@gjsify/domparser 0.41.0 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +42 -7
  2. package/lib/esm/canonical.js +3 -0
  3. package/lib/esm/dom/comment.js +1 -0
  4. package/lib/esm/dom/doctype.js +1 -0
  5. package/lib/esm/dom/document.js +1 -0
  6. package/lib/esm/dom/element.js +1 -0
  7. package/lib/esm/dom/fragment.js +1 -0
  8. package/lib/esm/dom/node.js +1 -0
  9. package/lib/esm/dom/reader.js +1 -0
  10. package/lib/esm/dom/serialize.js +1 -0
  11. package/lib/esm/dom/text.js +1 -0
  12. package/lib/esm/dom-adapter.js +1 -0
  13. package/lib/esm/dom-parser.js +1 -0
  14. package/lib/esm/entities/data.js +2 -0
  15. package/lib/esm/entities/decode.js +1 -0
  16. package/lib/esm/entities/index.js +1 -0
  17. package/lib/esm/html/implied-end-tags.js +1 -0
  18. package/lib/esm/html/index.js +1 -0
  19. package/lib/esm/html/text-elements.js +1 -0
  20. package/lib/esm/html/tokenizer.js +3 -0
  21. package/lib/esm/html/tree-builder.js +3 -0
  22. package/lib/esm/html/tree-sink.js +0 -0
  23. package/lib/esm/html/void-elements.js +1 -0
  24. package/lib/esm/index.js +1 -1
  25. package/lib/esm/register.js +1 -1
  26. package/lib/esm/selectors/adapter.js +0 -0
  27. package/lib/esm/selectors/compile.js +1 -0
  28. package/lib/esm/selectors/index.js +1 -0
  29. package/lib/esm/selectors/nth.js +1 -0
  30. package/lib/esm/selectors/parse.js +2 -0
  31. package/lib/esm/selectors/query.js +1 -0
  32. package/lib/esm/xml/parse-xml.js +1 -0
  33. package/lib/types/canonical.d.ts +27 -0
  34. package/lib/types/dom/comment.d.ts +5 -0
  35. package/lib/types/dom/doctype.d.ts +7 -0
  36. package/lib/types/dom/document.d.ts +12 -0
  37. package/lib/types/dom/element.d.ts +48 -0
  38. package/lib/types/dom/fragment.d.ts +9 -0
  39. package/lib/types/dom/node.d.ts +17 -0
  40. package/lib/types/dom/reader.d.ts +3 -0
  41. package/lib/types/dom/serialize.d.ts +5 -0
  42. package/lib/types/dom/text.d.ts +9 -0
  43. package/lib/types/dom-adapter.d.ts +5 -0
  44. package/lib/types/dom-parser.d.ts +14 -0
  45. package/lib/types/entities/data.d.ts +3 -0
  46. package/lib/types/entities/decode.d.ts +23 -0
  47. package/lib/types/entities/index.d.ts +3 -0
  48. package/lib/types/entities.spec.d.ts +2 -0
  49. package/lib/types/html/implied-end-tags.d.ts +42 -0
  50. package/lib/types/html/index.d.ts +4 -0
  51. package/lib/types/html/text-elements.d.ts +20 -0
  52. package/lib/types/html/tokenizer.d.ts +7 -0
  53. package/lib/types/html/tree-builder.d.ts +5 -0
  54. package/lib/types/html/tree-sink.d.ts +24 -0
  55. package/lib/types/html/void-elements.d.ts +1 -0
  56. package/lib/types/html-tokenizer.spec.d.ts +2 -0
  57. package/lib/types/html.spec.d.ts +2 -0
  58. package/lib/types/index.d.ts +11 -40
  59. package/lib/types/register.gjs.spec.d.ts +3 -0
  60. package/lib/types/selectors/adapter.d.ts +18 -0
  61. package/lib/types/selectors/compile.d.ts +9 -0
  62. package/lib/types/selectors/index.d.ts +3 -0
  63. package/lib/types/selectors/nth.d.ts +8 -0
  64. package/lib/types/selectors/parse.d.ts +55 -0
  65. package/lib/types/selectors/query.d.ts +8 -0
  66. package/lib/types/selectors-dom.spec.d.ts +2 -0
  67. package/lib/types/selectors.spec.d.ts +2 -0
  68. package/lib/types/serialize.spec.d.ts +2 -0
  69. package/lib/types/xml/parse-xml.d.ts +2 -0
  70. package/lib/types/xml-shape.spec.d.ts +2 -0
  71. package/package.json +19 -4
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @gjsify/domparser
2
2
 
3
- A minimal `DOMParser.parseFromString` implementation (XML/HTML) with a small DOM surface — `tagName`, `getAttribute`, `children`, `querySelector`/`querySelectorAll`, `textContent`, `innerHTML`. Sized for excalibur-tiled and simple config parsing; runs on GJS, Node.js, and browsers (where the native `DOMParser` is used instead).
3
+ `DOMParser.parseFromString` for GJS, Node.js, Bun, Deno and NativeScript — an HTML5 parser, an XML scanner, a CSS Selectors 4 engine and the full WHATWG character-reference table, with no runtime dependencies. Browsers keep their native `DOMParser`.
4
4
 
5
5
  Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js and Web APIs for GJS (GNOME JavaScript).
6
6
 
@@ -16,19 +16,54 @@ yarn add @gjsify/domparser
16
16
 
17
17
  ## Usage
18
18
 
19
+ `parseFromString` reads its second argument. `text/html` runs the HTML5 tokenizer and tree builder; the four XML types run the XML scanner; anything else throws a `TypeError` naming the five accepted values, rather than returning a plausible wrong tree.
20
+
19
21
  ```typescript
20
22
  import { DOMParser } from '@gjsify/domparser';
21
23
 
22
- const parser = new DOMParser();
23
- const doc = parser.parseFromString('<map width="20" height="15"><layer name="bg"/></map>', 'text/xml');
24
+ const doc = new DOMParser().parseFromString(await response.text(), 'text/html');
24
25
 
25
- const map = doc.querySelector('map');
26
- console.log(map?.getAttribute('width')); // "20"
26
+ for (const ad of doc.querySelectorAll('article.aditem[data-adid]')) {
27
+ console.log(ad.getAttribute('data-adid'), ad.querySelector('h2')?.textContent);
28
+ }
29
+ ```
27
30
 
28
- const layers = doc.querySelectorAll('layer');
29
- console.log(layers[0]?.getAttribute('name')); // "bg"
31
+ ```typescript
32
+ // The XML path — TMX, TSX, any well-formed document.
33
+ const map = new DOMParser().parseFromString(tmx, 'application/xml');
34
+ console.log(map.documentElement?.getAttribute('width'));
35
+ console.log(map.querySelectorAll('layer > data').length);
30
36
  ```
31
37
 
