{"version":3,"sources":["../src/linkSpace.ts"],"sourcesContent":["// Link path spaces (R3-273; REPO_CONTENT_DISPATCH_SPEC §9 decision, 2026-08-17).\n// R3-279: the RESOLVER CORE (resolveLinkTarget / normalizeAbsolute / FS_PREFIX /\n// ResolvedLinkTarget) moved to `@immediately-run/mdx-plugins` — beside its parity\n// fixture — and is re-exported here unchanged (API-stable). This module keeps the\n// REACT surface (LinkSpaceContext): the provider a bundle-rendering app wraps its\n// document tree in. Consumers importing from '@immediately-run/sdk/linkSpace' see\n// exactly the same names.\n//\n// A document link's target resolves in one of two spaces:\n//\n// - DEFAULT — the enclosing bundle's virtual filesystem. RELATIVE targets resolve\n//   against the authoring file (identical in both spaces); ABSOLUTE targets\n//   (`/x/y.mdx`) resolve from the bundle root when an enclosing `LinkSpaceContext`\n//   declares one, else from the filesystem root. A non-bundle app declares nothing\n//   and keeps today's behavior bit-for-bit (its fs root IS its only root).\n//\n// - `$fs:` — the explicit filesystem space: `$fs:/content/x.mdx` resolves from the\n//   root of the filesystem the app reads, escaping bundle-relative addressing.\n//\n// `$fs:` changes ADDRESSING, never REACH: resolution is pure path arithmetic and\n// existence is checked against the same in-mount metadata the default space uses —\n// nothing is fetched, and a link can never name what the app cannot already read.\n// A malformed `$fs:` target (anything not mount-absolute — which also catches\n// scheme smuggling like `$fs:javascript:…`) is INVALID and must render as a broken\n// link, never an anchor.\n//\n// Bundle nesting: `LinkSpaceContext` providers nest, and the NEAREST one wins —\n// which is exactly the innermost-enclosing-bundle rule (bundle encapsulation): a\n// document rendered inside a nested bundle resolves against the nested bundle.\n\nimport { createContext } from 'react';\n\nexport { FS_PREFIX, normalizeAbsolute, resolveLinkTarget } from '@immediately-run/mdx-plugins';\nexport type { ResolvedLinkTarget, LinkSpace } from '@immediately-run/mdx-plugins';\nimport type { LinkSpace as LinkSpaceShape } from '@immediately-run/mdx-plugins';\n\n/** Ambient link space. A bundle-rendering app wraps its document tree in\n *  `<LinkSpaceContext value={{ bundleRoot }}>`; nesting a second provider inside a\n *  rendered sub-bundle makes the innermost root win.\n *\n *  R3-482: the root's canonical spelling is `bundleRoot`; the deprecated\n *  `corpusRoot` field stays in the `LinkSpace` type (mdx-plugins §forever-compat)\n *  and is read as the fallback — only when `bundleRoot` is ABSENT, since an\n *  explicit `bundleRoot: null` is a value (\"no bundle root\"), not a miss. */\nexport const LinkSpaceContext = createContext<LinkSpaceShape>({\n  bundleRoot: null,\n  bundleChrooted: false,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BA,mBAA8B;AAE9B,yBAAgE;AAYzD,MAAM,uBAAmB,4BAA8B;AAAA,EAC5D,YAAY;AAAA,EACZ,gBAAgB;AAClB,CAAC;","names":[]}