{"version":3,"file":"index.browser-h_5xW7iF.cjs","names":["VNode","VDocumentFragment","VHTMLDocument","VDocType","hasOwn","unescapeHTML","document","SELF_CLOSING_TAGS","VTextNode","VElement","SELECTOR_BLOCK_ELEMENTS","VNode","VTextNode","isUnsafeUrl","isVElement","serialize","VNode","hasOwn","BLOCK_TAGS","SELECTOR_BLOCK_ELEMENTS","serialize","VNode","isVElement","escapeHTML","VNode","isVElement","hArgumentParser","markup"],"sources":["../src/htmlparser.ts","../src/vdomparser.ts","../src/manipulate.ts","../src/tidy.ts","../src/serialize-markdown.ts","../src/serialize-plaintext.ts","../src/serialize-safehtml.ts","../src/xml.ts"],"sourcesContent":["export interface HtmlParserScanner {\n  /** `isRawText` is set for the content of `<script>` and `<style>`, which has no entities */\n  characters: (text: string, isRawText?: boolean) => void\n  comment: (text: string) => void\n  startElement: (tagName: string, attrs: Record<string, any>, isSelfColse: boolean) => void\n  endElement: (tagName: string) => void\n}\n\n// Character classes of the tokenizer, see `isSpace` etc. below\nconst CH_TAB = 9\nconst CH_CR = 13\nconst CH_SPACE = 32\nconst CH_BANG = 33 // !\nconst CH_DQUOTE = 34 // \"\nconst CH_SQUOTE = 39 // '\nconst CH_SLASH = 47 // /\nconst CH_LT = 60 // <\nconst CH_EQ = 61 // =\nconst CH_GT = 62 // >\nconst CH_QUESTION = 63 // ?\n\n// Same set as `\\s` in regular expressions, which the parser used before\nfunction isSpace(c: number) {\n  if (c <= CH_SPACE)\n    return c === CH_SPACE || (c >= CH_TAB && c <= CH_CR)\n  if (c < 0xA0)\n    return false\n  return c === 0xA0 || c === 0x1680 || (c >= 0x2000 && c <= 0x200A) || c === 0x2028 || c === 0x2029 || c === 0x202F || c === 0x205F || c === 0x3000 || c === 0xFEFF\n}\n\n// A start tag begins with `<` and a letter, like in browsers. `!` and `?`\n// cover `<!DOCTYPE …>` and `<?xml …?>`. `a < b` or `<3` stay text.\nfunction isTagStart(c: number) {\n  return (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || c === CH_BANG || c === CH_QUESTION\n}\n\n/**\n * Simple HTML tokenizer. Reports text, comments, start and end tags to the\n * `scanner`.\n *\n * It scans the input once from left to right and never backtracks, so the\n * time is linear in the length of the input, whatever it contains. A start\n * tag that is still open at the end of the input (`<a href=\"x`) is reported\n * as text together with everything after it.\n */\nexport function createHtmlParser(scanner: HtmlParserScanner) {\n  const scriptEndRe = /<\\/script/gi\n  const styleEndRe = /<\\/style/gi\n\n  function parse(html: string) {\n    const length = html.length\n    let pos = 0\n    // Set once no `>` or `-->` follows anymore, so later `</x` or `<!--` fail\n    // without searching to the end again, which would be quadratic\n    let noMoreGt = false\n    let noMoreCommentEnd = false\n    // The same for closing quotes\n    let noMoreDoubleQuote = false\n    let noMoreSingleQuote = false\n\n    while (pos < length) {\n      // Text up to the next `<`\n      if (html.charCodeAt(pos) !== CH_LT) {\n        let end = html.indexOf('<', pos)\n        if (end < 0)\n          end = length\n        scanner.characters(html.slice(pos, end))\n        pos = end\n        continue\n      }\n\n      const next = html.charCodeAt(pos + 1)\n\n      // Comment\n      if (next === CH_BANG && html.startsWith('<!--', pos)) {\n        // From `pos + 2`: `<!-->` and `<!--->` are empty comments, like in browsers\n        const end = noMoreCommentEnd\n          ? -1\n          : html.indexOf('-->', pos + 2)\n        if (end >= 0) {\n          scanner.comment(html.slice(pos + 4, end))\n          pos = end + 3\n        }\n        else {\n          noMoreCommentEnd = true\n          scanner.characters('<')\n          pos += 1\n        }\n        continue\n      }\n\n      // End tag\n      if (next === CH_SLASH) {\n        const c = html.charCodeAt(pos + 2)\n        if (!noMoreGt && pos + 2 < length && !isSpace(c) && c !== CH_GT) {\n          const end = html.indexOf('>', pos + 3)\n          if (end < 0) {\n            noMoreGt = true\n          }\n          else {\n            let nameEnd = pos + 2\n            while (nameEnd < end && !isSpace(html.charCodeAt(nameEnd)))\n              nameEnd++\n            scanner.endElement(html.slice(pos + 2, nameEnd))\n            pos = end + 1\n            continue\n          }\n        }\n        scanner.characters('<')\n        pos += 1\n        continue\n      }\n\n      // Start tag\n      if (isTagStart(next)) {\n        const end = parseStartTag(html, pos)\n        if (end < 0) {\n          // Unterminated tag: the rest is text. Trying again at every later\n          // `<` would rescan the rest each time, which is quadratic.\n          scanner.characters(html.slice(pos))\n          return\n        }\n        pos = end\n        continue\n      }\n\n      scanner.characters('<')\n      pos += 1\n    }\n\n    /** Parse the start tag at `start`, return the position after it or -1 if it is not closed */\n    function parseStartTag(html: string, start: number): number {\n      let i = start + 1\n\n      // Tag name\n      while (i < length) {\n        const c = html.charCodeAt(i)\n        if (isSpace(c) || c === CH_SLASH || c === CH_GT)\n          break\n        i++\n      }\n      const tagName = html.slice(start + 1, i)\n\n      const attrs: Record<string, any> = {}\n      let isSelfClose = false\n\n      while (true) {\n        // Skip whitespace and slashes (`<br />`) between attributes\n        while (i < length) {\n          const c = html.charCodeAt(i)\n          if (c === CH_SLASH) {\n            isSelfClose = true\n          }\n          else if (!isSpace(c)) {\n            break\n          }\n          i++\n        }\n        if (i >= length)\n          return -1\n\n        if (html.charCodeAt(i) === CH_GT) {\n          i++\n          break\n        }\n        isSelfClose = false\n\n        // Attribute name, may start with `=` or contain quotes like in browsers\n        const nameStart = i\n        i++\n        while (i < length) {\n          const c = html.charCodeAt(i)\n          if (isSpace(c) || c === CH_GT || c === CH_EQ)\n            break\n          i++\n        }\n        let name = html.slice(nameStart, i)\n        // `<a b/>` is self closing with attribute `b`\n        if (html.charCodeAt(i) === CH_GT && name.length > 1 && name.endsWith('/')) {\n          name = name.slice(0, -1)\n          isSelfClose = true\n        }\n\n        // Optional value\n        let j = i\n        while (j < length && isSpace(html.charCodeAt(j)))\n          j++\n        if (html.charCodeAt(j) !== CH_EQ) {\n          attrs[name] = true\n          continue\n        }\n        j++\n        while (j < length && isSpace(html.charCodeAt(j)))\n          j++\n        if (j >= length)\n          return -1\n\n        const q = html.charCodeAt(j)\n        if (q === CH_DQUOTE || q === CH_SQUOTE) {\n          const isDouble = q === CH_DQUOTE\n          const close = (isDouble ? noMoreDoubleQuote : noMoreSingleQuote)\n            ? -1\n            : html.indexOf(isDouble ? '\"' : '\\'', j + 1)\n          if (close >= 0) {\n            attrs[name] = html.slice(j + 1, close)\n            i = close + 1\n          }\n          else {\n            if (isDouble)\n              noMoreDoubleQuote = true\n            else\n              noMoreSingleQuote = true\n            // The quote is never closed: the value ends at the next `>`, so\n            // `<p title=\"x>a</p>` keeps the rest of the document as markup\n            const gt = html.indexOf('>', j + 1)\n            if (gt < 0)\n              return -1\n            attrs[name] = html.slice(j + 1, gt)\n            i = gt\n          }\n        }\n        else if (q === CH_GT) {\n          // `<a b=>`\n          attrs[name] = true\n          i = j\n        }\n        else {\n          const valueStart = j\n          while (j < length) {\n            const c = html.charCodeAt(j)\n            if (isSpace(c) || c === CH_GT)\n              break\n            j++\n          }\n          // Like in browsers a trailing slash belongs to the value:\n          // `<a href=http://x.com/>` keeps the URL and is not self closing\n          attrs[name] = html.slice(valueStart, j)\n          i = j\n        }\n      }\n\n      scanner.startElement(tagName, attrs, isSelfClose)\n\n      // Raw text elements\n      const lowerTagName = tagName.toLowerCase()\n      const isScript = lowerTagName === 'script'\n      if (isScript || lowerTagName === 'style') {\n        const endRe = isScript ? scriptEndRe : styleEndRe\n        endRe.lastIndex = i\n        // Without an end tag the rest of the input is the content, like in\n        // browsers. Parsed as markup, `&lt;/script&gt;` in it was decoded to\n        // a `</script>` inside the script and the rest became markup on render.\n        const textEnd = endRe.test(html)\n          ? endRe.lastIndex - (lowerTagName.length + 2)\n          : length\n        if (textEnd > i)\n          scanner.characters(html.slice(i, textEnd), true)\n        return textEnd\n      }\n      return i\n    }\n  }\n\n  return parse\n}\n","import { unescapeHTML } from './encoding'\nimport { SELF_CLOSING_TAGS } from './html'\nimport { createHtmlParser } from './htmlparser'\nimport { hasOwn } from './utils'\nimport { document, VDocType, VDocumentFragment, VElement, VHTMLDocument, VNode, VTextNode } from './vdom'\n\ninterface NodeBufferLike {\n  toString: (encoding?: any) => string\n}\n\n// Detect a Node-style Buffer without forcing `@types/node` on consumers.\nfunction isNodeBuffer(value: unknown): value is NodeBufferLike {\n  // eslint-disable-next-line node/prefer-global/buffer\n  const B = (globalThis as { Buffer?: { isBuffer?: (v: unknown) => boolean } }).Buffer\n  return !!B?.isBuffer?.(value)\n}\n\n// Makes sure we operate on VNodes\nexport function vdom(obj: VNode | NodeBufferLike | string | null = null): VNode {\n  if (obj instanceof VNode)\n    return obj\n  if (isNodeBuffer(obj))\n    obj = obj.toString('utf-8')\n  if (typeof obj === 'string')\n    return parseHTML(obj)\n  return new VDocumentFragment()\n}\n\n/**\n * Maximum nesting depth of parsed elements, the same limit as Chrome's HTML\n * parser. Deeper elements become siblings at this depth, so that recursive\n * code like the serializers can't overflow the call stack on hostile input.\n */\nexport const MAX_PARSE_DEPTH = 512\n\nexport function parseHTML(html: string): VDocumentFragment | VHTMLDocument {\n  if (typeof html !== 'string') {\n    console.error('parseHTML requires string, found', html)\n    throw new Error('parseHTML requires string')\n  }\n\n  const isDoc = html.startsWith('<!')\n  const frag = isDoc\n    ? new VHTMLDocument(true)\n    : new VDocumentFragment()\n  const stack: VNode[] = [frag]\n  // Lowercase tag names of the open elements in `stack` and how often each is\n  // open, so an end tag without an open element is ignored in O(1) instead of\n  // searching the whole stack, which is quadratic for many stray end tags\n  const stackNames: string[] = ['']\n  const openCount = new Map<string, number>()\n\n  // `stack[k]` is at depth k. Elements deeper than `MAX_PARSE_DEPTH` become\n  // children of the element one level above, i.e. siblings at the limit.\n  const elementParent = () => stack[Math.min(stack.length - 1, MAX_PARSE_DEPTH - 1)]\n\n  // Text goes into the innermost open element. Beyond the limit that element\n  // may have later siblings by now (`<b>…</b>` closed after it), then the\n  // text is appended after them, so the document order stays the same.\n  const textParent = () => {\n    const top = stack[stack.length - 1]!\n    if (stack.length - 1 < MAX_PARSE_DEPTH)\n      return top\n    const container = stack[MAX_PARSE_DEPTH - 1]!\n    return container.lastChild === top\n      ? top\n      : container\n  }\n\n  const parse = createHtmlParser({\n    startElement(tagName: string, attrs: Record<string, string>, isSelfClosing: boolean) {\n      const lowerTagName = tagName.toLowerCase()\n      if (lowerTagName === '!doctype') {\n        frag.docType = new VDocType()\n        return\n      }\n      for (const name in attrs) {\n        if (hasOwn(attrs, name) && typeof attrs[name] === 'string') {\n          attrs[name] = unescapeHTML(attrs[name])\n        }\n      }\n      const parentNode = elementParent()\n      if (parentNode) {\n        const element = document.createElement(tagName, attrs)\n        parentNode.appendChild(element)\n        if (!SELF_CLOSING_TAGS.includes(lowerTagName) && !isSelfClosing) {\n          stack.push(element)\n          stackNames.push(lowerTagName)\n          openCount.set(lowerTagName, (openCount.get(lowerTagName) ?? 0) + 1)\n        }\n      }\n    },\n    endElement(tagName: string) {\n      const lowerTagName = tagName.toLowerCase()\n      // Void elements are never pushed onto the stack (see startElement). A stray\n      // end tag for one - some real-world (mail) HTML emits `</meta>`, `</img>`,\n      // `</br>` - must therefore pop nothing.\n      if (SELF_CLOSING_TAGS.includes(lowerTagName) || !openCount.get(lowerTagName))\n        return\n      // Pop down to the nearest matching open element. Index 0 is the root\n      // document/fragment and is never popped, so an unmatched end tag (e.g.\n      // `</div>` with no open `div`) is ignored instead of underflowing the\n      // stack - which would otherwise orphan every following sibling, including\n      // the entire `<body>` after a malformed `<head>`.\n      while (stack.length > 1) {\n        const name = stackNames.pop()!\n        stack.pop()\n        openCount.set(name, openCount.get(name)! - 1)\n        if (name === lowerTagName)\n          return\n      }\n    },\n    characters(text: string, isRawText?: boolean) {\n      // Like in browsers `&lt;` in a script or style stays as it is. Decoded it\n      // became `<` and was rendered as such, so `&lt;/style&gt;` closed the\n      // element after a round trip and the rest of its content became markup.\n      if (!isRawText)\n        text = unescapeHTML(text)\n      const parentNode = textParent()\n      if (parentNode?.lastChild?.nodeType === VNode.TEXT_NODE) {\n        parentNode.lastChild._text += text\n      }\n      else if (parentNode) {\n        parentNode.appendChild(new VTextNode(text))\n      }\n    },\n    comment() {},\n  })\n  parse(html)\n  return frag\n}\n\n// Attach parser-dependent methods to VElement prototype\nVElement.prototype.setInnerHTML = function (html) {\n  const frag = parseHTML(html)\n  this._detachChildren()\n  this._childNodes = frag._childNodes\n  frag._childNodes = []\n  this._fixChildNodesParent()\n}\n\nVElement.prototype.insertAdjacentHTML = function (\n  position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend',\n  text: string,\n) {\n  let nodes: VNode[] = []\n  try {\n    const frag = parseHTML(text)\n    nodes = frag._childNodes.filter((n: any) => n instanceof VNode)\n  }\n  catch (e) {\n    // Only fallback if text is not valid HTML\n    if (/^\\s*<\\/?[a-zA-Z]/.test(text)) {\n      throw new Error('HTML parsing failed in insertAdjacentHTML')\n    }\n    nodes = [\n      new VTextNode(text),\n    ]\n  }\n  const insert = (parent: VNode, index: number) => {\n    parent._childNodes.splice(index, 0, ...nodes)\n    for (let i = 0; i < nodes.length; i++) {\n      nodes[i]!._parentNode = parent\n      nodes[i]!._index = index + i\n    }\n  }\n  switch (position) {\n    case 'beforebegin':\n    case 'afterend':\n      if (this.parentNode) {\n        const idx = this._indexInParent()\n        if (idx >= 0) {\n          insert(this.parentNode, position === 'beforebegin'\n            ? idx\n            : idx + 1)\n        }\n      }\n      break\n    case 'afterbegin':\n      insert(this, 0)\n      break\n    case 'beforeend':\n      insert(this, this._childNodes.length)\n      break\n  }\n}\n","import type { VDocumentFragment, VHTMLDocument } from './vdom'\nimport { parseHTML } from './vdomparser'\n\nexport function handleHTML(html: string, handler: (document: VHTMLDocument | VDocumentFragment) => void) {\n  const document = parseHTML(html)\n  handler(document)\n  return document.render()\n}\n","import type { VDocument } from './vdom'\nimport { VNode, VTextNode } from './vdom'\n\nexport const SELECTOR_BLOCK_ELEMENTS = 'meta,link,script,p,h1,h2,h3,h4,h5,h6,blockquote,div,ul,ol,li,article,section,footer,head,body,title,nav,hr,form'\nexport const TAGS_KEEP_CONTENT = ['PRE', 'CODE', 'SCRIPT', 'STYLE', 'TT']\n\n/**\n * Tags whose whole subtree is dropped by the Markdown and safe HTML\n * serializers: active content, metadata and embedded foreign documents.\n * `form` is deliberately missing, mail and newsletter HTML often wraps the\n * entire body in one and its content has to survive.\n */\nexport const SERIALIZE_DROP_TAGS: ReadonlySet<string> = new Set([\n  'script',\n  'style',\n  'head',\n  'title',\n  'iframe',\n  'object',\n  'embed',\n  'noscript',\n  'template',\n  'svg',\n  'math',\n  'link',\n  'meta',\n  'base',\n])\n\nfunction level(element: VNode): string {\n  let indent = ''\n  while (element.parentNode) {\n    indent += '  '\n    element = element.parentNode\n  }\n  return indent.slice(2)\n}\n\nexport function tidyDOM(document: VDocument) {\n  document.handle(SELECTOR_BLOCK_ELEMENTS, (e) => {\n    // Ignore if inside PRE etc.\n    let ee = e\n    while (ee) {\n      if (TAGS_KEEP_CONTENT.includes(ee.tagName))\n        return\n      ee = ee.parentNode\n    }\n\n    const parent = e.parentNode\n    if (!parent)\n      return\n\n    const prev = e.previousSibling\n    if (!prev || prev.nodeType !== VNode.TEXT_NODE || !prev.nodeValue?.endsWith('\\n')) {\n      parent.insertBefore(new VTextNode('\\n'), e)\n    }\n    parent.insertBefore(new VTextNode(level(e)), e)\n\n    const next = e.nextSibling\n    if (!next || next.nodeType !== VNode.TEXT_NODE || !next.nodeValue?.startsWith('\\n')) {\n      if (next) {\n        parent.insertBefore(new VTextNode('\\n'), next)\n      }\n      else {\n        parent.appendChild(new VTextNode('\\n'))\n      }\n    }\n\n    if (e.childNodes.length) {\n      const first = e.firstChild\n      if (first.nodeType === VNode.TEXT_NODE) {\n        e.insertBefore(new VTextNode(`\\n${level(e)}  `), first)\n      }\n      e.appendChild(new VTextNode(`\\n${level(e)}`))\n    }\n  })\n}\n","import type { VElement } from './vdom'\nimport { isUnsafeUrl } from './encoding'\nimport { SERIALIZE_DROP_TAGS } from './tidy'\nimport { hasOwn } from './utils'\nimport { isVElement, VNode } from './vdom'\n\ninterface SerializeContext {\n  level: number\n  mode?: 'ol' | 'ul'\n  /** Item counter of the enclosing ordered list */\n  counter?: { n: number }\n  /** Indentation for list items, aligned to the content of the parent item */\n  indent?: string\n  inLi?: boolean\n  /** Whitespace only text between elements is dropped, like between list items */\n  blockOnly?: boolean\n  /** Inside `<pre>` or inline code, text is literal */\n  pre?: boolean\n  /** Text only, for link labels and headings */\n  plainOnly?: boolean\n  /** Row counter of the enclosing table */\n  row?: { n: number }\n  /** Inline code collected during one run, see `protect` */\n  codes?: string[]\n  options?: SerializeMarkdownOptions\n}\n\nconst INLINE_STYLE_TAGS = new Set([\n  'b',\n  'strong',\n  'i',\n  'em',\n  'u',\n  'mark',\n  'tt',\n  'code',\n  'strike',\n  'del',\n  'ins',\n  'sub',\n  'sup',\n  'super',\n])\n\n// Placeholder delimiter for inline code, removed from regular text so it\n// cannot collide with the input\nconst CODE_MARK = '\\u0000'\nconst RX_CODE_MARK = /\\0/g\nconst RX_CODE_PLACEHOLDER = /\\0(\\d+)\\0/g\n\n// Whitespace as collapsed by browsers. Not `\\s`, a no-break space is kept.\nconst RX_WHITESPACE = /[ \\t\\n\\r\\f]+/g\nconst RX_WHITESPACE_ONLY = /^[ \\t\\n\\r\\f]+$/\n\n/** Whitespace moved out of inline markers, line breaks (block boundaries) are kept */\nfunction outside(ws: string): string {\n  if (!ws)\n    return ''\n  return ws.includes('\\n')\n    ? ws\n    : ' '\n}\n\n/**\n * Wrap inline content in markers. Leading and trailing whitespace goes\n * outside: `foo<b> bar</b>` must become `foo **bar**`, because `** bar**` is\n * not emphasis in Markdown. Content without such whitespace is unchanged.\n */\nfunction wrapInline(content: string, open: string, close = open): string {\n  // `trimStart` / `trimEnd` instead of `/^(\\s*)([\\s\\S]*?)(\\s*)$/`, which is\n  // quadratic for long runs of whitespace inside the content\n  const start = content.length - content.trimStart().length\n  const inner = content.trim()\n  const lead = content.slice(0, start)\n  const trail = content.slice(start + inner.length)\n  if (!inner)\n    return outside(lead + trail)\n  return `${outside(lead)}${open}${inner}${close}${outside(trail)}`\n}\n\n/**\n * Text that looks like markup: `<` before a letter, `/`, `!` or `?`. Markdown\n * passes HTML through, so `&lt;img onerror=…&gt;` in the HTML became a real\n * `<img onerror=…>` in the Markdown. `&lt;` shows the same `<` when rendered.\n */\nfunction escapeMarkup(text: string): string {\n  return text.replace(/<(?=[a-z/!?])/gi, '&lt;')\n}\n\n/**\n * Attribute value without the placeholder delimiter of inline code, see\n * `protect`. Text has it removed already, but in `href` or `alt` a\n * `\\0<n>\\0` was replaced with the content of the n-th inline code, which\n * could end the link target and add a `javascript:` link.\n */\nfunction attr(node: VElement, name: string): string | null {\n  const value = node.getAttribute(name)\n  return value == null\n    ? null\n    : value.replace(RX_CODE_MARK, '')\n}\n\n/** Text in `[…]`, a `]` would end the label */\nfunction escapeLabel(text: string): string {\n  return text.replace(/[[\\]]/g, '\\\\$&')\n}\n\n/**\n * Link and image targets: characters that would end the target (`)`, spaces)\n * or an autolink (`>`) are percent-encoded, otherwise\n * `href=\"x)<img onerror=…>\"` left the rest of the URL as raw HTML.\n */\nfunction escapeUrl(url: string): string {\n  // Leading and trailing spaces and control characters are ignored by browsers\n  let start = 0\n  let end = url.length\n  while (start < end && url.charCodeAt(start) <= 32)\n    start++\n  while (end > start && url.charCodeAt(end - 1) <= 32)\n    end--\n  return url.slice(start, end).replace(/[\\s()<>]/g, c => c === '('\n    ? '%28'\n    : c === ')'\n      ? '%29'\n      : encodeURIComponent(c))\n}\n\n/** A run of backticks longer than any in `text`, so the content can't close the code block */\nfunction fenceFor(text: string): string {\n  let longest = 2\n  for (const run of text.match(/`+/g) ?? [])\n    longest = Math.max(longest, run.length)\n  return '`'.repeat(longest + 1)\n}\n\n/** Inline code is swapped for a placeholder, so collapsing whitespace and wrapping leave it alone */\nfunction protect(code: string, ctx?: SerializeContext): string {\n  const codes = ctx?.codes\n  if (!codes)\n    return code\n  codes.push(code.replace(/\\n/g, ' '))\n  return `${CODE_MARK}${codes.length - 1}${CODE_MARK}`\n}\n\n// `==` is highlighting and not a code span, so markup in it has to be escaped\nfunction inlineCode(node: VElement, h: (ctx?: Partial<SerializeContext>) => string, ctx?: SerializeContext): string {\n  const code = h({ pre: true })\n  // `<pre><code>` is a code block already, its text stays literal\n  if (ctx?.pre)\n    return code\n  const start = code.length - code.trimStart().length\n  const inner = code.trim()\n  const lead = code.slice(0, start)\n  const trail = code.slice(start + inner.length)\n  if (!inner)\n    return outside(lead + trail)\n  return `${outside(lead)}==${protect(escapeMarkup(inner), ctx)}==${outside(trail)}`\n}\n\nfunction headingAnchor(node: VElement, ctx?: SerializeContext): string {\n  if (!ctx?.options?.headingAnchors)\n    return ''\n  // Only characters that can't end the attribute block\n  const id = (node.getAttribute('id') ?? '').replace(/[^\\w\\-.:]/g, '')\n  return id\n    ? ` {#${id}}`\n    : ''\n}\n\nfunction heading(prefix: string) {\n  return (node: VElement, h: (ctx?: Partial<SerializeContext>) => string, ctx?: SerializeContext) =>\n    `\\n\\n${prefix} ${h({ plainOnly: true }).trim()}${headingAnchor(node, ctx)}\\n\\n`\n}\n\nfunction list(mode: 'ol' | 'ul') {\n  return (node: VElement, h: (ctx?: Partial<SerializeContext>) => string, ctx?: SerializeContext) => {\n    const level = (ctx?.level ?? 0) + 1\n    // A list nested directly in a list (no `li` in between, invalid but\n    // common) still has to be indented to show up as nested\n    const indent = level > 1 && !ctx?.inLi\n      ? `${ctx?.indent ?? ''}  `\n      : ctx?.indent ?? ''\n    // `<ol start=\"3\">` counts from 3, like in browsers\n    const start = Number.parseInt(node.getAttribute('start') ?? '', 10)\n    const inner = h({\n      level,\n      mode,\n      indent,\n      counter: mode === 'ol'\n        ? {\n            n: Number.isFinite(start)\n              ? start - 1\n              : 0,\n          }\n        : undefined,\n      inLi: false,\n      blockOnly: true,\n    })\n    if (level === 1)\n      return `\\n\\n${inner}\\n\\n`\n    // Inside an item the list starts on a new line after the item text, a\n    // directly nested list follows the previous item, which ends in one\n    return ctx?.inLi\n      ? `\\n${inner}`\n      : inner\n  }\n}\n\nfunction cell(node: VElement, h: (ctx?: Partial<SerializeContext>) => string) {\n  // A cell is one line in Markdown\n  return ` ${h({ blockOnly: false }).trim().replace(/\\n+/g, ' ').replace(/\\|/g, '\\\\|')} |`\n}\n\nfunction block(node: VElement, h: (ctx?: Partial<SerializeContext>) => string, ctx?: SerializeContext) {\n  // An item stays one line, but its blocks must not run into each other\n  return ctx?.inLi\n    ? ` ${h()} `\n    : `\\n\\n${h()}\\n\\n`\n}\n\n// Build rules map only once for performance\nconst rules: Record<string, (node: VElement, handleChildren: (ctx?: Partial<SerializeContext>) => string, ctx?: SerializeContext) => string> = {\n  b: (node, h) => wrapInline(h(), '**'),\n  strong: (node, h) => wrapInline(h(), '**'),\n  i: (node, h) => wrapInline(h(), '*'),\n  em: (node, h) => wrapInline(h(), '*'),\n  u: (node, h) => wrapInline(h(), '<u>', '</u>'),\n  mark: (node, h) => wrapInline(h(), '=='),\n  tt: inlineCode,\n  code: inlineCode,\n  strike: (node, h) => wrapInline(h(), '~~'),\n  sub: (node, h) => wrapInline(h(), '~'),\n  super: (node, h) => wrapInline(h(), '^'),\n  sup: (node, h) => wrapInline(h(), '^'),\n  li: (node, h, ctx) => {\n    const indent = ctx?.indent ?? ''\n    let marker = '- '\n    if (ctx?.mode === 'ol' && ctx.counter) {\n      ctx.counter.n += 1\n      marker = `${ctx.counter.n}. `\n    }\n    // Nested lists line up with the content of this item: 2 spaces after\n    // `- `, 3 after `1. `, otherwise CommonMark does not see them as nested\n    const content = h({\n      inLi: true,\n      blockOnly: false,\n      indent: indent + ' '.repeat(marker.length),\n    }).trim()\n    return `${indent}${marker}${content}\\n`\n  },\n  br: () => `\\n`,\n  ol: list('ol'),\n  ul: list('ul'),\n  blockquote: (node, h) => {\n    // Every line is quoted, not only the first\n    const lines = h({ blockOnly: false }).trim().replace(/\\n{3,}/g, '\\n\\n').split('\\n')\n    return `\\n\\n${lines.map(l => l.trim()\n      ? `> ${l}`\n      : '>').join('\\n')}\\n\\n`\n  },\n  pre: (node, h) => {\n    const content = h({ pre: true })\n    const fence = fenceFor(content)\n    return `\\n\\n${fence}\\n${content}\\n${fence}\\n\\n`\n  },\n  p: block,\n  div: block,\n  h1: heading('#'),\n  h2: heading('##'),\n  h3: heading('###'),\n  h4: heading('####'),\n  h5: heading('#####'),\n  h6: heading('######'),\n  hr: () => `\\n\\n---\\n\\n`,\n  a: (node, h, ctx) => {\n    const text = h({ plainOnly: true }).trim()\n    // A `javascript:` link would run script when clicked in the rendered Markdown\n    if (isUnsafeUrl(attr(node, 'href') ?? ''))\n      return text\n    const href = escapeUrl(attr(node, 'href') ?? '#')\n    if (ctx?.options?.linkStyle === 'autolink') {\n      if (!text || text === href)\n        return `<${href}>`\n      return `${text} <${href}>`\n    }\n    return `[${escapeLabel(text)}](${href})`\n  },\n  img: (node, _h, ctx) => {\n    const style = ctx?.options?.imageStyle ?? 'full'\n    if (style === 'none')\n      return ''\n    const alt = escapeLabel(escapeMarkup((attr(node, 'alt') ?? '').trim()))\n    if (style === 'alt') {\n      return alt\n        ? `[${alt}]`\n        : ''\n    }\n    if (isUnsafeUrl(attr(node, 'src') ?? '', true))\n      return ''\n    const src = escapeUrl(attr(node, 'src') ?? '')\n    if (ctx?.options?.linkStyle === 'autolink') {\n      if (!alt || alt === src)\n        return `<${src}>`\n      return `${alt} <${src}>`\n    }\n    return `![${alt}](${src})`\n  },\n  del: (node, h) => wrapInline(h(), '~~'),\n  ins: (node, h) => wrapInline(h(), '++'),\n  span: (node, h) => h(),\n  table: (node, h) => `\\n\\n${h({\n    blockOnly: true,\n    row: { n: 0 },\n  })}\\n\\n`,\n  tr: (node, h, ctx) => {\n    // Every cell ends with ` |` itself, so the row only adds the leading pipe\n    const row = `|${h({ blockOnly: true })}\\n`\n    // GFM renders a table only with a delimiter row below the header, which\n    // is the first row and only that one\n    const isFirst = !ctx?.row || ctx.row.n++ === 0\n    const cells = node.childNodes.filter(c => isVElement(c) && ['td', 'th'].includes(c.tagName.toLowerCase())) as VElement[]\n    if (isFirst && cells.length > 0 && cells.every(c => c.tagName.toLowerCase() === 'th'))\n      return `${row}|${' --- |'.repeat(cells.length)}\\n`\n    return row\n  },\n  th: cell,\n  td: cell,\n  caption: (node, h) => `\\n${h()}\\n`,\n}\n\nfunction serialize(node: VNode | VElement, context: SerializeContext = {\n  level: 0,\n}): string {\n  // A document (`parseHTML` of a complete page) is walked like a fragment,\n  // otherwise it fell through to plain `textContent` below\n  if (node.nodeType === VNode.DOCUMENT_FRAGMENT_NODE || node.nodeType === VNode.DOCUMENT_NODE) {\n    return (node.childNodes || []).map(c => serialize(c, { ...context })).join('')\n  }\n  else if (isVElement(node)) {\n    const tag: string = node.tagName.toLowerCase()\n    if (SERIALIZE_DROP_TAGS.has(tag))\n      return ''\n    const handleChildren = (ctx?: Partial<SerializeContext>): string => (node.childNodes || []).map(c => serialize(c, {\n      ...context,\n      ...ctx,\n    })).join('')\n    if (context.plainOnly) {\n      if (tag === 'img')\n        return escapeMarkup((attr(node, 'alt') ?? '').trim())\n      if (tag === 'br')\n        return ' '\n      return handleChildren()\n    }\n    if (context.options?.inlineStyles === false && INLINE_STYLE_TAGS.has(tag))\n      return handleChildren()\n    // Own properties only, `<constructor>` found `Object` before\n    const fn = hasOwn(rules, tag)\n      ? rules[tag]\n      : undefined\n    if (fn)\n      return fn(node as VElement, handleChildren, context)\n    else\n      return handleChildren()\n  }\n  const text = (node.textContent ?? '').replace(RX_CODE_MARK, '')\n  if (context.pre)\n    return text\n  if (text === '')\n    return ''\n  // Whitespace collapses like in a browser\n  if (RX_WHITESPACE_ONLY.test(text)) {\n    return context.blockOnly\n      ? ''\n      : ' '\n  }\n  return escapeMarkup(text.replace(RX_WHITESPACE, ' '))\n}\n\nexport interface SerializeMarkdownOptions {\n  /** Wrap column for soft-wrapping long lines. `0` or omitted disables wrapping. */\n  wrap?: number\n  /**\n   * How `<a href=\"…\">…</a>` and `<img src=\"…\" alt=\"…\">` are rendered.\n   * - `'inline'` (default): `[text](url)` / `![alt](src)` — standard inline syntax\n   * - `'autolink'`: `text <url>` / `alt <src>` — label followed by an autolink\n   *   (or just `<url>` / `<src>` if the label is empty or equals the URL)\n   */\n  linkStyle?: 'inline' | 'autolink'\n  /**\n   * When `false`, inline text-styling tags (`b`, `strong`, `i`, `em`, `u`, `mark`,\n   * `tt`, `code`, `strike`, `del`, `ins`, `sub`, `sup`) are unwrapped and rendered\n   * as plain text. Default `true` (styles preserved).\n   */\n  inlineStyles?: boolean\n  /**\n   * How `<img src=\"…\" alt=\"…\">` is rendered.\n   * - `'full'` (default): `![alt](src)` (or autolink form when `linkStyle: 'autolink'`)\n   * - `'alt'`: only the alt text in brackets (`[alt]`), no URL; empty alt → omitted\n   * - `'none'`: image is stripped entirely\n   */\n  imageStyle?: 'full' | 'alt' | 'none'\n  /**\n   * Append the `id` of a heading as ` {#id}` (Pandoc / kramdown style anchor).\n   * Not part of CommonMark or GFM, there it shows up as literal text.\n   * Default `false`.\n   */\n  headingAnchors?: boolean\n}\n\nexport function serializeMarkdown(node: VNode, options: SerializeMarkdownOptions = {}): string {\n  const codes: string[] = []\n  const raw = serialize(node, { level: 0, options, codes })\n  let out = `${collapseWhitespace(raw).replace(/\\n{3,}/g, '\\n\\n').trim()}\\n`\n  if (options.wrap && options.wrap > 0)\n    out = wrapMarkdown(out, options.wrap)\n  return codes.length\n    ? out.replace(RX_CODE_PLACEHOLDER, (_, i) => codes[Number(i)] ?? '')\n    : out\n}\n\n/**\n * Tracks fenced code blocks line by line. A fence closes only with a run of\n * at least as many backticks, so a line with ``` inside a longer fence stays\n * code. Returns `true` for lines that are part of a block, fences included.\n */\nfunction createFenceTracker() {\n  let open = 0\n  return (line: string): boolean => {\n    const m = line.match(/^\\s*(`{3,})\\s*$/) ?? (open\n      ? null\n      : line.match(/^\\s*(`{3,})/))\n    if (m) {\n      const length = m[1]!.length\n      if (!open) {\n        open = length\n        return true\n      }\n      if (length >= open) {\n        open = 0\n        return true\n      }\n    }\n    return open > 0\n  }\n}\n\nconst RX_LIST_ITEM = /^[ \\t]*(?:[-*+]|\\d+\\.)[ \\t]/\n\n// Outside fenced code blocks: collapse runs of horizontal whitespace inside a\n// line to a single space and drop whitespace at the end of a line. Leading\n// whitespace is kept only where the serializer created it on purpose, the\n// indentation of nested list items. Anywhere else it is a leftover of the\n// source formatting, and 4 spaces would turn a paragraph into a code block.\n// Inline code is protected by placeholders, see `protect`.\nfunction collapseWhitespace(text: string): string {\n  const inFence = createFenceTracker()\n  const result: string[] = []\n  for (const line of text.split('\\n')) {\n    if (inFence(line)) {\n      result.push(line)\n      continue\n    }\n    let i = 0\n    if (RX_LIST_ITEM.test(line)) {\n      while (i < line.length && (line[i] === ' ' || line[i] === '\\t'))\n        i++\n    }\n    const body = line.slice(i).replace(/[ \\t]+/g, ' ').replace(/^ | $/g, '')\n    result.push(body\n      ? line.slice(0, i) + body\n      : '')\n  }\n  return result.join('\\n')\n}\n\nfunction wrapMarkdown(text: string, width: number): string {\n  const inFence = createFenceTracker()\n  const result: string[] = []\n  for (const line of text.split('\\n')) {\n    if (inFence(line) || line.length <= width || /^\\s*\\|/.test(line)) {\n      result.push(line)\n      continue\n    }\n    const m = line.match(/^(\\s*)((?:[-*+]\\s+|\\d+\\.\\s+|>\\s+)?)/)\n    const indent = m?.[1] ?? ''\n    const marker = m?.[2] ?? ''\n    const contIndent = indent + ' '.repeat(marker.length)\n    const head = indent + marker\n    const body = line.slice(head.length)\n    const words = body.split(/\\s+/).filter(Boolean)\n    if (words.length === 0) {\n      result.push(line)\n      continue\n    }\n    let current = head + words.shift()\n    for (const word of words) {\n      if (current.length + 1 + word.length > width) {\n        result.push(current)\n        current = contIndent + word\n      }\n      else {\n        current += ` ${word}`\n      }\n    }\n    result.push(current)\n  }\n  return result.join('\\n')\n}\n","import type { VElement } from './vdom'\nimport { SELECTOR_BLOCK_ELEMENTS } from './tidy'\nimport { isVElement, VNode } from './vdom'\n\n// Built once, not for every element\nconst BLOCK_TAGS = new Set(SELECTOR_BLOCK_ELEMENTS.split(','))\nconst DROP_TAGS = new Set(['title', 'script', 'style'])\n\ninterface SerializeContext {\n  level: number\n  count: 0\n  mode?: 'ol' | 'ul'\n}\n\nfunction serialize(node: VNode | VElement, context: SerializeContext = {\n  level: 0,\n  count: 0,\n}): string {\n  // A document is walked exactly like a fragment. Without this it fell\n  // through to the `textContent` branch at the bottom, which loses every\n  // block boundary and includes the raw text of `<title>` and `<style>`.\n  // `parseHTML` of any complete page returns a document.\n  if (node.nodeType === VNode.DOCUMENT_FRAGMENT_NODE || node.nodeType === VNode.DOCUMENT_NODE) {\n    return node.childNodes.map(c => serialize(c, { ...context })).join('')\n  }\n\n  else if (isVElement(node)) {\n    const tag: string = node.tagName.toLowerCase()\n\n    const handleChildren = (ctx?: Partial<SerializeContext>): string => node.childNodes.map(c => serialize(c, {\n      ...context,\n      ...ctx,\n    })).join('')\n\n    // Order as before: dropped tags win over `br`, which wins over blocks.\n    // `SELECTOR_BLOCK_ELEMENTS` lists `title` and `script` itself.\n    if (DROP_TAGS.has(tag))\n      return ''\n    if (tag === 'br')\n      return `${handleChildren()}\\n`\n    if (BLOCK_TAGS.has(tag))\n      return `\\n\\n${handleChildren().trim()}\\n\\n`\n    return handleChildren()\n  }\n  return node.textContent ?? ''\n}\n\nexport function serializePlaintext(node: VNode): string {\n  return `${serialize(node).replace(/\\n{2,}/g, '\\n\\n').trim()}\\n`\n}\n","import type { VElement } from './vdom'\nimport { escapeHTML } from './encoding'\nimport { SERIALIZE_DROP_TAGS } from './tidy'\nimport { isVElement, VNode } from './vdom'\nimport { parseHTML } from './vdomparser'\n\nexport const SELECTOR_BLOCK_ELEMENTS = 'p,h1,h2,h3,h4,h5,h6,blockquote,div,ul,ol,li,article,section,footer,nav,hr,form'\n\nconst BLOCK_TAGS = new Set(SELECTOR_BLOCK_ELEMENTS.split(','))\n\nconst DEFAULT_INLINE_TAGS = [\n  'strong',\n  'b',\n  'em',\n  'i',\n  'u',\n  's',\n  'strike',\n  'small',\n  'sub',\n  'sup',\n  'code',\n  'pre',\n  'kbd',\n  'samp',\n  'var',\n  'mark',\n  'span',\n]\n\nconst DEFAULT_TABLE_TAGS = [\n  'table',\n  'thead',\n  'tbody',\n  'tfoot',\n  'tr',\n  'th',\n  'td',\n  'caption',\n]\n\n/**\n * Tags kept by default: block, inline and table elements, links, images and\n * line breaks. Other tags are unwrapped, their content stays. `form` is\n * unwrapped as well: the element is useless without its attributes and\n * controls, and its content (often a whole mail body) has to survive.\n */\nexport const DEFAULT_ALLOWED_TAGS: readonly string[] = [\n  ...new Set([\n    ...SELECTOR_BLOCK_ELEMENTS.split(',').filter(t => t !== 'form'),\n    ...DEFAULT_INLINE_TAGS,\n    ...DEFAULT_TABLE_TAGS,\n    'a',\n    'img',\n    'br',\n  ]),\n]\n\n/** Attributes kept by default, per tag. The key `'*'` applies to every tag. */\nexport const DEFAULT_ALLOWED_ATTRS: Readonly<Record<string, readonly string[]>> = {\n  a: ['href', 'title'],\n  img: [\n    'src',\n    'alt',\n    'title',\n    'width',\n    'height',\n  ],\n  th: ['colspan', 'rowspan', 'scope'],\n  td: ['colspan', 'rowspan'],\n}\n\n/**\n * Schemes for `allowedUrlSchemes` when only well known links should pass.\n * Not the default: without `allowedUrlSchemes` every scheme passes except\n * the ones that run script.\n */\nexport const DEFAULT_ALLOWED_URL_SCHEMES: readonly string[] = ['http:', 'https:', 'mailto:', 'tel:']\n\n/** Attributes holding a URL, checked like `href` and `src` when allowed */\nconst URL_ATTRS = new Set([\n  'href',\n  'src',\n  'action',\n  'formaction',\n  'xlink:href',\n  'poster',\n  'cite',\n  'background',\n  'data',\n  'codebase',\n  'longdesc',\n  'ping',\n])\n\n/**\n * Attributes that never pass, whatever `allowedAttrs` says: event handlers\n * run script, `srcdoc` is a whole document. `style` passes when allowed\n * explicitly, it can't run script in current browsers but can restyle and\n * load URLs.\n */\nfunction isForbiddenAttr(attr: string): boolean {\n  return attr.startsWith('on') || attr === 'srcdoc'\n}\n\nconst VOID_TAGS = new Set([\n  'br',\n  'hr',\n  'img',\n  'input',\n  'meta',\n  'link',\n  'source',\n  'col',\n  'wbr',\n  'area',\n  'base',\n  'embed',\n  'param',\n  'track',\n])\n\nexport interface SafeHTMLOptions {\n  /** Tag names to keep, others are unwrapped. Default {@link DEFAULT_ALLOWED_TAGS}. */\n  allowedTags?: readonly string[]\n  /** Attribute names to keep, per tag. The key `'*'` applies to every tag. Default {@link DEFAULT_ALLOWED_ATTRS}. */\n  allowedAttrs?: Readonly<Record<string, readonly string[]>>\n  /**\n   * Schemes allowed in `href` and `src`, like `'https:'`. Default: every\n   * scheme except `javascript:`, `vbscript:` and `data:`, which keeps `cid:`\n   * images in mails and custom app schemes. See {@link DEFAULT_ALLOWED_URL_SCHEMES}.\n   */\n  allowedUrlSchemes?: readonly string[]\n  /** Allow URLs without scheme: relative paths, fragments, protocol relative. Default `true`. */\n  allowRelativeUrls?: boolean\n  /** Allow `data:image/…` in the `src` of an image. Default `true`. */\n  allowDataImages?: boolean\n  /** `rel` added to every link. Default `'noopener noreferrer'`, `''` keeps the allowed `rel` of the source. */\n  linkRel?: string\n  /** `target` added to every link. Default `'_blank'`, `''` keeps the allowed `target` of the source. */\n  linkTarget?: string\n}\n\ninterface ResolvedOptions {\n  allowedTags: Set<string>\n  allowedAttrs: Map<string, string[]>\n  allowedUrlSchemes?: Set<string>\n  allowRelativeUrls: boolean\n  allowDataImages: boolean\n  linkRel: string\n  linkTarget: string\n}\n\nfunction resolveOptions(opts: SafeHTMLOptions = {}): ResolvedOptions {\n  const source = opts.allowedAttrs ?? DEFAULT_ALLOWED_ATTRS\n  const global = (source['*'] ?? []).map(a => a.toLowerCase())\n  const allowedAttrs = new Map<string, string[]>()\n  for (const [tag, list] of Object.entries(source)) {\n    if (tag !== '*') {\n      allowedAttrs.set(tag.toLowerCase(), [\n        ...new Set([\n          ...list.map(a => a.toLowerCase()),\n          ...global,\n        ]),\n      ])\n    }\n  }\n  allowedAttrs.set('*', global)\n  return {\n    allowedTags: new Set((opts.allowedTags ?? DEFAULT_ALLOWED_TAGS).map(t => t.toLowerCase())),\n    allowedAttrs,\n    allowedUrlSchemes: opts.allowedUrlSchemes\n      ? new Set(opts.allowedUrlSchemes.map(s => s.toLowerCase()))\n      : undefined,\n    allowRelativeUrls: opts.allowRelativeUrls ?? true,\n    allowDataImages: opts.allowDataImages ?? true,\n    linkRel: opts.linkRel ?? 'noopener noreferrer',\n    linkTarget: opts.linkTarget ?? '_blank',\n  }\n}\n\nconst DEFAULT_OPTIONS = resolveOptions()\n\n/** Browsers ignore control characters inside the scheme (`java\\tscript:`) and whitespace around the URL */\nfunction normalizeUrl(url: string): string {\n  // eslint-disable-next-line no-control-regex\n  return url.replace(/[\\x00-\\x1F\\x7F]/g, '').trim()\n}\n\nfunction isSafeUrl(url: string, attr: string, tag: string, opts: ResolvedOptions): boolean {\n  if (url === '')\n    return false\n  const scheme = url.match(/^([a-z][a-z0-9+.-]*):/i)?.[1]?.toLowerCase()\n  if (!scheme)\n    return opts.allowRelativeUrls\n  if (scheme === 'data')\n    return opts.allowDataImages && tag === 'img' && attr === 'src' && /^data:image\\//i.test(url)\n  if (opts.allowedUrlSchemes)\n    return opts.allowedUrlSchemes.has(`${scheme}:`)\n  return scheme !== 'javascript' && scheme !== 'vbscript'\n}\n\n/** Allowed attributes of `node`, URLs validated. Names in `skip` are rendered by the caller. */\nfunction renderAttrs(node: VElement, tag: string, opts: ResolvedOptions, skip?: readonly string[]): string {\n  let out = ''\n  for (const attr of opts.allowedAttrs.get(tag) ?? opts.allowedAttrs.get('*')!) {\n    if (skip?.includes(attr))\n      continue\n    if (isForbiddenAttr(attr))\n      continue\n    let value = node.getAttribute(attr)\n    if (value == null)\n      continue\n    if (attr === 'srcset') {\n      // Every candidate URL must be safe, `url 2x, url 640w`\n      const urls = value.split(',').map(c => normalizeUrl(c).split(/\\s+/)[0] ?? '').filter(Boolean)\n      if (!urls.every(u => isSafeUrl(u, 'src', tag, opts)))\n        continue\n    }\n    else if (URL_ATTRS.has(attr)) {\n      value = normalizeUrl(value)\n      if (!isSafeUrl(value, attr, tag, opts))\n        continue\n    }\n    out += ` ${attr}=\"${escapeHTML(value)}\"`\n  }\n  return out\n}\n\nfunction renderElement(node: VElement, tag: string, children: string, opts: ResolvedOptions): string {\n  // `href` of a link and `src` of an image are the point of the element, so\n  // they are written whatever the allowed attributes say. A link with an\n  // unsafe target is unwrapped, an image without a safe source dropped.\n  if (tag === 'a') {\n    const href = normalizeUrl(node.getAttribute('href') ?? '')\n    if (!isSafeUrl(href, 'href', 'a', opts))\n      return children\n    // `rel` and `target` of the source must not override the enforced ones\n    const skip = ['href']\n    if (opts.linkRel)\n      skip.push('rel')\n    if (opts.linkTarget)\n      skip.push('target')\n    const rel = opts.linkRel\n      ? ` rel=\"${escapeHTML(opts.linkRel)}\"`\n      : ''\n    const target = opts.linkTarget\n      ? ` target=\"${escapeHTML(opts.linkTarget)}\"`\n      : ''\n    return `<a href=\"${escapeHTML(href)}\"${renderAttrs(node, 'a', opts, skip)}${rel}${target}>${children}</a>`\n  }\n  if (tag === 'img') {\n    const src = normalizeUrl(node.getAttribute('src') ?? '')\n    if (!isSafeUrl(src, 'src', 'img', opts))\n      return ''\n    return `<img src=\"${escapeHTML(src)}\"${renderAttrs(node, 'img', opts, ['src'])}>`\n  }\n  const attrs = renderAttrs(node, tag, opts)\n  if (VOID_TAGS.has(tag))\n    return `<${tag}${attrs}>`\n  const inner = BLOCK_TAGS.has(tag)\n    ? children.trim()\n    : children\n  return `<${tag}${attrs}>${inner}</${tag}>`\n}\n\nfunction serialize(node: VNode, opts: ResolvedOptions): string {\n  // A document (`parseHTML` of a complete page) is walked like a fragment,\n  // otherwise it fell through to `textContent` below and lost all markup\n  if (node.nodeType === VNode.DOCUMENT_FRAGMENT_NODE || node.nodeType === VNode.DOCUMENT_NODE)\n    return (node.childNodes || []).map(c => serialize(c, opts)).join('')\n  if (isVElement(node)) {\n    const tag = node.tagName.toLowerCase()\n    if (SERIALIZE_DROP_TAGS.has(tag))\n      return ''\n    const children = (node.childNodes || []).map(c => serialize(c, opts)).join('')\n    if (!opts.allowedTags.has(tag))\n      return children\n    return renderElement(node, tag, children, opts)\n  }\n  return escapeHTML(node.textContent ?? '')\n}\n\n/**\n * HTML of untrusted origin reduced to the allowed tags and attributes, see\n * {@link SafeHTMLOptions}. Scripts, styles, embedded documents and event\n * handlers never pass, links get `rel=\"noopener noreferrer\" target=\"_blank\"`.\n */\nexport function serializeSafeHTML(node: VNode, options?: SafeHTMLOptions): string {\n  return serialize(node, options\n    ? resolveOptions(options)\n    : DEFAULT_OPTIONS).trim()\n}\n\nexport function safeHTML(html: string, options?: SafeHTMLOptions): string {\n  return serializeSafeHTML(parseHTML(html), options)\n}\n","import type { VDocumentFragment, VElement } from './vdom'\nimport { hArgumentParser } from './h'\nimport { markup } from './html'\nimport './jsx-runtime'\n\nexport function xml(\n  itag: string | ((props: any) => VElement | VDocumentFragment),\n  iattrs?: Record<string, unknown> | unknown[] | null,\n  ...ichildren: any[]\n) {\n  const { tag, attrs, children } = hArgumentParser(itag, iattrs, ...ichildren)\n  return markup(true, tag as string, attrs, children)\n}\n\n// export const xmlVDOM = markup.bind(null, true)\n\nxml.firstLine = '<?xml version=\"1.0\" encoding=\"utf-8\"?>'\nxml.xml = true\n\nexport const h = xml\n"],"mappings":";;;;AASA,MAAM,SAAS;AACf,MAAM,QAAQ;AACd,MAAM,WAAW;AACjB,MAAM,UAAU;AAChB,MAAM,YAAY;AAClB,MAAM,YAAY;AAClB,MAAM,WAAW;AACjB,MAAM,QAAQ;AACd,MAAM,QAAQ;AACd,MAAM,QAAQ;AACd,MAAM,cAAc;AAGpB,SAAS,QAAQ,GAAW;CAC1B,IAAI,KAAK,UACP,OAAO,MAAM,YAAa,KAAK,UAAU,KAAK;CAChD,IAAI,IAAI,KACN,OAAO;CACT,OAAO,MAAM,OAAQ,MAAM,QAAW,KAAK,QAAU,KAAK,QAAW,MAAM,QAAU,MAAM,QAAU,MAAM,QAAU,MAAM,QAAU,MAAM,SAAU,MAAM;AAC7J;AAIA,SAAS,WAAW,GAAW;CAC7B,OAAQ,K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