38
+ ### What the HTML mode gives you
39
+
40
+ - implicit `html`/`head`/`body`, the void-element set, the implied-end-tag table, table sections, `<template>` content as a fragment, EOF auto-close;
41
+ - `<script>`/`<style>` as raw text, `<textarea>`/`<title>` as RCDATA;
42
+ - character references decoded in all three contexts — element content, attribute values (`href="?a=1&copy=2"` stays a query string) and XML's five predefined names;
43
+ - `innerHTML`/`outerHTML` that re-escape, so what you read back reparses into the tree you had.
44
+
45
+ ### Selectors
46
+
47
+ `querySelector`, `querySelectorAll`, `matches`, `closest`, `getElementById` and `getElementsByClassName` all run through one engine: type/`*`/`.class`/`#id`, the eight attribute operators with the `i`/`s` flags, the four combinators, selector lists, `:not() :is() :where() :has() :nth-child(an+b [of S]) :nth-of-type() :first-child :last-child :only-child :first-of-type :last-of-type :only-of-type :empty :root :scope`, and the attribute-derived form states (`:disabled :enabled :checked :required :optional :selected :any-link`).
48
+
49
+ A construct the engine will not evaluate — a pseudo-element, a user-state pseudo-class, a namespace selector, `||` — throws a `SyntaxError` naming it. It never quietly matches nothing.
50
+
51
+ ### Subpaths
52
+
53
+ Each is a leaf: it imports no node classes and nothing platform-specific, so a consumer that needs one does not bundle the rest.
54
+
55
+ | Import | Contents |
56
+ |---|---|
57
+ | `@gjsify/domparser` | `DOMParser`, the node classes, `canonicalize`, `domTreeReader` |
58
+ | `@gjsify/domparser/html` | `tokenize`, `parseHtml`, `VOID_ELEMENTS`, `RAWTEXT_ELEMENTS`, `RCDATA_ELEMENTS` |
59
+ | `@gjsify/domparser/selectors` | `selectAll`, `selectOne`, `matchesSelector`, `closestSelector` over an `Adapter<TNode>` — point it at your own tree |
60
+ | `@gjsify/domparser/entities` | `decodeText`, `decodeAttributeValue`, `decodeXml`, `NAMED_REFERENCES` |
61
+ | `@gjsify/domparser/register` | side effect: installs `DOMParser` on `globalThis` if nothing else has |
62
+
63
+ ## Scope
64
+
65
+ Correct for HTML, and honest about where it stops. Not implemented: the adoption agency algorithm, foster parenting, SVG/MathML foreign content and its name adjustments, the "in select" insertion mode (a `<select>` keeps markup a browser would drop), encoding sniffing, and the `innerHTML` setter. Those boundaries are not claims — `tests/integration/domparser/` parses every fixture with this parser **and** with [parse5](https://github.com/inikulin/parse5), prints both trees through the same canonicalizer and compares them, so a divergence is a test failure; the out-of-scope constructs are pinned as `divergent` fixtures that fail the day the gap closes. Selector results are compared the same way against `css-select`, and the entity table against `entities`.
66
+
32
67
  ## License
33
68
 
34
69
  MIT
@@ -0,0 +1,3 @@
1
+ import"./_virtual/_rolldown/runtime.js";function quote(e){return`"`+e.split(`\\`).join(`\\\\`).split(`"`).join(`\\"`).split(`
2
+ `).join(`\\n`).split(`\r`).join(`\\r`).split(` `).join(`\\t`)+`"`}function line(e,t){if(e.isText(t)||e.isComment(t))return e.name(t)+` `+quote(e.value(t));if(e.isDoctype(t))return`#doctype `+quote(e.name(t));if(!e.isElement(t))return e.name(t);let n=e.attributes(t).slice().sort((e,t)=>e.name<t.name?-1:+(e.name>t.name)).map(e=>` `+e.name+`=`+quote(e.value)).join(``);return e.name(t)+n}function walk(e,t,n,r){r.push(` `.repeat(n)+line(e,t));for(let i of e.children(t))walk(e,i,n+1,r)}function canonicalize(e,t){let n=[];return walk(e,t,0,n),n.join(`
3
+ `)}export{canonicalize};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{DOMNode as e}from"./node.js";var DOMComment=class extends e{constructor(e){super(8,`#comment`,e)}get data(){return this.nodeValue??``}};export{DOMComment};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{DOMNode as e}from"./node.js";var DOMDocumentType=class extends e{name;publicId;systemId;constructor(e,t,n){super(10,e),this.name=e,this.publicId=t,this.systemId=n}};export{DOMDocumentType};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import"./node.js";import{quoteSelectorString as e}from"../selectors/parse.js";import"../selectors/index.js";import{DOMElement as t}from"./element.js";var DOMDocument=class extends t{documentElement=null;constructor(e=!1){super(`#document`,e),this.nodeType=9,this.nodeName=`#document`,this.tagName=`#document`}get doctype(){for(let e of this.childNodes)if(e.nodeType===10)return e;return null}get head(){return this._documentChild(`head`)}get body(){return this._documentChild(`body`)}getElementById(t){return this.querySelector(`[id=`+e(t)+`]`)}_documentChild(e){let t=this.documentElement;if(t===null)return null;for(let n of t.childNodes)if(n.nodeType===1&&n.localName===e)return n;return null}};export{DOMDocument};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{DOMNode as e}from"./node.js";import{HTML_ADAPTER as t,XML_ADAPTER as n}from"../dom-adapter.js";import{quoteSelectorString as r}from"../selectors/parse.js";import{closestSelector as i,matchesSelector as a,selectAll as o,selectOne as s}from"../selectors/query.js";import"../selectors/index.js";import{serializeInner as c,serializeOuter as l}from"./serialize.js";var DOMElement=class extends e{tagName;localName;content;_html;_attrs=new Map;constructor(e,t=!1){let n=e.toLowerCase();super(1,t?n.toUpperCase():e.toUpperCase()),this.localName=n,this.tagName=t?n.toUpperCase():n,this._html=t}get id(){return this._attrs.get(`id`)??``}get className(){return this._attrs.get(`class`)??``}get parentElement(){let e=this.parentNode;return e!==null&&e.nodeType===1?e:null}get firstElementChild(){return this.children[0]??null}get lastElementChild(){let e=this.children;return e[e.length-1]??null}get nextElementSibling(){return this._sibling(1)}get previousElementSibling(){return this._sibling(-1)}_sibling(e){let t=this.parentNode;if(t===null)return null;let n=t.childNodes;for(let t=n.indexOf(this)+e;t>=0&&t<n.length;t+=e)if(n[t].nodeType===1)return n[t];return null}get children(){return this.childNodes.filter(e=>e.nodeType===1)}getAttribute(e){return this._attrs.has(e)?this._attrs.get(e)??null:null}setAttribute(e,t){this._attrs.set(e,t)}hasAttribute(e){return this._attrs.has(e)}get attributes(){return Array.from(this._attrs.entries()).map(([e,t])=>({name:e,value:t}))}get innerHTML(){return c(this,this._html)}get outerHTML(){return l(this,this._html)}_adapter(){return this._html?t:n}querySelector(e){return s(e,this,this._adapter())}querySelectorAll(e){return o(e,this,this._adapter())}matches(e){return a(e,this,this._adapter())}closest(e){return i(e,this,this._adapter())}getElementsByClassName(e){let t=e.trim().split(/\s+/).filter(e=>e!==``);return t.length===0?[]:this.querySelectorAll(t.map(e=>`[class~=`+r(e)+`]`).join(``))}};export{DOMElement};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{DOMNode as e}from"./node.js";var DOMDocumentFragment=class extends e{constructor(){super(11,`#document-fragment`)}};export{DOMDocumentFragment};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";const e=1,t=3,n=4,r=8,i=9,a=10,o=11;var DOMNode=class{nodeType;nodeName;nodeValue;parentNode=null;childNodes=[];constructor(e,t,n=null){this.nodeType=e,this.nodeName=t,this.nodeValue=n}get textContent(){return this.nodeType===3||this.nodeType===4?this.nodeValue??``:this.childNodes.map(e=>e.textContent??``).join(``)}};export{n as CDATA_SECTION_NODE,r as COMMENT_NODE,o as DOCUMENT_FRAGMENT_NODE,i as DOCUMENT_NODE,a as DOCUMENT_TYPE_NODE,DOMNode,e as ELEMENT_NODE,t as TEXT_NODE};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import"./node.js";const e={isElement:e=>e.nodeType===1,isText:e=>e.nodeType===3||e.nodeType===4,isComment:e=>e.nodeType===8,isDoctype:e=>e.nodeType===10,name:e=>e.nodeType===1?e.localName:e.nodeName,value:e=>e.nodeValue??``,attributes:e=>e.nodeType===1?e.attributes:[],children:e=>{let t=e.content;return t===void 0?e.childNodes:[t]}};export{e as domTreeReader};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import"./node.js";import{RAWTEXT_ELEMENTS as e}from"../html/text-elements.js";import{VOID_ELEMENTS as t}from"../html/void-elements.js";function escapeText(e,t){let n=e.split(`&`).join(`&amp;`).split(`<`).join(`&lt;`).split(`>`).join(`&gt;`);return t?n.split(`\xA0`).join(`&nbsp;`):n}function escapeAttribute(e,t){let n=e.split(`&`).join(`&amp;`).split(`"`).join(`&quot;`);return t?n.split(`\xA0`).join(`&nbsp;`):n.split(`<`).join(`&lt;`).split(`>`).join(`&gt;`)}function openTag(e,t){let n=`<`+e.localName;for(let r of e.attributes)n+=` `+r.name+`="`+escapeAttribute(r.value,t)+`"`;return n}function childrenOf(e){let t=e.content;return t===void 0?e.childNodes:t.childNodes}function holdsRawText(t,n){return n&&t.nodeType===1&&e.has(t.localName)}function serializeNode(e,n,r,i){switch(e.nodeType){case 3:i.push(r?e.nodeValue??``:escapeText(e.nodeValue??``,n));return;case 4:i.push(`<![CDATA[`+(e.nodeValue??``)+`]]>`);return;case 8:i.push(`<!--`+(e.nodeValue??``)+`-->`);return;case 10:i.push(`<!DOCTYPE `+e.nodeName+`>`);return;case 1:break;default:serializeChildren(e,n,i);return}let a=e,o=a.localName,s=childrenOf(a);if(!n&&s.length===0){i.push(openTag(a,n)+`/>`);return}if(i.push(openTag(a,n)+`>`),n&&t.has(o))return;let c=holdsRawText(a,n);for(let e of s)serializeNode(e,n,c,i);i.push(`</`+o+`>`)}function serializeChildren(e,t,n){let r=holdsRawText(e,t);for(let i of childrenOf(e))serializeNode(i,t,r,n)}function serializeInner(e,t){let n=[];return serializeChildren(e,t,n),n.join(``)}function serializeOuter(e,t){let n=[];return serializeNode(e,t,!1,n),n.join(``)}export{serializeInner,serializeOuter};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{DOMNode as e}from"./node.js";var DOMText=class extends e{constructor(e){super(3,`#text`,e)}get data(){return this.nodeValue??``}set data(e){this.nodeValue=e}},DOMCDATASection=class extends e{constructor(e){super(4,`#cdata-section`,e)}};export{DOMCDATASection,DOMText};
@@ -0,0 +1 @@
1
+ import"./_virtual/_rolldown/runtime.js";import"./dom/node.js";function adapterFor(e){return{caseSensitive:e,isTag:e=>e.nodeType===1,getName:e=>e.localName,getParent:e=>e.parentNode,getChildren:e=>e.childNodes,getSiblings:e=>e.parentNode===null?[e]:e.parentNode.childNodes,getAttributeValue:(e,t)=>e.nodeType===1?e.getAttribute(t):null,getText:e=>e.textContent}}const e=adapterFor(!1),t=adapterFor(!0);export{e as HTML_ADAPTER,t as XML_ADAPTER};
@@ -0,0 +1 @@
1
+ import"./_virtual/_rolldown/runtime.js";import{parseHtml as e}from"./html/tree-builder.js";import{parseXml as t}from"./xml/parse-xml.js";const n=[`text/html`,`text/xml`,`application/xml`,`application/xhtml+xml`,`image/svg+xml`];var DOMParser=class{parseFromString(r,i){if(i===`text/html`)return e(r);if(n.includes(i))return t(r);throw TypeError(`Failed to execute 'parseFromString' on 'DOMParser': the provided value '`+i+`' is not a valid enum value of type DOMParserSupportedType (`+n.join(`, `)+`)`)}};export{DOMParser};
@@ -0,0 +1,2 @@
1
+ const e={AElig:`Æ`,"AElig;":`Æ`,AMP:`&`,"AMP;":`&`,Aacute:`Á`,"Aacute;":`Á`,"Abreve;":`Ă`,Acirc:`Â`,"Acirc;":`Â`,"Acy;":`А`,"Afr;":`𝔄`,Agrave:`À`,"Agrave;":`À`,"Alpha;":`Α`,"Amacr;":`Ā`,"And;":`⩓`,"Aogon;":`Ą`,"Aopf;":`𝔸`,"ApplyFunction;":`⁡`,Aring:`Å`,"Aring;":`Å`,"Ascr;":`𝒜`,"Assign;":`≔`,Atilde:`Ã`,"Atilde;":`Ã`,Auml:`Ä`,"Auml;":`Ä`,"Backslash;":`∖`,"Barv;":`⫧`,"Barwed;":`⌆`,"Bcy;":`Б`,"Because;":`∵`,"Bernoullis;":`ℬ`,"Beta;":`Β`,"Bfr;":`𝔅`,"Bopf;":`𝔹`,"Breve;":`˘`,"Bscr;":`ℬ`,"Bumpeq;":`≎`,"CHcy;":`Ч`,COPY:`©`,"COPY;":`©`,"Cacute;":`Ć`,"Cap;":`⋒`,"CapitalDifferentialD;":`ⅅ`,"Cayleys;":`ℭ`,"Ccaron;":`Č`,Ccedil:`Ç`,"Ccedil;":`Ç`,"Ccirc;":`Ĉ`,"Cconint;":`∰`,"Cdot;":`Ċ`,"Cedilla;":`¸`,"CenterDot;":`·`,"Cfr;":`ℭ`,"Chi;":`Χ`,"CircleDot;":`⊙`,"CircleMinus;":`⊖`,"CirclePlus;":`⊕`,"CircleTimes;":`⊗`,"ClockwiseContourIntegral;":`∲`,"CloseCurlyDoubleQuote;":`”`,"CloseCurlyQuote;":`’`,"Colon;":`∷`,"Colone;":`⩴`,"Congruent;":`≡`,"Conint;":`∯`,"ContourIntegral;":`∮`,"Copf;":`ℂ`,"Coproduct;":`∐`,"CounterClockwiseContourIntegral;":`∳`,"Cross;":`⨯`,"Cscr;":`𝒞`,"Cup;":`⋓`,"CupCap;":`≍`,"DD;":`ⅅ`,"DDotrahd;":`⤑`,"DJcy;":`Ђ`,"DScy;":`Ѕ`,"DZcy;":`Џ`,"Dagger;":`‡`,"Darr;":`↡`,"Dashv;":`⫤`,"Dcaron;":`Ď`,"Dcy;":`Д`,"Del;":`∇`,"Delta;":`Δ`,"Dfr;":`𝔇`,"DiacriticalAcute;":`´`,"DiacriticalDot;":`˙`,"DiacriticalDoubleAcute;":`˝`,"DiacriticalGrave;":"`","DiacriticalTilde;":`˜`,"Diamond;":`⋄`,"DifferentialD;":`ⅆ`,"Dopf;":`𝔻`,"Dot;":`¨`,"DotDot;":`⃜`,"DotEqual;":`≐`,"DoubleContourIntegral;":`∯`,"DoubleDot;":`¨`,"DoubleDownArrow;":`⇓`,"DoubleLeftArrow;":`⇐`,"DoubleLeftRightArrow;":`⇔`,"DoubleLeftTee;":`⫤`,"DoubleLongLeftArrow;":`⟸`,"DoubleLongLeftRightArrow;":`⟺`,"DoubleLongRightArrow;":`⟹`,"DoubleRightArrow;":`⇒`,"DoubleRightTee;":`⊨`,"DoubleUpArrow;":`⇑`,"DoubleUpDownArrow;":`⇕`,"DoubleVerticalBar;":`∥`,"DownArrow;":`↓`,"DownArrowBar;":`⤓`,"DownArrowUpArrow;":`⇵`,"DownBreve;":`̑`,"DownLeftRightVector;":`⥐`,"DownLeftTeeVector;":`⥞`,"DownLeftVector;":`↽`,"DownLeftVectorBar;":`⥖`,"DownRightTeeVector;":`⥟`,"DownRightVector;":`⇁`,"DownRightVectorBar;":`⥗`,"DownTee;":`⊤`,"DownTeeArrow;":`↧`,"Downarrow;":`⇓`,"Dscr;":`𝒟`,"Dstrok;":`Đ`,"ENG;":`Ŋ`,ETH:`Ð`,"ETH;":`Ð`,Eacute:`É`,"Eacute;":`É`,"Ecaron;":`Ě`,Ecirc:`Ê`,"Ecirc;":`Ê`,"Ecy;":`Э`,"Edot;":`Ė`,"Efr;":`𝔈`,Egrave:`È`,"Egrave;":`È`,"Element;":`∈`,"Emacr;":`Ē`,"EmptySmallSquare;":`◻`,"EmptyVerySmallSquare;":`▫`,"Eogon;":`Ę`,"Eopf;":`𝔼`,"Epsilon;":`Ε`,"Equal;":`⩵`,"EqualTilde;":`≂`,"Equilibrium;":`⇌`,"Escr;":`ℰ`,"Esim;":`⩳`,"Eta;":`Η`,Euml:`Ë`,"Euml;":`Ë`,"Exists;":`∃`,"ExponentialE;":`ⅇ`,"Fcy;":`Ф`,"Ffr;":`𝔉`,"FilledSmallSquare;":`◼`,"FilledVerySmallSquare;":`▪`,"Fopf;":`𝔽`,"ForAll;":`∀`,"Fouriertrf;":`ℱ`,"Fscr;":`ℱ`,"GJcy;":`Ѓ`,GT:`>`,"GT;":`>`,"Gamma;":`Γ`,"Gammad;":`Ϝ`,"Gbreve;":`Ğ`,"Gcedil;":`Ģ`,"Gcirc;":`Ĝ`,"Gcy;":`Г`,"Gdot;":`Ġ`,"Gfr;":`𝔊`,"Gg;":`⋙`,"Gopf;":`𝔾`,"GreaterEqual;":`≥`,"GreaterEqualLess;":`⋛`,"GreaterFullEqual;":`≧`,"GreaterGreater;":`⪢`,"GreaterLess;":`≷`,"GreaterSlantEqual;":`⩾`,"GreaterTilde;":`≳`,"Gscr;":`𝒢`,"Gt;":`≫`,"HARDcy;":`Ъ`,"Hacek;":`ˇ`,"Hat;":`^`,"Hcirc;":`Ĥ`,"Hfr;":`ℌ`,"HilbertSpace;":`ℋ`,"Hopf;":`ℍ`,"HorizontalLine;":`─`,"Hscr;":`ℋ`,"Hstrok;":`Ħ`,"HumpDownHump;":`≎`,"HumpEqual;":`≏`,"IEcy;":`Е`,"IJlig;":`IJ`,"IOcy;":`Ё`,Iacute:`Í`,"Iacute;":`Í`,Icirc:`Î`,"Icirc;":`Î`,"Icy;":`И`,"Idot;":`İ`,"Ifr;":`ℑ`,Igrave:`Ì`,"Igrave;":`Ì`,"Im;":`ℑ`,"Imacr;":`Ī`,"ImaginaryI;":`ⅈ`,"Implies;":`⇒`,"Int;":`∬`,"Integral;":`∫`,"Intersection;":`⋂`,"InvisibleComma;":`⁣`,"InvisibleTimes;":`⁢`,"Iogon;":`Į`,"Iopf;":`𝕀`,"Iota;":`Ι`,"Iscr;":`ℐ`,"Itilde;":`Ĩ`,"Iukcy;":`І`,Iuml:`Ï`,"Iuml;":`Ï`,"Jcirc;":`Ĵ`,"Jcy;":`Й`,"Jfr;":`𝔍`,"Jopf;":`𝕁`,"Jscr;":`𝒥`,"Jsercy;":`Ј`,"Jukcy;":`Є`,"KHcy;":`Х`,"KJcy;":`Ќ`,"Kappa;":`Κ`,"Kcedil;":`Ķ`,"Kcy;":`К`,"Kfr;":`𝔎`,"Kopf;":`𝕂`,"Kscr;":`𝒦`,"LJcy;":`Љ`,LT:`<`,"LT;":`<`,"Lacute;":`Ĺ`,"Lambda;":`Λ`,"Lang;":`⟪`,"Laplacetrf;":`ℒ`,"Larr;":`↞`,"Lcaron;":`Ľ`,"Lcedil;":`Ļ`,"Lcy;":`Л`,"LeftAngleBracket;":`⟨`,"LeftArrow;":`←`,"LeftArrowBar;":`⇤`,"LeftArrowRightArrow;":`⇆`,"LeftCeiling;":`⌈`,"LeftDoubleBracket;":`⟦`,"LeftDownTeeVector;":`⥡`,"LeftDownVector;":`⇃`,"LeftDownVectorBar;":`⥙`,"LeftFloor;":`⌊`,"LeftRightArrow;":`↔`,"LeftRightVector;":`⥎`,"LeftTee;":`⊣`,"LeftTeeArrow;":`↤`,"LeftTeeVector;":`⥚`,"LeftTriangle;":`⊲`,"LeftTriangleBar;":`⧏`,"LeftTriangleEqual;":`⊴`,"LeftUpDownVector;":`⥑`,"LeftUpTeeVector;":`⥠`,"LeftUpVector;":`↿`,"LeftUpVectorBar;":`⥘`,"LeftVector;":`↼`,"LeftVectorBar;":`⥒`,"Leftarrow;":`⇐`,"Leftrightarrow;":`⇔`,"LessEqualGreater;":`⋚`,"LessFullEqual;":`≦`,"LessGreater;":`≶`,"LessLess;":`⪡`,"LessSlantEqual;":`⩽`,"LessTilde;":`≲`,"Lfr;":`𝔏`,"Ll;":`⋘`,"Lleftarrow;":`⇚`,"Lmidot;":`Ŀ`,"LongLeftArrow;":`⟵`,"LongLeftRightArrow;":`⟷`,"LongRightArrow;":`⟶`,"Longleftarrow;":`⟸`,"Longleftrightarrow;":`⟺`,"Longrightarrow;":`⟹`,"Lopf;":`𝕃`,"LowerLeftArrow;":`↙`,"LowerRightArrow;":`↘`,"Lscr;":`ℒ`,"Lsh;":`↰`,"Lstrok;":`Ł`,"Lt;":`≪`,"Map;":`⤅`,"Mcy;":`М`,"MediumSpace;":` `,"Mellintrf;":`ℳ`,"Mfr;":`𝔐`,"MinusPlus;":`∓`,"Mopf;":`𝕄`,"Mscr;":`ℳ`,"Mu;":`Μ`,"NJcy;":`Њ`,"Nacute;":`Ń`,"Ncaron;":`Ň`,"Ncedil;":`Ņ`,"Ncy;":`Н`,"NegativeMediumSpace;":`​`,"NegativeThickSpace;":`​`,"NegativeThinSpace;":`​`,"NegativeVeryThinSpace;":`​`,"NestedGreaterGreater;":`≫`,"NestedLessLess;":`≪`,"NewLine;":`
2
+ `,"Nfr;":`𝔑`,"NoBreak;":`⁠`,"NonBreakingSpace;":`\xA0`,"Nopf;":`ℕ`,"Not;":`⫬`,"NotCongruent;":`≢`,"NotCupCap;":`≭`,"NotDoubleVerticalBar;":`∦`,"NotElement;":`∉`,"NotEqual;":`≠`,"NotEqualTilde;":`≂̸`,"NotExists;":`∄`,"NotGreater;":`≯`,"NotGreaterEqual;":`≱`,"NotGreaterFullEqual;":`≧̸`,"NotGreaterGreater;":`≫̸`,"NotGreaterLess;":`≹`,"NotGreaterSlantEqual;":`⩾̸`,"NotGreaterTilde;":`≵`,"NotHumpDownHump;":`≎̸`,"NotHumpEqual;":`≏̸`,"NotLeftTriangle;":`⋪`,"NotLeftTriangleBar;":`⧏̸`,"NotLeftTriangleEqual;":`⋬`,"NotLess;":`≮`,"NotLessEqual;":`≰`,"NotLessGreater;":`≸`,"NotLessLess;":`≪̸`,"NotLessSlantEqual;":`⩽̸`,"NotLessTilde;":`≴`,"NotNestedGreaterGreater;":`⪢̸`,"NotNestedLessLess;":`⪡̸`,"NotPrecedes;":`⊀`,"NotPrecedesEqual;":`⪯̸`,"NotPrecedesSlantEqual;":`⋠`,"NotReverseElement;":`∌`,"NotRightTriangle;":`⋫`,"NotRightTriangleBar;":`⧐̸`,"NotRightTriangleEqual;":`⋭`,"NotSquareSubset;":`⊏̸`,"NotSquareSubsetEqual;":`⋢`,"NotSquareSuperset;":`⊐̸`,"NotSquareSupersetEqual;":`⋣`,"NotSubset;":`⊂⃒`,"NotSubsetEqual;":`⊈`,"NotSucceeds;":`⊁`,"NotSucceedsEqual;":`⪰̸`,"NotSucceedsSlantEqual;":`⋡`,"NotSucceedsTilde;":`≿̸`,"NotSuperset;":`⊃⃒`,"NotSupersetEqual;":`⊉`,"NotTilde;":`≁`,"NotTildeEqual;":`≄`,"NotTildeFullEqual;":`≇`,"NotTildeTilde;":`≉`,"NotVerticalBar;":`∤`,"Nscr;":`𝒩`,Ntilde:`Ñ`,"Ntilde;":`Ñ`,"Nu;":`Ν`,"OElig;":`Œ`,Oacute:`Ó`,"Oacute;":`Ó`,Ocirc:`Ô`,"Ocirc;":`Ô`,"Ocy;":`О`,"Odblac;":`Ő`,"Ofr;":`𝔒`,Ograve:`Ò`,"Ograve;":`Ò`,"Omacr;":`Ō`,"Omega;":`Ω`,"Omicron;":`Ο`,"Oopf;":`𝕆`,"OpenCurlyDoubleQuote;":`“`,"OpenCurlyQuote;":`‘`,"Or;":`⩔`,"Oscr;":`𝒪`,Oslash:`Ø`,"Oslash;":`Ø`,Otilde:`Õ`,"Otilde;":`Õ`,"Otimes;":`⨷`,Ouml:`Ö`,"Ouml;":`Ö`,"OverBar;":`‾`,"OverBrace;":`⏞`,"OverBracket;":`⎴`,"OverParenthesis;":`⏜`,"PartialD;":`∂`,"Pcy;":`П`,"Pfr;":`𝔓`,"Phi;":`Φ`,"Pi;":`Π`,"PlusMinus;":`±`,"Poincareplane;":`ℌ`,"Popf;":`ℙ`,"Pr;":`⪻`,"Precedes;":`≺`,"PrecedesEqual;":`⪯`,"PrecedesSlantEqual;":`≼`,"PrecedesTilde;":`≾`,"Prime;":`″`,"Product;":`∏`,"Proportion;":`∷`,"Proportional;":`∝`,"Pscr;":`𝒫`,"Psi;":`Ψ`,QUOT:`"`,"QUOT;":`"`,"Qfr;":`𝔔`,"Qopf;":`ℚ`,"Qscr;":`𝒬`,"RBarr;":`⤐`,REG:`®`,"REG;":`®`,"Racute;":`Ŕ`,"Rang;":`⟫`,"Rarr;":`↠`,"Rarrtl;":`⤖`,"Rcaron;":`Ř`,"Rcedil;":`Ŗ`,"Rcy;":`Р`,"Re;":`ℜ`,"ReverseElement;":`∋`,"ReverseEquilibrium;":`⇋`,"ReverseUpEquilibrium;":`⥯`,"Rfr;":`ℜ`,"Rho;":`Ρ`,"RightAngleBracket;":`⟩`,"RightArrow;":`→`,"RightArrowBar;":`⇥`,"RightArrowLeftArrow;":`⇄`,"RightCeiling;":`⌉`,"RightDoubleBracket;":`⟧`,"RightDownTeeVector;":`⥝`,"RightDownVector;":`⇂`,"RightDownVectorBar;":`⥕`,"RightFloor;":`⌋`,"RightTee;":`⊢`,"RightTeeArrow;":`↦`,"RightTeeVector;":`⥛`,"RightTriangle;":`⊳`,"RightTriangleBar;":`⧐`,"RightTriangleEqual;":`⊵`,"RightUpDownVector;":`⥏`,"RightUpTeeVector;":`⥜`,"RightUpVector;":`↾`,"RightUpVectorBar;":`⥔`,"RightVector;":`⇀`,"RightVectorBar;":`⥓`,"Rightarrow;":`⇒`,"Ropf;":`ℝ`,"RoundImplies;":`⥰`,"Rrightarrow;":`⇛`,"Rscr;":`ℛ`,"Rsh;":`↱`,"RuleDelayed;":`⧴`,"SHCHcy;":`Щ`,"SHcy;":`Ш`,"SOFTcy;":`Ь`,"Sacute;":`Ś`,"Sc;":`⪼`,"Scaron;":`Š`,"Scedil;":`Ş`,"Scirc;":`Ŝ`,"Scy;":`С`,"Sfr;":`𝔖`,"ShortDownArrow;":`↓`,"ShortLeftArrow;":`←`,"ShortRightArrow;":`→`,"ShortUpArrow;":`↑`,"Sigma;":`Σ`,"SmallCircle;":`∘`,"Sopf;":`𝕊`,"Sqrt;":`√`,"Square;":`□`,"SquareIntersection;":`⊓`,"SquareSubset;":`⊏`,"SquareSubsetEqual;":`⊑`,"SquareSuperset;":`⊐`,"SquareSupersetEqual;":`⊒`,"SquareUnion;":`⊔`,"Sscr;":`𝒮`,"Star;":`⋆`,"Sub;":`⋐`,"Subset;":`⋐`,"SubsetEqual;":`⊆`,"Succeeds;":`≻`,"SucceedsEqual;":`⪰`,"SucceedsSlantEqual;":`≽`,"SucceedsTilde;":`≿`,"SuchThat;":`∋`,"Sum;":`∑`,"Sup;":`⋑`,"Superset;":`⊃`,"SupersetEqual;":`⊇`,"Supset;":`⋑`,THORN:`Þ`,"THORN;":`Þ`,"TRADE;":`™`,"TSHcy;":`Ћ`,"TScy;":`Ц`,"Tab;":` `,"Tau;":`Τ`,"Tcaron;":`Ť`,"Tcedil;":`Ţ`,"Tcy;":`Т`,"Tfr;":`𝔗`,"Therefore;":`∴`,"Theta;":`Θ`,"ThickSpace;":`  `,"ThinSpace;":` `,"Tilde;":`∼`,"TildeEqual;":`≃`,"TildeFullEqual;":`≅`,"TildeTilde;":`≈`,"Topf;":`𝕋`,"TripleDot;":`⃛`,"Tscr;":`𝒯`,"Tstrok;":`Ŧ`,Uacute:`Ú`,"Uacute;":`Ú`,"Uarr;":`↟`,"Uarrocir;":`⥉`,"Ubrcy;":`Ў`,"Ubreve;":`Ŭ`,Ucirc:`Û`,"Ucirc;":`Û`,"Ucy;":`У`,"Udblac;":`Ű`,"Ufr;":`𝔘`,Ugrave:`Ù`,"Ugrave;":`Ù`,"Umacr;":`Ū`,"UnderBar;":`_`,"UnderBrace;":`⏟`,"UnderBracket;":`⎵`,"UnderParenthesis;":`⏝`,"Union;":`⋃`,"UnionPlus;":`⊎`,"Uogon;":`Ų`,"Uopf;":`𝕌`,"UpArrow;":`↑`,"UpArrowBar;":`⤒`,"UpArrowDownArrow;":`⇅`,"UpDownArrow;":`↕`,"UpEquilibrium;":`⥮`,"UpTee;":`⊥`,"UpTeeArrow;":`↥`,"Uparrow;":`⇑`,"Updownarrow;":`⇕`,"UpperLeftArrow;":`↖`,"UpperRightArrow;":`↗`,"Upsi;":`ϒ`,"Upsilon;":`Υ`,"Uring;":`Ů`,"Uscr;":`𝒰`,"Utilde;":`Ũ`,Uuml:`Ü`,"Uuml;":`Ü`,"VDash;":`⊫`,"Vbar;":`⫫`,"Vcy;":`В`,"Vdash;":`⊩`,"Vdashl;":`⫦`,"Vee;":`⋁`,"Verbar;":`‖`,"Vert;":`‖`,"VerticalBar;":`∣`,"VerticalLine;":`|`,"VerticalSeparator;":`❘`,"VerticalTilde;":`≀`,"VeryThinSpace;":` `,"Vfr;":`𝔙`,"Vopf;":`𝕍`,"Vscr;":`𝒱`,"Vvdash;":`⊪`,"Wcirc;":`Ŵ`,"Wedge;":`⋀`,"Wfr;":`𝔚`,"Wopf;":`𝕎`,"Wscr;":`𝒲`,"Xfr;":`𝔛`,"Xi;":`Ξ`,"Xopf;":`𝕏`,"Xscr;":`𝒳`,"YAcy;":`Я`,"YIcy;":`Ї`,"YUcy;":`Ю`,Yacute:`Ý`,"Yacute;":`Ý`,"Ycirc;":`Ŷ`,"Ycy;":`Ы`,"Yfr;":`𝔜`,"Yopf;":`𝕐`,"Yscr;":`𝒴`,"Yuml;":`Ÿ`,"ZHcy;":`Ж`,"Zacute;":`Ź`,"Zcaron;":`Ž`,"Zcy;":`З`,"Zdot;":`Ż`,"ZeroWidthSpace;":`​`,"Zeta;":`Ζ`,"Zfr;":`ℨ`,"Zopf;":`ℤ`,"Zscr;":`𝒵`,aacute:`á`,"aacute;":`á`,"abreve;":`ă`,"ac;":`∾`,"acE;":`∾̳`,"acd;":`∿`,acirc:`â`,"acirc;":`â`,acute:`´`,"acute;":`´`,"acy;":`а`,aelig:`æ`,"aelig;":`æ`,"af;":`⁡`,"afr;":`𝔞`,agrave:`à`,"agrave;":`à`,"alefsym;":`ℵ`,"aleph;":`ℵ`,"alpha;":`α`,"amacr;":`ā`,"amalg;":`⨿`,amp:`&`,"amp;":`&`,"and;":`∧`,"andand;":`⩕`,"andd;":`⩜`,"andslope;":`⩘`,"andv;":`⩚`,"ang;":`∠`,"ange;":`⦤`,"angle;":`∠`,"angmsd;":`∡`,"angmsdaa;":`⦨`,"angmsdab;":`⦩`,"angmsdac;":`⦪`,"angmsdad;":`⦫`,"angmsdae;":`⦬`,"angmsdaf;":`⦭`,"angmsdag;":`⦮`,"angmsdah;":`⦯`,"angrt;":`∟`,"angrtvb;":`⊾`,"angrtvbd;":`⦝`,"angsph;":`∢`,"angst;":`Å`,"angzarr;":`⍼`,"aogon;":`ą`,"aopf;":`𝕒`,"ap;":`≈`,"apE;":`⩰`,"apacir;":`⩯`,"ape;":`≊`,"apid;":`≋`,"apos;":`'`,"approx;":`≈`,"approxeq;":`≊`,aring:`å`,"aring;":`å`,"ascr;":`𝒶`,"ast;":`*`,"asymp;":`≈`,"asympeq;":`≍`,atilde:`ã`,"atilde;":`ã`,auml:`ä`,"auml;":`ä`,"awconint;":`∳`,"awint;":`⨑`,"bNot;":`⫭`,"backcong;":`≌`,"backepsilon;":`϶`,"backprime;":`‵`,"backsim;":`∽`,"backsimeq;":`⋍`,"barvee;":`⊽`,"barwed;":`⌅`,"barwedge;":`⌅`,"bbrk;":`⎵`,"bbrktbrk;":`⎶`,"bcong;":`≌`,"bcy;":`б`,"bdquo;":`„`,"becaus;":`∵`,"because;":`∵`,"bemptyv;":`⦰`,"bepsi;":`϶`,"bernou;":`ℬ`,"beta;":`β`,"beth;":`ℶ`,"between;":`≬`,"bfr;":`𝔟`,"bigcap;":`⋂`,"bigcirc;":`◯`,"bigcup;":`⋃`,"bigodot;":`⨀`,"bigoplus;":`⨁`,"bigotimes;":`⨂`,"bigsqcup;":`⨆`,"bigstar;":`★`,"bigtriangledown;":`▽`,"bigtriangleup;":`△`,"biguplus;":`⨄`,"bigvee;":`⋁`,"bigwedge;":`⋀`,"bkarow;":`⤍`,"blacklozenge;":`⧫`,"blacksquare;":`▪`,"blacktriangle;":`▴`,"blacktriangledown;":`▾`,"blacktriangleleft;":`◂`,"blacktriangleright;":`▸`,"blank;":`␣`,"blk12;":`▒`,"blk14;":`░`,"blk34;":`▓`,"block;":`█`,"bne;":`=⃥`,"bnequiv;":`≡⃥`,"bnot;":`⌐`,"bopf;":`𝕓`,"bot;":`⊥`,"bottom;":`⊥`,"bowtie;":`⋈`,"boxDL;":`╗`,"boxDR;":`╔`,"boxDl;":`╖`,"boxDr;":`╓`,"boxH;":`═`,"boxHD;":`╦`,"boxHU;":`╩`,"boxHd;":`╤`,"boxHu;":`╧`,"boxUL;":`╝`,"boxUR;":`╚`,"boxUl;":`╜`,"boxUr;":`╙`,"boxV;":`║`,"boxVH;":`╬`,"boxVL;":`╣`,"boxVR;":`╠`,"boxVh;":`╫`,"boxVl;":`╢`,"boxVr;":`╟`,"boxbox;":`⧉`,"boxdL;":`╕`,"boxdR;":`╒`,"boxdl;":`┐`,"boxdr;":`┌`,"boxh;":`─`,"boxhD;":`╥`,"boxhU;":`╨`,"boxhd;":`┬`,"boxhu;":`┴`,"boxminus;":`⊟`,"boxplus;":`⊞`,"boxtimes;":`⊠`,"boxuL;":`╛`,"boxuR;":`╘`,"boxul;":`┘`,"boxur;":`└`,"boxv;":`│`,"boxvH;":`╪`,"boxvL;":`╡`,"boxvR;":`╞`,"boxvh;":`┼`,"boxvl;":`┤`,"boxvr;":`├`,"bprime;":`‵`,"breve;":`˘`,brvbar:`¦`,"brvbar;":`¦`,"bscr;":`𝒷`,"bsemi;":`⁏`,"bsim;":`∽`,"bsime;":`⋍`,"bsol;":`\\`,"bsolb;":`⧅`,"bsolhsub;":`⟈`,"bull;":`•`,"bullet;":`•`,"bump;":`≎`,"bumpE;":`⪮`,"bumpe;":`≏`,"bumpeq;":`≏`,"cacute;":`ć`,"cap;":`∩`,"capand;":`⩄`,"capbrcup;":`⩉`,"capcap;":`⩋`,"capcup;":`⩇`,"capdot;":`⩀`,"caps;":`∩︀`,"caret;":`⁁`,"caron;":`ˇ`,"ccaps;":`⩍`,"ccaron;":`č`,ccedil:`ç`,"ccedil;":`ç`,"ccirc;":`ĉ`,"ccups;":`⩌`,"ccupssm;":`⩐`,"cdot;":`ċ`,cedil:`¸`,"cedil;":`¸`,"cemptyv;":`⦲`,cent:`¢`,"cent;":`¢`,"centerdot;":`·`,"cfr;":`𝔠`,"chcy;":`ч`,"check;":`✓`,"checkmark;":`✓`,"chi;":`χ`,"cir;":`○`,"cirE;":`⧃`,"circ;":`ˆ`,"circeq;":`≗`,"circlearrowleft;":`↺`,"circlearrowright;":`↻`,"circledR;":`®`,"circledS;":`Ⓢ`,"circledast;":`⊛`,"circledcirc;":`⊚`,"circleddash;":`⊝`,"cire;":`≗`,"cirfnint;":`⨐`,"cirmid;":`⫯`,"cirscir;":`⧂`,"clubs;":`♣`,"clubsuit;":`♣`,"colon;":`:`,"colone;":`≔`,"coloneq;":`≔`,"comma;":`,`,"commat;":`@`,"comp;":`∁`,"compfn;":`∘`,"complement;":`∁`,"complexes;":`ℂ`,"cong;":`≅`,"congdot;":`⩭`,"conint;":`∮`,"copf;":`𝕔`,"coprod;":`∐`,copy:`©`,"copy;":`©`,"copysr;":`℗`,"crarr;":`↵`,"cross;":`✗`,"cscr;":`𝒸`,"csub;":`⫏`,"csube;":`⫑`,"csup;":`⫐`,"csupe;":`⫒`,"ctdot;":`⋯`,"cudarrl;":`⤸`,"cudarrr;":`⤵`,"cuepr;":`⋞`,"cuesc;":`⋟`,"cularr;":`↶`,"cularrp;":`⤽`,"cup;":`∪`,"cupbrcap;":`⩈`,"cupcap;":`⩆`,"cupcup;":`⩊`,"cupdot;":`⊍`,"cupor;":`⩅`,"cups;":`∪︀`,"curarr;":`↷`,"curarrm;":`⤼`,"curlyeqprec;":`⋞`,"curlyeqsucc;":`⋟`,"curlyvee;":`⋎`,"curlywedge;":`⋏`,curren:`¤`,"curren;":`¤`,"curvearrowleft;":`↶`,"curvearrowright;":`↷`,"cuvee;":`⋎`,"cuwed;":`⋏`,"cwconint;":`∲`,"cwint;":`∱`,"cylcty;":`⌭`,"dArr;":`⇓`,"dHar;":`⥥`,"dagger;":`†`,"daleth;":`ℸ`,"darr;":`↓`,"dash;":`‐`,"dashv;":`⊣`,"dbkarow;":`⤏`,"dblac;":`˝`,"dcaron;":`ď`,"dcy;":`д`,"dd;":`ⅆ`,"ddagger;":`‡`,"ddarr;":`⇊`,"ddotseq;":`⩷`,deg:`°`,"deg;":`°`,"delta;":`δ`,"demptyv;":`⦱`,"dfisht;":`⥿`,"dfr;":`𝔡`,"dharl;":`⇃`,"dharr;":`⇂`,"diam;":`⋄`,"diamond;":`⋄`,"diamondsuit;":`♦`,"diams;":`♦`,"die;":`¨`,"digamma;":`ϝ`,"disin;":`⋲`,"div;":`÷`,divide:`÷`,"divide;":`÷`,"divideontimes;":`⋇`,"divonx;":`⋇`,"djcy;":`ђ`,"dlcorn;":`⌞`,"dlcrop;":`⌍`,"dollar;":`$`,"dopf;":`𝕕`,"dot;":`˙`,"doteq;":`≐`,"doteqdot;":`≑`,"dotminus;":`∸`,"dotplus;":`∔`,"dotsquare;":`⊡`,"doublebarwedge;":`⌆`,"downarrow;":`↓`,"downdownarrows;":`⇊`,"downharpoonleft;":`⇃`,"downharpoonright;":`⇂`,"drbkarow;":`⤐`,"drcorn;":`⌟`,"drcrop;":`⌌`,"dscr;":`𝒹`,"dscy;":`ѕ`,"dsol;":`⧶`,"dstrok;":`đ`,"dtdot;":`⋱`,"dtri;":`▿`,"dtrif;":`▾`,"duarr;":`⇵`,"duhar;":`⥯`,"dwangle;":`⦦`,"dzcy;":`џ`,"dzigrarr;":`⟿`,"eDDot;":`⩷`,"eDot;":`≑`,eacute:`é`,"eacute;":`é`,"easter;":`⩮`,"ecaron;":`ě`,"ecir;":`≖`,ecirc:`ê`,"ecirc;":`ê`,"ecolon;":`≕`,"ecy;":`э`,"edot;":`ė`,"ee;":`ⅇ`,"efDot;":`≒`,"efr;":`𝔢`,"eg;":`⪚`,egrave:`è`,"egrave;":`è`,"egs;":`⪖`,"egsdot;":`⪘`,"el;":`⪙`,"elinters;":`⏧`,"ell;":`ℓ`,"els;":`⪕`,"elsdot;":`⪗`,"emacr;":`ē`,"empty;":`∅`,"emptyset;":`∅`,"emptyv;":`∅`,"emsp13;":` `,"emsp14;":` `,"emsp;":` `,"eng;":`ŋ`,"ensp;":` `,"eogon;":`ę`,"eopf;":`𝕖`,"epar;":`⋕`,"eparsl;":`⧣`,"eplus;":`⩱`,"epsi;":`ε`,"epsilon;":`ε`,"epsiv;":`ϵ`,"eqcirc;":`≖`,"eqcolon;":`≕`,"eqsim;":`≂`,"eqslantgtr;":`⪖`,"eqslantless;":`⪕`,"equals;":`=`,"equest;":`≟`,"equiv;":`≡`,"equivDD;":`⩸`,"eqvparsl;":`⧥`,"erDot;":`≓`,"erarr;":`⥱`,"escr;":`ℯ`,"esdot;":`≐`,"esim;":`≂`,"eta;":`η`,eth:`ð`,"eth;":`ð`,euml:`ë`,"euml;":`ë`,"euro;":`€`,"excl;":`!`,"exist;":`∃`,"expectation;":`ℰ`,"exponentiale;":`ⅇ`,"fallingdotseq;":`≒`,"fcy;":`ф`,"female;":`♀`,"ffilig;":`ffi`,"fflig;":`ff`,"ffllig;":`ffl`,"ffr;":`𝔣`,"filig;":`fi`,"fjlig;":`fj`,"flat;":`♭`,"fllig;":`fl`,"fltns;":`▱`,"fnof;":`ƒ`,"fopf;":`𝕗`,"forall;":`∀`,"fork;":`⋔`,"forkv;":`⫙`,"fpartint;":`⨍`,frac12:`½`,"frac12;":`½`,"frac13;":`⅓`,frac14:`¼`,"frac14;":`¼`,"frac15;":`⅕`,"frac16;":`⅙`,"frac18;":`⅛`,"frac23;":`⅔`,"frac25;":`⅖`,frac34:`¾`,"frac34;":`¾`,"frac35;":`⅗`,"frac38;":`⅜`,"frac45;":`⅘`,"frac56;":`⅚`,"frac58;":`⅝`,"frac78;":`⅞`,"frasl;":`⁄`,"frown;":`⌢`,"fscr;":`𝒻`,"gE;":`≧`,"gEl;":`⪌`,"gacute;":`ǵ`,"gamma;":`γ`,"gammad;":`ϝ`,"gap;":`⪆`,"gbreve;":`ğ`,"gcirc;":`ĝ`,"gcy;":`г`,"gdot;":`ġ`,"ge;":`≥`,"gel;":`⋛`,"geq;":`≥`,"geqq;":`≧`,"geqslant;":`⩾`,"ges;":`⩾`,"gescc;":`⪩`,"gesdot;":`⪀`,"gesdoto;":`⪂`,"gesdotol;":`⪄`,"gesl;":`⋛︀`,"gesles;":`⪔`,"gfr;":`𝔤`,"gg;":`≫`,"ggg;":`⋙`,"gimel;":`ℷ`,"gjcy;":`ѓ`,"gl;":`≷`,"glE;":`⪒`,"gla;":`⪥`,"glj;":`⪤`,"gnE;":`≩`,"gnap;":`⪊`,"gnapprox;":`⪊`,"gne;":`⪈`,"gneq;":`⪈`,"gneqq;":`≩`,"gnsim;":`⋧`,"gopf;":`𝕘`,"grave;":"`","gscr;":`ℊ`,"gsim;":`≳`,"gsime;":`⪎`,"gsiml;":`⪐`,gt:`>`,"gt;":`>`,"gtcc;":`⪧`,"gtcir;":`⩺`,"gtdot;":`⋗`,"gtlPar;":`⦕`,"gtquest;":`⩼`,"gtrapprox;":`⪆`,"gtrarr;":`⥸`,"gtrdot;":`⋗`,"gtreqless;":`⋛`,"gtreqqless;":`⪌`,"gtrless;":`≷`,"gtrsim;":`≳`,"gvertneqq;":`≩︀`,"gvnE;":`≩︀`,"hArr;":`⇔`,"hairsp;":` `,"half;":`½`,"hamilt;":`ℋ`,"hardcy;":`ъ`,"harr;":`↔`,"harrcir;":`⥈`,"harrw;":`↭`,"hbar;":`ℏ`,"hcirc;":`ĥ`,"hearts;":`♥`,"heartsuit;":`♥`,"hellip;":`…`,"hercon;":`⊹`,"hfr;":`𝔥`,"hksearow;":`⤥`,"hkswarow;":`⤦`,"hoarr;":`⇿`,"homtht;":`∻`,"hookleftarrow;":`↩`,"hookrightarrow;":`↪`,"hopf;":`𝕙`,"horbar;":`―`,"hscr;":`𝒽`,"hslash;":`ℏ`,"hstrok;":`ħ`,"hybull;":`⁃`,"hyphen;":`‐`,iacute:`í`,"iacute;":`í`,"ic;":`⁣`,icirc:`î`,"icirc;":`î`,"icy;":`и`,"iecy;":`е`,iexcl:`¡`,"iexcl;":`¡`,"iff;":`⇔`,"ifr;":`𝔦`,igrave:`ì`,"igrave;":`ì`,"ii;":`ⅈ`,"iiiint;":`⨌`,"iiint;":`∭`,"iinfin;":`⧜`,"iiota;":`℩`,"ijlig;":`ij`,"imacr;":`ī`,"image;":`ℑ`,"imagline;":`ℐ`,"imagpart;":`ℑ`,"imath;":`ı`,"imof;":`⊷`,"imped;":`Ƶ`,"in;":`∈`,"incare;":`℅`,"infin;":`∞`,"infintie;":`⧝`,"inodot;":`ı`,"int;":`∫`,"intcal;":`⊺`,"integers;":`ℤ`,"intercal;":`⊺`,"intlarhk;":`⨗`,"intprod;":`⨼`,"iocy;":`ё`,"iogon;":`į`,"iopf;":`𝕚`,"iota;":`ι`,"iprod;":`⨼`,iquest:`¿`,"iquest;":`¿`,"iscr;":`𝒾`,"isin;":`∈`,"isinE;":`⋹`,"isindot;":`⋵`,"isins;":`⋴`,"isinsv;":`⋳`,"isinv;":`∈`,"it;":`⁢`,"itilde;":`ĩ`,"iukcy;":`і`,iuml:`ï`,"iuml;":`ï`,"jcirc;":`ĵ`,"jcy;":`й`,"jfr;":`𝔧`,"jmath;":`ȷ`,"jopf;":`𝕛`,"jscr;":`𝒿`,"jsercy;":`ј`,"jukcy;":`є`,"kappa;":`κ`,"kappav;":`ϰ`,"kcedil;":`ķ`,"kcy;":`к`,"kfr;":`𝔨`,"kgreen;":`ĸ`,"khcy;":`х`,"kjcy;":`ќ`,"kopf;":`𝕜`,"kscr;":`𝓀`,"lAarr;":`⇚`,"lArr;":`⇐`,"lAtail;":`⤛`,"lBarr;":`⤎`,"lE;":`≦`,"lEg;":`⪋`,"lHar;":`⥢`,"lacute;":`ĺ`,"laemptyv;":`⦴`,"lagran;":`ℒ`,"lambda;":`λ`,"lang;":`⟨`,"langd;":`⦑`,"langle;":`⟨`,"lap;":`⪅`,laquo:`«`,"laquo;":`«`,"larr;":`←`,"larrb;":`⇤`,"larrbfs;":`⤟`,"larrfs;":`⤝`,"larrhk;":`↩`,"larrlp;":`↫`,"larrpl;":`⤹`,"larrsim;":`⥳`,"larrtl;":`↢`,"lat;":`⪫`,"latail;":`⤙`,"late;":`⪭`,"lates;":`⪭︀`,"lbarr;":`⤌`,"lbbrk;":`❲`,"lbrace;":`{`,"lbrack;":`[`,"lbrke;":`⦋`,"lbrksld;":`⦏`,"lbrkslu;":`⦍`,"lcaron;":`ľ`,"lcedil;":`ļ`,"lceil;":`⌈`,"lcub;":`{`,"lcy;":`л`,"ldca;":`⤶`,"ldquo;":`“`,"ldquor;":`„`,"ldrdhar;":`⥧`,"ldrushar;":`⥋`,"ldsh;":`↲`,"le;":`≤`,"leftarrow;":`←`,"leftarrowtail;":`↢`,"leftharpoondown;":`↽`,"leftharpoonup;":`↼`,"leftleftarrows;":`⇇`,"leftrightarrow;":`↔`,"leftrightarrows;":`⇆`,"leftrightharpoons;":`⇋`,"leftrightsquigarrow;":`↭`,"leftthreetimes;":`⋋`,"leg;":`⋚`,"leq;":`≤`,"leqq;":`≦`,"leqslant;":`⩽`,"les;":`⩽`,"lescc;":`⪨`,"lesdot;":`⩿`,"lesdoto;":`⪁`,"lesdotor;":`⪃`,"lesg;":`⋚︀`,"lesges;":`⪓`,"lessapprox;":`⪅`,"lessdot;":`⋖`,"lesseqgtr;":`⋚`,"lesseqqgtr;":`⪋`,"lessgtr;":`≶`,"lesssim;":`≲`,"lfisht;":`⥼`,"lfloor;":`⌊`,"lfr;":`𝔩`,"lg;":`≶`,"lgE;":`⪑`,"lhard;":`↽`,"lharu;":`↼`,"lharul;":`⥪`,"lhblk;":`▄`,"ljcy;":`љ`,"ll;":`≪`,"llarr;":`⇇`,"llcorner;":`⌞`,"llhard;":`⥫`,"lltri;":`◺`,"lmidot;":`ŀ`,"lmoust;":`⎰`,"lmoustache;":`⎰`,"lnE;":`≨`,"lnap;":`⪉`,"lnapprox;":`⪉`,"lne;":`⪇`,"lneq;":`⪇`,"lneqq;":`≨`,"lnsim;":`⋦`,"loang;":`⟬`,"loarr;":`⇽`,"lobrk;":`⟦`,"longleftarrow;":`⟵`,"longleftrightarrow;":`⟷`,"longmapsto;":`⟼`,"longrightarrow;":`⟶`,"looparrowleft;":`↫`,"looparrowright;":`↬`,"lopar;":`⦅`,"lopf;":`𝕝`,"loplus;":`⨭`,"lotimes;":`⨴`,"lowast;":`∗`,"lowbar;":`_`,"loz;":`◊`,"lozenge;":`◊`,"lozf;":`⧫`,"lpar;":`(`,"lparlt;":`⦓`,"lrarr;":`⇆`,"lrcorner;":`⌟`,"lrhar;":`⇋`,"lrhard;":`⥭`,"lrm;":`‎`,"lrtri;":`⊿`,"lsaquo;":`‹`,"lscr;":`𝓁`,"lsh;":`↰`,"lsim;":`≲`,"lsime;":`⪍`,"lsimg;":`⪏`,"lsqb;":`[`,"lsquo;":`‘`,"lsquor;":`‚`,"lstrok;":`ł`,lt:`<`,"lt;":`<`,"ltcc;":`⪦`,"ltcir;":`⩹`,"ltdot;":`⋖`,"lthree;":`⋋`,"ltimes;":`⋉`,"ltlarr;":`⥶`,"ltquest;":`⩻`,"ltrPar;":`⦖`,"ltri;":`◃`,"ltrie;":`⊴`,"ltrif;":`◂`,"lurdshar;":`⥊`,"luruhar;":`⥦`,"lvertneqq;":`≨︀`,"lvnE;":`≨︀`,"mDDot;":`∺`,macr:`¯`,"macr;":`¯`,"male;":`♂`,"malt;":`✠`,"maltese;":`✠`,"map;":`↦`,"mapsto;":`↦`,"mapstodown;":`↧`,"mapstoleft;":`↤`,"mapstoup;":`↥`,"marker;":`▮`,"mcomma;":`⨩`,"mcy;":`м`,"mdash;":`—`,"measuredangle;":`∡`,"mfr;":`𝔪`,"mho;":`℧`,micro:`µ`,"micro;":`µ`,"mid;":`∣`,"midast;":`*`,"midcir;":`⫰`,middot:`·`,"middot;":`·`,"minus;":`−`,"minusb;":`⊟`,"minusd;":`∸`,"minusdu;":`⨪`,"mlcp;":`⫛`,"mldr;":`…`,"mnplus;":`∓`,"models;":`⊧`,"mopf;":`𝕞`,"mp;":`∓`,"mscr;":`𝓂`,"mstpos;":`∾`,"mu;":`μ`,"multimap;":`⊸`,"mumap;":`⊸`,"nGg;":`⋙̸`,"nGt;":`≫⃒`,"nGtv;":`≫̸`,"nLeftarrow;":`⇍`,"nLeftrightarrow;":`⇎`,"nLl;":`⋘̸`,"nLt;":`≪⃒`,"nLtv;":`≪̸`,"nRightarrow;":`⇏`,"nVDash;":`⊯`,"nVdash;":`⊮`,"nabla;":`∇`,"nacute;":`ń`,"nang;":`∠⃒`,"nap;":`≉`,"napE;":`⩰̸`,"napid;":`≋̸`,"napos;":`ʼn`,"napprox;":`≉`,"natur;":`♮`,"natural;":`♮`,"naturals;":`ℕ`,nbsp:`\xA0`,"nbsp;":`\xA0`,"nbump;":`≎̸`,"nbumpe;":`≏̸`,"ncap;":`⩃`,"ncaron;":`ň`,"ncedil;":`ņ`,"ncong;":`≇`,"ncongdot;":`⩭̸`,"ncup;":`⩂`,"ncy;":`н`,"ndash;":`–`,"ne;":`≠`,"neArr;":`⇗`,"nearhk;":`⤤`,"nearr;":`↗`,"nearrow;":`↗`,"nedot;":`≐̸`,"nequiv;":`≢`,"nesear;":`⤨`,"nesim;":`≂̸`,"nexist;":`∄`,"nexists;":`∄`,"nfr;":`𝔫`,"ngE;":`≧̸`,"nge;":`≱`,"ngeq;":`≱`,"ngeqq;":`≧̸`,"ngeqslant;":`⩾̸`,"nges;":`⩾̸`,"ngsim;":`≵`,"ngt;":`≯`,"ngtr;":`≯`,"nhArr;":`⇎`,"nharr;":`↮`,"nhpar;":`⫲`,"ni;":`∋`,"nis;":`⋼`,"nisd;":`⋺`,"niv;":`∋`,"njcy;":`њ`,"nlArr;":`⇍`,"nlE;":`≦̸`,"nlarr;":`↚`,"nldr;":`‥`,"nle;":`≰`,"nleftarrow;":`↚`,"nleftrightarrow;":`↮`,"nleq;":`≰`,"nleqq;":`≦̸`,"nleqslant;":`⩽̸`,"nles;":`⩽̸`,"nless;":`≮`,"nlsim;":`≴`,"nlt;":`≮`,"nltri;":`⋪`,"nltrie;":`⋬`,"nmid;":`∤`,"nopf;":`𝕟`,not:`¬`,"not;":`¬`,"notin;":`∉`,"notinE;":`⋹̸`,"notindot;":`⋵̸`,"notinva;":`∉`,"notinvb;":`⋷`,"notinvc;":`⋶`,"notni;":`∌`,"notniva;":`∌`,"notnivb;":`⋾`,"notnivc;":`⋽`,"npar;":`∦`,"nparallel;":`∦`,"nparsl;":`⫽⃥`,"npart;":`∂̸`,"npolint;":`⨔`,"npr;":`⊀`,"nprcue;":`⋠`,"npre;":`⪯̸`,"nprec;":`⊀`,"npreceq;":`⪯̸`,"nrArr;":`⇏`,"nrarr;":`↛`,"nrarrc;":`⤳̸`,"nrarrw;":`↝̸`,"nrightarrow;":`↛`,"nrtri;":`⋫`,"nrtrie;":`⋭`,"nsc;":`⊁`,"nsccue;":`⋡`,"nsce;":`⪰̸`,"nscr;":`𝓃`,"nshortmid;":`∤`,"nshortparallel;":`∦`,"nsim;":`≁`,"nsime;":`≄`,"nsimeq;":`≄`,"nsmid;":`∤`,"nspar;":`∦`,"nsqsube;":`⋢`,"nsqsupe;":`⋣`,"nsub;":`⊄`,"nsubE;":`⫅̸`,"nsube;":`⊈`,"nsubset;":`⊂⃒`,"nsubseteq;":`⊈`,"nsubseteqq;":`⫅̸`,"nsucc;":`⊁`,"nsucceq;":`⪰̸`,"nsup;":`⊅`,"nsupE;":`⫆̸`,"nsupe;":`⊉`,"nsupset;":`⊃⃒`,"nsupseteq;":`⊉`,"nsupseteqq;":`⫆̸`,"ntgl;":`≹`,ntilde:`ñ`,"ntilde;":`ñ`,"ntlg;":`≸`,"ntriangleleft;":`⋪`,"ntrianglelefteq;":`⋬`,"ntriangleright;":`⋫`,"ntrianglerighteq;":`⋭`,"nu;":`ν`,"num;":`#`,"numero;":`№`,"numsp;":` `,"nvDash;":`⊭`,"nvHarr;":`⤄`,"nvap;":`≍⃒`,"nvdash;":`⊬`,"nvge;":`≥⃒`,"nvgt;":`>⃒`,"nvinfin;":`⧞`,"nvlArr;":`⤂`,"nvle;":`≤⃒`,"nvlt;":`<⃒`,"nvltrie;":`⊴⃒`,"nvrArr;":`⤃`,"nvrtrie;":`⊵⃒`,"nvsim;":`∼⃒`,"nwArr;":`⇖`,"nwarhk;":`⤣`,"nwarr;":`↖`,"nwarrow;":`↖`,"nwnear;":`⤧`,"oS;":`Ⓢ`,oacute:`ó`,"oacute;":`ó`,"oast;":`⊛`,"ocir;":`⊚`,ocirc:`ô`,"ocirc;":`ô`,"ocy;":`о`,"odash;":`⊝`,"odblac;":`ő`,"odiv;":`⨸`,"odot;":`⊙`,"odsold;":`⦼`,"oelig;":`œ`,"ofcir;":`⦿`,"ofr;":`𝔬`,"ogon;":`˛`,ograve:`ò`,"ograve;":`ò`,"ogt;":`⧁`,"ohbar;":`⦵`,"ohm;":`Ω`,"oint;":`∮`,"olarr;":`↺`,"olcir;":`⦾`,"olcross;":`⦻`,"oline;":`‾`,"olt;":`⧀`,"omacr;":`ō`,"omega;":`ω`,"omicron;":`ο`,"omid;":`⦶`,"ominus;":`⊖`,"oopf;":`𝕠`,"opar;":`⦷`,"operp;":`⦹`,"oplus;":`⊕`,"or;":`∨`,"orarr;":`↻`,"ord;":`⩝`,"order;":`ℴ`,"orderof;":`ℴ`,ordf:`ª`,"ordf;":`ª`,ordm:`º`,"ordm;":`º`,"origof;":`⊶`,"oror;":`⩖`,"orslope;":`⩗`,"orv;":`⩛`,"oscr;":`ℴ`,oslash:`ø`,"oslash;":`ø`,"osol;":`⊘`,otilde:`õ`,"otilde;":`õ`,"otimes;":`⊗`,"otimesas;":`⨶`,ouml:`ö`,"ouml;":`ö`,"ovbar;":`⌽`,"par;":`∥`,para:`¶`,"para;":`¶`,"parallel;":`∥`,"parsim;":`⫳`,"parsl;":`⫽`,"part;":`∂`,"pcy;":`п`,"percnt;":`%`,"period;":`.`,"permil;":`‰`,"perp;":`⊥`,"pertenk;":`‱`,"pfr;":`𝔭`,"phi;":`φ`,"phiv;":`ϕ`,"phmmat;":`ℳ`,"phone;":`☎`,"pi;":`π`,"pitchfork;":`⋔`,"piv;":`ϖ`,"planck;":`ℏ`,"planckh;":`ℎ`,"plankv;":`ℏ`,"plus;":`+`,"plusacir;":`⨣`,"plusb;":`⊞`,"pluscir;":`⨢`,"plusdo;":`∔`,"plusdu;":`⨥`,"pluse;":`⩲`,plusmn:`±`,"plusmn;":`±`,"plussim;":`⨦`,"plustwo;":`⨧`,"pm;":`±`,"pointint;":`⨕`,"popf;":`𝕡`,pound:`£`,"pound;":`£`,"pr;":`≺`,"prE;":`⪳`,"prap;":`⪷`,"prcue;":`≼`,"pre;":`⪯`,"prec;":`≺`,"precapprox;":`⪷`,"preccurlyeq;":`≼`,"preceq;":`⪯`,"precnapprox;":`⪹`,"precneqq;":`⪵`,"precnsim;":`⋨`,"precsim;":`≾`,"prime;":`′`,"primes;":`ℙ`,"prnE;":`⪵`,"prnap;":`⪹`,"prnsim;":`⋨`,"prod;":`∏`,"profalar;":`⌮`,"profline;":`⌒`,"profsurf;":`⌓`,"prop;":`∝`,"propto;":`∝`,"prsim;":`≾`,"prurel;":`⊰`,"pscr;":`𝓅`,"psi;":`ψ`,"puncsp;":` `,"qfr;":`𝔮`,"qint;":`⨌`,"qopf;":`𝕢`,"qprime;":`⁗`,"qscr;":`𝓆`,"quaternions;":`ℍ`,"quatint;":`⨖`,"quest;":`?`,"questeq;":`≟`,quot:`"`,"quot;":`"`,"rAarr;":`⇛`,"rArr;":`⇒`,"rAtail;":`⤜`,"rBarr;":`⤏`,"rHar;":`⥤`,"race;":`∽̱`,"racute;":`ŕ`,"radic;":`√`,"raemptyv;":`⦳`,"rang;":`⟩`,"rangd;":`⦒`,"range;":`⦥`,"rangle;":`⟩`,raquo:`»`,"raquo;":`»`,"rarr;":`→`,"rarrap;":`⥵`,"rarrb;":`⇥`,"rarrbfs;":`⤠`,"rarrc;":`⤳`,"rarrfs;":`⤞`,"rarrhk;":`↪`,"rarrlp;":`↬`,"rarrpl;":`⥅`,"rarrsim;":`⥴`,"rarrtl;":`↣`,"rarrw;":`↝`,"ratail;":`⤚`,"ratio;":`∶`,"rationals;":`ℚ`,"rbarr;":`⤍`,"rbbrk;":`❳`,"rbrace;":`}`,"rbrack;":`]`,"rbrke;":`⦌`,"rbrksld;":`⦎`,"rbrkslu;":`⦐`,"rcaron;":`ř`,"rcedil;":`ŗ`,"rceil;":`⌉`,"rcub;":`}`,"rcy;":`р`,"rdca;":`⤷`,"rdldhar;":`⥩`,"rdquo;":`”`,"rdquor;":`”`,"rdsh;":`↳`,"real;":`ℜ`,"realine;":`ℛ`,"realpart;":`ℜ`,"reals;":`ℝ`,"rect;":`▭`,reg:`®`,"reg;":`®`,"rfisht;":`⥽`,"rfloor;":`⌋`,"rfr;":`𝔯`,"rhard;":`⇁`,"rharu;":`⇀`,"rharul;":`⥬`,"rho;":`ρ`,"rhov;":`ϱ`,"rightarrow;":`→`,"rightarrowtail;":`↣`,"rightharpoondown;":`⇁`,"rightharpoonup;":`⇀`,"rightleftarrows;":`⇄`,"rightleftharpoons;":`⇌`,"rightrightarrows;":`⇉`,"rightsquigarrow;":`↝`,"rightthreetimes;":`⋌`,"ring;":`˚`,"risingdotseq;":`≓`,"rlarr;":`⇄`,"rlhar;":`⇌`,"rlm;":`‏`,"rmoust;":`⎱`,"rmoustache;":`⎱`,"rnmid;":`⫮`,"roang;":`⟭`,"roarr;":`⇾`,"robrk;":`⟧`,"ropar;":`⦆`,"ropf;":`𝕣`,"roplus;":`⨮`,"rotimes;":`⨵`,"rpar;":`)`,"rpargt;":`⦔`,"rppolint;":`⨒`,"rrarr;":`⇉`,"rsaquo;":`›`,"rscr;":`𝓇`,"rsh;":`↱`,"rsqb;":`]`,"rsquo;":`’`,"rsquor;":`’`,"rthree;":`⋌`,"rtimes;":`⋊`,"rtri;":`▹`,"rtrie;":`⊵`,"rtrif;":`▸`,"rtriltri;":`⧎`,"ruluhar;":`⥨`,"rx;":`℞`,"sacute;":`ś`,"sbquo;":`‚`,"sc;":`≻`,"scE;":`⪴`,"scap;":`⪸`,"scaron;":`š`,"sccue;":`≽`,"sce;":`⪰`,"scedil;":`ş`,"scirc;":`ŝ`,"scnE;":`⪶`,"scnap;":`⪺`,"scnsim;":`⋩`,"scpolint;":`⨓`,"scsim;":`≿`,"scy;":`с`,"sdot;":`⋅`,"sdotb;":`⊡`,"sdote;":`⩦`,"seArr;":`⇘`,"searhk;":`⤥`,"searr;":`↘`,"searrow;":`↘`,sect:`§`,"sect;":`§`,"semi;":`;`,"seswar;":`⤩`,"setminus;":`∖`,"setmn;":`∖`,"sext;":`✶`,"sfr;":`𝔰`,"sfrown;":`⌢`,"sharp;":`♯`,"shchcy;":`щ`,"shcy;":`ш`,"shortmid;":`∣`,"shortparallel;":`∥`,shy:`­`,"shy;":`­`,"sigma;":`σ`,"sigmaf;":`ς`,"sigmav;":`ς`,"sim;":`∼`,"simdot;":`⩪`,"sime;":`≃`,"simeq;":`≃`,"simg;":`⪞`,"simgE;":`⪠`,"siml;":`⪝`,"simlE;":`⪟`,"simne;":`≆`,"simplus;":`⨤`,"simrarr;":`⥲`,"slarr;":`←`,"smallsetminus;":`∖`,"smashp;":`⨳`,"smeparsl;":`⧤`,"smid;":`∣`,"smile;":`⌣`,"smt;":`⪪`,"smte;":`⪬`,"smtes;":`⪬︀`,"softcy;":`ь`,"sol;":`/`,"solb;":`⧄`,"solbar;":`⌿`,"sopf;":`𝕤`,"spades;":`♠`,"spadesuit;":`♠`,"spar;":`∥`,"sqcap;":`⊓`,"sqcaps;":`⊓︀`,"sqcup;":`⊔`,"sqcups;":`⊔︀`,"sqsub;":`⊏`,"sqsube;":`⊑`,"sqsubset;":`⊏`,"sqsubseteq;":`⊑`,"sqsup;":`⊐`,"sqsupe;":`⊒`,"sqsupset;":`⊐`,"sqsupseteq;":`⊒`,"squ;":`□`,"square;":`□`,"squarf;":`▪`,"squf;":`▪`,"srarr;":`→`,"sscr;":`𝓈`,"ssetmn;":`∖`,"ssmile;":`⌣`,"sstarf;":`⋆`,"star;":`☆`,"starf;":`★`,"straightepsilon;":`ϵ`,"straightphi;":`ϕ`,"strns;":`¯`,"sub;":`⊂`,"subE;":`⫅`,"subdot;":`⪽`,"sube;":`⊆`,"subedot;":`⫃`,"submult;":`⫁`,"subnE;":`⫋`,"subne;":`⊊`,"subplus;":`⪿`,"subrarr;":`⥹`,"subset;":`⊂`,"subseteq;":`⊆`,"subseteqq;":`⫅`,"subsetneq;":`⊊`,"subsetneqq;":`⫋`,"subsim;":`⫇`,"subsub;":`⫕`,"subsup;":`⫓`,"succ;":`≻`,"succapprox;":`⪸`,"succcurlyeq;":`≽`,"succeq;":`⪰`,"succnapprox;":`⪺`,"succneqq;":`⪶`,"succnsim;":`⋩`,"succsim;":`≿`,"sum;":`∑`,"sung;":`♪`,sup1:`¹`,"sup1;":`¹`,sup2:`²`,"sup2;":`²`,sup3:`³`,"sup3;":`³`,"sup;":`⊃`,"supE;":`⫆`,"supdot;":`⪾`,"supdsub;":`⫘`,"supe;":`⊇`,"supedot;":`⫄`,"suphsol;":`⟉`,"suphsub;":`⫗`,"suplarr;":`⥻`,"supmult;":`⫂`,"supnE;":`⫌`,"supne;":`⊋`,"supplus;":`⫀`,"supset;":`⊃`,"supseteq;":`⊇`,"supseteqq;":`⫆`,"supsetneq;":`⊋`,"supsetneqq;":`⫌`,"supsim;":`⫈`,"supsub;":`⫔`,"supsup;":`⫖`,"swArr;":`⇙`,"swarhk;":`⤦`,"swarr;":`↙`,"swarrow;":`↙`,"swnwar;":`⤪`,szlig:`ß`,"szlig;":`ß`,"target;":`⌖`,"tau;":`τ`,"tbrk;":`⎴`,"tcaron;":`ť`,"tcedil;":`ţ`,"tcy;":`т`,"tdot;":`⃛`,"telrec;":`⌕`,"tfr;":`𝔱`,"there4;":`∴`,"therefore;":`∴`,"theta;":`θ`,"thetasym;":`ϑ`,"thetav;":`ϑ`,"thickapprox;":`≈`,"thicksim;":`∼`,"thinsp;":` `,"thkap;":`≈`,"thksim;":`∼`,thorn:`þ`,"thorn;":`þ`,"tilde;":`˜`,times:`×`,"times;":`×`,"timesb;":`⊠`,"timesbar;":`⨱`,"timesd;":`⨰`,"tint;":`∭`,"toea;":`⤨`,"top;":`⊤`,"topbot;":`⌶`,"topcir;":`⫱`,"topf;":`𝕥`,"topfork;":`⫚`,"tosa;":`⤩`,"tprime;":`‴`,"trade;":`™`,"triangle;":`▵`,"triangledown;":`▿`,"triangleleft;":`◃`,"trianglelefteq;":`⊴`,"triangleq;":`≜`,"triangleright;":`▹`,"trianglerighteq;":`⊵`,"tridot;":`◬`,"trie;":`≜`,"triminus;":`⨺`,"triplus;":`⨹`,"trisb;":`⧍`,"tritime;":`⨻`,"trpezium;":`⏢`,"tscr;":`𝓉`,"tscy;":`ц`,"tshcy;":`ћ`,"tstrok;":`ŧ`,"twixt;":`≬`,"twoheadleftarrow;":`↞`,"twoheadrightarrow;":`↠`,"uArr;":`⇑`,"uHar;":`⥣`,uacute:`ú`,"uacute;":`ú`,"uarr;":`↑`,"ubrcy;":`ў`,"ubreve;":`ŭ`,ucirc:`û`,"ucirc;":`û`,"ucy;":`у`,"udarr;":`⇅`,"udblac;":`ű`,"udhar;":`⥮`,"ufisht;":`⥾`,"ufr;":`𝔲`,ugrave:`ù`,"ugrave;":`ù`,"uharl;":`↿`,"uharr;":`↾`,"uhblk;":`▀`,"ulcorn;":`⌜`,"ulcorner;":`⌜`,"ulcrop;":`⌏`,"ultri;":`◸`,"umacr;":`ū`,uml:`¨`,"uml;":`¨`,"uogon;":`ų`,"uopf;":`𝕦`,"uparrow;":`↑`,"updownarrow;":`↕`,"upharpoonleft;":`↿`,"upharpoonright;":`↾`,"uplus;":`⊎`,"upsi;":`υ`,"upsih;":`ϒ`,"upsilon;":`υ`,"upuparrows;":`⇈`,"urcorn;":`⌝`,"urcorner;":`⌝`,"urcrop;":`⌎`,"uring;":`ů`,"urtri;":`◹`,"uscr;":`𝓊`,"utdot;":`⋰`,"utilde;":`ũ`,"utri;":`▵`,"utrif;":`▴`,"uuarr;":`⇈`,uuml:`ü`,"uuml;":`ü`,"uwangle;":`⦧`,"vArr;":`⇕`,"vBar;":`⫨`,"vBarv;":`⫩`,"vDash;":`⊨`,"vangrt;":`⦜`,"varepsilon;":`ϵ`,"varkappa;":`ϰ`,"varnothing;":`∅`,"varphi;":`ϕ`,"varpi;":`ϖ`,"varpropto;":`∝`,"varr;":`↕`,"varrho;":`ϱ`,"varsigma;":`ς`,"varsubsetneq;":`⊊︀`,"varsubsetneqq;":`⫋︀`,"varsupsetneq;":`⊋︀`,"varsupsetneqq;":`⫌︀`,"vartheta;":`ϑ`,"vartriangleleft;":`⊲`,"vartriangleright;":`⊳`,"vcy;":`в`,"vdash;":`⊢`,"vee;":`∨`,"veebar;":`⊻`,"veeeq;":`≚`,"vellip;":`⋮`,"verbar;":`|`,"vert;":`|`,"vfr;":`𝔳`,"vltri;":`⊲`,"vnsub;":`⊂⃒`,"vnsup;":`⊃⃒`,"vopf;":`𝕧`,"vprop;":`∝`,"vrtri;":`⊳`,"vscr;":`𝓋`,"vsubnE;":`⫋︀`,"vsubne;":`⊊︀`,"vsupnE;":`⫌︀`,"vsupne;":`⊋︀`,"vzigzag;":`⦚`,"wcirc;":`ŵ`,"wedbar;":`⩟`,"wedge;":`∧`,"wedgeq;":`≙`,"weierp;":`℘`,"wfr;":`𝔴`,"wopf;":`𝕨`,"wp;":`℘`,"wr;":`≀`,"wreath;":`≀`,"wscr;":`𝓌`,"xcap;":`⋂`,"xcirc;":`◯`,"xcup;":`⋃`,"xdtri;":`▽`,"xfr;":`𝔵`,"xhArr;":`⟺`,"xharr;":`⟷`,"xi;":`ξ`,"xlArr;":`⟸`,"xlarr;":`⟵`,"xmap;":`⟼`,"xnis;":`⋻`,"xodot;":`⨀`,"xopf;":`𝕩`,"xoplus;":`⨁`,"xotime;":`⨂`,"xrArr;":`⟹`,"xrarr;":`⟶`,"xscr;":`𝓍`,"xsqcup;":`⨆`,"xuplus;":`⨄`,"xutri;":`△`,"xvee;":`⋁`,"xwedge;":`⋀`,yacute:`ý`,"yacute;":`ý`,"yacy;":`я`,"ycirc;":`ŷ`,"ycy;":`ы`,yen:`¥`,"yen;":`¥`,"yfr;":`𝔶`,"yicy;":`ї`,"yopf;":`𝕪`,"yscr;":`𝓎`,"yucy;":`ю`,yuml:`ÿ`,"yuml;":`ÿ`,"zacute;":`ź`,"zcaron;":`ž`,"zcy;":`з`,"zdot;":`ż`,"zeetrf;":`ℨ`,"zeta;":`ζ`,"zfr;":`𝔷`,"zhcy;":`ж`,"zigrarr;":`⇝`,"zopf;":`𝕫`,"zscr;":`𝓏`,"zwj;":`‍`,"zwnj;":`‌`},t=32;export{t as MAX_NAMED_REFERENCE_LENGTH,e as NAMED_REFERENCES};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{NAMED_REFERENCES as e}from"./data.js";const t={names:{"amp;":`&`,"apos;":`'`,"gt;":`>`,"lt;":`<`,"quot;":`"`},maxNameLength:5,strict:!0},n={names:e,maxNameLength:32,strict:!1},r={128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376};function isDecimalDigit(e){return e!==void 0&&e>=`0`&&e<=`9`}function isHexDigit(e){return e===void 0?!1:e>=`0`&&e<=`9`||e>=`a`&&e<=`f`||e>=`A`&&e<=`F`}function isAlphanumeric(e){return e===void 0?!1:e>=`0`&&e<=`9`||e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`}function fromCodePoint(e,t,n){let i=Number.parseInt(e,t?16:10);if(!Number.isFinite(i)||i===0||i>1114111||i>=55296&&i<=57343)return`�`;let a=n?r[i]:void 0;return String.fromCodePoint(a===void 0?i:a)}function matchNumeric(e,t,n){let r=t+1,i=e[r]===`x`||e[r]===`X`;i&&r++;let a=r;for(;r<e.length&&(i?isHexDigit(e[r]):isDecimalDigit(e[r]));)r++;return r===a||n.strict&&e[r]!==`;`?{text:``,consumed:0}:{text:fromCodePoint(e.slice(a,r),i,!n.strict),consumed:(e[r]===`;`?r+1:r)-t}}function matchNamed(e,t,n,r){let i=n.names,a=e.slice(t,t+n.maxNameLength);for(let n=a.length;n>0;n--){let o=a.slice(0,n);if(Object.hasOwn(i,o)){if(r&&o[o.length-1]!==`;`){let r=e[t+n];if(r===`=`||isAlphanumeric(r))break}return{text:i[o],consumed:n}}}return{text:``,consumed:0}}function decodeWith(e,t,n){let r=e.indexOf(`&`);if(r===-1)return e;let i=``,a=0;for(;r!==-1;){i+=e.slice(a,r);let o=e[r+1]===`#`?matchNumeric(e,r+1,t):matchNamed(e,r+1,t,n);o.consumed===0?(i+=`&`,a=r+1):(i+=o.text,a=r+1+o.consumed),r=e.indexOf(`&`,a)}return i+e.slice(a)}function decodeText(e){return decodeWith(e,n,!1)}function decodeAttributeValue(e){return decodeWith(e,n,!0)}function decodeXml(e){return decodeWith(e,t,!1)}function decodeHtml(e,r){return r===`strict`?decodeWith(e,t,!1):decodeWith(e,n,r===`attribute`)}export{decodeAttributeValue,decodeHtml,decodeText,decodeXml};
@@ -0,0 +1 @@
1
+ import{NAMED_REFERENCES as e}from"./data.js";import{decodeAttributeValue as t,decodeHtml as n,decodeText as r,decodeXml as i}from"./decode.js";export{e as NAMED_REFERENCES,t as decodeAttributeValue,n as decodeHtml,r as decodeText,i as decodeXml};
@@ -0,0 +1 @@
1
+ const e=new Set([`applet`,`caption`,`html`,`marquee`,`object`,`table`,`td`,`template`,`th`]),t=new Set([...e,`button`]),n=new Set([...e,`ol`,`ul`]),r=new Set([`html`,`table`,`template`]),i=e,a=new Set([`dd`,`dt`,`li`,`optgroup`,`option`,`p`,`rb`,`rp`,`rt`,`rtc`]),o=new Set(`address.article.aside.blockquote.center.details.dialog.dir.div.dl.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.hr.listing.main.menu.nav.ol.p.plaintext.pre.search.section.summary.table.ul.xmp`.split(`.`)),s=new Set(`address.applet.area.article.aside.base.basefont.bgsound.blockquote.body.br.button.caption.center.col.colgroup.dd.details.dir.div.dl.dt.embed.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.iframe.img.input.keygen.li.link.listing.main.marquee.menu.meta.nav.noembed.noframes.noscript.object.ol.p.param.plaintext.pre.script.search.section.select.source.style.summary.table.tbody.td.template.textarea.tfoot.th.thead.title.tr.track.ul.wbr.xmp`.split(`.`)),c=new Set([`h1`,`h2`,`h3`,`h4`,`h5`,`h6`]),l=new Set([`base`,`basefont`,`bgsound`,`link`,`meta`,`noframes`,`script`,`style`,`template`,`title`]),u=new Set([`basefont`,`bgsound`,`link`,`meta`,`noframes`,`style`]),d=new Set([`tbody`,`tfoot`,`thead`]),f=new Set([`td`,`th`]);export{t as BUTTON_SCOPE,o as CLOSES_PARAGRAPH,i as DEFAULT_SCOPE,c as HEADINGS,l as HEAD_ELEMENTS,a as IMPLIED_END_TAGS,u as IN_HEAD_NOSCRIPT,n as LIST_ITEM_SCOPE,s as SPECIAL_ELEMENTS,f as TABLE_CELLS,r as TABLE_SCOPE,d as TABLE_SECTIONS};
@@ -0,0 +1 @@
1
+ import{RAWTEXT_ELEMENTS as e,RCDATA_ELEMENTS as t}from"./text-elements.js";import{VOID_ELEMENTS as n}from"./void-elements.js";import{tokenize as r}from"./tokenizer.js";import{parseHtml as i}from"./tree-builder.js";export{e as RAWTEXT_ELEMENTS,t as RCDATA_ELEMENTS,n as VOID_ELEMENTS,i as parseHtml,r as tokenize};
@@ -0,0 +1 @@
1
+ const e=new Set([`iframe`,`noembed`,`noframes`,`script`,`style`,`xmp`]),t=new Set([`textarea`,`title`]);export{e as RAWTEXT_ELEMENTS,t as RCDATA_ELEMENTS};
@@ -0,0 +1,3 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{RAWTEXT_ELEMENTS as e,RCDATA_ELEMENTS as t}from"./text-elements.js";import{decodeAttributeValue as n,decodeText as r}from"../entities/decode.js";function isWhitespace(e){return e===` `||e===`
2
+ `||e===` `||e===`\f`}function isAsciiAlpha(e){return e===void 0?!1:e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`}function asciiLower(e){return e.replace(/[A-Z]+/g,e=>e.toLowerCase())}function replaceNul(e){return e.indexOf(`\0`)===-1?e:e.split(`\0`).join(`�`)}var Tokenizer=class{source;sink;pos=0;text=``;constructor(e,t){this.source=e.indexOf(`\r`)===-1?e:e.replace(/\r\n?/g,`
3
+ `),this.sink=t}run(){let e=this.source,t=e.length;for(;this.pos<t;){let n=e.indexOf(`<`,this.pos);if(n===-1){this.appendText(e.slice(this.pos)),this.pos=t;break}n>this.pos&&this.appendText(e.slice(this.pos,n)),this.pos=n,this.readMarkup()}this.flushText()}appendText(e){this.text+=r(e)}appendLiteral(e){this.text+=e}flushText(){if(this.text===``)return;let e=this.text;this.text=``,this.sink.onText(e)}emitComment(e){this.flushText(),this.sink.onComment(e)}readMarkup(){let e=this.source,t=this.pos,n=e[t+1];if(n===`!`){if(e.startsWith(`--`,t+2)){this.readComment(t+4);return}if(asciiLower(e.slice(t+2,t+9))===`doctype`){this.readDoctype(t+9);return}this.readBogusComment(t+2);return}if(n===`/`){let n=e[t+2];if(n===void 0){this.appendLiteral(`</`),this.pos=e.length;return}if(n===`>`){this.pos=t+3;return}if(isAsciiAlpha(n)){this.readTag();return}this.readBogusComment(t+2);return}if(isAsciiAlpha(n)){this.readTag();return}if(n===`?`){this.readBogusComment(t+1);return}this.appendLiteral(`<`),this.pos=t+1}readTag(){let r=this.source,i=r.length,a=this.pos+1,o=r[a]===`/`;o&&a++;let s=a;for(;a<i;){let e=r[a];if(isWhitespace(e)||e===`/`||e===`>`)break;a++}let c=replaceNul(asciiLower(r.slice(s,a))),l=[],u=new Set,d=!1;for(;;){for(;a<i&&isWhitespace(r[a]);)a++;if(a>=i){this.pos=i;return}let e=r[a];if(e===`>`){a++;break}if(e===`/`){if(a++,r[a]===`>`){d=!0,a++;break}continue}let t=a;for(e===`=`&&a++;a<i;){let e=r[a];if(isWhitespace(e)||e===`/`||e===`>`||e===`=`)break;a++}let o=replaceNul(asciiLower(r.slice(t,a)));for(;a<i&&isWhitespace(r[a]);)a++;let s=``;if(r[a]===`=`){for(a++;a<i&&isWhitespace(r[a]);)a++;let e=r[a];if(e===`"`||e===`'`){a++;let t=a;for(;a<i&&r[a]!==e;)a++;s=n(replaceNul(r.slice(t,a))),a<i&&a++}else{let e=a;for(;a<i;){let e=r[a];if(isWhitespace(e)||e===`>`)break;a++}s=n(replaceNul(r.slice(e,a)))}}u.has(o)||(u.add(o),l.push({name:o,value:s}))}if(this.pos=a,this.flushText(),o){this.sink.onCloseTag(c);return}this.sink.onOpenTag(c,l,d),e.has(c)?this.readRawText(c,!1):t.has(c)&&this.readRawText(c,!0)}readRawText(e,t){let n=e===`script`?this.findScriptDataEnd():this.findRawTextEnd(e);this.appendRawText(this.source.slice(this.pos,n),t),this.pos=n}findRawTextEnd(e){let t=this.source,n=this.pos;for(;;){let r=t.indexOf(`</`,n);if(r===-1)return t.length;if(this.isEndTagAt(r,e))return r;n=r+2}}findScriptDataEnd(){let e=this.source,t=e.length,n=0,r=this.pos;for(;r<t;){if(n===0){if(e.startsWith(`<!--`,r)){n=1,r+=2;continue}if(this.isEndTagAt(r,`script`))return r;r++;continue}if(e.startsWith(`-->`,r)){n=0,r+=3;continue}if(n===1){if(this.isEndTagAt(r,`script`))return r;if(this.isStartTagAt(r,`script`)){n=2,r+=7;continue}}else if(this.isEndTagAt(r,`script`)){n=1,r+=8;continue}r++}return t}isEndTagAt(e,t){let n=this.source;return n[e]!==`<`||n[e+1]!==`/`?!1:this.matchesTagName(e+2,t)}isStartTagAt(e,t){return this.source[e]===`<`?this.matchesTagName(e+1,t):!1}matchesTagName(e,t){let n=this.source,r=e+t.length,i=n[r];return i===void 0||!isWhitespace(i)&&i!==`/`&&i!==`>`?!1:asciiLower(n.slice(e,r))===t}appendRawText(e,t){if(e===``)return;let n=replaceNul(e);this.text+=t?r(n):n}readBogusComment(e){let t=this.source,n=t.indexOf(`>`,e),r=n===-1?t.length:n;this.emitComment(replaceNul(t.slice(e,r))),this.pos=n===-1?t.length:n+1}readComment(e){let t=this.source,n=t.length,r=``,i=e,a=0;for(;;){if(i>=n){this.emitComment(r),this.pos=n;return}let e=t[i];switch(a){case 0:if(e===`-`)a=1,i++;else if(e===`>`){this.emitComment(``),this.pos=i+1;return}else a=2;break;case 1:if(e===`-`)a=8,i++;else if(e===`>`){this.emitComment(``),this.pos=i+1;return}else r+=`-`,a=2;break;case 2:e===`<`?(r+=`<`,a=3,i++):e===`-`?(a=7,i++):(r+=e===`\0`?`�`:e,i++);break;case 3:e===`!`?(r+=`!`,a=4,i++):e===`<`?(r+=`<`,i++):a=2;break;case 4:e===`-`?(a=5,i++):a=2;break;case 5:e===`-`?(a=6,i++):a=7;break;case 6:a=8;break;case 7:e===`-`?(a=8,i++):(r+=`-`,a=2);break;case 8:if(e===`>`){this.emitComment(r),this.pos=i+1;return}else e===`!`?(a=9,i++):e===`-`?(r+=`-`,i++):(r+=`--`,a=2);break;default:if(e===`-`)r+=`--!`,a=7,i++;else if(e===`>`){this.emitComment(r),this.pos=i+1;return}else r+=`--!`,a=2;break}}}readDoctype(e){let t=this.source,n=t.length,r=e,i=0,a=null,o=null,s=null,c=!1,l=`"`,emit=()=>{this.flushText(),this.sink.onDoctype({name:a,publicId:o,systemId:s,forceQuirks:c})};for(;;){if(r>=n){i!==9&&(c=!0),emit(),this.pos=n;return}let e=t[r];switch(i){case 0:if(isWhitespace(e))r++;else if(e===`>`){c=!0,emit(),this.pos=r+1;return}else a=``,i=1;break;case 1:if(isWhitespace(e))i=2,r++;else if(e===`>`){emit(),this.pos=r+1;return}else a+=e===`\0`?`�`:asciiLower(e),r++;break;case 2:if(isWhitespace(e))r++;else if(e===`>`){emit(),this.pos=r+1;return}else asciiLower(t.slice(r,r+6))===`public`?(r+=6,i=3):asciiLower(t.slice(r,r+6))===`system`?(r+=6,i=6):(c=!0,i=9);break;case 3:if(isWhitespace(e))r++;else if(e===`"`||e===`'`)o=``,l=e,i=4,r++;else if(e===`>`){c=!0,emit(),this.pos=r+1;return}else c=!0,i=9;break;case 4:if(e===l)i=5,r++;else if(e===`>`){c=!0,emit(),this.pos=r+1;return}else o+=e===`\0`?`�`:e,r++;break;case 5:if(isWhitespace(e))r++;else if(e===`>`){emit(),this.pos=r+1;return}else e===`"`||e===`'`?(s=``,l=e,i=7,r++):(c=!0,i=9);break;case 6:if(isWhitespace(e))r++;else if(e===`"`||e===`'`)s=``,l=e,i=7,r++;else if(e===`>`){c=!0,emit(),this.pos=r+1;return}else c=!0,i=9;break;case 7:if(e===l)i=8,r++;else if(e===`>`){c=!0,emit(),this.pos=r+1;return}else s+=e===`\0`?`�`:e,r++;break;case 8:if(isWhitespace(e))r++;else if(e===`>`){emit(),this.pos=r+1;return}else i=9;break;default:if(e===`>`){emit(),this.pos=r+1;return}r++;break}}}};function tokenize(e,t){new Tokenizer(e,t).run()}export{e as RAWTEXT_ELEMENTS,t as RCDATA_ELEMENTS,tokenize};
@@ -0,0 +1,3 @@
1
+ import"../_virtual/_rolldown/runtime.js";import"../dom/node.js";import{DOMComment as e}from"../dom/comment.js";import{RAWTEXT_ELEMENTS as t,RCDATA_ELEMENTS as n}from"./text-elements.js";import{VOID_ELEMENTS as r}from"./void-elements.js";import{DOMElement as i}from"../dom/element.js";import{DOMDocument as a}from"../dom/document.js";import{DOMDocumentType as o}from"../dom/doctype.js";import{DOMDocumentFragment as s}from"../dom/fragment.js";import{DOMText as c}from"../dom/text.js";import{BUTTON_SCOPE as l,CLOSES_PARAGRAPH as u,DEFAULT_SCOPE as d,HEADINGS as f,HEAD_ELEMENTS as p,IMPLIED_END_TAGS as m,IN_HEAD_NOSCRIPT as h,LIST_ITEM_SCOPE as g,SPECIAL_ELEMENTS as _,TABLE_CELLS as v,TABLE_SCOPE as y,TABLE_SECTIONS as b}from"./implied-end-tags.js";import{tokenize as x}from"./tokenizer.js";const S=new Set([`table`,`template`,`html`]),C=new Set([`tbody`,`tfoot`,`thead`,`table`,`template`,`html`]),w=new Set([`tr`,`tbody`,`tfoot`,`thead`,`table`,`template`,`html`]),T=new Set([`caption`,`col`,`colgroup`,`frame`,`tbody`,`td`,`tfoot`,`th`,`thead`,`tr`]),E=new Set(`address.article.aside.blockquote.button.caption.center.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.header.hgroup.li.listing.main.menu.nav.ol.pre.search.section.summary.table.tbody.td.tfoot.th.thead.tr.ul`.split(`.`)),D=new Set([`caption`,`colgroup`,`table`,`tbody`,`td`,`tfoot`,`th`,`thead`,`tr`]),O=new Set([`listing`,`pre`,`textarea`]);function isWhitespace(e){return e===` `||e===`
2
+ `||e===` `||e===`\f`||e===`\r`}function leadingWhitespaceLength(e){let t=0;for(;t<e.length&&isWhitespace(e[t]);)t++;return t}var TreeBuilder=class{document=new a(!0);quirks=!1;open=[];mode=0;htmlElement=null;headElement=null;bodyElement=null;skipLineFeed=!1;formElement=null;textElement=null;get current(){let e=this.open[this.open.length-1];return e===void 0?this.document:e.content??e}get inTemplate(){for(let e=this.open.length-1;e>=0;e--)if(this.open[e].localName===`template`)return!0;return!1}currentName(){let e=this.open[this.open.length-1];return e===void 0?``:e.localName}append(e,t){t.parentNode=e,e.childNodes.push(t)}insertText(e){if(e===``)return;let t=this.current,n=t.childNodes[t.childNodes.length-1];if(n!==void 0&&n.nodeType===3){n.nodeValue=(n.nodeValue??``)+e;return}this.append(t,new c(e))}createElement(e,t){let n=new i(e,!0);for(let e of t)n.setAttribute(e.name,e.value);return n}insertElement(e,r){let i=this.createElement(e,r);return this.append(this.current,i),e===`template`&&(i.content=new s),this.open.push(i),O.has(e)&&(this.skipLineFeed=!0),(t.has(e)||n.has(e))&&(this.textElement=i),i}insertVoid(e,t){this.append(this.current,this.createElement(e,t))}insertGeneric(e,t){r.has(e)?this.insertVoid(e,t):this.insertElement(e,t)}mergeAttributes(e,t){if(e!==null)for(let n of t)e.hasAttribute(n.name)||e.setAttribute(n.name,n.value)}hasInScope(e,t){for(let n=this.open.length-1;n>=0;n--){let r=this.open[n].localName;if(r===e)return!0;if(t.has(r))return!1}return!1}generateImpliedEndTags(e){for(;this.open.length>0;){let t=this.currentName();if(t===e||!m.has(t))break;this.open.pop()}}popUntil(e){for(;this.open.length>0&&this.open.pop()?.localName!==e;);}clearBackTo(e){for(;this.open.length>0&&!e.has(this.currentName());)this.open.pop()}closeParagraph(){this.hasInScope(`p`,l)&&(this.generateImpliedEndTags(`p`),this.popUntil(`p`))}leaveInitial(){this.mode===0&&(this.quirks=!0)}ensureHtml(e){if(this.leaveInitial(),this.htmlElement!==null){this.mergeAttributes(this.htmlElement,e);return}let t=this.createElement(`html`,e);this.append(this.document,t),this.document.documentElement=t,this.htmlElement=t,this.open.push(t),this.mode=2}openHead(e){this.ensureHtml([]);let t=this.createElement(`head`,e);this.append(this.current,t),this.headElement=t,this.open.push(t),this.mode=3}popHead(){let e=this.headElement;if(e!==null){let t=this.open.indexOf(e);t!==-1&&this.open.splice(t,1)}this.mode=4}openBody(e){let t=this.createElement(`body`,e);this.append(this.htmlElement??this.document,t),this.bodyElement=t,this.open.push(t),this.mode=5}onDoctype(e){if(this.mode!==0)return;let t=e.name??``;this.quirks=e.forceQuirks||t!==`html`,this.append(this.document,new o(t,e.publicId??``,e.systemId??``)),this.mode=1}onComment(t){if(this.skipLineFeed=!1,this.mode===0||this.mode===1||this.mode===7){this.append(this.document,new e(t));return}if(this.mode===6){this.append(this.htmlElement??this.document,new e(t));return}this.append(this.current,new e(t))}onText(e){let t=e.indexOf(`\0`)===-1?e:e.split(`\0`).join(``);if(this.skipLineFeed&&(this.skipLineFeed=!1,t.startsWith(`
3
+ `)&&(t=t.slice(1))),t!==``){if(this.textElement!==null||this.inTemplate){this.insertText(t);return}switch(this.mode){case 0:case 1:case 2:{let e=t.slice(leadingWhitespaceLength(t));if(e===``)return;this.openHead([]),this.onText(e);return}case 3:case 4:{let e=leadingWhitespaceLength(t);e>0&&this.insertText(t.slice(0,e));let n=t.slice(e);if(n===``)return;if(this.mode===3&&this.currentName()===`noscript`){this.open.pop(),this.onText(n);return}this.mode===3?this.popHead():this.openBody([]),this.onText(n);return}case 6:case 7:{let e=leadingWhitespaceLength(t);e>0&&this.insertText(t.slice(0,e));let n=t.slice(e);if(n===``)return;this.mode=5,this.onText(n);return}default:this.insertText(t)}}}onOpenTag(e,t,n){this.textElement=null,this.skipLineFeed=!1;let r=e===`image`?`img`:e;if(this.inTemplate){this.inBodyStartTag(r,t);return}switch(this.mode){case 0:case 1:if(this.ensureHtml(r===`html`?t:[]),r===`html`)return;this.onOpenTag(r,t,n);return;case 2:if(r===`html`){this.mergeAttributes(this.htmlElement,t);return}if(r===`head`){this.openHead(t);return}this.openHead([]),this.onOpenTag(r,t,n);return;case 3:if(r===`html`){this.mergeAttributes(this.htmlElement,t);return}if(r===`head`)return;if(this.currentName()===`noscript`){if(h.has(r)){this.insertGeneric(r,t);return}this.open.pop(),this.onOpenTag(r,t,n);return}if(p.has(r)||r===`noscript`){this.insertGeneric(r,t);return}this.popHead(),this.onOpenTag(r,t,n);return;case 4:if(r===`html`){this.mergeAttributes(this.htmlElement,t);return}if(r===`head`)return;if(r===`body`){this.openBody(t);return}if(p.has(r)&&this.headElement!==null){this.open.push(this.headElement),this.insertGeneric(r,t);let e=this.open.indexOf(this.headElement);e!==-1&&this.open.splice(e,1);return}this.openBody([]),this.onOpenTag(r,t,n);return;case 6:case 7:this.mode=5,this.onOpenTag(r,t,n);return;default:this.inBodyStartTag(r,t)}}inBodyStartTag(e,t){if(e===`html`){this.mergeAttributes(this.htmlElement,t);return}if(e===`body`){this.mergeAttributes(this.bodyElement,t);return}if(e!==`head`){if(T.has(e)){if(!this.openTableStructure(e))return;this.insertGeneric(e,t);return}e===`form`&&this.formElement!==null&&!this.inTemplate||(u.has(e)&&(e!==`table`||!this.quirks)&&this.closeParagraph(),f.has(e)?f.has(this.currentName())&&this.open.pop():e===`li`||e===`dd`||e===`dt`?(this.closeListItem(e),this.closeParagraph()):e===`option`?this.currentName()===`option`&&this.open.pop():e===`optgroup`?(this.currentName()===`option`&&this.open.pop(),this.currentName()===`optgroup`&&this.open.pop()):e===`button`?this.hasInScope(`button`,d)&&(this.generateImpliedEndTags(),this.popUntil(`button`)):e===`rb`||e===`rtc`?this.hasInScope(`ruby`,d)&&this.generateImpliedEndTags():(e===`rp`||e===`rt`)&&this.hasInScope(`ruby`,d)&&this.generateImpliedEndTags(`rtc`),this.insertGeneric(e,t),e===`form`&&!this.inTemplate&&(this.formElement=this.open[this.open.length-1]??null))}}closeListItem(e){let t=e===`li`?e=>e===`li`:e=>e===`dd`||e===`dt`;for(let e=this.open.length-1;e>=0;e--){let n=this.open[e].localName;if(t(n)){this.generateImpliedEndTags(n),this.popUntil(n);return}if(_.has(n)&&n!==`address`&&n!==`div`&&n!==`p`)return}}openTableStructure(e){if(!this.hasInScope(`table`,y))return!1;if(v.has(e)){if(this.hasInScope(`td`,y)||this.hasInScope(`th`,y))for(this.generateImpliedEndTags();this.open.length>0&&!v.has(this.open.pop()?.localName??``););return this.clearBackTo(w),this.currentName()!==`tr`&&(this.currentName()===`table`&&this.insertElement(`tbody`,[]),this.insertElement(`tr`,[])),!0}return e===`tr`?(this.clearBackTo(C),this.currentName()===`table`&&this.insertElement(`tbody`,[]),!0):e===`col`?(this.currentName()!==`colgroup`&&(this.clearBackTo(S),this.insertElement(`colgroup`,[])),!0):b.has(e)||e===`caption`||e===`colgroup`?(this.clearBackTo(S),!0):!1}onCloseTag(e){if(this.skipLineFeed=!1,this.textElement!==null&&this.textElement.localName===e&&(this.textElement=null),this.inTemplate){this.inBodyEndTag(e);return}switch(this.mode){case 0:case 1:case 2:(e===`head`||e===`body`||e===`html`||e===`br`)&&(this.openHead([]),this.onCloseTag(e));return;case 3:if(p.has(e)||e===`noscript`){this.closeElement(e);return}if(this.currentName()===`noscript`){this.open.pop(),this.onCloseTag(e);return}if(e===`head`){this.popHead();return}(e===`body`||e===`html`||e===`br`)&&(this.popHead(),this.onCloseTag(e));return;case 4:(e===`body`||e===`html`||e===`br`)&&(this.openBody([]),this.onCloseTag(e));return;case 6:if(e===`html`){this.mode=7;return}this.mode=5,this.onCloseTag(e);return;case 7:this.mode=5,this.onCloseTag(e);return;default:this.inBodyEndTag(e)}}inBodyEndTag(e){if(e===`body`||e===`html`){this.hasInScope(`body`,d)&&(this.mode=6,e===`html`&&this.onCloseTag(`html`));return}if(e===`br`){this.inBodyStartTag(`br`,[]);return}if(e===`form`&&!this.inTemplate){let e=this.formElement;if(this.formElement=null,e===null||!this.hasInScope(`form`,d))return;this.generateImpliedEndTags();let t=this.open.indexOf(e);t!==-1&&this.open.splice(t,1);return}if(e===`p`){this.hasInScope(`p`,l)||this.insertElement(`p`,[]),this.generateImpliedEndTags(`p`),this.popUntil(`p`);return}this.closeElement(e)}closeElement(e){if(f.has(e)){if(!this.hasAnyHeadingInScope())return;for(this.generateImpliedEndTags(e);this.open.length>0&&!f.has(this.open.pop()?.localName??``););return}if(E.has(e)){let t=e===`li`?g:D.has(e)?y:d;if(!this.hasInScope(e,t))return;this.generateImpliedEndTags(e),this.popUntil(e);return}for(let t=this.open.length-1;t>=0;t--){let n=this.open[t].localName;if(n===e){for(this.generateImpliedEndTags(e);this.open.length>t;)this.open.pop();return}if(_.has(n))return}}hasAnyHeadingInScope(){for(let e=this.open.length-1;e>=0;e--){let t=this.open[e].localName;if(f.has(t))return!0;if(d.has(t))return!1}return!1}finish(){(this.mode===0||this.mode===1)&&this.ensureHtml([]),this.mode===2&&this.openHead([]),this.mode===3&&this.popHead(),this.mode===4&&this.openBody([])}};function parseHtml(e){let t=new TreeBuilder;return x(e,t),t.finish(),t.document}export{parseHtml};
File without changes
@@ -0,0 +1 @@
1
+ const e=new Set([`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`embed`,`frame`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);export{e as VOID_ELEMENTS};
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";var DOMNode=class{nodeType;nodeName;nodeValue;parentNode=null;childNodes=[];constructor(e,t,n=null){this.nodeType=e,this.nodeName=t,this.nodeValue=n}get textContent(){return this.nodeType===3||this.nodeType===4?this.nodeValue??``:this.childNodes.map(e=>e.textContent??``).join(``)}},DOMElement=class extends DOMNode{tagName;localName;_attrs=new Map;constructor(e){super(1,e.toUpperCase()),this.tagName=e.toLowerCase(),this.localName=this.tagName}get children(){return this.childNodes.filter(e=>e.nodeType===1)}getAttribute(e){return this._attrs.has(e)?this._attrs.get(e)??null:null}setAttribute(e,t){this._attrs.set(e,t)}hasAttribute(e){return this._attrs.has(e)}get attributes(){return Array.from(this._attrs.entries()).map(([e,t])=>({name:e,value:t}))}get innerHTML(){return this.childNodes.map(e=>e.nodeType===1?e.outerHTML:e.nodeType===3?e.nodeValue??``:e.nodeType===4?`<![CDATA[`+(e.nodeValue??``)+`]]>`:``).join(``)}get outerHTML(){let e=Array.from(this._attrs.entries()).map(([e,t])=>` `+e+`="`+t.replace(/"/g,`&quot;`)+`"`).join(``);return this.childNodes.length===0?`<`+this.tagName+e+`/>`:`<`+this.tagName+e+`>`+this.innerHTML+`</`+this.tagName+`>`}querySelector(e){let t=e.trim().split(/\s*>\s*/);if(t.length>1)return this._queryChildChain(t);let n=e.trim().split(/\s+/);return n.length>1?this._queryDescendantChain(n):this._find(e.trim().toLowerCase())??null}querySelectorAll(e){let t=e.trim().toLowerCase(),n=[];return this._findAll(t,n),n}_find(e){for(let t of this.children){if(t.tagName===e)return t;let n=t._find(e);if(n)return n}}_findAll(e,t){for(let n of this.children)n.tagName===e&&t.push(n),n._findAll(e,t)}_queryChildChain(e){let[t,...n]=e,r=this.children.filter(e=>e.tagName===t.trim().toLowerCase());if(n.length===0)return r[0]??null;for(let e of r){let t=e._queryChildChain(n);if(t)return t}return null}_queryDescendantChain(e){let[t,...n]=e,r=[];if(this._findAll(t.trim().toLowerCase(),r),n.length===0)return r[0]??null;for(let e of r){let t=e._queryDescendantChain(n);if(t)return t}return null}},DOMDocument=class extends DOMElement{documentElement=null;constructor(){super(`#document`),this.nodeType=9,this.nodeName=`#document`}querySelector(e){if(this.documentElement){let t=e.trim().toLowerCase();return this.documentElement.tagName===t?this.documentElement:this.documentElement.querySelector(e)}return super.querySelector(e)}querySelectorAll(e){let t=e.trim().toLowerCase(),n=[];return this.documentElement&&(this.documentElement.tagName===t&&n.push(this.documentElement),this.documentElement._findAll(t,n)),n}};const e=/\s+([\w:.-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\S+))/g;function parseAttributes(t,n){let r;for(e.lastIndex=0;(r=e.exec(t))!==null;)n.setAttribute(r[1],r[2]??r[3]??r[4]??``)}function parseXml(e){let t=new DOMDocument,n=[t],r=0,i=e.length;for(;r<i;){let a=e.indexOf(`<`,r);if(a===-1){let t=e.slice(r);if(t.trim()){let e=new DOMNode(3,`#text`,t),r=n[n.length-1];e.parentNode=r,r.childNodes.push(e)}break}if(a>r){let t=e.slice(r,a);if(t.trim()){let e=new DOMNode(3,`#text`,t),r=n[n.length-1];e.parentNode=r,r.childNodes.push(e)}}if(e.startsWith(`<![CDATA[`,a)){let t=e.indexOf(`]]>`,a);if(t===-1)break;let i=new DOMNode(4,`#cdata-section`,e.slice(a+9,t)),o=n[n.length-1];i.parentNode=o,o.childNodes.push(i),r=t+3;continue}if(e.startsWith(`<!--`,a)){let t=e.indexOf(`-->`,a);r=t===-1?i:t+3;continue}if(e.startsWith(`<?`,a)||e.startsWith(`<!`,a)){let t=e.indexOf(`>`,a);r=t===-1?i:t+1;continue}let o=findTagEnd(e,a+1);if(o===-1)break;let s=e.slice(a+1,o);if(s.startsWith(`/`)){n.length>1&&n.pop(),r=o+1;continue}let c=s.endsWith(`/`),l=c?s.slice(0,-1):s,u=l.search(/\s/),d=(u===-1?l:l.slice(0,u)).trim();if(!d){r=o+1;continue}let f=new DOMElement(d);u!==-1&&parseAttributes(l.slice(u),f);let p=n[n.length-1];f.parentNode=p,p.childNodes.push(f),p===t&&!t.documentElement&&(t.documentElement=f),c||n.push(f),r=o+1}return t}function findTagEnd(e,t){let n=!1,r=!1;for(let i=t;i<e.length;i++){let t=e[i];if(t===`"`&&!n){r=!r;continue}if(t===`'`&&!r){n=!n;continue}if(t===`>`&&!n&&!r)return i}return-1}var DOMParser=class{parseFromString(e,t){return parseXml(e)}};export{DOMDocument,DOMElement,DOMNode,DOMParser};
1
+ import{canonicalize as e}from"./canonical.js";import{DOMNode as t}from"./dom/node.js";import{DOMComment as n}from"./dom/comment.js";import{DOMElement as r}from"./dom/element.js";import{DOMDocument as i}from"./dom/document.js";import{DOMDocumentType as a}from"./dom/doctype.js";import{DOMDocumentFragment as o}from"./dom/fragment.js";import{DOMCDATASection as s,DOMText as c}from"./dom/text.js";import{DOMParser as l}from"./dom-parser.js";import{domTreeReader as u}from"./dom/reader.js";export{s as DOMCDATASection,n as DOMComment,i as DOMDocument,o as DOMDocumentFragment,a as DOMDocumentType,r as DOMElement,t as DOMNode,l as DOMParser,c as DOMText,e as canonicalize,u as domTreeReader};
@@ -1 +1 @@
1
- import{DOMParser as e}from"./index.js";const t=globalThis;t.DOMParser===void 0&&(t.DOMParser=e);
1
+ import{DOMParser as e}from"./dom-parser.js";import"./index.js";const t=globalThis;t.DOMParser===void 0&&(t.DOMParser=e);
File without changes
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{matchesNth as e}from"./nth.js";const t=new Set(`accept.accept-charset.align.alink.axis.bgcolor.charset.checked.clear.codetype.color.compact.declare.defer.dir.direction.disabled.enctype.face.frame.hreflang.http-equiv.lang.language.link.media.method.multiple.nohref.noresize.noshade.nowrap.readonly.rel.rev.rules.scope.scrolling.selected.shape.target.text.type.valign.valuetype.vlink`.split(`.`)),n=/\s+/,r={universal:0,attribute:1,type:2,nth:3,empty:3,root:3,scope:3,is:4,not:4,has:5};function cost(e){return e.kind===`attribute`?e.name===`id`&&e.action===`equals`?0:e.action===`exists`?2:1:r[e.kind]}function compileAttribute(e,r){let i=r.caseSensitive?e.name:e.name.toLowerCase(),a=e.ignoreCase===null?!r.caseSensitive&&t.has(i):e.ignoreCase,o=a?e.value.toLowerCase():e.value,read=e=>{let t=r.getAttributeValue(e,i);return t===null||!a?t:t.toLowerCase()},noMatch=()=>!1;switch(e.action){case`exists`:return e=>r.getAttributeValue(e,i)!==null;case`equals`:return e=>read(e)===o;case`not`:return o===``?e=>(read(e)??``)!==``:e=>read(e)!==o;case`start`:return o===``?noMatch:e=>read(e)?.startsWith(o)===!0;case`end`:return o===``?noMatch:e=>read(e)?.endsWith(o)===!0;case`any`:return o===``?noMatch:e=>read(e)?.includes(o)===!0;case`hyphen`:return e=>{let t=read(e);return t!==null&&(t===o||t.startsWith(o+`-`))};default:return o===``||n.test(o)?noMatch:e=>read(e)?.split(n).includes(o)===!0}}function compileNth(t,n){let r=t.axis===`last-child`||t.axis===`last-of-type`,i=t.axis===`of-type`||t.axis===`last-of-type`,a=t.of===null?null:compileList(t.of,n);return(o,s)=>{let c=n.getSiblings(o),l=i?n.getName(o):``,u=r?-1:1,d=0;for(let f=r?c.length-1:0;f>=0&&f<c.length;f+=u){let r=c[f];if(n.isTag(r)&&!(i&&n.getName(r)!==l)&&!(a!==null&&!a(r,s))&&(d++,r===o))return e(t.formula,d)}return!1}}function collectDescendants(e,t,n){for(let r of t.getChildren(e))t.isTag(r)&&n.push(r),collectDescendants(r,t,n)}function followingSiblings(e,t){let n=t.getSiblings(e),r=n.indexOf(e);return r===-1?[]:n.slice(r+1).filter(e=>t.isTag(e))}function compileHas(e,t){let n=e.selectors.map(e=>compileComplex(e,t)),r=e.selectors.some(e=>e.leading===`adjacent`||e.leading===`sibling`),i=new Map;return(e,a)=>{let o=i.get(e);if(o!==void 0)return o;let s=[];if(collectDescendants(e,t,s),r)for(let n of followingSiblings(e,t))s.push(n);let c=a.scope;a.scope=e;let l=!1;for(let e of s)if(n.some(t=>t(e,a))){l=!0;break}return a.scope=c,i.set(e,l),l}}function compileSimple(e,t){switch(e.kind){case`universal`:return()=>!0;case`type`:{let n=t.caseSensitive?e.name:e.name.toLowerCase();return e=>t.getName(e)===n}case`attribute`:return compileAttribute(e,t);case`nth`:return compileNth(e,t);case`empty`:return e=>!t.getChildren(e).some(e=>t.isTag(e)||t.getText(e)!==``);case`root`:return e=>{let n=t.getParent(e);return n===null||!t.isTag(n)};case`scope`:return(e,t)=>e===t.scope;case`is`:return compileList(e.selectors,t);case`not`:{let n=compileList(e.selectors,t);return(e,t)=>!n(e,t)}default:return compileHas(e,t)}}function compileCompound(e,t){let n=e.slice().sort((e,t)=>cost(e)-cost(t)).map(e=>compileSimple(e,t));return n.length===1?n[0]:(e,t)=>{for(let r of n)if(!r(e,t))return!1;return!0}}function compileCombinator(e,t,n){switch(e){case`child`:return(e,r)=>{let i=n.getParent(e);return i!==null&&t(i,r)};case`descendant`:return(e,r)=>{let i=n.getParent(e);for(;i!==null;){if(t(i,r))return!0;i=n.getParent(i)}return!1};case`adjacent`:return(e,r)=>{let i=n.getSiblings(e);for(let a=i.indexOf(e)-1;a>=0;a--)if(n.isTag(i[a]))return t(i[a],r);return!1};default:return(e,r)=>{let i=n.getSiblings(e);for(let a=i.indexOf(e)-1;a>=0;a--)if(n.isTag(i[a])&&t(i[a],r))return!0;return!1}}}function compileComplex(e,t){let next=e.leading===null?()=>!0:compileCombinator(e.leading,(e,t)=>e===t.scope,t);for(let n=0;n<e.compounds.length;n++){n>0&&(next=compileCombinator(e.combinators[n-1],next,t));let r=compileCompound(e.compounds[n],t),i=next;next=(e,t)=>r(e,t)&&i(e,t)}return next}function compileList(e,t){let n=e.map(e=>compileComplex(e,t));return n.length===1?n[0]:(e,t)=>n.some(n=>n(e,t))}export{compileComplex,compileList};
@@ -0,0 +1 @@
1
+ import{quoteSelectorString as e}from"./parse.js";import{closestSelector as t,matchesSelector as n,selectAll as r,selectOne as i}from"./query.js";export{t as closestSelector,n as matchesSelector,e as quoteSelectorString,r as selectAll,i as selectOne};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";const e=/^([+-]?\d*)n\s*(?:([+-])\s*(\d+))?$/,t=/^[+-]?\d+$/;function parseNth(n){let r=n.trim().toLowerCase();if(r===`odd`)return{a:2,b:1};if(r===`even`)return{a:2,b:0};let i=e.exec(r);if(i!==null){let e=i[1];return{a:e===``||e===`+`?1:e===`-`?-1:Number(e),b:i[3]===void 0?0:Number(i[2]+i[3])}}if(t.test(r))return{a:0,b:Number(r)};throw SyntaxError(`'`+n+`' is not a valid An+B argument`)}function matchesNth(e,t){if(e.a===0)return t===e.b;let n=t-e.b;return e.a>0?n>=0&&n%e.a===0:n<=0&&n%e.a===0}export{matchesNth,parseNth};
@@ -0,0 +1,2 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{parseNth as e}from"./nth.js";const t=new Set([` `,` `,`
2
+ `,`\r`,`\f`]),n={"~":`element`,"|":`hyphen`,"^":`start`,$:`end`,"*":`any`,"!":`not`},r={"nth-child":`child`,"nth-last-child":`last-child`,"nth-of-type":`of-type`,"nth-last-of-type":`last-of-type`},i={"any-link":`:is(a, area, link)[href]`,disabled:`:is(:is(button, input, select, textarea, optgroup, option, fieldset)[disabled], optgroup[disabled] > option, fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *))`,enabled:`:is(button, input, select, textarea, optgroup, option, fieldset):not(:disabled)`,checked:`:is(:is(input[type=radio], input[type=checkbox])[checked], option:selected)`,required:`:is(input, select, textarea)[required]`,optional:`:is(input, select, textarea):not([required])`,selected:`option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)`},a=new Set([`before`,`after`,`first-line`,`first-letter`,`selection`,`placeholder`]),o=new Set([`hover`,`active`,`focus`,`focus-visible`,`focus-within`,`visited`,`link`,`target`,`target-within`,`playing`,`paused`,`current`,`past`,`future`]);function isNameChar(e){if(e===``)return!1;let t=e.codePointAt(0);return e===`-`||e===`_`||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t>127}function isNameStart(e){return e===`\\`||e!==`-`&&isNameChar(e)&&!(e>=`0`&&e<=`9`)}function isHexDigit(e){return e>=`0`&&e<=`9`||e>=`a`&&e<=`f`||e>=`A`&&e<=`F`}function isNthChar(e){return e>=`0`&&e<=`9`||e===`n`||e===`N`||e===`+`||e===`-`||t.has(e)}var SelectorParser=class{input;pos=0;constructor(e){this.input=e}parseSelectorList(e){let t=[this.parseComplex(e)];for(;this.peek()===`,`;)this.pos++,t.push(this.parseComplex(e));return t}atEnd(){return this.pos>=this.input.length}fail(e){throw SyntaxError(`Failed to parse selector '`+this.input+`': `+e)}peek(e=0){return this.input[this.pos+e]??``}skipWhitespace(){let e=this.pos;for(;t.has(this.peek());)this.pos++;return this.pos>e}expect(e){this.peek()!==e&&this.fail(`expected '`+e+`' at offset `+this.pos),this.pos++}parseComplex(e){this.skipWhitespace();let t=e?this.readLeadingCombinator():null,n=[this.parseCompound()],r=[];for(;;){let e=this.readCombinator();if(e===null)break;r.push(e),n.push(this.parseCompound())}return{compounds:n,combinators:r,leading:t}}readLeadingCombinator(){let e=this.peek();return e!==`>`&&e!==`+`&&e!==`~`?`descendant`:(this.pos++,this.skipWhitespace(),e===`>`?`child`:e===`+`?`adjacent`:`sibling`)}readCombinator(){let e=this.skipWhitespace(),t=this.peek();if(t===`>`||t===`+`||t===`~`)return this.pos++,this.skipWhitespace(),t===`>`?`child`:t===`+`?`adjacent`:`sibling`;if(t===`|`&&this.peek(1)===`|`&&this.fail(`the column combinator '||' needs a table layout`),t===``||t===`,`||t===`)`)return null;if(e)return`descendant`;this.fail(`unexpected '`+t+`' at offset `+this.pos)}parseCompound(){let e=[];for(;;){let t=this.peek();if(t===`*`)this.pos++,this.rejectNamespace(),e.push({kind:`universal`});else if(t===`#`)this.pos++,e.push({kind:`attribute`,name:`id`,action:`equals`,value:this.readName(),ignoreCase:!1});else if(t===`.`)this.pos++,e.push({kind:`attribute`,name:`class`,action:`element`,value:this.readName(),ignoreCase:!1});else if(t===`[`)e.push(this.parseAttribute());else if(t===`:`)for(let t of this.parsePseudo())e.push(t);else if(t===`|`)this.fail(`namespace selectors need a namespace map this parser is not given`);else if(isNameStart(t)){let t=this.readName();this.rejectNamespace(),e.push({kind:`type`,name:t})}else break}return e.length===0&&this.fail(`expected a selector at offset `+this.pos),e}rejectNamespace(){this.peek()===`|`&&this.peek(1)!==`=`&&this.fail(`namespace selectors need a namespace map this parser is not given`)}readName(){let e=``;for(;;){let t=this.peek();if(t===`\\`){e+=this.readEscape();continue}if(!isNameChar(t))break;e+=t,this.pos++}return e===``&&this.fail(`expected an identifier at offset `+this.pos),e}readEscape(){this.pos++;let e=``;for(;e.length<6&&isHexDigit(this.peek());)e+=this.peek(),this.pos++;if(e===``){let e=this.peek();return e===``&&this.fail(`a trailing backslash escapes nothing`),this.pos++,e}t.has(this.peek())&&this.pos++;let n=Number.parseInt(e,16);return n===0||n>1114111||n>=55296&&n<=57343?`�`:String.fromCodePoint(n)}readString(e){this.pos++;let t=``;for(;;){let n=this.peek();if(n===``&&this.fail(`unterminated string`),n===e)return this.pos++,t;if(n===`\\`){t+=this.readEscape();continue}t+=n,this.pos++}}parseAttribute(){this.expect(`[`),this.skipWhitespace(),(this.peek()===`|`||this.peek()===`*`)&&this.fail(`namespace selectors need a namespace map this parser is not given`);let e=this.readName();if(this.rejectNamespace(),this.skipWhitespace(),this.peek()===`]`)return this.pos++,{kind:`attribute`,name:e,action:`exists`,value:``,ignoreCase:null};let t;this.peek()===`=`?(t=`equals`,this.pos++):this.peek(1)===`=`&&Object.hasOwn(n,this.peek())?(t=n[this.peek()],this.pos+=2):this.fail(`'`+this.peek()+`' is not an attribute operator`),this.skipWhitespace();let r=this.peek(),i=r===`"`||r===`'`?this.readString(r):this.readName();this.skipWhitespace();let a=null,o=this.peek().toLowerCase();return(o===`i`||o===`s`)&&(a=o===`i`,this.pos++,this.skipWhitespace()),this.expect(`]`),{kind:`attribute`,name:e,action:t,value:i,ignoreCase:a}}parsePseudo(){this.pos++,this.peek()===`:`&&(this.pos++,this.fail(`pseudo-element '::`+this.readName()+`' has no meaning without rendering`));let e=this.readName().toLowerCase();if(e===`not`||e===`is`||e===`where`||e===`matches`||e===`has`){this.expect(`(`);let t=this.parseSelectorList(e===`has`);return this.expect(`)`),[{kind:e===`not`?`not`:e===`has`?`has`:`is`,selectors:t}]}if(Object.hasOwn(r,e))return[this.parseNthPseudo(r[e])];if(e===`first-child`)return[positional(`child`,1)];if(e===`last-child`)return[positional(`last-child`,1)];if(e===`only-child`)return[positional(`child`,1),positional(`last-child`,1)];if(e===`first-of-type`)return[positional(`of-type`,1)];if(e===`last-of-type`)return[positional(`last-of-type`,1)];if(e===`only-of-type`)return[positional(`of-type`,1),positional(`last-of-type`,1)];if(e===`empty`)return[{kind:`empty`}];if(e===`root`)return[{kind:`root`}];if(e===`scope`)return[{kind:`scope`}];if(Object.hasOwn(i,e))return[{kind:`is`,selectors:parseSelectorList(i[e])}];o.has(e)&&this.fail(`':`+e+`' is a user-state pseudo-class and needs a live document`),a.has(e)&&this.fail(`pseudo-element ':`+e+`' has no meaning without rendering`),this.fail(`unknown pseudo-class ':`+e+`'`)}parseNthPseudo(t){this.expect(`(`);let n=e(this.readNthArgument()),r=null;return this.readKeyword(`of`)&&(r=this.parseSelectorList(!1)),this.expect(`)`),{kind:`nth`,axis:t,formula:n,of:r}}readNthArgument(){if(this.skipWhitespace(),this.readKeyword(`odd`))return`odd`;if(this.readKeyword(`even`))return`even`;let e=this.pos;for(;isNthChar(this.peek());)this.pos++;return this.input.slice(e,this.pos)}readKeyword(e){return this.input.slice(this.pos,this.pos+e.length).toLowerCase()!==e||isNameChar(this.peek(e.length))?!1:(this.pos+=e.length,this.skipWhitespace(),!0)}};function positional(e,t){return{kind:`nth`,axis:e,formula:{a:0,b:t},of:null}}function quoteSelectorString(e){return`"`+e.split(`\\`).join(`\\\\`).split(`"`).join(`\\"`)+`"`}function parseSelectorList(e){let t=new SelectorParser(e),n=t.parseSelectorList(!1);return t.atEnd()||t.fail(`unexpected trailing input`),n}export{parseSelectorList,quoteSelectorString};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{parseSelectorList as e}from"./parse.js";import{compileList as t}from"./compile.js";function compile(n,r){return t(e(n),r)}function walk(e,t,n){for(let r of t.getChildren(e))if(t.isTag(r)&&n(r)||walk(r,t,n))return!0;return!1}function selectAll(e,t,n){let r=compile(e,n),i={scope:t},a=[];return walk(t,n,e=>(r(e,i)&&a.push(e),!1)),a}function selectOne(e,t,n){let r=compile(e,n),i={scope:t},a=null;return walk(t,n,e=>r(e,i)?(a=e,!0):!1),a}function matchesSelector(e,t,n){return compile(e,n)(t,{scope:t})}function closestSelector(e,t,n){let r=compile(e,n),i={scope:t},a=t;for(;a!==null&&n.isTag(a);){if(r(a,i))return a;a=n.getParent(a)}return null}export{closestSelector,matchesSelector,selectAll,selectOne};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{DOMNode as e}from"../dom/node.js";import{DOMComment as t}from"../dom/comment.js";import{DOMElement as n}from"../dom/element.js";import{DOMDocument as r}from"../dom/document.js";import{DOMDocumentType as i}from"../dom/doctype.js";import{decodeXml as a}from"../entities/decode.js";const o=/\s+([\w:.-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\S+))/g;function asciiLower(e){return e.replace(/[A-Z]+/g,e=>e.toLowerCase())}function parseAttributes(e,t){let n;for(o.lastIndex=0;(n=o.exec(e))!==null;)t.setAttribute(n[1],a(n[2]??n[3]??n[4]??``))}function parseXml(o){let s=new r,c=[s],l=0,u=o.length;for(;l<u;){let r=o.indexOf(`<`,l);if(r===-1){let t=o.slice(l);if(t.trim()){let n=new e(3,`#text`,a(t)),r=c[c.length-1];n.parentNode=r,r.childNodes.push(n)}break}if(r>l){let t=o.slice(l,r);if(t.trim()){let n=new e(3,`#text`,a(t)),r=c[c.length-1];n.parentNode=r,r.childNodes.push(n)}}if(o.startsWith(`<![CDATA[`,r)){let t=o.indexOf(`]]>`,r);if(t===-1)break;let n=new e(4,`#cdata-section`,o.slice(r+9,t)),i=c[c.length-1];n.parentNode=i,i.childNodes.push(n),l=t+3;continue}if(o.startsWith(`<!--`,r)){let e=o.indexOf(`-->`,r),n=new t(o.slice(r+4,e===-1?u:e)),i=c[c.length-1];n.parentNode=i,i.childNodes.push(n),l=e===-1?u:e+3;continue}if(asciiLower(o.slice(r,r+9))===`<!doctype`){let e=findTagEnd(o,r+9),t=new i(o.slice(r+9,e===-1?u:e).trim().split(/[\s[]/)[0]??``,``,``);t.parentNode=s,s.childNodes.push(t),l=e===-1?u:e+1;continue}if(o.startsWith(`<?`,r)||o.startsWith(`<!`,r)){let e=o.indexOf(`>`,r);l=e===-1?u:e+1;continue}let d=findTagEnd(o,r+1);if(d===-1)break;let f=o.slice(r+1,d);if(f.startsWith(`/`)){c.length>1&&c.pop(),l=d+1;continue}let p=f.endsWith(`/`),m=p?f.slice(0,-1):f,h=m.search(/\s/),g=(h===-1?m:m.slice(0,h)).trim();if(!g){l=d+1;continue}let _=new n(g);h!==-1&&parseAttributes(m.slice(h),_);let v=c[c.length-1];_.parentNode=v,v.childNodes.push(_),v===s&&!s.documentElement&&(s.documentElement=_),p||c.push(_),l=d+1}return s}function findTagEnd(e,t){let n=!1,r=!1;for(let i=t;i<e.length;i++){let t=e[i];if(t===`"`&&!n){r=!r;continue}if(t===`'`&&!r){n=!n;continue}if(t===`>`&&!n&&!r)return i}return-1}export{parseXml};
@@ -0,0 +1,27 @@
1
+ /** One attribute, in the two parts every tree model agrees on. */
2
+ export interface ReadAttribute {
3
+ name: string;
4
+ value: string;
5
+ }
6
+ /**
7
+ * The minimum a tree has to answer to be canonicalized. Implemented once per
8
+ * tree model; `TNode` is that model's node type.
9
+ */
10
+ export interface TreeReader<TNode> {
11
+ isElement(node: TNode): boolean;
12
+ isText(node: TNode): boolean;
13
+ isComment(node: TNode): boolean;
14
+ isDoctype(node: TNode): boolean;
15
+ /** Lowercase local name for an element, the declared name for a doctype. */
16
+ name(node: TNode): string;
17
+ /** Character data for text and comment nodes. */
18
+ value(node: TNode): string;
19
+ attributes(node: TNode): ReadAttribute[];
20
+ children(node: TNode): TNode[];
21
+ }
22
+ /**
23
+ * Serialize `root` and its descendants, one indented line per node. The root
24
+ * line is included, so a fixture that parsed to nothing is one line long and
25
+ * cannot be mistaken for a match.
26
+ */
27
+ export declare function canonicalize<TNode>(reader: TreeReader<TNode>, root: TNode): string;
@@ -0,0 +1,5 @@
1
+ import { DOMNode } from './node.js';
2
+ export declare class DOMComment extends DOMNode {
3
+ constructor(data: string);
4
+ get data(): string;
5
+ }
@@ -0,0 +1,7 @@
1
+ import { DOMNode } from './node.js';
2
+ export declare class DOMDocumentType extends DOMNode {
3
+ readonly name: string;
4
+ readonly publicId: string;
5
+ readonly systemId: string;
6
+ constructor(name: string, publicId: string, systemId: string);
7
+ }
@@ -0,0 +1,12 @@
1
+ import type { DOMDocumentType } from './doctype.js';
2
+ import { DOMElement } from './element.js';
3
+ export declare class DOMDocument extends DOMElement {
4
+ documentElement: DOMElement | null;
5
+ constructor(html?: boolean);
6
+ /** Computed rather than stored, so a document assembled by hand answers too. */
7
+ get doctype(): DOMDocumentType | null;
8
+ get head(): DOMElement | null;
9
+ get body(): DOMElement | null;
10
+ getElementById(id: string): DOMElement | null;
11
+ private _documentChild;
12
+ }
@@ -0,0 +1,48 @@
1
+ import type { Adapter } from '../selectors/index.js';
2
+ import type { DOMDocumentFragment } from './fragment.js';
3
+ import { DOMNode } from './node.js';
4
+ export declare class DOMElement extends DOMNode {
5
+ /**
6
+ * UPPERCASE in HTML documents, lowercase in XML ones. The XML spelling is
7
+ * wrong by the XML spec and frozen anyway — the one measured consumer
8
+ * switches on lowercase literals at 24 sites (ADR 0026 § Decision 4), and
9
+ * `src/xml-shape.spec.ts` fails if it moves.
10
+ */
11
+ tagName: string;
12
+ localName: string;
13
+ /** `<template>` holds its children here, never in `childNodes`. */
14
+ content?: DOMDocumentFragment;
15
+ /**
16
+ * Which document this node belongs to, in the only terms selectors need:
17
+ * HTML folds type and attribute names to lowercase, XML does not. There is
18
+ * no `ownerDocument` to ask — one node model is § Deferred in ADR 0026.
19
+ */
20
+ protected readonly _html: boolean;
21
+ private _attrs;
22
+ constructor(tagName: string, html?: boolean);
23
+ get id(): string;
24
+ get className(): string;
25
+ get parentElement(): DOMElement | null;
26
+ get firstElementChild(): DOMElement | null;
27
+ get lastElementChild(): DOMElement | null;
28
+ get nextElementSibling(): DOMElement | null;
29
+ get previousElementSibling(): DOMElement | null;
30
+ private _sibling;
31
+ get children(): DOMElement[];
32
+ getAttribute(name: string): string | null;
33
+ setAttribute(name: string, value: string): void;
34
+ hasAttribute(name: string): boolean;
35
+ get attributes(): {
36
+ name: string;
37
+ value: string;
38
+ }[];
39
+ get innerHTML(): string;
40
+ get outerHTML(): string;
41
+ protected _adapter(): Adapter<DOMNode>;
42
+ querySelector(selector: string): DOMElement | null;
43
+ querySelectorAll(selector: string): DOMElement[];
44
+ matches(selector: string): boolean;
45
+ closest(selector: string): DOMElement | null;
46
+ /** A space-separated list, and EVERY name in it has to be present. */
47
+ getElementsByClassName(names: string): DOMElement[];
48
+ }
@@ -0,0 +1,9 @@
1
+ import { DOMNode } from './node.js';
2
+ /**
3
+ * A parentless container. Its only use today is `<template>`: the spec puts a
4
+ * template's children in a fragment held by `content`, NOT in `childNodes`, which
5
+ * is exactly why `querySelectorAll` does not reach into a template.
6
+ */
7
+ export declare class DOMDocumentFragment extends DOMNode {
8
+ constructor();
9
+ }
@@ -0,0 +1,17 @@
1
+ /** Node type constants, spelled out so call sites read as the spec does. */
2
+ export declare const ELEMENT_NODE = 1;
3
+ export declare const TEXT_NODE = 3;
4
+ export declare const CDATA_SECTION_NODE = 4;
5
+ export declare const COMMENT_NODE = 8;
6
+ export declare const DOCUMENT_NODE = 9;
7
+ export declare const DOCUMENT_TYPE_NODE = 10;
8
+ export declare const DOCUMENT_FRAGMENT_NODE = 11;
9
+ export declare class DOMNode {
10
+ nodeType: number;
11
+ nodeName: string;
12
+ nodeValue: string | null;
13
+ parentNode: DOMNode | null;
14
+ childNodes: DOMNode[];
15
+ constructor(nodeType: number, nodeName: string, nodeValue?: string | null);
16
+ get textContent(): string;
17
+ }
@@ -0,0 +1,3 @@
1
+ import type { TreeReader } from '../canonical.js';
2
+ import type { DOMNode } from './node.js';
3
+ export declare const domTreeReader: TreeReader<DOMNode>;
@@ -0,0 +1,5 @@
1
+ import type { DOMNode } from './node.js';
2
+ /** `Element.innerHTML` — the children, not the element itself. */
3
+ export declare function serializeInner(node: DOMNode, html: boolean): string;
4
+ /** `Element.outerHTML` — the element and everything under it. */
5
+ export declare function serializeOuter(node: DOMNode, html: boolean): string;
@@ -0,0 +1,9 @@
1
+ import { DOMNode } from './node.js';
2
+ export declare class DOMText extends DOMNode {
3
+ constructor(data: string);
4
+ get data(): string;
5
+ set data(value: string);
6
+ }
7
+ export declare class DOMCDATASection extends DOMNode {
8
+ constructor(data: string);
9
+ }
@@ -0,0 +1,5 @@
1
+ import type { DOMNode } from './dom/node.js';
2
+ import type { Adapter } from './selectors/index.js';
3
+ /** HTML folds type and attribute names to lowercase; XML does not. */
4
+ export declare const HTML_ADAPTER: Adapter<DOMNode>;
5
+ export declare const XML_ADAPTER: Adapter<DOMNode>;
@@ -0,0 +1,14 @@
1
+ import type { DOMDocument } from './dom/document.js';
2
+ export declare class DOMParser {
3
+ /**
4
+ * The second argument is READ. It used to be ignored, and every call ran the
5
+ * XML scanner whatever it said — including on HTML, where that produces a tree
6
+ * with `<li>` items nested inside one another and `<script>` contents spilled
7
+ * into the document text.
8
+ *
9
+ * An unsupported type THROWS rather than falling back to XML: a caller who
10
+ * passes the wrong type is told once, at the call, instead of receiving a
11
+ * plausible wrong tree (ADR 0026 § Decision 3).
12
+ */
13
+ parseFromString(string: string, mimeType: string): DOMDocument;
14
+ }
@@ -0,0 +1,3 @@
1
+ export declare const NAMED_REFERENCES: Record<string, string>;
2
+ /** Length of the longest key above, so the matcher's window follows the data. */
3
+ export declare const MAX_NAMED_REFERENCE_LENGTH = 32;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * `text` — element content and RCDATA: the semicolon may be omitted.
3
+ * `attribute` — the same table, refusing a semicolon-less name followed by `=`
4
+ * or an alphanumeric, so a query string survives.
5
+ * `strict` — XML: the five predefined names only, semicolon mandatory.
6
+ */
7
+ export type DecodeContext = 'text' | 'attribute' | 'strict';
8
+ /** Decode references in element content (RCDATA included). */
9
+ export declare function decodeText(input: string): string;
10
+ /** Decode references in an attribute value, quoted or unquoted. */
11
+ export declare function decodeAttributeValue(input: string): string;
12
+ /** Decode the references XML defines, and only those. Reaches neither the HTML
13
+ * table nor anything that names it, so an XML-only consumer does not bundle it. */
14
+ export declare function decodeXml(input: string): string;
15
+ /**
16
+ * Decode every character reference in `input` under the rules of `ctx`.
17
+ *
18
+ * The dynamic entry point: `ctx` is a value, so this one binding reaches BOTH
19
+ * tables and a consumer importing it bundles both. The three named functions
20
+ * above exist so that consumers who know their context at author time are not
21
+ * made to pay for the other one.
22
+ */
23
+ export declare function decodeHtml(input: string, ctx: DecodeContext): string;
@@ -0,0 +1,3 @@
1
+ export { decodeAttributeValue, decodeHtml, decodeText, decodeXml } from './decode.js';
2
+ export type { DecodeContext } from './decode.js';
3
+ export { NAMED_REFERENCES } from './data.js';
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,42 @@
1
+ /** Button scope: base scope plus `button`. Used by `</p>` and by every element
2
+ * that closes an open paragraph. */
3
+ export declare const BUTTON_SCOPE: ReadonlySet<string>;
4
+ /** List-item scope: base scope plus the list containers, so a `<li>` in a nested
5
+ * list does not close its grandparent's item. */
6
+ export declare const LIST_ITEM_SCOPE: ReadonlySet<string>;
7
+ /** Table scope, for the row and cell rules. */
8
+ export declare const TABLE_SCOPE: ReadonlySet<string>;
9
+ export declare const DEFAULT_SCOPE: ReadonlySet<string>;
10
+ /**
11
+ * Elements popped automatically when their parent closes. `generateImpliedEndTags`
12
+ * pops these, which is why `<ul><li>one<li>two</ul>` yields two siblings rather
13
+ * than a chain.
14
+ */
15
+ export declare const IMPLIED_END_TAGS: ReadonlySet<string>;
16
+ /**
17
+ * Start tags that close an open `<p>` first. The list is the spec's, and it is
18
+ * why `<p>a<div>b</div>` gives two siblings and not a nested pair.
19
+ */
20
+ export declare const CLOSES_PARAGRAPH: ReadonlySet<string>;
21
+ /**
22
+ * The "special" category. Only used by the `li`/`dd`/`dt` rule, which walks up
23
+ * the stack looking for a sibling item and gives up at the first special element
24
+ * that is not `address`, `div` or `p` — so `<li><div>a<li>` still closes the item
25
+ * while `<li><table><li>` does not.
26
+ */
27
+ export declare const SPECIAL_ELEMENTS: ReadonlySet<string>;
28
+ /** The six heading names, which close one another. */
29
+ export declare const HEADINGS: ReadonlySet<string>;
30
+ /** Elements the "in head" insertion mode owns. */
31
+ export declare const HEAD_ELEMENTS: ReadonlySet<string>;
32
+ /**
33
+ * What the "in head noscript" mode admits. `<noscript>` reaches the head only
34
+ * when scripting is disabled — which it always is here, nothing runs scripts —
35
+ * and a real page puts a whole `<noscript>` block of `<link>`s in its head. Head
36
+ * elements outside this set pop the noscript instead of nesting inside it.
37
+ */
38
+ export declare const IN_HEAD_NOSCRIPT: ReadonlySet<string>;
39
+ /** Table section containers, which a new one of the same kind replaces. */
40
+ export declare const TABLE_SECTIONS: ReadonlySet<string>;
41
+ /** Table cells. */
42
+ export declare const TABLE_CELLS: ReadonlySet<string>;
@@ -0,0 +1,4 @@
1
+ export { parseHtml } from './tree-builder.js';
2
+ export { RAWTEXT_ELEMENTS, RCDATA_ELEMENTS, tokenize } from './tokenizer.js';
3
+ export { VOID_ELEMENTS } from './void-elements.js';
4
+ export type { DoctypeToken, TokenAttribute, TreeSink } from './tree-sink.js';
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Elements whose content is raw text: markup inside them is text and character
3
+ * references are NOT decoded, so `<style>a{b:'&amp;'}</style>` keeps `&amp;`.
4
+ *
5
+ * `noscript` is deliberately absent. It is raw text only when scripting is
6
+ * enabled, and nothing here runs scripts — a scraper wants the markup inside it.
7
+ *
8
+ * The same set answers the serializer's question, because the HTML fragment
9
+ * serialization algorithm names exactly these elements as the ones whose text is
10
+ * written verbatim.
11
+ * https://html.spec.whatwg.org/multipage/parsing.html#serialising-html-fragments
12
+ */
13
+ export declare const RAWTEXT_ELEMENTS: ReadonlySet<string>;
14
+ /**
15
+ * Elements whose content is text but WITH character references decoded — the same
16
+ * shape as RAWTEXT and the opposite answer, which is why both are driven with the
17
+ * same input in the spec file. They are NOT in the serializer's verbatim set:
18
+ * `<textarea>&</textarea>` has to be written back as `&amp;`.
19
+ */
20
+ export declare const RCDATA_ELEMENTS: ReadonlySet<string>;
@@ -0,0 +1,7 @@
1
+ import type { TreeSink } from './tree-sink.js';
2
+ export { RAWTEXT_ELEMENTS, RCDATA_ELEMENTS } from './text-elements.js';
3
+ /**
4
+ * Tokenize `source` as HTML, reporting every token to `sink` in document order.
5
+ * Pure string processing: no globals, no platform imports, no tree.
6
+ */
7
+ export declare function tokenize(source: string, sink: TreeSink): void;
@@ -0,0 +1,5 @@
1
+ import { DOMDocument } from '../dom/document.js';
2
+ /** Parse `source` as an HTML document. Never throws on malformed input: HTML has
3
+ * no fatal parse errors, and a scraper that gets an exception instead of a tree
4
+ * has to guess what the page was. */
5
+ export declare function parseHtml(source: string): DOMDocument;
@@ -0,0 +1,24 @@
1
+ /** One attribute of a start tag, after name lowercasing and duplicate removal. */
2
+ export interface TokenAttribute {
3
+ name: string;
4
+ value: string;
5
+ }
6
+ /** `<!DOCTYPE …>`, in the parts an HTML document can observe. */
7
+ export interface DoctypeToken {
8
+ name: string | null;
9
+ publicId: string | null;
10
+ systemId: string | null;
11
+ /** The declaration was malformed; the tree builder maps this to quirks mode. */
12
+ forceQuirks: boolean;
13
+ }
14
+ /**
15
+ * What the tokenizer emits. Text arrives already decoded and coalesced: one call
16
+ * per run between markup, never one per character, so a sink never has to merge.
17
+ */
18
+ export interface TreeSink {
19
+ onDoctype(doctype: DoctypeToken): void;
20
+ onOpenTag(name: string, attrs: TokenAttribute[], selfClosing: boolean): void;
21
+ onCloseTag(name: string): void;
22
+ onText(text: string): void;
23
+ onComment(data: string): void;
24
+ }
@@ -0,0 +1 @@
1
+ export declare const VOID_ELEMENTS: ReadonlySet<string>;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -1,40 +1,11 @@
1
- export declare class DOMNode {
2
- nodeType: number;
3
- nodeName: string;
4
- nodeValue: string | null;
5
- parentNode: DOMNode | null;
6
- childNodes: DOMNode[];
7
- constructor(nodeType: number, nodeName: string, nodeValue?: string | null);
8
- get textContent(): string;
9
- }
10
- export declare class DOMElement extends DOMNode {
11
- tagName: string;
12
- localName: string;
13
- private _attrs;
14
- constructor(tagName: string);
15
- get children(): DOMElement[];
16
- getAttribute(name: string): string | null;
17
- setAttribute(name: string, value: string): void;
18
- hasAttribute(name: string): boolean;
19
- get attributes(): {
20
- name: string;
21
- value: string;
22
- }[];
23
- get innerHTML(): string;
24
- get outerHTML(): string;
25
- querySelector(selector: string): DOMElement | null;
26
- querySelectorAll(selector: string): DOMElement[];
27
- _find(tag: string): DOMElement | undefined;
28
- _findAll(tag: string, results: DOMElement[]): void;
29
- private _queryChildChain;
30
- private _queryDescendantChain;
31
- }
32
- export declare class DOMDocument extends DOMElement {
33
- documentElement: DOMElement | null;
34
- constructor();
35
- querySelector(selector: string): DOMElement | null;
36
- querySelectorAll(selector: string): DOMElement[];
37
- }
38
- export declare class DOMParser {
39
- parseFromString(string: string, _mimeType: string): DOMDocument;
40
- }
1
+ export { DOMNode } from './dom/node.js';
2
+ export { DOMElement } from './dom/element.js';
3
+ export { DOMDocument } from './dom/document.js';
4
+ export { DOMComment } from './dom/comment.js';
5
+ export { DOMDocumentType } from './dom/doctype.js';
6
+ export { DOMDocumentFragment } from './dom/fragment.js';
7
+ export { DOMCDATASection, DOMText } from './dom/text.js';
8
+ export { domTreeReader } from './dom/reader.js';
9
+ export { canonicalize } from './canonical.js';
10
+ export type { ReadAttribute, TreeReader } from './canonical.js';
11
+ export { DOMParser } from './dom-parser.js';
@@ -0,0 +1,3 @@
1
+ import '@gjsify/domparser/register';
2
+ declare const _default: () => Promise<void>;
3
+ export default _default;
@@ -0,0 +1,18 @@
1
+ export interface Adapter<TNode> {
2
+ isTag(node: TNode): boolean;
3
+ /** The element's lowercase local name — no namespace prefix. */
4
+ getName(node: TNode): string;
5
+ getParent(node: TNode): TNode | null;
6
+ /** Every child NODE in document order; the engine filters elements itself. */
7
+ getChildren(node: TNode): TNode[];
8
+ /** The child list `node` lives in, or `[node]` when it has no parent. */
9
+ getSiblings(node: TNode): TNode[];
10
+ getAttributeValue(node: TNode, name: string): string | null;
11
+ /** Concatenated character data of the subtree — what `:empty` asks about. */
12
+ getText(node: TNode): string;
13
+ /**
14
+ * `false` in an HTML document, where type and attribute NAMES fold to
15
+ * lowercase; `true` in an XML one, where they do not.
16
+ */
17
+ readonly caseSensitive: boolean;
18
+ }
@@ -0,0 +1,9 @@
1
+ import type { Adapter } from './adapter.js';
2
+ import type { ComplexSelector } from './parse.js';
3
+ export interface MatchContext<TNode> {
4
+ /** What `:scope` names, and the anchor a `:has()` measures against. */
5
+ scope: TNode | null;
6
+ }
7
+ export type Predicate<TNode> = (node: TNode, ctx: MatchContext<TNode>) => boolean;
8
+ export declare function compileComplex<TNode>(selector: ComplexSelector, adapter: Adapter<TNode>): Predicate<TNode>;
9
+ export declare function compileList<TNode>(selectors: ComplexSelector[], adapter: Adapter<TNode>): Predicate<TNode>;
@@ -0,0 +1,3 @@
1
+ export type { Adapter } from './adapter.js';
2
+ export { quoteSelectorString } from './parse.js';
3
+ export { closestSelector, matchesSelector, selectAll, selectOne } from './query.js';
@@ -0,0 +1,8 @@
1
+ export interface NthFormula {
2
+ a: number;
3
+ b: number;
4
+ }
5
+ /** Throws a `SyntaxError` naming the argument it could not read. */
6
+ export declare function parseNth(text: string): NthFormula;
7
+ /** `index` counts from 1, as the CSS definition does. */
8
+ export declare function matchesNth(formula: NthFormula, index: number): boolean;
@@ -0,0 +1,55 @@
1
+ import { type NthFormula } from './nth.js';
2
+ export type Combinator = 'descendant' | 'child' | 'adjacent' | 'sibling';
3
+ /** The eight forms an attribute selector takes, `[a]` and `[a!=b]` included. */
4
+ export type AttributeAction = 'exists' | 'equals' | 'element' | 'start' | 'end' | 'any' | 'hyphen' | 'not';
5
+ export type NthAxis = 'child' | 'last-child' | 'of-type' | 'last-of-type';
6
+ export type SimpleSelector = {
7
+ kind: 'universal';
8
+ } | {
9
+ kind: 'type';
10
+ name: string;
11
+ } | {
12
+ kind: 'attribute';
13
+ name: string;
14
+ action: AttributeAction;
15
+ value: string;
16
+ ignoreCase: boolean | null;
17
+ } | {
18
+ kind: 'nth';
19
+ axis: NthAxis;
20
+ formula: NthFormula;
21
+ of: ComplexSelector[] | null;
22
+ } | {
23
+ kind: 'empty';
24
+ } | {
25
+ kind: 'root';
26
+ } | {
27
+ kind: 'scope';
28
+ } | {
29
+ kind: 'is';
30
+ selectors: ComplexSelector[];
31
+ } | {
32
+ kind: 'not';
33
+ selectors: ComplexSelector[];
34
+ } | {
35
+ kind: 'has';
36
+ selectors: ComplexSelector[];
37
+ };
38
+ export interface ComplexSelector {
39
+ /** `compounds[i]` is joined to `compounds[i + 1]` by `combinators[i]`. */
40
+ compounds: SimpleSelector[][];
41
+ combinators: Combinator[];
42
+ /** Set only for a RELATIVE selector — `:has(> .price)` — where it names the
43
+ * combinator between the `:has()` anchor and `compounds[0]`. */
44
+ leading: Combinator | null;
45
+ }
46
+ /**
47
+ * Quote a raw identifier so it survives being spliced into selector text — the
48
+ * inverse of `readString`. Without it a `class` or `id` holding `a.b` turns
49
+ * `getElementsByClassName('a.b')` into "class a AND class b": a WRONG answer
50
+ * rather than an empty one, which is the failure mode this package exists to end.
51
+ */
52
+ export declare function quoteSelectorString(value: string): string;
53
+ /** Parse a comma-separated selector list. Throws `SyntaxError` on anything it
54
+ * will not evaluate — never returns a selector that silently matches nothing. */
55
+ export declare function parseSelectorList(selector: string): ComplexSelector[];
@@ -0,0 +1,8 @@
1
+ import type { Adapter } from './adapter.js';
2
+ /** Every descendant of `root` matching `selector`, in document order. */
3
+ export declare function selectAll<TNode>(selector: string, root: TNode, adapter: Adapter<TNode>): TNode[];
4
+ export declare function selectOne<TNode>(selector: string, root: TNode, adapter: Adapter<TNode>): TNode | null;
5
+ /** `:scope` is the element being tested, as `Element.matches()` defines it. */
6
+ export declare function matchesSelector<TNode>(selector: string, node: TNode, adapter: Adapter<TNode>): boolean;
7
+ /** `node` itself first, then its ancestors — `Element.closest()`. */
8
+ export declare function closestSelector<TNode>(selector: string, node: TNode, adapter: Adapter<TNode>): TNode | null;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { DOMDocument } from '../dom/document.js';
2
+ export declare function parseXml(xml: string): DOMDocument;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gjsify/domparser",
3
- "version": "0.41.0",
4
- "description": "DOMParser for GJS — self-contained XML parser with minimal DOM (querySelector, getAttribute, children)",
3
+ "version": "0.43.0",
4
+ "description": "DOMParser for GJS — HTML5 parser, XML scanner, CSS Selectors 4 engine and the full entity table, dependency-free",
5
5
  "module": "lib/esm/index.js",
6
6
  "types": "lib/types/index.d.ts",
7
7
  "files": [
@@ -14,6 +14,18 @@
14
14
  "types": "./lib/types/index.d.ts",
15
15
  "default": "./lib/esm/index.js"
16
16
  },
17
+ "./html": {
18
+ "types": "./lib/types/html/index.d.ts",
19
+ "default": "./lib/esm/html/index.js"
20
+ },
21
+ "./selectors": {
22
+ "types": "./lib/types/selectors/index.d.ts",
23
+ "default": "./lib/esm/selectors/index.js"
24
+ },
25
+ "./entities": {
26
+ "types": "./lib/types/entities/index.d.ts",
27
+ "default": "./lib/esm/entities/index.js"
28
+ },
17
29
  "./register": {
18
30
  "types": "./lib/types/register.d.ts",
19
31
  "default": "./lib/esm/register.js"
@@ -44,13 +56,16 @@
44
56
  "keywords": [
45
57
  "gjs",
46
58
  "domparser",
59
+ "html",
60
+ "html5-parser",
61
+ "css-selectors",
47
62
  "xml",
48
63
  "dom",
49
64
  "web-api"
50
65
  ],
51
66
  "devDependencies": {
52
- "@gjsify/cli": "^0.41.0",
53
- "@gjsify/unit": "^0.41.0",
67
+ "@gjsify/cli": "^0.43.0",
68
+ "@gjsify/unit": "^0.43.0",
54
69
  "@types/node": "^25.9.2",
55
70
  "typescript": "^6.0.3"
56
71
  },