nodejs-map 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +95 -2
- package/dist/app/assets/app.worker-PoneE3J2.js +8 -0
- package/dist/app/assets/app.worker-PoneE3J2.js.map +1 -0
- package/dist/app/assets/atlas.worker-B0xwOHwo.js +2 -0
- package/dist/app/assets/atlas.worker-B0xwOHwo.js.map +1 -0
- package/dist/app/assets/cm-BiB0hvWw.js +13 -0
- package/dist/app/assets/cm-BiB0hvWw.js.map +1 -0
- package/dist/app/assets/dist-B37Ex44M.js +2 -0
- package/dist/app/assets/dist-B37Ex44M.js.map +1 -0
- package/dist/app/assets/dist-hDhUT_Vg.js +2 -0
- package/dist/app/assets/dist-hDhUT_Vg.js.map +1 -0
- package/dist/app/assets/index-2K-ozYKf.js +16 -0
- package/dist/app/assets/index-2K-ozYKf.js.map +1 -0
- package/dist/app/assets/index-Cw18rDSZ.css +1 -0
- package/dist/app/assets/map-Cnxgv4Ve.js +129 -0
- package/dist/app/assets/map-Cnxgv4Ve.js.map +1 -0
- package/dist/app/assets/map-Cz4s03Wm.css +1 -0
- package/dist/app/assets/sdf-label-font-1nAa0TP8.png +0 -0
- package/dist/app/config.json +5 -0
- package/dist/app/favicon.svg +1 -0
- package/dist/app/index.html +21 -0
- package/dist/atlas/v26.13.1/build-report.json +178 -0
- package/dist/atlas/v26.13.1/chunks/lib.bootstrap.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.core.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.crypto.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.devtools.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.events.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.fs.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.modules.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.net.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.net.1.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.platform.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.process.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.rest.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.streams.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.timers.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.workers.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.zlib.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.callbacks.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.crypto.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.diag.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.fs.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.inspector.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.loop.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.modules.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.napi.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.net.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.net.1.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.process.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.rest.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.support.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.zlib.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/uv.api.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/uv.backends.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/uv.fs.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/uv.loop.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/uv.net.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/uv.rest.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/uv.threadpool.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.api.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.asmjs.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.ast.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.base.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.baseline.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.bigint.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.builtins.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.codegen.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.codegen.riscv.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.common.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.compiler-dispatcher.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.compiler.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.compiler.backend.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.compiler.turboshaft.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.d8.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.date.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.debug.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.deoptimizer.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.diagnostics.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.dumpling.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.execution.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.extensions.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.flags.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.fuzzilli.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.handles.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.heap.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.heap.cppgc.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.ic.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.init.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.inspector.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.interpreter.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.json.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.libplatform.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.libsampler.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.logging.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.maglev.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.numbers.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.objects.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.parsing.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.profiler.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.regexp.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.root.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.roots.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.runtime.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.sandbox.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.snapshot.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.strings.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.tasks.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.torque.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.tracing.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.trap-handler.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.utils.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.wasm.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.zone.0.json +1 -0
- package/dist/atlas/v26.13.1/edges.json +1 -0
- package/dist/atlas/v26.13.1/files.json +1 -0
- package/dist/atlas/v26.13.1/index.json +1 -0
- package/dist/atlas/v26.13.1/link-check.json +16 -0
- package/dist/atlas/v26.13.1/search.json +1 -0
- package/dist/cli.js +6002 -0
- package/dist/examples.json +1 -0
- package/dist/lessons/async-await-chain.nmrec.gz +0 -0
- package/dist/lessons/beforeexit-and-exit.nmrec.gz +0 -0
- package/dist/lessons/dns-lookup-thread-pool.nmrec.gz +0 -0
- package/dist/lessons/esm-twist.nmrec.gz +0 -0
- package/dist/lessons/eventemitter-is-synchronous.nmrec.gz +0 -0
- package/dist/lessons/fs-promises-await.nmrec.gz +0 -0
- package/dist/lessons/fs-sync-vs-async.nmrec.gz +0 -0
- package/dist/lessons/index.json +621 -0
- package/dist/lessons/interval-and-clear.nmrec.gz +0 -0
- package/dist/lessons/nested-ticks-and-microtasks.nmrec.gz +0 -0
- package/dist/lessons/pbkdf2-six-jobs-four-threads.nmrec.gz +0 -0
- package/dist/lessons/pool-with-two-threads.nmrec.gz +0 -0
- package/dist/lessons/readfile-thread-pool.nmrec.gz +0 -0
- package/dist/lessons/tcp-round-trip.nmrec.gz +0 -0
- package/dist/lessons/tick-before-promise.nmrec.gz +0 -0
- package/dist/lessons/timeout-vs-immediate-io.nmrec.gz +0 -0
- package/dist/lessons/timeout-vs-immediate-main.nmrec.gz +0 -0
- package/dist/lessons/timer-vs-file-read.nmrec.gz +0 -0
- package/dist/lessons/timers-phase.nmrec.gz +0 -0
- package/dist/preload.cjs +477 -0
- package/package.json +25 -4
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=[`id`,`p`,`k`,`n`,`x`,`y`,`w`,`h`,`a`,`b`,`v`];var 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}};const n=/* @__PURE__ */ new Set([`unix`,`linux`,`darwin`,`win`]),r=/* @__PURE__ */ new Set([`region`,`group`,`feature`,`single`]),i=/* @__PURE__ */ new Set([`d`,`f`,`s`]),a=/^(?!\/)(?!.*(^|\/)\.\.(\/|$))[A-Za-z0-9_@+.,~=\-/]+$/,o=/^(?!\/)(?!.*(^|\/)\.\.(\/|$))[A-Za-z0-9_.\-/]+\.json$/;var s=class{problems=[];fail(e){this.problems.length<50&&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`&&a.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 r=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 r&&e.end<e.start&&(this.fail(`${t}: end before start`),r=!1),e.os!==void 0&&!n.has(e.os)&&(this.fail(`${t}.os: unknown OS tag`),r=!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`),r=!1),r}};function c(e,n,r){if(e.problems.length)throw new t(n,e.problems);return r}function l(e){let t=new s;if(!t.isObj(e,`index`))return c(t,`index`,e);e.schema!==`nodejs-map/atlas@1`&&t.fail(`schema: expected "nodejs-map/atlas@1", 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 i=e.world;t.isObj(i,`world`)&&(t.int(i.w,`world.w`,1),t.int(i.h,`world.h`,1));for(let n of[`files`,`search`,`edges`])typeof e[n]==`string`&&o.test(e[n])||t.fail(`${n}: expected a relative .json URL`);let a=/* @__PURE__ */ new Set([`o:world`]),l=e.boxes;Array.isArray(l)?l.forEach((e,n)=>{let i=`boxes[${n}]`;if(!t.isObj(e,i))return;t.str(e.id,`${i}.id`)&&(a.has(e.id)&&t.fail(`${i}.id: duplicate ${e.id}`),a.add(e.id)),a.has(e.p)||t.fail(`${i}.p: parent ${JSON.stringify(e.p)} must appear earlier`),r.has(e.k)||t.fail(`${i}.k: unknown kind`),t.int(e.t,`${i}.t`,1,3),t.str(e.n,`${i}.n`),t.str(e.d,`${i}.d`,!0),t.rect(e.r,`${i}.r`);let o=e.loc;Array.isArray(o)?o.forEach((e,n)=>t.range(e,`${i}.loc[${n}]`)):o!==null&&t.isObj(o,`${i}.loc`)&&t.path(o.tree,`${i}.loc.tree`),e.k===`feature`&&!(Array.isArray(o)&&o.length>0)&&t.fail(`${i}: a feature needs at least one code range`)}):t.fail(`boxes: expected an array`);let u=e.paths;Array.isArray(u)?u.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 d=e.chunks;Array.isArray(d)?d.forEach((e,n)=>{let r=`chunks[${n}]`;t.isObj(e,r)&&(t.str(e.id,`${r}.id`),a.has(e.group)||t.fail(`${r}.group: unknown box ${JSON.stringify(e.group)}`),typeof e.url==`string`&&o.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 f=e.aliases;if(t.isObj(f,`aliases`))for(let[e,n]of Object.entries(f))typeof n!=`string`&&t.fail(`aliases.${e}: expected a string`);return c(t,`index`,e)}function u(t,n){let r=new s;if(!r.isObj(t,`chunk`))return c(r,`chunk`,t);t.schema!==`nodejs-map/atlas-chunk@1`&&r.fail(`schema: expected "nodejs-map/atlas-chunk@1"`),r.str(t.id,`id`),r.str(t.group,`group`),JSON.stringify(t.cols)!==JSON.stringify(e)&&r.fail(`cols: unexpected column list`);let a=t.rows;if(!Array.isArray(a))r.fail(`rows: expected an array`);else{let e=/* @__PURE__ */ new Set;a.forEach((a,o)=>{let s=`rows[${o}]`;if(!Array.isArray(a)||a.length!==10&&a.length!==11){r.fail(`${s}: expected 10 or 11 columns`);return}let[c,l,u,d,f,p,m,h,g,_,v]=a;if(!r.str(c,`${s}.id`))return;let y=c;(typeof l!=`string`||!e.has(l)&&l!==t.group&&!n?.has(l))&&r.fail(`${s}.p: parent ${JSON.stringify(l)} unknown or after its child`),i.has(u)||r.fail(`${s}.k: d, f or s`),r.str(d,`${s}.n`),r.rect([f,p,m,h],`${s}.rect`),u===`d`?y.startsWith(`d:`)||r.fail(`${s}: directory id must start with d:`):u===`f`?(y.startsWith(`f:`)?r.path(y.slice(2),`${s}.path`):r.fail(`${s}: file id must start with f:`),r.int(_,`${s}.b`,0,2**53-1,!0)):u===`s`&&(/^s:[^#]+#.+$/.test(y)?r.path(y.slice(2,y.indexOf(`#`)),`${s}.path`):r.fail(`${s}: function id must be s:<path>#<name>`),r.int(g,`${s}.a`,1)&&r.int(_,`${s}.b`,1)&&_<g&&r.fail(`${s}: end before start`)),v!==void 0&&typeof v!=`string`&&r.fail(`${s}.v: expected a string`),e.add(y)})}return c(r,`chunk`,t)}function d(e,t){let n=new s;return n.isObj(e,`files`)&&(e.schema!==`nodejs-map/atlas-files@1`&&n.fail(`schema: expected "nodejs-map/atlas-files@1"`),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`)),c(n,`files`,e)}function f(e){let t=new s;return t.isObj(e,`search`)&&(e.schema!==`nodejs-map/atlas-search@1`&&t.fail(`schema: expected "nodejs-map/atlas-search@1"`),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`)),c(t,`search`,e)}function p(e){let t=new s;return t.isObj(e,`edges`)&&(e.schema!==`nodejs-map/atlas-edges@1`&&t.fail(`schema: expected "nodejs-map/atlas-edges@1"`),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`)),c(t,`edges`,e)}const m=`nodejs/node`,h=e=>e.split(`/`).map(encodeURIComponent).join(`/`),g=(e,t)=>e?t&&t!==e?`#L${e}-L${t}`:`#L${e}`:``;function _(e,t,n,r){return`https://github.com/${m}/blob/${e}/${h(t)}${g(n,r)}`}function v(e,t){return`https://github.com/${m}/tree/${e}/${h(t)}`}function y(e,t,n,r){return`https://github.dev/${m}/blob/${e}/${h(t)}${g(n,r)}`}function b(e,t){return`https://raw.githubusercontent.com/${m}/${e}/${h(t)}`}function x(e,t){return e===void 0?!0:e===`win`?t===`win32`:e===`unix`?t===`linux`||t===`darwin`:e===t}function S(e,t){let n,r=-1;for(let i of e){if(!x(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 C(e,t,n){let r=S(t.ranges,n);if(r)return{github:_(e,r.path,r.start,r.end),githubDev:y(e,r.path,r.start,r.end),raw:b(e,r.path),range:r};if(t.file)return{github:_(e,t.file.path),githubDev:y(e,t.file.path),raw:b(e,t.file.path)};if(t.tree)return{github:v(e,t.tree)}}function w(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`}`}const T={d:`dir`,f:`file`,s:`fn`};function E(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 D(e,t){let[n,r,i,a,o,s,c,l,u,d,f]=e,p={id:n,parent:r,kind:T[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 O=class{#e;#t;#n;#r=/* @__PURE__ */ new Map;#i=/* @__PURE__ */ new Map;#a=/* @__PURE__ */ new Map;#o=/* @__PURE__ */ 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=l(await this.#e(this.#t));this.#n=e;for(let t of e.boxes)this.#u(E(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===`o:world`)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(/* @__PURE__ */ Error(`unknown chunk ${e}`));t=this.#e(n.url).then(e=>{let t=u(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(D(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=d(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=w(e);return n?this.locate(n,t):void 0}pickRange(e,t){return S(e.ranges,t)}links(e,t){return C(this.commit,e,t)}async search(e,t=20){this.#c??=this.#e(this.index.search).then(e=>f(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(p),this.#l}boxesOfTier(e){return this.index.boxes.filter(t=>t.t===e).map(e=>this.#r.get(e.id))}};const k={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.`}};k.phaseTimers.id,k.phasePending.id,k.phaseIdle.id,k.phasePrepare.id,k.phasePoll.id,k.phaseCheck.id,k.phaseClosing.id;const A={Timeout:{id:k.listOnTimeout.id,title:`setTimeout / setInterval timer`,meaning:`setTimeout / setInterval timer; its callback runs from listOnTimeout.`},Immediate:{id:k.immediateProcess.id,title:`setImmediate`,meaning:`setImmediate; its callback runs from processImmediate in the check phase.`},TickObject:{id:k.tickDrain.id,title:`process.nextTick`,meaning:`process.nextTick; its callback runs from processTicksAndRejections.`},PROMISE:{id:k.promiseReactionRun.id,title:`promise`,meaning:`A promise (reported while an async hook is enabled); its reactions run as microtasks.`},Microtask:{id:k.microtaskCallback.id,title:`queueMicrotask`,meaning:`queueMicrotask callback; runs from the microtask queue via runMicrotask.`},FSREQCALLBACK:{id:k.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:k.fsReqPromise.id,title:`fs/promises request`,meaning:`fs/promises request.`},PBKDF2REQUEST:{id:k.cryptoJobAfter.id,title:`pbkdf2 request`,meaning:`crypto.pbkdf2 job; work in PBKDF2Traits::DeriveBits on the pool.`},RANDOMBYTESREQUEST:{id:k.cryptoJobAfter.id,title:`randomBytes request`,meaning:`crypto.randomBytes / randomFill job; work in RandomBytesTraits::DeriveBits on the pool.`},SCRYPTREQUEST:{id:k.cryptoJobAfter.id,title:`scrypt request`,meaning:`crypto.scrypt job on the pool.`},GETADDRINFOREQWRAP:{id:k.dnsAfterGetAddrInfo.id,title:`dns.lookup request`,meaning:`dns.lookup request; getaddrinfo runs on the pool.`},ZLIB:{id:k.zlibAfter.id,title:`zlib stream`,meaning:`zlib stream; each chunk is compressed on the pool.`},TCPWRAP:{id:k.streamRead.id,title:`TCP connection`,meaning:`TCP socket handle; reads arrive in the poll phase.`},TCPSERVERWRAP:{id:k.onConnection.id,title:`TCP server`,meaning:`TCP server handle; new connections arrive in the poll phase.`},TCPCONNECTWRAP:{id:k.afterConnect.id,title:`TCP connect request`,meaning:`Outgoing TCP connect request.`},PIPEWRAP:{id:k.streamRead.id,title:`pipe`,meaning:`Pipe handle (also stdio pipes).`},PIPECONNECTWRAP:{id:k.afterConnect.id,title:`pipe connect request`,meaning:`Outgoing pipe connect request.`},TTYWRAP:{id:k.streamRead.id,title:`terminal (TTY)`,meaning:`TTY handle (terminal stdio).`},WRITEWRAP:{id:k.streamAfterWrite.id,title:`stream write`,meaning:`A stream write request.`},SHUTDOWNWRAP:{id:k.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:k.udpRecv.id,title:`UDP socket`,meaning:`UDP socket handle.`},PROCESSWRAP:{id:k.processExit.id,title:`child process`,meaning:`Child process handle.`},FSEVENTWRAP:{id:k.fsEvent.id,title:`fs.watch watcher`,meaning:`fs.watch handle.`},STATWATCHER:{id:k.statWatcher.id,title:`fs.watchFile watcher`,meaning:`fs.watchFile handle.`},HTTPINCOMINGMESSAGE:{id:k.httpIncoming.id,title:`HTTP incoming message`,meaning:`HTTP incoming message (server request or client response).`},QUERYWRAP:{id:k.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:k.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:k.onConnection.id,title:`pipe server`,meaning:`Pipe (named pipe / Unix socket) server handle; new connections arrive in the poll phase.`},UDPSENDWRAP:{id:k.udpSendDone.id,title:`UDP send`,meaning:`A UDP send request.`},STREAM_END_OF_STREAM:{id:k.streamFinished.id,title:`stream finished callback`,meaning:`stream.finished / pipeline callback, bound to the context where it was registered.`},MESSAGEPORT:{id:k.messagePortOnMessage.id,title:`MessagePort (worker messages)`,meaning:`A message channel between threads; messages are delivered by MessagePort::OnMessage.`},WORKER:{id:k.workerExit.id,title:`worker thread`,meaning:`A worker_threads Worker as seen from the parent thread.`},HTTPCLIENTREQUEST:{id:k.httpClientRequest.id,title:`HTTP client request`,meaning:`HTTP client request.`}};Object.fromEntries(Object.entries(A).map(([e,t])=>[e,t.id]));function j(e,t){return e===`fn`?4:t===1?1:t===2?2:3}function M(e,t=300){let n=e.ids.length;if(n<=t)return[e];let r=Math.ceil(n/t),i=[];for(let a=0;a<r;a++){let o=a*t,s=Math.min(n,o+t);i.push({chunk:e.chunk,group:e.group,part:a,parts:r,ids:e.ids.slice(o,s),parents:e.parents.slice(o,s),labels:e.labels.slice(o,s),rects:e.rects.slice(o*4,s*4),levels:e.levels.slice(o,s),depths:e.depths.slice(o,s),loadMs:e.loadMs})}return i}var N=class{#e;#t=/* @__PURE__ */ new Map;#n=null;#r=null;constructor(e){this.#e=e}#i(e){let t=this.#t.get(e);if(t!==void 0)return t;let n=this.#e.getBox(e);return t=!n||n.parent===`o:world`?0:this.#i(n.parent)+1,this.#t.set(e,t),t}async chunk(e){let t=performance.now(),n=await this.#e.loadChunk(e),r=n.rows.length,i=Array(r),a=Array(r),o=Array(r),s=new Float32Array(r*4),c=new Uint8Array(r),l=new Uint8Array(r),u=0;for(let e of n.rows){let t=e[0],n=this.#e.absRect(t);n&&(i[u]=t,a[u]=e[1],o[u]=e[3],s[u*4]=n.x,s[u*4+1]=n.y,s[u*4+2]=n.w,s[u*4+3]=n.h,c[u]=j(e[2]===`s`?`fn`:e[2]===`f`?`file`:`dir`,3),l[u]=Math.min(255,this.#i(t)),u++)}return i.length=a.length=o.length=u,{chunk:n.id,group:n.group,part:0,parts:1,ids:i,parents:a,labels:o,rects:s.slice(0,u*4),levels:c.slice(0,u),depths:l.slice(0,u),loadMs:performance.now()-t}}async chunkParts(e,t){for(let n of M(await this.chunk(e)))t(n)}async place(e){let t=this.#e.resolveAlias(e),n=this.#e.getBox(t);if(n&&n.tier!==3)return{id:t,chunk:null,group:null};if(n&&!n.chunk)return{id:t,chunk:null,group:n.parent};let r=n??await this.#e.box(t).catch(()=>void 0);if(!r)return null;if(!r.chunk)return{id:t,chunk:null,group:null};let i=this.#e.index.chunks.find(e=>e.id===r.chunk);return{id:t,chunk:r.chunk,group:i?.group??null}}search(e,t){return this.#e.search(e,t)}async describe(e,t){let n=await this.#e.box(e).catch(()=>void 0);if(!n)return null;let r={box:n},i=this.#e.links(n,t);i&&(r.links=i);let a=this.#e.pickRange(n,t);return a&&(r.range=a),r}async locate(e,t){return await this.#e.locate(e,t).catch(()=>void 0)??null}async edgesFor(e,t){if(!this.#r){let e=await this.#e.edges();this.#r=e.edges,this.#n=/* @__PURE__ */ new Map;for(let t of e.edges)t.kind===`registers-binding`&&this.#n.set(t.to,t.from)}let n=this.#n,r=e=>n.get(e)??n.get(e.split(`.`)[0])??null,i=e.startsWith(`f:`)?e.slice(2):null,a=t=>t===e||i!==null&&t.startsWith(`s:${i}#`),o=/* @__PURE__ */ new Map,s=(e,t,n)=>{if(!e||!t||e===t||!a(e)&&!a(t))return;let r=`${e}\n${t}`;o.has(r)||o.set(r,[e,t,n])};for(let e of this.#r){if(o.size>=t)break;if(e.kind===`uses-binding`)s(e.from,r(e.to),e.kind);else if(e.kind===`calls-binding`)s(e.from,e.cxx??r(e.to),e.kind);else if(e.kind===`calls-uv`)for(let t of e.to)s(e.from,t,e.kind)}let c=[];for(let[e,t,n]of o.values()){let[r,i]=await Promise.all([this.place(e),this.place(t)]);r&&i&&c.push({from:r,to:i,kind:n})}return c}};let P=null,F=null;async function I(e){if(!F)throw Error(`atlas worker: not initialised`);let t=new URL(e,F);if(t.origin!==F.origin||!t.pathname.startsWith(F.pathname))throw Error(`The atlas names a file outside its folder: ${e}`);let n=await fetch(t,{credentials:`same-origin`});if(!n.ok)throw Error(`${e}: HTTP ${n.status}`);return n.json()}const L=(e,t=[])=>self.postMessage(e,t);self.onmessage=async e=>{let t=e.data;try{if(t.op===`init`){F=new URL(t.base);let e=new O({fetchJson:I}),n=await e.load();if(n.node.commit!==t.commit)throw Error(`atlas at ${t.base} is for commit ${n.node.commit}, not ${t.commit}`);P=new N(e),L({id:t.id,ok:!0,value:null});return}if(!P)throw Error(`atlas worker: not initialised`);switch(t.op){case`chunk`:for(let e of M(await P.chunk(t.chunk)))L({id:t.id,ok:!0,partial:!0,value:e},[e.rects.buffer,e.levels.buffer,e.depths.buffer]);L({id:t.id,ok:!0,value:null});return;case`place`:L({id:t.id,ok:!0,value:await P.place(t.target)});return;case`search`:L({id:t.id,ok:!0,value:await P.search(t.query,t.limit)});return;case`describe`:L({id:t.id,ok:!0,value:await P.describe(t.target,t.platform)});return;case`locate`:L({id:t.id,ok:!0,value:await P.locate(t.path,t.line)});return;case`edges`:L({id:t.id,ok:!0,value:await P.edgesFor(t.target,t.limit)});return}}catch(e){L({id:t.id,ok:!1,error:e instanceof Error?e.message:String(e)})}};
|
|
2
|
+
//# sourceMappingURL=atlas.worker-B0xwOHwo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atlas.worker-B0xwOHwo.js","names":["CHUNK_COLS","AtlasValidationError","what","problems","OS_TAGS","INDEX_KINDS","ROW_KINDS","SAFE_PATH","SAFE_URL","Checker","msg","v","at","opt","min","max","nullable","ok","n","i","\"path\"","\"start\"","\"end\"","\"sym\"","\"os\"","\"url\"","report","c","validateIndex","\"schema\"","node","\"node\"","\"version\"","\"commit\"","\"repo\"","world","\"world\"","\"w\"","\"h\"","k","ids","boxes","\"boxes\"","b","\"id\"","\"p\"","\"k\"","\"t\"","\"n\"","\"d\"","\"r\"","loc","\"loc\"","l","j","\"tree\"","paths","\"paths\"","p","\"title\"","\"certainty\"","steps","s","sat","st","a","\"desc\"","\"thread\"","\"locs\"","\"steps\"","\"branches\"","chunks","\"chunks\"","ch","\"group\"","\"rows\"","\"bytes\"","aliases","\"aliases\"","t","validateChunk","knownParents","\"cols\"","rows","seen","r","id","x","y","w","variant","validateFiles","chunkCount","\"files\"","f","validateSearch","\"entries\"","validateEdges","\"edges\"","\"kind\"","\"from\"","REPO","enc","path","lines","start","end","githubBlobUrl","commit","githubTreeUrl","githubDevUrl","rawSourceUrl","osMatches","os","platform","pickRange","ranges","best","bestScore","score","boxLinks","box","scriptUrlToPath","url","m","ROW_KIND","indexBoxToBox","rowToBox","row","chunk","h","AtlasStore","#fetchJson","#indexUrl","#index","#boxes","#children","#abs","#chunks","#files","#search","#edges","opts","index","#add","list","cur","real","have","ref","#chunkForPath","group","cached","abs","chunkId","raw","view","out","g","#loadFiles","e","line","fileId","visit","child","query","limit","entries","q","hits","label","tail","tier","WELL_KNOWN","ASYNC_TYPE_INFO","type","levelOf","kind","sliceChunk","parts","AtlasService","#store","#depth","#regFile","store","#depthOf","d","t0","parents","labels","rects","levels","depths","onPart","part","info","links","range","all","reg","bindingFile","filePath","matches","pairs","add","key","pa","pb","service","base","fetchJson","relative","res","post","transfer","event","req"],"sources":["../../../atlas-format/src/schema.ts","../../../atlas-format/src/validate.ts","../../../atlas-format/src/links.ts","../../../atlas-format/src/store.ts","../../../atlas-format/src/well-known.ts","../../src/map/model.ts","../../src/map/atlasService.ts","../../src/map/atlas.worker.ts"],"sourcesContent":["/**\n * The nodejs-map atlas, version 1.\n *\n * An atlas describes one Node.js release (tag + commit) as nested boxes with code\n * locations. It is a set of static JSON files:\n *\n * index.json tiers 1-2 (regions, groups, feature boxes, single boxes), curated\n * paths, the chunk manifest, aliases. Small: load it first.\n * chunks/<id>.json tier 3 (directories, files, functions) of one group, or of part\n * of a big group. Load on demand (by box id or by what is in view).\n * files.json path -> chunk + line count, for locate(path, line). Lazy.\n * search.json [label, id] pairs for search. Lazy.\n * edges.json extracted relations (lib -> binding -> C++ -> libuv). Lazy.\n *\n * Rects nest: every box's `r` is [x, y, w, h] relative to its PARENT box's rect, in\n * units of 1/10000 of the parent's width/height (regions: relative to the world).\n * The absolute rect is obtained by walking up the parents (AtlasStore.absRect does this).\n *\n * Ids (stable across releases while the thing exists, see ID_GRAMMAR):\n * o:<overlay-id> region, group or feature, written by hand in the overlay\n * p:<path>/<step> curated path step (also hand-written)\n * f:<path> file, e.g. f:lib/fs.js\n * d:<group>:<path> directory inside a group\n * s:<path>#<qualified-name> function, e.g. s:src/api/callback.cc#node::InternalCallbackScope::Close\n * (duplicates in one file add ~<hash of params|return type|#if condition>)\n * x:<path> single box (a whole bundled dependency), e.g. x:deps/openssl\n * b:<binding>[.<member>] binding nodes; only appear in edges\n */\n\nexport const ATLAS_SCHEMA = 'nodejs-map/atlas@1';\nexport const CHUNK_SCHEMA = 'nodejs-map/atlas-chunk@1';\nexport const FILES_SCHEMA = 'nodejs-map/atlas-files@1';\nexport const SEARCH_SCHEMA = 'nodejs-map/atlas-search@1';\nexport const EDGES_SCHEMA = 'nodejs-map/atlas-edges@1';\n\nexport const ID_GRAMMAR = {\n overlay: /^o:[a-z0-9][a-zA-Z0-9._-]*$/,\n pathStep: /^p:[a-zA-Z0-9._-]+(\\/[a-zA-Z0-9._-]+)*$/,\n file: /^f:.+$/,\n dir: /^d:[a-zA-Z0-9._-]+:.+$/,\n fn: /^s:[^#]+#.+$/,\n single: /^x:.+$/,\n} as const;\n\n/** OS tag on a code location. `unix` covers linux and darwin. */\nexport type OsTag = 'unix' | 'linux' | 'darwin' | 'win';\n/** process.platform values the app cares about. */\nexport type Platform = 'win32' | 'darwin' | 'linux';\n\n/** [x, y, w, h], integers, relative to the parent's rect in units of 1/10000. */\nexport type Rect = [number, number, number, number];\n/** Absolute rect in world units. */\nexport interface AbsRect { x: number; y: number; w: number; h: number }\n\n/** A line range in one file at the atlas commit. Lines are 1-based and inclusive. */\nexport interface CodeRange {\n path: string;\n start: number;\n end: number;\n /** Fully qualified symbol, e.g. \"node::InternalCallbackScope::Close\" or \"ReadFileContext.prototype.read\". */\n sym: string;\n /** Present when this range applies to one platform only. */\n os?: OsTag;\n /** Preprocessor / if() condition when the symbol has per-platform variants in one file. */\n cond?: string;\n}\n\n/** A directory link (no line range). */\nexport interface TreeLocation { tree: string }\n\nexport type IndexBoxKind = 'region' | 'group' | 'feature' | 'single';\nexport type ChunkRowKind = 'd' | 'f' | 's';\nexport type BoxKind = IndexBoxKind | 'dir' | 'file' | 'fn';\nexport type Tier = 1 | 2 | 3;\n\n/**\n * A box in index.json.\n * loc: features have CodeRange[] (one per platform where they differ); regions, groups and\n * single boxes have a TreeLocation or null (\"Your code\" has null: it is filled at run time).\n */\nexport interface IndexBox {\n id: string;\n /** Parent id; \"o:world\" for regions. */\n p: string;\n k: IndexBoxKind;\n t: Tier;\n /** Title. */\n n: string;\n /** One-line description (plain English). */\n d?: string;\n r: Rect;\n loc: CodeRange[] | TreeLocation | null;\n /** single boxes: number of files and bytes in the dependency. */\n files?: number;\n bytes?: number;\n}\n\nexport interface PathStep {\n id: string;\n title: string;\n /** One sentence. */\n desc: string;\n thread: 'main' | 'pool';\n /** Present when the whole step only happens on that platform. */\n os?: OsTag;\n /** Where it happens; one entry per platform where the code differs. */\n locs: Array<CodeRange & { url: string }>;\n /** Optional link to the feature box this step corresponds to. */\n box?: string;\n}\n\nexport interface PathBranch { id: string; title: string; desc?: string; steps: PathStep[] }\n\nexport interface CuratedPath {\n id: string;\n title: string;\n desc: string;\n /** Curated paths are hand-traced illustrations: always \"model\". */\n certainty: 'model';\n steps: PathStep[];\n branches: PathBranch[];\n}\n\nexport interface ChunkRef {\n /** Chunk id, e.g. \"lib.fs.0\". */\n id: string;\n /** Owning group box id. */\n group: string;\n url: string;\n /** Bounding rect of the chunk's content, relative to the group's rect. */\n r: Rect;\n rows: number;\n bytes: number;\n}\n\nexport interface AtlasIndex {\n schema: typeof ATLAS_SCHEMA;\n node: { version: string; commit: string; repo: 'nodejs/node' };\n builder: { version: string; overlayHash: string };\n world: { w: number; h: number };\n boxes: IndexBox[];\n paths: CuratedPath[];\n chunks: ChunkRef[];\n /** Relative URLs of the lazy files. */\n files: string;\n search: string;\n edges: string;\n /** Renamed or moved ids: old -> new. */\n aliases: Record<string, string>;\n}\n\n/**\n * One tier-3 row: [id, parent, kind, label, x, y, w, h, start, end, variant?]\n * kind 'd' directory (start/end null), 'f' file (start null, end = line count),\n * 's' function (start/end = line range). variant: #if / if() condition, when relevant.\n */\nexport type ChunkRow =\n | [string, string, ChunkRowKind, string, number, number, number, number, number | null, number | null]\n | [string, string, ChunkRowKind, string, number, number, number, number, number | null, number | null, string];\n\nexport const CHUNK_COLS = ['id', 'p', 'k', 'n', 'x', 'y', 'w', 'h', 'a', 'b', 'v'] as const;\n\nexport interface AtlasChunk {\n schema: typeof CHUNK_SCHEMA;\n id: string;\n group: string;\n cols: typeof CHUNK_COLS;\n /** Parents come before children. Rows of directories that were split across chunks are repeated. */\n rows: ChunkRow[];\n}\n\n/** files.json: [path, index into AtlasIndex.chunks, line count] sorted by path. */\nexport interface AtlasFiles { schema: typeof FILES_SCHEMA; files: Array<[string, number, number]> }\n\nexport interface AtlasSearch { schema: typeof SEARCH_SCHEMA; entries: Array<[string, string]> }\n\nexport type Edge =\n | { kind: 'uses-binding'; from: string; to: string; line: number; registered: boolean }\n | { kind: 'registers-binding'; from: string; to: string; line: number; macro: string; init: string | null }\n | { kind: 'binding-method'; from: string; name: string; to: string | null; cxx: string; api: string; at: { path: string; line: number }; heuristic?: true }\n | { kind: 'calls-binding'; from: string; to: string; line: number; cxx: string | null }\n | { kind: 'calls-uv'; from: string; to: string[]; name: string; how: 'call' | 'ref'; lines: number[] };\n\n/** Extracted edges are inferred from source text, never observed. */\nexport interface AtlasEdges { schema: typeof EDGES_SCHEMA; certainty: 'inferred'; edges: Edge[] }\n\n/** A box with everything resolved, as AtlasStore returns it. */\nexport interface Box {\n id: string;\n parent: string;\n kind: BoxKind;\n tier: Tier;\n title: string;\n desc?: string;\n /** Relative rect (as stored). */\n rect: Rect;\n /** Code ranges (features, functions). Empty for others. */\n ranges: CodeRange[];\n /** Files: path and line count. */\n file?: { path: string; lines: number | null };\n /** Directories, groups, regions, single boxes: a folder link. */\n tree?: string;\n /** Functions: #if / if() variant condition. */\n variant?: string;\n /** Chunk the box came from (tier 3). */\n chunk?: string;\n}\n","// Runtime validation of atlas files. The app never trusts a fetched file: every index and\n// chunk goes through these checks before use. Hand-written (zero dependencies); errors are\n// collected (up to a limit) so a broken file reports all of its problems at once.\nimport {\n ATLAS_SCHEMA, CHUNK_SCHEMA, FILES_SCHEMA, SEARCH_SCHEMA, EDGES_SCHEMA, CHUNK_COLS,\n} from './schema.ts';\nimport type { AtlasIndex, AtlasChunk, AtlasFiles, AtlasSearch, AtlasEdges } from './schema.ts';\n\nexport class AtlasValidationError extends Error {\n readonly problems: string[];\n constructor(what: string, problems: string[]) {\n super(`invalid ${what}: ${problems.slice(0, 5).join('; ')}${problems.length > 5 ? ` (+${problems.length - 5} more)` : ''}`);\n this.name = 'AtlasValidationError';\n this.problems = problems;\n }\n}\n\nconst MAX_PROBLEMS = 50;\nconst OS_TAGS = new Set(['unix', 'linux', 'darwin', 'win']);\nconst INDEX_KINDS = new Set(['region', 'group', 'feature', 'single']);\nconst ROW_KINDS = new Set(['d', 'f', 's']);\nconst SAFE_PATH = /^(?!\\/)(?!.*(^|\\/)\\.\\.(\\/|$))[A-Za-z0-9_@+.,~=\\-/]+$/;\nconst SAFE_URL = /^(?!\\/)(?!.*(^|\\/)\\.\\.(\\/|$))[A-Za-z0-9_.\\-/]+\\.json$/;\n\nclass Checker {\n readonly problems: string[] = [];\n fail(msg: string): void { if (this.problems.length < MAX_PROBLEMS) this.problems.push(msg); }\n isObj(v: unknown, at: string): v is Record<string, unknown> {\n if (typeof v === 'object' && v !== null && !Array.isArray(v)) return true;\n this.fail(`${at}: expected an object`); return false;\n }\n str(v: unknown, at: string, opt = false): boolean {\n if (v === undefined && opt) return true;\n if (typeof v === 'string' && v.length > 0 && v.length < 4096) return true;\n this.fail(`${at}: expected a non-empty string`); return false;\n }\n int(v: unknown, at: string, min = 0, max = Number.MAX_SAFE_INTEGER, nullable = false): boolean {\n if (v === null && nullable) return true;\n if (typeof v === 'number' && Number.isInteger(v) && v >= min && v <= max) return true;\n this.fail(`${at}: expected an integer in ${min}..${max}${nullable ? ' or null' : ''}`); return false;\n }\n path(v: unknown, at: string): boolean {\n if (typeof v === 'string' && SAFE_PATH.test(v)) return true;\n this.fail(`${at}: not a safe relative repository path`); return false;\n }\n rect(v: unknown, at: string): boolean {\n if (!Array.isArray(v) || v.length !== 4) { this.fail(`${at}: rect must be [x, y, w, h]`); return false; }\n let ok = true;\n v.forEach((n, i) => { ok = this.int(n, `${at}[${i}]`, i < 2 ? -10 : 0, 10010) && ok; });\n return ok;\n }\n range(v: unknown, at: string): boolean {\n if (!this.isObj(v, at)) return false;\n let ok = this.path(v['path'], `${at}.path`) && this.int(v['start'], `${at}.start`, 1) && this.int(v['end'], `${at}.end`, 1) && this.str(v['sym'], `${at}.sym`);\n if (ok && (v['end'] as number) < (v['start'] as number)) { this.fail(`${at}: end before start`); ok = false; }\n if (v['os'] !== undefined && !OS_TAGS.has(v['os'] as string)) { this.fail(`${at}.os: unknown OS tag`); ok = false; }\n if (v['url'] !== undefined && !(typeof v['url'] === 'string' && v['url'].startsWith('https://github.com/nodejs/node/blob/'))) { this.fail(`${at}.url: not a nodejs/node GitHub permalink`); ok = false; }\n return ok;\n }\n}\n\nfunction report<T>(c: Checker, what: string, v: unknown): T {\n if (c.problems.length) throw new AtlasValidationError(what, c.problems);\n return v as T;\n}\n\n/** Validates index.json. Returns it typed, or throws AtlasValidationError listing the problems. */\nexport function validateIndex(v: unknown): AtlasIndex {\n const c = new Checker();\n if (!c.isObj(v, 'index')) return report(c, 'index', v);\n if (v['schema'] !== ATLAS_SCHEMA) c.fail(`schema: expected \"${ATLAS_SCHEMA}\", got ${JSON.stringify(v['schema'])}`);\n const node = v['node'];\n if (c.isObj(node, 'node')) {\n c.str(node['version'], 'node.version');\n if (!(typeof node['commit'] === 'string' && /^[0-9a-f]{40}$/.test(node['commit']))) c.fail('node.commit: expected a 40-hex commit');\n if (node['repo'] !== 'nodejs/node') c.fail('node.repo: expected \"nodejs/node\"');\n }\n const world = v['world'];\n if (c.isObj(world, 'world')) { c.int(world['w'], 'world.w', 1); c.int(world['h'], 'world.h', 1); }\n for (const k of ['files', 'search', 'edges']) if (!(typeof v[k] === 'string' && SAFE_URL.test(v[k]))) c.fail(`${k}: expected a relative .json URL`);\n const ids = new Set<string>(['o:world']);\n const boxes = v['boxes'];\n if (!Array.isArray(boxes)) c.fail('boxes: expected an array');\n else {\n boxes.forEach((b: unknown, i) => {\n const at = `boxes[${i}]`;\n if (!c.isObj(b, at)) return;\n if (c.str(b['id'], `${at}.id`)) {\n if (ids.has(b['id'] as string)) c.fail(`${at}.id: duplicate ${b['id']}`);\n ids.add(b['id'] as string);\n }\n if (!ids.has(b['p'] as string)) c.fail(`${at}.p: parent ${JSON.stringify(b['p'])} must appear earlier`);\n if (!INDEX_KINDS.has(b['k'] as string)) c.fail(`${at}.k: unknown kind`);\n c.int(b['t'], `${at}.t`, 1, 3);\n c.str(b['n'], `${at}.n`);\n c.str(b['d'], `${at}.d`, true);\n c.rect(b['r'], `${at}.r`);\n const loc = b['loc'];\n if (Array.isArray(loc)) loc.forEach((l: unknown, j) => c.range(l, `${at}.loc[${j}]`));\n else if (loc !== null) { if (c.isObj(loc, `${at}.loc`)) c.path(loc['tree'], `${at}.loc.tree`); }\n if (b['k'] === 'feature' && !(Array.isArray(loc) && loc.length > 0)) c.fail(`${at}: a feature needs at least one code range`);\n });\n }\n const paths = v['paths'];\n if (!Array.isArray(paths)) c.fail('paths: expected an array');\n else paths.forEach((p: unknown, i) => {\n const at = `paths[${i}]`;\n if (!c.isObj(p, at)) return;\n c.str(p['id'], `${at}.id`); c.str(p['title'], `${at}.title`);\n if (p['certainty'] !== 'model') c.fail(`${at}.certainty: curated paths are \"model\"`);\n const steps = (s: unknown, sat: string): void => {\n if (!Array.isArray(s)) { c.fail(`${sat}: expected an array`); return; }\n s.forEach((st: unknown, j) => {\n const a = `${sat}[${j}]`;\n if (!c.isObj(st, a)) return;\n c.str(st['id'], `${a}.id`); c.str(st['title'], `${a}.title`); c.str(st['desc'], `${a}.desc`);\n if (st['thread'] !== 'main' && st['thread'] !== 'pool') c.fail(`${a}.thread: main or pool`);\n if (!Array.isArray(st['locs']) || st['locs'].length === 0) c.fail(`${a}.locs: at least one location`);\n else st['locs'].forEach((l: unknown, k) => c.range(l, `${a}.locs[${k}]`));\n });\n };\n steps(p['steps'], `${at}.steps`);\n if (Array.isArray(p['branches'])) p['branches'].forEach((b: unknown, j) => { if (c.isObj(b, `${at}.branches[${j}]`)) steps(b['steps'], `${at}.branches[${j}].steps`); });\n else c.fail(`${at}.branches: expected an array`);\n });\n const chunks = v['chunks'];\n if (!Array.isArray(chunks)) c.fail('chunks: expected an array');\n else chunks.forEach((ch: unknown, i) => {\n const at = `chunks[${i}]`;\n if (!c.isObj(ch, at)) return;\n c.str(ch['id'], `${at}.id`);\n if (!ids.has(ch['group'] as string)) c.fail(`${at}.group: unknown box ${JSON.stringify(ch['group'])}`);\n if (!(typeof ch['url'] === 'string' && SAFE_URL.test(ch['url']))) c.fail(`${at}.url: expected a relative .json URL`);\n c.rect(ch['r'], `${at}.r`); c.int(ch['rows'], `${at}.rows`, 1); c.int(ch['bytes'], `${at}.bytes`, 1);\n });\n const aliases = v['aliases'];\n if (c.isObj(aliases, 'aliases')) for (const [k, t] of Object.entries(aliases)) if (typeof t !== 'string') c.fail(`aliases.${k}: expected a string`);\n return report<AtlasIndex>(c, 'index', v);\n}\n\n/** Validates a chunk file. `knownParents` are ids that may be referenced as parents (index boxes). */\nexport function validateChunk(v: unknown, knownParents?: ReadonlySet<string>): AtlasChunk {\n const c = new Checker();\n if (!c.isObj(v, 'chunk')) return report(c, 'chunk', v);\n if (v['schema'] !== CHUNK_SCHEMA) c.fail(`schema: expected \"${CHUNK_SCHEMA}\"`);\n c.str(v['id'], 'id'); c.str(v['group'], 'group');\n if (JSON.stringify(v['cols']) !== JSON.stringify(CHUNK_COLS)) c.fail('cols: unexpected column list');\n const rows = v['rows'];\n if (!Array.isArray(rows)) c.fail('rows: expected an array');\n else {\n const seen = new Set<string>();\n rows.forEach((r: unknown, i) => {\n const at = `rows[${i}]`;\n if (!Array.isArray(r) || (r.length !== 10 && r.length !== 11)) { c.fail(`${at}: expected 10 or 11 columns`); return; }\n const [id, p, k, n, x, y, w, h, a, b, variant] = r as unknown[];\n if (!c.str(id, `${at}.id`)) return;\n const ids = id as string;\n if (!(typeof p === 'string' && (seen.has(p) || p === v['group'] || knownParents?.has(p)))) c.fail(`${at}.p: parent ${JSON.stringify(p)} unknown or after its child`);\n if (!ROW_KINDS.has(k as string)) c.fail(`${at}.k: d, f or s`);\n c.str(n, `${at}.n`);\n c.rect([x, y, w, h], `${at}.rect`);\n if (k === 'd') { if (!ids.startsWith('d:')) c.fail(`${at}: directory id must start with d:`); }\n else if (k === 'f') { if (!ids.startsWith('f:')) c.fail(`${at}: file id must start with f:`); else c.path(ids.slice(2), `${at}.path`); c.int(b, `${at}.b`, 0, Number.MAX_SAFE_INTEGER, true); }\n else if (k === 's') {\n if (!/^s:[^#]+#.+$/.test(ids)) c.fail(`${at}: function id must be s:<path>#<name>`); else c.path(ids.slice(2, ids.indexOf('#')), `${at}.path`);\n if (c.int(a, `${at}.a`, 1) && c.int(b, `${at}.b`, 1) && (b as number) < (a as number)) c.fail(`${at}: end before start`);\n }\n if (variant !== undefined && typeof variant !== 'string') c.fail(`${at}.v: expected a string`);\n seen.add(ids);\n });\n }\n return report<AtlasChunk>(c, 'chunk', v);\n}\n\nexport function validateFiles(v: unknown, chunkCount: number): AtlasFiles {\n const c = new Checker();\n if (c.isObj(v, 'files')) {\n if (v['schema'] !== FILES_SCHEMA) c.fail(`schema: expected \"${FILES_SCHEMA}\"`);\n if (!Array.isArray(v['files'])) c.fail('files: expected an array');\n else v['files'].forEach((f: unknown, i) => {\n if (!Array.isArray(f) || f.length !== 3) { c.fail(`files[${i}]: expected [path, chunk, lines]`); return; }\n c.path(f[0], `files[${i}][0]`); c.int(f[1], `files[${i}][1]`, 0, chunkCount - 1); c.int(f[2], `files[${i}][2]`, 0);\n });\n }\n return report<AtlasFiles>(c, 'files', v);\n}\n\nexport function validateSearch(v: unknown): AtlasSearch {\n const c = new Checker();\n if (c.isObj(v, 'search')) {\n if (v['schema'] !== SEARCH_SCHEMA) c.fail(`schema: expected \"${SEARCH_SCHEMA}\"`);\n if (!Array.isArray(v['entries'])) c.fail('entries: expected an array');\n else v['entries'].forEach((e: unknown, i) => { if (!Array.isArray(e) || e.length !== 2 || typeof e[0] !== 'string' || typeof e[1] !== 'string') c.fail(`entries[${i}]: expected [label, id]`); });\n }\n return report<AtlasSearch>(c, 'search', v);\n}\n\nexport function validateEdges(v: unknown): AtlasEdges {\n const c = new Checker();\n if (c.isObj(v, 'edges')) {\n if (v['schema'] !== EDGES_SCHEMA) c.fail(`schema: expected \"${EDGES_SCHEMA}\"`);\n if (v['certainty'] !== 'inferred') c.fail('certainty: extracted edges are \"inferred\"');\n if (!Array.isArray(v['edges'])) c.fail('edges: expected an array');\n else v['edges'].forEach((e: unknown, i) => { if (c.isObj(e, `edges[${i}]`)) { c.str(e['kind'], `edges[${i}].kind`); c.str(e['from'], `edges[${i}].from`); } });\n }\n return report<AtlasEdges>(c, 'edges', v);\n}\n","// Links to Node's source at the atlas commit. The atlas never contains Node's source text:\n// the app fetches it on demand from rawSourceUrl().\nimport type { CodeRange, OsTag, Platform, Box } from './schema.ts';\n\nconst REPO = 'nodejs/node';\nconst enc = (path: string): string => path.split('/').map(encodeURIComponent).join('/');\nconst lines = (start?: number, end?: number): string =>\n start ? (end && end !== start ? `#L${start}-L${end}` : `#L${start}`) : '';\n\n/** https://github.com/nodejs/node/blob/<commit>/<path>#L<a>-L<b> - GitHub highlights the lines. */\nexport function githubBlobUrl(commit: string, path: string, start?: number, end?: number): string {\n return `https://github.com/${REPO}/blob/${commit}/${enc(path)}${lines(start, end)}`;\n}\n\n/** https://github.com/nodejs/node/tree/<commit>/<path> - a folder. */\nexport function githubTreeUrl(commit: string, path: string): string {\n return `https://github.com/${REPO}/tree/${commit}/${enc(path)}`;\n}\n\n/** https://github.dev/nodejs/node/blob/<commit>/<path>#L<a>-L<b> - opens the web editor. See GITHUB_DEV_NOTE. */\nexport function githubDevUrl(commit: string, path: string, start?: number, end?: number): string {\n return `https://github.dev/${REPO}/blob/${commit}/${enc(path)}${lines(start, end)}`;\n}\n\n/** Text for the UI next to \"Open in web editor\". */\nexport const GITHUB_DEV_NOTE =\n '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.';\n\n/** https://raw.githubusercontent.com/nodejs/node/<commit>/<path> - plain source text for the source panel. */\nexport function rawSourceUrl(commit: string, path: string): string {\n return `https://raw.githubusercontent.com/${REPO}/${commit}/${enc(path)}`;\n}\n\n/** Does a location tagged `os` apply on `platform`? Untagged locations apply everywhere. */\nexport function osMatches(os: OsTag | undefined, platform: Platform): boolean {\n if (os === undefined) return true;\n if (os === 'win') return platform === 'win32';\n if (os === 'unix') return platform === 'linux' || platform === 'darwin';\n return os === platform;\n}\n\n/**\n * Picks the code range for a platform: an exact OS tag wins over \"unix\", which wins over an\n * untagged range. Returns undefined when no range applies (e.g. a Windows-only step on Linux).\n */\nexport function pickRange<T extends CodeRange>(ranges: readonly T[], platform: Platform): T | undefined {\n let best: T | undefined;\n let bestScore = -1;\n for (const r of ranges) {\n if (!osMatches(r.os, platform)) continue;\n const score = r.os === undefined ? 1 : r.os === 'unix' ? 2 : 3;\n if (score > bestScore) { best = r; bestScore = score; }\n }\n return best;\n}\n\nexport interface BoxLinks {\n /** GitHub permalink (blob with line range, blob for a file, tree for a folder). */\n github: string;\n /** Web editor link (files and ranges only). */\n githubDev?: string;\n /** Raw source text (files and ranges only). */\n raw?: string;\n /** The range the links point at, when there is one. */\n range?: CodeRange;\n}\n\n/** Links for a box on a platform, or undefined if it has no code location there (\"Your code\"). */\nexport function boxLinks(commit: string, box: Box, platform: Platform): BoxLinks | undefined {\n const r = pickRange(box.ranges, platform);\n if (r) return { github: githubBlobUrl(commit, r.path, r.start, r.end), githubDev: githubDevUrl(commit, r.path, r.start, r.end), raw: rawSourceUrl(commit, r.path), range: r };\n if (box.file) return { github: githubBlobUrl(commit, box.file.path), githubDev: githubDevUrl(commit, box.file.path), raw: rawSourceUrl(commit, box.file.path) };\n if (box.tree) return { github: githubTreeUrl(commit, box.tree) };\n return undefined;\n}\n\n/**\n * Maps a script URL as V8/CDP reports it for Node's own JavaScript to the repository path:\n * \"node:internal/timers\" -> \"lib/internal/timers.js\", \"node:fs\" -> \"lib/fs.js\".\n * Returns null for anything else (user code, file:// URLs, evaluated code).\n */\nexport function scriptUrlToPath(url: string): string | null {\n const m = /^node:([a-z0-9_][a-z0-9_./-]*)$/i.exec(url);\n if (!m || m[1] === undefined || m[1].includes('..')) return null;\n const id = m[1];\n return `lib/${id}${/\\.(m?js|cjs)$/.test(id) ? '' : '.js'}`;\n}\n","// AtlasStore: loads an atlas on demand over a caller-supplied fetchJson(relativeUrl).\n// Works in the browser (fetch) and in Node (read files). Every file is validated before use.\nimport type {\n AtlasIndex, AtlasChunk, AtlasEdges, Box, ChunkRef, ChunkRow, CodeRange, IndexBox, Platform, AbsRect, Tier, BoxKind,\n} from './schema.ts';\nimport { validateIndex, validateChunk, validateFiles, validateSearch, validateEdges } from './validate.ts';\nimport { pickRange, boxLinks, scriptUrlToPath } from './links.ts';\nimport type { BoxLinks } from './links.ts';\n\nexport type FetchJson = (relativeUrl: string) => Promise<unknown>;\n\nexport interface AtlasStoreOptions {\n fetchJson: FetchJson;\n /** URL of the index, relative to the atlas folder. Default \"index.json\". */\n indexUrl?: string;\n}\n\nexport interface SearchHit { id: string; label: string; score: number }\n\nconst ROW_KIND: Record<string, BoxKind> = { d: 'dir', f: 'file', s: 'fn' };\nconst WORLD = 'o:world';\n\nfunction indexBoxToBox(b: IndexBox): Box {\n const box: Box = { id: b.id, parent: b.p, kind: b.k, tier: b.t, title: b.n, rect: b.r, ranges: [] };\n if (b.d !== undefined) box.desc = b.d;\n if (Array.isArray(b.loc)) box.ranges = b.loc;\n else if (b.loc) box.tree = b.loc.tree;\n return box;\n}\n\nfunction rowToBox(row: ChunkRow, chunk: string): Box {\n const [id, p, k, n, x, y, w, h, a, b, v] = row;\n const box: Box = { id, parent: p, kind: ROW_KIND[k] ?? 'file', tier: 3, title: n, rect: [x, y, w, h], ranges: [], chunk };\n if (k === 's' && a !== null && b !== null) box.ranges = [{ path: id.slice(2, id.indexOf('#')), start: a, end: b, sym: n }];\n else if (k === 'f') box.file = { path: id.slice(2), lines: b };\n else if (k === 'd') box.tree = id.slice(id.indexOf(':', 2) + 1);\n if (v !== undefined) { box.variant = v; for (const r of box.ranges) r.cond = v; }\n return box;\n}\n\nexport class AtlasStore {\n readonly #fetchJson: FetchJson;\n readonly #indexUrl: string;\n #index: AtlasIndex | undefined;\n readonly #boxes = new Map<string, Box>();\n readonly #children = new Map<string, string[]>();\n readonly #abs = new Map<string, AbsRect>();\n readonly #chunks = new Map<string, Promise<AtlasChunk>>();\n #files: Promise<Map<string, [number, number]>> | undefined;\n #search: Promise<Array<[string, string]>> | undefined;\n #edges: Promise<AtlasEdges> | undefined;\n\n constructor(opts: AtlasStoreOptions) {\n this.#fetchJson = opts.fetchJson;\n this.#indexUrl = opts.indexUrl ?? 'index.json';\n }\n\n /** Loads and validates index.json (tiers 1-2). Call once before anything else. */\n async load(): Promise<AtlasIndex> {\n if (this.#index) return this.#index;\n const index = validateIndex(await this.#fetchJson(this.#indexUrl));\n this.#index = index;\n for (const b of index.boxes) this.#add(indexBoxToBox(b));\n return index;\n }\n\n get index(): AtlasIndex {\n if (!this.#index) throw new Error('AtlasStore: call load() first');\n return this.#index;\n }\n\n get commit(): string { return this.index.node.commit; }\n\n #add(box: Box): void {\n if (this.#boxes.has(box.id)) return; // split-directory rows repeat across chunks\n this.#boxes.set(box.id, box);\n const list = this.#children.get(box.parent);\n if (list) list.push(box.id); else this.#children.set(box.parent, [box.id]);\n }\n\n /** Follows aliases (old id -> new id), at most 16 hops. */\n resolveAlias(id: string): string {\n const aliases = this.index.aliases;\n let cur = id;\n for (let i = 0; i < 16 && Object.hasOwn(aliases, cur); i++) cur = aliases[cur] as string;\n return cur;\n }\n\n /** A box that is already loaded (tiers 1-2 always are), or undefined. */\n getBox(id: string): Box | undefined { return this.#boxes.get(this.resolveAlias(id)); }\n\n /** A box by id, loading the chunk that holds it when needed. */\n async box(id: string): Promise<Box | undefined> {\n const real = this.resolveAlias(id);\n const have = this.#boxes.get(real);\n if (have) return have;\n if (real.startsWith('f:') || real.startsWith('s:')) {\n const path = real.startsWith('f:') ? real.slice(2) : real.slice(2, real.indexOf('#'));\n const ref = await this.#chunkForPath(path);\n if (ref) await this.loadChunk(ref.id);\n } else if (real.startsWith('d:')) {\n const group = `o:${real.slice(2, real.indexOf(':', 2))}`;\n for (const ch of this.index.chunks) if (ch.group === group) await this.loadChunk(ch.id);\n }\n return this.#boxes.get(real);\n }\n\n /** Children that are loaded (tier-3 children appear once their chunk is loaded). */\n children(id: string): Box[] {\n return (this.#children.get(id) ?? []).map((c) => this.#boxes.get(c)).filter((b): b is Box => b !== undefined);\n }\n\n /** Absolute rect in world units. The box (and so its ancestors) must be loaded. */\n absRect(id: string): AbsRect | undefined {\n const real = this.resolveAlias(id);\n const cached = this.#abs.get(real);\n if (cached) return cached;\n if (real === WORLD) return { x: 0, y: 0, w: this.index.world.w, h: this.index.world.h };\n const box = this.#boxes.get(real);\n if (!box) return undefined;\n const p = this.absRect(box.parent);\n if (!p) return undefined;\n const [x, y, w, h] = box.rect;\n const abs = { x: p.x + (x / 1e4) * p.w, y: p.y + (y / 1e4) * p.h, w: (w / 1e4) * p.w, h: (h / 1e4) * p.h };\n this.#abs.set(real, abs);\n return abs;\n }\n\n /** Loads (once) and validates a chunk; its boxes become available. */\n loadChunk(chunkId: string): Promise<AtlasChunk> {\n let p = this.#chunks.get(chunkId);\n if (!p) {\n const ref = this.index.chunks.find((c) => c.id === chunkId);\n if (!ref) return Promise.reject(new Error(`unknown chunk ${chunkId}`));\n p = this.#fetchJson(ref.url).then((raw) => {\n const chunk = validateChunk(raw, new Set(this.#boxes.keys()));\n if (chunk.id !== ref.id || chunk.group !== ref.group) throw new Error(`chunk ${ref.url} does not match the manifest`);\n for (const row of chunk.rows) this.#add(rowToBox(row, chunk.id));\n return chunk;\n });\n p.catch(() => this.#chunks.delete(chunkId));\n this.#chunks.set(chunkId, p);\n }\n return p;\n }\n\n /** Chunks whose content intersects a world-space view rect (for a renderer at tier-3 zoom). */\n chunksInView(view: AbsRect): ChunkRef[] {\n const out: ChunkRef[] = [];\n for (const ch of this.index.chunks) {\n const g = this.absRect(ch.group);\n if (!g) continue;\n const [x, y, w, h] = ch.r;\n const r = { x: g.x + (x / 1e4) * g.w, y: g.y + (y / 1e4) * g.h, w: (w / 1e4) * g.w, h: (h / 1e4) * g.h };\n if (r.x < view.x + view.w && r.x + r.w > view.x && r.y < view.y + view.h && r.y + r.h > view.y) out.push(ch);\n }\n return out;\n }\n\n /** Loads every chunk that intersects the view. */\n async loadInView(view: AbsRect): Promise<void> {\n await Promise.all(this.chunksInView(view).map((c) => this.loadChunk(c.id)));\n }\n\n #loadFiles(): Promise<Map<string, [number, number]>> {\n this.#files ??= this.#fetchJson(this.index.files).then((raw) => {\n const f = validateFiles(raw, this.index.chunks.length);\n return new Map(f.files.map(([p, c, l]) => [p, [c, l]]));\n });\n return this.#files;\n }\n\n async #chunkForPath(path: string): Promise<ChunkRef | undefined> {\n const e = (await this.#loadFiles()).get(path);\n return e ? this.index.chunks[e[0]] : undefined;\n }\n\n /** Line count of a file in the atlas (undefined when the file is not in the atlas). */\n async lineCount(path: string): Promise<number | undefined> {\n return (await this.#loadFiles()).get(path)?.[1];\n }\n\n /**\n * The deepest box containing `line` of `path`: a function box if one contains it, else the\n * file box. Undefined when the file is not in the atlas (e.g. V8 headers are, test/ is not).\n */\n async locate(path: string, line: number): Promise<string | undefined> {\n const ref = await this.#chunkForPath(path);\n if (!ref) return undefined;\n await this.loadChunk(ref.id);\n const fileId = `f:${path}`;\n // Functions nest (a JS function inside another is its child box): descend to the smallest range.\n let best: Box | undefined;\n const visit = (id: string): void => {\n for (const child of this.children(id)) {\n const r = child.ranges[0];\n if (!r || line < r.start || line > r.end) continue;\n if (!best || r.end - r.start <= (best.ranges[0] as CodeRange).end - (best.ranges[0] as CodeRange).start) best = child;\n visit(child.id);\n }\n };\n visit(fileId);\n return best ? (best as Box).id : this.#boxes.has(fileId) ? fileId : undefined;\n }\n\n /** locate() for a V8/CDP script URL of Node's own JavaScript (\"node:internal/timers\"). */\n async locateScript(url: string, line: number): Promise<string | undefined> {\n const path = scriptUrlToPath(url);\n return path ? this.locate(path, line) : undefined;\n }\n\n /** The code range of a box for a platform (exact OS > unix > untagged). */\n pickRange(box: Box, platform: Platform): CodeRange | undefined { return pickRange(box.ranges, platform); }\n\n /** GitHub / web editor / raw links for a box on a platform. */\n links(box: Box, platform: Platform): BoxLinks | undefined { return boxLinks(this.commit, box, platform); }\n\n /** Case-insensitive search over box labels (loads search.json on first use). */\n async search(query: string, limit = 20): Promise<SearchHit[]> {\n this.#search ??= this.#fetchJson(this.index.search).then((raw) => validateSearch(raw).entries);\n const entries = await this.#search;\n const q = query.trim().toLowerCase();\n if (!q) return [];\n const hits: SearchHit[] = [];\n for (const [label, id] of entries) {\n const l = label.toLowerCase();\n const at = l.indexOf(q);\n if (at < 0) continue;\n const tail = l.split(/::|\\.|\\//).pop() ?? l;\n const score = l === q || tail === q ? 0 : tail.startsWith(q) ? 1 : at === 0 ? 2 : 3;\n hits.push({ id, label, score: score * 1e4 + l.length });\n }\n hits.sort((a, b) => a.score - b.score || (a.label < b.label ? -1 : a.label > b.label ? 1 : 0));\n return hits.slice(0, limit);\n }\n\n /** Extracted edges (inferred, not observed). */\n edges(): Promise<AtlasEdges> {\n this.#edges ??= this.#fetchJson(this.index.edges).then(validateEdges);\n return this.#edges;\n }\n\n /** Index boxes of a tier (1 or 2), for the first view. */\n boxesOfTier(tier: Tier): Box[] {\n return this.index.boxes.filter((b) => b.t === tier).map((b) => this.#boxes.get(b.id) as Box);\n }\n}\n","// Atlas ids the live view points at. Each is a feature box in the overlay (o:...), so it\n// survives releases: the overlay is updated when Node's code moves, the id stays.\n// The atlas builder fails if any of these ids is missing from a built atlas.\n// Meanings are true for Node v26.13.1 (libuv 1.52.1); each box links to the exact code.\n\nexport interface WellKnownEntry {\n readonly id: string;\n /** One line, plain English. */\n readonly meaning: string;\n}\n\nexport const WELL_KNOWN = {\n // ---- the event loop (libuv)\n 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.' },\n 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).' },\n phasePending: { id: 'o:phase.pending', meaning: 'Pending phase: callbacks deferred from the previous turn; on Windows, completed I/O requests run here.' },\n phaseIdle: { id: 'o:phase.idle', meaning: 'Idle phase: idle handles; Node keeps one active while immediates are queued so poll does not block.' },\n phasePrepare: { id: 'o:phase.prepare', meaning: 'Prepare phase: prepare handles, just before the loop waits for I/O.' },\n 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.' },\n phaseCheck: { id: 'o:phase.check', meaning: 'Check phase: check handles; Node runs setImmediate callbacks here.' },\n phaseClosing: { id: 'o:phase.close', meaning: 'Close phase: close callbacks of handles closed during this turn.' },\n loopTime: { id: 'o:loop.updateTime', meaning: 'The loop clock: libuv reads the time once per turn; timers compare against this cached time.' },\n spinEventLoop: { id: 'o:loop.spin', meaning: \"Node's loop driver: calls uv_run until there is no more work, then emits beforeExit.\" },\n\n // ---- nextTick and microtasks\n tickEnqueue: { id: 'o:tick.nextTick', meaning: 'process.nextTick: pushes a callback onto the nextTick queue.' },\n tickDrain: { id: 'o:tick.drain', meaning: 'processTicksAndRejections: runs the nextTick queue, then microtasks, until both are empty.' },\n runNextTicks: { id: 'o:tick.runNextTicks', meaning: 'runNextTicks: drains nextTicks and microtasks between two timer or immediate callbacks.' },\n microtaskEnqueue: { id: 'o:microtask.queueMicrotask', meaning: 'queueMicrotask: puts a callback on V8\\'s microtask queue.' },\n microtaskCallback: { id: 'o:microtask.runCallback', meaning: 'runMicrotask: the wrapper that runs a queueMicrotask callback with async_hooks before/after.' },\n microtaskCheckpoint: { id: 'o:microtask.checkpoint', meaning: 'MicrotaskQueue::PerformCheckpoint: V8 runs all queued microtasks if it is not already doing so.' },\n microtaskDrain: { id: 'o:microtask.run', meaning: 'MicrotaskQueue::RunMicrotasks: V8 runs every queued microtask (promise reactions, queueMicrotask callbacks).' },\n runMicrotasksBinding: { id: 'o:microtask.binding', meaning: 'runMicrotasks(): the C++ binding processTicksAndRejections calls to make V8 drain the microtask queue.' },\n\n // ---- promises in V8\n promiseThen: { id: 'o:v8.promiseThen', meaning: 'Promise.prototype.then (V8 Torque builtin).' },\n performPromiseThen: { id: 'o:v8.performPromiseThen', meaning: 'PerformPromiseThen: stores the reaction, or queues a reaction job at once if the promise is already settled.' },\n triggerPromiseReactions: { id: 'o:v8.triggerReactions', meaning: 'TriggerPromiseReactions: when a promise settles, turns each stored reaction into a queued job.' },\n promiseReactionEnqueue: { id: 'o:v8.enqueueMicrotask', meaning: 'EnqueueMicrotask builtin: where a promise reaction job (or any microtask) is appended to the microtask queue.' },\n runMicrotasksBuiltin: { id: 'o:v8.runMicrotasksBuiltin', meaning: 'RunMicrotasks builtin: the loop inside V8 that takes jobs off the microtask queue.' },\n runSingleMicrotask: { id: 'o:v8.runSingleMicrotask', meaning: 'RunSingleMicrotask: runs one job, dispatching on its kind (callable, promise reaction, ...).' },\n promiseReactionRun: { id: 'o:v8.promiseReactionJob', meaning: 'PromiseReactionJob: runs a .then/.catch handler with the settled value and settles the derived promise.' },\n\n // ---- timers\n timerSet: { id: 'o:timers.setTimeout', meaning: 'setTimeout: creates a Timeout and inserts it into the timer lists.' },\n setInterval: { id: 'o:timers.setInterval', meaning: 'setInterval: a Timeout that is re-inserted after each run.' },\n timerInsert: { id: 'o:timers.insert', meaning: 'insert: appends the timer to the list for its duration; a new earliest list reschedules the libuv timer.' },\n scheduleTimer: { id: 'o:timers.scheduleTimer', meaning: 'Environment::ScheduleTimer: starts the single libuv timer for the earliest JS timer.' },\n timersNative: { id: 'o:timers.runTimers', meaning: 'Environment::RunTimers: the libuv timer callback; calls processTimers in JS and reschedules.' },\n timersProcess: { id: 'o:timers.processTimers', meaning: 'processTimers: walks the due timer lists in expiry order.' },\n listOnTimeout: { id: 'o:timers.listOnTimeout', meaning: 'listOnTimeout: runs each due timer of one list; nextTicks and microtasks run between timers.' },\n uvRunTimers: { id: 'o:phase.timers', meaning: 'uv__run_timers: libuv runs timers whose timeout is not later than the loop time.' },\n\n // ---- immediates\n immediateSet: { id: 'o:immediate.setImmediate', meaning: 'setImmediate: creates an Immediate and appends it to the immediate queue.' },\n immediateNative: { id: 'o:immediate.check', meaning: 'Environment::CheckImmediate: the check-phase callback that calls processImmediate.' },\n immediateProcess: { id: 'o:immediate.process', meaning: 'processImmediate: runs the queued immediates; nextTicks and microtasks run between them.' },\n toggleImmediateRef: { id: 'o:immediate.toggleRef', meaning: 'Environment::ToggleImmediateRef: starts/stops an idle handle so poll does not block while immediates wait.' },\n\n // ---- thread pool (libuv)\n poolQueueWork: { id: 'o:pool.queue_work', meaning: 'uv_queue_work: the public \"run this function on the thread pool\" call.' },\n poolSubmit: { id: 'o:pool.submit', meaning: 'uv__work_submit: queues work for the pool (starts the threads on first use).' },\n poolPost: { id: 'o:pool.post', meaning: 'post: appends to the shared work queue and wakes an idle pool thread.' },\n poolWorker: { id: 'o:pool.worker', meaning: 'worker: a pool thread; waits, runs one work item, posts the result back.' },\n poolDone: { id: 'o:pool.done', meaning: 'uv__work_done: on the main thread, runs the after-work callbacks of finished items.' },\n poolWake: { id: 'o:pool.asyncSend', meaning: 'uv_async_send: wakes the loop from another thread (eventfd/pipe on Unix, a completion packet on Windows).' },\n scheduleWork: { id: 'o:cb.ScheduleWork', meaning: \"ThreadPoolWork::ScheduleWork: Node's wrapper around uv_queue_work for fs, crypto and zlib jobs.\" },\n\n // ---- calling back into JavaScript\n asyncWrapMakeCallback: { id: 'o:cb.MakeCallback', meaning: 'AsyncWrap::MakeCallback: calls a JS callback for an async resource (async_hooks before/after).' },\n makeCallback: { id: 'o:cb.InternalMakeCallback', meaning: 'InternalMakeCallback: opens a callback scope, calls the function, closes the scope.' },\n callbackScopeClose: { id: 'o:cb.ScopeClose', meaning: 'InternalCallbackScope::Close: after a callback, runs microtasks or the nextTick drain.' },\n\n // ---- debugger\n inspectorPause: { id: 'o:inspector.pause', meaning: 'runMessageLoopOnPause: the main thread waits here while a breakpoint holds JavaScript.' },\n\n // ---- fs\n fsReadFile: { id: 'o:fs.readFile', meaning: 'fs.readFile: small files in one thread-pool job (ReadFileJob), large ones in chunks.' },\n fsReadFileJobRun: { id: 'o:fs.ReadFileJob.Run', meaning: 'ReadFileJob::Run: schedules the whole read on the thread pool.' },\n fsReadFileJobWork: { id: 'o:fs.ReadFileJob.DoThreadPoolWork', meaning: 'ReadFileJob::DoThreadPoolWork: open, fstat, read, close on a pool thread.' },\n fsReadFileJobAfter: { id: 'o:fs.ReadFileJob.AfterThreadPoolWork', meaning: 'ReadFileJob::AfterThreadPoolWork: builds the Buffer and calls back into JS.' },\n fsReqCallback: { id: 'o:fs.reqCallback', meaning: 'FSReqCallback::Resolve: delivers the result of an async fs request to its JS callback.' },\n fsReqPromise: { id: 'o:fs.reqPromise', meaning: 'FSReqPromise::Resolve: settles the promise of an fs/promises request.' },\n\n // ---- crypto\n cryptoPbkdf2: { id: 'o:crypto.pbkdf2', meaning: 'crypto.pbkdf2: creates a PBKDF2Job and runs it on the thread pool.' },\n cryptoRandomBytes: { id: 'o:crypto.randomBytes', meaning: 'crypto.randomBytes: creates a RandomBytesJob and runs it on the thread pool.' },\n cryptoJobRun: { id: 'o:crypto.jobRun', meaning: 'CryptoJob::Run: runs a crypto job now (sync) or schedules it on the thread pool (async).' },\n cryptoDeriveBitsWork: { id: 'o:crypto.deriveBitsWork', meaning: 'DeriveBitsJob::DoThreadPoolWork: the pool-thread side of pbkdf2, randomBytes, scrypt, hkdf...' },\n cryptoPbkdf2DeriveBits: { id: 'o:crypto.pbkdf2DeriveBits', meaning: 'PBKDF2Traits::DeriveBits: the PBKDF2 computation (OpenSSL) on a pool thread.' },\n cryptoRandomBytesDeriveBits: { id: 'o:crypto.randomBytesDeriveBits', meaning: 'RandomBytesTraits::DeriveBits: fills the buffer with random bytes on a pool thread.' },\n cryptoJobAfter: { id: 'o:crypto.jobAfter', meaning: 'CryptoJob::AfterThreadPoolWork: back on the main thread, calls job.ondone in JS.' },\n\n // ---- zlib\n zlibProcessChunk: { id: 'o:zlib.processChunk', meaning: 'processChunk: hands one chunk to the native zlib handle (async write).' },\n zlibWrite: { id: 'o:zlib.write', meaning: 'CompressionStream::Write: queues compression work on the thread pool.' },\n zlibWork: { id: 'o:zlib.work', meaning: 'ZlibContext::DoThreadPoolWork: runs deflate/inflate on a pool thread.' },\n zlibAfter: { id: 'o:zlib.after', meaning: 'CompressionStream::AfterThreadPoolWork: back on the main thread, calls the JS write callback.' },\n\n // ---- dns.lookup\n dnsLookup: { id: 'o:dns.lookup', meaning: 'dns.lookup: asks the OS resolver (getaddrinfo) on the thread pool, not c-ares.' },\n dnsGetAddrInfo: { id: 'o:dns.getAddrInfo', meaning: 'GetAddrInfo (C++): starts uv_getaddrinfo with AfterGetAddrInfo as callback.' },\n uvGetaddrinfo: { id: 'o:dns.uvGetaddrinfo', meaning: 'uv_getaddrinfo: queues the lookup as slow I/O work on the thread pool.' },\n getaddrinfoWork: { id: 'o:dns.getaddrinfoWork', meaning: 'uv__getaddrinfo_work: calls the OS getaddrinfo on a pool thread.' },\n dnsAfterGetAddrInfo: { id: 'o:dns.afterGetAddrInfo', meaning: 'AfterGetAddrInfo: back on the main thread, converts the addresses and calls oncomplete in JS.' },\n\n // ---- sockets, processes, http (async_hooks resources)\n streamRead: { id: 'o:net.streamRead', meaning: 'LibuvStreamWrap::OnUvRead: data arrived on a TCP socket, pipe or TTY; calls onread in JS.' },\n streamAfterWrite: { id: 'o:net.afterWrite', meaning: 'LibuvStreamWrap::AfterUvWrite: a write finished; calls the write callback.' },\n streamAfterShutdown: { id: 'o:net.afterShutdown', meaning: 'LibuvStreamWrap::AfterUvShutdown: the write side was shut down.' },\n onConnection: { id: 'o:net.onConnection', meaning: 'ConnectionWrap::OnConnection: a server accepted a connection.' },\n afterConnect: { id: 'o:net.afterConnect', meaning: 'ConnectionWrap::AfterConnect: an outgoing connect finished.' },\n udpRecv: { id: 'o:net.udpRecv', meaning: 'UDPWrap::OnRecv: a datagram arrived.' },\n processExit: { id: 'o:proc.onExit', meaning: 'ProcessWrap::OnExit: a child process exited.' },\n fsEvent: { id: 'o:fs.watchEvent', meaning: 'FSEventWrap::OnEvent: fs.watch saw a change.' },\n statWatcher: { id: 'o:fs.statWatcher', meaning: 'StatWatcher::Callback: fs.watchFile polled a changed stat.' },\n httpIncoming: { id: 'o:http.incoming', meaning: 'IncomingMessage: a received HTTP request (server) or response (client).' },\n httpClientRequest: { id: 'o:http.clientRequest', meaning: 'ClientRequest: an outgoing HTTP request.' },\n udpSendDone: { id: 'o:net.udpSendDone', meaning: 'UDPWrap::OnSendDone: a datagram send finished; calls oncomplete in JS.' },\n\n // ---- c-ares DNS (dns.resolve*, dns.Resolver)\n dnsChannel: { id: 'o:dns.channel', meaning: 'ChannelWrap::New: creates the c-ares resolver channel used by dns.resolve* and dns.Resolver.' },\n dnsQueryResponse: { id: 'o:dns.queryResponse', meaning: 'QueryWrap::QueueResponseCallback: defers a c-ares answer with SetImmediate, so its callback runs in the check phase.' },\n nativeImmediatesRun: { id: 'o:immediate.native', meaning: 'Environment::RunAndClearNativeImmediates: runs C++ SetImmediate callbacks (such as c-ares answers) from CheckImmediate.' },\n\n // ---- stream shutdown and handle close\n 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.' },\n 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).' },\n uvClose: { id: 'o:loop.uvClose', meaning: 'uv_close: starts closing a handle; its close callback always runs later, in the close phase.' },\n 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.' },\n handleOnClose: { id: 'o:cb.handleOnClose', meaning: \"HandleWrap::OnClose: Node's close callback for every handle; calls the JS handle's onclose.\" },\n\n // ---- streams and workers\n streamFinished: { id: 'o:streams.eos', meaning: 'eos (stream.finished): calls back once a stream has ended, finished or errored; used by pipeline.' },\n messagePortOnMessage: { id: 'o:worker.onMessage', meaning: 'MessagePort::OnMessage: delivers queued messages from another thread to the JS listener of the port.' },\n workerExit: { id: 'o:worker.onExit', meaning: 'Worker::JoinThread: after the worker thread stopped, calls onexit in the parent thread.' },\n} as const satisfies Record<string, WellKnownEntry>;\n\nexport type WellKnownName = keyof typeof WELL_KNOWN;\n\n/** The 7 phases in the order uv_run runs them in one turn (timers also run once before the first turn). */\nexport const PHASE_ORDER = ['pending', 'idle', 'prepare', 'poll', 'check', 'closing', 'timers'] as const;\nexport type PhaseName = (typeof PHASE_ORDER)[number];\nexport const PHASE_IDS: Readonly<Record<PhaseName, string>> = {\n timers: WELL_KNOWN.phaseTimers.id,\n pending: WELL_KNOWN.phasePending.id,\n idle: WELL_KNOWN.phaseIdle.id,\n prepare: WELL_KNOWN.phasePrepare.id,\n poll: WELL_KNOWN.phasePoll.id,\n check: WELL_KNOWN.phaseCheck.id,\n closing: WELL_KNOWN.phaseClosing.id,\n};\n\n/** Atlas id of an event-loop phase. */\nexport function phaseAtlasId(phase: PhaseName): string {\n return PHASE_IDS[phase];\n}\n\n/**\n * async_hooks resource types (as reported by Node v26.13.1, checked with a probe script) to\n * the atlas box where the resource's callback is made. Types not listed here map to nothing.\n */\nexport interface AsyncTypeInfo extends WellKnownEntry {\n /** Short label a student can read, shown as the item's title in the app (\"setTimeout\", \"pbkdf2 request\"). */\n readonly title: string;\n}\n\nexport const ASYNC_TYPE_INFO: Readonly<Record<string, AsyncTypeInfo>> = {\n Timeout: { id: WELL_KNOWN.listOnTimeout.id, title: 'setTimeout / setInterval timer', meaning: 'setTimeout / setInterval timer; its callback runs from listOnTimeout.' },\n Immediate: { id: WELL_KNOWN.immediateProcess.id, title: 'setImmediate', meaning: 'setImmediate; its callback runs from processImmediate in the check phase.' },\n TickObject: { id: WELL_KNOWN.tickDrain.id, title: 'process.nextTick', meaning: 'process.nextTick; its callback runs from processTicksAndRejections.' },\n PROMISE: { id: WELL_KNOWN.promiseReactionRun.id, title: 'promise', meaning: 'A promise (reported while an async hook is enabled); its reactions run as microtasks.' },\n Microtask: { id: WELL_KNOWN.microtaskCallback.id, title: 'queueMicrotask', meaning: 'queueMicrotask callback; runs from the microtask queue via runMicrotask.' },\n FSREQCALLBACK: { id: WELL_KNOWN.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).' },\n FSREQPROMISE: { id: WELL_KNOWN.fsReqPromise.id, title: 'fs/promises request', meaning: 'fs/promises request.' },\n PBKDF2REQUEST: { id: WELL_KNOWN.cryptoJobAfter.id, title: 'pbkdf2 request', meaning: 'crypto.pbkdf2 job; work in PBKDF2Traits::DeriveBits on the pool.' },\n RANDOMBYTESREQUEST: { id: WELL_KNOWN.cryptoJobAfter.id, title: 'randomBytes request', meaning: 'crypto.randomBytes / randomFill job; work in RandomBytesTraits::DeriveBits on the pool.' },\n SCRYPTREQUEST: { id: WELL_KNOWN.cryptoJobAfter.id, title: 'scrypt request', meaning: 'crypto.scrypt job on the pool.' },\n GETADDRINFOREQWRAP: { id: WELL_KNOWN.dnsAfterGetAddrInfo.id, title: 'dns.lookup request', meaning: 'dns.lookup request; getaddrinfo runs on the pool.' },\n ZLIB: { id: WELL_KNOWN.zlibAfter.id, title: 'zlib stream', meaning: 'zlib stream; each chunk is compressed on the pool.' },\n TCPWRAP: { id: WELL_KNOWN.streamRead.id, title: 'TCP connection', meaning: 'TCP socket handle; reads arrive in the poll phase.' },\n TCPSERVERWRAP: { id: WELL_KNOWN.onConnection.id, title: 'TCP server', meaning: 'TCP server handle; new connections arrive in the poll phase.' },\n TCPCONNECTWRAP: { id: WELL_KNOWN.afterConnect.id, title: 'TCP connect request', meaning: 'Outgoing TCP connect request.' },\n PIPEWRAP: { id: WELL_KNOWN.streamRead.id, title: 'pipe', meaning: 'Pipe handle (also stdio pipes).' },\n PIPECONNECTWRAP: { id: WELL_KNOWN.afterConnect.id, title: 'pipe connect request', meaning: 'Outgoing pipe connect request.' },\n TTYWRAP: { id: WELL_KNOWN.streamRead.id, title: 'terminal (TTY)', meaning: 'TTY handle (terminal stdio).' },\n WRITEWRAP: { id: WELL_KNOWN.streamAfterWrite.id, title: 'stream write', meaning: 'A stream write request.' },\n SHUTDOWNWRAP: { id: WELL_KNOWN.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.' },\n UDPWRAP: { id: WELL_KNOWN.udpRecv.id, title: 'UDP socket', meaning: 'UDP socket handle.' },\n PROCESSWRAP: { id: WELL_KNOWN.processExit.id, title: 'child process', meaning: 'Child process handle.' },\n FSEVENTWRAP: { id: WELL_KNOWN.fsEvent.id, title: 'fs.watch watcher', meaning: 'fs.watch handle.' },\n STATWATCHER: { id: WELL_KNOWN.statWatcher.id, title: 'fs.watchFile watcher', meaning: 'fs.watchFile handle.' },\n HTTPINCOMINGMESSAGE: { id: WELL_KNOWN.httpIncoming.id, title: 'HTTP incoming message', meaning: 'HTTP incoming message (server request or client response).' },\n QUERYWRAP: { id: WELL_KNOWN.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.' },\n DNSCHANNEL: { id: WELL_KNOWN.dnsChannel.id, title: 'DNS resolver (c-ares)', meaning: 'The c-ares channel behind dns.resolve* and dns.Resolver; created when the dns module loads.' },\n PIPESERVERWRAP: { id: WELL_KNOWN.onConnection.id, title: 'pipe server', meaning: 'Pipe (named pipe / Unix socket) server handle; new connections arrive in the poll phase.' },\n UDPSENDWRAP: { id: WELL_KNOWN.udpSendDone.id, title: 'UDP send', meaning: 'A UDP send request.' },\n STREAM_END_OF_STREAM: { id: WELL_KNOWN.streamFinished.id, title: 'stream finished callback', meaning: 'stream.finished / pipeline callback, bound to the context where it was registered.' },\n MESSAGEPORT: { id: WELL_KNOWN.messagePortOnMessage.id, title: 'MessagePort (worker messages)', meaning: 'A message channel between threads; messages are delivered by MessagePort::OnMessage.' },\n WORKER: { id: WELL_KNOWN.workerExit.id, title: 'worker thread', meaning: 'A worker_threads Worker as seen from the parent thread.' },\n HTTPCLIENTREQUEST: { id: WELL_KNOWN.httpClientRequest.id, title: 'HTTP client request', meaning: 'HTTP client request.' },\n};\n\n/** async_hooks type string -> atlas id of the best place to point at for an item of that type. */\nexport const ASYNC_TYPE_AT: Readonly<Record<string, string>> = Object.fromEntries(\n Object.entries(ASYNC_TYPE_INFO).map(([type, e]) => [type, e.id]),\n);\n\n/** Every distinct well-known id (WELL_KNOWN plus the async type map). */\nexport function allWellKnownIds(): string[] {\n const ids = new Set<string>();\n for (const e of Object.values(WELL_KNOWN)) ids.add(e.id);\n for (const id of Object.values(ASYNC_TYPE_AT)) ids.add(id);\n return [...ids].sort();\n}\n","/**\n * Turns atlas boxes and user boxes into the renderer's neutral batches. Pure: tested in\n * Node (test/unit/map-model.test.ts).\n *\n * Detail levels (when a box fades in, see @nodejs-map/renderer DEFAULT_LOD):\n * 1 regions, and the two tier-1 groups (Event loop, Thread pool)\n * 2 other tier-2 boxes: groups, single boxes, features inside tier-1 groups\n * 3 features inside groups, directories, files\n * 4 functions\n */\nimport type { AtlasStore, Box } from '@nodejs-map/atlas-format';\nimport type { BoxBatch } from './renderer.ts';\nimport type { UserBox } from './contract.ts';\n\nexport const USER_REGION = 'o:user';\nexport const INDEX_BATCH = 'index';\nexport const USER_BATCH = 'user';\n\n/** Tint index per top-level region (Theme.tints, see theme.ts REGION_TOKENS). */\nexport const REGION_TINT: Readonly<Record<string, number>> = {\n 'o:user': 1, 'o:lib': 2, 'o:src': 3, 'o:v8': 4, 'o:libuv': 5, 'o:deps': 6, 'o:os': 7,\n};\n\n/** The top-level region of an index box. */\nexport function regionOf(atlas: AtlasStore, id: string): string | null {\n let cur = atlas.getBox(id);\n for (let i = 0; cur && i < 32; i++) {\n if (cur.parent === 'o:world') return cur.id;\n cur = atlas.getBox(cur.parent);\n }\n return null;\n}\n\nexport function levelOf(kind: Box['kind'], tier: number): 1 | 2 | 3 | 4 {\n if (kind === 'fn') return 4;\n if (tier === 1) return 1;\n if (tier === 2) return 2;\n return 3;\n}\n\n/** Tiers 1-2 (and the features stored in the index): available as soon as the index is loaded. */\nexport function indexBatch(atlas: AtlasStore): BoxBatch {\n const boxes = atlas.index.boxes;\n const ids: string[] = [], parents: (string | null)[] = [], labels: string[] = [];\n const rects = new Float32Array(boxes.length * 4);\n const levels = new Uint8Array(boxes.length), depths = new Uint8Array(boxes.length), tints = new Uint8Array(boxes.length);\n const depthOf = new Map<string, number>();\n let n = 0;\n for (const b of boxes) {\n const r = atlas.absRect(b.id);\n if (!r) continue;\n const parent = b.p === 'o:world' ? null : b.p;\n const depth = parent === null ? 0 : (depthOf.get(parent) ?? 0) + 1;\n depthOf.set(b.id, depth);\n ids.push(b.id);\n parents.push(parent);\n labels.push(b.n);\n rects.set([r.x, r.y, r.w, r.h], n * 4);\n levels[n] = levelOf(b.k, b.t);\n depths[n] = depth;\n tints[n] = REGION_TINT[regionOf(atlas, b.id) ?? ''] ?? 0;\n n++;\n }\n return { id: INDEX_BATCH, ids, parents, labels, rects: rects.subarray(0, n * 4), levels: levels.subarray(0, n), depths: depths.subarray(0, n), tints: tints.subarray(0, n) };\n}\n\nexport interface RegionRect { x: number; y: number; w: number; h: number }\n\nconst HEADER = 0.08, SIDE = 0.01;\n\n/**\n * Lays \"Your code\" out inside the region: a slice-and-dice treemap, files side by side,\n * each file's functions stacked the other way, alternating at each depth. A box's weight\n * is 1 + its number of descendants, so a file with many functions gets more room.\n * Deterministic: depends only on the boxes and their order. Your files are level 1 (shown\n * with the big parts), their functions level 2.\n */\nexport function userBatch(region: RegionRect, regionDepth: number, boxes: readonly UserBox[]): BoxBatch {\n const known = new Set(boxes.map((b) => b.id));\n const kids = new Map<string | null, UserBox[]>();\n for (const b of boxes) {\n const p = b.parent !== null && known.has(b.parent) ? b.parent : null;\n let list = kids.get(p);\n if (!list) kids.set(p, (list = []));\n list.push(b);\n }\n const weight = new Map<string, number>();\n const w = (b: UserBox): number => {\n let v = weight.get(b.id);\n if (v === undefined) {\n v = 1 + (kids.get(b.id) ?? []).reduce((s, k) => s + w(k), 0);\n weight.set(b.id, v);\n }\n return v;\n };\n const ids: string[] = [], parents: (string | null)[] = [], labels: string[] = [], rects: number[] = [], levels: number[] = [], depths: number[] = [];\n const place = (list: readonly UserBox[], parent: string, r: RegionRect, depth: number, horizontal: boolean): void => {\n const inner = { x: r.x + r.w * SIDE, y: r.y + r.h * HEADER, w: r.w * (1 - 2 * SIDE), h: r.h * (1 - HEADER - SIDE) };\n const total = list.reduce((s, b) => s + w(b), 0);\n if (total <= 0) return;\n const gap = (horizontal ? inner.w : inner.h) * 0.004;\n let at = 0;\n for (const b of list) {\n const share = w(b) / total;\n const span = (horizontal ? inner.w : inner.h) * share;\n const rect = horizontal\n ? { x: inner.x + at + gap / 2, y: inner.y, w: Math.max(0, span - gap), h: inner.h }\n : { x: inner.x, y: inner.y + at + gap / 2, w: inner.w, h: Math.max(0, span - gap) };\n at += span;\n ids.push(b.id);\n parents.push(parent);\n labels.push(b.lines ? `${b.label} ${b.lines.start}-${b.lines.end}` : b.label);\n rects.push(rect.x, rect.y, rect.w, rect.h);\n levels.push(depth <= regionDepth + 1 ? 1 : depth === regionDepth + 2 ? 2 : 3);\n depths.push(depth);\n const sub = kids.get(b.id);\n if (sub?.length) place(sub, b.id, rect, depth + 1, !horizontal);\n }\n };\n place(kids.get(null) ?? [], USER_REGION, region, regionDepth + 1, true);\n return {\n id: USER_BATCH, ids, parents, labels, rects: Float32Array.from(rects), levels: Uint8Array.from(levels), depths: Uint8Array.from(depths),\n tints: new Uint8Array(ids.length).fill(REGION_TINT[USER_REGION] ?? 0),\n };\n}\n\n/** The tier-3 group a file / function / directory id belongs to, from the id alone when possible. */\nexport function groupOfDirId(id: string): string | null {\n if (!id.startsWith('d:')) return null;\n const at = id.indexOf(':', 2);\n return at > 2 ? `o:${id.slice(2, at)}` : null;\n}\n\n/** Repository path of an f: / s: id. */\nexport function pathOfId(id: string): string | null {\n if (id.startsWith('f:')) return id.slice(2);\n if (id.startsWith('s:')) {\n const at = id.indexOf('#');\n return at > 2 ? id.slice(2, at) : null;\n }\n return null;\n}\n","/**\n * Atlas work the map panel needs beyond tiers 1-2: tier-3 chunks as typed arrays, search,\n * box descriptions with links, locate, and extracted edges. Runs inside a Worker (see\n * atlas.worker.ts) so parsing and validating chunks never blocks a frame; it can also run\n * on the main thread with the shell's AtlasStore when the atlas folder URL is unknown.\n */\nimport type { AtlasStore, Box, BoxLinks, CodeRange, Edge, Platform, SearchHit } from '@nodejs-map/atlas-format';\nimport { levelOf } from './model.ts';\n\nexport interface ChunkPayload {\n chunk: string;\n group: string;\n /** Slice number and count: a big chunk reaches the main thread in slices (see sliceChunk). */\n part: number;\n parts: number;\n ids: string[];\n parents: string[];\n labels: string[];\n /** Absolute world rects, 4 per row. */\n rects: Float32Array;\n levels: Uint8Array;\n depths: Uint8Array;\n /** Time spent fetching + parsing + validating (in the worker), ms. */\n loadMs: number;\n}\n\nexport interface BoxInfo {\n box: Box;\n links?: BoxLinks;\n range?: CodeRange;\n}\n\nexport interface EdgeEnd {\n id: string;\n /** Chunk that holds the box (null: it is in the index). */\n chunk: string | null;\n /** Group box that contains it (always loaded), to draw at while the chunk loads. */\n group: string | null;\n}\n\nexport interface EdgeOut {\n from: EdgeEnd;\n to: EdgeEnd;\n kind: Edge['kind'];\n}\n\nexport interface AtlasApi {\n /** Loads a chunk and hands it over in slices of at most SLICE_ROWS rows, parents first. */\n chunkParts(chunkId: string, onPart: (p: ChunkPayload) => void): Promise<void>;\n /** Chunk and group of a tier-3 id (loads files.json / the chunk where needed). */\n place(id: string): Promise<EdgeEnd | null>;\n search(query: string, limit: number): Promise<SearchHit[]>;\n describe(id: string, platform: Platform): Promise<BoxInfo | null>;\n locate(path: string, line: number): Promise<string | null>;\n edgesFor(id: string, limit: number): Promise<EdgeOut[]>;\n}\n\n/**\n * Rows per slice. Adding a slice costs the main thread about 1 ms at full speed: small\n * enough that a chunk arriving during playback never makes a long task, even at 4-6x CPU\n * throttle and when it lands in the same frame as other work.\n */\nexport const SLICE_ROWS = 300;\n\n/** Splits a payload into slices in row order (rows are parents-first, so slices are too). */\nexport function sliceChunk(p: ChunkPayload, rows = SLICE_ROWS): ChunkPayload[] {\n const n = p.ids.length;\n if (n <= rows) return [p];\n const parts = Math.ceil(n / rows);\n const out: ChunkPayload[] = [];\n for (let i = 0; i < parts; i++) {\n const a = i * rows, b = Math.min(n, a + rows);\n out.push({\n chunk: p.chunk, group: p.group, part: i, parts, ids: p.ids.slice(a, b), parents: p.parents.slice(a, b), labels: p.labels.slice(a, b),\n rects: p.rects.slice(a * 4, b * 4), levels: p.levels.slice(a, b), depths: p.depths.slice(a, b), loadMs: p.loadMs,\n });\n }\n return out;\n}\n\nexport class AtlasService implements AtlasApi {\n readonly #store: AtlasStore;\n readonly #depth = new Map<string, number>();\n #regFile: Map<string, string> | null = null;\n #edges: Edge[] | null = null;\n\n constructor(store: AtlasStore) {\n this.#store = store;\n }\n\n #depthOf(id: string): number {\n let d = this.#depth.get(id);\n if (d !== undefined) return d;\n const box = this.#store.getBox(id);\n d = !box || box.parent === 'o:world' ? 0 : this.#depthOf(box.parent) + 1;\n this.#depth.set(id, d);\n return d;\n }\n\n async chunk(chunkId: string): Promise<ChunkPayload> {\n const t0 = performance.now();\n const chunk = await this.#store.loadChunk(chunkId);\n const n = chunk.rows.length;\n const ids: string[] = new Array(n), parents: string[] = new Array(n), labels: string[] = new Array(n);\n const rects = new Float32Array(n * 4), levels = new Uint8Array(n), depths = new Uint8Array(n);\n let k = 0;\n for (const row of chunk.rows) {\n const id = row[0];\n const r = this.#store.absRect(id);\n if (!r) continue;\n ids[k] = id;\n parents[k] = row[1];\n labels[k] = row[3];\n rects[k * 4] = r.x; rects[k * 4 + 1] = r.y; rects[k * 4 + 2] = r.w; rects[k * 4 + 3] = r.h;\n levels[k] = levelOf(row[2] === 's' ? 'fn' : row[2] === 'f' ? 'file' : 'dir', 3);\n depths[k] = Math.min(255, this.#depthOf(id));\n k++;\n }\n ids.length = parents.length = labels.length = k;\n return {\n chunk: chunk.id, group: chunk.group, part: 0, parts: 1, ids, parents, labels,\n rects: rects.slice(0, k * 4), levels: levels.slice(0, k), depths: depths.slice(0, k), loadMs: performance.now() - t0,\n };\n }\n\n async chunkParts(chunkId: string, onPart: (p: ChunkPayload) => void): Promise<void> {\n for (const part of sliceChunk(await this.chunk(chunkId))) onPart(part);\n }\n\n async place(id: string): Promise<EdgeEnd | null> {\n const real = this.#store.resolveAlias(id);\n const have = this.#store.getBox(real);\n if (have && have.tier !== 3) return { id: real, chunk: null, group: null };\n if (have && !have.chunk) return { id: real, chunk: null, group: have.parent };\n const box = have ?? (await this.#store.box(real).catch(() => undefined));\n if (!box) return null;\n if (!box.chunk) return { id: real, chunk: null, group: null };\n const ref = this.#store.index.chunks.find((c) => c.id === box.chunk);\n return { id: real, chunk: box.chunk, group: ref?.group ?? null };\n }\n\n search(query: string, limit: number): Promise<SearchHit[]> {\n return this.#store.search(query, limit);\n }\n\n async describe(id: string, platform: Platform): Promise<BoxInfo | null> {\n const box = await this.#store.box(id).catch(() => undefined);\n if (!box) return null;\n const info: BoxInfo = { box };\n const links = this.#store.links(box, platform);\n if (links) info.links = links;\n const range = this.#store.pickRange(box, platform);\n if (range) info.range = range;\n return info;\n }\n\n async locate(path: string, line: number): Promise<string | null> {\n return (await this.#store.locate(path, line).catch(() => undefined)) ?? null;\n }\n\n /**\n * Extracted relations around a box, binding nodes resolved to the C++ file that\n * registers the binding: lib file -> C++ file (uses-binding), lib function -> C++\n * function (calls-binding), C++ -> libuv (calls-uv). A file also matches the edges of\n * the functions inside it.\n */\n async edgesFor(id: string, limit: number): Promise<EdgeOut[]> {\n if (!this.#edges) {\n const all = await this.#store.edges();\n this.#edges = all.edges;\n this.#regFile = new Map();\n for (const e of all.edges) if (e.kind === 'registers-binding') this.#regFile.set(e.to, e.from);\n }\n const reg = this.#regFile as Map<string, string>;\n const bindingFile = (b: string): string | null => reg.get(b) ?? reg.get(b.split('.')[0] as string) ?? null;\n const filePath = id.startsWith('f:') ? id.slice(2) : null;\n const matches = (x: string): boolean => x === id || (filePath !== null && x.startsWith(`s:${filePath}#`));\n const pairs = new Map<string, [string, string, Edge['kind']]>();\n const add = (a: string | null, b: string | null, kind: Edge['kind']): void => {\n if (!a || !b || a === b || (!matches(a) && !matches(b))) return;\n const key = `${a}\\n${b}`;\n if (!pairs.has(key)) pairs.set(key, [a, b, kind]);\n };\n for (const e of this.#edges) {\n if (pairs.size >= limit) break;\n if (e.kind === 'uses-binding') add(e.from, bindingFile(e.to), e.kind);\n else if (e.kind === 'calls-binding') add(e.from, e.cxx ?? bindingFile(e.to), e.kind);\n else if (e.kind === 'calls-uv') for (const t of e.to) add(e.from, t, e.kind);\n }\n const out: EdgeOut[] = [];\n for (const [a, b, kind] of pairs.values()) {\n const [pa, pb] = await Promise.all([this.place(a), this.place(b)]);\n if (pa && pb) out.push({ from: pa, to: pb, kind });\n }\n return out;\n }\n}\n","/**\n * The map's atlas worker: its own AtlasStore over the atlas folder, so tier-3 chunks,\n * search.json and edges.json are fetched, parsed and validated off the main thread. The\n * main thread receives typed arrays (transferred, not copied) and small objects.\n */\nimport { AtlasStore } from '@nodejs-map/atlas-format';\nimport { AtlasService, sliceChunk } from './atlasService.ts';\nimport type { WorkerReply, WorkerRequest } from './client.ts';\n\nlet service: AtlasService | null = null;\nlet base: URL | null = null;\n\nasync function fetchJson(relative: string): Promise<unknown> {\n if (!base) throw new Error('atlas worker: not initialised');\n const url = new URL(relative, base);\n // atlas files name their own URLs: never leave the atlas folder\n if (url.origin !== base.origin || !url.pathname.startsWith(base.pathname)) throw new Error(`The atlas names a file outside its folder: ${relative}`);\n const res = await fetch(url, { credentials: 'same-origin' });\n if (!res.ok) throw new Error(`${relative}: HTTP ${res.status}`);\n return res.json();\n}\n\nconst post = (msg: WorkerReply, transfer: Transferable[] = []): void => (self as unknown as Worker).postMessage(msg, transfer);\n\nself.onmessage = async (event: MessageEvent<WorkerRequest>) => {\n const req = event.data;\n try {\n if (req.op === 'init') {\n base = new URL(req.base);\n const store = new AtlasStore({ fetchJson });\n const index = await store.load();\n if (index.node.commit !== req.commit) throw new Error(`atlas at ${req.base} is for commit ${index.node.commit}, not ${req.commit}`);\n service = new AtlasService(store);\n post({ id: req.id, ok: true, value: null });\n return;\n }\n if (!service) throw new Error('atlas worker: not initialised');\n switch (req.op) {\n case 'chunk': {\n for (const p of sliceChunk(await service.chunk(req.chunk))) {\n post({ id: req.id, ok: true, partial: true, value: p }, [p.rects.buffer, p.levels.buffer, p.depths.buffer]);\n }\n post({ id: req.id, ok: true, value: null });\n return;\n }\n case 'place': post({ id: req.id, ok: true, value: await service.place(req.target) }); return;\n case 'search': post({ id: req.id, ok: true, value: await service.search(req.query, req.limit) }); return;\n case 'describe': post({ id: req.id, ok: true, value: await service.describe(req.target, req.platform) }); return;\n case 'locate': post({ id: req.id, ok: true, value: await service.locate(req.path, req.line) }); return;\n case 'edges': post({ id: req.id, ok: true, value: await service.edgesFor(req.target, req.limit) }); return;\n }\n } catch (e) {\n post({ id: req.id, ok: false, error: e instanceof Error ? e.message : String(e) });\n }\n};\n"],"mappings":"AA6BA,MAmIaA,EAAa,CAAC,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