@leadertechie/md2html 0.1.0-alpha.18 → 0.1.0-alpha.19
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/README.md +152 -2
- package/dist/index.d.ts +266 -28
- package/dist/index.js +452 -435
- package/dist/index.js.map +1 -1
- package/dist/index2.js +4 -325
- package/dist/index2.js.map +1 -1
- package/dist/lit-renderer-Bp1Q6wYL.js +790 -0
- package/dist/lit-renderer-Bp1Q6wYL.js.map +1 -0
- package/dist/lit-renderer.d.ts +46 -2
- package/package.json +2 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/types.ts","../src/handlers/heading-handler.ts","../src/handlers/paragraph-handler.ts","../src/handlers/list-handler.ts","../src/handlers/image-handler.ts","../src/handlers/code-handler.ts","../src/handlers/hr-handler.ts","../src/handlers/blockquote-handler.ts","../src/handlers/html-handler.ts","../src/handlers/link-handler.ts","../src/handlers/catchall-handler.ts","../src/handlers/frontmatter-handler.ts","../src/handlers/container-block-handler.ts","../src/handlers/registry.ts","../src/parser.ts","../src/renderer-strategies.ts","../src/renderer.ts","../src/pipeline.ts","../src/visitor.ts","../src/factory.ts"],"sourcesContent":["export type ContentNodeType = \n | 'text' \n | 'heading' \n | 'paragraph' \n | 'list' \n | 'list-item' \n | 'image' \n | 'code' \n | 'container'\n | 'strong'\n | 'emphasis'\n | 'link';\n\nexport interface ContentNode {\n type: ContentNodeType;\n content?: string;\n children?: ContentNode[];\n attributes?: Record<string, unknown>;\n className?: string;\n src?: string;\n alt?: string;\n ordered?: boolean;\n /** Raw HTML content for passthrough mode */\n rawHTML?: string;\n /** Scope anchor value for data-md-scope */\n scope?: string;\n}\n\nexport interface MarkdownContent {\n title: string;\n metadata?: Record<string, unknown>;\n content: ContentNode[];\n}\n\nexport interface ParseOptions {\n gfm?: boolean;\n breaks?: boolean;\n pedantic?: boolean;\n}\n\nexport interface StyleConfig {\n classPrefix?: string;\n customCSS?: string;\n addHeadingIds?: boolean;\n}\n\n/**\n * v2: Extended StyleConfig with scope anchor support.\n */\nexport interface StyleConfigV2 extends StyleConfig {\n /** Emit data-md-scope attributes for CSS @scope anchoring (default: false) */\n emitScopeAnchors?: boolean;\n}\n\nexport interface PipelineConfig {\n imagePathPrefix?: string;\n imageBaseUrl?: string;\n parseOptions?: ParseOptions;\n styleOptions?: StyleConfig | StyleConfigV2;\n}\n\n/**\n * v2: Extended PipelineConfig with raw HTML passthrough, slot hooks, and error recovery.\n */\nexport interface PipelineConfigV2 extends PipelineConfig {\n styleOptions?: StyleConfigV2;\n /** Preserve raw HTML tags in markdown (img, style, div, span, etc.) (default: false) */\n preserveRawHTML?: boolean;\n /** Regex pattern for slot placeholders like [[SLOT_NAME]] (default: /\\[\\[(.*?)\\]\\]/g) */\n slotPattern?: RegExp;\n /** Callback to resolve slot values. Called with the slot name, returns replacement string. */\n onSlot?: (name: string) => string;\n /** Error recovery mode (default: 'throw' — backward compatible) */\n errorRecovery?: 'throw' | 'warn' | 'silent';\n /** Max recursion depth to prevent stack overflow (default: 100) */\n maxRecursionDepth?: number;\n /** Additional allowed HTML tags for preserveRawHTML mode */\n allowedHTMLTags?: string[];\n /**\n * Allowed HTML attributes per tag for preserveRawHTML mode.\n * Key \"*\" applies to all tags. Key \"tag\" applies to specific tags.\n * Supports \"data-*\" wildcard prefix matching.\n * Example: { \"*\": [\"id\", \"class\"], \"script\": [\"type\", \"src\"] }\n */\n allowedAttributes?: Record<string, string[]>;\n}\n\n\n/** Default allowed HTML tags for preserveRawHTML mode */\nexport const defaultAllowedHTMLTags = [\n 'img', 'style', 'div', 'span', 'section', 'article',\n 'aside', 'header', 'footer', 'nav', 'main', 'figure',\n 'figcaption', 'details', 'summary', 'mark', 'time',\n 'video', 'audio', 'source', 'iframe', 'embed'\n];\n\n/** Scope hierarchy values for data-md-scope */\nexport type ScopeValue =\n | 'root'\n | 'heading'\n | 'paragraph'\n | 'list'\n | 'list-item'\n | 'image'\n | 'code'\n | 'strong'\n | 'emphasis'\n | 'link'\n | 'container';\n\n/** Maps ContentNodeType to ScopeValue */\nexport const nodeTypeToScope: Record<ContentNodeType, ScopeValue> = {\n 'text': 'root',\n 'heading': 'heading',\n 'paragraph': 'paragraph',\n 'list': 'list',\n 'list-item': 'list-item',\n 'image': 'image',\n 'code': 'code',\n 'container': 'container',\n 'strong': 'strong',\n 'emphasis': 'emphasis',\n 'link': 'link',\n};\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'heading' tokens (h1-h6).\n */\nexport class HeadingHandler implements TokenHandler {\n readonly type = 'heading';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n return {\n type: 'heading' as const,\n content: ctx.processSlots(token.text as string),\n attributes: { level: String(token.depth) }\n };\n }\n}\n","import { ContentNode } from '../types.js';\nimport { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'paragraph' tokens, including inline images, links, and raw HTML.\n */\nexport class ParagraphHandler implements TokenHandler {\n readonly type = 'paragraph';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n const tokens = (token.tokens as Array<Record<string, unknown>>) || [];\n const hasInlineImage = tokens.some(t => t.type === 'image');\n const hasInlineLink = tokens.some(t => t.type === 'link');\n const hasInlineHTML = tokens.some(t => t.type === 'html');\n\n if (hasInlineImage || hasInlineLink || (ctx.preserveRawHTML && hasInlineHTML)) {\n const children = tokens.map(t => {\n if (t.type === 'image') {\n return {\n type: 'image' as const,\n src: ctx.processImagePath(t.href as string),\n alt: t.text as string || ''\n };\n }\n if (t.type === 'link') {\n return {\n type: 'link' as const,\n content: ctx.processSlots(ctx.processInlineFormatting(t.text as string || '')),\n attributes: {\n href: t.href as string || '',\n ...(t.title ? { title: t.title as string } : {})\n }\n };\n }\n if (t.type === 'html' && ctx.preserveRawHTML) {\n const processed = ctx.processRawHTML(t.raw as string);\n if (processed.trim()) {\n return { type: 'text' as const, content: processed };\n }\n return null;\n }\n return {\n type: 'text' as const,\n content: ctx.processSlots(ctx.processInlineFormatting(t.text as string || ''))\n };\n }).filter(Boolean) as ContentNode[];\n\n\n if (children.length === 0) return null;\n\n return { type: 'paragraph' as const, children };\n }\n\n return {\n type: 'paragraph' as const,\n content: ctx.processSlots(ctx.processInlineFormatting(token.text as string))\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'list' tokens (ordered and unordered).\n */\nexport class ListHandler implements TokenHandler {\n readonly type = 'list';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n return {\n type: 'list' as const,\n ordered: token.ordered as boolean,\n children: (token.items as Array<Record<string, unknown>>).map((item) => ({\n type: 'list-item' as const,\n content: ctx.processSlots(ctx.processInlineFormatting(item.text as string))\n }))\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles standalone 'image' tokens.\n */\nexport class ImageHandler implements TokenHandler {\n readonly type = 'image';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n return {\n type: 'image' as const,\n src: ctx.processImagePath(token.href as string),\n alt: token.title as string || ''\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'code' tokens (fenced code blocks).\n */\nexport class CodeHandler implements TokenHandler {\n readonly type = 'code';\n\n handle(token: Record<string, unknown>, _ctx: ParseContext) {\n return {\n type: 'code' as const,\n content: token.text as string,\n attributes: { lang: token.lang as string || '' }\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'hr' tokens (horizontal rules).\n */\nexport class HrHandler implements TokenHandler {\n readonly type = 'hr';\n\n handle(_token: Record<string, unknown>, _ctx: ParseContext) {\n return { type: 'container' as const, attributes: { tag: 'hr' } };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'blockquote' tokens.\n */\nexport class BlockquoteHandler implements TokenHandler {\n readonly type = 'blockquote';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n return {\n type: 'container' as const,\n attributes: { tag: 'blockquote' },\n children: ctx.parseTokens((token.tokens as unknown[]) || [], ctx.maxRecursionDepth + 1)\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'html' tokens (inline or block-level raw HTML).\n * In preserveRawHTML mode, passes through allowed HTML tags.\n * Otherwise, stores the raw content as a container node.\n */\nexport class HtmlHandler implements TokenHandler {\n readonly type = 'html';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n if (ctx.preserveRawHTML) {\n const raw = token.raw as string;\n const processed = ctx.processRawHTML(raw);\n if (processed.trim()) {\n return { type: 'container' as const, rawHTML: processed };\n }\n return null;\n }\n return { type: 'container' as const, content: token.raw as string };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles standalone 'link' tokens (e.g., reference-style links, or links\n * that appear outside paragraphs in certain edge cases).\n */\nexport class LinkHandler implements TokenHandler {\n readonly type = 'link';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n const text = token.text as string || '';\n const href = token.href as string || '';\n const title = token.title as string || '';\n\n return {\n type: 'link' as const,\n content: ctx.processSlots(ctx.processInlineFormatting(text)),\n attributes: {\n href,\n ...(title ? { title } : {})\n }\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Catch-all handler for any token type that doesn't have a dedicated handler.\n * Wraps the raw token content in a container node so content is never silently lost.\n * Reports the unhandled type via the context's reportUnhandled callback.\n */\nexport class CatchAllHandler implements TokenHandler {\n readonly type = '*';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n const tokenType = token.type as string;\n\n // Report the unhandled token so callers can be notified\n ctx.reportUnhandled(tokenType, token);\n\n // Try to extract meaningful content from the raw token\n const raw = token.raw as string | undefined;\n const text = token.text as string | undefined;\n const content = raw || text || `[unhandled: ${tokenType}]`;\n\n return {\n type: 'container' as const,\n content,\n attributes: {\n 'data-unhandled': tokenType,\n tag: 'div'\n }\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * FrontmatterHandler — consumes YAML-ish frontmatter tokens produced by marked.lexer().\n * Parses the raw YAML and stores key-value pairs onto ctx.metadata.\n * Returns null so no HTML is emitted for frontmatter blocks.\n *\n * Handles both formats:\n * key: value\n * key:\n * - item1\n * - item2\n */\nexport class FrontmatterHandler implements TokenHandler {\n readonly type = 'frontmatter';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n const raw = (token.raw as string) || '';\n\n // Normalize line endings\n const lines = raw.split('\\n');\n const parsed: Record<string, unknown> = {};\n\n let currentKey: string | null = null;\n let currentArray: string[] = [];\n\n for (const line of lines) {\n // Detect dashed list item (indented with `- `)\n const listMatch = line.match(/^\\s+-\\s+(.+)$/);\n if (listMatch && currentKey) {\n currentArray.push(listMatch[1].trim());\n continue;\n }\n\n // If we were building an array, flush it\n if (currentKey && currentArray.length > 0) {\n parsed[currentKey] = [...currentArray];\n currentArray = [];\n currentKey = null;\n }\n\n // Detect key: value or key:\n const keyMatch = line.match(/^(\\w[\\w_-]*)\\s*:\\s*(.*)$/);\n if (keyMatch) {\n currentKey = keyMatch[1];\n const val = keyMatch[2].trim();\n\n if (val === '') {\n // List follows — continue\n continue;\n } else if (val.startsWith('[') && val.endsWith(']')) {\n // Inline array: [a, b, c]\n parsed[currentKey] = val.slice(1, -1).split(',').map(s => s.trim().replace(/^[\"']|[\"']$/g, ''));\n currentKey = null;\n } else {\n parsed[currentKey] = val.replace(/^[\"']|[\"']$/g, '');\n currentKey = null;\n }\n }\n }\n\n // Flush any remaining array\n if (currentKey && currentArray.length > 0) {\n parsed[currentKey] = [...currentArray];\n }\n\n // Merge parsed metadata into the shared context metadata\n if (ctx.metadata) {\n Object.assign(ctx.metadata, parsed);\n }\n\n // Return null — frontmatter produces no HTML\n return null;\n }\n}\n","import { ContentNode } from '../types.js';\nimport { TokenHandler, ParseContext } from './types.js';\n\n/**\n * ContainerBlockHandler — handles custom :::tag#id.class container blocks.\n *\n * These are produced by the MarkdownParser's preprocessor which converts\n * the ::: syntax into marked tokens before lexing, then reconstructs\n * containerBlock tokens after lexing.\n *\n * The handler parses the specifier (e.g. \"section#header.content\") into\n * tag name, id, and class(es), then recursively parses the inner tokens\n * as normal markdown content, producing a container node with the\n * specified HTML wrapper.\n */\nexport class ContainerBlockHandler implements TokenHandler {\n readonly type = 'containerBlock';\n\n handle(token: Record<string, unknown>, ctx: ParseContext): ContentNode | null {\n const specifier = token.specifier as string;\n const childTokens = token.tokens as unknown[];\n\n if (!specifier) return null;\n\n // Parse specifier: tag#id.class (any order, all optional except tag)\n const tagMatch = specifier.match(/^(\\w+)/);\n const idMatch = specifier.match(/#([\\w-]+)/);\n const classMatches = [...specifier.matchAll(/\\.([\\w-]+)/g)];\n\n const tag = tagMatch?.[1] || 'div';\n const id = idMatch?.[1] || '';\n const classes = classMatches.map(m => m[1]);\n\n // Recursively parse inner tokens as markdown\n const children = ctx.parseTokens(childTokens, 0);\n\n return {\n type: 'container' as const,\n children,\n attributes: {\n tag,\n id: id || undefined,\n },\n className: classes.length > 0 ? classes.join(' ') : undefined,\n };\n }\n}\n","import type { TokenHandler } from './types.js';\nimport { HeadingHandler } from './heading-handler.js';\nimport { ParagraphHandler } from './paragraph-handler.js';\nimport { ListHandler } from './list-handler.js';\nimport { ImageHandler } from './image-handler.js';\nimport { CodeHandler } from './code-handler.js';\nimport { HrHandler } from './hr-handler.js';\nimport { BlockquoteHandler } from './blockquote-handler.js';\nimport { HtmlHandler } from './html-handler.js';\nimport { LinkHandler } from './link-handler.js';\nimport { CatchAllHandler } from './catchall-handler.js';\n\nimport { FrontmatterHandler } from './frontmatter-handler.js';\nimport { ContainerBlockHandler } from './container-block-handler.js';\n\n\n/**\n * Registry of token handlers. Handlers can be added/overridden externally\n * to extend the parser without modifying its internals.\n *\n * The registry uses a two-tier lookup:\n * 1. First, check for a dedicated handler by token type name\n * 2. If none found, fall back to the catch-all handler (registered as '*')\n *\n * The catch-all handler ensures no content is silently lost — unhandled\n * token types are wrapped in a container node with `data-unhandled` attribute.\n */\nexport class TokenHandlerRegistry {\n private handlers = new Map<string, TokenHandler>();\n private catchAll: TokenHandler;\n\n constructor() {\n // Register all built-in handlers\n this.register(new HeadingHandler());\n this.register(new ParagraphHandler());\n this.register(new ListHandler());\n this.register(new ImageHandler());\n this.register(new CodeHandler());\n this.register(new HrHandler());\n this.register(new BlockquoteHandler());\n this.register(new HtmlHandler());\n this.register(new FrontmatterHandler());\n this.register(new ContainerBlockHandler());\n this.register(new LinkHandler());\n\n\n\n // Catch-all handler for any unregistered token types\n this.catchAll = new CatchAllHandler();\n }\n\n /** Register a handler. Overrides any existing handler for the same token type. */\n register(handler: TokenHandler): void {\n this.handlers.set(handler.type, handler);\n }\n\n /** Unregister a handler by token type. */\n unregister(type: string): void {\n this.handlers.delete(type);\n }\n\n /**\n * Get a handler for the given token type.\n * Falls back to the catch-all handler if no dedicated handler is registered.\n */\n get(type: string): TokenHandler {\n return this.handlers.get(type) ?? this.catchAll;\n }\n\n /** Check if a dedicated handler exists for the given token type (excludes catch-all). */\n has(type: string): boolean {\n return this.handlers.has(type);\n }\n\n /** Get all registered dedicated handler types. */\n get types(): string[] {\n return Array.from(this.handlers.keys());\n }\n\n /** Replace the catch-all handler with a custom implementation. */\n setCatchAll(handler: TokenHandler): void {\n this.catchAll = handler;\n }\n\n /** Get the current catch-all handler. */\n getCatchAll(): TokenHandler {\n return this.catchAll;\n }\n}\n","import { marked } from 'marked';\nimport { ContentNode, MarkdownContent, ParseOptions, defaultAllowedHTMLTags } from './types.js';\nimport { TokenHandlerRegistry, ParseContext } from './handlers/index.js';\n\nexport interface ParserOptions {\n imagePathPrefix?: string;\n imageBaseUrl?: string;\n preserveRawHTML?: boolean;\n slotPattern?: RegExp;\n onSlot?: (name: string) => string;\n errorRecovery?: 'throw' | 'warn' | 'silent';\n maxRecursionDepth?: number;\n allowedHTMLTags?: string[];\n /**\n * Allowed HTML attributes per tag for preserveRawHTML mode.\n * Key \"*\" applies to all tags. Key \"tag\" applies to specific tags.\n * Supports \"data-*\" wildcard prefix matching.\n */\n allowedAttributes?: Record<string, string[]>;\n /**\n * Callback invoked when a token type has no dedicated handler.\n\n * The catch-all handler will still produce a container node for the content,\n * but this callback allows callers to log, warn, or track unhandled types.\n *\n * @param type - The unhandled token type name (e.g. 'table', 'def')\n * @param token - The raw marked token\n */\n onUnhandledToken?: (type: string, token: Record<string, unknown>) => void;\n}\n\nconst DEFAULT_SLOT_PATTERN = /\\[\\[(.*?)\\]\\]/g;\n\n// Re-export handler types for convenience\nexport { TokenHandlerRegistry } from './handlers/index.js';\nexport type { TokenHandler, ParseContext } from './handlers/index.js';\n\n// ─── MarkdownParser ───────────────────────────────────────────────────────────\n\nexport class MarkdownParser {\n private imagePathPrefix: string;\n private imageBaseUrl: string;\n private preserveRawHTML: boolean;\n private slotPattern: RegExp;\n private onSlot: ((name: string) => string) | undefined;\n private errorRecovery: 'throw' | 'warn' | 'silent';\n private maxRecursionDepth: number;\n private allowedHTMLTags: Set<string>;\n private allowedAttributes: Record<string, string[]>;\n private handlerRegistry: TokenHandlerRegistry;\n private onUnhandledToken?: (type: string, token: Record<string, unknown>) => void;\n\n constructor(options?: ParserOptions) {\n this.imagePathPrefix = options?.imagePathPrefix || '';\n this.imageBaseUrl = options?.imageBaseUrl || '';\n this.preserveRawHTML = options?.preserveRawHTML ?? false;\n this.slotPattern = options?.slotPattern ?? DEFAULT_SLOT_PATTERN;\n this.onSlot = options?.onSlot;\n this.errorRecovery = options?.errorRecovery ?? 'throw';\n this.maxRecursionDepth = options?.maxRecursionDepth ?? 100;\n this.allowedHTMLTags = new Set([\n ...defaultAllowedHTMLTags,\n ...(options?.allowedHTMLTags ?? [])\n ]);\n this.allowedAttributes = options?.allowedAttributes ?? {};\n this.handlerRegistry = new TokenHandlerRegistry();\n this.onUnhandledToken = options?.onUnhandledToken;\n }\n\n\n /** Access the handler registry for customization. */\n get handlers(): TokenHandlerRegistry {\n return this.handlerRegistry;\n }\n\n private processImagePath(src: string): string {\n if (src.startsWith('http') || src.startsWith('/')) {\n return src;\n }\n let path = this.imagePathPrefix ? `${this.imagePathPrefix}${src}` : src;\n if (this.imageBaseUrl && !path.startsWith('http')) {\n path = `${this.imageBaseUrl}${path}`;\n }\n return path;\n }\n\n private processInlineFormatting(text: string): string {\n return text\n .replace(/\\*\\*(.+?)\\*\\*/g, '<strong>$1</strong>')\n .replace(/\\*(.+?)\\*/g, '<em>$1</em>');\n }\n\n private processSlots(text: string): string {\n if (!this.onSlot) return text;\n return text.replace(this.slotPattern, (match, name: string) => {\n return this.onSlot!(name.trim());\n });\n }\n\n /**\n * Check if an attribute name is allowed for a given tag.\n * Supports \"data-*\" wildcard prefix matching.\n */\n private isAttributeAllowed(tagName: string, attrName: string): boolean {\n const globalAllowed = this.allowedAttributes['*'];\n if (globalAllowed && this.matchesAttributeList(attrName, globalAllowed)) {\n return true;\n }\n const tagAllowed = this.allowedAttributes[tagName];\n if (tagAllowed && this.matchesAttributeList(attrName, tagAllowed)) {\n return true;\n }\n return false;\n }\n\n /**\n * Check if an attribute name matches a list of allowed patterns.\n * Supports \"data-*\" wildcard prefix matching.\n */\n private matchesAttributeList(attrName: string, allowed: string[]): boolean {\n const lower = attrName.toLowerCase();\n for (const pattern of allowed) {\n if (pattern.endsWith('-*')) {\n const prefix = pattern.slice(0, -1).toLowerCase();\n if (lower.startsWith(prefix)) return true;\n } else if (pattern.toLowerCase() === lower) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Filter attributes on an HTML tag, keeping only allowed ones.\n */\n private filterTagAttributes(tag: string): string {\n // Match opening tag: <tagname ...attrs...>\n const tagMatch = tag.match(/^<\\/?(\\w+)/);\n if (!tagMatch) return tag;\n const tagName = tagMatch[1].toLowerCase();\n\n // If no attribute rules defined, return as-is\n const hasRules = Object.keys(this.allowedAttributes).length > 0;\n if (!hasRules) return tag;\n\n // Extract all attributes from the tag\n const attrRegex = /(\\S+)\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|(\\S+))/g;\n const selfClosing = tag.endsWith('/>');\n\n // Get the tag opening part (e.g., <div or </div)\n const tagOpen = tagMatch[0];\n const remaining = tag.slice(tagOpen.length);\n\n // Rebuild the tag with only allowed attributes\n let filtered = tagOpen;\n let match: RegExpExecArray | null;\n while ((match = attrRegex.exec(remaining)) !== null) {\n const attrName = match[1];\n const attrValue = match[2] ?? match[3] ?? match[4] ?? '';\n if (this.isAttributeAllowed(tagName, attrName)) {\n filtered += ` ${attrName}=\"${attrValue.replace(/\"/g, '\"')}\"`;\n }\n }\n\n // Close the tag\n if (selfClosing) {\n filtered += ' /';\n }\n filtered += '>';\n\n return filtered;\n }\n\n private processRawHTML(html: string): string {\n if (!this.allowedHTMLTags.has('script')) {\n html = html.replace(/<script[\\s\\S]*?<\\/script>/gi, '');\n html = html.replace(/<\\/?script[^>]*>/gi, '');\n }\n if (!this.allowedHTMLTags.has('style')) {\n html = html.replace(/<style[\\s\\S]*?<\\/style>/gi, '');\n html = html.replace(/<\\/?style[^>]*>/gi, '');\n }\n\n // Filter attributes on all remaining HTML tags\n const hasAttrRules = Object.keys(this.allowedAttributes).length > 0;\n if (hasAttrRules) {\n html = html.replace(/<[^>]+>/g, (match) => this.filterTagAttributes(match));\n }\n\n return html;\n }\n\n\n /**\n * Build the ParseContext that is passed to every token handler.\n * This is the bridge between the parser's private services and the handlers.\n */\n private createContext(): ParseContext {\n const self = this;\n const metadata: Record<string, unknown> = {};\n return {\n get preserveRawHTML() { return self.preserveRawHTML; },\n get errorRecovery() { return self.errorRecovery; },\n get maxRecursionDepth() { return self.maxRecursionDepth; },\n processImagePath: (src: string) => self.processImagePath(src),\n processInlineFormatting: (text: string) => self.processInlineFormatting(text),\n processSlots: (text: string) => self.processSlots(text),\n processRawHTML: (html: string) => self.processRawHTML(html),\n parseTokens: (tokens: unknown[], depth: number) => self.parseTokens(tokens, depth),\n reportUnhandled: (type: string, token: Record<string, unknown>) => {\n self.onUnhandledToken?.(type, token);\n },\n metadata\n };\n }\n\n /**\n * Process an array of marked tokens into ContentNodes.\n * When depth === 0 (root), creates a shared context that accumulates metadata.\n * For recursive calls (depth > 0), creates a fresh context for each level.\n */\n private parseTokens(tokens: unknown[], depth: number = 0, sharedCtx?: ParseContext): ContentNode[] {\n if (depth > this.maxRecursionDepth) {\n const msg = `[md2html] Max recursion depth (${this.maxRecursionDepth}) exceeded, truncating`;\n if (this.errorRecovery === 'warn') {\n console.warn(msg);\n }\n return [];\n }\n\n const nodes: ContentNode[] = [];\n // Use shared context at root level (depth 0), create fresh for recursive calls\n const ctx = sharedCtx || this.createContext();\n\n for (const token of tokens) {\n const typedToken = token as Record<string, unknown>;\n // The registry automatically falls back to the catch-all handler\n const handler = this.handlerRegistry.get(typedToken.type as string);\n const node = handler.handle(typedToken, ctx);\n if (node) {\n nodes.push(node);\n }\n }\n\n return nodes;\n }\n\n /**\n * Pre-process markdown: convert `:::tag#id.class` container syntax\n * into HTML comment markers that marked will preserve as html tokens,\n * but won't affect markdown parsing of the inner content.\n *\n * Example:\n * :::section#header\n * # Heading inside container\n * Some text\n * :::\n *\n * Becomes:\n * <!-- md-container:section#header -->\n * # Heading inside container\n * Some text\n * <!-- /md-container -->\n */\n private preprocessContainerBlocks(markdown: string): string {\n // Match opening fence: :::tagname#id.class (at start of line)\n // Valid patterns: :::div, :::section#header, :::div.container, :::section#header.main\n return markdown.replace(/^:::(?:(\\w+(?:[.#][\\w-]+)*)\\s*)?$/gm, (match, specifier) => {\n if (!specifier) {\n // Closing fence :::\n return '<!-- /md-container -->';\n }\n // Normalize: if no tag name given, default to \"div\"\n const normalized = specifier.match(/^\\w/) ? specifier : `div${specifier}`;\n return `<!-- md-container:${normalized} -->`;\n });\n }\n\n /**\n * Post-process marked tokens to collapse container block markers\n * into structured containerBlock tokens with proper nesting.\n *\n * This handles nesting depth up to maxRecursionDepth.\n */\n private postprocessTokens(tokens: unknown[]): unknown[] {\n const result: unknown[] = [];\n const stack: { specifier: string; tokens: unknown[] }[] = [];\n let current = result;\n\n for (const token of tokens) {\n const t = token as Record<string, unknown>;\n\n // Detect container opening comment\n if (t.type === 'html') {\n const raw = (t.raw as string).trim();\n const openMatch = raw.match(/^<!--\\s*md-container:\\s*(\\S+)\\s*-->$/);\n const closeMatch = raw.match(/^<!--\\s*\\/md-container\\s*-->$/);\n\n\n if (openMatch) {\n // Start a new container\n const newContainer: { specifier: string; tokens: unknown[] } = {\n specifier: openMatch[1],\n tokens: []\n };\n stack.push(newContainer);\n continue;\n }\n\n if (closeMatch) {\n if (stack.length === 0) {\n // Unmatched closing fence — ignore\n continue;\n }\n const container = stack.pop()!;\n // Recursively process inner tokens for any nested containers\n const processedInner = this.postprocessTokens(container.tokens);\n const containerToken = {\n type: 'containerBlock',\n specifier: container.specifier,\n tokens: processedInner\n };\n\n if (stack.length > 0) {\n stack[stack.length - 1].tokens.push(containerToken);\n } else {\n result.push(containerToken);\n }\n continue;\n }\n }\n\n // Not a container marker — add to current context\n if (stack.length > 0) {\n stack[stack.length - 1].tokens.push(token);\n } else {\n result.push(token);\n }\n }\n\n return result;\n }\n\n parse(markdown: string, options?: ParseOptions): MarkdownContent {\n const parseOptions = {\n gfm: options?.gfm ?? true,\n breaks: options?.breaks ?? false,\n pedantic: options?.pedantic ?? false\n };\n\n try {\n // Step 1: Pre-process ::: container syntax into HTML comment markers\n const processed = this.preprocessContainerBlocks(markdown);\n\n // Step 2: Lex with marked (content between markers is parsed as normal markdown)\n const rawTokens = marked.lexer(processed, parseOptions as Parameters<typeof marked.lexer>[1]);\n\n // Step 3: Post-process to collapse comment markers into containerBlock tokens\n const tokens = this.postprocessTokens(rawTokens);\n\n // Create a shared context at root level so frontmatter metadata accumulates\n const ctx = this.createContext();\n const content = this.parseTokens(tokens, 0, ctx);\n\n return {\n title: '',\n metadata: { ...ctx.metadata },\n content\n };\n } catch (err) {\n if (this.errorRecovery === 'throw') throw err;\n\n const msg = `[md2html] Parse error: ${err instanceof Error ? err.message : String(err)}`;\n if (this.errorRecovery === 'warn') {\n console.warn(msg);\n }\n\n return {\n title: '',\n content: [{ type: 'text', content: markdown }]\n };\n }\n }\n\n\n parseToNodes(markdown: string, options?: ParseOptions): ContentNode[] {\n return this.parse(markdown, options).content;\n }\n}\n","import { ContentNode } from './types.js';\n\n/**\n * Strategy interface for rendering a specific ContentNode type to HTML.\n * This is the renderer-side equivalent of TokenHandler — each node type\n * gets its own strategy, eliminating the large switch statement.\n *\n * To add support for a new node type:\n * 1. Create a class implementing NodeRendererStrategy\n * 2. Register it with the RendererStrategyRegistry\n */\nexport interface NodeRendererStrategy {\n /** The node type this strategy handles */\n readonly type: string;\n /** Render a node of this type to an HTML string */\n render(node: ContentNode, renderChild: (child: ContentNode) => string, ctx: RenderContext): string;\n}\n\n/**\n * Context passed to every render strategy, providing access to\n * shared rendering services and configuration.\n */\nexport interface RenderContext {\n classPrefix: string;\n addHeadingIds: boolean;\n emitScopeAnchors: boolean;\n customCSS: string;\n getClass(baseClass: string, nodeClass?: string): string;\n getScopeAttr(node: ContentNode): string;\n generateHeadingId(content?: string): string;\n getContainerClass(tag: string): string;\n hasClassConfig(): boolean;\n}\n\n// ─── Heading Strategy ───────────────────────────────────────────────────\n\nexport class HeadingRendererStrategy implements NodeRendererStrategy {\n readonly type = 'heading';\n\n render(node: ContentNode, _renderChild: (child: ContentNode) => string, ctx: RenderContext): string {\n const level = (node.attributes?.level as string) || '2';\n const headingId = ctx.addHeadingIds \n ? ` id=\"${ctx.generateHeadingId(node.content)}\"` \n : '';\n const scopeAttr = ctx.getScopeAttr(node);\n\n if (!ctx.hasClassConfig()) {\n return `<h${level}${headingId}${scopeAttr}>${node.content || ''}</h${level}>`;\n }\n\n const prefix = ctx.classPrefix;\n const levelClass = level === '1' ? 'h1' : level === '2' ? 'h2' : level === '3' ? 'h3' : level === '4' ? 'h4' : level === '5' ? 'h5' : 'h6';\n const headingClass = prefix ? `${prefix}${levelClass}` : levelClass;\n return `<h${level}${headingId}${scopeAttr} class=\"${headingClass}\">${node.content || ''}</h${level}>`;\n }\n}\n\n// ─── Paragraph Strategy ─────────────────────────────────────────────────\n\nexport class ParagraphRendererStrategy implements NodeRendererStrategy {\n readonly type = 'paragraph';\n\n render(node: ContentNode, renderChild: (child: ContentNode) => string, ctx: RenderContext): string {\n const scopeAttr = ctx.getScopeAttr(node);\n if (node.children) {\n const childrenHtml = node.children.map(renderChild).join('');\n return ctx.hasClassConfig() && ctx.classPrefix\n ? `<p class=\"${ctx.classPrefix}paragraph\"${scopeAttr}>${childrenHtml}</p>`\n : `<p${scopeAttr}>${childrenHtml}</p>`;\n }\n return ctx.hasClassConfig() && ctx.classPrefix\n ? `<p class=\"${ctx.classPrefix}paragraph\"${scopeAttr}>${node.content || ''}</p>`\n : `<p${scopeAttr}>${node.content || ''}</p>`;\n }\n}\n\n// ─── List Strategy ──────────────────────────────────────────────────────\n\nexport class ListRendererStrategy implements NodeRendererStrategy {\n readonly type = 'list';\n\n render(node: ContentNode, renderChild: (child: ContentNode) => string, ctx: RenderContext): string {\n const tag = node.ordered ? 'ol' : 'ul';\n const items = node.children?.map(renderChild).join('') || '';\n const scopeAttr = ctx.getScopeAttr(node);\n return ctx.hasClassConfig() && ctx.classPrefix\n ? `<${tag} class=\"${ctx.classPrefix}list\"${scopeAttr}>${items}</${tag}>`\n : `<${tag}${scopeAttr}>${items}</${tag}>`;\n }\n}\n\n// ─── List Item Strategy ─────────────────────────────────────────────────\n\nexport class ListItemRendererStrategy implements NodeRendererStrategy {\n readonly type = 'list-item';\n\n render(node: ContentNode, _renderChild: (child: ContentNode) => string, ctx: RenderContext): string {\n const scopeAttr = ctx.getScopeAttr(node);\n return ctx.hasClassConfig() && ctx.classPrefix\n ? `<li class=\"${ctx.classPrefix}list-item\"${scopeAttr}>${node.content || ''}</li>`\n : `<li${scopeAttr}>${node.content || ''}</li>`;\n }\n}\n\n// ─── Image Strategy ─────────────────────────────────────────────────────\n\nexport class ImageRendererStrategy implements NodeRendererStrategy {\n readonly type = 'image';\n\n render(node: ContentNode, _renderChild: (child: ContentNode) => string, ctx: RenderContext): string {\n const src = node.src || (node.attributes?.src as string) || '';\n const alt = node.alt || (node.attributes?.alt as string) || '';\n const scopeAttr = ctx.getScopeAttr(node);\n let classStr = '';\n if (ctx.hasClassConfig()) {\n const prefix = ctx.classPrefix;\n classStr = prefix ? `${prefix}image` : 'image';\n if (node.className) classStr += ` ${node.className}`;\n return `<img src=\"${src}\" alt=\"${alt}\" class=\"${classStr}\"${scopeAttr}>`;\n }\n if (node.className) {\n return `<img src=\"${src}\" alt=\"${alt}\" class=\"${node.className}\"${scopeAttr}>`;\n }\n return `<img src=\"${src}\" alt=\"${alt}\"${scopeAttr}>`;\n }\n}\n\n// ─── Code Strategy ──────────────────────────────────────────────────────\n\nexport class CodeRendererStrategy implements NodeRendererStrategy {\n readonly type = 'code';\n\n render(node: ContentNode, _renderChild: (child: ContentNode) => string, ctx: RenderContext): string {\n const scopeAttr = ctx.getScopeAttr(node);\n const lang = (node.attributes?.lang as string) || '';\n if (ctx.hasClassConfig()) {\n const prefix = ctx.classPrefix;\n const codeClass = prefix ? `${prefix}code` : 'code';\n return `<pre${scopeAttr}><code class=\"${codeClass} language-${lang}\">${node.content || ''}</code></pre>`;\n }\n return `<pre${scopeAttr}><code class=\"language-${lang}\">${node.content || ''}</code></pre>`;\n }\n}\n\n// ─── Container Strategy ─────────────────────────────────────────────────\n\nexport class ContainerRendererStrategy implements NodeRendererStrategy {\n readonly type = 'container';\n\n render(node: ContentNode, renderChild: (child: ContentNode) => string, ctx: RenderContext): string {\n // If node has rawHTML, emit it directly (passthrough mode)\n if (node.rawHTML) {\n return node.rawHTML;\n }\n\n const tag = (node.attributes?.tag as string) || 'div';\n const children = node.children?.map(renderChild).join('') || '';\n const id = node.attributes?.id as string;\n const idAttr = id ? ` id=\"${id}\"` : '';\n const scopeAttr = ctx.getScopeAttr(node);\n\n // Self-closing tags\n if (tag === 'hr') return '<hr>';\n\n if (ctx.hasClassConfig()) {\n const containerClass = ctx.getContainerClass(tag);\n const prefix = ctx.classPrefix;\n // If we have a classPrefix, use prefixed tag name as class\n if (prefix) {\n const classes = [prefix + (containerClass || 'container')];\n if (node.className) classes.push(node.className);\n return `<${tag} class=\"${classes.join(' ')}\"${idAttr}${scopeAttr}>${children}</${tag}>`;\n }\n // No prefix, use the default container class\n const classes = [containerClass || 'container'];\n if (node.className) classes.push(node.className);\n return `<${tag} class=\"${classes.join(' ')}\"${idAttr}${scopeAttr}>${children}</${tag}>`;\n }\n\n // No class config at all\n if (node.className) {\n return `<${tag} class=\"${node.className}\"${idAttr}${scopeAttr}>${children}</${tag}>`;\n }\n return `<${tag}${idAttr}${scopeAttr}>${children}</${tag}>`;\n }\n}\n\n// ─── Strong Strategy ────────────────────────────────────────────────────\n\nexport class StrongRendererStrategy implements NodeRendererStrategy {\n readonly type = 'strong';\n\n render(node: ContentNode, _renderChild: (child: ContentNode) => string, ctx: RenderContext): string {\n return `<strong${ctx.getScopeAttr(node)}>${node.content || ''}</strong>`;\n }\n}\n\n// ─── Emphasis Strategy ──────────────────────────────────────────────────\n\nexport class EmphasisRendererStrategy implements NodeRendererStrategy {\n readonly type = 'emphasis';\n\n render(node: ContentNode, _renderChild: (child: ContentNode) => string, ctx: RenderContext): string {\n return `<em${ctx.getScopeAttr(node)}>${node.content || ''}</em>`;\n }\n}\n\n// ─── Link Strategy ──────────────────────────────────────────────────────\n\nexport class LinkRendererStrategy implements NodeRendererStrategy {\n readonly type = 'link';\n\n render(node: ContentNode, _renderChild: (child: ContentNode) => string, ctx: RenderContext): string {\n const href = node.attributes?.href || '';\n return `<a href=\"${href}\"${ctx.getScopeAttr(node)}>${node.content || ''}</a>`;\n }\n}\n\n// ─── Text Strategy (fallback) ───────────────────────────────────────────\n\nexport class TextRendererStrategy implements NodeRendererStrategy {\n readonly type = 'text';\n\n render(node: ContentNode, _renderChild: (child: ContentNode) => string, _ctx: RenderContext): string {\n return node.content || '';\n }\n}\n\n// ─── Registry ───────────────────────────────────────────────────────────\n\n/**\n * Registry of renderer strategies. Maps ContentNode types to their\n * rendering strategy. This is the renderer-side equivalent of\n * TokenHandlerRegistry.\n *\n * The registry uses a two-tier lookup:\n * 1. Check for a dedicated strategy by node type\n * 2. Fall back to the catch-all strategy (registered as '*')\n */\nexport class RendererStrategyRegistry {\n private strategies = new Map<string, NodeRendererStrategy>();\n private fallback: NodeRendererStrategy;\n\n constructor() {\n // Register all built-in strategies\n this.register(new HeadingRendererStrategy());\n this.register(new ParagraphRendererStrategy());\n this.register(new ListRendererStrategy());\n this.register(new ListItemRendererStrategy());\n this.register(new ImageRendererStrategy());\n this.register(new CodeRendererStrategy());\n this.register(new ContainerRendererStrategy());\n this.register(new StrongRendererStrategy());\n this.register(new EmphasisRendererStrategy());\n this.register(new LinkRendererStrategy());\n this.register(new TextRendererStrategy());\n\n // Fallback renders the content as plain text\n this.fallback = new TextRendererStrategy();\n }\n\n /** Register a strategy for a node type. Overrides any existing strategy. */\n register(strategy: NodeRendererStrategy): void {\n this.strategies.set(strategy.type, strategy);\n }\n\n /** Unregister a strategy by node type. */\n unregister(type: string): void {\n this.strategies.delete(type);\n }\n\n /** Get a strategy for the given node type, falling back to catch-all. */\n get(type: string): NodeRendererStrategy {\n return this.strategies.get(type) ?? this.fallback;\n }\n\n /** Check if a dedicated strategy exists for the given node type. */\n has(type: string): boolean {\n return this.strategies.has(type);\n }\n\n /** Get all registered dedicated strategy types. */\n get types(): string[] {\n return Array.from(this.strategies.keys());\n }\n\n /** Replace the fallback strategy. */\n setFallback(strategy: NodeRendererStrategy): void {\n this.fallback = strategy;\n }\n}\n","import { ContentNode, StyleConfigV2, nodeTypeToScope } from './types.js';\nimport { RendererStrategyRegistry, RenderContext } from './renderer-strategies.js';\n\nexport { RendererStrategyRegistry } from './renderer-strategies.js';\nexport type { NodeRendererStrategy, RenderContext } from './renderer-strategies.js';\n\nexport class HTMLRenderer {\n private config: Required<StyleConfigV2>;\n private strategyRegistry: RendererStrategyRegistry;\n\n constructor(config: StyleConfigV2 = {}) {\n this.config = {\n classPrefix: config.classPrefix || '',\n customCSS: config.customCSS || '',\n addHeadingIds: config.addHeadingIds ?? false,\n emitScopeAnchors: config.emitScopeAnchors ?? false\n };\n this.strategyRegistry = new RendererStrategyRegistry();\n }\n\n /** Access the strategy registry for customization. */\n get strategies(): RendererStrategyRegistry {\n return this.strategyRegistry;\n }\n\n private hasClassConfig(): boolean {\n return this.config.classPrefix !== '' || this.config.addHeadingIds;\n }\n\n private getClass(baseClass: string, nodeClass?: string): string {\n if (!this.hasClassConfig()) {\n return nodeClass || '';\n }\n const prefix = this.config.classPrefix;\n const classes = [prefix ? `${prefix}${baseClass}` : baseClass];\n if (nodeClass) classes.push(nodeClass);\n return classes.join(' ');\n }\n\n private generateHeadingId(content?: string): string {\n if (!content) return '';\n return content\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/(^-|-$)/g, '');\n }\n\n /**\n * Get the scope attribute string for a node type.\n * Returns empty string if emitScopeAnchors is disabled.\n */\n private getScopeAttr(node: ContentNode): string {\n if (!this.config.emitScopeAnchors) return '';\n const scopeValue = node.scope || nodeTypeToScope[node.type] || 'container';\n return ` data-md-scope=\"${scopeValue}\"`;\n }\n\n /**\n * Get the CSS class for a container's tag-based rendering.\n * Returns just the tag name since renderWithClass applies the prefix.\n */\n private getContainerClass(tag: string): string {\n if (!this.hasClassConfig()) return '';\n return tag;\n }\n\n private buildRenderContext(): RenderContext {\n const self = this;\n return {\n get classPrefix() { return self.config.classPrefix; },\n get addHeadingIds() { return self.config.addHeadingIds; },\n get emitScopeAnchors() { return self.config.emitScopeAnchors; },\n get customCSS() { return self.config.customCSS; },\n hasClassConfig: () => self.hasClassConfig(),\n getClass: (baseClass: string, nodeClass?: string) => self.getClass(baseClass, nodeClass),\n getScopeAttr: (node: ContentNode) => self.getScopeAttr(node),\n generateHeadingId: (content?: string) => self.generateHeadingId(content),\n getContainerClass: (tag: string) => self.getContainerClass(tag)\n };\n }\n\n renderNode(node: ContentNode): string {\n const ctx = this.buildRenderContext();\n const strategy = this.strategyRegistry.get(node.type);\n return strategy.render(node, (child) => this.renderNode(child), ctx);\n }\n\n renderNodes(nodes: ContentNode[]): string {\n if (!nodes || nodes.length === 0) {\n return '';\n }\n // Wrap in scope root if emitScopeAnchors is enabled\n if (this.config.emitScopeAnchors) {\n const inner = nodes.map(node => this.renderNode(node)).join('\\n');\n return `<div data-md-scope=\"root\">\\n${inner}\\n</div>`;\n }\n return nodes.map(node => this.renderNode(node)).join('\\n');\n }\n\n renderToHTMLString(nodes: ContentNode[]): string {\n return this.renderNodes(nodes);\n }\n\n render(markdown: string): string {\n return markdown;\n }\n\n getCustomCSS(): string {\n return this.config.customCSS;\n }\n}\n","import { MarkdownParser } from './parser.js';\nimport { HTMLRenderer } from './renderer.js';\nimport { ContentNode, MarkdownContent, PipelineConfigV2 } from './types.js';\n\ntype NormalizedPipelineConfig = Required<Omit<PipelineConfigV2, 'onSlot' | 'slotPattern'>> & {\n onSlot?: (name: string) => string;\n slotPattern: RegExp;\n};\n\nexport class MarkdownPipeline {\n private parser: MarkdownParser;\n private renderer: HTMLRenderer;\n private config: NormalizedPipelineConfig;\n\n constructor(config: PipelineConfigV2 = {}) {\n this.config = {\n imagePathPrefix: config.imagePathPrefix || '',\n imageBaseUrl: config.imageBaseUrl || '',\n parseOptions: {\n gfm: config.parseOptions?.gfm ?? true,\n breaks: config.parseOptions?.breaks ?? false,\n pedantic: config.parseOptions?.pedantic ?? false\n },\n styleOptions: {\n classPrefix: config.styleOptions?.classPrefix || '',\n customCSS: config.styleOptions?.customCSS || '',\n addHeadingIds: config.styleOptions?.addHeadingIds ?? false,\n emitScopeAnchors: config.styleOptions?.emitScopeAnchors ?? false\n },\n preserveRawHTML: config.preserveRawHTML ?? false,\n slotPattern: config.slotPattern ?? /\\[\\[(.*?)\\]\\]/g,\n onSlot: config.onSlot,\n errorRecovery: config.errorRecovery ?? 'throw',\n maxRecursionDepth: config.maxRecursionDepth ?? 100,\n allowedHTMLTags: config.allowedHTMLTags ?? [],\n allowedAttributes: config.allowedAttributes ?? {}\n };\n\n\n this.parser = new MarkdownParser({\n imagePathPrefix: this.config.imagePathPrefix,\n imageBaseUrl: this.config.imageBaseUrl,\n preserveRawHTML: this.config.preserveRawHTML,\n slotPattern: this.config.slotPattern,\n onSlot: this.config.onSlot,\n errorRecovery: this.config.errorRecovery,\n maxRecursionDepth: this.config.maxRecursionDepth,\n allowedHTMLTags: this.config.allowedHTMLTags,\n allowedAttributes: this.config.allowedAttributes\n });\n\n this.renderer = new HTMLRenderer(this.config.styleOptions);\n }\n\n parse(markdown: string): ContentNode[] {\n return this.parser.parseToNodes(markdown, this.config.parseOptions);\n }\n\n parseWithMetadata(markdown: string): MarkdownContent {\n return this.parser.parse(markdown, this.config.parseOptions);\n }\n\n render(nodes: ContentNode[]): string {\n return this.renderer.renderNodes(nodes);\n }\n\n renderMarkdown(markdown: string): string {\n const nodes = this.parse(markdown);\n return this.render(nodes);\n }\n\n renderPage(title: string, nodes: ContentNode[], options?: {\n lang?: string;\n charset?: string;\n }): string {\n const html = this.render(nodes);\n return `<!DOCTYPE html>\n<html lang=\"${options?.lang || 'en'}\">\n<head>\n <meta charset=\"${options?.charset || 'UTF-8'}\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>${title}</title>\n</head>\n<body>\n ${html}\n</body>\n</html>`;\n }\n\n getConfig(): Readonly<PipelineConfigV2> {\n return { ...this.config };\n }\n\n getCustomCSS(): string {\n return this.renderer.getCustomCSS();\n }\n}\n","import { ContentNode } from './types.js';\n\n/**\n * Visitor interface for traversing/walking a ContentNode AST.\n *\n * Implement this interface to inspect, collect, or transform nodes.\n * Each method returns a ContentNode or null — returning null removes the node.\n *\n * Use cases:\n * - Collect all images for preloading\n * - Transform link URLs\n * - Validate AST structure\n * - Extract headings for ToC\n * - Inject attributes\n */\nexport interface NodeVisitor {\n /** Called when entering a node, before visiting its children. */\n enter?(node: ContentNode, parent: ContentNode | null, depth: number): ContentNode | null;\n /** Called after visiting all children of the node. */\n exit?(node: ContentNode, parent: ContentNode | null, depth: number): ContentNode | null;\n}\n\n/**\n * Walk a ContentNode tree, applying a visitor at each node.\n * Returns a new tree (immutable) — does not mutate the original.\n */\nexport function walkTree(root: ContentNode, visitor: NodeVisitor): ContentNode {\n return walkNode(root, null, 0, visitor);\n}\n\nfunction walkNode(\n node: ContentNode,\n parent: ContentNode | null,\n depth: number,\n visitor: NodeVisitor\n): ContentNode {\n // Enter phase\n let processed = visitor.enter ? visitor.enter(node, parent, depth) : node;\n if (processed === null) return null as unknown as ContentNode;\n\n // Recursively walk children\n if (processed.children && processed.children.length > 0) {\n processed = {\n ...processed,\n children: processed.children\n .map(child => walkNode(child, processed, depth + 1, visitor))\n .filter(Boolean) as ContentNode[]\n };\n }\n\n // Exit phase\n processed = visitor.exit ? visitor.exit(processed, parent, depth) : processed;\n if (processed === null) return null as unknown as ContentNode;\n\n return processed;\n}\n\n/**\n * Walk a ContentNode tree and collect results from the visitor.\n * The collector function is called for each node and returns a value or null.\n */\nexport function collectFromTree<T>(\n root: ContentNode,\n collector: (node: ContentNode, parent: ContentNode | null, depth: number) => T | null\n): T[] {\n const results: T[] = [];\n collectNode(root, null, 0, collector, results);\n return results;\n}\n\nfunction collectNode<T>(\n node: ContentNode,\n parent: ContentNode | null,\n depth: number,\n collector: (node: ContentNode, parent: ContentNode | null, depth: number) => T | null,\n results: T[]\n): void {\n const result = collector(node, parent, depth);\n if (result !== null) {\n results.push(result);\n }\n if (node.children) {\n for (const child of node.children) {\n collectNode(child, node, depth + 1, collector, results);\n }\n }\n}\n\n/**\n * Built-in visitor: collect all nodes of a specific type.\n */\nexport function collectByType(root: ContentNode, type: string): ContentNode[] {\n return collectFromTree(root, (node) => \n node.type === type ? node : null\n );\n}\n\n/**\n * Built-in visitor: collect all headings with their levels.\n */\nexport function collectHeadings(root: ContentNode): Array<{ level: string; text: string; id?: string }> {\n return collectFromTree(root, (node) => {\n if (node.type === 'heading') {\n return {\n level: (node.attributes?.level as string) || '2',\n text: node.content || '',\n id: node.attributes?.id as string | undefined\n };\n }\n return null;\n });\n}\n\n/**\n * Built-in visitor: collect all images with their src/alt.\n */\nexport function collectImages(root: ContentNode): Array<{ src: string; alt: string }> {\n return collectFromTree(root, (node) => {\n if (node.type === 'image') {\n return { src: node.src || '', alt: node.alt || '' };\n }\n return null;\n });\n}\n","import { ContentNode } from './types.js';\n\n/**\n * ContentNode factory — a builder API for creating ContentNode instances\n * consistently across the codebase. Eliminates scattered object literals\n * and provides type-safe construction with sensible defaults.\n *\n * Usage:\n * NodeFactory.heading('Hello', { level: '1' })\n * NodeFactory.paragraph('Some text')\n * NodeFactory.container({ tag: 'section', id: 'main' }, [children...])\n */\nexport class NodeFactory {\n static heading(content: string, attributes?: Record<string, unknown>): ContentNode {\n return {\n type: 'heading',\n content,\n attributes: { level: attributes?.level || '2', ...attributes }\n };\n }\n\n static paragraph(\n contentOrChildren: string | ContentNode[],\n children?: ContentNode[]\n ): ContentNode {\n if (typeof contentOrChildren === 'string') {\n return { type: 'paragraph', content: contentOrChildren };\n }\n return { type: 'paragraph', children: contentOrChildren ?? children };\n }\n\n static list(\n items: ContentNode[],\n ordered?: boolean,\n attributes?: Record<string, unknown>\n ): ContentNode {\n return {\n type: 'list',\n ordered: ordered ?? false,\n children: items,\n ...(attributes ? { attributes } : {})\n };\n }\n\n static listItem(content: string): ContentNode {\n return { type: 'list-item', content };\n }\n\n static image(src: string, alt?: string, className?: string): ContentNode {\n return { type: 'image', src, alt: alt || '', ...(className ? { className } : {}) };\n }\n\n static code(content: string, lang?: string): ContentNode {\n return {\n type: 'code',\n content,\n attributes: { lang: lang || '' }\n };\n }\n\n static container(\n children?: ContentNode[],\n config?: {\n tag?: string;\n id?: string;\n className?: string;\n rawHTML?: string;\n scope?: string;\n }\n ): ContentNode {\n const node: ContentNode = { type: 'container' };\n if (children && children.length > 0) node.children = children;\n if (config?.rawHTML) node.rawHTML = config.rawHTML;\n if (config?.scope) node.scope = config.scope;\n\n const attrs: Record<string, unknown> = {};\n if (config?.tag) attrs.tag = config.tag;\n if (config?.id) attrs.id = config.id;\n if (Object.keys(attrs).length > 0) node.attributes = attrs;\n if (config?.className) node.className = config.className;\n\n return node;\n }\n\n static text(content: string): ContentNode {\n return { type: 'text', content };\n }\n\n static strong(content: string): ContentNode {\n return { type: 'strong', content };\n }\n\n static emphasis(content: string): ContentNode {\n return { type: 'emphasis', content };\n }\n\n static link(href: string, content: string): ContentNode {\n return { type: 'link', content, attributes: { href } };\n }\n}\n"],"names":["classes"],"mappings":";AAyFO,MAAM,yBAAyB;AAAA,EACpC;AAAA,EAAO;AAAA,EAAS;AAAA,EAAO;AAAA,EAAQ;AAAA,EAAW;AAAA,EAC1C;AAAA,EAAS;AAAA,EAAU;AAAA,EAAU;AAAA,EAAO;AAAA,EAAQ;AAAA,EAC5C;AAAA,EAAc;AAAA,EAAW;AAAA,EAAW;AAAA,EAAQ;AAAA,EAC5C;AAAA,EAAS;AAAA,EAAS;AAAA,EAAU;AAAA,EAAU;AACxC;AAiBO,MAAM,kBAAuD;AAAA,EAClE,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,QAAQ;AACV;ACtHO,MAAM,eAAuC;AAAA,EAA7C,cAAA;AACL,SAAS,OAAO;AAAA,EAAA;AAAA,EAEhB,OAAO,OAAgC,KAAmB;AACxD,WAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS,IAAI,aAAa,MAAM,IAAc;AAAA,MAC9C,YAAY,EAAE,OAAO,OAAO,MAAM,KAAK,EAAA;AAAA,IAAE;AAAA,EAE7C;AACF;ACTO,MAAM,iBAAyC;AAAA,EAA/C,cAAA;AACL,SAAS,OAAO;AAAA,EAAA;AAAA,EAEhB,OAAO,OAAgC,KA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EA,OAAO,UACL,UACA,QAOa;AACb,UAAM,OAAoB,EAAE,MAAM,YAAA;AAClC,QAAI,YAAY,SAAS,SAAS,QAAQ,WAAW;AACrD,QAAI,QAAQ,QAAS,MAAK,UAAU,OAAO;AAC3C,QAAI,QAAQ,MAAO,MAAK,QAAQ,OAAO;AAEvC,UAAM,QAAiC,CAAA;AACvC,QAAI,QAAQ,IAAK,OAAM,MAAM,OAAO;AACpC,QAAI,QAAQ,GAAI,OAAM,KAAK,OAAO;AAClC,QAAI,OAAO,KAAK,KAAK,EAAE,SAAS,QAAQ,aAAa;AACrD,QAAI,QAAQ,UAAW,MAAK,YAAY,OAAO;AAE/C,WAAO;AAAA,EACT;AAAA,EAEA,OAAO,KAAK,SAA8B;AACxC,WAAO,EAAE,MAAM,QAAQ,QAAA;AAAA,EACzB;AAAA,EAEA,OAAO,OAAO,SAA8B;AAC1C,WAAO,EAAE,MAAM,UAAU,QAAA;AAAA,EAC3B;AAAA,EAEA,OAAO,SAAS,SAA8B;AAC5C,WAAO,EAAE,MAAM,YAAY,QAAA;AAAA,EAC7B;AAAA,EAEA,OAAO,KAAK,MAAc,SAA8B;AACtD,WAAO,EAAE,MAAM,QAAQ,SAAS,YAAY,EAAE,OAAK;AAAA,EACrD;AACF;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/handlers/heading-handler.ts","../src/handlers/paragraph-handler.ts","../src/handlers/list-handler.ts","../src/handlers/image-handler.ts","../src/handlers/code-handler.ts","../src/handlers/hr-handler.ts","../src/handlers/blockquote-handler.ts","../src/handlers/html-handler.ts","../src/handlers/link-handler.ts","../src/handlers/catchall-handler.ts","../src/handlers/frontmatter-handler.ts","../src/handlers/container-block-handler.ts","../src/handlers/registry.ts","../node_modules/@leadertechie/telemetry/dist/telemetry.js","../src/telemetry-init.ts","../src/context-factory.ts","../src/preprocessor.ts","../src/token-postprocessor.ts","../src/parser.ts","../src/pipeline.ts","../src/visitor.ts","../src/factory.ts"],"sourcesContent":["import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'heading' tokens (h1-h6).\n */\nexport class HeadingHandler implements TokenHandler {\n readonly type = 'heading';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n return {\n type: 'heading' as const,\n content: ctx.processSlots(token.text as string),\n attributes: { level: String(token.depth) }\n };\n }\n}\n","import { ContentNode } from '../types.js';\nimport { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'paragraph' tokens, including inline images, links, and raw HTML.\n */\nexport class ParagraphHandler implements TokenHandler {\n readonly type = 'paragraph';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n const tokens = (token.tokens as Array<Record<string, unknown>>) || [];\n const hasInlineImage = tokens.some(t => t.type === 'image');\n const hasInlineLink = tokens.some(t => t.type === 'link');\n const hasInlineHTML = tokens.some(t => t.type === 'html');\n\n if (hasInlineImage || hasInlineLink || (ctx.preserveRawHTML && hasInlineHTML)) {\n const children = tokens.map(t => {\n if (t.type === 'image') {\n return {\n type: 'image' as const,\n src: ctx.processImagePath(t.href as string),\n alt: t.text as string || ''\n };\n }\n if (t.type === 'link') {\n return {\n type: 'link' as const,\n content: ctx.processSlots(ctx.processInlineFormatting(t.text as string || '')),\n attributes: {\n href: t.href as string || '',\n ...(t.title ? { title: t.title as string } : {})\n }\n };\n }\n if (t.type === 'html' && ctx.preserveRawHTML) {\n const processed = ctx.processRawHTML(t.raw as string);\n if (processed.trim()) {\n return { type: 'text' as const, content: processed };\n }\n return null;\n }\n return {\n type: 'text' as const,\n content: ctx.processSlots(ctx.processInlineFormatting(t.text as string || ''))\n };\n }).filter(Boolean) as ContentNode[];\n\n\n if (children.length === 0) return null;\n\n return { type: 'paragraph' as const, children };\n }\n\n return {\n type: 'paragraph' as const,\n content: ctx.processSlots(ctx.processInlineFormatting(token.text as string))\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'list' tokens (ordered and unordered).\n */\nexport class ListHandler implements TokenHandler {\n readonly type = 'list';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n return {\n type: 'list' as const,\n ordered: token.ordered as boolean,\n children: (token.items as Array<Record<string, unknown>>).map((item) => ({\n type: 'list-item' as const,\n content: ctx.processSlots(ctx.processInlineFormatting(item.text as string))\n }))\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles standalone 'image' tokens.\n */\nexport class ImageHandler implements TokenHandler {\n readonly type = 'image';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n return {\n type: 'image' as const,\n src: ctx.processImagePath(token.href as string),\n alt: token.title as string || ''\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'code' tokens (fenced code blocks).\n */\nexport class CodeHandler implements TokenHandler {\n readonly type = 'code';\n\n handle(token: Record<string, unknown>, _ctx: ParseContext) {\n return {\n type: 'code' as const,\n content: token.text as string,\n attributes: { lang: token.lang as string || '' }\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'hr' tokens (horizontal rules).\n */\nexport class HrHandler implements TokenHandler {\n readonly type = 'hr';\n\n handle(_token: Record<string, unknown>, _ctx: ParseContext) {\n return { type: 'container' as const, attributes: { tag: 'hr' } };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'blockquote' tokens.\n */\nexport class BlockquoteHandler implements TokenHandler {\n readonly type = 'blockquote';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n return {\n type: 'container' as const,\n attributes: { tag: 'blockquote' },\n children: ctx.parseTokens((token.tokens as unknown[]) || [], ctx.maxRecursionDepth + 1)\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles 'html' tokens (inline or block-level raw HTML).\n * In preserveRawHTML mode, passes through allowed HTML tags.\n * Otherwise, stores the raw content as a container node.\n */\nexport class HtmlHandler implements TokenHandler {\n readonly type = 'html';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n if (ctx.preserveRawHTML) {\n const raw = token.raw as string;\n const processed = ctx.processRawHTML(raw);\n if (processed.trim()) {\n return { type: 'container' as const, rawHTML: processed };\n }\n return null;\n }\n return { type: 'container' as const, content: token.raw as string };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Handles standalone 'link' tokens (e.g., reference-style links, or links\n * that appear outside paragraphs in certain edge cases).\n */\nexport class LinkHandler implements TokenHandler {\n readonly type = 'link';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n const text = token.text as string || '';\n const href = token.href as string || '';\n const title = token.title as string || '';\n\n return {\n type: 'link' as const,\n content: ctx.processSlots(ctx.processInlineFormatting(text)),\n attributes: {\n href,\n ...(title ? { title } : {})\n }\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * Catch-all handler for any token type that doesn't have a dedicated handler.\n * Wraps the raw token content in a container node so content is never silently lost.\n * Reports the unhandled type via the context's reportUnhandled callback.\n */\nexport class CatchAllHandler implements TokenHandler {\n readonly type = '*';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n const tokenType = token.type as string;\n\n // Report the unhandled token so callers can be notified\n ctx.reportUnhandled(tokenType, token);\n\n // Try to extract meaningful content from the raw token\n const raw = token.raw as string | undefined;\n const text = token.text as string | undefined;\n const content = raw || text || `[unhandled: ${tokenType}]`;\n\n return {\n type: 'container' as const,\n content,\n attributes: {\n 'data-unhandled': tokenType,\n tag: 'div'\n }\n };\n }\n}\n","import { TokenHandler, ParseContext } from './types.js';\n\n/**\n * FrontmatterHandler — consumes YAML-ish frontmatter tokens produced by marked.lexer().\n * Parses the raw YAML and stores key-value pairs onto ctx.metadata.\n * Returns null so no HTML is emitted for frontmatter blocks.\n *\n * Handles both formats:\n * key: value\n * key:\n * - item1\n * - item2\n */\nexport class FrontmatterHandler implements TokenHandler {\n readonly type = 'frontmatter';\n\n handle(token: Record<string, unknown>, ctx: ParseContext) {\n const raw = (token.raw as string) || '';\n\n // Normalize line endings\n const lines = raw.split('\\n');\n const parsed: Record<string, unknown> = {};\n\n let currentKey: string | null = null;\n let currentArray: string[] = [];\n\n for (const line of lines) {\n // Detect dashed list item (indented with `- `)\n const listMatch = line.match(/^\\s+-\\s+(.+)$/);\n if (listMatch && currentKey) {\n currentArray.push(listMatch[1].trim());\n continue;\n }\n\n // If we were building an array, flush it\n if (currentKey && currentArray.length > 0) {\n parsed[currentKey] = [...currentArray];\n currentArray = [];\n currentKey = null;\n }\n\n // Detect key: value or key:\n const keyMatch = line.match(/^(\\w[\\w_-]*)\\s*:\\s*(.*)$/);\n if (keyMatch) {\n currentKey = keyMatch[1];\n const val = keyMatch[2].trim();\n\n if (val === '') {\n // List follows — continue\n continue;\n } else if (val.startsWith('[') && val.endsWith(']')) {\n // Inline array: [a, b, c]\n parsed[currentKey] = val.slice(1, -1).split(',').map(s => s.trim().replace(/^[\"']|[\"']$/g, ''));\n currentKey = null;\n } else {\n parsed[currentKey] = val.replace(/^[\"']|[\"']$/g, '');\n currentKey = null;\n }\n }\n }\n\n // Flush any remaining array\n if (currentKey && currentArray.length > 0) {\n parsed[currentKey] = [...currentArray];\n }\n\n // Merge parsed metadata into the shared context metadata\n if (ctx.metadata) {\n Object.assign(ctx.metadata, parsed);\n }\n\n // Return null — frontmatter produces no HTML\n return null;\n }\n}\n","import { ContentNode } from '../types.js';\nimport { TokenHandler, ParseContext } from './types.js';\n\n/**\n * ContainerBlockHandler — handles custom :::tag#id.class container blocks.\n *\n * These are produced by the MarkdownParser's preprocessor which converts\n * the ::: syntax into marked tokens before lexing, then reconstructs\n * containerBlock tokens after lexing.\n *\n * The handler parses the specifier (e.g. \"section#header.content\") into\n * tag name, id, and class(es), then recursively parses the inner tokens\n * as normal markdown content, producing a container node with the\n * specified HTML wrapper.\n */\nexport class ContainerBlockHandler implements TokenHandler {\n readonly type = 'containerBlock';\n\n handle(token: Record<string, unknown>, ctx: ParseContext): ContentNode | null {\n const specifier = token.specifier as string;\n const childTokens = token.tokens as unknown[];\n\n if (!specifier) return null;\n\n // Parse specifier: tag#id.class (any order, all optional except tag)\n const tagMatch = specifier.match(/^(\\w+)/);\n const idMatch = specifier.match(/#([\\w-]+)/);\n const classMatches = [...specifier.matchAll(/\\.([\\w-]+)/g)];\n\n const tag = tagMatch?.[1] || 'div';\n const id = idMatch?.[1] || '';\n const classes = classMatches.map(m => m[1]);\n\n // Recursively parse inner tokens as markdown\n const children = ctx.parseTokens(childTokens, 0);\n\n return {\n type: 'container' as const,\n children,\n attributes: {\n tag,\n id: id || undefined,\n },\n className: classes.length > 0 ? classes.join(' ') : undefined,\n };\n }\n}\n","import type { TokenHandler } from './types.js';\nimport { HeadingHandler } from './heading-handler.js';\nimport { ParagraphHandler } from './paragraph-handler.js';\nimport { ListHandler } from './list-handler.js';\nimport { ImageHandler } from './image-handler.js';\nimport { CodeHandler } from './code-handler.js';\nimport { HrHandler } from './hr-handler.js';\nimport { BlockquoteHandler } from './blockquote-handler.js';\nimport { HtmlHandler } from './html-handler.js';\nimport { LinkHandler } from './link-handler.js';\nimport { CatchAllHandler } from './catchall-handler.js';\n\nimport { FrontmatterHandler } from './frontmatter-handler.js';\nimport { ContainerBlockHandler } from './container-block-handler.js';\n\n\n/**\n * Registry of token handlers. Handlers can be added/overridden externally\n * to extend the parser without modifying its internals.\n *\n * The registry uses a two-tier lookup:\n * 1. First, check for a dedicated handler by token type name\n * 2. If none found, fall back to the catch-all handler (registered as '*')\n *\n * The catch-all handler ensures no content is silently lost — unhandled\n * token types are wrapped in a container node with `data-unhandled` attribute.\n */\nexport class TokenHandlerRegistry {\n private handlers = new Map<string, TokenHandler>();\n private catchAll: TokenHandler;\n\n constructor() {\n // Register all built-in handlers\n this.register(new HeadingHandler());\n this.register(new ParagraphHandler());\n this.register(new ListHandler());\n this.register(new ImageHandler());\n this.register(new CodeHandler());\n this.register(new HrHandler());\n this.register(new BlockquoteHandler());\n this.register(new HtmlHandler());\n this.register(new FrontmatterHandler());\n this.register(new ContainerBlockHandler());\n this.register(new LinkHandler());\n\n\n\n // Catch-all handler for any unregistered token types\n this.catchAll = new CatchAllHandler();\n }\n\n /** Register a handler. Overrides any existing handler for the same token type. */\n register(handler: TokenHandler): void {\n this.handlers.set(handler.type, handler);\n }\n\n /** Unregister a handler by token type. */\n unregister(type: string): void {\n this.handlers.delete(type);\n }\n\n /**\n * Get a handler for the given token type.\n * Falls back to the catch-all handler if no dedicated handler is registered.\n */\n get(type: string): TokenHandler {\n return this.handlers.get(type) ?? this.catchAll;\n }\n\n /** Check if a dedicated handler exists for the given token type (excludes catch-all). */\n has(type: string): boolean {\n return this.handlers.has(type);\n }\n\n /** Get all registered dedicated handler types. */\n get types(): string[] {\n return Array.from(this.handlers.keys());\n }\n\n /** Replace the catch-all handler with a custom implementation. */\n setCatchAll(handler: TokenHandler): void {\n this.catchAll = handler;\n }\n\n /** Get the current catch-all handler. */\n getCatchAll(): TokenHandler {\n return this.catchAll;\n }\n}\n","var h = /* @__PURE__ */ ((t) => (t[t.DEBUG = 1] = \"DEBUG\", t[t.INFO = 9] = \"INFO\", t[t.WARN = 13] = \"WARN\", t[t.ERROR = 17] = \"ERROR\", t))(h || {});\nconst S = {\n 1: \"DEBUG\",\n 9: \"INFO\",\n 13: \"WARN\",\n 17: \"ERROR\"\n}, E = [\n \"/telemetry/src/logger.ts\",\n \"/telemetry/src/caller.ts\",\n \"/telemetry/src/index.ts\"\n];\nfunction N() {\n const e = new Error().stack;\n if (!e) return;\n const s = e.split(`\n`);\n for (let r = 1; r < s.length; r++) {\n const o = s[r].trim(), n = $(o);\n if (!n) continue;\n const { file: l } = n;\n if (!(l && E.some((m) => l.includes(m))) && !(l && l.includes(\"/node_modules/\")) && l)\n return n;\n }\n}\nfunction $(t) {\n const e = t.match(\n /at\\s+(?:(?:async\\s+)?(?:(.+?)\\s+\\()?)?(?:(.+?):(\\d+):(\\d+)\\)?)$/\n );\n if (!e) return null;\n const s = e[1] || \"<anonymous>\", r = e[2], o = parseInt(e[3], 10), n = parseInt(e[4], 10);\n return r ? { file: r, line: o, column: n, functionName: s } : null;\n}\nclass g {\n constructor(e = [], s, r = {}) {\n this.processors = [...e], this.resource = s ?? { serviceName: \"unknown\" }, this.baseAttributes = { ...r };\n }\n // ── Public API ───────────────────────────────────────────────────────────\n debug(e, s) {\n this.emit(h.DEBUG, e, void 0, s);\n }\n info(e, s) {\n this.emit(h.INFO, e, void 0, s);\n }\n warn(e, s) {\n this.emit(h.WARN, e, void 0, s);\n }\n error(e, s, r) {\n this.emit(h.ERROR, e, s, r);\n }\n /**\n * Create a child logger with merged base attributes.\n * Returns a NEW Logger — original is immutable.\n */\n withContext(e) {\n return new g(this.processors, this.resource, {\n ...this.baseAttributes,\n ...e\n });\n }\n /**\n * Append a processor to the pipeline.\n * Returns a NEW Logger — original is immutable.\n */\n withProcessor(e) {\n return new g(\n [...this.processors, e],\n this.resource,\n this.baseAttributes\n );\n }\n /**\n * Force-flush all pending records in all processors.\n * Await before the end of a CF Worker request (inside ctx.waitUntil).\n */\n async flush() {\n await Promise.all(this.processors.map((e) => e.forceFlush()));\n }\n /**\n * Shutdown: flush + release resources. No logging after shutdown.\n */\n async shutdown() {\n await this.flush(), await Promise.all(this.processors.map((e) => e.shutdown()));\n }\n // ── Internal ────────────────────────────────────────────────────────────\n emit(e, s, r, o) {\n if (this.processors.length === 0) return;\n const n = (/* @__PURE__ */ new Date()).toISOString(), l = {\n severityNumber: e,\n severityText: S[e],\n body: s,\n timestamp: n,\n observedTimestamp: n,\n attributes: { ...this.baseAttributes, ...o },\n caller: N(),\n ...r ? { error: r } : {},\n resource: { ...this.resource }\n };\n for (const m of this.processors)\n try {\n m.onEmit(l);\n } catch (f) {\n console.error(\n \"[telemetry] Processor threw in onEmit:\",\n f\n );\n }\n }\n}\nclass T {\n constructor(e) {\n this.shutdownFlag = !1, this.pendingExport = Promise.resolve(), this.adapter = e;\n }\n onEmit(e) {\n this.shutdownFlag || (this.pendingExport = this.pendingExport.then(() => this.adapter.export([e])).catch((s) => {\n console.error(\n `[telemetry] SimpleLogProcessor: adapter \"${this.adapter.name}\" export failed:`,\n s\n );\n }));\n }\n async forceFlush() {\n await this.pendingExport;\n }\n async shutdown() {\n this.shutdownFlag = !0, await this.forceFlush(), await this.adapter.shutdown?.();\n }\n}\nclass M {\n constructor(e) {\n this.processors = [], this.resource = {\n serviceName: e?.serviceName ?? \"unknown\",\n environment: e?.environment,\n version: e?.version,\n processName: e?.processName\n };\n }\n /**\n * Register an adapter via a SimpleLogProcessor (immediate export).\n * For batching, use addProcessor(new BatchLogProcessor(adapter, opts)).\n */\n addAdapter(e) {\n return this.addProcessor(new T(e));\n }\n /**\n * Register a custom processor (SimpleLogProcessor, BatchLogProcessor,\n * or your own implementation).\n */\n addProcessor(e) {\n return this.processors.push(e), this;\n }\n /**\n * Get a named Logger instance.\n * The logger inherits the provider's resource and processors.\n * Optionally provide initial context attributes.\n */\n getLogger(e, s) {\n const r = {\n ...this.resource,\n ...e ? { processName: e } : {}\n };\n return new g(this.processors, r, s);\n }\n /**\n * Force-flush all registered processors.\n */\n async flush() {\n await Promise.all(this.processors.map((e) => e.forceFlush()));\n }\n /**\n * Shutdown: flush + release all processor resources.\n */\n async shutdown() {\n await this.flush(), await Promise.all(this.processors.map((e) => e.shutdown()));\n }\n}\nfunction U(t) {\n const e = t?.level ?? h.DEBUG, s = t?.json ?? !1;\n return {\n name: \"console\",\n async export(r) {\n for (const o of r)\n o.severityNumber < e || (s ? I(o) : R(o));\n }\n };\n}\nfunction R(t) {\n const e = F(t.severityNumber), s = t.timestamp, r = t.severityText, o = t.caller ? ` (${t.caller.file}:${t.caller.line})` : \"\", n = Object.keys(t.attributes).length > 0;\n !!t.error ? e(\n `[${s}] [${r}]${o} ${t.body}`,\n t.attributes,\n t.error\n ) : n ? e(`[${s}] [${r}]${o} ${t.body}`, t.attributes) : e(`[${s}] [${r}]${o} ${t.body}`);\n}\nfunction I(t) {\n const e = {\n timestamp: t.timestamp,\n level: t.severityText,\n message: t.body,\n service: t.resource.serviceName,\n environment: t.resource.environment,\n attributes: t.attributes,\n caller: t.caller\n };\n t.error && (e.error = {\n name: t.error.name,\n message: t.error.message,\n stack: t.error.stack\n }), console.log(JSON.stringify(e));\n}\nfunction F(t) {\n switch (t) {\n case h.ERROR:\n return console.error.bind(console);\n case h.WARN:\n return console.warn.bind(console);\n case h.INFO:\n return console.log.bind(console);\n case h.DEBUG:\n default:\n return console.debug.bind(console);\n }\n}\nfunction z(t) {\n if (!t?.dsn)\n return f(\"no DSN\");\n const e = P(t.dsn);\n if (!e)\n return f(\"invalid DSN\");\n const { host: s, projectId: r, publicKey: o } = e, n = `https://${s}/api/${r}/envelope/`, l = t.environment ?? \"production\", m = t.release ?? \"unknown\";\n return {\n name: \"sentry\",\n async export(a) {\n const u = a.filter(\n (c) => c.severityNumber >= h.ERROR\n );\n if (u.length !== 0)\n for (const c of u) {\n const d = i(c, l, m, t.dsn);\n await p(n, d);\n }\n }\n };\n function f(a) {\n return {\n name: `sentry (inactive – ${a})`,\n async export(u) {\n }\n };\n }\n async function p(a, u) {\n try {\n const c = await fetch(a, {\n method: \"POST\",\n body: u,\n headers: {\n \"Content-Type\": \"application/x-sentry-envelope\"\n }\n });\n c.ok || console.warn(\n `[telemetry] Sentry adapter: HTTP ${c.status}`,\n await c.text().catch(() => \"\")\n );\n } catch (c) {\n console.warn(\"[telemetry] Sentry adapter: network error\", c);\n }\n }\n function i(a, u, c, d) {\n const y = O(), v = JSON.stringify({\n event_id: y,\n sent_at: a.timestamp,\n dsn: d\n }), x = JSON.stringify({\n type: \"event\",\n content_type: \"application/json\"\n }), b = B(y, a, u, c);\n return `${v}\n${x}\n${b}`;\n }\n}\nfunction P(t) {\n try {\n const e = new URL(t);\n if (e.protocol !== \"https:\") return null;\n const s = e.username || \"\", r = e.host, n = e.pathname.replace(/\\/$/, \"\").split(\"/\").filter(Boolean).pop() || \"\";\n return { host: r, projectId: n, publicKey: s };\n } catch {\n return null;\n }\n}\nfunction B(t, e, s, r) {\n const o = {\n event_id: t,\n timestamp: e.timestamp,\n level: e.severityText.toLowerCase(),\n logger: e.resource.serviceName,\n platform: \"javascript\",\n environment: s,\n release: r,\n message: { formatted: e.body },\n exception: e.error ? {\n values: [\n {\n type: e.error.name || \"Error\",\n value: e.error.message,\n stacktrace: e.error.stack ? { frames: k(e.error.stack) } : void 0\n }\n ]\n } : void 0,\n extra: { ...e.attributes, caller: e.caller }\n };\n for (const n of Object.keys(o))\n o[n] === void 0 && delete o[n];\n return JSON.stringify(o);\n}\nfunction O() {\n const t = \"0123456789abcdef\";\n let e = \"\";\n for (let s = 0; s < 32; s++)\n e += t[Math.floor(Math.random() * 16)];\n return e;\n}\nfunction k(t) {\n const e = t.split(`\n`).slice(1), s = [];\n for (const r of e) {\n const n = r.trim().match(\n /at\\s+(?:(.+?)\\s+\\()?(.+?):(\\d+):(\\d+)\\)?$/\n );\n n && s.push({\n function: n[1] || \"<anonymous>\",\n filename: n[2],\n lineno: parseInt(n[3], 10),\n colno: parseInt(n[4], 10)\n });\n }\n return s;\n}\nfunction j() {\n return {\n name: \"noop\",\n async export(t) {\n }\n };\n}\nfunction C(t) {\n const {\n binding: e,\n prefix: s = \"logs\",\n workerId: r = \"unknown\",\n maxFileSize: o = 1048576\n // 1 MB default\n } = t;\n let n = \"\", l = 0;\n return {\n name: \"r2\",\n async export(p) {\n for (const i of p)\n n += JSON.stringify({\n ts: i.timestamp,\n level: i.severityText,\n msg: i.body,\n attrs: i.attributes,\n caller: i.caller,\n err: i.error ? {\n name: i.error.name,\n message: i.error.message,\n stack: A(i.error.stack, 5)\n } : void 0,\n svc: i.resource.serviceName,\n env: i.resource.environment,\n ver: i.resource.version\n }) + `\n`, n.length >= o && await f();\n },\n async shutdown() {\n n.length > 0 && await f();\n }\n };\n function m(p) {\n const i = /* @__PURE__ */ new Date(), a = i.getUTCFullYear(), u = String(i.getUTCMonth() + 1).padStart(2, \"0\"), c = String(i.getUTCDate()).padStart(2, \"0\"), d = String(i.getUTCHours()).padStart(2, \"0\"), y = String(p).padStart(3, \"0\");\n return `${s}/${a}/${u}/${c}/${d}-${r}-${y}.ndjson`;\n }\n async function f() {\n if (n.length === 0) return;\n const p = n;\n n = \"\";\n const i = l++, a = m(i);\n try {\n await e.put(a, p, {\n httpMetadata: {\n \"content-type\": \"application/x-ndjson\"\n }\n });\n } catch (u) {\n console.error(\n `[telemetry] R2 adapter: failed to write \"${a}\"`,\n u\n );\n }\n }\n}\nfunction A(t, e) {\n if (t)\n return t.split(`\n`).slice(0, e).join(`\n`);\n}\nconst w = {\n maxQueueSize: 2048,\n maxExportBatchSize: 512,\n scheduledDelayMillis: 5e3,\n exportTimeoutMillis: 3e4\n};\nclass _ {\n constructor(e, s) {\n this.buffer = [], this.shutdownFlag = !1, this.timerId = null, this.adapter = e, this.maxQueueSize = s?.maxQueueSize ?? w.maxQueueSize, this.maxExportBatchSize = s?.maxExportBatchSize ?? w.maxExportBatchSize, this.scheduledDelayMillis = s?.scheduledDelayMillis ?? w.scheduledDelayMillis, this.exportTimeoutMillis = s?.exportTimeoutMillis ?? w.exportTimeoutMillis;\n }\n onEmit(e) {\n if (!this.shutdownFlag) {\n if (this.buffer.push(e), this.buffer.length >= this.maxQueueSize) {\n this.flushBuffer().catch(() => {\n });\n return;\n }\n !this.timerId && !this.shutdownFlag && (this.timerId = setTimeout(() => {\n this.timerId = null, this.flushBuffer().catch(() => {\n });\n }, this.scheduledDelayMillis));\n }\n }\n async forceFlush() {\n await this.flushBuffer();\n }\n async shutdown() {\n this.shutdownFlag = !0, this.timerId !== null && (clearTimeout(this.timerId), this.timerId = null), await this.flushBuffer(), await this.adapter.shutdown?.();\n }\n // ── Internal ────────────────────────────────────────────────────────────\n async flushBuffer() {\n if (this.buffer.length === 0) return;\n const e = this.buffer.splice(0, this.maxExportBatchSize), s = this.buffer.length;\n try {\n await D(\n this.adapter.export(e),\n this.exportTimeoutMillis\n );\n } catch (r) {\n console.error(\n `[telemetry] BatchLogProcessor: adapter \"${this.adapter.name}\" export failed:`,\n r\n );\n }\n s > 0 && !this.shutdownFlag && (await new Promise((r) => setTimeout(r, 0)), await this.flushBuffer());\n }\n}\nfunction D(t, e) {\n return new Promise((s, r) => {\n const o = setTimeout(() => {\n r(new Error(`export timed out after ${e}ms`));\n }, e);\n t.then(\n (n) => {\n clearTimeout(o), s(n);\n },\n (n) => {\n clearTimeout(o), r(n);\n }\n );\n });\n}\nexport {\n _ as BatchLogProcessor,\n h as LogLevel,\n S as LogLevelLabel,\n g as Logger,\n M as LoggerProvider,\n T as SimpleLogProcessor,\n U as consoleAdapter,\n j as noopAdapter,\n C as r2Adapter,\n z as sentryAdapter\n};\n//# sourceMappingURL=telemetry.js.map\n","/**\n * Shared internal telemetry helper — used by every @leadertechie package.\n *\n * Each package gets a lazy console logger (WARN+ERROR only).\n * Consumers can optionally pass their own LoggerInterface for\n * production telemetry (fetchAdapter → toldby-telemetry-worker).\n *\n * Usage inside a package:\n * import { getDefaultLogger } from \"./telemetry-init.js\";\n * const log = opts?.logger ?? getDefaultLogger(\"md2html\");\n */\n\nimport {\n LoggerProvider,\n consoleAdapter,\n LogLevel,\n LoggerInterface,\n} from \"@leadertechie/telemetry\";\n\nconst defaultLoggers = new Map<string, LoggerInterface>();\n\nexport function getDefaultLogger(serviceName: string): LoggerInterface {\n let log = defaultLoggers.get(serviceName);\n if (!log) {\n const provider = new LoggerProvider({ serviceName });\n // Dev/standalone: console, WARN+ only — silent unless something's wrong\n provider.addAdapter(consoleAdapter({ level: LogLevel.WARN }));\n log = provider.getLogger();\n defaultLoggers.set(serviceName, log);\n }\n return log;\n}\n\nexport type { LoggerInterface } from \"@leadertechie/telemetry\";\n","/**\n * ParseContext Factory\n *\n * Single responsibility: Creates ParseContext instances that bridge\n * the parser's private services to token handlers.\n *\n * Separates context construction logic from the parser itself,\n * making it easier to test and extend.\n */\n\nimport type { ParseContext } from './handlers/types.js';\nimport { ContentNode } from './types.js';\n\n/**\n * Services needed by the ParseContext factory.\n * This is the interface the parser exposes to context creation.\n */\nexport interface ParserServices {\n preserveRawHTML: boolean;\n errorRecovery: 'throw' | 'warn' | 'silent';\n maxRecursionDepth: number;\n processImagePath(src: string): string;\n processInlineFormatting(text: string): string;\n processSlots(text: string): string;\n processRawHTML(html: string): string;\n parseTokens(tokens: unknown[], depth: number): ContentNode[];\n onUnhandledToken?: (type: string, token: Record<string, unknown>) => void;\n}\n\n/**\n * Create a ParseContext from parser services.\n *\n * Each call creates a fresh context with its own metadata store,\n * allowing for clean separation between recursive parse calls.\n *\n * The getters use closures to lazily access the parser's current state,\n * so the context always reflects the latest configuration.\n */\nexport function createParseContext(services: ParserServices): ParseContext {\n const metadata: Record<string, unknown> = {};\n return {\n get preserveRawHTML() { return services.preserveRawHTML; },\n get errorRecovery() { return services.errorRecovery; },\n get maxRecursionDepth() { return services.maxRecursionDepth; },\n processImagePath: (src: string) => services.processImagePath(src),\n processInlineFormatting: (text: string) => services.processInlineFormatting(text),\n processSlots: (text: string) => services.processSlots(text),\n processRawHTML: (html: string) => services.processRawHTML(html),\n parseTokens: (tokens: unknown[], depth: number) => services.parseTokens(tokens, depth),\n reportUnhandled: (type: string, token: Record<string, unknown>) => {\n services.onUnhandledToken?.(type, token);\n },\n metadata\n };\n}\n","/**\n * Markdown Preprocessor\n *\n * Single responsibility: Transform markdown text before it reaches the lexer.\n * Currently handles `:::` container block syntax conversion to HTML comments.\n *\n * This is the first stage in the parsing pipeline.\n *\n * Extensibility: Additional preprocessors can be composed via the\n * CompositePipeline pattern (see composite-pipeline.ts).\n */\n\nexport interface Preprocessor {\n /** Name identifier for logging/debugging */\n readonly name: string;\n /** Transform the markdown before lexing */\n process(markdown: string): string;\n}\n\n// ─── Container Block Preprocessor ─────────────────────────────────────────────\n\n/**\n * Converts `:::tag#id.class` container syntax into HTML comment markers\n * that marked will preserve as HTML tokens, without affecting markdown parsing\n * of the inner content.\n *\n * Example:\n * :::section#header\n * # Heading inside container\n * Some text\n * :::\n *\n * Becomes:\n * <!-- md-container:section#header -->\n * # Heading inside container\n * Some text\n * <!-- /md-container -->\n */\nexport class ContainerBlockPreprocessor implements Preprocessor {\n readonly name = 'container-blocks';\n\n process(markdown: string): string {\n return markdown.replace(/^:::(?:(\\w+(?:[.#][\\w-]+)*)\\s*)?$/gm, (_match, specifier) => {\n if (!specifier) {\n // Closing fence :::\n return '<!-- /md-container -->';\n }\n // Normalize: if no tag name given, default to \"div\"\n const normalized = specifier.match(/^\\w/) ? specifier : `div${specifier}`;\n return `<!-- md-container:${normalized} -->`;\n });\n }\n}\n\n// ─── Composite Preprocessor (Chain of Responsibility) ─────────────────────────\n\n/**\n * Sequentially applies multiple preprocessors to the markdown.\n * Each preprocessor's output becomes the next one's input.\n *\n * This follows the Chain of Responsibility pattern — you can add\n * new preprocessors without modifying existing code.\n */\nexport class CompositePreprocessor implements Preprocessor {\n readonly name = 'composite';\n private processors: Preprocessor[] = [];\n\n constructor(processors?: Preprocessor[]) {\n if (processors) {\n this.processors = [...processors];\n }\n }\n\n /** Add a preprocessor to the chain. Returns `this` for fluent API. */\n add(processor: Preprocessor): this {\n this.processors.push(processor);\n return this;\n }\n\n /** Remove a preprocessor by name. */\n remove(name: string): void {\n this.processors = this.processors.filter(p => p.name !== name);\n }\n\n /** Get the list of registered preprocessors. */\n getProcessors(): ReadonlyArray<Preprocessor> {\n return [...this.processors];\n }\n\n process(markdown: string): string {\n let result = markdown;\n for (const processor of this.processors) {\n result = processor.process(result);\n }\n return result;\n }\n}\n\n// ─── Default Instance ─────────────────────────────────────────────────────────\n\n/** Default preprocessor chain with the built-in container block support. */\nexport function createDefaultPreprocessor(): CompositePreprocessor {\n return new CompositePreprocessor([\n new ContainerBlockPreprocessor()\n ]);\n}\n","/**\n * Token Postprocessor\n *\n * Single responsibility: Transform the flat array of marked tokens into\n * a structured tree. Currently handles collapsing HTML comment markers\n * (from container block preprocessing) into structured `containerBlock` tokens.\n *\n * This is the third stage in the parsing pipeline (after lexing).\n */\n\nexport interface TokenPostprocessor {\n /** Name identifier for logging/debugging */\n readonly name: string;\n /** Transform an array of tokens into an array of (possibly restructured) tokens */\n process(tokens: unknown[]): unknown[];\n}\n\n// ─── Container Block Postprocessor ────────────────────────────────────────────\n\n/**\n * Collapses `<!-- md-container:... -->` and `<!-- /md-container -->` comment\n * markers into nested `containerBlock` tokens with proper parent-child structure.\n *\n * Handles nesting depth up to any reasonable limit (depends on stack memory).\n */\nexport class ContainerBlockPostprocessor implements TokenPostprocessor {\n readonly name = 'container-blocks';\n\n process(tokens: unknown[]): unknown[] {\n const result: unknown[] = [];\n const stack: { specifier: string; tokens: unknown[] }[] = [];\n\n for (const token of tokens) {\n const t = token as Record<string, unknown>;\n\n // Only inspect 'html' type tokens for container markers\n if (t.type === 'html') {\n const raw = (t.raw as string).trim();\n const openMatch = raw.match(/^<!--\\s*md-container:\\s*(\\S+)\\s*-->$/);\n const closeMatch = raw.match(/^<!--\\s*\\/md-container\\s*-->$/);\n\n if (openMatch) {\n // Start a new container\n stack.push({\n specifier: openMatch[1],\n tokens: []\n });\n continue;\n }\n\n if (closeMatch) {\n if (stack.length === 0) {\n // Unmatched closing fence — skip\n continue;\n }\n const container = stack.pop()!;\n // Recursively process inner tokens for any nested containers\n const processedInner = this.process(container.tokens);\n const containerToken = {\n type: 'containerBlock',\n specifier: container.specifier,\n tokens: processedInner\n };\n\n if (stack.length > 0) {\n stack[stack.length - 1].tokens.push(containerToken);\n } else {\n result.push(containerToken);\n }\n continue;\n }\n }\n\n // Not a container marker — add to current context\n if (stack.length > 0) {\n stack[stack.length - 1].tokens.push(token);\n } else {\n result.push(token);\n }\n }\n\n return result;\n }\n}\n\n// ─── Composite Token Postprocessor (Chain of Responsibility) ──────────────────\n\n/**\n * Sequentially applies multiple postprocessors to the token array.\n */\nexport class CompositeTokenPostprocessor implements TokenPostprocessor {\n readonly name = 'composite';\n private processors: TokenPostprocessor[] = [];\n\n constructor(processors?: TokenPostprocessor[]) {\n if (processors) {\n this.processors = [...processors];\n }\n }\n\n /** Add a postprocessor to the chain. Returns `this` for fluent API. */\n add(processor: TokenPostprocessor): this {\n this.processors.push(processor);\n return this;\n }\n\n /** Remove a postprocessor by name. */\n remove(name: string): void {\n this.processors = this.processors.filter(p => p.name !== name);\n }\n\n /** Get the list of registered postprocessors. */\n getProcessors(): ReadonlyArray<TokenPostprocessor> {\n return [...this.processors];\n }\n\n process(tokens: unknown[]): unknown[] {\n let result = tokens;\n for (const processor of this.processors) {\n result = processor.process(result);\n }\n return result;\n }\n}\n\n// ─── Default Instance ─────────────────────────────────────────────────────────\n\n/** Default postprocessor chain with the built-in container block support. */\nexport function createDefaultPostprocessor(): CompositeTokenPostprocessor {\n return new CompositeTokenPostprocessor([\n new ContainerBlockPostprocessor()\n ]);\n}\n","import { marked } from 'marked';\nimport type { LoggerInterface } from \"@leadertechie/telemetry\";\nimport { ContentNode, MarkdownContent, ParseOptions, defaultAllowedHTMLTags } from './types.js';\nimport { TokenHandlerRegistry, ParseContext } from './handlers/index.js';\nimport { getDefaultLogger } from './telemetry-init.js';\nimport { createParseContext, ParserServices } from './context-factory.js';\nimport { CompositePreprocessor, createDefaultPreprocessor } from './preprocessor.js';\nimport { CompositeTokenPostprocessor, createDefaultPostprocessor } from './token-postprocessor.js';\n\nexport interface ParserOptions {\n /** Optional telemetry logger */\n logger?: import(\"@leadertechie/telemetry\").LoggerInterface;\n imagePathPrefix?: string;\n imageBaseUrl?: string;\n preserveRawHTML?: boolean;\n slotPattern?: RegExp;\n onSlot?: (name: string) => string;\n errorRecovery?: 'throw' | 'warn' | 'silent';\n maxRecursionDepth?: number;\n allowedHTMLTags?: string[];\n /**\n * Allowed HTML attributes per tag for preserveRawHTML mode.\n * Key \"*\" applies to all tags. Key \"tag\" applies to specific tags.\n * Supports \"data-*\" wildcard prefix matching.\n */\n allowedAttributes?: Record<string, string[]>;\n /**\n * Callback invoked when a token type has no dedicated handler.\n\n * The catch-all handler will still produce a container node for the content,\n * but this callback allows callers to log, warn, or track unhandled types.\n *\n * @param type - The unhandled token type name (e.g. 'table', 'def')\n * @param token - The raw marked token\n */\n onUnhandledToken?: (type: string, token: Record<string, unknown>) => void;\n}\n\nconst DEFAULT_SLOT_PATTERN = /\\[\\[(.*?)\\]\\]/g;\n\n// Re-export handler types for convenience\nexport { TokenHandlerRegistry } from './handlers/index.js';\nexport type { TokenHandler, ParseContext } from './handlers/index.js';\n\n// ─── MarkdownParser ───────────────────────────────────────────────────────────\n\nexport class MarkdownParser {\n private imagePathPrefix: string;\n private imageBaseUrl: string;\n private preserveRawHTML: boolean;\n private slotPattern: RegExp;\n private onSlot: ((name: string) => string) | undefined;\n private errorRecovery: 'throw' | 'warn' | 'silent';\n private maxRecursionDepth: number;\n private allowedHTMLTags: Set<string>;\n private allowedAttributes: Record<string, string[]>;\n private handlerRegistry: TokenHandlerRegistry;\n private onUnhandledToken?: (type: string, token: Record<string, unknown>) => void;\n private log: LoggerInterface;\n private preprocessor: CompositePreprocessor;\n private postprocessor: CompositeTokenPostprocessor;\n\n constructor(options?: ParserOptions) {\n this.imagePathPrefix = options?.imagePathPrefix || '';\n this.imageBaseUrl = options?.imageBaseUrl || '';\n this.preserveRawHTML = options?.preserveRawHTML ?? false;\n this.slotPattern = options?.slotPattern ?? DEFAULT_SLOT_PATTERN;\n this.onSlot = options?.onSlot;\n this.log = options?.logger ?? getDefaultLogger('md2html');\n this.errorRecovery = options?.errorRecovery ?? 'throw';\n this.maxRecursionDepth = options?.maxRecursionDepth ?? 100;\n this.allowedHTMLTags = new Set([\n ...defaultAllowedHTMLTags,\n ...(options?.allowedHTMLTags ?? [])\n ]);\n this.allowedAttributes = options?.allowedAttributes ?? {};\n this.handlerRegistry = new TokenHandlerRegistry();\n this.onUnhandledToken = options?.onUnhandledToken;\n this.preprocessor = createDefaultPreprocessor();\n this.postprocessor = createDefaultPostprocessor();\n }\n\n\n /** Access the handler registry for customization. */\n get handlers(): TokenHandlerRegistry {\n return this.handlerRegistry;\n }\n\n /** Access the preprocessor chain for customization. */\n get preprocessors(): CompositePreprocessor {\n return this.preprocessor;\n }\n\n /** Access the token postprocessor chain for customization. */\n get postprocessors(): CompositeTokenPostprocessor {\n return this.postprocessor;\n }\n\n private processImagePath(src: string): string {\n if (src.startsWith('http') || src.startsWith('/')) {\n return src;\n }\n let path = this.imagePathPrefix ? `${this.imagePathPrefix}${src}` : src;\n if (this.imageBaseUrl && !path.startsWith('http')) {\n path = `${this.imageBaseUrl}${path}`;\n }\n return path;\n }\n\n private processInlineFormatting(text: string): string {\n return text\n .replace(/\\*\\*(.+?)\\*\\*/g, '<strong>$1</strong>')\n .replace(/\\*(.+?)\\*/g, '<em>$1</em>');\n }\n\n private processSlots(text: string): string {\n if (!this.onSlot) return text;\n return text.replace(this.slotPattern, (match, name: string) => {\n return this.onSlot!(name.trim());\n });\n }\n\n /**\n * Check if an attribute name is allowed for a given tag.\n * Supports \"data-*\" wildcard prefix matching.\n */\n private isAttributeAllowed(tagName: string, attrName: string): boolean {\n const globalAllowed = this.allowedAttributes['*'];\n if (globalAllowed && this.matchesAttributeList(attrName, globalAllowed)) {\n return true;\n }\n const tagAllowed = this.allowedAttributes[tagName];\n if (tagAllowed && this.matchesAttributeList(attrName, tagAllowed)) {\n return true;\n }\n return false;\n }\n\n /**\n * Check if an attribute name matches a list of allowed patterns.\n * Supports \"data-*\" wildcard prefix matching.\n */\n private matchesAttributeList(attrName: string, allowed: string[]): boolean {\n const lower = attrName.toLowerCase();\n for (const pattern of allowed) {\n if (pattern.endsWith('-*')) {\n const prefix = pattern.slice(0, -1).toLowerCase();\n if (lower.startsWith(prefix)) return true;\n } else if (pattern.toLowerCase() === lower) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Filter attributes on an HTML tag, keeping only allowed ones.\n */\n private filterTagAttributes(tag: string): string {\n // Match opening tag: <tagname ...attrs...>\n const tagMatch = tag.match(/^<\\/?(\\w+)/);\n if (!tagMatch) return tag;\n const tagName = tagMatch[1].toLowerCase();\n\n // If no attribute rules defined, return as-is\n const hasRules = Object.keys(this.allowedAttributes).length > 0;\n if (!hasRules) return tag;\n\n // Extract all attributes from the tag\n const attrRegex = /(\\S+)\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|(\\S+))/g;\n const selfClosing = tag.endsWith('/>');\n\n // Get the tag opening part (e.g., <div or </div)\n const tagOpen = tagMatch[0];\n const remaining = tag.slice(tagOpen.length);\n\n // Rebuild the tag with only allowed attributes\n let filtered = tagOpen;\n let match: RegExpExecArray | null;\n while ((match = attrRegex.exec(remaining)) !== null) {\n const attrName = match[1];\n const attrValue = match[2] ?? match[3] ?? match[4] ?? '';\n if (this.isAttributeAllowed(tagName, attrName)) {\n filtered += ` ${attrName}=\"${attrValue.replace(/\"/g, '\"')}\"`;\n }\n }\n\n // Close the tag\n if (selfClosing) {\n filtered += ' /';\n }\n filtered += '>';\n\n return filtered;\n }\n\n private processRawHTML(html: string): string {\n if (!this.allowedHTMLTags.has('script')) {\n html = html.replace(/<script[\\s\\S]*?<\\/script>/gi, '');\n html = html.replace(/<\\/?script[^>]*>/gi, '');\n }\n if (!this.allowedHTMLTags.has('style')) {\n html = html.replace(/<style[\\s\\S]*?<\\/style>/gi, '');\n html = html.replace(/<\\/?style[^>]*>/gi, '');\n }\n\n // Filter attributes on all remaining HTML tags\n const hasAttrRules = Object.keys(this.allowedAttributes).length > 0;\n if (hasAttrRules) {\n html = html.replace(/<[^>]+>/g, (match) => this.filterTagAttributes(match));\n }\n\n return html;\n }\n\n\n /**\n * Build a ParserServices object that bridges the parser's private methods\n * to the ParseContext factory. This keeps context creation decoupled.\n */\n private buildServices(): ParserServices {\n return {\n preserveRawHTML: this.preserveRawHTML,\n errorRecovery: this.errorRecovery,\n maxRecursionDepth: this.maxRecursionDepth,\n processImagePath: (src: string) => this.processImagePath(src),\n processInlineFormatting: (text: string) => this.processInlineFormatting(text),\n processSlots: (text: string) => this.processSlots(text),\n processRawHTML: (html: string) => this.processRawHTML(html),\n parseTokens: (tokens: unknown[], depth: number) => this.parseTokens(tokens, depth),\n onUnhandledToken: this.onUnhandledToken\n };\n }\n\n /**\n * Process an array of marked tokens into ContentNodes.\n * When depth === 0 (root), creates a shared context that accumulates metadata.\n * For recursive calls (depth > 0), creates a fresh context for each level.\n */\n private parseTokens(tokens: unknown[], depth: number = 0, sharedCtx?: ParseContext): ContentNode[] {\n if (depth > this.maxRecursionDepth) {\n const msg = `[md2html] Max recursion depth (${this.maxRecursionDepth}) exceeded, truncating`;\n if (this.errorRecovery === 'warn') {\n this.log.warn(msg);\n }\n return [];\n }\n\n const nodes: ContentNode[] = [];\n // Use shared context at root level (depth 0), create fresh for recursive calls\n const ctx = sharedCtx || createParseContext(this.buildServices());\n\n for (const token of tokens) {\n const typedToken = token as Record<string, unknown>;\n // The registry automatically falls back to the catch-all handler\n const handler = this.handlerRegistry.get(typedToken.type as string);\n const node = handler.handle(typedToken, ctx);\n if (node) {\n nodes.push(node);\n }\n }\n\n return nodes;\n }\n\n parse(markdown: string, options?: ParseOptions): MarkdownContent {\n const parseOptions = {\n gfm: options?.gfm ?? true,\n breaks: options?.breaks ?? false,\n pedantic: options?.pedantic ?? false\n };\n\n try {\n // Step 1: Pre-process markdown (container blocks, etc.)\n const processed = this.preprocessor.process(markdown);\n\n // Step 2: Lex with marked\n const rawTokens = marked.lexer(processed, parseOptions as Parameters<typeof marked.lexer>[1]);\n\n // Step 3: Post-process tokens (collapse container markers, etc.)\n const tokens = this.postprocessor.process(rawTokens);\n\n // Step 4: Create a shared context so frontmatter metadata accumulates\n const ctx = createParseContext(this.buildServices());\n const content = this.parseTokens(tokens, 0, ctx);\n\n return {\n title: '',\n metadata: { ...ctx.metadata },\n content\n };\n } catch (err) {\n if (this.errorRecovery === 'throw') throw err;\n\n const msg = `[md2html] Parse error: ${err instanceof Error ? err.message : String(err)}`;\n if (this.errorRecovery === 'warn') {\n this.log.warn(msg);\n }\n\n return {\n title: '',\n content: [{ type: 'text', content: markdown }]\n };\n }\n }\n\n\n parseToNodes(markdown: string, options?: ParseOptions): ContentNode[] {\n return this.parse(markdown, options).content;\n }\n}\n","import { MarkdownParser } from './parser.js';\nimport { HTMLRenderer } from './renderer.js';\nimport { ContentNode, MarkdownContent, PipelineConfigV2 } from './types.js';\nimport { getDefaultLogger } from './telemetry-init.js';\nimport type { LoggerInterface } from '@leadertechie/telemetry';\n\ntype NormalizedPipelineConfig = Required<Omit<PipelineConfigV2, 'onSlot' | 'slotPattern' | 'logger'>> & {\n onSlot?: (name: string) => string;\n slotPattern: RegExp;\n logger?: LoggerInterface;\n};\n\nexport class MarkdownPipeline {\n private parser: MarkdownParser;\n private renderer: HTMLRenderer;\n private config: NormalizedPipelineConfig;\n private log: LoggerInterface;\n\n constructor(config: PipelineConfigV2 = {}) {\n this.log = config.logger ?? getDefaultLogger('md2html');\n\n this.config = {\n imagePathPrefix: config.imagePathPrefix || '',\n imageBaseUrl: config.imageBaseUrl || '',\n parseOptions: {\n gfm: config.parseOptions?.gfm ?? true,\n breaks: config.parseOptions?.breaks ?? false,\n pedantic: config.parseOptions?.pedantic ?? false\n },\n styleOptions: {\n classPrefix: config.styleOptions?.classPrefix || '',\n customCSS: config.styleOptions?.customCSS || '',\n addHeadingIds: config.styleOptions?.addHeadingIds ?? false,\n emitScopeAnchors: config.styleOptions?.emitScopeAnchors ?? false\n },\n preserveRawHTML: config.preserveRawHTML ?? false,\n slotPattern: config.slotPattern ?? /\\[\\[(.*?)\\]\\]/g,\n onSlot: config.onSlot,\n errorRecovery: config.errorRecovery ?? 'throw',\n maxRecursionDepth: config.maxRecursionDepth ?? 100,\n allowedHTMLTags: config.allowedHTMLTags ?? [],\n allowedAttributes: config.allowedAttributes ?? {}\n };\n\n this.parser = new MarkdownParser({\n imagePathPrefix: this.config.imagePathPrefix,\n imageBaseUrl: this.config.imageBaseUrl,\n preserveRawHTML: this.config.preserveRawHTML,\n slotPattern: this.config.slotPattern,\n onSlot: this.config.onSlot,\n errorRecovery: this.config.errorRecovery,\n maxRecursionDepth: this.config.maxRecursionDepth,\n allowedHTMLTags: this.config.allowedHTMLTags,\n allowedAttributes: this.config.allowedAttributes\n });\n\n this.renderer = new HTMLRenderer(this.config.styleOptions);\n }\n\n parse(markdown: string): ContentNode[] {\n return this.parser.parseToNodes(markdown, this.config.parseOptions);\n }\n\n parseWithMetadata(markdown: string): MarkdownContent {\n return this.parser.parse(markdown, this.config.parseOptions);\n }\n\n render(nodes: ContentNode[]): string {\n return this.renderer.renderNodes(nodes);\n }\n\n renderMarkdown(markdown: string): string {\n try {\n const nodes = this.parse(markdown);\n return this.render(nodes);\n } catch (err: any) {\n this.log.error('Markdown render failed', err, {\n length: markdown.length,\n recovery: this.config.errorRecovery,\n });\n throw err;\n }\n }\n\n renderPage(title: string, nodes: ContentNode[], options?: {\n lang?: string;\n charset?: string;\n }): string {\n const html = this.render(nodes);\n return `<!DOCTYPE html>\n<html lang=\"${options?.lang || 'en'}\">\n<head>\n <meta charset=\"${options?.charset || 'UTF-8'}\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>${title}</title>\n</head>\n<body>\n ${html}\n</body>\n</html>`;\n }\n\n getConfig(): Readonly<PipelineConfigV2> {\n return { ...this.config };\n }\n\n getCustomCSS(): string {\n return this.renderer.getCustomCSS();\n }\n}\n","import { ContentNode } from './types.js';\n\n/**\n * Visitor interface for traversing/walking a ContentNode AST.\n *\n * Implement this interface to inspect, collect, or transform nodes.\n * Each method returns a ContentNode or null — returning null removes the node.\n *\n * Use cases:\n * - Collect all images for preloading\n * - Transform link URLs\n * - Validate AST structure\n * - Extract headings for ToC\n * - Inject attributes\n */\nexport interface NodeVisitor {\n /** Called when entering a node, before visiting its children. */\n enter?(node: ContentNode, parent: ContentNode | null, depth: number): ContentNode | null;\n /** Called after visiting all children of the node. */\n exit?(node: ContentNode, parent: ContentNode | null, depth: number): ContentNode | null;\n}\n\n/**\n * Walk a ContentNode tree, applying a visitor at each node.\n * Returns a new tree (immutable) — does not mutate the original.\n */\nexport function walkTree(root: ContentNode, visitor: NodeVisitor): ContentNode {\n return walkNode(root, null, 0, visitor);\n}\n\nfunction walkNode(\n node: ContentNode,\n parent: ContentNode | null,\n depth: number,\n visitor: NodeVisitor\n): ContentNode {\n // Enter phase\n let processed = visitor.enter ? visitor.enter(node, parent, depth) : node;\n if (processed === null) return null as unknown as ContentNode;\n\n // Recursively walk children\n if (processed.children && processed.children.length > 0) {\n processed = {\n ...processed,\n children: processed.children\n .map(child => walkNode(child, processed, depth + 1, visitor))\n .filter(Boolean) as ContentNode[]\n };\n }\n\n // Exit phase\n processed = visitor.exit ? visitor.exit(processed, parent, depth) : processed;\n if (processed === null) return null as unknown as ContentNode;\n\n return processed;\n}\n\n/**\n * Walk a ContentNode tree and collect results from the visitor.\n * The collector function is called for each node and returns a value or null.\n */\nexport function collectFromTree<T>(\n root: ContentNode,\n collector: (node: ContentNode, parent: ContentNode | null, depth: number) => T | null\n): T[] {\n const results: T[] = [];\n collectNode(root, null, 0, collector, results);\n return results;\n}\n\nfunction collectNode<T>(\n node: ContentNode,\n parent: ContentNode | null,\n depth: number,\n collector: (node: ContentNode, parent: ContentNode | null, depth: number) => T | null,\n results: T[]\n): void {\n const result = collector(node, parent, depth);\n if (result !== null) {\n results.push(result);\n }\n if (node.children) {\n for (const child of node.children) {\n collectNode(child, node, depth + 1, collector, results);\n }\n }\n}\n\n/**\n * Built-in visitor: collect all nodes of a specific type.\n */\nexport function collectByType(root: ContentNode, type: string): ContentNode[] {\n return collectFromTree(root, (node) => \n node.type === type ? node : null\n );\n}\n\n/**\n * Built-in visitor: collect all headings with their levels.\n */\nexport function collectHeadings(root: ContentNode): Array<{ level: string; text: string; id?: string }> {\n return collectFromTree(root, (node) => {\n if (node.type === 'heading') {\n return {\n level: (node.attributes?.level as string) || '2',\n text: node.content || '',\n id: node.attributes?.id as string | undefined\n };\n }\n return null;\n });\n}\n\n/**\n * Built-in visitor: collect all images with their src/alt.\n */\nexport function collectImages(root: ContentNode): Array<{ src: string; alt: string }> {\n return collectFromTree(root, (node) => {\n if (node.type === 'image') {\n return { src: node.src || '', alt: node.alt || '' };\n }\n return null;\n });\n}\n","import { ContentNode } from './types.js';\n\n/**\n * ContentNode factory — a builder API for creating ContentNode instances\n * consistently across the codebase. Eliminates scattered object literals\n * and provides type-safe construction with sensible defaults.\n *\n * Usage:\n * NodeFactory.heading('Hello', { level: '1' })\n * NodeFactory.paragraph('Some text')\n * NodeFactory.container({ tag: 'section', id: 'main' }, [children...])\n */\nexport class NodeFactory {\n static heading(content: string, attributes?: Record<string, unknown>): ContentNode {\n return {\n type: 'heading',\n content,\n attributes: { level: attributes?.level || '2', ...attributes }\n };\n }\n\n static paragraph(\n contentOrChildren: string | ContentNode[],\n children?: ContentNode[]\n ): ContentNode {\n if (typeof contentOrChildren === 'string') {\n return { type: 'paragraph', content: contentOrChildren };\n }\n return { type: 'paragraph', children: contentOrChildren ?? children };\n }\n\n static list(\n items: ContentNode[],\n ordered?: boolean,\n attributes?: Record<string, unknown>\n ): ContentNode {\n return {\n type: 'list',\n ordered: ordered ?? false,\n children: items,\n ...(attributes ? { attributes } : {})\n };\n }\n\n static listItem(content: string): ContentNode {\n return { type: 'list-item', content };\n }\n\n static image(src: string, alt?: string, className?: string): ContentNode {\n return { type: 'image', src, alt: alt || '', ...(className ? { className } : {}) };\n }\n\n static code(content: string, lang?: string): ContentNode {\n return {\n type: 'code',\n content,\n attributes: { lang: lang || '' }\n };\n }\n\n static container(\n children?: ContentNode[],\n config?: {\n tag?: string;\n id?: string;\n className?: string;\n rawHTML?: string;\n scope?: string;\n }\n ): ContentNode {\n const node: ContentNode = { type: 'container' };\n if (children && children.length > 0) node.children = children;\n if (config?.rawHTML) node.rawHTML = config.rawHTML;\n if (config?.scope) node.scope = config.scope;\n\n const attrs: Record<string, unknown> = {};\n if (config?.tag) attrs.tag = config.tag;\n if (config?.id) attrs.id = config.id;\n if (Object.keys(attrs).length > 0) node.attributes = attrs;\n if (config?.className) node.className = config.className;\n\n return node;\n }\n\n static text(content: string): ContentNode {\n return { type: 'text', content };\n }\n\n static strong(content: string): ContentNode {\n return { type: 'strong', content };\n }\n\n static emphasis(content: string): ContentNode {\n return { type: 'emphasis', content };\n }\n\n static link(href: string, content: string): ContentNode {\n return { type: 'link', content, attributes: { href } };\n }\n}\n"],"names":["m","h","e","o","n","l","g","f","R","LoggerProvider","consoleAdapter","LogLevel"],"mappings":";;;AAKO,MAAM,eAAuC;AAAA,EAA7C,cAAA;AACL,SAAS,OAAO;AAAA,EAAA;AAAA,EAEhB,OAAO,OAAgC,KAAmB;AACxD,WAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS,IAAI,aAAa,MAAM,IAAc;AAAA,MAC9C,YAAY,EAAE,OAAO,OAAO,MAAM,KAAK,EAAA;AAAA,IAAE;AAAA,EAE7C;AACF;ACTO,MAAM,iBAAyC;AAAA,EAA/C,cAAA;AACL,SAAS,OAAO;AAAA,EAAA;AAAA,EAEhB,OAAO,OAAgC,KAAmB;AACxD,UAAM,SAAU,MAAM,UAA6C,CAAA;AACnE,UAAM,iBAAiB,OAAO,KAAK,CAAA,MAAK,EAAE,SAAS,OAAO;AAC1D,UAAM,gBAAgB,OAAO,KAAK,CAAA,MAAK,EAAE,SAAS,MAAM;AACxD,UAAM,gBAAgB,OAAO,KAAK,CAAA,MAAK,EAAE,SAAS,MAAM;AAExD,QAAI,kBAAkB,iBAAkB,IAAI,mBAAmB,eAAgB;AAC7E,YAAM,WAAW,OAAO,IAAI,CAAA,MAAK;AAC/B,YAAI,EAAE,SAAS,SAAS;AACtB,iBAAO;AAAA,YACL,MAAM;AAAA,YACN,KAAK,IAAI,iBAAiB,EAAE,IAAc;AAAA,YAC1C,KAAK,EAAE,QAAkB;AAAA,UAAA;AAAA,QAE7B;AACA,YAAI,EAAE,SAAS,QAAQ;AACrB,iBAAO;AAAA,YACL,MAAM;AAAA,YACN,SAAS,IAAI,aAAa,IAAI,wBAAwB,EAAE,QAAkB,EAAE,CAAC;AAAA,YAC7E,YAAY;AAAA,cACV,MAAM,EAAE,QAAkB;A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