nodejs-map 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +95 -2
- package/dist/app/assets/LearnView-Cqz9Ux8w.js +3 -0
- package/dist/app/assets/LearnView-Cqz9Ux8w.js.map +1 -0
- package/dist/app/assets/LearnView-Nrw6YQU8.css +1 -0
- package/dist/app/assets/app.worker-DZKurLgd.js +8 -0
- package/dist/app/assets/app.worker-DZKurLgd.js.map +1 -0
- package/dist/app/assets/atlas.worker-DGHewGIv.js +2 -0
- package/dist/app/assets/atlas.worker-DGHewGIv.js.map +1 -0
- package/dist/app/assets/cm-BTWjV_Gb.js +13 -0
- package/dist/app/assets/cm-BTWjV_Gb.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-Dv4HNg5q.js +2 -0
- package/dist/app/assets/dist-Dv4HNg5q.js.map +1 -0
- package/dist/app/assets/index-BRoted4h.css +1 -0
- package/dist/app/assets/index-eLItdROg.js +18 -0
- package/dist/app/assets/index-eLItdROg.js.map +1 -0
- package/dist/app/assets/map-CISW7_cc.css +1 -0
- package/dist/app/assets/map-mCCk9DTc.js +132 -0
- package/dist/app/assets/map-mCCk9DTc.js.map +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/search.json +1 -0
- package/dist/cli.js +6268 -0
- package/dist/examples.json +1 -0
- package/dist/learn/async-await.json +1 -0
- package/dist/learn/backpressure.json +1 -0
- package/dist/learn/big-picture.json +1 -0
- package/dist/learn/blocking-the-loop.json +1 -0
- package/dist/learn/breakpoints.json +1 -0
- package/dist/learn/call-stack.json +1 -0
- package/dist/learn/first-run.json +1 -0
- package/dist/learn/follow-readfile.json +1 -0
- package/dist/learn/four-threads-six-jobs.json +1 -0
- package/dist/learn/glossary.json +1 -0
- package/dist/learn/hiding-areas.json +1 -0
- package/dist/learn/http-one-request.json +1 -0
- package/dist/learn/http-two-requests.json +1 -0
- package/dist/learn/img/big-picture.webp +0 -0
- package/dist/learn/img/first-run-queues.webp +0 -0
- package/dist/learn/img/hide-restore-strip.webp +0 -0
- package/dist/learn/img/hide-view-menu.webp +0 -0
- package/dist/learn/img/map-call-path.webp +0 -0
- package/dist/learn/img/marks-in-a-run.webp +0 -0
- package/dist/learn/img/paused-at-breakpoint.webp +0 -0
- package/dist/learn/img/paused-in-node-fs.webp +0 -0
- package/dist/learn/img/playback-bar.webp +0 -0
- package/dist/learn/img/save-and-share.webp +0 -0
- package/dist/learn/img/tour-areas.webp +0 -0
- package/dist/learn/index.json +390 -0
- package/dist/learn/keep-alive.json +1 -0
- package/dist/learn/loop-phases.json +1 -0
- package/dist/learn/many-clients.json +1 -0
- package/dist/learn/microtasks-belong-to-v8.json +1 -0
- package/dist/learn/next-tick.json +1 -0
- package/dist/learn/observed-and-inferred.json +1 -0
- package/dist/learn/one-libuv-timer.json +1 -0
- package/dist/learn/order-and-esm.json +1 -0
- package/dist/learn/pipeline-errors.json +1 -0
- package/dist/learn/playback.json +1 -0
- package/dist/learn/pool-size.json +1 -0
- package/dist/learn/prerequisites.json +1 -0
- package/dist/learn/probe-build.json +1 -0
- package/dist/learn/promises-and-microtasks.json +1 -0
- package/dist/learn/reading-a-file.json +1 -0
- package/dist/learn/rec/async-await-chain.nmrec.gz +0 -0
- package/dist/learn/rec/backpressure.nmrec.gz +0 -0
- package/dist/learn/rec/beforeexit-and-exit.nmrec.gz +0 -0
- package/dist/learn/rec/block-loop.nmrec.gz +0 -0
- package/dist/learn/rec/dns-lookup-thread-pool.nmrec.gz +0 -0
- package/dist/learn/rec/esm-twist.nmrec.gz +0 -0
- package/dist/learn/rec/eventemitter-is-synchronous.nmrec.gz +0 -0
- package/dist/learn/rec/first-run.nmrec.gz +0 -0
- package/dist/learn/rec/fs-promises-await.nmrec.gz +0 -0
- package/dist/learn/rec/fs-sync-vs-async.nmrec.gz +0 -0
- package/dist/learn/rec/http-blocking-fixed.nmrec.gz +0 -0
- package/dist/learn/rec/http-blocking.nmrec.gz +0 -0
- package/dist/learn/rec/http-keep-alive.nmrec.gz +0 -0
- package/dist/learn/rec/http-roundtrip.nmrec.gz +0 -0
- package/dist/learn/rec/http-two-requests.nmrec.gz +0 -0
- package/dist/learn/rec/interval-and-clear.nmrec.gz +0 -0
- package/dist/learn/rec/nested-ticks-and-microtasks.nmrec.gz +0 -0
- package/dist/learn/rec/next-tick.nmrec.gz +0 -0
- package/dist/learn/rec/pbkdf2-six-jobs-four-threads.nmrec.gz +0 -0
- package/dist/learn/rec/phase-check.nmrec.gz +0 -0
- package/dist/learn/rec/phase-close.nmrec.gz +0 -0
- package/dist/learn/rec/phase-io.nmrec.gz +0 -0
- package/dist/learn/rec/pipeline-error.nmrec.gz +0 -0
- package/dist/learn/rec/pool-users.nmrec.gz +0 -0
- package/dist/learn/rec/pool-with-two-threads.nmrec.gz +0 -0
- package/dist/learn/rec/promise-microtasks.nmrec.gz +0 -0
- package/dist/learn/rec/readfile-thread-pool.nmrec.gz +0 -0
- package/dist/learn/rec/run-to-completion.nmrec.gz +0 -0
- package/dist/learn/rec/split-work.nmrec.gz +0 -0
- package/dist/learn/rec/stream-pipeline-file.nmrec.gz +0 -0
- package/dist/learn/rec/streams-memory.nmrec.gz +0 -0
- package/dist/learn/rec/tcp-many-clients.nmrec.gz +0 -0
- package/dist/learn/rec/tcp-round-trip.nmrec.gz +0 -0
- package/dist/learn/rec/tick-before-promise.nmrec.gz +0 -0
- package/dist/learn/rec/timeout-vs-immediate-io.nmrec.gz +0 -0
- package/dist/learn/rec/timeout-vs-immediate-main.nmrec.gz +0 -0
- package/dist/learn/rec/timer-lateness.nmrec.gz +0 -0
- package/dist/learn/rec/timer-vs-file-read.nmrec.gz +0 -0
- package/dist/learn/rec/timers-phase.nmrec.gz +0 -0
- package/dist/learn/rec/unref-timer.nmrec.gz +0 -0
- package/dist/learn/save-and-share.json +1 -0
- package/dist/learn/slow-handler.json +1 -0
- package/dist/learn/splitting-work.json +1 -0
- package/dist/learn/staying-alive.json +1 -0
- package/dist/learn/stepping-into-node.json +1 -0
- package/dist/learn/streams-basics.json +1 -0
- package/dist/learn/tcp-step-by-step.json +1 -0
- package/dist/learn/the-map.json +1 -0
- package/dist/learn/three-marks.json +1 -0
- package/dist/learn/timeout-vs-immediate.json +1 -0
- package/dist/learn/timers-are-not-now.json +1 -0
- package/dist/learn/tour.json +1 -0
- package/dist/learn/what-it-is.json +1 -0
- package/dist/learn/what-uses-the-pool.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 +507 -0
- package/package.json +25 -4
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./cm-BTWjV_Gb.js","./dist-B37Ex44M.js","./map-mCCk9DTc.js","./map-CISW7_cc.css","./LearnView-Cqz9Ux8w.js","./LearnView-Nrw6YQU8.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),se(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,ue(a,n,o),r.__=r.__e=null,n.__e!=i&&T(n))}function T(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),T(e)}function E(t){(8&t.__g||(t.__g|=8,r.push(t),a++))&&i==e.debounceRendering||((i=e.debounceRendering)||queueMicrotask)(D)}function D(){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)(D)}}function ee(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=te(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=se(e,h,m,i,a,o,s,c,l,u),g=h.__e,(m.ref!=h.ref||8&m.__u)&&(m.ref&&fe(m.ref,null,h,m),h.ref&&u.push(h.ref,h.__c||g,h)),_||=g,4&h.__u?(c=ne(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 te(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=re(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)),pe(s,s));return r}function ne(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=ne(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 re(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 ie(e,t,n){n??=``,t[0]==`-`?e.setProperty(t,n):e[t]=n}function ae(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||ie(e.style,t);if(n)for(t in n)r&&n[t]==r[t]||ie(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]=oe(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 oe(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 se(t,n,r,i,a,o,s,c,l,u){var f,m,g,y,b,w,T,E,D,te,ne,re,ie,ae,oe,se,ue,fe,he=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=ce(f,o):o.push(f),c=o[0]||c),(f=e.__b)&&f(n);e:if(typeof he==`function`){g=s.length;try{if(E=n.props,D=(f=he.prototype)&&f.render,te=(f=he.contextType)&&i[f.__c],ne=f?te?te.props.value:f.__:i,(y=r.__c)?(n.__c=y,2&y.__g&&(y.__g|=1)):(D?n.__c=y=new he(E,ne):(n.__c=y=new S(E,ne),y.constructor=he,y.render=me),te&&te.sub(y),y.state||(y.state={}),y.__n=i,y.__g|=8,y.__h=[],y.__k=[]),D&&(y.__s||(y.__s=y.state),he.getDerivedStateFromProps&&(y.__s==y.state&&(y.__s=_({},y.__s)),_(y.__s,he.getDerivedStateFromProps(E,y.__s)))),b=y.props,w=y.state,y.__v=n,r.__c){if(E!==b&&D&&!he.getDerivedStateFromProps&&y.componentWillReceiveProps&&y.componentWillReceiveProps(E,ne),n.__v==r.__v&&!(8&y.__g)||!(4&y.__g)&&y.shouldComponentUpdate&&!1===y.shouldComponentUpdate(E,y.__s,ne)){n.__v!=r.__v&&(y.props=E,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(E,y.__s,ne),D&&y.componentDidUpdate&&y.__h.push(function(){y.componentDidUpdate(b,w,T)})}else D&&!he.getDerivedStateFromProps&&y.componentWillMount&&y.componentWillMount(),D&&y.componentDidMount&&y.__h.push(y.componentDidMount);y.context=ne,y.props=E,y.__P=t,y.__g&=-5,re=e.__r,ie=D?25:0;do y.__g&=-9,re&&re(n),f=y.render(y.props,y.state=y.__s,y.context);while(8&y.__g&&++ie<25);D&&(p.push.apply(y.__h,y.__k),y.__k=[]),y.state=y.__s,y.getChildContext&&(i=_({},i,y.getChildContext())),D&&r.__c&&y.getSnapshotBeforeUpdate&&(T=y.getSnapshotBeforeUpdate(b,w)),ae=f&&f.type===x&&f.key==null?f.props.children:f,E.__P&&(f=c,a=(t=E.__P).namespaceURI,l=o=null,r.props&&r.props.__P!=t&&(r.__k.some(function(e){e&&pe(e,e)}),r.__k=null),c=r.__k?C(r,0):null),c=ee(t,h(ae)?ae:[ae],n,r,i,a,o,s,c,l,u),E.__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(~(ue=o.indexOf(c||void 0))||(ue=o.length);(fe=o[ue-1])&&fe.nodeType==8;)ue--;for(;ue<o.length;ue++)if(fe=o[ue]){if(o[ue]=null,oe){if(fe==se)break}else{if(fe.nodeType!=8)break;fe.data.startsWith(`$s`)&&(se=ce(oe=fe))}}}if(!oe){for(;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;oe=c}(f=ce(oe=n.__c.__z||(n.__c.__z=oe)))?(n.__e=oe,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||le(n),e.__e(t,n,r)}}else c=n.__e=de(r.__e,n,r,i,a,o,s,l,u,t);return(f=e.diffed)&&f(n),c}function ce(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 le(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(le))}function ue(t,n,r){for(var i=0;i<r.length;)fe(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 de(t,n,r,i,a,o,s,c,l,u){var d,p,_,y,b,x,S,w,T=r.props||f,E=n.props,D=n.type;if(D==`svg`?a=`http://www.w3.org/2000/svg`:D==`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])&&(D?b.localName==D:b.nodeType==3)){t=b,o[d]=null;break}}if(!t){if(w=u.ownerDocument||document,!D)return w.createTextNode(E);t=w.createElementNS(a,D,E.is?E:u),c&&=(e.__m&&e.__m(n,o),!1),o=null}if(D){if(u=D==`template`&&t.content||t,o=D==`textarea`&&E.defaultValue!=null?null:o&&g.call(u.childNodes),!c&&o)for(T={},d=0;d<t.attributes.length;d++)T[(b=t.attributes[d]).name]=b.value;for(d in T)b=T[d],d==`dangerouslySetInnerHTML`?_=b:d==`children`||d in E||d==`value`&&`defaultValue`in E||d==`checked`&&`defaultChecked`in E||ae(t,d,null,b,a);for(d in E)b=E[d],d==`children`?y=b:d==`dangerouslySetInnerHTML`?p=b:d==`value`?x=b:d==`checked`?S=b:c&&typeof b!=`function`||T[d]===b||ae(t,d,b,T[d],a);p?(c||_&&(p.__html==_.__html||p.__html==t.innerHTML)||(t.innerHTML=p.__html),n.__k=[]):(_&&(t.textContent=``),(D==`foreignObject`||a==`http://www.w3.org/1998/Math/MathML`&&m.test(D))&&(a=`http://www.w3.org/1999/xhtml`),ee(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&&D!=`textarea`||(d=`value`,D==`progress`&&x==null?t.removeAttribute(d):x==null||x===t[d]&&(D!=`progress`||x)||ae(t,d,x,T[d],a),d=`checked`,S!=null&&S!=t[d]&&ae(t,d,S,T[d],a))}else T===E||c&&t.data==E||(t.data=E);return t}function fe(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 pe(t,n,r){var i,a,o,s;if(e.unmount&&e.unmount(t),!(i=t.ref)||i.current&&i.current!=t.__e||fe(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]&&pe(i[s],n,typeof t.type!=`function`||r&&!t.props.__P);!r&&(i=t.__c)&&(i=i.__z)&&(a=ce(i,o=[]))&&(i==t.__e&&o.some(v),v(a),v(i)),r||v(t.__e),t.__e=t.__c=t.__=null}function me(e,t,n){return this.constructor(e,n)}function he(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=[],se(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),ue(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),E(this)))},S.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),E(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 ge=new Set;function _e(e){if(!ge.has(e)){ge.add(e);try{performance.mark(`nm:${e}`)}catch{}}}var ve,ye,be,xe,Se=Object.is,Ce=0,we=[],Te=[],Ee=e,De=Ee.__b,Oe=Ee.__r,ke=Ee.diffed,Ae=Ee.__c,je=Ee.unmount,Me=Ee.__;function Ne(e,t){Ee.__h&&Ee.__h(ye,e,Ce||t),Ce=0;var n=ye.__H||(ye.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function O(e){return Ce=1,Pe(Ke,e)}function Pe(e,t,n){var r=Ne(ve++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ke(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=ye,!ye.__f)){ye.__f=!0;var i=ye.shouldComponentUpdate;ye.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 k(e,t){var n=Ne(ve++,3);!Ee.__s&&Ge(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,ye.__H.__h.push(n))}function Fe(e,t){var n=Ne(ve++,4);!Ee.__s&&Ge(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,ye.__h.push(n))}function A(e){return Ce=5,Ie(function(){return{current:e}},[])}function Ie(e,t){var n=Ne(ve++,7);return Ge(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function Le(e,t){return Ce=8,Ie(function(){return e},t)}function Re(){var e=Ne(ve++,11);if(!e.__){for(var t=ye.__v;!t.__m&&t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__=`P`+n[0]+`-`+n[1]++}return e.__}function ze(){var e;do{for(;e=Te.shift();)try{Ue(e)}catch(t){Ee.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=we.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ue),t.__h.some(We),t.__h=[]}catch(n){t.__h=[],Ee.__e(n,e.__v)}}}while(Te.length)}Ee.__b=function(e){ye=null,De&&De(e)},Ee.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Me&&Me(e,t)},Ee.__r=function(e){Oe&&Oe(e),ve=0;var t=(ye=e.__c).__H;t&&(be==ye?ye.__h=[]:(t.__h.some(Ue),t.__h.some(We),ve=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),be=ye},Ee.diffed=function(e){ke&&ke(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&He(we.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),be=ye=null},Ee.__c=function(e,t){t.some(function(e){try{e.__h.some(Ue),e.__h=e.__h.filter(function(e){return!e.__||We(e)})}catch(t){e.__h=[function(){throw t}]}}),Ae&&Ae(e,t)},Ee.unmount=function(e){je&&je(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,He(Te.push(r))}else Ue(r)}catch(e){t=e}}),r.__H=void 0,t&&Ee.__e(t,r.__v))};var Be=typeof requestAnimationFrame==`function`;function Ve(e){var t,n=function(){clearTimeout(r),Be&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Be&&(t=requestAnimationFrame(n))}function He(e){e!=1&&xe==Ee.requestAnimationFrame||((xe=Ee.requestAnimationFrame)||Ve)(ze)}function Ue(e){var t=ye,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),ye=t}function We(e){var t=ye;e.__c=e.__(),ye=t}function Ge(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!Se(t,e[n])})}function Ke(e,t){return typeof t==`function`?t(e):t}var qe=Symbol.for(`pv`),Je=0;Array.isArray;function j(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:qe,__v:--Je,__i:-1,__u:0};return(a||o)&&(u.__source=a,u.__self=o),e.vnode&&e.vnode(u),u}var Ye=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),Xe=function(e,t){return new URL(e,t).href},Ze={},Qe={},$e=function(e){return e.pathname.endsWith(`.css`)},et=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},tt=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=Xe(t,n);let r=s(t),i=$e(r);return et(Ze,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?Qe[r.href]:void 0;if(!n&&t.has(r.href))return;let o=document.createElement(`link`);if(o.rel=i?`stylesheet`:Ye,i||(o.as=`script`),o.crossOrigin=``,o.href=r.href,a&&o.setAttribute(`nonce`,a),n&&delete Qe[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`?(Qe[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)})},nt=null;function rt(){return nt??=tt(()=>import(`./cm-BTWjV_Gb.js`).then(e=>e.t),__vite__mapDeps([0,1]),import.meta.url),nt}function it(e){let t=A(null),n=A(null),[r,i]=O(!1),[a,o]=O(!1),s=A(e);s.current=e;let c=e.onToggleBreakpoint!==void 0,l=A(null),u=A(0);k(()=>{let e=!0;return rt().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),_e(`editor`)},()=>{e&&o(!0)}),()=>{e=!1,n.current?.destroy(),n.current=null}},[c]),k(()=>{e.text===l.current?u.current=0:u.current>0?u.current--:n.current?.setDoc(e.text)},[r,e.text]),k(()=>{n.current?.setLanguage(e.language)},[r,e.language]),k(()=>{n.current?.setReadOnly(e.readOnly)},[r,e.readOnly]),k(()=>{n.current?.setLabel(e.label)},[r,e.label]),k(()=>{n.current?.setBreakpoints(e.breakpoints??[],e.breakpointsActive!==!1)},[r,e.breakpoints,e.breakpointsActive,e.text]);let d=e.lineMark?.line,f=e.lineMark?.kind,p=e.lineMark?.tag,m=A(0);return k(()=>{let e=0,r,i=()=>{let a=t.current;if(!n.current||!a)return;if(a.offsetParent===null||document.hidden){r=setTimeout(()=>{e=requestAnimationFrame(i)},250);return}let o=s.current.lineMark??null,c=performance.now(),l=o!==null&&(o.kind===`paused`||o.kind===`frame`||c-m.current>500);l&&(m.current=c),n.current.setLineMark(o,l)};return e=requestAnimationFrame(i),()=>{cancelAnimationFrame(e),clearTimeout(r)}},[r,d,f,p,e.text]),k(()=>{n.current?.setRange(e.range??null,!0)},[r,e.range?.start,e.range?.end,e.revealKey,e.text]),j(`div`,{class:`code`,children:[j(`div`,{ref:t,class:`code__cm`}),r?null:j(`pre`,{class:`code__plain mono`,tabIndex:0,"aria-label":e.label,children:e.text}),a?j(`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 at={enabled:!0,reason:null},ot=e=>({enabled:!1,reason:e}),st={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.`,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 ct(e,t){let n=t[`gates.${e}`]??t.gates;if(n)return n;switch(e){case`phase`:return st.gatePhase;case`timer`:return st.gateTimer;case`poolStart`:return st.gatePoolStart;case`poolPost`:return st.gatePoolPost}}function lt(e){let{connected:t,provider:n,notes:r,status:i}=e,a=n?.caps??null,o=i===`running`||i===`paused`||i===`gated`,s=t?n?n.available?i===`starting`?st.starting:null:n.why??st.providerUnavailable:st.noProvider:st.notConnected,c=s??(a&&!a.jsDebugger?r.jsDebugger??st.jsDebugger:null),l=e=>t?i===`starting`?ot(st.starting):o?e?e():at:ot(st.nothingRunning):ot(st.notConnected),u=e=>a&&!a.jsDebugger?ot(r.jsDebugger??st.jsDebugger):l(()=>i===`gated`?ot(st.atGate):e?i===`paused`?at:ot(st.notPaused):i===`paused`?ot(st.alreadyPaused):at),d=(e,s)=>t?!a||!a.gates[e]?ot(ct(e,r)):s===`arm`&&!o?i===`starting`?ot(st.starting):n&&!n.available?ot(n.why??st.providerUnavailable):at:l(()=>s===`resume`?i===`gated`?at:ot(st.notAtGate):at):ot(st.notConnected);return{run:s?ot(s):at,debug:c?ot(c):at,stop:t?o||i===`starting`?at:ot(st.nothingRunning):ot(st.notConnected),pause:u(!1),resume:u(!0),stepOver:u(!0),stepInto:u(!0),stepOut:u(!0),pauseAtNextPhase:d(`phase`,`arm`),stepPhase:d(`phase`,`act`),runToPhase:d(`phase`,`act`),gateTimer:d(`timer`,`arm`),gatePoolStart:d(`poolStart`,`arm`),gatePoolPost:d(`poolPost`,`arm`),gateResume:d(`phase`,`resume`)}}function ut(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 dt=`nodejs-map/atlas@1`,ft=`nodejs-map/atlas-chunk@1`,pt=`nodejs-map/atlas-files@1`,mt=`nodejs-map/atlas-search@1`,ht=`nodejs-map/atlas-edges@1`,gt=[`id`,`p`,`k`,`n`,`x`,`y`,`w`,`h`,`a`,`b`,`v`],_t=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}},vt=50,yt=new Set([`unix`,`linux`,`darwin`,`win`]),bt=new Set([`region`,`group`,`feature`,`single`]),xt=new Set([`d`,`f`,`s`]),St=/^(?!\/)(?!.*(^|\/)\.\.(\/|$))[A-Za-z0-9_@+.,~=\-/]+$/,Ct=/^(?!\/)(?!.*(^|\/)\.\.(\/|$))[A-Za-z0-9_.\-/]+\.json$/,wt=class{problems=[];fail(e){this.problems.length<vt&&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`&&St.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&&!yt.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 Tt(e,t,n){if(e.problems.length)throw new _t(t,e.problems);return n}function Et(e){let t=new wt;if(!t.isObj(e,`index`))return Tt(t,`index`,e);e.schema!==`nodejs-map/atlas@1`&&t.fail(`schema: expected "${dt}", 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`&&Ct.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`),bt.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`&&Ct.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 Tt(t,`index`,e)}function Dt(e,t){let n=new wt;if(!n.isObj(e,`chunk`))return Tt(n,`chunk`,e);e.schema!==`nodejs-map/atlas-chunk@1`&&n.fail(`schema: expected "${ft}"`),n.str(e.id,`id`),n.str(e.group,`group`),JSON.stringify(e.cols)!==JSON.stringify(gt)&&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`),xt.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 Tt(n,`chunk`,e)}function Ot(e,t){let n=new wt;return n.isObj(e,`files`)&&(e.schema!==`nodejs-map/atlas-files@1`&&n.fail(`schema: expected "${pt}"`),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`)),Tt(n,`files`,e)}function kt(e){let t=new wt;return t.isObj(e,`search`)&&(e.schema!==`nodejs-map/atlas-search@1`&&t.fail(`schema: expected "${mt}"`),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`)),Tt(t,`search`,e)}function At(e){let t=new wt;return t.isObj(e,`edges`)&&(e.schema!==`nodejs-map/atlas-edges@1`&&t.fail(`schema: expected "${ht}"`),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`)),Tt(t,`edges`,e)}var jt=`nodejs/node`,Mt=e=>e.split(`/`).map(encodeURIComponent).join(`/`),Nt=(e,t)=>e?t&&t!==e?`#L${e}-L${t}`:`#L${e}`:``;function Pt(e,t,n,r){return`https://github.com/${jt}/blob/${e}/${Mt(t)}${Nt(n,r)}`}function Ft(e,t){return`https://github.com/${jt}/tree/${e}/${Mt(t)}`}function It(e,t,n,r){return`https://github.dev/${jt}/blob/${e}/${Mt(t)}${Nt(n,r)}`}var Lt=`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 Rt(e,t){return`https://raw.githubusercontent.com/${jt}/${e}/${Mt(t)}`}function zt(e,t){return e===void 0?!0:e===`win`?t===`win32`:e===`unix`?t===`linux`||t===`darwin`:e===t}function Bt(e,t){let n,r=-1;for(let i of e){if(!zt(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 Vt(e,t,n){let r=Bt(t.ranges,n);if(r)return{github:Pt(e,r.path,r.start,r.end),githubDev:It(e,r.path,r.start,r.end),raw:Rt(e,r.path),range:r};if(t.file)return{github:Pt(e,t.file.path),githubDev:It(e,t.file.path),raw:Rt(e,t.file.path)};if(t.tree)return{github:Ft(e,t.tree)}}function Ht(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 Ut={d:`dir`,f:`file`,s:`fn`},Wt=`o:world`;function Gt(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 Kt(e,t){let[n,r,i,a,o,s,c,l,u,d,f]=e,p={id:n,parent:r,kind:Ut[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 qt=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=Et(await this.#e(this.#t));this.#n=e;for(let t of e.boxes)this.#u(Gt(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===Wt)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=Dt(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(Kt(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=Ot(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=Ht(e);return n?this.locate(n,t):void 0}pickRange(e,t){return Bt(e.ranges,t)}links(e,t){return Vt(this.commit,e,t)}async search(e,t=20){this.#c??=this.#e(this.index.search).then(e=>kt(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(At),this.#l}boxesOfTier(e){return this.index.boxes.filter(t=>t.t===e).map(e=>this.#r.get(e.id))}},M={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.`}},Jt={timers:M.phaseTimers.id,pending:M.phasePending.id,idle:M.phaseIdle.id,prepare:M.phasePrepare.id,poll:M.phasePoll.id,check:M.phaseCheck.id,closing:M.phaseClosing.id},Yt={Timeout:{id:M.listOnTimeout.id,title:`setTimeout / setInterval timer`,meaning:`setTimeout / setInterval timer; its callback runs from listOnTimeout.`},Immediate:{id:M.immediateProcess.id,title:`setImmediate`,meaning:`setImmediate; its callback runs from processImmediate in the check phase.`},TickObject:{id:M.tickDrain.id,title:`process.nextTick`,meaning:`process.nextTick; its callback runs from processTicksAndRejections.`},PROMISE:{id:M.promiseReactionRun.id,title:`promise`,meaning:`A promise (reported while an async hook is enabled); its reactions run as microtasks.`},Microtask:{id:M.microtaskCallback.id,title:`queueMicrotask`,meaning:`queueMicrotask callback; runs from the microtask queue via runMicrotask.`},FSREQCALLBACK:{id:M.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:M.fsReqPromise.id,title:`fs/promises request`,meaning:`fs/promises request.`},PBKDF2REQUEST:{id:M.cryptoJobAfter.id,title:`pbkdf2 request`,meaning:`crypto.pbkdf2 job; work in PBKDF2Traits::DeriveBits on the pool.`},RANDOMBYTESREQUEST:{id:M.cryptoJobAfter.id,title:`randomBytes request`,meaning:`crypto.randomBytes / randomFill job; work in RandomBytesTraits::DeriveBits on the pool.`},SCRYPTREQUEST:{id:M.cryptoJobAfter.id,title:`scrypt request`,meaning:`crypto.scrypt job on the pool.`},GETADDRINFOREQWRAP:{id:M.dnsAfterGetAddrInfo.id,title:`dns.lookup request`,meaning:`dns.lookup request; getaddrinfo runs on the pool.`},ZLIB:{id:M.zlibAfter.id,title:`zlib stream`,meaning:`zlib stream; each chunk is compressed on the pool.`},TCPWRAP:{id:M.streamRead.id,title:`TCP connection`,meaning:`TCP socket handle; reads arrive in the poll phase.`},TCPSERVERWRAP:{id:M.onConnection.id,title:`TCP server`,meaning:`TCP server handle; new connections arrive in the poll phase.`},TCPCONNECTWRAP:{id:M.afterConnect.id,title:`TCP connect request`,meaning:`Outgoing TCP connect request.`},PIPEWRAP:{id:M.streamRead.id,title:`pipe`,meaning:`Pipe handle (also stdio pipes).`},PIPECONNECTWRAP:{id:M.afterConnect.id,title:`pipe connect request`,meaning:`Outgoing pipe connect request.`},TTYWRAP:{id:M.streamRead.id,title:`terminal (TTY)`,meaning:`TTY handle (terminal stdio).`},WRITEWRAP:{id:M.streamAfterWrite.id,title:`stream write`,meaning:`A stream write request.`},SHUTDOWNWRAP:{id:M.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:M.udpRecv.id,title:`UDP socket`,meaning:`UDP socket handle.`},PROCESSWRAP:{id:M.processExit.id,title:`child process`,meaning:`Child process handle.`},FSEVENTWRAP:{id:M.fsEvent.id,title:`fs.watch watcher`,meaning:`fs.watch handle.`},STATWATCHER:{id:M.statWatcher.id,title:`fs.watchFile watcher`,meaning:`fs.watchFile handle.`},HTTPINCOMINGMESSAGE:{id:M.httpIncoming.id,title:`HTTP incoming message`,meaning:`HTTP incoming message (server request or client response).`},QUERYWRAP:{id:M.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:M.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:M.onConnection.id,title:`pipe server`,meaning:`Pipe (named pipe / Unix socket) server handle; new connections arrive in the poll phase.`},UDPSENDWRAP:{id:M.udpSendDone.id,title:`UDP send`,meaning:`A UDP send request.`},STREAM_END_OF_STREAM:{id:M.streamFinished.id,title:`stream finished callback`,meaning:`stream.finished / pipeline callback, bound to the context where it was registered.`},MESSAGEPORT:{id:M.messagePortOnMessage.id,title:`MessagePort (worker messages)`,meaning:`A message channel between threads; messages are delivered by MessagePort::OnMessage.`},WORKER:{id:M.workerExit.id,title:`worker thread`,meaning:`A worker_threads Worker as seen from the parent thread.`},HTTPCLIENTREQUEST:{id:M.httpClientRequest.id,title:`HTTP client request`,meaning:`HTTP client request.`}},Xt=Object.fromEntries(Object.entries(Yt).map(([e,t])=>[e,t.id])),Zt={nextTick:`nextTick queue`,microtask:`Microtask queue`,timers:`Timers`,immediate:`Immediates`,pool:`Thread pool requests`,io:`Pending I/O`,close:`Close callbacks`},Qt={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.`},$t={timers:`timers`,pending:`pending`,idle:`idle`,prepare:`prepare`,poll:`poll`,check:`check`,closing:`close`},en={hooks:`async_hooks`,trace:`trace events`,cdp:`debugger`,probe:`probe build`,helper:`helper`,rule:`rule`},tn={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.`},nn=new Intl.NumberFormat(`en`,{maximumFractionDigits:1,minimumFractionDigits:1}),rn=new Intl.NumberFormat(`en`,{maximumFractionDigits:3,minimumFractionDigits:3}),an=new Intl.NumberFormat(`en`,{maximumFractionDigits:0});function on(e){if(!Number.isFinite(e))return`-`;let t=Math.abs(e);return t<1e3?`${an.format(e)} µs`:t<1e6?`${rn.format(e/1e3)} ms`:`${rn.format(e/1e6)} s`}function sn(e){return Number.isFinite(e)?Math.abs(e)<1e3?`${nn.format(e)} ms`:`${nn.format(e/1e3)} s`:`-`}function cn(e){return an.format(e)}function ln(e,t,n=`${t}s`){return`${cn(e)} ${e===1?t:n}`}function un(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 dn(e,t){return e===t||!e.startsWith(`node:`)&&un(e)===un(t)}function fn(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 pn={GETNAMEINFOREQWRAP:`dns.lookupService request`};function mn(e){let t=Yt[e]?.title;if(t)return t;let n=pn[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 hn(e){let t=e.label?fn(e.label,60):mn(e.type);return t?`${t} #${e.id} (${e.type})`:`${e.type} #${e.id}`}var gn=[`run`,`output`,`callbacks`,`queues`,`loop`,`timers`,`pool`,`items`,`debug`,`signals`],_n={run:`Run`,output:`Output`,callbacks:`Callbacks`,queues:`Queues`,loop:`Loop`,timers:`Timers`,pool:`Pool`,items:`Items`,debug:`Debugger`,signals:`Raw signals`},vn=Symbol.for(`preact-signals`);function yn(){if(wn>1)wn--;else{var e,t=!1;for((function(){var e=On;for(On=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}})();Cn!==void 0;){var n=Cn;for(Cn=void 0,Tn++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Mn(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(Tn=0,wn--,t)throw e}}function bn(e){if(wn>0)return e();Dn=++En,wn++;try{return e()}finally{yn()}}var xn,N=void 0;function Sn(e){var t=N,n=xn;N=void 0,xn=void 0;try{return e()}finally{N=t,xn=n}}var Cn=void 0,wn=0,Tn=0,En=0,Dn=0,On=void 0,kn=0;function An(e){if(N!==void 0){var t=e.n;if(t===void 0||t.t!==N)return t={i:0,S:e,p:N.s,n:void 0,t:N,e:void 0,x:void 0,r:t},N.s!==void 0&&(N.s.n=t),N.s=t,e.n=t,32&N.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=N.s,t.n=void 0,N.s.n=t,N.s=t),t}}function jn(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}jn.prototype.brand=vn,jn.prototype.h=function(){return!0},jn.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?Sn(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},jn.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&&Sn(function(){var e;(e=t.Z)==null||e.call(t)}))}},jn.prototype.subscribe=function(e){var t=this;return Bn(function(){var n=t.value;Sn(function(){return e(n)})},{name:`sub`})},jn.prototype.valueOf=function(){return this.value},jn.prototype.toString=function(){return this.value+``},jn.prototype.toJSON=function(){return this.value},jn.prototype.peek=function(){var e=this;return Sn(function(){return e.value})},Object.defineProperty(jn.prototype,"value",{get:function(){var e=An(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Tn>100)throw Error(`Cycle detected`);(function(e){wn!==0&&Tn===0&&e.l!==Dn&&(e.l=Dn,On={S:e,v:e.v,i:e.i,o:On})})(this),this.v=e,this.i++,kn++,wn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{yn()}}}});function P(e,t){return new jn(e,t)}function Mn(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 Nn(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 Pn(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 Fn(e,t){jn.call(this,void 0,t),this.x=e,this.s=void 0,this.g=kn-1,this.f=4}Fn.prototype=new jn,Fn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===kn))return!0;if(this.g=kn,this.f|=1,this.i>0&&!Mn(this))return this.f&=-2,!0;var e=N;try{Nn(this),N=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 N=e,Pn(this),this.f&=-2,!0},Fn.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)}jn.prototype.S.call(this,e)},Fn.prototype.U=function(e){if(this.t!==void 0&&(jn.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)}},Fn.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(Fn.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=An(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function F(e,t){return new Fn(e,t)}function In(e){var t=e.j;if(e.j=void 0,typeof t==`function`){wn++;var n=N;N=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Ln(e),t}finally{N=n,yn()}}}function Ln(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,In(e)}function Rn(e){if(N!==this)throw Error(`Out-of-order effect`);Pn(this),N=e,this.f&=-2;try{8&this.f&&Ln(this)}finally{yn()}}function zn(e,t){this.x=e,this.j=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,xn&&xn.push(this)}zn.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()}},zn.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,In(this),Nn(this),wn++;var e=N;return N=this,Rn.bind(this,e)},zn.prototype.N=function(){2&this.f||(this.f|=2,this.u=Cn,Cn=this)},zn.prototype.d=function(){this.f|=8,1&this.f||Ln(this)},zn.prototype.dispose=function(){this.d()};function Bn(e,t){var n=new zn(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Vn,Hn,Un,Wn=typeof window<`u`&&!!window.__PREACT_SIGNALS_DEVTOOLS__,Gn=[],Kn=[];Bn(function(){Vn=this.N})();function qn(t,n){e[t]=n.bind(null,e[t]||function(){})}function Jn(e){if(Un){var t=Un;Un=void 0,t()}Un=e&&e.S()}function Yn(e){var t=this,r=e.data,i=Zn(r);i.name=`ReactiveDom`,i.value=r;var a=Ie(function(){for(var e=t,r=t.__v;r=r.__;)if(r.__c){r.__c.__$f|=4;break}var a=F(function(){var e=i.value.value;return e===0?0:!0===e?``:e||``}),o=F(function(){return!Array.isArray(a.value)&&!n(a.value)}),s=Bn(function(){if(this.N=rr,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}Yn.displayName=`ReactiveTextNode`,Object.defineProperties(jn.prototype,{constructor:{configurable:!0,value:y(x,null).constructor},type:{configurable:!0,value:Yn},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}}),qn(`__b`,function(e,t){if(Jn(),Hn=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 jn&&(n||(t.__np=n={}),n[i]=a,r[i]=a.peek())}}e(t)}),qn(`__r`,function(e,t){if(e(t),t.type!==x){Jn();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=function(e,t){var n;return Bn(function(){n=this},{name:t}),n.c=e,n}(function(e){return function(){var t;Wn&&((t=this.y)==null||t.call(this)),e.__$f|=1,e.setState({})}}(r),typeof t.type==`function`?t.type.displayName||t.type.name:``))),Hn=r,Jn(n)}}),qn(`__e`,function(e,t,n,r){Jn(),Hn=void 0,e(t,n,r)}),qn(`diffed`,function(e,t){Jn(),Hn=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=Xn(n,c,u,i),a[c]=l):l.o(u,i)}}e(t)});function Xn(e,t,n,r){var i=t in e&&e.ownerSVGElement===void 0,a=P(n);return{o:function(e,t){a.value=e,r=t},d:Bn(function(){this.N=rr;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))})}}qn(`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)}),qn(`__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 Zn(e,t){return Ie(function(){return P(e,t)},[])}var Qn=typeof requestAnimationFrame>`u`?setTimeout:function(e){var t=function(){clearTimeout(n),cancelAnimationFrame(r),e()},n=setTimeout(t,35),r=requestAnimationFrame(t)},$n=function(e){queueMicrotask(function(){queueMicrotask(e)})};function er(){bn(function(){for(var e;e=Gn.shift();)Vn.call(e)})}function tr(){Gn.push(this)===1&&(e.requestAnimationFrame||Qn)(er)}function nr(){bn(function(){for(var e;e=Kn.shift();)Vn.call(e)})}function rr(){Kn.push(this)===1&&(e.requestAnimationFrame||$n)(nr)}function ir(e,t){var n=A(e);n.current=e;var r=Hn;k(function(){return Bn(function(){if(this.N=tr,!(r&&8&r.__$f))return n.current()},t)},[])}var ar=[`cb.nextTick`,`cb.microtask`,`cb.timers`,`cb.immediate`,`cb.pool`,`cb.io`,`cb.close`,`cb.other`,`stdout`,`stderr`,`pause`,`pool`,`note`],or=[null,`timers`,`pending`,`idle`,`prepare`,`poll`,`check`,`closing`],sr=[null,`observed`,`inferred`,`model`],cr=e=>Object.assign(Object.create(null),e);cr({nextTick:0,microtask:1,timers:2,immediate:3,pool:4,io:5,close:6}),cr({timers:1,pending:2,idle:3,prepare:4,poll:5,check:6,closing:7});var lr=class extends Error{line;constructor(e,t){super(t===void 0?e:`line ${t}: ${e}`),this.name=`RecordingError`,this.line=t}},ur={text:1e6,name:512,frames:200,args:32,sources:64};function dr(e,t){throw new lr(`${e}: ${t}`)}var fr=e=>(t,n)=>(typeof t!=`string`&&dr(n,`must be a string`),t.length>e&&dr(n,`string longer than ${e}`),t),I=fr(ur.name),pr=fr(ur.text),mr=(e,t)=>(typeof e==`number`&&Number.isFinite(e)||dr(t,`must be a finite number`),e),hr=(e,t)=>(mr(e,t),e<0&&dr(t,`must not be negative`),e),gr=(e,t)=>(typeof e==`number`&&Number.isSafeInteger(e)||dr(t,`must be an integer`),e),_r=(e,t)=>((typeof e!=`number`||!Number.isInteger(e)||e<1||e>1024)&&dr(t,`must be a whole number from 1 to 1024`),e),L=(e,t)=>(gr(e,t),e<0&&dr(t,`must not be negative`),e),vr=(e,t)=>(typeof e!=`boolean`&&dr(t,`must be true or false`),e),yr=(...e)=>(t,n)=>(typeof t==`string`&&e.includes(t)||dr(n,`must be one of ${e.join(`, `)}`),t),br=e=>(t,n)=>t===null?null:e(t,n),R=e=>({check:e}),z=e=>({check:e,optional:!0});function xr(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Sr(e,t,n,r){xr(t)||dr(n,`must be an object`);let i={};for(let i of Object.keys(t))!Object.hasOwn(e,i)&&!(r&&r.has(i))&&dr(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||dr(n,`missing field "${r}"`):i[r]=a.check(o,n===``?r:`${n}.${r}`)}return i}var Cr=e=>(t,n)=>Sr(e,t,n),wr={url:R(I),line:R(L),col:z(L)},Tr={fn:R(I),loc:R(Cr(wr)),origin:R(yr(`user`,`node`,`other`)),at:z(I)},Er={version:R(I),v8:R(I),uv:R(I),platform:R(I),arch:R(I)},Dr=yr(`observed`,`inferred`,`model`),Or={provider:R(yr(`user`,`pinned`,`probe`)),jsDebugger:R(vr),asyncItems:R(vr),poolThreads:R(yr(`delayed`,`live`,`none`)),phasesTimersCheck:R(yr(`observed`,`inferred`,`model`,`none`)),phasesOther:R(yr(`observed`,`inferred`,`model`,`none`)),gates:R(Cr({phase:R(vr),timer:R(vr),poolStart:R(vr),poolPost:R(vr)})),frozenClock:R(vr)},kr=yr(`timers`,`pending`,`idle`,`prepare`,`poll`,`check`,`closing`),Ar=yr(`nextTick`,`microtask`,`timers`,`immediate`,`pool`,`io`,`close`),jr=(e,t)=>(Array.isArray(e)||dr(t,`must be a list`),e.length>ur.frames&&dr(t,`more than ${ur.frames} frames`),e.map((e,n)=>Sr(Tr,e,`${t}[${n}]`))),Mr=(e,t)=>{xr(e)||dr(t,`must be an object`);let n=Object.keys(e);n.length>ur.args&&dr(t,`more than ${ur.args} keys`);let r=Object.create(null);for(let i of n){i.length>ur.name&&dr(t,`key too long`);let n=e[i];n===null||typeof n==`boolean`||typeof n==`number`&&Number.isFinite(n)||typeof n==`string`&&n.length<=ur.text?r[i]=n:dr(`${t}.${i}`,`must be a string, a finite number, true, false or null`)}return Object.assign({},r)},Nr={k:R(I),t:R(mr),tq:z(yr(`approx`,`tie`)),src:R(yr(`hooks`,`trace`,`cdp`,`probe`,`helper`,`rule`)),c:R(Dr),rule:z(fr(32)),at:z(I),tid:z(L)},Pr={"run.start":{node:R(Cr(Er)),caps:R(Cr(Or)),mode:R(yr(`free`,`debug`)),program:R(I),poolSize:R(L)},"run.end":{code:R(br(gr)),signal:R(br(I))},output:{stream:R(yr(`stdout`,`stderr`)),text:R(pr),loc:z(Cr(wr))},"item.new":{id:R(L),type:R(I),trigger:R(L),label:z(I),loc:z(Cr(wr))},"callback.start":{id:R(L),type:R(I),close:z(vr)},"callback.end":{id:R(L)},"item.gone":{id:R(L)},"promise.settled":{id:R(L)},"timer.set":{id:R(L),delayMs:R(hr),repeat:R(vr)},"loop.sample":{loopCount:R(L),events:R(L),eventsWaiting:R(L)},scope:{name:R(I),durUs:R(hr)},"pool.thread":{edge:R(yr(`start`,`end`)),name:R(I)},signal:{cat:R(I),name:R(I),ph:R(fr(8)),ref:z(I),args:z(Mr)},"queue.add":{queue:R(Ar),id:R(L)},"queue.remove":{queue:R(Ar),id:R(L),why:R(yr(`cancel`,`gone`))},"loop.turn":{n:R(L)},"phase.enter":{phase:R(kr),turn:z(L),afterPoll:z(vr),pollTimeoutMs:z(mr)},"phase.leave":{phase:R(kr),turn:z(L),afterPoll:z(vr)},"timer.fired":{lateMs:z(mr)},"pool.queued":{job:R(I),kind:R(yr(`fs`,`dns`,`crypto`,`zlib`,`user`,`unknown`)),op:z(I),id:z(L)},"pool.started":{job:R(I),thread:R(L)},"pool.finished":{job:R(I),thread:R(L)},"pool.posted":{job:R(I),thread:R(L)},"pool.delivered":{job:R(I)},"pool.cancelled":{job:R(I)},"pool.link":{job:R(I),id:R(L)},"pool.size":{size:R(_r)},"debug.paused":{reason:R(yr(`breakpoint`,`step`,`pause`,`exception`,`entry`,`other`)),frames:R(jr),timeKeptRunning:R(vr)},"debug.resumed":{pausedMs:R(hr)},"gate.stopped":{gate:R(yr(`phase`,`turn`,`timer`,`poolStart`,`poolPost`,`poolDone`,`manual`)),phase:z(kr),job:z(I)},"gate.released":{stoppedMs:R(hr)},"clock.frozen":{why:z(yr(`gate`,`breakpoint`))},"clock.unfrozen":{hiddenMs:R(hr)},note:{level:R(yr(`info`,`warn`)),text:R(fr(2e3))}};new Set(Object.keys(Pr));var Fr=new Map;for(let e of Object.keys(Pr))Fr.set(e,{...Nr,...Pr[e]});var B={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`},V={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`},Ir=[{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:[B.callbackScopeCtor,B.callbackScopeClose,B.listOnTimeout,B.processImmediate,B.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:[B.runTimers,B.uvRunTimers,B.scheduleTimer,V.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:[B.processTimers,B.listOnTimeout,B.runTimers,V.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:[B.runTimers,B.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:[B.checkImmediate,V.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:[B.processImmediate,B.checkImmediate,V.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:[B.checkImmediate,B.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:[B.uvRunUnix,B.uvIoPollLinux,B.uvAsyncIo,B.workDone,V.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:[B.uvRunWin,B.uvPollWin,B.uvProcessReqs,B.uvAsyncWakeupWin,B.workDone,V.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:[B.uvRunUnix,B.uvRunWin,B.uvProcessReqs,B.streamIo,B.ioFeed,B.runPending,B.writeReqFinish,B.shutdownUnix,V.shutdownQueue,V.shutdownRun,V.phasePoll,V.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:[B.handleOnClose,B.closingUnix,B.closingWin,B.uvRunUnix,B.uvRunWin,V.handleOnClose,V.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:[B.queryResponse,B.checkImmediate,V.dnsQueryResponse,V.nativeImmediatesRun,V.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:[B.nextTick,B.processTicks,B.callbackScopeClose,V.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:[B.promiseBeforeHook,B.runMicrotask,B.processTicks,B.callbackScopeClose,V.microtaskDrain,V.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:[B.uvMetricsInfo,B.uvRunUnix,B.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:[B.checkImmediate,B.uvRunUnix,B.uvRunWin,V.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:[B.uvMetricsInfo,B.uvRunUnix,B.uvRunWin,V.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:[B.scheduleWork,B.workSubmit,B.workDone,V.poolSubmit,V.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:[B.scheduleWork,B.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:[B.scheduleWork,B.worker,V.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:[B.worker,B.post,B.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:[B.scheduleWork,B.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:[B.worker,B.workDone,V.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:[B.worker,B.post,B.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:[B.fsWorkUnix,B.fsWorkWin,B.getaddrinfoUnix,B.getaddrinfoWin,B.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:[B.workSubmit,B.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:[B.initThreads,B.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:[B.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:[B.timeoutCtor,B.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:[B.listOnTimeout,B.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:[B.immediateCtor,B.processImmediate,B.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:[B.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:[B.queueMicrotask,V.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:[B.promiseInitHook,V.performPromiseThen,V.triggerReactions,V.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:[V.promiseReactionEnqueue,V.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:[B.workSubmit,B.scheduleWork,V.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:[V.phasePoll,V.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:[B.timeoutCtor,B.immediateCtor]}],Lr=new Set([`C0`,`T2`,`I2`,`L1`,`W2`,`W4`,`W5`,`W6`,`X1`]),Rr=Ir.filter(e=>!Lr.has(e.id)),zr=Ir.filter(e=>Lr.has(e.id)),Br=new Map(Rr.map(e=>[e.id,e]));function Vr(e){return Br.get(e)}var Hr=new Set([`TCPWRAP`,`TCPSERVERWRAP`,`PIPEWRAP`,`PIPESERVERWRAP`,`TTYWRAP`,`UDPWRAP`,`PROCESSWRAP`,`SIGNALWRAP`,`FSEVENTWRAP`,`STATWATCHER`,`MESSAGEPORT`]),Ur=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 Wr(e){return Ur.get(e)}ar.length,typeof performance<`u`&&performance.now;var Gr=2e3,Kr=`rec=1.`,qr=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`,Jr=new Int8Array(128).fill(-1);for(let e=0;e<64;e++)Jr[qr.charCodeAt(e)]=e;var Yr=[`nextTick`,`microtask`,`timers`,`immediate`,`pool`,`io`,`close`];function Xr(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 Zr=e=>e.seq,Qr=e=>e.index;function $r(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 Yr){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:Xr(e.output.chunks,r,Zr)},log:t.full?t.log?.append??[]:Xr(e.log,t.log,Qr)}}var ei=[`observed`,`inferred`,`model`],ti={observed:`Observed`,inferred:`Inferred`,model:`Model`},ni={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.`},ri={observed:2,inferred:1,model:0};function ii(e,t){return ri[e]<=ri[t]?e:t}var ai=[{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`]}],oi=`app:phase-ring`;function si(e){if(e)return Vr(e)??zr.find(t=>t.id===e)??Wr(e)??ai.find(t=>t.id===e)}var ci={all:`Windows, macOS and Linux`,unix:`macOS and Linux`,win32:`Windows`},li=80;function ui(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 di(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 fi=new Set([`ArrowFunction`,`FunctionExpression`,`ClassExpression`]),pi=new Set([`extends`,`ParamList`,`ClassBody`,`Block`,`⚠`]);function mi(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||pi.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&&fi.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)mi(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&&fi.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 hi(e){return`u:${e.replace(/[\r\n#]/g,`_`).slice(0,200)}`}function gi(e,t,n){let r=hi(e),i=ui(t),a=t.length===0?1:di(i,t.length-+!!t.endsWith(`
|
|
6
|
+
`)),o=[{id:r,parent:null,label:e.slice(0,li),lines:{start:1,end:Math.max(1,a)}}],s=[],c=n.parse(t).topNode;for(let e=c.firstChild;e;e=e.nextSibling)mi(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,li),lines:{start:di(i,e.from),end:di(i,Math.max(e.from,e.to-1))}})}return o}function _i(e,t,n){let r=hi(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 vi(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=ii(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(Jt[e.loop.phase],`active`,e.loop.phaseFrom.c,`${e.loop.phase} phase`);let i=e.main.stack[e.main.stack.length-1];i&&r(Xt[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??M.poolWorker.id,i=n?n.c:`inferred`,o=a.get(r);o?(o.n++,o.c=ii(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(M.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&&dn(i.loc.url,t.programName)&&r(_i(t.userBoxes,t.programName,i.loc.line)?.id,`active`,n,`line ${i.loc.line}`))}return[...n.values()]}function yi(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?Xt[t.item.type]:void 0;return t&&n?{id:n,certainty:t.from.c}:e.loop.phase&&e.loop.phaseFrom?{id:Jt[e.loop.phase],certainty:e.loop.phaseFrom.c}:null}var bi={paused:null,frame:`called from here`,output:`wrote this output`,created:`scheduled here`,callback:`callback scheduled here is running`};function xi(e){let t,n,r=e.frames;if(r&&r.length>0){let i=Math.min(Math.max(0,e.frame),r.length-1);t=r[i].loc,n=i===0?`paused`:`frame`}else if(e.source)t=e.source.loc,n=e.source.why;else return null;if(!Number.isInteger(t.line)||t.line<1)return null;let i=e.programName!==null&&dn(t.url,e.programName)?`editor`:t.url.startsWith(`node:`)?`source`:null;return i===null?null:{where:i,url:t.url,line:t.line,kind:n,tag:bi[n]}}function Si(e,t){return e===null||t===null?e===t:e.where===t.where&&e.url===t.url&&e.line===t.line&&e.kind===t.kind}function Ci(e){switch(e){case`breakpoint`:return`Paused on breakpoint`;case`step`:return`Paused on step`;case`entry`:return`Paused on the first line`;case`exception`:return`Paused on exception`;case`pause`:return`Paused`;default:return`Paused in the debugger`}}var wi=/^[a-z0-9][a-z0-9._-]{0,80}$/i;function Ti(e){let t=e.replace(/^#/,``);if(t!==`/learn`&&!t.startsWith(`/learn/`))return{view:`main`};let n=t.slice(7).replace(/\/+$/,``);try{n=decodeURIComponent(n)}catch{n=``}return{view:`learn`,lesson:wi.test(n)?n:null}}function Ei(e){return e.view===`main`?`#/`:e.lesson!==null&&wi.test(e.lesson)?`#/learn/${encodeURIComponent(e.lesson)}`:`#/learn`}function Di(e,t){return e.view===t.view&&(e.view!==`learn`||t.view!==`learn`||e.lesson===t.lesson)}var Oi=2e4,ki=400,Ai=200,H=(e,t=Oi)=>typeof e==`string`?e.slice(0,t):``;function ji(e){if(typeof e!=`object`||!e||!Array.isArray(e.chapters))throw Error(`no "chapters" list`);let t=[];for(let n of e.chapters.slice(0,50)){if(typeof n!=`object`||!n)continue;let e=n,r=[];for(let t of Array.isArray(e.lessons)?e.lessons.slice(0,Ai):[]){if(typeof t!=`object`||!t)continue;let e=t;if(typeof e.id!=`string`||!wi.test(e.id)||typeof e.file!=`string`)continue;let n=e.level===`core`||e.level===`deep`?e.level:`start`,i=typeof e.minutes==`number`&&Number.isFinite(e.minutes)?Math.max(1,Math.min(600,Math.round(e.minutes))):1;r.push({id:e.id,title:H(e.title,160),summary:H(e.summary,600),minutes:i,level:n,file:e.file.slice(0,300)})}t.push({id:H(e.id,80),title:H(e.title,160),summary:H(e.summary,600),lessons:r})}return{version:1,chapters:t}}function Mi(e){return e.chapters.flatMap(e=>e.lessons)}function Ni(e){if(!Array.isArray(e))return typeof e==`string`?[e.slice(0,Oi)]:[];let t=[];for(let n of e.slice(0,Ai))if(typeof n==`string`)t.push(n.slice(0,Oi));else if(typeof n==`object`&&n){let e=n,r=H(e.text);switch(e.t){case`code`:case`strong`:case`em`:case`kbd`:case`ui`:t.push({t:e.t,text:r});break;case`path`:t.push({t:`path`,id:H(e.id,200),text:r});break;case`link`:t.push({t:`link`,text:r,href:H(e.href,2e3)});break;default:r&&t.push(r)}}return t}function Pi(e){if(typeof e!=`object`||!e)return null;let t=e;switch(t.t){case`p`:return{t:`p`,text:Ni(t.text)};case`h`:return{t:`h`,level:t.level===3?3:2,id:H(t.id,120).replace(/[^\w.-]+/g,`-`),text:H(t.text,300)};case`list`:return{t:`list`,ordered:t.ordered===!0,items:(Array.isArray(t.items)?t.items.slice(0,Ai):[]).map(Ni)};case`note`:return{t:`note`,kind:t.kind===`honest`||t.kind===`warn`?t.kind:`tip`,text:Ni(t.text)};case`code`:return{t:`code`,lang:t.lang===`js`||t.lang===`sh`?t.lang:`text`,text:H(t.text,2e5)};case`example`:return{t:`example`,example:H(t.example,120)};case`image`:{let e=typeof t.width==`number`&&t.width>0&&t.width<2e4?Math.round(t.width):0,n=typeof t.height==`number`&&t.height>0&&t.height<2e4?Math.round(t.height):0;if(typeof t.src!=`string`||e===0||n===0)return null;let r=H(t.caption,600);return{t:`image`,src:t.src.slice(0,300),alt:H(t.alt,600),width:e,height:n,...r?{caption:r}:{}}}case`check`:return{t:`check`,question:Ni(t.question),answer:Ni(t.answer)};default:return null}}function Fi(e,t){if(typeof t!=`object`||!t)return null;let n=t;if(typeof n.text!=`string`||n.text.length>2e5)return null;let r={id:e,title:H(n.title,200),name:H(n.name,80),module:n.module===`esm`?`esm`:`commonjs`,text:n.text,racy:n.racy===!0,output:(Array.isArray(n.output)?n.output.slice(0,2e3):[]).map(e=>H(e,2e3))};if(typeof n.recording==`string`&&(r.recording=n.recording.slice(0,300)),Array.isArray(n.steps)){r.steps=[];for(let e of n.steps.slice(0,Ai)){if(typeof e!=`object`||!e)continue;let t=e;typeof t.index!=`number`||!Number.isInteger(t.index)||t.index<0||r.steps.push({index:t.index,title:H(t.title,160),text:H(t.text,2e3)})}r.steps.sort((e,t)=>e.index-t.index)}return r}function Ii(e){if(typeof e!=`object`||!e||!Array.isArray(e.blocks))throw Error(`no "blocks" list`);let t=e,n={};if(typeof t.examples==`object`&&t.examples!==null)for(let[e,r]of Object.entries(t.examples).slice(0,Ai)){let t=Fi(e.slice(0,120),r);t&&(n[t.id]=t)}let r=e=>{if(typeof e!=`object`||!e)return;let t=e;return typeof t.id==`string`&&wi.test(t.id)?{id:t.id,title:H(t.title,160)}:void 0},i=r(t.prev),a=r(t.next);return{id:H(t.id,80),chapter:H(t.chapter,80),title:H(t.title,200),summary:H(t.summary,800),blocks:t.blocks.slice(0,ki).map(Pi).filter(e=>e!==null),examples:n,...i?{prev:i}:{},...a?{next:a}:{}}}function Li(e){let t;try{t=new URL(e)}catch{return null}return t.protocol===`https:`&&t.username===``&&t.password===``?t.href:null}function Ri(e,t){return e.map(e=>{if(typeof e==`string`)return{kind:`text`,text:e};switch(e.t){case`link`:{if(e.href.startsWith(`learn:`)){let n=e.href.slice(6);return wi.test(n)&&t.hasLesson(n)?{kind:`lesson`,text:e.text,lesson:n,href:Ei({view:`learn`,lesson:n})}:{kind:`text`,text:e.text}}let n=Li(e.href);return n?{kind:`external`,text:e.text,href:n}:{kind:`text`,text:e.text}}case`path`:return/^p:[\w.-]{1,120}$/.test(e.id)?{kind:`path`,text:e.text,id:e.id}:{kind:`text`,text:e.text};default:return{kind:e.t,text:e.text}}})}function zi(e,t,n){let r,i;try{i=new URL(`.`,e),r=new URL(n,t)}catch{return null}return r.origin!==i.origin||!r.pathname.startsWith(i.pathname)?null:r.href}function Bi(e){return/^\w[\w.-]{0,80}$/.test(e.name)?e.name:e.module===`esm`?`example.mjs`:`example.js`}var Vi=`nodejs-map.learn.v1`;function Hi(e){let t={done:[],last:null,introDismissed:!1};if(e===null)return t;let n;try{n=JSON.parse(e)}catch{return t}if(typeof n!=`object`||!n)return t;let r=n;return{done:Array.isArray(r.done)?[...new Set(r.done.filter(e=>typeof e==`string`&&wi.test(e)))].slice(0,1e3):[],last:typeof r.last==`string`&&wi.test(r.last)?r.last:null,introDismissed:r.introDismissed===!0}}var Ui={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`},Wi=/^\s*\{\s*"op"\s*:\s*"events"\s*[,}]/,Gi=class extends Error{constructor(e){super(e),this.name=`HelperError`}},Ki=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 Gi(`Could not connect to the helper.`)),this.#e.onclose=()=>{t(new Gi(`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 Gi(`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 Gi(`The connection to the helper closed.`);let t=this.#r++;return new Promise((n,r)=>{let i=setTimeout(()=>{this.#n.delete(t),r(new Gi(`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 Gi(`The connection to the helper closed.`));this.#n.clear(),this.#t.onClose()}}#c(e){if(typeof e!=`string`)return;if(Wi.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 Gi(String(t.message))):t.op===Ui[e.op]?e.resolve(t):e.reject(new Gi(`Unexpected reply "${t.op}" to "${e.op}".`))}else(t.op===`run.ended`||t.op===`notice`)&&this.#t.onPush(t)}}};function qi(e,t){let n=new URL(e,t);return n.protocol=n.protocol===`https:`?`wss:`:`ws:`,n.hash=``,n.href}var Ji={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 Yi(e){return e===`win32`||e===`darwin`?e:`linux`}function Xi(e,t,n,r,i){return{...Ji,title:t,path:n,start:r,end:i,github:Pt(e,n,r??void 0,i??void 0),githubDev:It(e,n,r??void 0,i??void 0),raw:Rt(e,n)}}async function Zi(e,t,n){let r;try{r=await e.box(n)}catch{return{...Ji,title:n,atlasId:n,note:`The map data for this place could not be loaded.`}}if(!r)return{...Ji,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{...Xi(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{...Ji,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?{...Xi(i,r.title,r.file.path,null,null),description:r.desc??null,atlasId:r.id}:r.tree?{...Ji,title:r.title,description:r.desc??null,atlasId:r.id,github:Ft(i,r.tree),note:`This box is a folder. Zoom in on the map to reach its files, or open the folder on GitHub.`}:{...Ji,title:r.title,description:r.desc??null,atlasId:r.id,note:`This box has no source in Node.js itself.`}}async function Qi(e,t){let n=t.fn||`(anonymous)`,r=Ht(t.loc.url);if(!r)return{...Ji,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{...Ji,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{...Xi(i,n,r,o,s),atlasId:a??null,line:t.loc.line,scriptUrl:t.loc.url}}function $i(e){return/\.(?:m?js|cjs)$/i.test(e)?`javascript`:/\.(?:c|cc|cpp|cxx|h|hh|hpp|inl|inc)$/i.test(e)?`cpp`:`plain`}function ea(e){return/^v\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(e)}function ta(e){return e.endsWith(`/`)?e:`${e}/`}function na(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 ra(e){let t=P({status:`none`}),n=``;return{state:t,async load(r,i){let a=new URL(ta(r),e.pageUrl());if(a.href===n)return;n=a.href,t.value={status:`loading`,tag:i};let o=new qt({fetchJson:t=>{let n=na(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},_e(`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 ia(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 aa=600;function oa(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 sa(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`),o=n(`learn`);if(t.mode===`helper`){if(typeof t.ws!=`string`)throw Error(`config.json: "ws" is missing.`);let e=oa(n(`playerUrl`));return{mode:`helper`,ws:t.ws,atlasBase:r,...i===void 0?{}:{examples:i},...a===void 0?{}:{lessons:a},...o===void 0?{}:{learn:o},...e===void 0?{}:{playerUrl:e}}}if(t.mode===`player`)return{mode:`player`,atlasBase:r,...a===void 0?{}:{lessons:a},...o===void 0?{}:{learn:o}};throw Error(`config.json: "mode" must be "helper" or "player".`)}function ca(e){let t=P(null),n=P(`none`),r=P(null),i=P([]),a=P(null),o=null,s=1,c=(e,t)=>{let n={id:s++,level:e,text:t.slice(0,aa)};i.value=[...i.value,n].slice(-5)};return{config:t,mode:F(()=>t.value?.mode??null),status:n,welcome:r,providers:F(()=>r.value?.providers??[]),notes:F(()=>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 Ki({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 Gi?e.message:`Could not connect to the helper.`),s.close()}},request(e){return!o||n.value!==`open`?Promise.reject(new Gi(`The helper is not connected.`)):o.request(e)},notify:c,dismiss(e){i.value=i.value.filter(t=>t.id!==e)}}}var la=[`nextTick`,`microtask`,`timers`,`immediate`,`pool`,`io`,`close`],ua={maxEntries:60,maxOutput:0,maxNotes:5,maxLog:0,items:`none`},da=600,fa=1e3;function pa(){return{position:P(0),length:P(0),ready:P(0),live:P(!1),version:P(0),t:P(0),run:P(null),main:P(null),loop:P(null),timers:P(null),pool:P(null),output:P(null),debug:P(null),notes:P(null),focus:P(null),source:P(null),problems:P(null),itemCount:P(0),queues:Object.fromEntries(la.map(e=>[e,P(null)]))}}function ma(e,t){let n=P(null),r=pa(),i=(e,t)=>{bn(()=>{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.source.value=e.source??null,r.problems.value=e.problems,r.itemCount.value=e.items.total;for(let t of la)r.queues[t].value=e.queues[t]})},a=P(null),o=P(null),s=P(null),c=P({status:`idle`,mode:null,length:0,pauses:0,located:!1,run:null}),l=P(null),u=P(!1),d=new Map,f=1,p=0,m=0,h=!1,g=0,_=null,v=!1,y=null,b=(t,n)=>{v||e.postMessage(t,n)},x=()=>{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))},S=e=>{_=null,v||((!h||e-g>fa)&&(h=!0,g=e,b({op:`tick`,now:e})),x()&&(_=t.request(S)))},C=()=>{p=t.now()+da,!_&&!v&&(_=t.request(S))},w=e=>new Promise((t,n)=>{let r=f++;d.set(r,{resolve:t,reject:n}),e(r),C()}),T=(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=$r(n.peek(),t.patch)}catch{b({op:`configure`,views:`patch`}),C();return}i(e,t.player);return}case`timeline`:o.value=t.summary;return;case`markers`:s.value=t.markers;return;case`answer`:T(t.re,t.answer);return;case`saved`:T(t.re,t.bytes);return;case`shared`:T(t.re,t.result);return;case`opened`:T(t.re,{header:t.header,events:t.events});return;case`error`:case`app.error`:T(t.re,void 0,t.message)||(l.value=t.message);return;case`app.opened`:T(t.re,{header:t.header,events:t.events}),C();return;case`app.log`:T(t.re,t.window);return;case`app.runFinal`:T(t.re,{current:t.current,length:t.length,steps:t.steps,pauses:t.pauses});return;case`app.ticked`:h=!1;return;case`app.tail`:c.value={...t.tail,run:t.run},C();return}},e.onerror=()=>{l.value=`The part of the app that reads events stopped working. Reload the page.`},b({op:`configure`,view:ua,views:`patch`,clock:`external`,markers:!0}),u.value=!0,C(),{view:n,parts:r,player:a,timeline:o,markers:s,tail:c,problem:l,ready:u,command(e){(e.do===`play`||e.do===`pause`||e.do===`toggle`||e.do===`seek`||e.do===`seekTime`||e.do===`step`||e.do===`follow`&&!e.on)&&m++,b({op:`player`,cmd:e}),C()},touches:()=>m,query(e){return w(t=>b({op:`query`,id:t,q:e}))},log(e,t,n,r){return w(i=>b({op:`app.log`,id:i,filter:e,offset:t,limit:n,position:r}))},setTimeline(e,t){y&&y.width===e&&y.axis===t||(y={width:e,axis:t},b({op:`configure`,timeline:{width:e,axis:t}}),C())},setViewCaps(e){b({op:`configure`,view:e}),C()},newRun(){l.value=null,b({op:`app.newRun`}),C()},setRun(e){b({op:`app.run`,run:e}),C()},eventsText(e){b({op:`app.eventsText`,text:e}),_||C()},runEnded(e){return w(t=>b({op:`app.runEnded`,id:t,run:e})).catch(()=>({current:!1,length:0,steps:0,pauses:0}))},open(e){return l.value=null,w(t=>b({op:`app.open`,id:t,data:e}))},openFragment(e){return l.value=null,w(t=>b({op:`app.openFragment`,id:t,fragment:e}))},close(){b({op:`app.close`}),C()},save(e,t){return w(n=>b({op:`save`,id:n,header:e,gzip:t}))},share(e){return w(t=>b({op:`share`,id:t,header:e}))},dispose(){v=!0,_?.();for(let e of d.values())e.reject(Error(`The player was closed.`));d.clear()}}}var ha=e=>e.startsWith(`node:`),ga=e=>[...new Set(e.filter(e=>Number.isInteger(e)&&e>=1))].sort((e,t)=>e-t);function _a(e,t,n){let r={...e},i=ga(n);return i.length>0?r[t]=i:delete r[t],r}function va(e,t){let n=new Set(e.off[t]??[]);return(e.lines[t]??[]).map(e=>({line:e,enabled:!n.has(e)}))}function ya(e){return Object.keys(e.lines).sort((e,t)=>Number(ha(e))-Number(ha(t))||e.localeCompare(t)).flatMap(t=>va(e,t).map(e=>({file:t,...e})))}function ba(e,t,n){if(!Number.isInteger(n)||n<1)return e;let r=e.lines[t]??[];return r.includes(n)?xa(e,t,n):{lines:_a(e.lines,t,[...r,n]),off:e.off}}function xa(e,t,n){return{lines:_a(e.lines,t,(e.lines[t]??[]).filter(e=>e!==n)),off:_a(e.off,t,(e.off[t]??[]).filter(e=>e!==n))}}function Sa(e,t,n,r){if(!(e.lines[t]??[]).includes(n))return e;let i=(e.off[t]??[]).filter(e=>e!==n);return{lines:e.lines,off:_a(e.off,t,r?i:[...i,n])}}function Ca(e,t,n){let r=new Map;for(let e of n)r.set(e.line,(r.get(e.line)??!1)||e.enabled);let i=[...r.keys()];return{lines:_a(e.lines,t,i),off:_a(e.off,t,i.filter(e=>r.get(e)===!1))}}function wa(e,t){return e.length===t.length&&e.every((e,n)=>e.line===t[n]?.line&&e.enabled===t[n]?.enabled)}function Ta(e,t,n){return t?ya(e).filter(e=>e.enabled&&(ha(e.file)||e.file===n)).map(({file:e,line:t})=>({file:e,line:t})):[]}function Ea(e,t){return ha(e.file)||e.file===t}function Da(e){let t=/^lib\/([a-z0-9_][a-z0-9_./-]*)\.js$/i.exec(e);return t&&t[1]!==void 0&&!t[1].includes(`..`)?`node:${t[1]}`:null}var Oa=[.1,.25,.5,1,2,4,8,16],ka=`// 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
|
+
`,Aa=[`map`,`code`,`panels`,`playback`],ja={map:!0,code:!0,panels:!0,playback:!0},Ma=e=>{if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e;if(!Aa.every(e=>typeof t[e]==`boolean`))return;let n=Object.fromEntries(Aa.map(e=>[e,t[e]]));return n.map||n.code||n.panels?n:void 0},Na=[`code`,`now`,`stack`,`queues`,`pool`,`output`,`events`,`source`,`lessons`],Pa=(...e)=>t=>typeof t==`string`&&e.includes(t)?t:void 0,Fa=(e,t)=>n=>typeof n==`number`&&Number.isFinite(n)?Math.min(t,Math.max(e,n)):void 0,Ia=e=>typeof e==`boolean`?e:void 0,La=.2,Ra=.8,za=.12,Ba=.88,Va=1024,Ha=e=>{if(typeof e!=`object`||!e||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e).slice(0,500)){if(!Array.isArray(r)||n.length>300)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},Ua={theme:Pa(`system`,`light`,`dark`),splitMap:Fa(La,Ra),splitEditor:Fa(La,Ra),splitSheet:Fa(za,Ba),module:Pa(`commonjs`,`esm`),poolSize:e=>e===null?null:typeof e==`number`&&Number.isInteger(e)&&e>=1&&e<=1024?e:void 0,pauseOnStart:Ia,sourceLines:Ia,autoReplay:Ia,provider:Pa(`user`,`pinned`,`probe`),speed:e=>typeof e==`number`&&Oa.includes(e)?e:void 0,moveMap:Ia,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:Pa(...Na),timelineAxis:Pa(`index`,`time`),breakpoints:Ha,breakpointsOff:Ha,breakpointsActive:Ia,areas:Ma},Wa={theme:`system`,splitMap:.56,splitEditor:.48,splitSheet:.6,module:`commonjs`,poolSize:null,pauseOnStart:!1,sourceLines:!0,autoReplay:!0,provider:`user`,speed:1,moveMap:!1,snippet:ka,snippetName:`snippet.js`,breakpoints:{},breakpointsOff:{},breakpointsActive:!0,tab:`now`,timelineAxis:`index`,areas:ja},Ga=`nodejs-map.settings.v1`;function Ka(e){let t={...Wa};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(Ua)){if(!Object.hasOwn(n,e))continue;let r=Ua[e](n[e]);r!==void 0&&(t[e]=r)}return t}function qa(e,t=e=>void setTimeout(e,250)){let n=null;try{n=e?.getItem(`nodejs-map.settings.v1`)??null}catch{}let r=Ka(n),i=Object.fromEntries(Object.keys(r).map(e=>[e,P(r[e])])),a=!1,o=!0,s=()=>JSON.stringify(Object.fromEntries(Object.entries(i).map(([e,t])=>[e,t.value]))),c=Bn(()=>{s(),o?o=!1:!a&&e&&(a=!0,t(l))}),l=()=>{if(a&&e){a=!1;try{e.setItem(Ga,s())}catch{}}};return{settings:i,dispose:c,flush:l}}function Ja(){try{return typeof localStorage>`u`?null:localStorage}catch{return null}}var Ya=qa(Ja()),U=Ya.settings;typeof addEventListener==`function`&&(addEventListener(`pagehide`,()=>Ya.flush()),addEventListener(`visibilitychange`,()=>{typeof document<`u`&&document.visibilityState===`hidden`&&Ya.flush()}));var Xa=200;function Za(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,Xa)){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 Qa(e){return`${e.id.replace(/[^\w.-]+/g,`-`).replace(/^[.-]+/,``).slice(0,60)||`example`}${e.module===`esm`?`.mjs`:`.js`}`}function $a(e){let{settings:t}=e,n=P({kind:`snippet`}),r=P({status:`none`}),i=0,a=F(()=>{let e=n.value;return e.kind===`file`?e.path:t.snippetName.value}),o=F(()=>({lines:t.breakpoints.value,off:t.breakpointsOff.value})),s=e=>{e!==o.peek()&&(e.lines!==t.breakpoints.peek()&&(t.breakpoints.value=e.lines),e.off!==t.breakpointsOff.peek()&&(t.breakpointsOff.value=e.off))};return{source:n,name:a,text:F(()=>{let e=n.value;return e.kind===`file`?e.text??``:t.snippet.value}),readOnly:F(()=>n.value.kind===`file`),breakpoints:F(()=>va(o.value,a.value)),allBreakpoints:F(()=>ya(o.value)),breakpointsActive:t.breakpointsActive,breakpointSet:o,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=Qa(e),t.module.value=e.module,n.value={kind:`snippet`}},loadSnippet(e,r,a){r.length>2e5||!/^\w[\w.-]{0,80}$/.test(e)||(i++,t.snippet.value=r,t.snippetName.value=e,t.module.value=a,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:Za(await e.fetchJson(t))}}catch(e){r.value={status:`failed`,reason:e instanceof Error?e.message:String(e)}}},marksFor:e=>va(o.value,e),toggleBreakpoint(e,t=a.peek()){s(ba(o.peek(),t,e))},setBreakpointEnabled(e,t,n){s(Sa(o.peek(),e,t,n))},removeBreakpoint(e,t){s(xa(o.peek(),e,t))},removeAllBreakpoints(){s({lines:{},off:{}})},setFileBreakpoints(e,t){let n=o.peek();wa(va(n,e),[...t].sort((e,t)=>e.line-t.line))||s(Ca(n,e,t))},setBreakpointsActive(e){t.breakpointsActive.value=e},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(){return Ta(o.value,t.breakpointsActive.value,a.value)}}}var eo={map:`Map`,code:`Code`,panels:`Panels`,playback:`Playback bar`},to={map:`1`,code:`2`,panels:`3`,playback:`4`},no=`Map, Code and Panels cannot all be hidden: one of them stays open.`;function ro(e){let{areas:t,narrow:n}=e,r=F(()=>{let e=t.value;if(!n.value)return e;let r=e.panels||!e.map;return{map:e.map,code:r,panels:r,playback:e.playback}}),i=e=>{let n={...t.value,...e};Aa.some(e=>n[e]!==t.value[e])&&(t.value=n)},a=(r,a)=>{if(n.value&&r===`code`&&(r=`panels`),a)return i({[r]:!0}),!0;if(r===`playback`)return i({playback:!1}),!0;let o=t.value;return(n.value?r===`map`?o.panels:o.map:[`map`,`code`,`panels`].some(e=>e!==r&&o[e]))?(i({[r]:!1}),!0):(e.onRefused(no),!1)};return{shown:r,applies:e=>!(n.value&&e===`code`),set:a,toggle:e=>a(e,!r.peek()[e]),reveal(...e){let t={};for(let r of e)t[r]=!0,r===`code`&&n.peek()&&(t.panels=!0);i(t)},showAll:()=>i(ja),reset(){i(ja);for(let t of e.splits)t.value.value=t.initial}}}function io(e){let t=Hi(null);try{t=Hi(e.storage?.getItem(`nodejs-map.learn.v1`)??null)}catch{}let n=P({view:`main`}),r=P({status:`none`}),i=P({status:`none`}),a=P(new Set(t.done)),o=P(t.introDismissed),s=P(null),c=t.last,l=0,u=()=>{try{e.storage?.setItem(Vi,JSON.stringify({done:[...a.value],last:c,introDismissed:o.value}))}catch{}},d=e=>{let t=r.value;return t.status===`ready`?Mi(t.index).find(t=>t.id===e):void 0},f=()=>{let t=r.value,a=n.value;if(a.view!==`learn`||t.status!==`ready`)return;let o=Mi(t.index),s=a.lesson??(c!==null&&o.some(e=>e.id===c)?c:o[0]?.id)??null;if(s===null)return;let f=i.value;if(f.status===`ready`&&f.lesson.id===s||f.status===`loading`&&f.id===s)return;let p=d(s),m=p?zi(t.url,t.url,p.file):null,h=++l;!p||!m?i.value={status:`failed`,id:s,reason:p?`its file is outside the course folder`:`the course has no lesson with this name`}:(i.value={status:`loading`,id:s},e.fetchJson(m).then(e=>{if(h===l)try{i.value={status:`ready`,lesson:{...Ii(e),id:s},url:m},c=s,u()}catch(e){i.value={status:`failed`,id:s,reason:e instanceof Error?e.message:String(e)}}},e=>{h===l&&(i.value={status:`failed`,id:s,reason:e instanceof Error?e.message:String(e)})}))};return{route:n,index:r,lesson:i,done:a,introDismissed:o,returnTo:s,first:F(()=>{let e=r.value,t=e.status===`ready`?Mi(e.index)[0]:void 0;return t?{id:t.id,title:t.title,minutes:t.minutes}:null}),async loadIndex(t){r.value={status:`loading`};try{r.value={status:`ready`,index:ji(await e.fetchJson(t)),url:t},f()}catch(e){r.value={status:`failed`,reason:e instanceof Error?e.message:String(e)}}},syncRoute(e){let t=Ti(e);Di(t,n.value)||(n.value=t),f()},go(t){let r=Ei(t);Di(t,n.value)||(n.value=t),e.setHash(r),f()},setDone(e,t){let n=new Set(a.value);t?n.add(e):n.delete(e),a.value=n,u()},dismissIntro(){o.value=!0,u()},leaveFor(e,t){s.value={lesson:e,scroll:t}},takeScroll(e){let t=s.value;return!t||t.lesson!==e?null:(s.value=null,t.scroll)},fileUrl(e){let t=r.value,n=i.value;return t.status===`ready`&&n.status===`ready`?zi(t.url,n.url,e):null},hasLesson:e=>d(e)!==void 0}}function ao(e){return!e.enabled||e.paused||e.ended!==`itself`||e.userTookControl||e.opening||!(e.steps>0)?`leave`:e.steps>3e3?`rewind`:`replay`}function oo(e,t){let n=e*t;return n>=1?`${Number(n.toFixed(2))} steps/s`:`1 step / ${Number((1/n).toFixed(1))} s`}var so=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function co(e){let t=Ta(e.breakpoints,e.active,e.programName),n=t.length>0||e.pauseOnStart,r=e.autoReplay?`, then replays`:``;if(n&&e.canDebug){let n=`tops at ${so(t.length,`breakpoint`)}`,r=e.pauseOnStart?t.length>0?`Pauses on the first line, then s${n}`:`Pauses on the first line`:`S${n}`;return{mode:`debug`,breakpoints:t,pauseOnStart:e.pauseOnStart,says:r}}let i;if(n)i=`This Node.js cannot be debugged`;else{let t=ya(e.breakpoints).filter(t=>Ea(t,e.programName));i=t.length===0?`No breakpoints`:e.active?t.length===1?`The breakpoint is switched off`:`All breakpoints are switched off`:`Breakpoints are deactivated`}return{mode:`free`,breakpoints:[],pauseOnStart:!1,says:`${i}: runs at full speed${r}`}}var lo=200,uo=200;function fo(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,lo)){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,uo)){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 po(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 mo(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 ho(e){return e instanceof Error?e.message:String(e)}function go(e){let{settings:t,connection:n,player:r,program:i}=e,a=P(`empty`),o=P(null),s=P(!1),c=P(!1),l=P(!1),u=P({phase:!1,timer:!1,poolStart:!1,poolPost:!1}),d=P({status:`none`}),f=P(``),p=P(null),m=P(!1),h=P(null),g=P(0),_=0,v=!1,y=!1,b=!1,x=0;Bn(()=>{let e=r.player.value;m.value&&e&&(r.touches()===x?((e.playing||e.position===0)&&(b=!0),b&&!e.playing&&e.position>0&&(m.value=!1,f.value=`The replay reached the end. Finished run.`)):m.value=!1)});let S=null,C=0,w=e=>{f.value=f.value===e?`${e} `:e},T=F(()=>{let e=n.providers.value;return e.find(e=>e.id===t.provider.value)??e.find(e=>e.available)??e[0]??null}),E=F(()=>{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`}}),D=F(()=>lt({connected:n.status.value===`open`,provider:T.value,notes:n.notes.value,status:E.value})),ee=F(()=>co({breakpoints:i.breakpointSet.value,active:i.breakpointsActive.value,programName:i.name.value,pauseOnStart:t.pauseOnStart.value,canDebug:T.value?.caps.jsDebugger!==!1,autoReplay:t.autoReplay.value})),te=F(()=>r.parts.run.value?.caps??(a.value===`recording`?null:T.value?.caps??null)),ne=F(()=>r.parts.run.value?.node??o.value?.header.node??(a.value===`recording`?null:T.value?.node??null)),re=e=>{let t=ho(e);p.value=t,w(t)},ie=e=>{let t=D.value[e];return!t.enabled&&(t.reason&&w(t.reason),!0)},ae=null,oe=()=>l.value?ae:null,se=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}:{}},ce=async()=>{let e=oe();if(e){try{await n.request({op:`stop`,run:e})}catch{}l.value=!1}},le=async(t,n,i,c)=>{let l=++C;p.value=null,s.value=!0;try{await ce();let s=await t();if(l!==C)return;a.value=`recording`,o.value={header:s.header,events:s.events,origin:n,label:i,lesson:c},m.value=!1,h.value=null,S=null,e.onNewContent?.(c?`lesson`:`recording`),r.command({do:`pause`}),r.command({do:`seek`,position:c?.steps?.[0]?c.steps[0].index+1:0}),w(`Opened a recording with ${s.events} events. Nothing was run.`)}catch(e){if(l!==C)return;re(Error(`This recording could not be opened: ${ho(e)}`))}finally{l===C&&(s.value=!1)}},ue=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`||!S)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:S.node,atlas:{tag:r.tag,commit:r.commit},title:S.name};return t&&S.text!==null&&(i.sources=[{name:S.name,text:S.text}]),i};return{kind:a,recording:o,opening:s,provider:T,liveStatus:E,controls:D,caps:te,node:ne,gates:u,plan:ee,lessons:d,announcement:f,error:p,replaying:m,notice:h,replayStarts:g,announce:w,clearError(){p.value=null},clearNotice(){h.value=null},async start(){if(ie(`run`))return;let{mode:s,breakpoints:u,pauseOnStart:d}=ee.value,f=i.ref(),g=T.value;if(!f||!g)w(`The program is still loading.`);else{C++,p.value=null,c.value=!0,a.value=`live`,o.value=null,S={name:i.name.value,text:i.text.value,node:g.node},v=s===`debug`,y=!1,m.value=!1,h.value=null,r.newRun(),r.command({do:`follow`,on:!0}),e.onNewContent?.(`run`);try{let e=t.poolSize.value,i=await n.request({op:`run`,program:f,mode:s,provider:g.id,breakpoints:u,...e===null?{}:{poolSize:e},...d?{pauseOnStart:!0}:{},...t.sourceLines.value?{itemLocations:!0}:{},...se(g)});ae=i.run,r.setRun(i.run),l.value=!0,_=r.touches(),w(s===`debug`?`Run started. ${ee.peek().says}.`:`Run started at full speed.`)}catch(e){re(Error(`The run could not start: ${ho(e)}`))}finally{c.value=!1}}},async stop(){if(ie(`stop`))return;let e=oe();if(e){y=!0;try{await n.request({op:`stop`,run:e}),w(`Stop requested.`)}catch(e){re(e)}}},async debug(e){if(ie(e))return;let t=oe();if(t)try{e===`pause`&&(v=!0),await n.request({op:`debug.do`,run:t,action:e})}catch(e){re(e)}},async pauseOrResume(){await this.debug(E.value===`paused`?`resume`:`pause`)},async gate(e){let t=e.kind===`resume`?`gateResume`:e.kind;if(ie(t))return;let r=oe();if(r)try{await n.request({op:`gate.do`,run:r,action:e})}catch(e){re(e)}},async setGate(e,t){if(ie(e===`phase`?`pauseAtNextPhase`:e===`timer`?`gateTimer`:e===`poolStart`?`gatePoolStart`:`gatePoolPost`))return;let r=oe();if(!r||e===`phase`)u.value={...u.value,[e]:t},w(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){re(e)}},syncBreakpoints(){let e=oe();if(!e)return;let t=i.breakpointList();(v||t.length!==0)&&(v=!0,n.request({op:`debug.breakpoints`,run:e,breakpoints:t}).catch(re))},handleRunEnded(e){let n=r.runEnded(e.run);if(e.run!==ae||!l.value)return;l.value=!1;let i=e.signal?`The run was ended by signal ${e.signal}.`:`The run ended with exit code ${String(e.code)}.`;w(i);let o=e.run,u=r.touches()!==_;n.then(e=>{if(!e.current||ae!==o||a.value!==`live`||l.value||c.value)return;let n=ao({enabled:t.autoReplay.value,paused:e.pauses>0,ended:y?`stopped`:`itself`,userTookControl:u||r.touches()!==_,opening:s.value,steps:e.steps});n!==`leave`&&(r.command({do:`pause`}),r.command({do:`seek`,position:0}),n===`rewind`?(h.value=`This run has ${e.steps.toLocaleString(`en`)} steps. Press play, or drag the timeline.`,w(`${i} It has ${e.steps} steps; it is at its start, ready to play.`)):(b=!1,r.command({do:`play`}),x=r.touches(),m.value=!0,g.value++,w(`${i} Replaying it from the start at the chosen speed.`)))})},openRecordingData(e,t){return le(()=>r.open(e),`file`,t.slice(0,200),null)},openRecordingFragment(e){return le(()=>r.openFragment(e),`link`,`Shared link`,null)},async openLesson(t){let n=d.value,i=n.status===`ready`?po(n.baseUrl,t.recording):null;i?await le(async()=>r.open(await e.fetchBytes(i)),`lesson`,t.title,t):re(Error(`This lesson names a recording outside the lessons folder; it was not opened.`))},async openGuide(t){let n={id:t.id,title:t.title,summary:t.summary,recording:t.url,node:``,steps:t.steps};await le(async()=>r.open(await e.fetchBytes(t.url)),`lesson`,t.title,n)},closeRecording(){C++,s.value=!1,o.value=null,a.value=`empty`,r.close(),w(`Recording closed.`)},async loadLessons(t){let n=new URL(t,e.pageUrl()).href;d.value={status:`loading`};try{d.value={status:`ready`,lessons:fo(await e.fetchJson(n)),baseUrl:n}}catch(e){d.value={status:`failed`,reason:ho(e)}}},headerForSave:ue,async save(e){let t=ue(e.includeSource);if(!t)return null;try{return{bytes:await r.save(t,e.gzip),fileName:mo(t.title,e.gzip)}}catch(e){return re(Error(`The recording could not be saved: ${ho(e)}`)),null}},async share(e){let t=ue(e);if(!t)return null;try{return await r.share(t)}catch(e){return re(Error(`The link could not be made: ${ho(e)}`)),null}}}}var _o=40;function vo(e){let t=P(null),n=P({status:`none`}),r=new Map,i=0,a=(e,t)=>{r.delete(e),r.set(e,t),r.size>_o&&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 yo(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 bo(){return{narrow:P(!1),dialog:P(null),mark:P(null),selected:P(null),flyTo:P(null),hint:P(null),reveal:P(null),recordingSource:P(0),frame:P(0),runMore:P(!1)}}var xo=()=>location.href.replace(/#.*$/,``);function So(){let e=new Worker(new URL(new URL(`app.worker-DZKurLgd.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 W=ma(So(),{request(e){let t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)},now:()=>performance.now()}),G=bo(),K=ca({makeSocket:e=>new WebSocket(e),onEventsText:e=>W.eventsText(e),onRunEnded:e=>J.handleRunEnded(e)}),q=$a({settings:U,listFiles:async e=>(await K.request({op:`files.list`,dir:e})).entries,readFile:async e=>(await K.request({op:`files.read`,path:e})).text,fetchJson:ia}),Co=ra({pageUrl:xo,fetchJson:ia}),J=go({settings:U,connection:K,player:W,program:q,fetchJson:ia,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:xo,now:()=>new Date,atlas(){let e=Co.state.value;return e.status===`ready`?{tag:e.tag,commit:e.commit}:null},onNewContent(){ps()}}),wo=vo({fetchText:yo,async fetchFromProgram(e){let t=W.tail.value.run;return J.kind.value!==`live`||!t||J.liveStatus.value===`idle`?null:(await K.request({op:`source`,run:t,url:e})).text}}),Y=io({fetchJson:ia,storage:(()=>{try{return typeof localStorage>`u`?null:localStorage}catch{return null}})(),setHash(e){location.hash!==e&&(location.hash=e)}}),To=ro({areas:U.areas,narrow:G.narrow,splits:[{value:U.splitMap,initial:Wa.splitMap},{value:U.splitEditor,initial:Wa.splitEditor},{value:U.splitSheet,initial:Wa.splitSheet}],onRefused(e){G.hint.value=e,J.announce(e)}}),X=F(()=>K.mode.value===`helper`),Eo=F(()=>W.parts.length.value>0),Do=F(()=>Yi(J.node.value?.platform)),Oo=F(()=>{let e=J.recording.value;if(J.kind.value===`recording`&&e){let t=e.header.sources??[],n=t[Math.min(G.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(K.mode.value!==`helper`)return{name:`program`,text:null,missing:K.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=q.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:q.name.value,text:q.text.value,missing:null,readOnly:q.readOnly.value,origin:`program`,files:[]}}),ko=P([]),Ao=[],jo=F(()=>{let{focus:e,loop:t,main:n,pool:r,debug:i}=W.parts,a=vi(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:ko.value,programName:Oo.value.name});return a.length===Ao.length&&a.every((e,t)=>{let n=Ao[t];return e.id===n.id&&e.role===n.role&&e.certainty===n.certainty&&e.badge===n.badge})||(Ao=a),Ao}),Mo=null,No=F(()=>{let e=W.parts.debug.value,t=Oo.value,n=xi({source:W.parts.source.value,frames:e?.paused?e.frames:null,frame:G.frame.value,programName:t.text===null?null:t.name});return Si(n,Mo)||(Mo=n),Mo}),Po=F(()=>{let e=No.value;return e&&e.where===`editor`?e:null}),Fo=F(()=>{let e=No.value;return e&&e.where===`source`&&wo.target.value?.scriptUrl===e.url?e:null}),Io=null,Lo=F(()=>{let e=W.parts.source.value,t=Oo.value,n=e&&t.text!==null&&dn(e.loc.url,t.name)?{file:hi(t.name),line:e.loc.line,why:e.why}:null;return(n===null||Io===null||n.file!==Io.file||n.line!==Io.line||n.why!==Io.why)&&(Io=n),Io});function Ro(e,t=!0){U.tab.value=e,t&&To.reveal(`panels`),G.narrow.value&&U.splitSheet.value>.75&&(U.splitSheet.value=.6)}function zo(e){To.reveal(`map`),G.selected.value=e,G.flyTo.value=e}function Bo(e){if(e.startsWith(`u:`)){let t=ko.value.find(t=>t.id===e);t?.lines&&Wo(t.lines.start,t.lines.end);return}let t=Co.state.value;t.status===`ready`?wo.showLater(Zi(t.store,Do.value,e)):wo.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.`}),Ro(`source`)}function Vo(e){if(e.origin===`user`){Wo(e.loc.line,e.loc.line);return}let t=Co.state.value;wo.showLater(Qi(t.status===`ready`?t.store:null,e)),e.at&&(G.selected.value=e.at),Ro(`source`)}function Ho(e){e.url.startsWith(`node:`)?Vo({fn:e.url,loc:e,origin:`node`}):Wo(e.line,e.line)}var Uo=0;function Wo(e,t){G.reveal.value={start:e,end:t,ticket:++Uo},To.reveal(`code`),G.narrow.value&&Ro(`code`)}async function Go(e,t,n){let r=t.recording?Y.fileUrl(t.recording):null;r?(Y.leaveFor(e,n),Y.go({view:`main`}),To.reveal(`code`,`panels`),Ro(`lessons`),await J.openGuide({id:`learn:${t.id}`,title:t.title||t.name,summary:``,url:r,steps:t.steps??[]})):J.announce(`This example has no recording to play.`)}async function Ko(e,t,n){X.value&&(Y.leaveFor(e,n),J.kind.value===`recording`&&J.closeRecording(),q.loadSnippet(Bi(t),t.text,t.module),Y.go({view:`main`}),To.reveal(`code`),G.narrow.value&&Ro(`code`),await J.start())}function qo(e,t,n){let r=Co.state.value,i=r.status===`ready`?r.store.index.paths.find(e=>e.id===t):void 0;i?(Y.leaveFor(e,n),Y.go({view:`main`}),To.reveal(`map`),requestAnimationFrame(()=>{let e=document.querySelector(`.nm-map__paths select`);if(e&&[...e.options].some(e=>e.value===t)){e.value=t,e.dispatchEvent(new Event(`change`,{bubbles:!0}));return}let n=i.steps[0]?.box;n&&zo(n)})):J.announce(r.status===`ready`?`This call path is not in the map of this Node.js version.`:`The map is not loaded yet, so the call path cannot be shown.`)}function Jo(e){W.command({do:`pause`}),W.command({do:`seek`,position:e+1})}function Yo(e,t){W.command({do:`step`,kind:e,direction:t})}function Xo(e){G.mark.value=e}function Zo(e){let t=Oa.indexOf(U.speed.value),n=Oa[Math.min(Oa.length-1,Math.max(0,(t<0?Oa.indexOf(1):t)+e))];n!==void 0&&(U.speed.value=n)}function Qo(){let e=U.theme.value===`dark`||U.theme.value===`system`&&matchMedia(`(prefers-color-scheme: dark)`).matches;U.theme.value=e?`light`:`dark`}function $o(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 es(e){e.size>314572800?J.announce(`This file is too large to be a recording.`):await J.openRecordingData(await e.arrayBuffer(),e.name)}function ts(){let e=K.config.value;return e?e.mode===`player`?xo():e.playerUrl??null:null}var ns=P(null);function rs(e){return e.replace(/^#/,``).split(`&`).some(e=>e.startsWith(Kr))}async function is(){rs(location.hash)&&await J.openRecordingFragment(location.hash)}async function as(){Y.syncRoute(location.hash);let e;try{e=sa(await ia(new URL(`config.json`,xo()).href))}catch(e){ns.value=`nodejs-map could not read its configuration (config.json): ${e instanceof Error?e.message:String(e)}`;return}if(K.setConfig(e),_e(`config`),e.lessons!==void 0&&J.loadLessons(e.lessons).then(()=>_e(`lessons`)),e.learn!==void 0&&Y.loadIndex(new URL(e.learn,xo()).href),e.mode===`helper`){e.examples!==void 0&&q.loadExamples(new URL(e.examples,xo()).href),await K.connect(qi(e.ws,xo()));let t=K.welcome.value;t&&_e(`connected`),t?.openFile&&q.openFile(t.openFile)}else!rs(location.hash)&&Y.route.value.view===`main`&&(U.tab.value=`lessons`);await is(),addEventListener(`hashchange`,()=>{Y.syncRoute(location.hash),is()})}Bn(()=>{let e=U.theme.value;e===`system`?delete document.documentElement.dataset.theme:document.documentElement.dataset.theme=e});{let e=matchMedia(`(max-width: 760px)`);G.narrow.value=e.matches,e.addEventListener(`change`,e=>{G.narrow.value=e.matches})}Bn(()=>{let e=K.config.value;if(!e)return;if(e.mode===`helper`){let e=K.welcome.value?.atlas;if(!e)return;if(!ea(e.tag)){Co.unavailable(e.tag.slice(0,40),`the helper named a version this page cannot look up`);return}Co.load(`${ta(e.baseUrl)}${e.tag}/`,e.tag);return}let t=J.recording.value?.header,n=J.lessons.value,r=t?t.atlas.tag:n.status===`ready`&&n.lessons[0]?`v${n.lessons[0].node}`:null;r!==null&&(ea(r)?Co.load(`${ta(e.atlasBase)}${r}/`,r):Co.unavailable(r.slice(0,40),`its version name is not one this site can look up`))}),Bn(()=>{let e=U.speed.value;W.ready.value&&W.command({do:`speed`,speed:e})}),Bn(()=>{let e=U.tab.value===`output`;W.ready.value&&W.setViewCaps({maxOutput:e?150:0})}),Bn(()=>{q.breakpointSet.value,q.breakpointsActive.value,Sn(()=>J.syncBreakpoints())}),Bn(()=>{W.parts.debug.value?.from?.index,G.frame.value=0});{let e,t=0;Bn(()=>{let{name:n,text:r}=Oo.value;clearTimeout(e);let i=++t;r===null?ko.value=[]:e=setTimeout(()=>{tt(async()=>{let{parser:e}=await import(`./dist-B37Ex44M.js`).then(e=>e.t);return{parser:e}},[],import.meta.url).then(({parser:e})=>{if(i!==t)return;let a=hi(n);ko.value=gi(n,r,e).map(e=>e.id===a?{...e,text:r}:e)})},400)})}{let e=null,t=-1,n=null;Bn(()=>{let r=W.parts.debug.value,i=W.tail.value.run;if(J.liveStatus.value!==`paused`||!r?.paused||!r.from||W.parts.position.peek()!==W.parts.length.peek())return;let a=r.from.index,o=i!==e;if(!o&&a===t)return;o&&(n=null),e=i,t=a;let s=r.frames[0];Sn(()=>{let e=G.narrow.peek();s!==void 0&&s.origin!==`node`?(To.reveal(`code`),e?Ro(`code`):o?Ro(`stack`,!1):n!==null&&U.tab.peek()===`source`&&Ro(n,!1),n=null):s&&(U.tab.peek()!==`source`&&(n=o&&!e?`stack`:U.tab.peek()),Vo(s))})})}var os=180,ss=900,cs=`o:world`,ls=null,us=6;function ds(){U.moveMap.value&&(U.moveMap.value=!1,J.announce(`You moved the map, so it no longer moves with the run. Turn "Move map with the run" on to let it move again.`))}function fs(e,t=0,n=0){e===`down`?ls={x:t,y:n}:e===`move`?ls&&Math.hypot(t-ls.x,n-ls.y)>us&&(ls=null,ds()):e===`up`?ls=null:ds()}function ps(){G.flyTo.value=cs}function ms(e){let{debug:t,main:n,loop:r,focus:i}=W.parts,a=t.value,o=n.value,s=r.value,c=i.value;if(!a||!o||!s||!c)return null;let l=yi({debug:a,main:o,loop:s});return e?l?.id??null:(a.paused?l?.id:null)??c.at??c.waiting[0]?.at??l?.id??null}function hs(){let e=Sn(()=>ms(!1));e===null?J.announce(Eo.peek()?`Nothing is running at this point of the run, so there is no place to show.`:`There is no run to show yet.`):zo(e)}{let e,t=null,n=0,r=!0;Bn(()=>{let e=W.parts.length.value===0;e&&!r&&(t=null),r=e}),Bn(()=>{if(!U.moveMap.value){t=null,clearTimeout(e);return}let r=W.player.value?.playing===!0,i=ms(r);if(i===null||i===t)return;clearTimeout(e);let a=Math.max(os,r?n+ss-performance.now():0);e=setTimeout(()=>{U.moveMap.peek()&&(t=i,n=performance.now(),G.flyTo.value=i)},a)})}function Z({label:e,children:t,state:n,onAct:r,keys:i,pressed:a,kind:o=`plain`,class:s}){let c=Re(),l=n&&!n.enabled?n.reason??`Not available.`:null,u=l?`${e}: ${l}`:null,d=()=>{u&&(G.hint.value=u)},f=()=>{u&&G.hint.value===u&&(G.hint.value=null)};return j(`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?(G.hint.value=u,J.announce(u)):(G.hint.value=null,r())},children:[t??e,l?j(`span`,{id:c,class:`sr-only`,children:[`Not available. `,l]}):null]})}var gs={play:`M4.5 2.8v10.4L13 8z`,pause:`M4 3h3v10H4zM9 3h3v10H9z`,stop:`M3.5 3.5h9v9h-9z`,resume:`M3 3h2v10H3zM7 3l7 5-7 5z`,breakpoints:`M2 4h8.2L14 8l-3.8 4H2z`,breakpointsOff:`M2 4h8.2L14 8l-3.8 4H2zM3.4 5.4v5.2h6.2L12 8 9.600 5.400zM2.300 13.800L12.700 1.400l1.100 0.900L3.400 14.700z`,more:`M8 2.200a1.500 1.500 0 1 0 0 3 1.500 1.500 0 0 0 0-3zm0 4.300a1.500 1.500 0 1 0 0 3 1.500 1.500 0 0 0 0-3zm0 4.300a1.500 1.500 0 1 0 0 3 1.500 1.500 0 0 0 0-3z`,trash:`M6 2h4l.6 1.200H13.500v1.500h-11V3.200h2.900zM3.600 5.800h8.800l-.7 8.200H4.300zm2.200 1.600.3 5h1.300l-.2-5zm2.900 0-.2 5h1.300l.3-5z`,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 j(`svg`,{class:`icon`,viewBox:`0 0 16 16`,width:`16`,height:`16`,"aria-hidden":`true`,focusable:`false`,children:j(`path`,{d:gs[e],fill:`currentColor`,"fill-rule":`evenodd`})})}var _s=[`timers`,`pending`,`idle`,`prepare`,`poll`,`check`,`closing`];function vs(){return j(`select`,{class:`select codehead__module`,"aria-label":`How Node.js loads the snippet`,title:`How Node.js loads the snippet: as a CommonJS script or as an ES module`,value:U.module.value,onChange:e=>{U.module.value=e.currentTarget.value===`esm`?`esm`:`commonjs`},children:[j(`option`,{value:`commonjs`,children:`CommonJS`}),j(`option`,{value:`esm`,children:`ES module`})]})}function ys(){let e=q.source.value.kind===`snippet`,t=U.poolSize.value,n=J.controls.value.debug.reason;return j(`div`,{class:`runopts`,role:`group`,"aria-label":`Options for the next run`,children:[G.narrow.value&&e?j(`label`,{class:`field field--inline`,children:[j(`span`,{class:`field__label`,children:`Module`}),j(vs,{})]}):null,j(`label`,{class:`field field--inline`,title:`UV_THREADPOOL_SIZE for the next run. Empty leaves the environment alone (libuv's default is 4).`,children:[j(`span`,{class:`field__label`,children:`Pool size`}),j(`input`,{class:`input input--num`,type:`number`,inputMode:`numeric`,min:1,max:Va,placeholder:`default`,value:t??``,onChange:e=>{let t=e.currentTarget.value.trim(),n=Number(t);U.poolSize.value=t!==``&&Number.isInteger(n)&&n>=1&&n<=1024?n:null}})]}),j(`label`,{class:`check`,title:n??`Run stops at the first statement of the program, as if there were a breakpoint on it`,children:[j(`input`,{type:`checkbox`,checked:U.pauseOnStart.value,onChange:e=>{U.pauseOnStart.value=e.currentTarget.checked}}),`Pause on the first line`]}),j(`label`,{class:`check runopts__wide`,title:`Applies to runs that were never stopped: not after a pause at a breakpoint, not after Stop, and not when you paused, stepped or moved the timeline during the run.`,children:[j(`input`,{type:`checkbox`,checked:U.autoReplay.value,onChange:e=>{U.autoReplay.value=e.currentTarget.checked}}),j(`span`,{children:[`When a run finishes, replay it from the start. `,j(`span`,{class:`muted`,children:`Your program runs at full speed; this replays what was recorded, at the speed chosen in the bar below.`})]})]}),j(`label`,{class:`check runopts__wide`,title:`The helper captures a stack for every output and for every timer, promise, request and handle, to find the line of your program behind it.`,children:[j(`input`,{type:`checkbox`,checked:U.sourceLines.value,onChange:e=>{U.sourceLines.value=e.currentTarget.checked}}),j(`span`,{children:[`Record source lines.`,` `,j(`span`,{class:`muted`,children:`Lets a replay highlight the line of code it is at. Adds a little work per timer, promise and output line; in programs with millisecond races it can change which side wins more often.`})]})]})]})}function bs(){let e=J.controls.value,t=J.gates.value,[n,r]=O(`poll`),i=ut(e),a=J.provider.value?.caps.gates.phase===!0,o=J.liveStatus.value,s=o===`running`||o===`paused`||o===`gated`,c=xs(),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`;return j(`div`,{class:`gates`,children:[j(`p`,{class:`gates__head`,children:[j(`span`,{class:`label`,children:`Loop gates`}),j(`span`,{class:`fold__state${c.length>0&&a&&!s?` fold__state--armed`:` muted`}`,children:l})]}),j(`div`,{class:`gates__row`,role:`group`,"aria-label":`Event loop gates (probe build)`,children:[s||!a?j(Z,{label:`Pause at the next phase`,state:e.pauseAtNextPhase,onAct:()=>void J.gate({kind:`pauseAtNextPhase`}),children:`Next phase`}):j(Z,{label:`Start the next run stopped at the first phase`,pressed:t.phase,state:e.pauseAtNextPhase,onAct:()=>void J.setGate(`phase`,!t.phase),children:`Start stopped at the first phase`}),j(Z,{label:`Step one phase`,state:e.stepPhase,onAct:()=>void J.gate({kind:`stepPhase`}),children:`Step phase`}),j(`span`,{class:`gates__runto`,children:[j(Z,{label:`Run to the ${$t[n]} phase`,state:e.runToPhase,onAct:()=>void J.gate({kind:`runToPhase`,phase:n}),children:`Run to`}),j(`select`,{class:`select`,"aria-label":`Phase to run to`,value:n,onChange:e=>r(e.currentTarget.value),children:_s.map(e=>j(`option`,{value:e,children:$t[e]},e))})]}),j(`span`,{class:`label gates__title`,children:`Stop before`}),j(Z,{label:`Stop before a timer fires`,pressed:t.timer,state:e.gateTimer,onAct:()=>void J.setGate(`timer`,!t.timer),children:`Timer`}),j(Z,{label:`Stop before a pool thread starts a job`,pressed:t.poolStart,state:e.gatePoolStart,onAct:()=>void J.setGate(`poolStart`,!t.poolStart),children:`Pool start`}),j(Z,{label:`Stop before a pool thread posts its result`,pressed:t.poolPost,state:e.gatePoolPost,onAct:()=>void J.setGate(`poolPost`,!t.poolPost),children:`Pool post`}),j(Z,{label:`Resume from the gate`,state:e.gateResume,onAct:()=>void J.gate({kind:`resume`}),children:`Resume`})]}),i?j(`p`,{class:`gates__why`,children:i}):null]})}function xs(){let e=J.gates.value;return J.provider.value?.caps.gates.phase===!0?[e.phase?`stop at the first phase`:null,e.timer?`before timers`:null,e.poolStart?`before pool jobs start`:null,e.poolPost?`before pool results are posted`:null].filter(e=>e!==null):[]}function Ss(){return G.runMore.value?j(`div`,{class:`runmore`,id:`run-more`,role:`region`,"aria-label":`Run options and loop gates`,onKeyDown:e=>{e.key===`Escape`&&(G.runMore.value=!1,document.getElementById(`run-more-button`)?.focus())},children:[j(ys,{}),j(bs,{})]}):null}function Cs(){let e=J.controls.value,t=J.liveStatus.value,n=t===`paused`,r=t!==`idle`,i=G.narrow.value,a=q.breakpointsActive.value,o=G.runMore.value,s=j(Z,{label:`Stop`,kind:`danger`,keys:`Ctrl+.`,class:i?`ctl--icon`:``,state:e.stop,onAct:()=>void J.stop(),children:[j(Q,{name:`stop`}),i?null:j(`span`,{children:`Stop`})]});return j(`div`,{class:`toolbar codehead__run`,role:`toolbar`,"aria-label":`Run and debug`,children:[i&&r?null:j(Z,{label:`Run`,kind:`primary`,keys:`Ctrl+Enter`,class:`codehead__runbtn`,state:e.run,onAct:()=>void J.start(),children:[j(Q,{name:`play`}),j(`span`,{children:`Run`})]}),r?s:null,j(`span`,{class:`toolbar__sep`,"aria-hidden":`true`}),n?j(Z,{label:`Resume script execution`,keys:`F8 or Ctrl+\\`,class:`ctl--icon`,state:e.resume,onAct:()=>void J.debug(`resume`),children:j(Q,{name:`resume`})}):j(Z,{label:`Pause script execution`,keys:`F8 or Ctrl+\\`,class:`ctl--icon`,state:e.pause,onAct:()=>void J.debug(`pause`),children:j(Q,{name:`pause`})}),j(Z,{label:`Step over next function call`,keys:`F10 or Ctrl+'`,class:`ctl--icon`,state:e.stepOver,onAct:()=>void J.debug(`stepOver`),children:j(Q,{name:`stepOver`})}),j(Z,{label:`Step into next function call`,keys:`F11 or Ctrl+;`,class:`ctl--icon`,state:e.stepInto,onAct:()=>void J.debug(`stepInto`),children:j(Q,{name:`stepInto`})}),j(Z,{label:`Step out of current function`,keys:`Shift+F11 or Ctrl+Shift+;`,class:`ctl--icon`,state:e.stepOut,onAct:()=>void J.debug(`stepOut`),children:j(Q,{name:`stepOut`})}),j(Z,{label:a?`Deactivate breakpoints`:`Activate breakpoints`,keys:`Ctrl+F8`,class:`ctl--icon`,pressed:!a,onAct:()=>{q.setBreakpointsActive(!a),J.announce(a?`Breakpoints deactivated: the program will not stop at them.`:`Breakpoints activated.`)},children:j(Q,{name:a?`breakpoints`:`breakpointsOff`})}),j(`button`,{type:`button`,id:`run-more-button`,class:`ctl ctl--plain ctl--icon${o?` is-pressed`:``}`,"aria-label":`More run options`,title:`More: pool size, pause on the first line, replay when finished, record source lines, loop gates`,"aria-expanded":o?`true`:`false`,"aria-controls":`run-more`,onClick:()=>G.runMore.value=!o,children:j(Q,{name:`more`})})]})}var ws=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform),Ts=e=>`${ws?`⌥`:`Alt+`}${to[e]}`;function Es(e){e===`code`&&!To.applies(`code`)?To.shown.peek().panels&&U.tab.peek()===`code`?To.set(`panels`,!1):Ro(`code`):To.toggle(e)}function Ds(){let[e,t]=O(!1),n=A(null),r=A(null),i=Re(),a=To.shown.value,o=Aa.filter(e=>To.applies(e)),s=()=>[...r.current?.querySelectorAll(`[role^="menuitem"]`)??[]],c=e=>{t(!1),e&&n.current?.focus()},[l,u]=O(`first`);k(()=>{if(!e)return;let i=s();(l===`last`?i[i.length-1]:i[0])?.focus();let a=e=>{let i=e.target;!r.current?.contains(i)&&!n.current?.contains(i)&&t(!1)};return addEventListener(`pointerdown`,a,!0),()=>removeEventListener(`pointerdown`,a,!0)},[e]);let d=e=>{let n=s(),r=n.indexOf(document.activeElement),i=-1;if(e.key===`ArrowDown`)i=(r+1)%n.length;else if(e.key===`ArrowUp`)i=(r-1+n.length)%n.length;else if(e.key===`Home`)i=0;else if(e.key===`End`)i=n.length-1;else if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),c(!0);return}else if(e.key===`Tab`){t(!1);return}else if(e.key===` `||e.key===`Enter`)return;else if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=n.findIndex((t,n)=>n>r&&t.textContent?.trim().toLowerCase().startsWith(e.key.toLowerCase())),a=t>=0?t:n.findIndex(t=>t.textContent?.trim().toLowerCase().startsWith(e.key.toLowerCase()));if(a>=0)i=a;else return}else return;e.preventDefault(),e.stopPropagation(),n[i]?.focus()},f=e=>{e(),c(!0)};return j(`div`,{class:`viewmenu`,children:[j(`button`,{ref:n,type:`button`,class:`ctl ctl--plain topbar__view`,"aria-haspopup":`menu`,"aria-expanded":e?`true`:`false`,"aria-controls":e?i:void 0,title:`Show or hide the map, the code, the panels and the playback bar`,onClick:()=>{u(`first`),t(!e)},onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),e.stopPropagation(),u(e.key===`ArrowUp`?`last`:`first`),t(!0))},children:[`View`,j(Q,{name:`chevronDown`})]}),e?j(`div`,{ref:r,id:i,class:`viewmenu__list`,role:`menu`,"aria-label":`View`,onKeyDown:d,children:[o.map(e=>j(`button`,{type:`button`,class:`viewmenu__item`,role:`menuitemcheckbox`,"aria-checked":a[e]?`true`:`false`,"aria-keyshortcuts":`Alt+${to[e]}`,tabIndex:-1,onClick:()=>f(()=>To.toggle(e)),children:[j(`span`,{class:`viewmenu__check`,"aria-hidden":`true`,children:a[e]?`✓`:``}),j(`span`,{class:`viewmenu__label`,children:eo[e]}),j(`kbd`,{class:`viewmenu__keys`,"aria-hidden":`true`,children:Ts(e)})]},e)),j(`div`,{class:`viewmenu__sep`,role:`separator`}),j(`button`,{type:`button`,class:`viewmenu__item`,role:`menuitem`,tabIndex:-1,onClick:()=>f(()=>To.showAll()),children:[j(`span`,{class:`viewmenu__check`,"aria-hidden":`true`}),j(`span`,{class:`viewmenu__label`,children:`Show all`})]}),j(`button`,{type:`button`,class:`viewmenu__item`,role:`menuitem`,tabIndex:-1,title:`Show every area and put the dividers back where they started`,onClick:()=>f(()=>To.reset()),children:[j(`span`,{class:`viewmenu__check`,"aria-hidden":`true`}),j(`span`,{class:`viewmenu__label`,children:`Reset layout`})]})]}):null]})}function Os({area:e,class:t}){let n=`Hide ${eo[e].toLowerCase()}`;return j(`button`,{type:`button`,class:`ctl ctl--plain ctl--icon areaclose${t?` ${t}`:``}`,"aria-label":n,title:`${n} (${Ts(e)}; View menu to bring it back)`,onClick:()=>To.set(e,!1),children:j(Q,{name:`close`})})}function ks({area:e,vertical:t=!1}){return j(`button`,{type:`button`,class:`restore restore--${e}${t?` restore--vertical`:``}`,title:`Show ${eo[e].toLowerCase()} (${Ts(e)})`,onClick:()=>To.set(e,!0),children:[j(`span`,{class:`restore__name`,children:[eo[e],` hidden`]}),j(`span`,{class:`restore__dot`,children:` · `}),j(`span`,{class:`restore__show`,children:`Show`})]})}function As(){let e=Oo.value;if(e.origin===`recording`)return j(`div`,{class:`codehead__what`,children:[e.files.length>1?j(`select`,{class:`select`,"aria-label":`File of the recording`,value:Math.min(G.recordingSource.value,e.files.length-1),onChange:e=>{G.recordingSource.value=Number(e.currentTarget.value)},children:e.files.map((e,t)=>j(`option`,{value:t,children:e},t))}):j(`span`,{class:`codehead__name mono ellipsis`,title:e.name,children:e.name}),j(`span`,{class:`codehead__kind muted ellipsis`,title:`The text the recording carries. It is shown read-only and is never run.`,children:`from the recording · never run`})]});if(!X.value)return j(`div`,{class:`codehead__what`,children:[j(`span`,{class:`codehead__name mono ellipsis`,children:e.name}),j(`span`,{class:`codehead__kind muted`,children:`read-only`})]});let t=q.source.value.kind===`file`;return j(`div`,{class:`codehead__what`,children:[G.narrow.value?null:j(`button`,{type:`button`,class:`ctl ctl--plain codehead__program`,"aria-haspopup":`dialog`,title:`Choose what to run: the snippet, an example or a file`,onClick:()=>G.dialog.value=`program`,children:[j(Q,{name:`code`}),j(`span`,{class:`ellipsis mono`,children:e.name}),j(Q,{name:`chevronDown`})]}),G.narrow.value?null:t?j(`span`,{class:`codehead__kind muted ellipsis`,title:`A file on disk is shown read-only here; Run starts the file itself`,children:`file · read-only here`}):j(vs,{})]})}var js=`An official Node.js can be stopped only at a JavaScript statement. The operating system, the timers and the thread pool threads are not stopped with it: timers keep coming due and pool work keeps finishing while you look, so what happens after this pause may come in a different order than in a run without pauses. The probe build can freeze the loop clock and hold the pool threads instead.`,Ms=`The probe build holds the loop clock and the thread pool threads during this pause, so timers do not come due and no pool work starts or is handed back. Not held: work already running on a pool thread, Date.now(), the operating system and network peers.`;function Ns(){let e=W.parts.debug.value;if(!e?.paused)return null;let t=J.controls.value,n=e.frames[0],r=Oo.value,i=Po.value,a=W.parts.live.value&&W.parts.position.peek()===W.parts.length.peek(),o=J.liveStatus.value===`paused`&&a,s=n?i&&i.kind===`paused`?`line ${n.loc.line}`:`${n.origin===`node`?n.loc.url:un(n.loc.url)}, line ${n.loc.line}`:null,c=n&&!(i&&i.kind===`paused`)&&n.origin!==`node`&&r.text!==null;return j(`div`,{class:`codestrip codestrip--paused`,role:`status`,children:[j(`span`,{class:`codestrip__main`,children:[j(`strong`,{children:[o?Ci(e.reason):`${Ci(e.reason)} (recorded)`,s?` - ${s}`:``]}),c?j(`span`,{class:`muted`,children:` · in a file that is not open here`}):null]}),o?j(`span`,{class:`codestrip__acts`,children:[j(Z,{label:`Resume`,keys:`F8`,state:t.resume,onAct:()=>void J.debug(`resume`),children:[j(Q,{name:`resume`}),j(`span`,{children:`Resume`})]}),j(Z,{label:`Step over`,keys:`F10`,state:t.stepOver,onAct:()=>void J.debug(`stepOver`),children:[j(Q,{name:`stepOver`}),j(`span`,{children:`Step over`})]})]}):null,j(`details`,{class:`codestrip__time`,children:[j(`summary`,{title:`Why, and what it means for what you see`,children:[e.timeKeptRunning?`Real time keeps running`:`The clock is frozen`,j(`span`,{class:`codestrip__wide`,children:` while paused`}),` · why`]}),j(`p`,{children:e.timeKeptRunning?js:Ms})]})]})}function Ps(){let e=W.parts.debug.value,t=X.value,n=J.liveStatus.value,r=J.kind.value;if(e?.paused)return j(Ns,{});let i=W.tail.value,a=Eo.value&&!i.located&&i.status!==`running`&&i.status!==`idle`&&i.length>0?j(`span`,{class:`codestrip__note muted`,title:`The line highlight needs events that name a line of the program. This run has none.`,children:[`No line is highlighted: `,r===`recording`?`this recording has no source lines`:`this run recorded no source lines (switch on "Record source lines" under More)`,`.`]}):null,o=Po.value,s=Eo.value&&i.located&&n===`idle`?o&&o.tag?j(`span`,{class:`codestrip__line`,children:[`Line `,o.line,`: `,o.tag]}):j(`span`,{class:`codestrip__line muted`,children:o?`Line ${o.line}`:`No line: no JavaScript of this program is running at this point`}):null;if(r===`recording`)return s||a?j(`div`,{class:`codestrip`,children:[s,a]}):null;if(!t)return null;if(n===`starting`)return j(`div`,{class:`codestrip codestrip--running`,role:`status`,children:`Starting...`});if(n===`running`)return j(`div`,{class:`codestrip codestrip--running`,role:`status`,children:[j(`span`,{class:`live-dot is-on`,"aria-hidden":`true`}),`Running...`]});if(n===`gated`)return j(`div`,{class:`codestrip codestrip--running`,role:`status`,children:`Stopped at a gate (see the message above the map).`});let c=J.plan.value,l=xs();return j(`div`,{class:`codestrip`,children:[r===`live`?s:null,j(`span`,{class:`codestrip__plan${c.mode===`debug`?` codestrip__plan--debug`:``}`,title:`What pressing Run will do: ${c.says}. With a breakpoint (click a line number) Run stops there; without one the program runs at full speed, which keeps its real timing.`,children:[r===`live`&&s?`Run: `:``,c.says,l.length>0?` · gates armed: ${l.join(`, `)}`:``]}),r===`live`?a:null]})}function Fs({text:e}){let t=Oo.value,n=t.origin===`program`&&X.value,r=G.reveal.value,i=Po.value,a=q.name.value;return j(it,{text:e,language:`javascript`,readOnly:t.readOnly,label:t.readOnly?`Program text of ${t.name}, read-only`:`Program text of ${t.name}`,onChange:n?e=>q.setSnippetText(e):void 0,breakpoints:n?q.breakpoints.value:void 0,breakpointsActive:q.breakpointsActive.value,onToggleBreakpoint:n?e=>q.toggleBreakpoint(e,a):void 0,onBreakpointsMoved:n?e=>q.setFileBreakpoints(a,e):void 0,lineMark:i?{line:i.line,kind:i.kind,tag:i.tag}:null,range:r?{start:r.start,end:r.end}:null,revealKey:r?.ticket})}function Is(){let e=Oo.value,t=X.value,n=J.kind.value===`live`&&J.liveStatus.value!==`idle`&&!e.readOnly?`Edits apply to the next run.`:null;return j(`section`,{class:`editor`,"aria-label":`Program`,children:[j(`div`,{class:`codehead`,children:[j(As,{}),t?j(Cs,{}):null,G.narrow.value?null:j(Os,{area:`code`,class:`codehead__close`})]}),t?j(Ss,{}):null,j(Ps,{}),e.text===null?j(`p`,{class:`empty`,children:e.missing}):j(Fs,{text:e.text}),n?j(`p`,{class:`editor__note muted`,children:n}):null]})}var $=(e,t={})=>({key:e,...t}),Ls=[{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 (stops at breakpoints when there are any)`,combos:[$(`Enter`,{ctrl:!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}),$(`;`,{ctrl:!0,shift:!0})],helperOnly:!0},{id:`debug.toggleBreakpoints`,group:`Running and debugging`,label:`Deactivate or activate all breakpoints`,combos:[$(`F8`,{ctrl:!0})],helperOnly:!0},{id:`view.followAction`,group:`View`,label:`Move the map with the run: on or off`,combos:[$(`f`)]},{id:`view.showOnMap`,group:`View`,label:`Show on the map where the run is now (once)`,combos:[$(`m`)]},{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`)]},{id:`layout.map`,group:`View`,label:`Show or hide the map`,combos:[$(`1`,{alt:!0,code:`Digit1`})]},{id:`layout.code`,group:`View`,label:`Show or hide the code`,combos:[$(`2`,{alt:!0,code:`Digit2`})]},{id:`layout.panels`,group:`View`,label:`Show or hide the panels`,combos:[$(`3`,{alt:!0,code:`Digit3`})]},{id:`layout.playback`,group:`View`,label:`Show or hide the playback bar`,combos:[$(`4`,{alt:!0,code:`Digit4`})]}];function Rs(e){return e.length===1}function zs(e,t){let n=t.ctrlKey||t.metaKey;return!!e.ctrl!==n||!!e.alt!==t.altKey?!1:e.code!==void 0&&t.code?t.code===e.code&&!!e.shift===t.shiftKey:/^[a-z]$/i.test(e.key)?t.key.toLowerCase()===e.key.toLowerCase()&&!!e.shift===t.shiftKey:Rs(e.key)&&e.key!==` `?t.key===e.key&&(e.shift||e.ctrl?!!e.shift===t.shiftKey:!0):t.key===e.key&&!!e.shift===t.shiftKey}function Bs(e,t,n){for(let r of Ls)if(!r.helperOnly||n)for(let n of r.combos){if(!zs(n,e))continue;let i=!n.ctrl&&!n.alt&&!/^F\d+$/.test(n.key);if(!(t&&i))return r.id}return null}var Vs={" ":`Space`,ArrowLeft:`←`,ArrowRight:`→`,ArrowUp:`↑`,ArrowDown:`↓`};function Hs(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(Vs[e.key]??(e.key.length===1?e.key.toUpperCase():e.key)),n}function Us(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 Ws(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=Us(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 Gs(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 Ks(e,t){return e<=0||t<=0?0:Math.min(1,Math.sqrt(e/t))}function qs(e){return Math.min(1e3,Math.max(50,Math.floor(e/2)))}function Js(){let e=A(null),[t,n]=O({width:0,height:0});return Fe(()=>{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 Ys(e){return typeof matchMedia==`function`&&matchMedia(e).matches}function Xs(e){let[t,n]=O(()=>Ys(e));return k(()=>{let t=matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function Zs(){return Xs(`(pointer: coarse)`)?44:24}function Qs(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 $s=[{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`}],ec=44,tc=[[`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:ar.indexOf(e),color:t})),nc={timers:`--q-timers`,pending:`--q-pool`,idle:`--line-strong`,prepare:`--line-strong`,poll:`--q-io`,check:`--q-immediate`,closing:`--q-close`},rc=null;function ic(e,t){let n=`${t}|${matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}`;if(rc?.key===n)return rc.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`,...tc.map(e=>e.color),...Object.values(nc)])a(e);return rc={key:n,get:e=>i.get(e)??`#888`},rc.get}function ac(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):ec;(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=ic(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=ar.length,u=a-9,d=u-7,f=1;for(let e=0;e<s.width;e++){let t=0;for(let n of tc)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=or[s.phase[e]];if(r){let i=sr[s.phaseCertainty[e]],a=i===`inferred`?2:i===`model`?3:1;e%a===0&&(n.fillStyle=o(nc[r]??`--line-strong`),n.fillRect(t,0,Math.max(1,c-(a>1?.5:0)),5))}let i=0;for(let t of tc)i+=s.counts[e*l+t.index];if(i>0){let r=Math.max(2,Ks(i,f)*d),a=u;for(let u of tc){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=>(Us(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 oc(){let[e,t]=Js(),n=A(null),r=A(null),i=A(null),a=A(0),o=W.timeline.value,s=W.markers.value,c=W.player.value,l=U.timelineAxis.value,u=U.theme.value,d=c?.position??0,f=c?.length??0;k(()=>{t.width>0&&W.setTimeline(qs(t.width),l)},[t.width,l]),k(()=>(cancelAnimationFrame(a.current),a.current=requestAnimationFrame(()=>{n.current&&ac(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]),Fe(()=>{let e=o&&o.length>0?Ws(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]),k(()=>{let e=matchMedia(`(prefers-color-scheme: dark)`),t=()=>{n.current&&ac(n.current,{summary:W.timeline.peek(),markers:W.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();W.command({do:`pause`}),W.command(Gs(o,(t-r.left)/Math.max(1,r.width)))},m=A(null),h=f===0;return j(`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 ${on(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`?Yo(e.shiftKey?`event`:`step`,-1):e.key===`ArrowRight`||e.key===`ArrowUp`?Yo(e.shiftKey?`event`:`step`,1):e.key===`PageDown`?W.command({do:`seek`,position:Math.max(0,d-t)}):e.key===`PageUp`?W.command({do:`seek`,position:Math.min(f,d+t)}):e.key===`Home`?W.command({do:`seek`,position:0}):e.key===`End`?W.command({do:`seek`,position:f}):n=!1,n&&(e.preventDefault(),e.stopPropagation())},children:[j(`canvas`,{ref:n,class:`timeline__canvas`,"aria-hidden":`true`}),j(`div`,{ref:i,class:`timeline__future`,hidden:h}),j(`div`,{ref:r,class:`timeline__cursor`,hidden:h}),h?j(`span`,{class:`timeline__empty muted`,children:`The run will appear here.`}):null]})}var sc=[{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`}],cc=P(`step`),lc=e=>({enabled:!1,reason:e}),uc={enabled:!0,reason:null};function dc(){return j(`select`,{class:`select`,"aria-label":`What the step buttons move by`,value:cc.value,onChange:e=>{cc.value=e.currentTarget.value},children:sc.map(e=>j(`option`,{value:e.kind,title:e.hint,children:[`by `,e.label.toLowerCase()]},e.kind))})}var fc=`1× is about five steps a second`;function pc(){let e=J.replayStarts.value,[t,n]=O(!1),r=A(e);return k(()=>{if(e===r.current)return;r.current=e,n(!0);let t=setTimeout(()=>n(!1),3500);return()=>clearTimeout(t)},[e]),t}function mc({flash:e=!1}){return j(`select`,{class:`select transport__speed${e?` is-flash`:``}`,"aria-label":`Playback speed`,title:`Playback speed. ${fc}.`,value:String(U.speed.value),onChange:e=>{let t=Number(e.currentTarget.value);Oa.includes(t)&&(U.speed.value=t)},children:Oa.map(e=>j(`option`,{value:String(e),children:[e,`× (`,oo(e,5),`)`]},e))})}function hc(){let e=W.player.value,t=e?.length??0,n=e?.position??0,r=t===0,i=lc(`There is no run or recording to play yet.`),a=n<=0,o=n>=t,s=sc.find(e=>e.kind===cc.value)??sc[0],c=e?.live??!1,l=e?.deadTime??null,u=G.narrow.value,d=pc(),f=j(Z,{label:`Back one ${s.label.toLowerCase()}`,keys:`←`,class:`ctl--icon`,state:r?i:a?lc(`Already at the start.`):uc,onAct:()=>Yo(s.kind,-1),children:j(Q,{name:`stepBack`})}),p=j(Z,{label:e?.playing?`Pause playback`:`Play`,keys:`Space`,kind:`primary`,class:`ctl--icon transport__play`,state:r?i:uc,onAct:()=>{!e?.playing&&o&&!c&&W.command({do:`seek`,position:0}),W.command({do:`toggle`})},children:j(Q,{name:e?.playing?`pause`:`play`})}),m=j(Z,{label:`Forward one ${s.label.toLowerCase()}`,keys:`→`,class:`ctl--icon`,state:r?i:o?lc(`Already at the end.`):uc,onAct:()=>Yo(s.kind,1),children:j(Q,{name:`stepForward`})}),h=U.moveMap.value,g=j(x,{children:[j(Z,{label:`Move map with the run: ${h?`on`:`off`}`,keys:`F`,pressed:h,class:`transport__follow`,onAct:()=>{U.moveMap.value=!h},children:[j(Q,{name:`follow`}),j(`span`,{class:`transport__follow-word`,children:`Move map with the run`}),j(`span`,{class:`transport__follow-state`,children:h?`On`:`Off`})]}),j(Z,{label:`Show on map: fly once to where the run is now`,keys:`M`,class:`transport__show`,state:r?i:uc,onAct:()=>hs(),children:[j(Q,{name:`map`}),j(`span`,{class:`transport__follow-word`,children:`Show on map`})]})]});return u?j(`footer`,{class:`transport`,"aria-label":`Playback`,children:[j(oc,{}),j(`div`,{class:`toolbar transport__buttons`,role:`toolbar`,"aria-label":`Playback controls`,children:[f,p,m,j(`span`,{class:`transport__pos num`,"aria-hidden":`true`,children:r?`-`:`${n} / ${t}`}),g,j(`button`,{type:`button`,class:`ctl ctl--plain transport__menu${d?` is-flash`:``}`,title:`Speed and stepping. ${fc}.`,"aria-haspopup":`dialog`,"aria-label":`Playback options: speed ${U.speed.value}×, stepping by ${s.label.toLowerCase()}`,onClick:()=>G.dialog.value=`playback`,children:[U.speed.value,`× · `,s.label.toLowerCase()]}),j(Os,{area:`playback`})]})]}):j(`footer`,{class:`transport`,"aria-label":`Playback`,children:[j(`div`,{class:`toolbar transport__buttons`,role:`toolbar`,"aria-label":`Playback controls`,children:[j(Z,{label:`Go to the start`,keys:`Home`,class:`ctl--icon`,state:r?i:a?lc(`Already at the start.`):uc,onAct:()=>W.command({do:`seek`,position:0}),children:j(Q,{name:`toStart`})}),f,p,m,j(Z,{label:`Go to the end`,keys:`End`,class:`ctl--icon`,state:r?i:o?lc(`Already at the end.`):uc,onAct:()=>W.command({do:`seek`,position:t}),children:j(Q,{name:`toEnd`})}),j(`span`,{title:s.hint,children:j(dc,{})}),j(mc,{flash:d}),d?j(`span`,{class:`transport__speedhint`,role:`note`,children:[`Replaying. Speed: `,fc,`.`]}):null]}),j(oc,{}),j(`div`,{class:`transport__status`,children:[J.replaying.value?j(`span`,{class:`badge badge--replay`,title:`The program itself is over. This plays back what was recorded, from the start.`,children:`Replay`}):null,j(`span`,{class:`transport__pos num`,"aria-hidden":`true`,children:[r?`-`:`${n} / ${t}`,j(`span`,{class:`muted`,children:[` · `,r?``:on(e?.t??0)]})]}),l?j(`span`,{class:`transport__dead muted`,role:`status`,children:l.during===`nothing`?`Skipping ${sn(l.ms)} in which the loop only waited`:`Skipping ${sn(l.ms)} in which JavaScript ran without events`}):null,g,j(`button`,{type:`button`,class:`ctl ctl--plain`,"aria-pressed":U.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:()=>{U.timelineAxis.value=U.timelineAxis.value===`time`?`index`:`time`},children:U.timelineAxis.value===`time`?`By time`:`By events`}),X.value?j(Z,{label:`Follow the live run`,keys:`L`,pressed:!!(e?.follow&&c),state:c?uc:lc(`Only while a run is in progress. A recording or a finished run has no live end to follow.`),onAct:()=>W.command({do:`follow`,on:!(e?.follow??!1)}),children:[j(`span`,{class:`live-dot${e?.following?` is-on`:``}`,"aria-hidden":`true`}),`Live`]}):null,j(Os,{area:`playback`})]})]})}function gc({kind:e,children:t,onDismiss:n,role:r=`status`}){return j(`div`,{class:`banner banner--${e}`,role:r,children:[j(`div`,{class:`banner__text`,children:t}),n?j(`button`,{type:`button`,class:`ctl ctl--plain ctl--icon`,"aria-label":`Dismiss this message`,onClick:n,children:j(Q,{name:`close`})}):null]})}function _c(){let e=W.parts.debug.value;if(!e||e.paused)return null;if(e.gate.stopped)return j(yc,{});let t=e.lastPause;return t&&t.timeKeptRunning&&e.pauses>0?j(gc,{kind:`info`,children:[`This run was paused `,e.pauses,` time`,e.pauses===1?``:`s`,` before this point (last for `,sn(t.pausedMs),`). Real time kept running during the pauses, so the order of what follows may differ from a run without pauses.`]}):null}var vc={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 yc(){let e=W.parts.debug.value;if(!e)return null;let t=e.gate,n=J.controls.value,r=J.liveStatus.value===`gated`&&W.parts.live.value&&W.parts.position.peek()===W.parts.length.peek(),i=[t.phase?`${$t[t.phase]} phase`:null,t.job?`job ${fn(t.job,24)}`:null].filter(Boolean).join(`, `);return j(gc,{kind:`warn`,children:j(`div`,{class:`gatebanner`,children:[j(`div`,{children:[j(`strong`,{children:[`Stopped at the `,t.gate??`?`,` gate`,t.gate&&vc[t.gate]?`: ${vc[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?j(`div`,{class:`gatebanner__acts`,children:[j(Z,{label:`Step one phase`,kind:`primary`,state:n.stepPhase,onAct:()=>void J.gate({kind:`stepPhase`})}),j(Z,{label:`Resume from the gate`,state:n.gateResume,onAct:()=>void J.gate({kind:`resume`}),children:`Resume`})]}):null]})})}function bc(){let e=K.welcome.value,t=J.provider.value;return!e||e.atlas.matchesNode?null:j(gc,{kind:`warn`,children:[j(`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 xc(){let e=Y.returnTo.value,t=Y.index.value;if(Y.route.value.view!==`main`)return null;if(e){let n=t.status===`ready`?Mi(t.index).find(t=>t.id===e.lesson)?.title:void 0;return j(gc,{kind:`info`,children:j(`div`,{class:`learnlinks`,children:[j(`button`,{type:`button`,class:`ctl ctl--primary learn-back`,onClick:()=>Y.go({view:`learn`,lesson:e.lesson}),children:`Back to the lesson`}),n?j(`span`,{class:`muted ellipsis`,children:n}):null]})})}let n=Y.first.value;return!n||Y.introDismissed.value||Eo.value||J.opening.value||J.kind.value===`recording`?null:j(gc,{kind:`info`,onDismiss:()=>Y.dismissIntro(),children:[`New here?`,` `,j(`a`,{class:`learn-intro`,href:Ei({view:`learn`,lesson:n.id}),onClick:()=>Y.dismissIntro(),children:`Start the course: what nodejs-map is and how to read it`})]})}function Sc(){let e=ns.value,t=K.status.value,n=K.error.value,r=K.notices.value,i=J.error.value,a=W.problem.value,o=Co.state.value,s=J.recording.value;return j(`div`,{class:`banners`,children:[e?j(gc,{kind:`error`,role:`alert`,children:e}):null,t===`connecting`?j(gc,{kind:`info`,children:`Connecting to the helper...`}):null,(t===`closed`||t===`failed`)&&n?j(gc,{kind:`error`,role:`alert`,children:[n,` Recordings can still be opened and played.`]}):null,j(bc,{}),s&&o.status===`missing`?j(gc,{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,J.opening.value?j(gc,{kind:`info`,children:`Opening the recording. Nothing is being run.`}):null,J.notice.value?j(gc,{kind:`info`,onDismiss:()=>J.clearNotice(),children:J.notice.value}):null,i?j(gc,{kind:`error`,role:`alert`,onDismiss:()=>J.clearError(),children:i}):null,a?j(gc,{kind:`warn`,children:a}):null,r.map(e=>j(gc,{kind:e.level,onDismiss:()=>K.dismiss(e.id),children:e.text},e.id)),j(_c,{}),j(xc,{})]})}var Cc={observed:void 0,inferred:`4.6 3.25`,model:`0.01 3.13`};function wc({c:e}){return j(`svg`,{class:`mark-glyph mark-glyph--${e}`,viewBox:`0 0 14 14`,width:`14`,height:`14`,"aria-hidden":`true`,focusable:`false`,children:[j(`circle`,{cx:`7`,cy:`7`,r:`5`,fill:`none`,stroke:`currentColor`,"stroke-width":e===`model`?2:1.75,"stroke-dasharray":Cc[e],"stroke-linecap":e===`model`?`round`:`butt`}),e===`observed`?j(`circle`,{cx:`7`,cy:`7`,r:`2.4`,fill:`currentColor`}):null]})}function Tc({c:e,rule:t=null,index:n=null,subject:r,tabbable:i=!0}){return j(`button`,{type:`button`,class:`mark mark--${e}`,"aria-label":`${ti[e]}. How we know: ${r}`,title:`${ti[e]} - how we know`,tabIndex:i?0:-1,"data-certainty":e,onClick:i=>{i.stopPropagation(),Xo({certainty:e,ruleId:t,index:n,subject:r})},children:j(wc,{c:e})})}function Ec({fact:e,subject:t,tabbable:n}){return e?j(Tc,{c:e.c,rule:e.rule,index:e.index,subject:t,...n===void 0?{}:{tabbable:n}}):null}function Dc(){let e=K.providers.value,t=J.provider.value;return e.length===0?null:j(`label`,{class:`field field--inline topbar__provider`,title:J.liveStatus.value===`idle`?`The Node.js binary that runs your program`:`Applies to the next run`,children:[j(`span`,{class:`field__label`,children:`Node`}),j(`select`,{class:`select`,value:t?.id??``,onChange:e=>{let t=e.currentTarget.value;(t===`user`||t===`pinned`||t===`probe`)&&(U.provider.value=t)},children:e.map(e=>j(`option`,{value:e.id,disabled:!e.available,children:[e.title,e.available?``:` - not available${e.why?`: ${e.why}`:``}`]},e.id))})]})}function Oc({compact:e=!1}){let t=J.kind.value,n=J.recording.value,r=X.value;if(t===`recording`&&n)return j(`div`,{class:`topbar__what`,children:[j(`span`,{class:`badge badge--recording`,title:`A recording is played back from its event list. Nothing is run.`,children:`Recording`}),j(`span`,{class:`topbar__name ellipsis`,title:n.label,children:n.lesson?.title??n.header.title??n.label}),e?null:j(x,{children:[j(`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`:``]}),j(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>J.closeRecording(),children:r?`Close and return to the editor`:`Close`})]})]});if(!r)return j(`div`,{class:`topbar__what topbar__what--plain`,children:j(`span`,{class:`muted`,children:`Player: opens recordings and lessons. It cannot run code.`})});let i=J.liveStatus.value,a=t===`live`&&i===`idle`&&Eo.value,o=a&&J.replaying.value,s=`Finished - replaying from the start`;return j(`div`,{class:`topbar__what`,children:[G.narrow.value?j(`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:()=>G.dialog.value=`program`,children:[j(Q,{name:`code`}),j(`span`,{class:`ellipsis`,children:Oo.value.name}),j(Q,{name:`chevronDown`})]}):null,t===`live`?j(`span`,{class:`badge badge--${o?`replay`:i===`idle`?`ended`:`live`}`,title:o?`${s}. The program itself is over; this plays back what was recorded.`:void 0,children:i===`starting`?`Starting`:i===`running`?`Live run`:i===`paused`?`Live run, paused`:i===`gated`?`Live run, at a gate`:o?G.narrow.value?`Replaying`:s:a?`Finished run`:`Run`}):null]})}function kc(){return j(`button`,{type:`button`,class:`ctl ctl--plain topbar__legend`,"aria-haspopup":`dialog`,title:`What the three marks mean (I)`,onClick:()=>G.dialog.value=`legend`,children:ei.map(e=>j(`span`,{class:`legend-item mark--${e}`,children:[j(wc,{c:e}),j(`span`,{class:`legend-item__word`,children:ti[e]})]},e))})}function Ac({words:e=!1}){let t=e=>{let t=e.currentTarget,n=t.files?.[0];t.value=``,n&&(G.dialog.value===`more`&&(G.dialog.value=null),es(n))},n=Eo.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 j(`div`,{class:`toolbar`,role:`toolbar`,"aria-label":`Recordings`,children:[j(`label`,{class:`ctl ctl--plain ctl--file`,title:`Open a recording file. It is played back; nothing is run.`,children:[j(Q,{name:`open`}),j(`span`,{class:r,children:`Open`}),j(`input`,{type:`file`,class:`sr-only`,accept:`.nodejs-map,.gz,.ndjson,.txt,application/gzip,text/plain`,"aria-label":`Open a recording file`,onChange:t})]}),j(Z,{label:`Save as a recording file`,state:n,onAct:()=>G.dialog.value=`save`,children:[j(Q,{name:`save`}),j(`span`,{class:r,children:`Save`})]}),j(Z,{label:`Share as a link`,state:n,onAct:()=>G.dialog.value=`share`,children:[j(Q,{name:`share`}),j(`span`,{class:r,children:`Share`})]})]})}function jc(){let e=Y.route.value.view===`learn`;return j(`nav`,{class:`topbar__views`,"aria-label":`Views`,children:[j(`a`,{class:`ctl ctl--plain topbar__viewlink`,href:`#/`,"aria-current":e?void 0:`page`,children:`Map`}),j(`a`,{class:`ctl ctl--plain topbar__viewlink topbar__learn`,href:`#/learn`,"aria-current":e?`page`:void 0,children:`Learn`})]})}function Mc(){let e=X.value;return G.narrow.value?j(`header`,{class:`topbar`,children:[j(`h1`,{class:`topbar__brand`,children:`nodejs-map`}),j(jc,{}),j(Ds,{}),j(Oc,{compact:!0}),j(`button`,{type:`button`,class:`ctl ctl--plain topbar__more`,"aria-haspopup":`dialog`,"aria-label":`More: open, save, share, legend, theme, help`,onClick:()=>G.dialog.value=`more`,children:`More`})]}):j(`header`,{class:`topbar`,children:[j(`h1`,{class:`topbar__brand`,children:`nodejs-map`}),j(jc,{}),j(Ds,{}),j(Oc,{}),j(`div`,{class:`topbar__right`,children:[e?j(Dc,{}):null,j(Ac,{}),j(kc,{}),j(`button`,{type:`button`,class:`ctl ctl--plain ctl--icon`,"aria-label":`Switch between light and dark`,title:`Light or dark (Shift+D)`,onClick:Qo,children:j(Q,{name:`theme`})}),j(`button`,{type:`button`,class:`ctl ctl--plain ctl--icon`,"aria-label":`Keyboard shortcuts and help`,"aria-haspopup":`dialog`,title:`Keyboard shortcuts (?)`,onClick:()=>G.dialog.value=`help`,children:j(Q,{name:`help`})})]})]})}function Nc({title:e,onClose:t,children:n,wide:r}){let i=A(null),a=Re(),o=A(!0),s=()=>{o.current&&t()};return k(()=>{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()}},[]),j(`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:[j(`header`,{class:`dialog__head`,children:[j(`h2`,{id:a,class:`dialog__title`,children:e}),j(`button`,{type:`button`,class:`ctl ctl--plain ctl--icon`,"aria-label":`Close`,onClick:s,children:j(Q,{name:`close`})})]}),j(`div`,{class:`dialog__body`,children:n})]})}var Pc=()=>{G.dialog.value=null};function Fc(){return j(Nc,{title:`How sure is each thing on screen?`,onClose:Pc,children:[j(`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.`}),j(`ul`,{class:`legend`,children:ei.map(e=>j(`li`,{class:`legend__row edge edge--${e}`,children:[j(`span`,{class:`mark-inline mark--${e}`,children:j(wc,{c:e})}),j(`div`,{children:[j(`strong`,{children:ti[e]}),j(`span`,{class:`muted`,children:[` · `,e===`observed`?`solid`:e===`inferred`?`dashed`:`dotted`,` line`]}),j(`p`,{children:ni[e]})]})]},e))}),j(`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 Ic({id:e}){let t=Co.state.value,n=Do.value,[r,i]=O(null);k(()=>{let r=!0;if(i(null),t.status===`ready`)return Zi(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 j(`li`,{class:`cite`,children:[j(`div`,{class:`cite__main`,children:[j(`span`,{class:`cite__title`,children:r?r.title:e}),r?.path?j(`span`,{class:`cite__path mono muted`,children:[r.path,a]}):j(`span`,{class:`cite__path mono muted`,children:t.status===`ready`?r?r.note??e:`Looking it up...`:e})]}),j(`div`,{class:`cite__acts`,children:[r?.github?j(`a`,{class:`ctl ctl--plain`,href:r.github,target:`_blank`,rel:`noreferrer noopener`,children:[j(Q,{name:`external`}),j(`span`,{children:`GitHub`})]}):null,j(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>{G.mark.value=null,Bo(e)},children:`Read here`}),j(`button`,{type:`button`,class:`ctl ctl--plain ctl--icon`,"aria-label":`Show ${r?.title??e} on the map`,title:`Show on the map`,onClick:()=>{G.mark.value=null,zo(e)},children:j(Q,{name:`map`})})]})]})}function Lc({rule:e}){let t=Co.state.value;return j(`section`,{class:`rule`,"aria-label":`Rule ${e.id}`,children:[j(`h3`,{class:`rule__title`,children:[j(`span`,{class:`rule__id mono`,children:e.id}),` `,e.title]}),j(`p`,{class:`rule__statement`,children:e.statement}),j(`dl`,{class:`facts`,children:[j(`div`,{children:[j(`dt`,{children:`Produces`}),j(`dd`,{children:[j(`span`,{class:`mark-inline mark--${e.yields}`,children:j(wc,{c:e.yields})}),` `,ti[e.yields].toLowerCase(),` facts`]})]}),j(`div`,{children:[j(`dt`,{children:`Holds on`}),j(`dd`,{children:ci[e.platform]})]})]}),j(`h4`,{class:`label`,children:`Node.js source this rule relies on`}),t.status===`ready`?null:j(`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.`}),j(`ul`,{class:`cites`,children:e.cites.map(e=>j(Ic,{id:e},e))})]})}function Rc(){let e=G.mark.value;if(!e)return null;let t=si(e.ruleId),n=()=>{G.mark.value=null};return j(Nc,{title:`How we know`,onClose:n,wide:!0,children:[j(`p`,{class:`markdlg__subject`,children:e.subject}),j(`p`,{class:`markdlg__certainty edge edge--${e.certainty}`,children:[j(`span`,{class:`mark-inline mark--${e.certainty}`,children:j(wc,{c:e.certainty})}),j(`span`,{children:[j(`strong`,{children:[ti[e.certainty],`.`]}),` `,ni[e.certainty]]})]}),t?j(Lc,{rule:t}):e.ruleId?j(`p`,{class:`callout callout--warn`,children:[`The event names rule `,j(`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`?j(`p`,{children:`No rule was needed: the fact is shown as Node.js reported it.`}):j(`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:j(`p`,{class:`dialog__acts`,children:j(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>{let t=e.index;n(),t!==null&&(Jo(t),Ro(`events`))},children:[j(Q,{name:`jump`}),j(`span`,{children:[`Go to event `,e.index+1]})]})})]})}var zc=[`Playback`,`Stepping through the recording`,`Running and debugging`,`View`],Bc=new Set([`view.tab2`,`view.tab3`,`view.tab4`,`view.tab5`,`view.tab6`,`view.tab7`,`view.tab8`]);function Vc({keys:e}){return j(`span`,{class:`keys`,children:e.map((e,t)=>j(`kbd`,{children:e},t))})}function Hc({shortcut:e,mac:t}){let n=e.id===`view.tab1`;return j(`tr`,{children:[j(`th`,{scope:`row`,children:e.label}),j(`td`,{children:n?j(Vc,{keys:[`1`,`…`,`8`]}):e.combos.map((e,n)=>j(`span`,{children:[n>0?j(`span`,{class:`muted`,children:` or `}):null,j(Vc,{keys:Hs(e,t)})]},n))})]})}function Uc(){let e=X.value,t=/Mac|iPhone|iPad/.test(navigator.platform);return j(Nc,{title:`Keyboard shortcuts`,onClose:Pc,wide:!0,children:[j(`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.`}),zc.map(n=>{let r=Ls.filter(t=>t.group===n&&!Bc.has(t.id)&&(e||!t.helperOnly));return r.length===0?null:j(`table`,{class:`keytable`,children:[j(`caption`,{class:`label`,children:n}),j(`tbody`,{children:r.map(e=>j(Hc,{shortcut:e,mac:t},e.id))})]},n)}),j(`table`,{class:`keytable`,children:[j(`caption`,{class:`label`,children:`In lists and panels`}),j(`tbody`,{children:[$s.map(e=>j(`tr`,{children:[j(`th`,{scope:`row`,children:e.label}),j(`td`,{children:j(Vc,{keys:e.keys})})]},e.label)),e?j(`tr`,{children:[j(`th`,{scope:`row`,children:`Toggle a breakpoint on the current line (in the editor)`}),j(`td`,{children:j(Vc,{keys:[`F9`]})})]}):null]})]}),e?j(`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?j(`section`,{class:`helpnote`,children:[j(`h3`,{class:`label`,children:`What a pause stops`}),j(`p`,{children:[K.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 Wc(){let[e,t]=O(``),[n,r]=O({status:`loading`});k(()=>{let t=!0;return r({status:`loading`}),q.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 j(`div`,{class:`files`,children:[j(`p`,{class:`files__where mono`,children:[K.welcome.value?.folder??`folder`,`/`,e]}),n.status===`loading`?j(`p`,{class:`muted`,children:`Reading the folder...`}):null,n.status===`failed`?j(`p`,{class:`warn-text`,children:[`The folder could not be read: `,n.reason]}):null,n.status===`ready`?j(`ul`,{class:`files__list`,children:[e===``?null:j(`li`,{children:j(`button`,{type:`button`,class:`files__entry`,onClick:()=>t(i),children:[j(Q,{name:`chevronUp`}),j(`span`,{children:`Up one folder`})]})}),n.entries.length===0?j(`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 j(`li`,{children:e.kind===`dir`?j(`button`,{type:`button`,class:`files__entry`,onClick:()=>t(e.path),children:[j(Q,{name:`open`}),j(`span`,{class:`mono`,children:[n,`/`]})]}):j(`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:()=>{q.openFile(e.path),Pc()},children:[j(Q,{name:`code`}),j(`span`,{class:`mono`,children:n})]})},e.path)})]}):null]})}function Gc(){let e=q.examples.value,t=q.source.value;return j(Nc,{title:`Choose a program`,onClose:Pc,wide:!0,children:[j(`p`,{class:`dialog__lead`,children:`Choosing a program only shows it. It runs when you press Run.`}),j(`section`,{class:`pick`,children:[j(`h3`,{class:`label`,children:`Editor snippet`}),j(`button`,{type:`button`,class:`card`,onClick:()=>{q.useSnippet(),Pc()},children:[j(`span`,{class:`card__title`,children:[`Edit a snippet`,t.kind===`snippet`?` (current)`:``]}),j(`span`,{class:`card__text`,children:`Your text is kept in this browser between visits.`})]})]}),j(`section`,{class:`pick`,children:[j(`h3`,{class:`label`,children:`Examples`}),e.status===`ready`&&e.examples.length>0?j(`ul`,{class:`cards cards--dense`,children:e.examples.map(e=>j(`li`,{children:j(`button`,{type:`button`,class:`card`,onClick:()=>{q.loadExample(e),Pc()},children:[j(`span`,{class:`card__title`,children:e.title}),j(`span`,{class:`card__text`,children:e.summary}),e.racy?j(`span`,{class:`card__meta muted`,children:`The output order is a race and can differ between runs.`}):null]})},e.id))}):j(`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.`}),j(`p`,{class:`muted`,children:`Loading an example replaces the text of the snippet.`})]}),j(`section`,{class:`pick`,children:[j(`h3`,{class:`label`,children:`A file from the folder nodejs-map was started in`}),j(Wc,{})]})]})}function Kc({value:e,onChange:t}){let n=!!J.headerForSave(!0)?.sources?.length;return j(`fieldset`,{class:`choice`,children:[j(`legend`,{children:`Include the text of the program?`}),j(`label`,{class:`check`,children:[j(`input`,{type:`radio`,name:`include-source`,checked:!e,onChange:()=>t(!1)}),`No. The recording holds the events and the output only.`]}),j(`label`,{class:`check`,children:[j(`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:j(`p`,{class:`muted`,children:`The text of the program is not available for this run, so it cannot be included.`}),j(`p`,{class:`muted`,children:`Either way the recording contains everything the program printed.`})]})}function qc(){let[e,t]=O(!1),[n,r]=O(!0),[i,a]=O(!1);return j(Nc,{title:`Save the recording`,onClose:Pc,children:[j(Kc,{value:e,onChange:t}),j(`label`,{class:`check`,children:[j(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.currentTarget.checked)}),`Compress the file (gzip). Uncompressed, it is plain text you can read.`]}),j(`p`,{class:`dialog__acts`,children:j(`button`,{type:`button`,class:`ctl ctl--primary`,disabled:i,onClick:()=>{a(!0),J.save({includeSource:e,gzip:n}).then(e=>{a(!1),e&&($o(e.bytes,e.fileName,n?`application/gzip`:`text/plain`),J.announce(`Saved ${e.fileName}.`),Pc())})},children:[j(Q,{name:`save`}),j(`span`,{children:i?`Saving...`:`Save file`})]})}),J.error.value?j(`p`,{class:`warn-text`,children:J.error.value}):null]})}function Jc(){let[e,t]=O(!1),[n,r]=O(null),[i,a]=O(!1),[o,s]=O(!1),c=ts(),l=n?.ok&&c?`${c}#${n.fragment}`:null;return k(()=>{r(null),s(!1)},[e]),j(Nc,{title:`Share as a link`,onClose:Pc,children:[j(`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.`}),j(Kc,{value:e,onChange:t}),j(`p`,{class:`dialog__acts`,children:j(`button`,{type:`button`,class:`ctl ctl--primary`,disabled:i,onClick:()=>{a(!0),J.share(e).then(e=>{a(!1),r(e)})},children:[j(Q,{name:`share`}),j(`span`,{children:i?`Making the link...`:`Make the link`})]})}),n&&!n.ok?j(`div`,{class:`callout callout--warn`,children:[j(`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.`]}),j(`p`,{class:`dialog__acts`,children:j(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>G.dialog.value=`save`,children:[j(Q,{name:`save`}),j(`span`,{children:`Save the file`})]})})]}):null,n?.ok&&l?j(`div`,{class:`sharelink`,children:[j(`label`,{class:`field`,children:[j(`span`,{class:`field__label`,children:[`Link (`,n.length.toLocaleString(`en`),` characters)`]}),j(`input`,{class:`input mono`,type:`text`,readOnly:!0,value:l,onFocus:e=>e.currentTarget.select()})]}),j(`p`,{class:`dialog__acts`,children:j(`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:j(`p`,{class:`muted`,children:[`This link is longer than `,Gr.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?j(`div`,{class:`callout callout--info`,children:[j(`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.`]}),j(`p`,{class:`dialog__acts`,children:j(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>G.dialog.value=`save`,children:[j(Q,{name:`save`}),j(`span`,{children:`Save the file`})]})})]}):null,J.error.value?j(`p`,{class:`warn-text`,children:J.error.value}):null]})}function Yc(){let e=J.recording.value,t=X.value;return j(Nc,{title:`More`,onClose:Pc,children:[e?j(`div`,{class:`more__now`,children:[j(`p`,{children:[j(`strong`,{children:e.lesson?.title??e.header.title??e.label}),j(`br`,{}),j(`span`,{class:`muted`,children:[`Recording · Node `,e.header.node.version,` · `,e.events,` events. It is played back; nothing is run.`]})]}),j(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>{J.closeRecording(),Pc()},children:t?`Close the recording and return to the editor`:`Close the recording`})]}):t?null:j(`p`,{class:`muted`,children:`This is the player: it opens recordings and lessons. It cannot run code.`}),t?j(Dc,{}):null,j(Ac,{words:!0}),j(`p`,{class:`dialog__acts`,children:[j(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>G.dialog.value=`legend`,children:[ei.map(e=>j(`span`,{class:`mark-inline mark--${e}`,children:j(wc,{c:e})},e)),j(`span`,{children:`What the marks mean`})]}),j(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:Qo,children:[j(Q,{name:`theme`}),j(`span`,{children:`Light or dark`})]}),j(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>G.dialog.value=`help`,children:[j(Q,{name:`help`}),j(`span`,{children:`Help`})]})]})]})}function Xc(){let e=W.player.value,t=e?.length??0,n=e?.live??!1;return j(Nc,{title:`Playback`,onClose:Pc,children:[j(`div`,{class:`playback`,children:[j(`label`,{class:`field`,children:[j(`span`,{class:`field__label`,children:`Speed`}),j(mc,{}),j(`span`,{class:`field__hint muted`,children:[fc,`.`]})]}),j(`label`,{class:`field`,children:[j(`span`,{class:`field__label`,children:`The step buttons move by`}),j(dc,{})]})]}),j(`p`,{class:`dialog__acts`,children:[j(`button`,{type:`button`,class:`ctl ctl--plain`,disabled:t===0,onClick:()=>W.command({do:`seek`,position:0}),children:[j(Q,{name:`toStart`}),j(`span`,{children:`Go to the start`})]}),j(`button`,{type:`button`,class:`ctl ctl--plain`,disabled:t===0,onClick:()=>W.command({do:`seek`,position:t}),children:[j(Q,{name:`toEnd`}),j(`span`,{children:`Go to the end`})]})]}),j(`label`,{class:`check`,children:[j(`input`,{type:`checkbox`,checked:U.timelineAxis.value===`time`,onChange:e=>{U.timelineAxis.value=e.currentTarget.checked?`time`:`index`}}),`Draw the strip by time instead of by event count`]}),X.value?j(`label`,{class:`check`,children:[j(`input`,{type:`checkbox`,checked:!!e?.follow,disabled:!n,onChange:e=>W.command({do:`follow`,on:e.currentTarget.checked})}),`Follow the live run`,n?``:` (only while a run is in progress)`]}):null]})}function Zc(){k(()=>{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&&es(r)};return addEventListener(`dragover`,t),addEventListener(`dragleave`,n),addEventListener(`drop`,r),()=>{removeEventListener(`dragover`,t),removeEventListener(`dragleave`,n),removeEventListener(`drop`,r)}},[])}function Qc(){if(G.mark.value)return j(Rc,{});switch(G.dialog.value){case`legend`:return j(Fc,{});case`help`:return j(Uc,{});case`program`:return j(Gc,{});case`save`:return j(qc,{});case`share`:return j(Jc,{});case`more`:return j(Yc,{});case`playback`:return j(Xc,{});default:return null}}function $c({flyTo:e}){return ir(()=>{e.value!==null&&(e.value=null)}),j(`p`,{class:`map__status`,children:`Map loading...`})}var el=Object.values(Object.assign({"../map/index.ts":()=>tt(()=>import(`./map-mCCk9DTc.js`),__vite__mapDeps([2,3]),import.meta.url)}))[0];function tl(){let e=Co.state.value,[t,n]=O(null),[r,i]=O(!1);k(()=>{if(!el)return;let e=!0;return el().then(t=>{e&&n(()=>t.MapPanel)},()=>{e&&i(!0)}),()=>{e=!1}},[]);let a;if(e.status===`none`)a=j(`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=j(`p`,{class:`map__status`,children:[`Loading the map of Node.js `,e.tag,`...`]});else if(e.status===`missing`)a=j(`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=j(`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:Do.value,highlights:jo,userBoxes:ko,codeLine:Lo,selected:G.selected,flyTo:G.flyTo,onOpenSource:Bo};a=j(t||$c,{...n},e.commit)}return j(`section`,{class:`map`,"aria-label":`Map of Node.js`,onPointerDownCapture:e=>fs(`down`,e.clientX,e.clientY),onPointerMoveCapture:e=>{(e.buttons!==0||e.pointerType===`touch`)&&fs(`move`,e.clientX,e.clientY)},onPointerUpCapture:()=>fs(`up`),onPointerCancelCapture:()=>fs(`up`),onWheelCapture:()=>fs(`zoom`),onKeyDownCapture:e=>{!(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement)&&(e.key.startsWith(`Arrow`)||e.key===`+`||e.key===`-`||e.key===`=`||e.key===`0`)&&fs(`zoom`)},children:[a,j(Os,{area:`map`})]})}function nl(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 rl(e,t){function n(n){return this.shouldComponentUpdate=e=>!t(this.props,e),e(n)}return n.displayName=`memo(${e.name||`component`})`,n}var il=8e6;function al(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,il),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 ol(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,il-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 sl=80;function cl({count:e,rowHeight:t,renderRow:n,onWindow:r,keepVisible:i=null,label:a,class:o,onKeyDown:s,activeDescendant:c}){let[l,u]=Js(),d=A(0),[,f]=O(0),p=A(null),m=A(null),h=A(``),g=A(0),_=`${String(i)}|${+(u.height>0)}|${t}`;if(_!==h.current&&(h.current=_,i!==null&&u.height>0)){let n=ol(i,d.current,u.height,t,e,`page`);n!==null&&(d.current=n,l.current&&(l.current.scrollTop=n,g.current=performance.now()+sl))}let v=al(d.current,u.height,t,e,3);Fe(()=>{p.current?.style.setProperty(`height`,`${v.totalHeight}px`),m.current?.style.setProperty(`transform`,`translateY(${v.offset}px)`)},[v.totalHeight,v.offset]),k(()=>{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 j(`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:j(`div`,{ref:p,class:`vlist__spacer`,children:j(`div`,{ref:m,class:`vlist__rows`,children:y})})})}function ll({at:e,what:t}){return e?j(`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:()=>zo(e),children:j(Q,{name:`map`})}):null}function ul({item:e}){let t=e.loc;if(!t)return null;let n=`${un(t.url)}:${t.line}`;return dn(t.url,Oo.value.name)?j(`button`,{type:`button`,class:`row__loc link mono`,tabIndex:-1,title:`Show this line in the editor`,onClick:()=>Wo(t.line,t.line),children:n}):j(`span`,{class:`row__loc mono muted`,children:n})}function dl({item:e,queue:t}){let n=e.label?fn(e.label,40):mn(e.type);return j(`span`,{class:`chip${t?` chip--${t}`:``}`,title:Yt[e.type]?.meaning??`async_hooks type ${e.type}`,children:[j(`span`,{class:`chip__kind`,children:n??e.type}),j(`span`,{class:`chip__id num`,children:[`#`,e.id]}),n?j(`span`,{class:`chip__label`,children:e.type}):null]})}function fl(e){return Xt[e.type]}function pl({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?()=>Jo(e.index):void 0);return j(`li`,{class:`row edge edge--${d}${c?` is-selected`:``}`,"data-rowbox":!0,children:[j(Tc,{c:d,rule:e?.rule??n??null,index:e?.index??null,subject:r,tabbable:!1}),j(`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 ${on(e.t)}`:void 0,onClick:f,children:[s?j(`span`,{class:`row__tag`,children:s}):null,i]}),a?j(`span`,{class:`row__meta`,children:a}):null,j(ll,{at:o,what:r})]})}function ml({children:e}){return j(`p`,{class:`empty`,children:e})}function hl({title:e,count:t,aside:n,children:r,class:i}){return j(`section`,{class:`section${i?` ${i}`:``}`,children:[j(`header`,{class:`section__head`,children:[j(`h3`,{class:`label`,children:e}),t===void 0?null:j(`span`,{class:`section__count num`,children:t}),n?j(`span`,{class:`section__aside`,children:n}):null]}),r]})}function gl({helper:e}){return j(ml,{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 _l=60,vl=12,yl=P(gn.filter(e=>e!==`signals`)),bl=P(ei),xl=P(!0);function Sl(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}var Cl=rl(function({row:e,event:t,now:n,future:r}){return t?j(`div`,{id:`ev-${e}`,class:`ev edge edge--${t.c}${n?` is-now`:``}${r?` is-future`:``}`,role:`option`,"aria-selected":n?`true`:`false`,children:[j(Tc,{c:t.c,rule:t.rule,index:t.index,subject:t.text,tabbable:!1}),j(`span`,{class:`ev__n num`,children:t.index+1}),j(`span`,{class:`ev__t num`,title:t.approx?`The order of this event against its neighbours is approximate`:void 0,children:[t.approx?`~`:``,on(t.t)]}),j(`button`,{type:`button`,class:`ev__text`,tabIndex:-1,title:t.k,onClick:()=>Jo(t.index),children:t.text}),j(`span`,{class:`ev__src muted`,title:tn[t.src]??t.src,children:[en[t.src]??t.src,t.rule?` · ${t.rule}`:``]}),j(ll,{at:t.at,what:`this event's place`})]}):j(`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 wl(){let e=Zs(),t=yl.value,n=bl.value,r=xl.value,[i,a]=O(null),o=A({first:0,end:0}),s=A(!1),c=A(!1),l=W.parts.version.value,u=W.parts.position.value,d=W.parts.length.value,f=A({groups:t,certainty:n,position:u,version:l});f.current={groups:t,certainty:n,position:u,version:l};let p=A(null),m=Le(()=>{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-_l),l=Math.max(1,r-n)+120;W.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?nl(i,u):void 0,g=h??(i&&i.position===u?i.cursorRow:-1),_=i?.total??0,v=A(i);v.current=i;let y=Le((e,t)=>{let n=v.current;return n?n.offset<=Math.max(0,e-vl)&&n.offset+n.rows.length>=Math.min(n.total,t+vl):!1},[]),b=!p.current||p.current.groups!==t||p.current.certainty!==n||p.current.version!==l,x=h===void 0&&(!i||i.position!==u);k(()=>{(b||x||!y(o.current.first,o.current.end))&&m()},[b,x,i,m,y]);let S=Le((e,t)=>{o.current={first:e,end:t},y(e,t)||m()},[m,y]);if(d===0)return j(gl,{helper:X.value});let C=e=>i&&e>=i.offset?i.rows[e-i.offset]:void 0;return j(`div`,{class:`events`,children:[j(`div`,{class:`events__filters`,role:`group`,"aria-label":`Filter the event list`,children:[j(`div`,{class:`filter-row`,children:gn.map(e=>j(`button`,{type:`button`,class:`pill${t.includes(e)?` is-on`:``}`,"aria-pressed":t.includes(e)?`true`:`false`,onClick:()=>yl.value=Sl(t,e),children:_n[e]},e))}),j(`div`,{class:`filter-row`,children:[ei.map(e=>j(`button`,{type:`button`,class:`pill pill--mark${n.includes(e)?` is-on`:``}`,"aria-pressed":n.includes(e)?`true`:`false`,onClick:()=>bl.value=Sl(n,e),children:[j(`span`,{class:`mark-inline mark--${e}`,children:j(wc,{c:e})}),ti[e]]},e)),j(`label`,{class:`check`,children:[j(`input`,{type:`checkbox`,checked:r,onChange:e=>xl.value=e.currentTarget.checked}),`Keep the current event in view`]}),j(`span`,{class:`events__count num muted`,children:[_,` of `,i?.length??d,` events`]})]})]}),j(cl,{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);xl.value=!0,r?Jo(r.index):(o.current={first:Math.max(0,n-10),end:n+10},m())}else n&&(e.key===`i`?(e.preventDefault(),e.stopPropagation(),Xo({certainty:n.c,ruleId:n.rule,index:n.index,subject:n.text})):e.key===`m`&&n.at&&(e.preventDefault(),e.stopPropagation(),zo(n.at)))},activeDescendant:g>=0?`ev-${g}`:void 0,renderRow:e=>{let t=C(e);return j(Cl,{row:e,event:t,now:e===g,future:t!==void 0&&t.index>=u},e)}})]})}function Tl({lesson:e}){let t=e.steps??[],n=W.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&&(W.command({do:`pause`}),W.command({do:`seek`,position:n.index+1}))},a=t[r];return j(`section`,{class:`lesson`,"aria-label":`Lesson: ${e.title}`,children:t.length===0?j(x,{children:[j(`h3`,{class:`lesson__step`,children:e.title}),j(`p`,{class:`lesson__text`,children:e.summary||`This lesson has no written steps. Press play, or step through it.`})]}):j(x,{children:[j(`h3`,{class:`lesson__step`,"aria-live":`polite`,children:a?j(x,{children:[j(`span`,{class:`lesson__n num`,children:[r+1,`/`,t.length]}),` `,a.title||`Event ${a.index+1}`]}):e.title}),j(`p`,{class:`lesson__text`,children:a?a.text:e.summary||`Press Next step to begin.`}),j(`div`,{class:`steps__nav`,children:[j(`button`,{type:`button`,class:`ctl ctl--plain`,disabled:r<=0,onClick:()=>i(r-1),children:`Previous step`}),j(`button`,{type:`button`,class:`ctl ctl--primary`,disabled:r>=t.length-1,onClick:()=>i(r+1),children:`Next step`})]}),j(`details`,{class:`lesson__more`,children:[j(`summary`,{children:[`About this lesson, and all `,t.length,` steps`]}),j(`p`,{class:`lesson__title`,children:e.title}),e.summary?j(`p`,{class:`lessons__summary`,children:e.summary}):null,j(`ol`,{class:`steps`,onKeyDown:Qs,"aria-label":`Steps of the lesson`,children:t.map((e,t)=>j(`li`,{class:`step${t===r?` is-current`:``}`,"data-rowbox":!0,children:j(`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:[j(`span`,{class:`step__n num`,children:t+1}),j(`span`,{class:`step__title`,children:e.title||`Event ${e.index+1}`}),j(`span`,{class:`num muted`,children:[`event `,e.index+1]})]})},t))})]})]})})}function El(){let e=J.lessons.value;if(e.status===`none`)return j(ml,{children:`This copy of nodejs-map has no recorded lessons.`});if(e.status===`loading`)return j(ml,{children:`Loading the lessons...`});if(e.status===`failed`)return j(`p`,{class:`empty warn-text`,children:[`The lessons could not be loaded: `,e.reason]});if(e.lessons.length===0)return j(ml,{children:`There are no lessons yet.`});let t=J.recording.value?.lesson?.id??null;return j(`ul`,{class:`cards`,children:e.lessons.map(e=>j(`li`,{children:j(`button`,{type:`button`,class:`card${e.id===t?` is-open`:``}`,disabled:J.opening.value,onClick:()=>void J.openLesson(e),children:[j(`span`,{class:`card__title`,children:e.title}),j(`span`,{class:`card__text`,children:e.summary}),j(`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 Dl(){let e=q.examples.value;return e.status===`none`?null:j(hl,{title:`Programs to run`,children:[e.status===`loading`?j(ml,{children:`Loading the examples...`}):null,e.status===`failed`?j(`p`,{class:`empty warn-text`,children:[`The examples could not be loaded: `,e.reason]}):null,e.status===`ready`?j(`ul`,{class:`cards`,children:e.examples.map(e=>j(`li`,{children:j(`button`,{type:`button`,class:`card`,onClick:()=>{q.loadExample(e),J.announce(`Loaded ${e.title} into the editor. It has not been run.`),G.narrow.value&&Ro(`code`)},children:[j(`span`,{class:`card__title`,children:e.title}),j(`span`,{class:`card__text`,children:e.summary}),j(`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 Ol(){let e=X.value,t=J.recording.value?.lesson??null,n=j(x,{children:[e?j(Dl,{}):null,j(hl,{title:e?`Recorded lessons`:`Lessons`,children:j(El,{})})]});return j(`div`,{class:`panel-scroll lessons`,children:t?j(x,{children:[j(Tl,{lesson:t}),j(`details`,{class:`lesson__more`,children:[j(`summary`,{children:e?`Other examples and lessons`:`Other lessons`}),n]})]}):n})}var kl=W.parts,Al=[`timers`,`pending`,`idle`,`prepare`,`poll`,`check`,`closing`],jl={observed:void 0,inferred:`7 4`,model:`1.5 4`};function Ml(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 Nl=Al.map((e,t)=>Ml(t,Al.length,40));function Pl(){let e=kl.loop.value;if(!e)return null;let t=e.phase,n=e.phaseFrom?.c??`inferred`,r=Do.value,i=r===`win32`?`Windows`:r===`darwin`?`macOS`:`Linux`;return j(`div`,{class:`ring`,children:[j(`svg`,{class:`ring__svg`,viewBox:`0 0 100 100`,role:`img`,"aria-label":t?`Event loop phase: ${$t[t]}`:`Event loop: no phase known at this point`,children:[Al.map((e,r)=>{let i=e===t;return j(`path`,{d:Nl[r],class:`ring__seg${i?` is-lit ring__seg--${n}`:``}`,fill:`none`,"stroke-width":i?9:5,"stroke-dasharray":i?jl[n]:void 0,"stroke-linecap":`butt`},e)}),j(`text`,{x:`50`,y:`47`,"text-anchor":`middle`,class:`ring__turn-label`,children:`turn`}),j(`text`,{x:`50`,y:`62`,"text-anchor":`middle`,class:`ring__turn`,children:e.turn??`-`})]}),j(`div`,{class:`ring__side`,children:[j(`ol`,{class:`ring__list`,"aria-label":`Loop phases in the order libuv runs them`,onKeyDown:Qs,children:Al.map((n,r)=>{let i=n===t;return j(`li`,{class:`ring__item${i?` is-lit`:``}`,"data-rowbox":!0,children:[j(`button`,{type:`button`,class:`ring__phase`,"data-row":!0,tabIndex:r===0?0:-1,"aria-current":i?`step`:void 0,title:`Show the ${$t[n]} phase on the map`,onClick:()=>zo(Jt[n]),children:[j(`span`,{class:`ring__n num`,children:r+1}),$t[n]]}),i?j(Ec,{fact:e.phaseFrom,subject:`the loop is in the ${$t[n]} phase`,tabbable:!1}):null]},n)})}),j(`p`,{class:`ring__note`,children:[j(Tc,{c:`model`,rule:oi,subject:`the ring of loop phases`}),j(`span`,{children:[`Order of uv_run in libuv`,J.node.value?` ${J.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:j(`p`,{class:`ring__fact`,children:[j(Ec,{fact:e.turnFrom,subject:`loop turn ${e.turn}`}),j(`span`,{children:[`Loop turn `,e.turn]})]}),!t&&e.lastPhase?j(`p`,{class:`ring__fact`,children:[j(Ec,{fact:e.lastPhase.left,subject:`the loop left the ${$t[e.lastPhase.phase]} phase`}),j(`span`,{children:[`Between phases. Last one: `,$t[e.lastPhase.phase],`.`]})]}):null,e.lastSample?j(`p`,{class:`ring__fact`,children:[j(Ec,{fact:e.lastSample.from,subject:`libuv loop counters`}),j(`span`,{class:`num`,children:[`libuv counters: loop count `,e.lastSample.loopCount,`, events `,e.lastSample.events,`, waiting `,e.lastSample.eventsWaiting]})]}):null]})]})}function Fl(e){let t=e.queue?` from ${Zt[e.queue].toLowerCase()}`:``;switch(e.via){case`phase`:return`Taken${t} by the event loop${e.phase?` in the ${$t[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 Il(e){let[t,n]=O(null),r=e?.from.index??-1,i=e!==void 0&&e.queue!==`close`&&Hr.has(e.item.type);return k(()=>{if(!i)return;let e=!0;return W.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 Ll(){let e=kl.main.value,t=kl.run.value?.status??`idle`,n=e?.stack[e.stack.length-1],r=Il(e?.doing===`callback`?n:void 0);return e?e.doing===`callback`&&n?j(`div`,{children:[j(`p`,{class:`now__line`,children:[j(Ec,{fact:n.from,subject:`the callback of ${hn(n.item)} is running`}),j(`span`,{children:[`Running the `,r?`close callback`:`callback`,` of `,j(dl,{item:n.item,queue:n.queue}),n.depth>0?j(`span`,{class:`muted`,children:` (started inside another callback)`}):null]})]}),j(`p`,{class:`now__line`,children:[n.viaFrom?j(Ec,{fact:n.viaFrom,subject:`how ${hn(n.item)} reached the main thread`}):j(`span`,{class:`mark-gap`}),j(`span`,{children:Fl(n)})]})]}):e.doing===`main`?j(`p`,{class:`now__line`,children:[j(Ec,{fact:e.from,subject:`the main script is running`}),j(`span`,{children:`Running the main script: the program's top-level code, before the event loop starts turning.`})]}):j(`p`,{class:`now__line`,children:[e.from?j(Ec,{fact:e.from,subject:`no JavaScript is running`}):j(`span`,{class:`mark-gap`}),j(`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 Rl(){let e=kl.main.value,t=kl.version.value,n=(e?.stack[e.stack.length-1])?.item.id??null,[r,i]=O(null);if(k(()=>{if(n===null)return;let e=!0;return W.query({what:`why`,id:n}).then(t=>{e&&i({id:n,items:t.chain})}).catch(()=>void 0),()=>{e=!1}},[n,t]),n===null)return j(ml,{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?j(ml,{children:`Reading the chain...`}):j(`ol`,{class:`rows chain`,onKeyDown:Qs,"aria-label":`Why this callback ran, newest first`,children:[a.map((e,t)=>j(pl,{fact:e.created??e.lastStart,certainty:`inferred`,subject:e.created?`${hn(e)} was created`:`${hn(e)} exists`,mapId:fl(e),tag:t===0?`running`:`scheduled it`,first:t===0,meta:j(ul,{item:e}),children:[j(dl,{item:e,queue:e.queues[0]??null}),e.created?null:j(`span`,{class:`muted`,children:` created before recording began`})]},e.id)),j(`li`,{class:`row row--plain`,children:[j(`span`,{class:`mark-gap`}),j(`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 zl(){return j(`dd`,{class:`num`,children:[ln(kl.position.value,`event`),` of `,kl.length.value,` · `,on(kl.t.value)]})}function Bl(){let e=kl.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 j(`dl`,{class:`facts`,children:[j(`div`,{children:[j(`dt`,{children:`Program`}),j(`dd`,{children:[e.program??`-`,` `,e.mode?j(`span`,{class:`muted`,children:[`(`,e.mode===`debug`?`debug run`:`free run`,`)`]}):null]})]}),j(`div`,{children:[j(`dt`,{children:`State`}),j(`dd`,{children:[t,` `,j(Ec,{fact:e.status===`ended`?e.ended:e.started,subject:`run state: ${t}`})]})]}),j(`div`,{children:[j(`dt`,{children:`Position`}),j(zl,{})]}),e.node?j(`div`,{children:[j(`dt`,{children:`Node.js`}),j(`dd`,{children:[e.node.version,` `,j(`span`,{class:`muted`,children:[`(`,e.node.platform,` `,e.node.arch,`, libuv `,e.node.uv,`, pool size `,e.poolSize??`?`,`)`]})]})]}):null]})}function Vl(){let e=kl.notes.value;return!e||e.items.length===0?null:j(hl,{title:`Notes from the tool`,count:e.total,children:j(`ul`,{class:`notes`,children:e.items.map(e=>j(`li`,{class:`now__line${e.level===`warn`?` warn-text`:``}`,children:[j(Ec,{fact:e.from,subject:`a note from nodejs-map`}),j(`span`,{children:fn(e.text,400)})]},e.seq))})})}function Hl(){let e=kl.debug.value,t=e?.lastPause;return!e||!t||e.paused?null:j(`p`,{class:`now__line muted`,children:[j(Ec,{fact:t.resumed,subject:`the latest debugger pause`}),j(`span`,{children:[`Last pause: `,sn(t.pausedMs),`.`,t.timeKeptRunning?` Real time kept running during it.`:``]})]})}function Ul(){let e=kl.problems.value;return!e||e.unknown+e.malformed+e.inconsistent===0?null:j(`p`,{class:`now__line warn-text`,children:[j(`span`,{class:`mark-gap`}),j(`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 Wl(){return Eo.value?j(`div`,{class:`panel-scroll now`,children:[j(Bl,{}),j(hl,{title:`Main thread`,children:j(`div`,{class:`now__doing`,children:j(Ll,{})})}),j(hl,{title:`Event loop`,children:j(Pl,{})}),j(hl,{title:`Why this callback ran`,children:j(Rl,{})}),j(Vl,{}),j(Hl,{}),j(Ul,{})]}):j(gl,{helper:X.value})}var Gl=2e4;function Kl(e){return e.slice(0,Gl).replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g,``).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,`�`)}function ql({chunk:e,first:t}){let n=e.text.length>Gl;return j(`li`,{class:`out out--${e.stream}`,"data-rowbox":!0,children:[j(`button`,{type:`button`,class:`out__text mono`,"data-row":!0,tabIndex:t?0:-1,title:`${e.stream}, event ${e.index+1} at ${on(e.t)}. Activate to go there.`,onClick:()=>Jo(e.index),children:[e.stream===`stderr`?j(`span`,{class:`out__tag`,children:`stderr`}):null,Kl(e.text),n?j(`span`,{class:`muted`,children:[` … (`,e.text.length-Gl,` more characters)`]}):null]}),e.loc?j(`button`,{type:`button`,class:`out__loc mono`,title:`Written by line ${e.loc.line} of ${e.loc.url}. Activate to see the line.`,onClick:()=>{e.loc&&Ho(e.loc)},children:[un(e.loc.url),`:`,e.loc.line]}):null]})}function Jl(){let e=W.parts.output.value,t=A(null),n=e?.total??0,r=A(!0);return k(()=>{let e=t.current;e&&r.current&&(e.scrollTop=e.scrollHeight)},[n]),!Eo.value||!e?j(gl,{helper:X.value}):j(`div`,{class:`panel-scroll output`,ref:t,onScroll:e=>{let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<24},children:[j(`p`,{class:`note`,children:[j(Tc,{c:`observed`,subject:`program output`}),j(`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?j(ml,{children:e.total>0?`Reading the output...`:`The program has written nothing up to this point.`}):j(`ol`,{class:`outs`,"aria-label":`Program output, oldest first`,onKeyDown:Qs,children:e.chunks.map((e,t)=>j(ql,{chunk:e,first:t===0},e.seq))})]})}var Yl=W.parts,Xl=60;function Zl(e){return`${e.kind}${e.op?` ${fn(e.op,30)}`:``}`}function Ql({job:e}){return j(x,{children:[j(`span`,{class:`chip chip--pool`,children:[j(`span`,{class:`chip__kind`,children:Zl(e)}),j(`span`,{class:`chip__id mono`,children:fn(e.job,18)})]}),e.item?j(x,{children:[` for `,j(dl,{item:e.item})]}):j(`span`,{class:`muted`,children:` owner not known`})]})}function $l({thread:e}){let t=e.job,n=t?t.started??t.queued:null;return j(`li`,{class:`lane${t?` is-busy`:``} edge edge--${n?.c??`observed`}`,"data-rowbox":!0,children:[j(`div`,{class:`lane__id`,children:[j(`span`,{class:`lane__n`,children:[`Thread `,e.thread]}),j(`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}`})]}),j(`div`,{class:`lane__job`,children:t?j(x,{children:[j(Ec,{fact:n,subject:`pool thread ${e.thread} runs job ${t.job}`,tabbable:!1}),j(`button`,{type:`button`,class:`row__main`,"data-row":!0,tabIndex:-1,title:n?`Go to event ${n.index+1}`:void 0,onClick:()=>n&&Jo(n.index),children:j(Ql,{job:t})}),t.started?j(`span`,{class:`num muted`,children:[`since `,on(t.started.t)]}):null,j(ll,{at:t.at??M.poolWorker.id,what:`pool thread ${e.thread}`})]}):j(`span`,{class:`muted lane__idle`,children:`idle`})}),j(`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 eu({jobs:e,total:t,label:n,tag:r,which:i}){if(e.length===0)return j(ml,{children:`None.`});let a=e.slice(0,Xl);return j(`ol`,{class:`rows`,onKeyDown:Qs,"aria-label":n,children:[a.map((e,t)=>{let n=i===`queued`?e.queued:e.finished??e.started??e.queued;return j(pl,{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`?M.poolSubmit.id:M.poolDone.id),meta:j(x,{children:[e.thread===null?null:j(`span`,{class:`muted num`,children:[`thread `,e.thread]}),n?j(`span`,{class:`muted num`,children:[`since `,on(n.t)]}):null]}),children:j(Ql,{job:e})},e.job)}),t>a.length?j(`li`,{class:`row row--plain`,children:[j(`span`,{class:`mark-gap`}),j(`span`,{class:`row__text muted`,children:[`and `,t-a.length,` more.`]})]}):null]})}function tu(){let e=J.caps.value?.poolThreads??null;return e===`delayed`?j(`details`,{class:`callout callout--info callout--fold`,children:[j(`summary`,{children:[j(`strong`,{children:`Exact, but delayed.`}),` `,j(`span`,{class:`callout__more`,children:`more`})]}),j(`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`?j(`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 nu(){let e=Yl.pool.value,t=Yl.queues.pool.value;if(!Eo.value||!e||!t)return j(gl,{helper:X.value});let n=e.held;return j(`div`,{class:`panel-scroll pool`,children:[j(tu,{}),e.leftAtEnd?j(`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?j(`p`,{class:`now__line`,children:[j(Ec,{fact:n.from,subject:`a gate holds pool job ${n.job}`}),j(`span`,{children:[`Held at the `,n.gate,` gate: job `,j(`span`,{class:`mono`,children:fn(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,j(hl,{title:`Threads`,...e.size===null?{}:{count:`pool size ${e.size}`},aside:e.sizeFrom?j(Ec,{fact:e.sizeFrom,subject:`the thread pool has ${String(e.size)} threads`}):void 0,children:e.threads.length===0?j(ml,{children:`No pool thread has been seen yet. libuv creates the threads on the first job.`}):j(`ol`,{class:`lanes`,onKeyDown:Qs,"aria-label":`Thread pool threads`,children:e.threads.map(e=>j($l,{thread:e},e.thread))})}),j(`div`,{class:`pool__lines`,children:[j(hl,{title:`Waiting for a thread`,count:e.waiting.length,children:j(eu,{jobs:e.waiting,total:e.waiting.length,label:`Jobs waiting for a pool thread, oldest first`,tag:`next`,which:`queued`})}),j(hl,{title:`Finished, not delivered`,count:e.done.length,children:j(eu,{jobs:e.done,total:e.done.length,label:`Finished jobs whose result has not reached the loop, oldest first`,tag:`next`,which:`finished`})})]}),j(hl,{title:`Requests with the pool`,count:t.total,children:t.total===0?j(ml,{children:`None.`}):j(`ol`,{class:`rows`,onKeyDown:Qs,"aria-label":`Async requests whose work is with the thread pool`,children:t.entries.slice(0,Xl).map((e,t)=>j(pl,{fact:e.from,subject:`${hn(e.item)} is with the thread pool`,first:t===0,mapId:e.at??M.poolSubmit.id,meta:j(`span`,{class:`muted num`,children:[`since `,on(e.from.t)]}),children:j(dl,{item:e.item,queue:`pool`})},e.item.id))})}),j(hl,{title:`Totals`,children:[j(`dl`,{class:`facts facts--inline`,children:[j(`div`,{children:[j(`dt`,{children:`queued`}),j(`dd`,{class:`num`,children:e.counts.queued})]}),j(`div`,{children:[j(`dt`,{children:`started`}),j(`dd`,{class:`num`,children:e.counts.started})]}),j(`div`,{children:[j(`dt`,{children:`finished`}),j(`dd`,{class:`num`,children:e.counts.finished})]}),j(`div`,{children:[j(`dt`,{children:`delivered`}),j(`dd`,{class:`num`,children:e.counts.delivered})]})]}),e.tids.length>0?j(`ul`,{class:`tids`,"aria-label":`Real thread ids seen in trace events`,children:e.tids.map(e=>j(`li`,{class:`tids__item`,children:[j(Ec,{fact:e.from,subject:`thread ${e.tid} reported by Node`}),j(`span`,{class:`num`,children:[`tid `,e.tid]}),j(`span`,{class:`muted`,children:[e.busy?`busy with ${fn(e.name,30)}`:`idle`,` · `,e.starts,` started, `,e.ends,` finished`]})]},e.tid))}):null]})]})}var ru=W.parts,iu=60,au=[`nextTick`,`microtask`,`timers`,`immediate`,`io`,`close`];function ou({name:e,total:t}){return j(`header`,{class:`section__head queue__head`,title:Qt[e],children:[j(`span`,{class:`swatch swatch--${e}`,"aria-hidden":`true`}),j(`h3`,{class:`label`,children:Zt[e]}),j(`span`,{class:`section__count num`,children:t})]})}function su({shown:e,total:t}){return t<=e?null:j(`li`,{class:`row row--plain`,children:[j(`span`,{class:`mark-gap`}),j(`span`,{class:`row__text muted`,children:[`and `,t-e,` more behind these.`]})]})}function cu({what:e}){return j(`p`,{class:`note`,children:[j(`span`,{class:`mark-gap`}),j(`span`,{children:[`The run ended with `,e,` still waiting here. They never ran.`]})]})}function lu({name:e}){let t=ru.queues[e].value;if(!t)return null;let n=t.entries.slice(0,iu);return j(`section`,{class:`section queue queue--${t.name}`,children:[j(ou,{name:t.name,total:t.total}),t.total===0?j(ml,{children:`Empty.`}):j(`ol`,{class:`rows`,onKeyDown:Qs,"aria-label":`${Zt[t.name]}, next to run first`,children:[n.map((e,n)=>j(pl,{fact:e.from,subject:`${hn(e.item)} waits in ${Zt[t.name].toLowerCase()}`,tag:n===0?t.name===`io`?`oldest`:`next`:void 0,first:n===0,mapId:e.at??fl(e.item),meta:j(x,{children:[e.runs>0?j(`span`,{class:`muted num`,children:[`ran `,e.runs,`×`]}):null,j(ul,{item:e.item}),j(`span`,{class:`num muted`,children:[`since `,on(e.from.t)]})]}),children:j(dl,{item:e.item,queue:t.name})},e.item.id)),j(su,{shown:n.length,total:t.total})]}),t.leftAtEnd?j(cu,{what:t.total===1?`this item`:`these items`}):null]})}function uu({timer:e}){let t=(e.dueT-ru.t.value)/1e3;return j(`span`,{class:`num due`,children:[j(Ec,{fact:e.dueFrom,subject:`when ${hn(e.item)} is due`,tabbable:!1}),t>=0?`due in ${sn(t)}`:`overdue by ${sn(-t)}`]})}function du(e){return j(x,{children:[j(ul,{item:e.item}),j(`span`,{class:`num`,children:sn(e.delayMs)}),e.state===`waiting`?j(uu,{timer:e}):null,e.lateMs!==null&&e.state!==`waiting`?j(`span`,{class:`num due`,children:[j(Ec,{fact:e.dueFrom,subject:`how late ${hn(e.item)} ran`,tabbable:!1}),`ran `,sn(Math.max(0,e.lateMs)),` late`]}):null]})}function fu(){let e=ru.timers.value;if(!e)return null;let t=e.active.slice(0,iu),n=e.recent.slice(-8).reverse(),r=e.counts.waiting+e.counts.running;return j(`section`,{class:`section queue queue--timers`,children:[j(ou,{name:`timers`,total:r}),t.length===0?j(ml,{children:`No timer is waiting.`}):j(`ol`,{class:`rows`,onKeyDown:Qs,"aria-label":`Timers, soonest due first`,children:[t.map((e,t)=>j(pl,{fact:e.armed,subject:`${hn(e.item)} is ${e.state===`running`?`running`:`waiting`}`,tag:e.state===`running`?`running`:t===0?`due first`:void 0,first:t===0,mapId:fl(e.item),meta:du(e),children:[j(dl,{item:e.item,queue:`timers`}),e.repeat?j(`span`,{class:`muted`,children:` repeats`}):null]},e.item.id)),j(su,{shown:t.length,total:r})]}),e.leftAtEnd?j(cu,{what:r===1?`this timer`:`these timers`}):null,e.fired.count>0&&e.fired.last?j(`p`,{class:`note`,children:[j(Ec,{fact:e.fired.last.from,subject:`Node's libuv timer came due`}),j(`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 ${sn(e.fired.last.lateMs)} late`,`.`]})]}):null,n.length>0?j(`details`,{class:`recent`,children:[j(`summary`,{children:[`Finished or cleared (`,e.counts.done+e.counts.cleared,`)`]}),j(`ol`,{class:`rows`,onKeyDown:Qs,"aria-label":`Timers that ran or were cleared, latest first`,children:n.map((e,t)=>j(pl,{fact:e.cleared??e.lastRun??e.set,subject:`${hn(e.item)} ${e.state===`cleared`?`was cleared`:`ran`}`,tag:e.state===`cleared`?`cleared`:`ran`,first:t===0,mapId:fl(e.item),meta:du(e),children:j(dl,{item:e.item,queue:`timers`})},e.item.id))})]}):null]})}function pu(){let e=ru.queues.pool.value?.total??0;return j(hl,{title:`Elsewhere`,children:j(`p`,{class:`note`,children:[j(`span`,{class:`mark-gap`}),j(`span`,{children:[e,` request`,e===1?``:`s`,` with the thread pool: see the Thread pool panel. `,ru.itemCount.value,` async items seen so far.`]})]})})}function mu(){return Eo.value?j(`div`,{class:`panel-scroll queues`,children:[au.map(e=>e===`timers`?j(fu,{},e):j(lu,{name:e},e)),j(pu,{})]}):j(gl,{helper:X.value})}function hu(){let e=wo.target.value,t=wo.text.value,n=Co.state.value;if(!e)return j(`div`,{class:`panel-scroll source`,children:j(ml,{children:`Open a box on the map, a stack frame, an event or a rule citation to read its code here. When the program is stopped inside Node's own JavaScript, the file and the line are shown here by themselves. 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,i=X.value&&e.path?e.scriptUrl??Da(e.path):null,a=Fo.value;return j(`div`,{class:`source`,children:[j(`header`,{class:`source__head`,children:[j(`div`,{class:`source__title`,children:[j(`h3`,{class:`source__name`,children:e.title}),e.atlasId?j(`button`,{type:`button`,class:`ctl ctl--plain ctl--icon`,"aria-label":`Show on the map`,title:`Show on the map`,onClick:()=>e.atlasId&&zo(e.atlasId),children:j(Q,{name:`map`})}):null]}),e.description?j(`p`,{class:`source__desc`,children:e.description}):null,e.path?j(`p`,{class:`source__path mono`,children:[e.path,r?j(`span`,{class:`muted`,children:[` · `,r]}):null,n.status===`ready`?j(`span`,{class:`muted`,children:[` · Node `,n.tag,` @ `,n.commit.slice(0,10)]}):null]}):null,e.variant?j(`p`,{class:`source__variant mono muted`,children:[`when: `,e.variant]}):null,j(`div`,{class:`source__bar`,children:[e.github?j(`a`,{class:`ctl ctl--plain`,href:e.github,target:`_blank`,rel:`noreferrer noopener`,children:[j(Q,{name:`external`}),j(`span`,{children:`Open on GitHub`})]}):null,e.githubDev?j(`a`,{class:`ctl ctl--plain`,href:e.githubDev,target:`_blank`,rel:`noreferrer noopener`,title:Lt,children:[j(Q,{name:`external`}),j(`span`,{children:[`Open in web editor `,j(`span`,{class:`muted`,children:`(needs GitHub sign-in)`})]})]}):null]})]}),e.note?j(`p`,{class:`callout callout--info`,children:e.note}):null,t.status===`loading`?j(ml,{children:`Fetching the text...`}):null,t.status===`unavailable`?j(`p`,{class:`callout callout--warn`,children:t.reason}):null,t.status===`ready`&&e.path?j(x,{children:[j(it,{text:t.text,language:$i(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:a?{line:a.line,kind:a.kind,tag:a.tag}:null,breakpoints:i?q.marksFor(i):void 0,breakpointsActive:q.breakpointsActive.value,onToggleBreakpoint:i?e=>q.toggleBreakpoint(e,i):void 0,revealKey:`${e.path}:${String(e.start)}:${String(e.line)}`}),j(`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 gu=W.parts,_u=500,vu=8;function yu(e,t){let[n,r]=O({key:e,loaded:{status:`loading`}});return k(()=>{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 bu({run:e,objectId:t,depth:n,pauseKey:r}){let i=yu(`${r}|${t}`,async()=>(await K.request({op:`debug.props`,run:e,objectId:t})).variables);if(i.status===`loading`)return j(`p`,{class:`vars__note muted`,children:`Reading...`});if(i.status===`failed`)return j(`p`,{class:`vars__note warn-text`,children:[`Could not read the values: `,i.reason]});let a=i.value;return a.length===0?j(`p`,{class:`vars__note muted`,children:`Empty.`}):j(`ul`,{class:`vars`,children:[a.slice(0,_u).map((t,i)=>j(xu,{run:e,variable:t,depth:n,pauseKey:r},`${i}:${t.name}`)),a.length>_u?j(`li`,{class:`vars__note muted`,children:[`and `,a.length-_u,` more that are not shown.`]}):null]})}function xu({run:e,variable:t,depth:n,pauseKey:r}){let[i,a]=O(!1),o=t.objectId!==void 0&&n<vu,s=j(x,{children:[j(`span`,{class:`vars__name mono`,children:fn(t.name,80)}),j(`span`,{class:`vars__sep`,children:`: `}),j(`span`,{class:`vars__value mono vars__value--${/^[a-z]+$/.test(t.type)?t.type:`other`}`,children:fn(t.preview,200)})]});return j(`li`,{class:`vars__item`,children:[o?j(`button`,{type:`button`,class:`vars__toggle`,"aria-expanded":i?`true`:`false`,onClick:()=>a(!i),children:[j(Q,{name:i?`chevronDown`:`chevronRight`}),s]}):j(`span`,{class:`vars__leaf`,children:s}),i&&t.objectId!==void 0?j(bu,{run:e,objectId:t.objectId,depth:n+1,pauseKey:r}):null]})}function Su({run:e,scope:t,pauseKey:n,startOpen:r}){let[i,a]=O(r);return j(`li`,{class:`scope`,children:[j(`button`,{type:`button`,class:`scope__head`,"aria-expanded":i?`true`:`false`,onClick:()=>a(!i),children:[j(Q,{name:i?`chevronDown`:`chevronRight`}),j(`span`,{class:`label`,children:fn(t.kind,30)}),t.name?j(`span`,{class:`mono muted`,children:[` `,fn(t.name,60)]}):null]}),i?j(bu,{run:e,objectId:t.objectId,depth:0,pauseKey:n}):null]})}function Cu({debug:e,frame:t}){let n=W.tail.value.run,r=gu.position.value===gu.length.value,i=J.kind.value===`live`&&J.liveStatus.value===`paused`&&r&&n!==null,a=`${String(n)}|${e.from?.index??-1}|${t}`;return!i||n===null?j(ml,{children:J.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.`}):j(wu,{run:n,frame:t,pauseKey:a},a)}function wu({run:e,frame:t,pauseKey:n}){let r=yu(n,async()=>(await K.request({op:`debug.scopes`,run:e,frame:t})).scopes);return r.status===`loading`?j(ml,{children:`Reading the scopes...`}):r.status===`failed`?j(`p`,{class:`empty warn-text`,children:[`Could not read the scopes: `,r.reason]}):r.value.length===0?j(ml,{children:`This frame has no scopes.`}):j(`ul`,{class:`scopes`,children:r.value.map((t,r)=>j(Su,{run:e,scope:t,pauseKey:n,startOpen:r===0},`${r}:${t.objectId}`))})}function Tu(e){return`${e.origin===`node`?e.loc.url:un(e.loc.url)}:${e.loc.line}`}function Eu({debug:e}){let t=e.frames,n=Math.min(G.frame.value,t.length-1);return j(x,{children:[j(hl,{title:`Call stack`,count:t.length,aside:j(`span`,{class:`muted`,children:[`paused: `,e.reason??`unknown reason`]}),children:j(`ol`,{class:`rows`,onKeyDown:Qs,"aria-label":`JavaScript call stack, innermost first`,children:t.map((t,r)=>j(pl,{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:j(`span`,{class:`mono muted`,children:Tu(t)}),onActivate:()=>{G.frame.value=r,Vo(t)},children:j(`span`,{class:`mono`,children:fn(t.fn||`(anonymous)`,80)})},r))})}),j(hl,{title:`Scopes of frame ${n+1}`,children:j(Cu,{debug:e,frame:n})})]})}function Du(){let e=gu.main.value?.stack??[];return j(hl,{title:`Callbacks on the main thread`,count:e.length,children:[e.length===0?j(ml,{children:`No callback is running at this point.`}):j(`ol`,{class:`rows`,onKeyDown:Qs,"aria-label":`Callbacks on the main thread, innermost first`,children:[...e].reverse().map((e,t)=>j(pl,{fact:e.from,subject:`the callback of ${hn(e.item)}`,first:t===0,mapId:fl(e.item),meta:j(ul,{item:e.item}),children:j(dl,{item:e.item,queue:e.queue})},e.from.index))}),j(`p`,{class:`note`,children:[j(`span`,{class:`mark-gap`}),j(`span`,{children:[`The JavaScript call stack is recorded only where the debugger pauses.`,` `,X.value?`Click a line number to set a breakpoint, then press Run, to see it.`:`This position is not a pause.`]})]})]})}function Ou(e,t,n){return fn(((ha(e.file)?n:t)?.[e.line-1]??``).trim(),120)}function ku(){let e=q.allBreakpoints.value,t=q.breakpointsActive.value,n=q.name.value,r=q.text.value.split(`
|
|
16
|
+
`),i=wo.target.value,a=wo.text.value,o=i?.scriptUrl??null,s=a.status===`ready`?a.text.split(`
|
|
17
|
+
`):null,c=(gu.notes.value?.items??[]).filter(e=>e.level===`warn`&&/breakpoint/i.test(e.text));return j(hl,{title:`Breakpoints`,count:e.length,class:`bps`,aside:e.length>0?j(`button`,{type:`button`,class:`ctl ctl--plain bps__clear`,onClick:()=>q.removeAllBreakpoints(),children:`Remove all`}):null,children:[e.length===0?j(ml,{children:`No breakpoints. Click a line number in the code to set one: Run then stops there, and you can step line by line.`}):j(`ul`,{class:`bps__list`,"aria-label":`Breakpoints`,children:e.map(e=>{let i=Ea(e,n),a=`${e.file}:${e.line}`,l=c.findLast(t=>t.text.includes(`${e.file} line ${e.line}`));return j(`li`,{class:`bp${e.enabled&&t?``:` bp--off`}${l?` bp--warned`:``}`,children:[j(`input`,{type:`checkbox`,class:`bp__on`,checked:e.enabled,"aria-label":`Breakpoint at ${a}: on`,title:e.enabled?`Switch this breakpoint off without removing it`:`Switch this breakpoint on`,onChange:t=>q.setBreakpointEnabled(e.file,e.line,t.currentTarget.checked)}),j(`button`,{type:`button`,class:`bp__where`,disabled:!i,title:i?`Show this line`:`Kept for another program: it does not apply to the program in the editor`,onClick:()=>Ho({url:e.file,line:e.line}),children:[j(`span`,{class:`bp__tag mono`,children:a}),j(`span`,{class:`bp__text mono`,children:i?Ou(e,r,o===e.file?s:null):`another program`})]}),j(`button`,{type:`button`,class:`ctl ctl--plain ctl--icon bp__remove`,"aria-label":`Remove the breakpoint at ${a}`,title:`Remove this breakpoint`,onClick:()=>q.removeBreakpoint(e.file,e.line),children:j(Q,{name:`close`})}),l?j(`p`,{class:`bp__note warn-text`,role:`note`,children:fn(l.text,400)}):null]},a)})}),!t&&e.length>0?j(`p`,{class:`note`,children:[j(`span`,{class:`mark-gap`}),j(`span`,{children:[`Breakpoints are deactivated: the program does not stop at them.`,` `,j(`button`,{type:`button`,class:`linklike`,onClick:()=>q.setBreakpointsActive(!0),children:`Activate them`})]})]}):null]})}function Au(){let e=gu.debug.value,t=X.value;return!Eo.value||!e?t?j(`div`,{class:`panel-scroll stack`,children:[j(ku,{}),j(gl,{helper:!0})]}):j(gl,{helper:!1}):j(`div`,{class:`panel-scroll stack`,children:[t?j(ku,{}):null,e.paused?j(Eu,{debug:e}):e.gate.stopped?j(x,{children:[j(`p`,{class:`now__line`,children:[j(Ec,{fact:e.gate.from,subject:`the program is stopped at a gate`}),j(`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.`]})]}),j(Du,{})]}):j(Du,{})]})}var ju=[{id:`code`,label:`Code`,panel:Is},{id:`now`,label:`Now`,panel:Wl},{id:`stack`,label:`Stack`,panel:Au},{id:`queues`,label:`Queues`,panel:mu,badge:()=>{let e=W.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:nu,badge:()=>W.parts.queues.pool.value?.total??null},{id:`output`,label:`Output`,panel:Jl,badge:()=>W.parts.output.value?.total??null},{id:`events`,label:`Events`,panel:wl},{id:`source`,label:`Source`,panel:hu},{id:`lessons`,label:`Lessons`,panel:Ol}];function Mu(e){return e?ju:ju.filter(e=>e.id!==`code`)}function Nu(){let e=G.narrow.value,t=Mu(e),n=X.value,r=U.tab.value,i=t.find(e=>e.id===r)??t.find(e=>e.id===`now`),a=i.panel,o=A(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 Fe(()=>{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]),k(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(c);return t.observe(e),()=>t.disconnect()},[]),j(`section`,{class:`panels${e?` panels--sheet`:``}`,"aria-label":`Panels`,children:[j(`div`,{class:`panels__bar`,children:[j(`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];Ro(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 j(`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:()=>Ro(e.id),children:[a,r!==null&&r>0?j(`span`,{class:`tab__count num`,children:r>999?`999+`:r}):null]},e.id)})}),j(Os,{area:`panels`})]}),j(`div`,{id:`tabpanel`,class:`panels__body`,role:`tabpanel`,"aria-labelledby":`tab-${i.id}`,children:j(a,{})})]})}function Pu({axis:e,value:t,label:n,min:r=La,max:i=Ra,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 j(`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 Fu(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 Iu(e){switch(e){case`player.toggle`:return W.command({do:`toggle`});case`player.stepForward`:return Yo(`step`,1);case`player.stepBack`:return Yo(`step`,-1);case`player.eventForward`:return Yo(`event`,1);case`player.eventBack`:return Yo(`event`,-1);case`player.callbackForward`:return Yo(`callback`,1);case`player.callbackBack`:return Yo(`callback`,-1);case`player.phaseForward`:return Yo(`phase`,1);case`player.phaseBack`:return Yo(`phase`,-1);case`player.turnForward`:return Yo(`turn`,1);case`player.turnBack`:return Yo(`turn`,-1);case`player.outputForward`:return Yo(`output`,1);case`player.outputBack`:return Yo(`output`,-1);case`player.pauseForward`:return Yo(`pause`,1);case`player.pauseBack`:return Yo(`pause`,-1);case`player.start`:return W.command({do:`seek`,position:0});case`player.end`:return W.command({do:`seek`,position:W.player.value?.length??0});case`player.slower`:return Zo(-1);case`player.faster`:return Zo(1);case`player.followLive`:return W.command({do:`follow`,on:!(W.player.value?.follow??!1)});case`view.followAction`:U.moveMap.value=!U.moveMap.value,J.announce(U.moveMap.value?`The map now moves with the run.`:`The map no longer moves with the run.`);return;case`view.showOnMap`:return hs();case`run.run`:J.start();return;case`run.stop`:J.stop();return;case`debug.pauseResume`:J.pauseOrResume();return;case`debug.stepOver`:J.debug(`stepOver`);return;case`debug.stepInto`:J.debug(`stepInto`);return;case`debug.stepOut`:J.debug(`stepOut`);return;case`debug.toggleBreakpoints`:{let e=!q.breakpointsActive.value;q.setBreakpointsActive(e),J.announce(e?`Breakpoints activated.`:`Breakpoints deactivated: the program will not stop at them.`);return}case`view.legend`:G.dialog.value=`legend`;return;case`view.help`:G.dialog.value=`help`;return;case`view.theme`:return Qo();case`layout.map`:return Es(`map`);case`layout.code`:return Es(`code`);case`layout.panels`:return Es(`panels`);case`layout.playback`:return Es(`playback`);default:{let t=Number(e.slice(8)),n=Mu(G.narrow.value)[t-1];n&&Ro(n.id)}}}function Lu(){k(()=>{let e=e=>{if(e.defaultPrevented||e.isComposing||document.querySelector(`dialog[open]`)||Y.route.value.view===`learn`)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=Bs(e,Fu(t),X.value);n&&(e.preventDefault(),Iu(n))};return addEventListener(`keydown`,e),()=>removeEventListener(`keydown`,e)},[])}function Ru(){let e=G.hint.value;return k(()=>{if(!e)return;let t=setTimeout(()=>{G.hint.value===e&&(G.hint.value=null)},8e3);return()=>clearTimeout(t)},[e]),e?j(`p`,{class:`hint`,children:e}):null}var zu=null;function Bu(){let[e,t]=O(null),[n,r]=O(!1);return k(()=>{let e=!0;return zu??=tt(()=>import(`./LearnView-Cqz9Ux8w.js`),__vite__mapDeps([4,5]),import.meta.url),zu.then(n=>{e&&t(()=>n.LearnView)},()=>{zu=null,e&&r(!0)}),()=>{e=!1}},[]),j(`div`,{class:`learn-slot`,children:e?j(e,{}):j(`p`,{class:`empty`,children:n?`The Learn page could not be loaded. Reload the page to try again.`:`Loading the Learn page...`})})}function Vu(){let e=G.narrow.value,t=Y.route.value.view===`learn`,n=A(null),r=A(null),i=U.splitMap.value,a=U.splitEditor.value,o=U.splitSheet.value;Lu(),Zc(),Fe(()=>{n.current?.style.setProperty(`--split-map`,String(i)),n.current?.style.setProperty(`--split-sheet`,String(o)),r.current?.style.setProperty(`--split-editor`,String(a))},[i,a,o,e]);let s=To.shown.value,c=!s.code&&!s.panels,l=`layout${s.map?``:` layout--nomap`}${e?s.panels?``:` layout--nopanels`:c?` layout--noside`:``}`,u=`side${s.code?``:` side--nocode`}${s.panels?``:` side--nopanels`}`;return j(`div`,{class:`app${e?` app--narrow`:``}${t?` app--learn`:``}${s.playback?``:` app--noplayback`}`,children:[t||!s.panels?null:j(`a`,{class:`skip`,href:`#tabpanel`,children:`Skip to the panels`}),j(Mc,{}),j(Sc,{}),t?j(Bu,{}):null,j(`div`,{class:l,ref:n,hidden:t,children:[j(tl,{}),s.map?null:j(ks,{area:`map`,vertical:!e}),e?j(x,{children:[j(Pu,{axis:`y`,value:U.splitSheet,min:za,max:Ba,class:`splitter--sheet`,label:`Drag to give the panels more or less height`}),j(Nu,{}),s.panels?null:j(ks,{area:`panels`})]}):j(x,{children:[j(Pu,{axis:`x`,value:U.splitMap,class:`splitter--map`,label:`Resize the map and the side panels`}),j(`div`,{class:u,ref:r,children:[s.code?null:j(ks,{area:`code`}),j(Is,{}),j(Pu,{axis:`y`,value:U.splitEditor,class:`splitter--editor`,label:`Resize the editor and the panels`}),j(Nu,{}),s.panels?null:j(ks,{area:`panels`})]}),c?j(`div`,{class:`restore-col`,children:[j(ks,{area:`code`,vertical:!0}),j(ks,{area:`panels`,vertical:!0})]}):null]})]}),t?null:j(Ru,{}),j(hc,{}),s.playback||t?null:j(ks,{area:`playback`}),j(`p`,{class:`sr-only`,role:`status`,"aria-live":`polite`,children:J.announcement.value}),j(Qc,{})]})}_e(`script`);var Hu=document.getElementById(`app`);Hu&&(Hu.textContent=``,he(j(Vu,{}),Hu),_e(`rendered`),as());export{x as C,O as S,tt as _,Go as a,Fe as b,Ri as c,Zn as d,ir as f,Rt as g,Bt as h,qo as i,Mi as l,zt as m,X as n,Ko as o,Lt as p,Y as r,G as s,Q as t,Ei as u,j as v,y as w,A as x,k as y};
|
|
18
|
+
//# sourceMappingURL=index-eLItdROg.js.map
|