🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

angular-html-parser

Package Overview
Dependencies
Maintainers
4
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-html-parser - npm Package Compare versions

Comparing version
10.0.0
to
10.1.0
+18
dist/_virtual/rolldown_runtime.mjs
//#region rolldown:runtime
var __defProp = Object.defineProperty;
var __export = (all, symbols) => {
let target = {};
for (var name in all) {
__defProp(target, name, {
get: all[name],
enumerable: true
});
}
if (symbols) {
__defProp(target, Symbol.toStringTag, { value: "Module" });
}
return target;
};
//#endregion
export { __export };
//#region ../compiler/src/chars.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
const $EOF = 0;
const $BSPACE = 8;
const $TAB = 9;
const $LF = 10;
const $VTAB = 11;
const $FF = 12;
const $CR = 13;
const $SPACE = 32;
const $BANG = 33;
const $DQ = 34;
const $HASH = 35;
const $$ = 36;
const $AMPERSAND = 38;
const $SQ = 39;
const $LPAREN = 40;
const $RPAREN = 41;
const $COMMA = 44;
const $SLASH = 47;
const $COLON = 58;
const $SEMICOLON = 59;
const $LT = 60;
const $EQ = 61;
const $GT = 62;
const $QUESTION = 63;
const $0 = 48;
const $7 = 55;
const $9 = 57;
const $A = 65;
const $F = 70;
const $X = 88;
const $Z = 90;
const $LBRACKET = 91;
const $BACKSLASH = 92;
const $RBRACKET = 93;
const $_ = 95;
const $a = 97;
const $b = 98;
const $f = 102;
const $n = 110;
const $r = 114;
const $t = 116;
const $u = 117;
const $v = 118;
const $x = 120;
const $z = 122;
const $LBRACE = 123;
const $RBRACE = 125;
const $NBSP = 160;
const $AT = 64;
const $BT = 96;
function isWhitespace(code) {
return code >= $TAB && code <= $SPACE || code == $NBSP;
}
function isDigit(code) {
return $0 <= code && code <= $9;
}
function isAsciiLetter(code) {
return code >= $a && code <= $z || code >= $A && code <= $Z;
}
function isAsciiHexDigit(code) {
return code >= $a && code <= $f || code >= $A && code <= $F || isDigit(code);
}
function isNewLine(code) {
return code === $LF || code === $CR;
}
function isOctalDigit(code) {
return $0 <= code && code <= $7;
}
function isQuote(code) {
return code === $SQ || code === $DQ || code === $BT;
}
//#endregion
export { $$, $0, $9, $A, $AMPERSAND, $AT, $BACKSLASH, $BANG, $BSPACE, $COLON, $COMMA, $CR, $DQ, $EOF, $EQ, $FF, $GT, $HASH, $LBRACE, $LBRACKET, $LF, $LPAREN, $LT, $QUESTION, $RBRACE, $RBRACKET, $RPAREN, $SEMICOLON, $SLASH, $SQ, $TAB, $VTAB, $X, $Z, $_, $a, $b, $f, $n, $r, $t, $u, $v, $x, $z, isAsciiHexDigit, isAsciiLetter, isDigit, isNewLine, isOctalDigit, isQuote, isWhitespace };
//#region ../compiler/src/core.ts
const CUSTOM_ELEMENTS_SCHEMA = { name: "custom-elements" };
const NO_ERRORS_SCHEMA = { name: "no-errors-schema" };
let SecurityContext = /* @__PURE__ */ function(SecurityContext$1) {
SecurityContext$1[SecurityContext$1["NONE"] = 0] = "NONE";
SecurityContext$1[SecurityContext$1["HTML"] = 1] = "HTML";
SecurityContext$1[SecurityContext$1["STYLE"] = 2] = "STYLE";
SecurityContext$1[SecurityContext$1["SCRIPT"] = 3] = "SCRIPT";
SecurityContext$1[SecurityContext$1["URL"] = 4] = "URL";
SecurityContext$1[SecurityContext$1["RESOURCE_URL"] = 5] = "RESOURCE_URL";
return SecurityContext$1;
}({});
//#endregion
export { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SecurityContext };
import { ParseSourceSpan } from "../parse_util.mjs";
//#region ../compiler/src/i18n/i18n_ast.d.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/**
* Describes the text contents of a placeholder as it appears in an ICU expression, including its
* source span information.
*/
interface MessagePlaceholder {
/** The text contents of the placeholder */
text: string;
/** The source span of the placeholder */
sourceSpan: ParseSourceSpan;
}
declare class Message {
nodes: Node[];
placeholders: {
[phName: string]: MessagePlaceholder;
};
placeholderToMessage: {
[phName: string]: Message;
};
meaning: string;
description: string;
customId: string;
sources: MessageSpan[];
id: string;
/** The ids to use if there are no custom id and if `i18nLegacyMessageIdFormat` is not empty */
legacyIds: string[];
messageString: string;
/**
* @param nodes message AST
* @param placeholders maps placeholder names to static content and their source spans
* @param placeholderToMessage maps placeholder names to messages (used for nested ICU messages)
* @param meaning
* @param description
* @param customId
*/
constructor(nodes: Node[], placeholders: {
[phName: string]: MessagePlaceholder;
}, placeholderToMessage: {
[phName: string]: Message;
}, meaning: string, description: string, customId: string);
}
interface MessageSpan {
filePath: string;
startLine: number;
startCol: number;
endLine: number;
endCol: number;
}
interface Node {
sourceSpan: ParseSourceSpan;
visit(visitor: Visitor, context?: any): any;
}
declare class Text implements Node {
value: string;
sourceSpan: ParseSourceSpan;
constructor(value: string, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context?: any): any;
}
declare class Container implements Node {
children: Node[];
sourceSpan: ParseSourceSpan;
constructor(children: Node[], sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context?: any): any;
}
declare class Icu implements Node {
expression: string;
type: string;
cases: {
[k: string]: Node;
};
sourceSpan: ParseSourceSpan;
expressionPlaceholder?: string;
constructor(expression: string, type: string, cases: {
[k: string]: Node;
}, sourceSpan: ParseSourceSpan, expressionPlaceholder?: string);
visit(visitor: Visitor, context?: any): any;
}
declare class TagPlaceholder implements Node {
tag: string;
attrs: {
[k: string]: string;
};
startName: string;
closeName: string;
children: Node[];
isVoid: boolean;
sourceSpan: ParseSourceSpan;
startSourceSpan: ParseSourceSpan | null;
endSourceSpan: ParseSourceSpan | null;
constructor(tag: string, attrs: {
[k: string]: string;
}, startName: string, closeName: string, children: Node[], isVoid: boolean, sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan | null, endSourceSpan: ParseSourceSpan | null);
visit(visitor: Visitor, context?: any): any;
}
declare class Placeholder implements Node {
value: string;
name: string;
sourceSpan: ParseSourceSpan;
constructor(value: string, name: string, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context?: any): any;
}
declare class IcuPlaceholder implements Node {
value: Icu;
name: string;
sourceSpan: ParseSourceSpan;
/** Used to capture a message computed from a previous processing pass (see `setI18nRefs()`). */
previousMessage?: Message;
constructor(value: Icu, name: string, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context?: any): any;
}
declare class BlockPlaceholder implements Node {
name: string;
parameters: string[];
startName: string;
closeName: string;
children: Node[];
sourceSpan: ParseSourceSpan;
startSourceSpan: ParseSourceSpan | null;
endSourceSpan: ParseSourceSpan | null;
constructor(name: string, parameters: string[], startName: string, closeName: string, children: Node[], sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan | null, endSourceSpan: ParseSourceSpan | null);
visit(visitor: Visitor, context?: any): any;
}
/**
* Each HTML node that is affect by an i18n tag will also have an `i18n` property that is of type
* `I18nMeta`.
* This information is either a `Message`, which indicates it is the root of an i18n message, or a
* `Node`, which indicates is it part of a containing `Message`.
*/
type I18nMeta = Message | Node;
interface Visitor {
visitText(text: Text, context?: any): any;
visitContainer(container: Container, context?: any): any;
visitIcu(icu: Icu, context?: any): any;
visitTagPlaceholder(ph: TagPlaceholder, context?: any): any;
visitPlaceholder(ph: Placeholder, context?: any): any;
visitIcuPlaceholder(ph: IcuPlaceholder, context?: any): any;
visitBlockPlaceholder(ph: BlockPlaceholder, context?: any): any;
}
//#endregion
export { I18nMeta };
import { ParseSourceSpan } from "../parse_util.mjs";
import { I18nMeta } from "../i18n/i18n_ast.mjs";
import { InterpolatedAttributeToken, InterpolatedTextToken } from "./tokens.mjs";
//#region ../compiler/src/ml_parser/ast.d.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
declare namespace ast_d_exports {
export { Attribute, Block, BlockParameter, CDATA, Comment, Component, Directive, DocType, Element, Expansion, ExpansionCase, LetDeclaration, Node, NodeWithI18n, RecursiveVisitor, Text, Visitor, visitAll };
}
interface BaseNode {
sourceSpan: ParseSourceSpan;
visit(visitor: Visitor, context: any): any;
}
type Node = Attribute | CDATA | Comment | DocType | Element | Expansion | ExpansionCase | Text | Block | BlockParameter | LetDeclaration | Component | Directive;
declare abstract class NodeWithI18n implements BaseNode {
sourceSpan: ParseSourceSpan;
i18n?: I18nMeta;
constructor(sourceSpan: ParseSourceSpan, i18n?: I18nMeta);
abstract visit(visitor: Visitor, context: any): any;
}
declare class Text extends NodeWithI18n {
value: string;
tokens: InterpolatedTextToken[];
constructor(value: string, sourceSpan: ParseSourceSpan, tokens: InterpolatedTextToken[], i18n?: I18nMeta);
visit(visitor: Visitor, context: any): any;
readonly kind = "text";
}
declare class CDATA extends NodeWithI18n {
value: string;
tokens: InterpolatedTextToken[];
constructor(value: string, sourceSpan: ParseSourceSpan, tokens: InterpolatedTextToken[], i18n?: I18nMeta);
visit(visitor: Visitor, context: any): any;
readonly kind = "cdata";
}
declare class Expansion extends NodeWithI18n {
switchValue: string;
type: string;
cases: ExpansionCase[];
switchValueSourceSpan: ParseSourceSpan;
constructor(switchValue: string, type: string, cases: ExpansionCase[], sourceSpan: ParseSourceSpan, switchValueSourceSpan: ParseSourceSpan, i18n?: I18nMeta);
visit(visitor: Visitor, context: any): any;
readonly kind = "expansion";
}
declare class ExpansionCase implements BaseNode {
value: string;
expression: Node[];
sourceSpan: ParseSourceSpan;
valueSourceSpan: ParseSourceSpan;
expSourceSpan: ParseSourceSpan;
constructor(value: string, expression: Node[], sourceSpan: ParseSourceSpan, valueSourceSpan: ParseSourceSpan, expSourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context: any): any;
readonly kind = "expansionCase";
}
declare class Attribute extends NodeWithI18n {
name: string;
value: string;
readonly keySpan: ParseSourceSpan | undefined;
valueSpan: ParseSourceSpan | undefined;
valueTokens: InterpolatedAttributeToken[] | undefined;
constructor(name: string, value: string, sourceSpan: ParseSourceSpan, keySpan: ParseSourceSpan | undefined, valueSpan: ParseSourceSpan | undefined, valueTokens: InterpolatedAttributeToken[] | undefined, i18n: I18nMeta | undefined);
visit(visitor: Visitor, context: any): any;
readonly kind = "attribute";
get nameSpan(): ParseSourceSpan;
}
declare class Element extends NodeWithI18n {
name: string;
attrs: Attribute[];
readonly directives: Directive[];
children: Node[];
readonly isSelfClosing: boolean;
startSourceSpan: ParseSourceSpan;
endSourceSpan: ParseSourceSpan | null;
nameSpan: ParseSourceSpan | null;
readonly isVoid: boolean;
constructor(name: string, attrs: Attribute[], directives: Directive[], children: Node[], isSelfClosing: boolean, sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan: ParseSourceSpan | null, nameSpan: ParseSourceSpan | null, isVoid: boolean, i18n?: I18nMeta);
visit(visitor: Visitor, context: any): any;
readonly kind = "element";
}
declare class Comment implements BaseNode {
value: string | null;
sourceSpan: ParseSourceSpan;
constructor(value: string | null, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context: any): any;
readonly kind = "comment";
}
declare class DocType implements BaseNode {
value: string | null;
sourceSpan: ParseSourceSpan;
constructor(value: string | null, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context: any): any;
readonly kind = "docType";
}
declare class Block extends NodeWithI18n {
name: string;
parameters: BlockParameter[];
children: Node[];
nameSpan: ParseSourceSpan;
startSourceSpan: ParseSourceSpan;
endSourceSpan: ParseSourceSpan | null;
constructor(name: string, parameters: BlockParameter[], children: Node[], sourceSpan: ParseSourceSpan, nameSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan?: ParseSourceSpan | null, i18n?: I18nMeta);
visit(visitor: Visitor, context: any): any;
readonly kind = "block";
}
declare class Component extends NodeWithI18n {
readonly componentName: string;
readonly tagName: string | null;
readonly fullName: string;
attrs: Attribute[];
readonly directives: Directive[];
readonly children: Node[];
readonly isSelfClosing: boolean;
readonly startSourceSpan: ParseSourceSpan;
endSourceSpan: ParseSourceSpan | null;
constructor(componentName: string, tagName: string | null, fullName: string, attrs: Attribute[], directives: Directive[], children: Node[], isSelfClosing: boolean, sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan?: ParseSourceSpan | null, i18n?: I18nMeta);
visit(visitor: Visitor, context: any): any;
readonly kind = "component";
}
declare class Directive implements BaseNode {
readonly name: string;
readonly attrs: Attribute[];
readonly sourceSpan: ParseSourceSpan;
readonly startSourceSpan: ParseSourceSpan;
readonly endSourceSpan: ParseSourceSpan | null;
constructor(name: string, attrs: Attribute[], sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan?: ParseSourceSpan | null);
visit(visitor: Visitor, context: any): any;
readonly kind = "directive";
}
declare class BlockParameter implements BaseNode {
expression: string;
sourceSpan: ParseSourceSpan;
constructor(expression: string, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context: any): any;
readonly kind = "blockParameter";
readonly startSourceSpan: null;
readonly endSourceSpan: null;
}
declare class LetDeclaration implements BaseNode {
name: string;
value: string;
sourceSpan: ParseSourceSpan;
readonly nameSpan: ParseSourceSpan;
valueSpan: ParseSourceSpan;
constructor(name: string, value: string, sourceSpan: ParseSourceSpan, nameSpan: ParseSourceSpan, valueSpan: ParseSourceSpan);
visit(visitor: Visitor, context: any): any;
readonly kind = "letDeclaration";
readonly startSourceSpan: null;
readonly endSourceSpan: null;
}
interface Visitor {
visit?(node: Node, context: any): any;
visitElement(element: Element, context: any): any;
visitAttribute(attribute: Attribute, context: any): any;
visitText(text: Text, context: any): any;
visitCdata(text: CDATA, context: any): any;
visitComment(comment: Comment, context: any): any;
visitDocType(docType: DocType, context: any): any;
visitExpansion(expansion: Expansion, context: any): any;
visitExpansionCase(expansionCase: ExpansionCase, context: any): any;
visitBlock(block: Block, context: any): any;
visitBlockParameter(parameter: BlockParameter, context: any): any;
visitLetDeclaration(decl: LetDeclaration, context: any): any;
visitComponent(component: Component, context: any): any;
visitDirective(directive: Directive, context: any): any;
}
declare function visitAll(visitor: Visitor, nodes: Node[], context?: any): any[];
declare class RecursiveVisitor implements Visitor {
constructor();
visitElement(ast: Element, context: any): any;
visitAttribute(ast: Attribute, context: any): any;
visitText(ast: Text, context: any): any;
visitCdata(ast: CDATA, context: any): any;
visitComment(ast: Comment, context: any): any;
visitDocType(ast: DocType, context: any): any;
visitExpansion(ast: Expansion, context: any): any;
visitExpansionCase(ast: ExpansionCase, context: any): any;
visitBlock(block: Block, context: any): any;
visitBlockParameter(ast: BlockParameter, context: any): any;
visitLetDeclaration(decl: LetDeclaration, context: any): void;
visitComponent(component: Component, context: any): void;
visitDirective(directive: Directive, context: any): void;
private visitChildren;
}
//#endregion
export { Node, RecursiveVisitor, ast_d_exports, visitAll };
//#region ../compiler/src/ml_parser/ast.ts
var NodeWithI18n = class {
constructor(sourceSpan, i18n) {
this.sourceSpan = sourceSpan;
this.i18n = i18n;
}
};
var Text = class extends NodeWithI18n {
constructor(value, sourceSpan, tokens, i18n) {
super(sourceSpan, i18n);
this.value = value;
this.tokens = tokens;
this.kind = "text";
}
visit(visitor, context) {
return visitor.visitText(this, context);
}
};
var CDATA = class extends NodeWithI18n {
constructor(value, sourceSpan, tokens, i18n) {
super(sourceSpan, i18n);
this.value = value;
this.tokens = tokens;
this.kind = "cdata";
}
visit(visitor, context) {
return visitor.visitCdata(this, context);
}
};
var Expansion = class extends NodeWithI18n {
constructor(switchValue, type, cases, sourceSpan, switchValueSourceSpan, i18n) {
super(sourceSpan, i18n);
this.switchValue = switchValue;
this.type = type;
this.cases = cases;
this.switchValueSourceSpan = switchValueSourceSpan;
this.kind = "expansion";
}
visit(visitor, context) {
return visitor.visitExpansion(this, context);
}
};
var ExpansionCase = class {
constructor(value, expression, sourceSpan, valueSourceSpan, expSourceSpan) {
this.value = value;
this.expression = expression;
this.sourceSpan = sourceSpan;
this.valueSourceSpan = valueSourceSpan;
this.expSourceSpan = expSourceSpan;
this.kind = "expansionCase";
}
visit(visitor, context) {
return visitor.visitExpansionCase(this, context);
}
};
var Attribute = class extends NodeWithI18n {
constructor(name, value, sourceSpan, keySpan, valueSpan, valueTokens, i18n) {
super(sourceSpan, i18n);
this.name = name;
this.value = value;
this.keySpan = keySpan;
this.valueSpan = valueSpan;
this.valueTokens = valueTokens;
this.kind = "attribute";
}
visit(visitor, context) {
return visitor.visitAttribute(this, context);
}
get nameSpan() {
return this.keySpan;
}
};
var Element = class extends NodeWithI18n {
constructor(name, attrs, directives, children, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan = null, nameSpan = null, isVoid, i18n) {
super(sourceSpan, i18n);
this.name = name;
this.attrs = attrs;
this.directives = directives;
this.children = children;
this.isSelfClosing = isSelfClosing;
this.startSourceSpan = startSourceSpan;
this.endSourceSpan = endSourceSpan;
this.nameSpan = nameSpan;
this.isVoid = isVoid;
this.kind = "element";
}
visit(visitor, context) {
return visitor.visitElement(this, context);
}
};
var Comment = class {
constructor(value, sourceSpan) {
this.value = value;
this.sourceSpan = sourceSpan;
this.kind = "comment";
}
visit(visitor, context) {
return visitor.visitComment(this, context);
}
};
var DocType = class {
constructor(value, sourceSpan) {
this.value = value;
this.sourceSpan = sourceSpan;
this.kind = "docType";
}
visit(visitor, context) {
return visitor.visitDocType(this, context);
}
};
var Block = class extends NodeWithI18n {
constructor(name, parameters, children, sourceSpan, nameSpan, startSourceSpan, endSourceSpan = null, i18n) {
super(sourceSpan, i18n);
this.name = name;
this.parameters = parameters;
this.children = children;
this.nameSpan = nameSpan;
this.startSourceSpan = startSourceSpan;
this.endSourceSpan = endSourceSpan;
this.kind = "block";
}
visit(visitor, context) {
return visitor.visitBlock(this, context);
}
};
var Component = class extends NodeWithI18n {
constructor(componentName, tagName, fullName, attrs, directives, children, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan = null, i18n) {
super(sourceSpan, i18n);
this.componentName = componentName;
this.tagName = tagName;
this.fullName = fullName;
this.attrs = attrs;
this.directives = directives;
this.children = children;
this.isSelfClosing = isSelfClosing;
this.startSourceSpan = startSourceSpan;
this.endSourceSpan = endSourceSpan;
this.kind = "component";
}
visit(visitor, context) {
return visitor.visitComponent(this, context);
}
};
var Directive = class {
constructor(name, attrs, sourceSpan, startSourceSpan, endSourceSpan = null) {
this.name = name;
this.attrs = attrs;
this.sourceSpan = sourceSpan;
this.startSourceSpan = startSourceSpan;
this.endSourceSpan = endSourceSpan;
this.kind = "directive";
}
visit(visitor, context) {
return visitor.visitDirective(this, context);
}
};
var BlockParameter = class {
constructor(expression, sourceSpan) {
this.expression = expression;
this.sourceSpan = sourceSpan;
this.kind = "blockParameter";
this.startSourceSpan = null;
this.endSourceSpan = null;
}
visit(visitor, context) {
return visitor.visitBlockParameter(this, context);
}
};
var LetDeclaration = class {
constructor(name, value, sourceSpan, nameSpan, valueSpan) {
this.name = name;
this.value = value;
this.sourceSpan = sourceSpan;
this.nameSpan = nameSpan;
this.valueSpan = valueSpan;
this.kind = "letDeclaration";
this.startSourceSpan = null;
this.endSourceSpan = null;
}
visit(visitor, context) {
return visitor.visitLetDeclaration(this, context);
}
};
function visitAll(visitor, nodes, context = null) {
const result = [];
const visit = visitor.visit ? (ast) => visitor.visit(ast, context) || ast.visit(visitor, context) : (ast) => ast.visit(visitor, context);
nodes.forEach((ast) => {
const astResult = visit(ast);
if (astResult) result.push(astResult);
});
return result;
}
var RecursiveVisitor = class {
constructor() {}
visitElement(ast, context) {
this.visitChildren(context, (visit) => {
visit(ast.attrs);
visit(ast.directives);
visit(ast.children);
});
}
visitAttribute(ast, context) {}
visitText(ast, context) {}
visitCdata(ast, context) {}
visitComment(ast, context) {}
visitDocType(ast, context) {}
visitExpansion(ast, context) {
return this.visitChildren(context, (visit) => {
visit(ast.cases);
});
}
visitExpansionCase(ast, context) {}
visitBlock(block, context) {
this.visitChildren(context, (visit) => {
visit(block.parameters);
visit(block.children);
});
}
visitBlockParameter(ast, context) {}
visitLetDeclaration(decl, context) {}
visitComponent(component, context) {
this.visitChildren(context, (visit) => {
visit(component.attrs);
visit(component.children);
});
}
visitDirective(directive, context) {
this.visitChildren(context, (visit) => {
visit(directive.attrs);
});
}
visitChildren(context, cb) {
let results = [];
let t = this;
function visit(children) {
if (children) results.push(visitAll(t, children, context));
}
cb(visit);
return Array.prototype.concat.apply([], results);
}
};
//#endregion
export { Attribute, Block, BlockParameter, CDATA, Comment, Component, Directive, DocType, Element, Expansion, ExpansionCase, LetDeclaration, RecursiveVisitor, Text, visitAll };
//#region ../compiler/src/ml_parser/entities.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
const NAMED_ENTITIES = {
"AElig": "Æ",
"AMP": "&",
"amp": "&",
"Aacute": "Á",
"Abreve": "Ă",
"Acirc": "Â",
"Acy": "А",
"Afr": "𝔄",
"Agrave": "À",
"Alpha": "Α",
"Amacr": "Ā",
"And": "⩓",
"Aogon": "Ą",
"Aopf": "𝔸",
"ApplyFunction": "⁡",
"af": "⁡",
"Aring": "Å",
"angst": "Å",
"Ascr": "𝒜",
"Assign": "≔",
"colone": "≔",
"coloneq": "≔",
"Atilde": "Ã",
"Auml": "Ä",
"Backslash": "∖",
"setminus": "∖",
"setmn": "∖",
"smallsetminus": "∖",
"ssetmn": "∖",
"Barv": "⫧",
"Barwed": "⌆",
"doublebarwedge": "⌆",
"Bcy": "Б",
"Because": "∵",
"becaus": "∵",
"because": "∵",
"Bernoullis": "ℬ",
"Bscr": "ℬ",
"bernou": "ℬ",
"Beta": "Β",
"Bfr": "𝔅",
"Bopf": "𝔹",
"Breve": "˘",
"breve": "˘",
"Bumpeq": "≎",
"HumpDownHump": "≎",
"bump": "≎",
"CHcy": "Ч",
"COPY": "©",
"copy": "©",
"Cacute": "Ć",
"Cap": "⋒",
"CapitalDifferentialD": "ⅅ",
"DD": "ⅅ",
"Cayleys": "ℭ",
"Cfr": "ℭ",
"Ccaron": "Č",
"Ccedil": "Ç",
"Ccirc": "Ĉ",
"Cconint": "∰",
"Cdot": "Ċ",
"Cedilla": "¸",
"cedil": "¸",
"CenterDot": "·",
"centerdot": "·",
"middot": "·",
"Chi": "Χ",
"CircleDot": "⊙",
"odot": "⊙",
"CircleMinus": "⊖",
"ominus": "⊖",
"CirclePlus": "⊕",
"oplus": "⊕",
"CircleTimes": "⊗",
"otimes": "⊗",
"ClockwiseContourIntegral": "∲",
"cwconint": "∲",
"CloseCurlyDoubleQuote": "”",
"rdquo": "”",
"rdquor": "”",
"CloseCurlyQuote": "’",
"rsquo": "’",
"rsquor": "’",
"Colon": "∷",
"Proportion": "∷",
"Colone": "⩴",
"Congruent": "≡",
"equiv": "≡",
"Conint": "∯",
"DoubleContourIntegral": "∯",
"ContourIntegral": "∮",
"conint": "∮",
"oint": "∮",
"Copf": "ℂ",
"complexes": "ℂ",
"Coproduct": "∐",
"coprod": "∐",
"CounterClockwiseContourIntegral": "∳",
"awconint": "∳",
"Cross": "⨯",
"Cscr": "𝒞",
"Cup": "⋓",
"CupCap": "≍",
"asympeq": "≍",
"DDotrahd": "⤑",
"DJcy": "Ђ",
"DScy": "Ѕ",
"DZcy": "Џ",
"Dagger": "‡",
"ddagger": "‡",
"Darr": "↡",
"Dashv": "⫤",
"DoubleLeftTee": "⫤",
"Dcaron": "Ď",
"Dcy": "Д",
"Del": "∇",
"nabla": "∇",
"Delta": "Δ",
"Dfr": "𝔇",
"DiacriticalAcute": "´",
"acute": "´",
"DiacriticalDot": "˙",
"dot": "˙",
"DiacriticalDoubleAcute": "˝",
"dblac": "˝",
"DiacriticalGrave": "`",
"grave": "`",
"DiacriticalTilde": "˜",
"tilde": "˜",
"Diamond": "⋄",
"diam": "⋄",
"diamond": "⋄",
"DifferentialD": "ⅆ",
"dd": "ⅆ",
"Dopf": "𝔻",
"Dot": "¨",
"DoubleDot": "¨",
"die": "¨",
"uml": "¨",
"DotDot": "⃜",
"DotEqual": "≐",
"doteq": "≐",
"esdot": "≐",
"DoubleDownArrow": "⇓",
"Downarrow": "⇓",
"dArr": "⇓",
"DoubleLeftArrow": "⇐",
"Leftarrow": "⇐",
"lArr": "⇐",
"DoubleLeftRightArrow": "⇔",
"Leftrightarrow": "⇔",
"hArr": "⇔",
"iff": "⇔",
"DoubleLongLeftArrow": "⟸",
"Longleftarrow": "⟸",
"xlArr": "⟸",
"DoubleLongLeftRightArrow": "⟺",
"Longleftrightarrow": "⟺",
"xhArr": "⟺",
"DoubleLongRightArrow": "⟹",
"Longrightarrow": "⟹",
"xrArr": "⟹",
"DoubleRightArrow": "⇒",
"Implies": "⇒",
"Rightarrow": "⇒",
"rArr": "⇒",
"DoubleRightTee": "⊨",
"vDash": "⊨",
"DoubleUpArrow": "⇑",
"Uparrow": "⇑",
"uArr": "⇑",
"DoubleUpDownArrow": "⇕",
"Updownarrow": "⇕",
"vArr": "⇕",
"DoubleVerticalBar": "∥",
"par": "∥",
"parallel": "∥",
"shortparallel": "∥",
"spar": "∥",
"DownArrow": "↓",
"ShortDownArrow": "↓",
"darr": "↓",
"downarrow": "↓",
"DownArrowBar": "⤓",
"DownArrowUpArrow": "⇵",
"duarr": "⇵",
"DownBreve": "̑",
"DownLeftRightVector": "⥐",
"DownLeftTeeVector": "⥞",
"DownLeftVector": "↽",
"leftharpoondown": "↽",
"lhard": "↽",
"DownLeftVectorBar": "⥖",
"DownRightTeeVector": "⥟",
"DownRightVector": "⇁",
"rhard": "⇁",
"rightharpoondown": "⇁",
"DownRightVectorBar": "⥗",
"DownTee": "⊤",
"top": "⊤",
"DownTeeArrow": "↧",
"mapstodown": "↧",
"Dscr": "𝒟",
"Dstrok": "Đ",
"ENG": "Ŋ",
"ETH": "Ð",
"Eacute": "É",
"Ecaron": "Ě",
"Ecirc": "Ê",
"Ecy": "Э",
"Edot": "Ė",
"Efr": "𝔈",
"Egrave": "È",
"Element": "∈",
"in": "∈",
"isin": "∈",
"isinv": "∈",
"Emacr": "Ē",
"EmptySmallSquare": "◻",
"EmptyVerySmallSquare": "▫",
"Eogon": "Ę",
"Eopf": "𝔼",
"Epsilon": "Ε",
"Equal": "⩵",
"EqualTilde": "≂",
"eqsim": "≂",
"esim": "≂",
"Equilibrium": "⇌",
"rightleftharpoons": "⇌",
"rlhar": "⇌",
"Escr": "ℰ",
"expectation": "ℰ",
"Esim": "⩳",
"Eta": "Η",
"Euml": "Ë",
"Exists": "∃",
"exist": "∃",
"ExponentialE": "ⅇ",
"ee": "ⅇ",
"exponentiale": "ⅇ",
"Fcy": "Ф",
"Ffr": "𝔉",
"FilledSmallSquare": "◼",
"FilledVerySmallSquare": "▪",
"blacksquare": "▪",
"squarf": "▪",
"squf": "▪",
"Fopf": "𝔽",
"ForAll": "∀",
"forall": "∀",
"Fouriertrf": "ℱ",
"Fscr": "ℱ",
"GJcy": "Ѓ",
"GT": ">",
"gt": ">",
"Gamma": "Γ",
"Gammad": "Ϝ",
"Gbreve": "Ğ",
"Gcedil": "Ģ",
"Gcirc": "Ĝ",
"Gcy": "Г",
"Gdot": "Ġ",
"Gfr": "𝔊",
"Gg": "⋙",
"ggg": "⋙",
"Gopf": "𝔾",
"GreaterEqual": "≥",
"ge": "≥",
"geq": "≥",
"GreaterEqualLess": "⋛",
"gel": "⋛",
"gtreqless": "⋛",
"GreaterFullEqual": "≧",
"gE": "≧",
"geqq": "≧",
"GreaterGreater": "⪢",
"GreaterLess": "≷",
"gl": "≷",
"gtrless": "≷",
"GreaterSlantEqual": "⩾",
"geqslant": "⩾",
"ges": "⩾",
"GreaterTilde": "≳",
"gsim": "≳",
"gtrsim": "≳",
"Gscr": "𝒢",
"Gt": "≫",
"NestedGreaterGreater": "≫",
"gg": "≫",
"HARDcy": "Ъ",
"Hacek": "ˇ",
"caron": "ˇ",
"Hat": "^",
"Hcirc": "Ĥ",
"Hfr": "ℌ",
"Poincareplane": "ℌ",
"HilbertSpace": "ℋ",
"Hscr": "ℋ",
"hamilt": "ℋ",
"Hopf": "ℍ",
"quaternions": "ℍ",
"HorizontalLine": "─",
"boxh": "─",
"Hstrok": "Ħ",
"HumpEqual": "≏",
"bumpe": "≏",
"bumpeq": "≏",
"IEcy": "Е",
"IJlig": "IJ",
"IOcy": "Ё",
"Iacute": "Í",
"Icirc": "Î",
"Icy": "И",
"Idot": "İ",
"Ifr": "ℑ",
"Im": "ℑ",
"image": "ℑ",
"imagpart": "ℑ",
"Igrave": "Ì",
"Imacr": "Ī",
"ImaginaryI": "ⅈ",
"ii": "ⅈ",
"Int": "∬",
"Integral": "∫",
"int": "∫",
"Intersection": "⋂",
"bigcap": "⋂",
"xcap": "⋂",
"InvisibleComma": "⁣",
"ic": "⁣",
"InvisibleTimes": "⁢",
"it": "⁢",
"Iogon": "Į",
"Iopf": "𝕀",
"Iota": "Ι",
"Iscr": "ℐ",
"imagline": "ℐ",
"Itilde": "Ĩ",
"Iukcy": "І",
"Iuml": "Ï",
"Jcirc": "Ĵ",
"Jcy": "Й",
"Jfr": "𝔍",
"Jopf": "𝕁",
"Jscr": "𝒥",
"Jsercy": "Ј",
"Jukcy": "Є",
"KHcy": "Х",
"KJcy": "Ќ",
"Kappa": "Κ",
"Kcedil": "Ķ",
"Kcy": "К",
"Kfr": "𝔎",
"Kopf": "𝕂",
"Kscr": "𝒦",
"LJcy": "Љ",
"LT": "<",
"lt": "<",
"Lacute": "Ĺ",
"Lambda": "Λ",
"Lang": "⟪",
"Laplacetrf": "ℒ",
"Lscr": "ℒ",
"lagran": "ℒ",
"Larr": "↞",
"twoheadleftarrow": "↞",
"Lcaron": "Ľ",
"Lcedil": "Ļ",
"Lcy": "Л",
"LeftAngleBracket": "⟨",
"lang": "⟨",
"langle": "⟨",
"LeftArrow": "←",
"ShortLeftArrow": "←",
"larr": "←",
"leftarrow": "←",
"slarr": "←",
"LeftArrowBar": "⇤",
"larrb": "⇤",
"LeftArrowRightArrow": "⇆",
"leftrightarrows": "⇆",
"lrarr": "⇆",
"LeftCeiling": "⌈",
"lceil": "⌈",
"LeftDoubleBracket": "⟦",
"lobrk": "⟦",
"LeftDownTeeVector": "⥡",
"LeftDownVector": "⇃",
"dharl": "⇃",
"downharpoonleft": "⇃",
"LeftDownVectorBar": "⥙",
"LeftFloor": "⌊",
"lfloor": "⌊",
"LeftRightArrow": "↔",
"harr": "↔",
"leftrightarrow": "↔",
"LeftRightVector": "⥎",
"LeftTee": "⊣",
"dashv": "⊣",
"LeftTeeArrow": "↤",
"mapstoleft": "↤",
"LeftTeeVector": "⥚",
"LeftTriangle": "⊲",
"vartriangleleft": "⊲",
"vltri": "⊲",
"LeftTriangleBar": "⧏",
"LeftTriangleEqual": "⊴",
"ltrie": "⊴",
"trianglelefteq": "⊴",
"LeftUpDownVector": "⥑",
"LeftUpTeeVector": "⥠",
"LeftUpVector": "↿",
"uharl": "↿",
"upharpoonleft": "↿",
"LeftUpVectorBar": "⥘",
"LeftVector": "↼",
"leftharpoonup": "↼",
"lharu": "↼",
"LeftVectorBar": "⥒",
"LessEqualGreater": "⋚",
"leg": "⋚",
"lesseqgtr": "⋚",
"LessFullEqual": "≦",
"lE": "≦",
"leqq": "≦",
"LessGreater": "≶",
"lessgtr": "≶",
"lg": "≶",
"LessLess": "⪡",
"LessSlantEqual": "⩽",
"leqslant": "⩽",
"les": "⩽",
"LessTilde": "≲",
"lesssim": "≲",
"lsim": "≲",
"Lfr": "𝔏",
"Ll": "⋘",
"Lleftarrow": "⇚",
"lAarr": "⇚",
"Lmidot": "Ŀ",
"LongLeftArrow": "⟵",
"longleftarrow": "⟵",
"xlarr": "⟵",
"LongLeftRightArrow": "⟷",
"longleftrightarrow": "⟷",
"xharr": "⟷",
"LongRightArrow": "⟶",
"longrightarrow": "⟶",
"xrarr": "⟶",
"Lopf": "𝕃",
"LowerLeftArrow": "↙",
"swarr": "↙",
"swarrow": "↙",
"LowerRightArrow": "↘",
"searr": "↘",
"searrow": "↘",
"Lsh": "↰",
"lsh": "↰",
"Lstrok": "Ł",
"Lt": "≪",
"NestedLessLess": "≪",
"ll": "≪",
"Map": "⤅",
"Mcy": "М",
"MediumSpace": " ",
"Mellintrf": "ℳ",
"Mscr": "ℳ",
"phmmat": "ℳ",
"Mfr": "𝔐",
"MinusPlus": "∓",
"mnplus": "∓",
"mp": "∓",
"Mopf": "𝕄",
"Mu": "Μ",
"NJcy": "Њ",
"Nacute": "Ń",
"Ncaron": "Ň",
"Ncedil": "Ņ",
"Ncy": "Н",
"NegativeMediumSpace": "​",
"NegativeThickSpace": "​",
"NegativeThinSpace": "​",
"NegativeVeryThinSpace": "​",
"ZeroWidthSpace": "​",
"NewLine": "\n",
"Nfr": "𝔑",
"NoBreak": "⁠",
"NonBreakingSpace": "\xA0",
"nbsp": "\xA0",
"Nopf": "ℕ",
"naturals": "ℕ",
"Not": "⫬",
"NotCongruent": "≢",
"nequiv": "≢",
"NotCupCap": "≭",
"NotDoubleVerticalBar": "∦",
"npar": "∦",
"nparallel": "∦",
"nshortparallel": "∦",
"nspar": "∦",
"NotElement": "∉",
"notin": "∉",
"notinva": "∉",
"NotEqual": "≠",
"ne": "≠",
"NotEqualTilde": "≂̸",
"nesim": "≂̸",
"NotExists": "∄",
"nexist": "∄",
"nexists": "∄",
"NotGreater": "≯",
"ngt": "≯",
"ngtr": "≯",
"NotGreaterEqual": "≱",
"nge": "≱",
"ngeq": "≱",
"NotGreaterFullEqual": "≧̸",
"ngE": "≧̸",
"ngeqq": "≧̸",
"NotGreaterGreater": "≫̸",
"nGtv": "≫̸",
"NotGreaterLess": "≹",
"ntgl": "≹",
"NotGreaterSlantEqual": "⩾̸",
"ngeqslant": "⩾̸",
"nges": "⩾̸",
"NotGreaterTilde": "≵",
"ngsim": "≵",
"NotHumpDownHump": "≎̸",
"nbump": "≎̸",
"NotHumpEqual": "≏̸",
"nbumpe": "≏̸",
"NotLeftTriangle": "⋪",
"nltri": "⋪",
"ntriangleleft": "⋪",
"NotLeftTriangleBar": "⧏̸",
"NotLeftTriangleEqual": "⋬",
"nltrie": "⋬",
"ntrianglelefteq": "⋬",
"NotLess": "≮",
"nless": "≮",
"nlt": "≮",
"NotLessEqual": "≰",
"nle": "≰",
"nleq": "≰",
"NotLessGreater": "≸",
"ntlg": "≸",
"NotLessLess": "≪̸",
"nLtv": "≪̸",
"NotLessSlantEqual": "⩽̸",
"nleqslant": "⩽̸",
"nles": "⩽̸",
"NotLessTilde": "≴",
"nlsim": "≴",
"NotNestedGreaterGreater": "⪢̸",
"NotNestedLessLess": "⪡̸",
"NotPrecedes": "⊀",
"npr": "⊀",
"nprec": "⊀",
"NotPrecedesEqual": "⪯̸",
"npre": "⪯̸",
"npreceq": "⪯̸",
"NotPrecedesSlantEqual": "⋠",
"nprcue": "⋠",
"NotReverseElement": "∌",
"notni": "∌",
"notniva": "∌",
"NotRightTriangle": "⋫",
"nrtri": "⋫",
"ntriangleright": "⋫",
"NotRightTriangleBar": "⧐̸",
"NotRightTriangleEqual": "⋭",
"nrtrie": "⋭",
"ntrianglerighteq": "⋭",
"NotSquareSubset": "⊏̸",
"NotSquareSubsetEqual": "⋢",
"nsqsube": "⋢",
"NotSquareSuperset": "⊐̸",
"NotSquareSupersetEqual": "⋣",
"nsqsupe": "⋣",
"NotSubset": "⊂⃒",
"nsubset": "⊂⃒",
"vnsub": "⊂⃒",
"NotSubsetEqual": "⊈",
"nsube": "⊈",
"nsubseteq": "⊈",
"NotSucceeds": "⊁",
"nsc": "⊁",
"nsucc": "⊁",
"NotSucceedsEqual": "⪰̸",
"nsce": "⪰̸",
"nsucceq": "⪰̸",
"NotSucceedsSlantEqual": "⋡",
"nsccue": "⋡",
"NotSucceedsTilde": "≿̸",
"NotSuperset": "⊃⃒",
"nsupset": "⊃⃒",
"vnsup": "⊃⃒",
"NotSupersetEqual": "⊉",
"nsupe": "⊉",
"nsupseteq": "⊉",
"NotTilde": "≁",
"nsim": "≁",
"NotTildeEqual": "≄",
"nsime": "≄",
"nsimeq": "≄",
"NotTildeFullEqual": "≇",
"ncong": "≇",
"NotTildeTilde": "≉",
"nap": "≉",
"napprox": "≉",
"NotVerticalBar": "∤",
"nmid": "∤",
"nshortmid": "∤",
"nsmid": "∤",
"Nscr": "𝒩",
"Ntilde": "Ñ",
"Nu": "Ν",
"OElig": "Œ",
"Oacute": "Ó",
"Ocirc": "Ô",
"Ocy": "О",
"Odblac": "Ő",
"Ofr": "𝔒",
"Ograve": "Ò",
"Omacr": "Ō",
"Omega": "Ω",
"ohm": "Ω",
"Omicron": "Ο",
"Oopf": "𝕆",
"OpenCurlyDoubleQuote": "“",
"ldquo": "“",
"OpenCurlyQuote": "‘",
"lsquo": "‘",
"Or": "⩔",
"Oscr": "𝒪",
"Oslash": "Ø",
"Otilde": "Õ",
"Otimes": "⨷",
"Ouml": "Ö",
"OverBar": "‾",
"oline": "‾",
"OverBrace": "⏞",
"OverBracket": "⎴",
"tbrk": "⎴",
"OverParenthesis": "⏜",
"PartialD": "∂",
"part": "∂",
"Pcy": "П",
"Pfr": "𝔓",
"Phi": "Φ",
"Pi": "Π",
"PlusMinus": "±",
"plusmn": "±",
"pm": "±",
"Popf": "ℙ",
"primes": "ℙ",
"Pr": "⪻",
"Precedes": "≺",
"pr": "≺",
"prec": "≺",
"PrecedesEqual": "⪯",
"pre": "⪯",
"preceq": "⪯",
"PrecedesSlantEqual": "≼",
"prcue": "≼",
"preccurlyeq": "≼",
"PrecedesTilde": "≾",
"precsim": "≾",
"prsim": "≾",
"Prime": "″",
"Product": "∏",
"prod": "∏",
"Proportional": "∝",
"prop": "∝",
"propto": "∝",
"varpropto": "∝",
"vprop": "∝",
"Pscr": "𝒫",
"Psi": "Ψ",
"QUOT": "\"",
"quot": "\"",
"Qfr": "𝔔",
"Qopf": "ℚ",
"rationals": "ℚ",
"Qscr": "𝒬",
"RBarr": "⤐",
"drbkarow": "⤐",
"REG": "®",
"circledR": "®",
"reg": "®",
"Racute": "Ŕ",
"Rang": "⟫",
"Rarr": "↠",
"twoheadrightarrow": "↠",
"Rarrtl": "⤖",
"Rcaron": "Ř",
"Rcedil": "Ŗ",
"Rcy": "Р",
"Re": "ℜ",
"Rfr": "ℜ",
"real": "ℜ",
"realpart": "ℜ",
"ReverseElement": "∋",
"SuchThat": "∋",
"ni": "∋",
"niv": "∋",
"ReverseEquilibrium": "⇋",
"leftrightharpoons": "⇋",
"lrhar": "⇋",
"ReverseUpEquilibrium": "⥯",
"duhar": "⥯",
"Rho": "Ρ",
"RightAngleBracket": "⟩",
"rang": "⟩",
"rangle": "⟩",
"RightArrow": "→",
"ShortRightArrow": "→",
"rarr": "→",
"rightarrow": "→",
"srarr": "→",
"RightArrowBar": "⇥",
"rarrb": "⇥",
"RightArrowLeftArrow": "⇄",
"rightleftarrows": "⇄",
"rlarr": "⇄",
"RightCeiling": "⌉",
"rceil": "⌉",
"RightDoubleBracket": "⟧",
"robrk": "⟧",
"RightDownTeeVector": "⥝",
"RightDownVector": "⇂",
"dharr": "⇂",
"downharpoonright": "⇂",
"RightDownVectorBar": "⥕",
"RightFloor": "⌋",
"rfloor": "⌋",
"RightTee": "⊢",
"vdash": "⊢",
"RightTeeArrow": "↦",
"map": "↦",
"mapsto": "↦",
"RightTeeVector": "⥛",
"RightTriangle": "⊳",
"vartriangleright": "⊳",
"vrtri": "⊳",
"RightTriangleBar": "⧐",
"RightTriangleEqual": "⊵",
"rtrie": "⊵",
"trianglerighteq": "⊵",
"RightUpDownVector": "⥏",
"RightUpTeeVector": "⥜",
"RightUpVector": "↾",
"uharr": "↾",
"upharpoonright": "↾",
"RightUpVectorBar": "⥔",
"RightVector": "⇀",
"rharu": "⇀",
"rightharpoonup": "⇀",
"RightVectorBar": "⥓",
"Ropf": "ℝ",
"reals": "ℝ",
"RoundImplies": "⥰",
"Rrightarrow": "⇛",
"rAarr": "⇛",
"Rscr": "ℛ",
"realine": "ℛ",
"Rsh": "↱",
"rsh": "↱",
"RuleDelayed": "⧴",
"SHCHcy": "Щ",
"SHcy": "Ш",
"SOFTcy": "Ь",
"Sacute": "Ś",
"Sc": "⪼",
"Scaron": "Š",
"Scedil": "Ş",
"Scirc": "Ŝ",
"Scy": "С",
"Sfr": "𝔖",
"ShortUpArrow": "↑",
"UpArrow": "↑",
"uarr": "↑",
"uparrow": "↑",
"Sigma": "Σ",
"SmallCircle": "∘",
"compfn": "∘",
"Sopf": "𝕊",
"Sqrt": "√",
"radic": "√",
"Square": "□",
"squ": "□",
"square": "□",
"SquareIntersection": "⊓",
"sqcap": "⊓",
"SquareSubset": "⊏",
"sqsub": "⊏",
"sqsubset": "⊏",
"SquareSubsetEqual": "⊑",
"sqsube": "⊑",
"sqsubseteq": "⊑",
"SquareSuperset": "⊐",
"sqsup": "⊐",
"sqsupset": "⊐",
"SquareSupersetEqual": "⊒",
"sqsupe": "⊒",
"sqsupseteq": "⊒",
"SquareUnion": "⊔",
"sqcup": "⊔",
"Sscr": "𝒮",
"Star": "⋆",
"sstarf": "⋆",
"Sub": "⋐",
"Subset": "⋐",
"SubsetEqual": "⊆",
"sube": "⊆",
"subseteq": "⊆",
"Succeeds": "≻",
"sc": "≻",
"succ": "≻",
"SucceedsEqual": "⪰",
"sce": "⪰",
"succeq": "⪰",
"SucceedsSlantEqual": "≽",
"sccue": "≽",
"succcurlyeq": "≽",
"SucceedsTilde": "≿",
"scsim": "≿",
"succsim": "≿",
"Sum": "∑",
"sum": "∑",
"Sup": "⋑",
"Supset": "⋑",
"Superset": "⊃",
"sup": "⊃",
"supset": "⊃",
"SupersetEqual": "⊇",
"supe": "⊇",
"supseteq": "⊇",
"THORN": "Þ",
"TRADE": "™",
"trade": "™",
"TSHcy": "Ћ",
"TScy": "Ц",
"Tab": " ",
"Tau": "Τ",
"Tcaron": "Ť",
"Tcedil": "Ţ",
"Tcy": "Т",
"Tfr": "𝔗",
"Therefore": "∴",
"there4": "∴",
"therefore": "∴",
"Theta": "Θ",
"ThickSpace": "  ",
"ThinSpace": " ",
"thinsp": " ",
"Tilde": "∼",
"sim": "∼",
"thicksim": "∼",
"thksim": "∼",
"TildeEqual": "≃",
"sime": "≃",
"simeq": "≃",
"TildeFullEqual": "≅",
"cong": "≅",
"TildeTilde": "≈",
"ap": "≈",
"approx": "≈",
"asymp": "≈",
"thickapprox": "≈",
"thkap": "≈",
"Topf": "𝕋",
"TripleDot": "⃛",
"tdot": "⃛",
"Tscr": "𝒯",
"Tstrok": "Ŧ",
"Uacute": "Ú",
"Uarr": "↟",
"Uarrocir": "⥉",
"Ubrcy": "Ў",
"Ubreve": "Ŭ",
"Ucirc": "Û",
"Ucy": "У",
"Udblac": "Ű",
"Ufr": "𝔘",
"Ugrave": "Ù",
"Umacr": "Ū",
"UnderBar": "_",
"lowbar": "_",
"UnderBrace": "⏟",
"UnderBracket": "⎵",
"bbrk": "⎵",
"UnderParenthesis": "⏝",
"Union": "⋃",
"bigcup": "⋃",
"xcup": "⋃",
"UnionPlus": "⊎",
"uplus": "⊎",
"Uogon": "Ų",
"Uopf": "𝕌",
"UpArrowBar": "⤒",
"UpArrowDownArrow": "⇅",
"udarr": "⇅",
"UpDownArrow": "↕",
"updownarrow": "↕",
"varr": "↕",
"UpEquilibrium": "⥮",
"udhar": "⥮",
"UpTee": "⊥",
"bot": "⊥",
"bottom": "⊥",
"perp": "⊥",
"UpTeeArrow": "↥",
"mapstoup": "↥",
"UpperLeftArrow": "↖",
"nwarr": "↖",
"nwarrow": "↖",
"UpperRightArrow": "↗",
"nearr": "↗",
"nearrow": "↗",
"Upsi": "ϒ",
"upsih": "ϒ",
"Upsilon": "Υ",
"Uring": "Ů",
"Uscr": "𝒰",
"Utilde": "Ũ",
"Uuml": "Ü",
"VDash": "⊫",
"Vbar": "⫫",
"Vcy": "В",
"Vdash": "⊩",
"Vdashl": "⫦",
"Vee": "⋁",
"bigvee": "⋁",
"xvee": "⋁",
"Verbar": "‖",
"Vert": "‖",
"VerticalBar": "∣",
"mid": "∣",
"shortmid": "∣",
"smid": "∣",
"VerticalLine": "|",
"verbar": "|",
"vert": "|",
"VerticalSeparator": "❘",
"VerticalTilde": "≀",
"wr": "≀",
"wreath": "≀",
"VeryThinSpace": " ",
"hairsp": " ",
"Vfr": "𝔙",
"Vopf": "𝕍",
"Vscr": "𝒱",
"Vvdash": "⊪",
"Wcirc": "Ŵ",
"Wedge": "⋀",
"bigwedge": "⋀",
"xwedge": "⋀",
"Wfr": "𝔚",
"Wopf": "𝕎",
"Wscr": "𝒲",
"Xfr": "𝔛",
"Xi": "Ξ",
"Xopf": "𝕏",
"Xscr": "𝒳",
"YAcy": "Я",
"YIcy": "Ї",
"YUcy": "Ю",
"Yacute": "Ý",
"Ycirc": "Ŷ",
"Ycy": "Ы",
"Yfr": "𝔜",
"Yopf": "𝕐",
"Yscr": "𝒴",
"Yuml": "Ÿ",
"ZHcy": "Ж",
"Zacute": "Ź",
"Zcaron": "Ž",
"Zcy": "З",
"Zdot": "Ż",
"Zeta": "Ζ",
"Zfr": "ℨ",
"zeetrf": "ℨ",
"Zopf": "ℤ",
"integers": "ℤ",
"Zscr": "𝒵",
"aacute": "á",
"abreve": "ă",
"ac": "∾",
"mstpos": "∾",
"acE": "∾̳",
"acd": "∿",
"acirc": "â",
"acy": "а",
"aelig": "æ",
"afr": "𝔞",
"agrave": "à",
"alefsym": "ℵ",
"aleph": "ℵ",
"alpha": "α",
"amacr": "ā",
"amalg": "⨿",
"and": "∧",
"wedge": "∧",
"andand": "⩕",
"andd": "⩜",
"andslope": "⩘",
"andv": "⩚",
"ang": "∠",
"angle": "∠",
"ange": "⦤",
"angmsd": "∡",
"measuredangle": "∡",
"angmsdaa": "⦨",
"angmsdab": "⦩",
"angmsdac": "⦪",
"angmsdad": "⦫",
"angmsdae": "⦬",
"angmsdaf": "⦭",
"angmsdag": "⦮",
"angmsdah": "⦯",
"angrt": "∟",
"angrtvb": "⊾",
"angrtvbd": "⦝",
"angsph": "∢",
"angzarr": "⍼",
"aogon": "ą",
"aopf": "𝕒",
"apE": "⩰",
"apacir": "⩯",
"ape": "≊",
"approxeq": "≊",
"apid": "≋",
"apos": "'",
"aring": "å",
"ascr": "𝒶",
"ast": "*",
"midast": "*",
"atilde": "ã",
"auml": "ä",
"awint": "⨑",
"bNot": "⫭",
"backcong": "≌",
"bcong": "≌",
"backepsilon": "϶",
"bepsi": "϶",
"backprime": "‵",
"bprime": "‵",
"backsim": "∽",
"bsim": "∽",
"backsimeq": "⋍",
"bsime": "⋍",
"barvee": "⊽",
"barwed": "⌅",
"barwedge": "⌅",
"bbrktbrk": "⎶",
"bcy": "б",
"bdquo": "„",
"ldquor": "„",
"bemptyv": "⦰",
"beta": "β",
"beth": "ℶ",
"between": "≬",
"twixt": "≬",
"bfr": "𝔟",
"bigcirc": "◯",
"xcirc": "◯",
"bigodot": "⨀",
"xodot": "⨀",
"bigoplus": "⨁",
"xoplus": "⨁",
"bigotimes": "⨂",
"xotime": "⨂",
"bigsqcup": "⨆",
"xsqcup": "⨆",
"bigstar": "★",
"starf": "★",
"bigtriangledown": "▽",
"xdtri": "▽",
"bigtriangleup": "△",
"xutri": "△",
"biguplus": "⨄",
"xuplus": "⨄",
"bkarow": "⤍",
"rbarr": "⤍",
"blacklozenge": "⧫",
"lozf": "⧫",
"blacktriangle": "▴",
"utrif": "▴",
"blacktriangledown": "▾",
"dtrif": "▾",
"blacktriangleleft": "◂",
"ltrif": "◂",
"blacktriangleright": "▸",
"rtrif": "▸",
"blank": "␣",
"blk12": "▒",
"blk14": "░",
"blk34": "▓",
"block": "█",
"bne": "=⃥",
"bnequiv": "≡⃥",
"bnot": "⌐",
"bopf": "𝕓",
"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": "┌",
"boxhD": "╥",
"boxhU": "╨",
"boxhd": "┬",
"boxhu": "┴",
"boxminus": "⊟",
"minusb": "⊟",
"boxplus": "⊞",
"plusb": "⊞",
"boxtimes": "⊠",
"timesb": "⊠",
"boxuL": "╛",
"boxuR": "╘",
"boxul": "┘",
"boxur": "└",
"boxv": "│",
"boxvH": "╪",
"boxvL": "╡",
"boxvR": "╞",
"boxvh": "┼",
"boxvl": "┤",
"boxvr": "├",
"brvbar": "¦",
"bscr": "𝒷",
"bsemi": "⁏",
"bsol": "\\",
"bsolb": "⧅",
"bsolhsub": "⟈",
"bull": "•",
"bullet": "•",
"bumpE": "⪮",
"cacute": "ć",
"cap": "∩",
"capand": "⩄",
"capbrcup": "⩉",
"capcap": "⩋",
"capcup": "⩇",
"capdot": "⩀",
"caps": "∩︀",
"caret": "⁁",
"ccaps": "⩍",
"ccaron": "č",
"ccedil": "ç",
"ccirc": "ĉ",
"ccups": "⩌",
"ccupssm": "⩐",
"cdot": "ċ",
"cemptyv": "⦲",
"cent": "¢",
"cfr": "𝔠",
"chcy": "ч",
"check": "✓",
"checkmark": "✓",
"chi": "χ",
"cir": "○",
"cirE": "⧃",
"circ": "ˆ",
"circeq": "≗",
"cire": "≗",
"circlearrowleft": "↺",
"olarr": "↺",
"circlearrowright": "↻",
"orarr": "↻",
"circledS": "Ⓢ",
"oS": "Ⓢ",
"circledast": "⊛",
"oast": "⊛",
"circledcirc": "⊚",
"ocir": "⊚",
"circleddash": "⊝",
"odash": "⊝",
"cirfnint": "⨐",
"cirmid": "⫯",
"cirscir": "⧂",
"clubs": "♣",
"clubsuit": "♣",
"colon": ":",
"comma": ",",
"commat": "@",
"comp": "∁",
"complement": "∁",
"congdot": "⩭",
"copf": "𝕔",
"copysr": "℗",
"crarr": "↵",
"cross": "✗",
"cscr": "𝒸",
"csub": "⫏",
"csube": "⫑",
"csup": "⫐",
"csupe": "⫒",
"ctdot": "⋯",
"cudarrl": "⤸",
"cudarrr": "⤵",
"cuepr": "⋞",
"curlyeqprec": "⋞",
"cuesc": "⋟",
"curlyeqsucc": "⋟",
"cularr": "↶",
"curvearrowleft": "↶",
"cularrp": "⤽",
"cup": "∪",
"cupbrcap": "⩈",
"cupcap": "⩆",
"cupcup": "⩊",
"cupdot": "⊍",
"cupor": "⩅",
"cups": "∪︀",
"curarr": "↷",
"curvearrowright": "↷",
"curarrm": "⤼",
"curlyvee": "⋎",
"cuvee": "⋎",
"curlywedge": "⋏",
"cuwed": "⋏",
"curren": "¤",
"cwint": "∱",
"cylcty": "⌭",
"dHar": "⥥",
"dagger": "†",
"daleth": "ℸ",
"dash": "‐",
"hyphen": "‐",
"dbkarow": "⤏",
"rBarr": "⤏",
"dcaron": "ď",
"dcy": "д",
"ddarr": "⇊",
"downdownarrows": "⇊",
"ddotseq": "⩷",
"eDDot": "⩷",
"deg": "°",
"delta": "δ",
"demptyv": "⦱",
"dfisht": "⥿",
"dfr": "𝔡",
"diamondsuit": "♦",
"diams": "♦",
"digamma": "ϝ",
"gammad": "ϝ",
"disin": "⋲",
"div": "÷",
"divide": "÷",
"divideontimes": "⋇",
"divonx": "⋇",
"djcy": "ђ",
"dlcorn": "⌞",
"llcorner": "⌞",
"dlcrop": "⌍",
"dollar": "$",
"dopf": "𝕕",
"doteqdot": "≑",
"eDot": "≑",
"dotminus": "∸",
"minusd": "∸",
"dotplus": "∔",
"plusdo": "∔",
"dotsquare": "⊡",
"sdotb": "⊡",
"drcorn": "⌟",
"lrcorner": "⌟",
"drcrop": "⌌",
"dscr": "𝒹",
"dscy": "ѕ",
"dsol": "⧶",
"dstrok": "đ",
"dtdot": "⋱",
"dtri": "▿",
"triangledown": "▿",
"dwangle": "⦦",
"dzcy": "џ",
"dzigrarr": "⟿",
"eacute": "é",
"easter": "⩮",
"ecaron": "ě",
"ecir": "≖",
"eqcirc": "≖",
"ecirc": "ê",
"ecolon": "≕",
"eqcolon": "≕",
"ecy": "э",
"edot": "ė",
"efDot": "≒",
"fallingdotseq": "≒",
"efr": "𝔢",
"eg": "⪚",
"egrave": "è",
"egs": "⪖",
"eqslantgtr": "⪖",
"egsdot": "⪘",
"el": "⪙",
"elinters": "⏧",
"ell": "ℓ",
"els": "⪕",
"eqslantless": "⪕",
"elsdot": "⪗",
"emacr": "ē",
"empty": "∅",
"emptyset": "∅",
"emptyv": "∅",
"varnothing": "∅",
"emsp13": " ",
"emsp14": " ",
"emsp": " ",
"eng": "ŋ",
"ensp": " ",
"eogon": "ę",
"eopf": "𝕖",
"epar": "⋕",
"eparsl": "⧣",
"eplus": "⩱",
"epsi": "ε",
"epsilon": "ε",
"epsiv": "ϵ",
"straightepsilon": "ϵ",
"varepsilon": "ϵ",
"equals": "=",
"equest": "≟",
"questeq": "≟",
"equivDD": "⩸",
"eqvparsl": "⧥",
"erDot": "≓",
"risingdotseq": "≓",
"erarr": "⥱",
"escr": "ℯ",
"eta": "η",
"eth": "ð",
"euml": "ë",
"euro": "€",
"excl": "!",
"fcy": "ф",
"female": "♀",
"ffilig": "ffi",
"fflig": "ff",
"ffllig": "ffl",
"ffr": "𝔣",
"filig": "fi",
"fjlig": "fj",
"flat": "♭",
"fllig": "fl",
"fltns": "▱",
"fnof": "ƒ",
"fopf": "𝕗",
"fork": "⋔",
"pitchfork": "⋔",
"forkv": "⫙",
"fpartint": "⨍",
"frac12": "½",
"half": "½",
"frac13": "⅓",
"frac14": "¼",
"frac15": "⅕",
"frac16": "⅙",
"frac18": "⅛",
"frac23": "⅔",
"frac25": "⅖",
"frac34": "¾",
"frac35": "⅗",
"frac38": "⅜",
"frac45": "⅘",
"frac56": "⅚",
"frac58": "⅝",
"frac78": "⅞",
"frasl": "⁄",
"frown": "⌢",
"sfrown": "⌢",
"fscr": "𝒻",
"gEl": "⪌",
"gtreqqless": "⪌",
"gacute": "ǵ",
"gamma": "γ",
"gap": "⪆",
"gtrapprox": "⪆",
"gbreve": "ğ",
"gcirc": "ĝ",
"gcy": "г",
"gdot": "ġ",
"gescc": "⪩",
"gesdot": "⪀",
"gesdoto": "⪂",
"gesdotol": "⪄",
"gesl": "⋛︀",
"gesles": "⪔",
"gfr": "𝔤",
"gimel": "ℷ",
"gjcy": "ѓ",
"glE": "⪒",
"gla": "⪥",
"glj": "⪤",
"gnE": "≩",
"gneqq": "≩",
"gnap": "⪊",
"gnapprox": "⪊",
"gne": "⪈",
"gneq": "⪈",
"gnsim": "⋧",
"gopf": "𝕘",
"gscr": "ℊ",
"gsime": "⪎",
"gsiml": "⪐",
"gtcc": "⪧",
"gtcir": "⩺",
"gtdot": "⋗",
"gtrdot": "⋗",
"gtlPar": "⦕",
"gtquest": "⩼",
"gtrarr": "⥸",
"gvertneqq": "≩︀",
"gvnE": "≩︀",
"hardcy": "ъ",
"harrcir": "⥈",
"harrw": "↭",
"leftrightsquigarrow": "↭",
"hbar": "ℏ",
"hslash": "ℏ",
"planck": "ℏ",
"plankv": "ℏ",
"hcirc": "ĥ",
"hearts": "♥",
"heartsuit": "♥",
"hellip": "…",
"mldr": "…",
"hercon": "⊹",
"hfr": "𝔥",
"hksearow": "⤥",
"searhk": "⤥",
"hkswarow": "⤦",
"swarhk": "⤦",
"hoarr": "⇿",
"homtht": "∻",
"hookleftarrow": "↩",
"larrhk": "↩",
"hookrightarrow": "↪",
"rarrhk": "↪",
"hopf": "𝕙",
"horbar": "―",
"hscr": "𝒽",
"hstrok": "ħ",
"hybull": "⁃",
"iacute": "í",
"icirc": "î",
"icy": "и",
"iecy": "е",
"iexcl": "¡",
"ifr": "𝔦",
"igrave": "ì",
"iiiint": "⨌",
"qint": "⨌",
"iiint": "∭",
"tint": "∭",
"iinfin": "⧜",
"iiota": "℩",
"ijlig": "ij",
"imacr": "ī",
"imath": "ı",
"inodot": "ı",
"imof": "⊷",
"imped": "Ƶ",
"incare": "℅",
"infin": "∞",
"infintie": "⧝",
"intcal": "⊺",
"intercal": "⊺",
"intlarhk": "⨗",
"intprod": "⨼",
"iprod": "⨼",
"iocy": "ё",
"iogon": "į",
"iopf": "𝕚",
"iota": "ι",
"iquest": "¿",
"iscr": "𝒾",
"isinE": "⋹",
"isindot": "⋵",
"isins": "⋴",
"isinsv": "⋳",
"itilde": "ĩ",
"iukcy": "і",
"iuml": "ï",
"jcirc": "ĵ",
"jcy": "й",
"jfr": "𝔧",
"jmath": "ȷ",
"jopf": "𝕛",
"jscr": "𝒿",
"jsercy": "ј",
"jukcy": "є",
"kappa": "κ",
"kappav": "ϰ",
"varkappa": "ϰ",
"kcedil": "ķ",
"kcy": "к",
"kfr": "𝔨",
"kgreen": "ĸ",
"khcy": "х",
"kjcy": "ќ",
"kopf": "𝕜",
"kscr": "𝓀",
"lAtail": "⤛",
"lBarr": "⤎",
"lEg": "⪋",
"lesseqqgtr": "⪋",
"lHar": "⥢",
"lacute": "ĺ",
"laemptyv": "⦴",
"lambda": "λ",
"langd": "⦑",
"lap": "⪅",
"lessapprox": "⪅",
"laquo": "«",
"larrbfs": "⤟",
"larrfs": "⤝",
"larrlp": "↫",
"looparrowleft": "↫",
"larrpl": "⤹",
"larrsim": "⥳",
"larrtl": "↢",
"leftarrowtail": "↢",
"lat": "⪫",
"latail": "⤙",
"late": "⪭",
"lates": "⪭︀",
"lbarr": "⤌",
"lbbrk": "❲",
"lbrace": "{",
"lcub": "{",
"lbrack": "[",
"lsqb": "[",
"lbrke": "⦋",
"lbrksld": "⦏",
"lbrkslu": "⦍",
"lcaron": "ľ",
"lcedil": "ļ",
"lcy": "л",
"ldca": "⤶",
"ldrdhar": "⥧",
"ldrushar": "⥋",
"ldsh": "↲",
"le": "≤",
"leq": "≤",
"leftleftarrows": "⇇",
"llarr": "⇇",
"leftthreetimes": "⋋",
"lthree": "⋋",
"lescc": "⪨",
"lesdot": "⩿",
"lesdoto": "⪁",
"lesdotor": "⪃",
"lesg": "⋚︀",
"lesges": "⪓",
"lessdot": "⋖",
"ltdot": "⋖",
"lfisht": "⥼",
"lfr": "𝔩",
"lgE": "⪑",
"lharul": "⥪",
"lhblk": "▄",
"ljcy": "љ",
"llhard": "⥫",
"lltri": "◺",
"lmidot": "ŀ",
"lmoust": "⎰",
"lmoustache": "⎰",
"lnE": "≨",
"lneqq": "≨",
"lnap": "⪉",
"lnapprox": "⪉",
"lne": "⪇",
"lneq": "⪇",
"lnsim": "⋦",
"loang": "⟬",
"loarr": "⇽",
"longmapsto": "⟼",
"xmap": "⟼",
"looparrowright": "↬",
"rarrlp": "↬",
"lopar": "⦅",
"lopf": "𝕝",
"loplus": "⨭",
"lotimes": "⨴",
"lowast": "∗",
"loz": "◊",
"lozenge": "◊",
"lpar": "(",
"lparlt": "⦓",
"lrhard": "⥭",
"lrm": "‎",
"lrtri": "⊿",
"lsaquo": "‹",
"lscr": "𝓁",
"lsime": "⪍",
"lsimg": "⪏",
"lsquor": "‚",
"sbquo": "‚",
"lstrok": "ł",
"ltcc": "⪦",
"ltcir": "⩹",
"ltimes": "⋉",
"ltlarr": "⥶",
"ltquest": "⩻",
"ltrPar": "⦖",
"ltri": "◃",
"triangleleft": "◃",
"lurdshar": "⥊",
"luruhar": "⥦",
"lvertneqq": "≨︀",
"lvnE": "≨︀",
"mDDot": "∺",
"macr": "¯",
"strns": "¯",
"male": "♂",
"malt": "✠",
"maltese": "✠",
"marker": "▮",
"mcomma": "⨩",
"mcy": "м",
"mdash": "—",
"mfr": "𝔪",
"mho": "℧",
"micro": "µ",
"midcir": "⫰",
"minus": "−",
"minusdu": "⨪",
"mlcp": "⫛",
"models": "⊧",
"mopf": "𝕞",
"mscr": "𝓂",
"mu": "μ",
"multimap": "⊸",
"mumap": "⊸",
"nGg": "⋙̸",
"nGt": "≫⃒",
"nLeftarrow": "⇍",
"nlArr": "⇍",
"nLeftrightarrow": "⇎",
"nhArr": "⇎",
"nLl": "⋘̸",
"nLt": "≪⃒",
"nRightarrow": "⇏",
"nrArr": "⇏",
"nVDash": "⊯",
"nVdash": "⊮",
"nacute": "ń",
"nang": "∠⃒",
"napE": "⩰̸",
"napid": "≋̸",
"napos": "ʼn",
"natur": "♮",
"natural": "♮",
"ncap": "⩃",
"ncaron": "ň",
"ncedil": "ņ",
"ncongdot": "⩭̸",
"ncup": "⩂",
"ncy": "н",
"ndash": "–",
"neArr": "⇗",
"nearhk": "⤤",
"nedot": "≐̸",
"nesear": "⤨",
"toea": "⤨",
"nfr": "𝔫",
"nharr": "↮",
"nleftrightarrow": "↮",
"nhpar": "⫲",
"nis": "⋼",
"nisd": "⋺",
"njcy": "њ",
"nlE": "≦̸",
"nleqq": "≦̸",
"nlarr": "↚",
"nleftarrow": "↚",
"nldr": "‥",
"nopf": "𝕟",
"not": "¬",
"notinE": "⋹̸",
"notindot": "⋵̸",
"notinvb": "⋷",
"notinvc": "⋶",
"notnivb": "⋾",
"notnivc": "⋽",
"nparsl": "⫽⃥",
"npart": "∂̸",
"npolint": "⨔",
"nrarr": "↛",
"nrightarrow": "↛",
"nrarrc": "⤳̸",
"nrarrw": "↝̸",
"nscr": "𝓃",
"nsub": "⊄",
"nsubE": "⫅̸",
"nsubseteqq": "⫅̸",
"nsup": "⊅",
"nsupE": "⫆̸",
"nsupseteqq": "⫆̸",
"ntilde": "ñ",
"nu": "ν",
"num": "#",
"numero": "№",
"numsp": " ",
"nvDash": "⊭",
"nvHarr": "⤄",
"nvap": "≍⃒",
"nvdash": "⊬",
"nvge": "≥⃒",
"nvgt": ">⃒",
"nvinfin": "⧞",
"nvlArr": "⤂",
"nvle": "≤⃒",
"nvlt": "<⃒",
"nvltrie": "⊴⃒",
"nvrArr": "⤃",
"nvrtrie": "⊵⃒",
"nvsim": "∼⃒",
"nwArr": "⇖",
"nwarhk": "⤣",
"nwnear": "⤧",
"oacute": "ó",
"ocirc": "ô",
"ocy": "о",
"odblac": "ő",
"odiv": "⨸",
"odsold": "⦼",
"oelig": "œ",
"ofcir": "⦿",
"ofr": "𝔬",
"ogon": "˛",
"ograve": "ò",
"ogt": "⧁",
"ohbar": "⦵",
"olcir": "⦾",
"olcross": "⦻",
"olt": "⧀",
"omacr": "ō",
"omega": "ω",
"omicron": "ο",
"omid": "⦶",
"oopf": "𝕠",
"opar": "⦷",
"operp": "⦹",
"or": "∨",
"vee": "∨",
"ord": "⩝",
"order": "ℴ",
"orderof": "ℴ",
"oscr": "ℴ",
"ordf": "ª",
"ordm": "º",
"origof": "⊶",
"oror": "⩖",
"orslope": "⩗",
"orv": "⩛",
"oslash": "ø",
"osol": "⊘",
"otilde": "õ",
"otimesas": "⨶",
"ouml": "ö",
"ovbar": "⌽",
"para": "¶",
"parsim": "⫳",
"parsl": "⫽",
"pcy": "п",
"percnt": "%",
"period": ".",
"permil": "‰",
"pertenk": "‱",
"pfr": "𝔭",
"phi": "φ",
"phiv": "ϕ",
"straightphi": "ϕ",
"varphi": "ϕ",
"phone": "☎",
"pi": "π",
"piv": "ϖ",
"varpi": "ϖ",
"planckh": "ℎ",
"plus": "+",
"plusacir": "⨣",
"pluscir": "⨢",
"plusdu": "⨥",
"pluse": "⩲",
"plussim": "⨦",
"plustwo": "⨧",
"pointint": "⨕",
"popf": "𝕡",
"pound": "£",
"prE": "⪳",
"prap": "⪷",
"precapprox": "⪷",
"precnapprox": "⪹",
"prnap": "⪹",
"precneqq": "⪵",
"prnE": "⪵",
"precnsim": "⋨",
"prnsim": "⋨",
"prime": "′",
"profalar": "⌮",
"profline": "⌒",
"profsurf": "⌓",
"prurel": "⊰",
"pscr": "𝓅",
"psi": "ψ",
"puncsp": " ",
"qfr": "𝔮",
"qopf": "𝕢",
"qprime": "⁗",
"qscr": "𝓆",
"quatint": "⨖",
"quest": "?",
"rAtail": "⤜",
"rHar": "⥤",
"race": "∽̱",
"racute": "ŕ",
"raemptyv": "⦳",
"rangd": "⦒",
"range": "⦥",
"raquo": "»",
"rarrap": "⥵",
"rarrbfs": "⤠",
"rarrc": "⤳",
"rarrfs": "⤞",
"rarrpl": "⥅",
"rarrsim": "⥴",
"rarrtl": "↣",
"rightarrowtail": "↣",
"rarrw": "↝",
"rightsquigarrow": "↝",
"ratail": "⤚",
"ratio": "∶",
"rbbrk": "❳",
"rbrace": "}",
"rcub": "}",
"rbrack": "]",
"rsqb": "]",
"rbrke": "⦌",
"rbrksld": "⦎",
"rbrkslu": "⦐",
"rcaron": "ř",
"rcedil": "ŗ",
"rcy": "р",
"rdca": "⤷",
"rdldhar": "⥩",
"rdsh": "↳",
"rect": "▭",
"rfisht": "⥽",
"rfr": "𝔯",
"rharul": "⥬",
"rho": "ρ",
"rhov": "ϱ",
"varrho": "ϱ",
"rightrightarrows": "⇉",
"rrarr": "⇉",
"rightthreetimes": "⋌",
"rthree": "⋌",
"ring": "˚",
"rlm": "‏",
"rmoust": "⎱",
"rmoustache": "⎱",
"rnmid": "⫮",
"roang": "⟭",
"roarr": "⇾",
"ropar": "⦆",
"ropf": "𝕣",
"roplus": "⨮",
"rotimes": "⨵",
"rpar": ")",
"rpargt": "⦔",
"rppolint": "⨒",
"rsaquo": "›",
"rscr": "𝓇",
"rtimes": "⋊",
"rtri": "▹",
"triangleright": "▹",
"rtriltri": "⧎",
"ruluhar": "⥨",
"rx": "℞",
"sacute": "ś",
"scE": "⪴",
"scap": "⪸",
"succapprox": "⪸",
"scaron": "š",
"scedil": "ş",
"scirc": "ŝ",
"scnE": "⪶",
"succneqq": "⪶",
"scnap": "⪺",
"succnapprox": "⪺",
"scnsim": "⋩",
"succnsim": "⋩",
"scpolint": "⨓",
"scy": "с",
"sdot": "⋅",
"sdote": "⩦",
"seArr": "⇘",
"sect": "§",
"semi": ";",
"seswar": "⤩",
"tosa": "⤩",
"sext": "✶",
"sfr": "𝔰",
"sharp": "♯",
"shchcy": "щ",
"shcy": "ш",
"shy": "­",
"sigma": "σ",
"sigmaf": "ς",
"sigmav": "ς",
"varsigma": "ς",
"simdot": "⩪",
"simg": "⪞",
"simgE": "⪠",
"siml": "⪝",
"simlE": "⪟",
"simne": "≆",
"simplus": "⨤",
"simrarr": "⥲",
"smashp": "⨳",
"smeparsl": "⧤",
"smile": "⌣",
"ssmile": "⌣",
"smt": "⪪",
"smte": "⪬",
"smtes": "⪬︀",
"softcy": "ь",
"sol": "/",
"solb": "⧄",
"solbar": "⌿",
"sopf": "𝕤",
"spades": "♠",
"spadesuit": "♠",
"sqcaps": "⊓︀",
"sqcups": "⊔︀",
"sscr": "𝓈",
"star": "☆",
"sub": "⊂",
"subset": "⊂",
"subE": "⫅",
"subseteqq": "⫅",
"subdot": "⪽",
"subedot": "⫃",
"submult": "⫁",
"subnE": "⫋",
"subsetneqq": "⫋",
"subne": "⊊",
"subsetneq": "⊊",
"subplus": "⪿",
"subrarr": "⥹",
"subsim": "⫇",
"subsub": "⫕",
"subsup": "⫓",
"sung": "♪",
"sup1": "¹",
"sup2": "²",
"sup3": "³",
"supE": "⫆",
"supseteqq": "⫆",
"supdot": "⪾",
"supdsub": "⫘",
"supedot": "⫄",
"suphsol": "⟉",
"suphsub": "⫗",
"suplarr": "⥻",
"supmult": "⫂",
"supnE": "⫌",
"supsetneqq": "⫌",
"supne": "⊋",
"supsetneq": "⊋",
"supplus": "⫀",
"supsim": "⫈",
"supsub": "⫔",
"supsup": "⫖",
"swArr": "⇙",
"swnwar": "⤪",
"szlig": "ß",
"target": "⌖",
"tau": "τ",
"tcaron": "ť",
"tcedil": "ţ",
"tcy": "т",
"telrec": "⌕",
"tfr": "𝔱",
"theta": "θ",
"thetasym": "ϑ",
"thetav": "ϑ",
"vartheta": "ϑ",
"thorn": "þ",
"times": "×",
"timesbar": "⨱",
"timesd": "⨰",
"topbot": "⌶",
"topcir": "⫱",
"topf": "𝕥",
"topfork": "⫚",
"tprime": "‴",
"triangle": "▵",
"utri": "▵",
"triangleq": "≜",
"trie": "≜",
"tridot": "◬",
"triminus": "⨺",
"triplus": "⨹",
"trisb": "⧍",
"tritime": "⨻",
"trpezium": "⏢",
"tscr": "𝓉",
"tscy": "ц",
"tshcy": "ћ",
"tstrok": "ŧ",
"uHar": "⥣",
"uacute": "ú",
"ubrcy": "ў",
"ubreve": "ŭ",
"ucirc": "û",
"ucy": "у",
"udblac": "ű",
"ufisht": "⥾",
"ufr": "𝔲",
"ugrave": "ù",
"uhblk": "▀",
"ulcorn": "⌜",
"ulcorner": "⌜",
"ulcrop": "⌏",
"ultri": "◸",
"umacr": "ū",
"uogon": "ų",
"uopf": "𝕦",
"upsi": "υ",
"upsilon": "υ",
"upuparrows": "⇈",
"uuarr": "⇈",
"urcorn": "⌝",
"urcorner": "⌝",
"urcrop": "⌎",
"uring": "ů",
"urtri": "◹",
"uscr": "𝓊",
"utdot": "⋰",
"utilde": "ũ",
"uuml": "ü",
"uwangle": "⦧",
"vBar": "⫨",
"vBarv": "⫩",
"vangrt": "⦜",
"varsubsetneq": "⊊︀",
"vsubne": "⊊︀",
"varsubsetneqq": "⫋︀",
"vsubnE": "⫋︀",
"varsupsetneq": "⊋︀",
"vsupne": "⊋︀",
"varsupsetneqq": "⫌︀",
"vsupnE": "⫌︀",
"vcy": "в",
"veebar": "⊻",
"veeeq": "≚",
"vellip": "⋮",
"vfr": "𝔳",
"vopf": "𝕧",
"vscr": "𝓋",
"vzigzag": "⦚",
"wcirc": "ŵ",
"wedbar": "⩟",
"wedgeq": "≙",
"weierp": "℘",
"wp": "℘",
"wfr": "𝔴",
"wopf": "𝕨",
"wscr": "𝓌",
"xfr": "𝔵",
"xi": "ξ",
"xnis": "⋻",
"xopf": "𝕩",
"xscr": "𝓍",
"yacute": "ý",
"yacy": "я",
"ycirc": "ŷ",
"ycy": "ы",
"yen": "¥",
"yfr": "𝔶",
"yicy": "ї",
"yopf": "𝕪",
"yscr": "𝓎",
"yucy": "ю",
"yuml": "ÿ",
"zacute": "ź",
"zcaron": "ž",
"zcy": "з",
"zdot": "ż",
"zeta": "ζ",
"zfr": "𝔷",
"zhcy": "ж",
"zigrarr": "⇝",
"zopf": "𝕫",
"zscr": "𝓏",
"zwj": "‍",
"zwnj": "‌"
};
const NGSP_UNICODE = "";
NAMED_ENTITIES["ngsp"] = NGSP_UNICODE;
//#endregion
export { NAMED_ENTITIES };
import { getHtmlTagDefinition } from "./html_tags.mjs";
import { Parser } from "./parser.mjs";
//#region ../compiler/src/ml_parser/html_parser.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
var HtmlParser = class extends Parser {
constructor() {
super(getHtmlTagDefinition);
}
parse(source, url, options, isTagNameCaseSensitive = false, getTagContentType) {
return super.parse(source, url, options, isTagNameCaseSensitive, getTagContentType);
}
};
//#endregion
export { HtmlParser };
import { TagContentType, TagDefinition } from "./tags.mjs";
//#region ../compiler/src/ml_parser/html_tags.d.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
declare class HtmlTagDefinition implements TagDefinition {
private closedByChildren;
private contentType;
closedByParent: boolean;
implicitNamespacePrefix: string | null;
isVoid: boolean;
ignoreFirstLf: boolean;
canSelfClose: boolean;
preventNamespaceInheritance: boolean;
constructor({
closedByChildren,
implicitNamespacePrefix,
contentType,
closedByParent,
isVoid,
ignoreFirstLf,
preventNamespaceInheritance,
canSelfClose
}?: {
closedByChildren?: string[];
closedByParent?: boolean;
implicitNamespacePrefix?: string;
contentType?: TagContentType | {
default: TagContentType;
[namespace: string]: TagContentType;
};
isVoid?: boolean;
ignoreFirstLf?: boolean;
preventNamespaceInheritance?: boolean;
canSelfClose?: boolean;
});
isClosedByChild(name: string): boolean;
getContentType(prefix?: string): TagContentType;
}
declare function getHtmlTagDefinition(tagName: string): HtmlTagDefinition;
//#endregion
export { getHtmlTagDefinition };
import { TagContentType, getNsPrefix } from "./tags.mjs";
import { DomElementSchemaRegistry } from "../schema/dom_element_schema_registry.mjs";
//#region ../compiler/src/ml_parser/html_tags.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
var HtmlTagDefinition = class {
constructor({ closedByChildren, implicitNamespacePrefix, contentType = TagContentType.PARSABLE_DATA, closedByParent = false, isVoid = false, ignoreFirstLf = false, preventNamespaceInheritance = false, canSelfClose = false } = {}) {
this.closedByChildren = {};
this.closedByParent = false;
if (closedByChildren && closedByChildren.length > 0) closedByChildren.forEach((tagName) => this.closedByChildren[tagName] = true);
this.isVoid = isVoid;
this.closedByParent = closedByParent || isVoid;
this.implicitNamespacePrefix = implicitNamespacePrefix || null;
this.contentType = contentType;
this.ignoreFirstLf = ignoreFirstLf;
this.preventNamespaceInheritance = preventNamespaceInheritance;
this.canSelfClose = canSelfClose ?? isVoid;
}
isClosedByChild(name) {
return this.isVoid || name.toLowerCase() in this.closedByChildren;
}
getContentType(prefix) {
if (typeof this.contentType === "object") return (prefix === void 0 ? void 0 : this.contentType[prefix]) ?? this.contentType.default;
return this.contentType;
}
};
let DEFAULT_TAG_DEFINITION;
let TAG_DEFINITIONS;
function getHtmlTagDefinition(tagName) {
if (!TAG_DEFINITIONS) {
DEFAULT_TAG_DEFINITION = new HtmlTagDefinition({ canSelfClose: true });
TAG_DEFINITIONS = Object.assign(Object.create(null), {
"base": new HtmlTagDefinition({ isVoid: true }),
"meta": new HtmlTagDefinition({ isVoid: true }),
"area": new HtmlTagDefinition({ isVoid: true }),
"embed": new HtmlTagDefinition({ isVoid: true }),
"link": new HtmlTagDefinition({ isVoid: true }),
"img": new HtmlTagDefinition({ isVoid: true }),
"input": new HtmlTagDefinition({ isVoid: true }),
"param": new HtmlTagDefinition({ isVoid: true }),
"hr": new HtmlTagDefinition({ isVoid: true }),
"br": new HtmlTagDefinition({ isVoid: true }),
"source": new HtmlTagDefinition({ isVoid: true }),
"track": new HtmlTagDefinition({ isVoid: true }),
"wbr": new HtmlTagDefinition({ isVoid: true }),
"p": new HtmlTagDefinition({
closedByChildren: [
"address",
"article",
"aside",
"blockquote",
"div",
"dl",
"fieldset",
"footer",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"header",
"hgroup",
"hr",
"main",
"nav",
"ol",
"p",
"pre",
"section",
"table",
"ul"
],
closedByParent: true
}),
"thead": new HtmlTagDefinition({ closedByChildren: ["tbody", "tfoot"] }),
"tbody": new HtmlTagDefinition({
closedByChildren: ["tbody", "tfoot"],
closedByParent: true
}),
"tfoot": new HtmlTagDefinition({
closedByChildren: ["tbody"],
closedByParent: true
}),
"tr": new HtmlTagDefinition({
closedByChildren: ["tr"],
closedByParent: true
}),
"td": new HtmlTagDefinition({
closedByChildren: ["td", "th"],
closedByParent: true
}),
"th": new HtmlTagDefinition({
closedByChildren: ["td", "th"],
closedByParent: true
}),
"col": new HtmlTagDefinition({ isVoid: true }),
"svg": new HtmlTagDefinition({ implicitNamespacePrefix: "svg" }),
"foreignObject": new HtmlTagDefinition({
implicitNamespacePrefix: "svg",
preventNamespaceInheritance: true
}),
"math": new HtmlTagDefinition({ implicitNamespacePrefix: "math" }),
"li": new HtmlTagDefinition({
closedByChildren: ["li"],
closedByParent: true
}),
"dt": new HtmlTagDefinition({ closedByChildren: ["dt", "dd"] }),
"dd": new HtmlTagDefinition({
closedByChildren: ["dt", "dd"],
closedByParent: true
}),
"rb": new HtmlTagDefinition({
closedByChildren: [
"rb",
"rt",
"rtc",
"rp"
],
closedByParent: true
}),
"rt": new HtmlTagDefinition({
closedByChildren: [
"rb",
"rt",
"rtc",
"rp"
],
closedByParent: true
}),
"rtc": new HtmlTagDefinition({
closedByChildren: [
"rb",
"rtc",
"rp"
],
closedByParent: true
}),
"rp": new HtmlTagDefinition({
closedByChildren: [
"rb",
"rt",
"rtc",
"rp"
],
closedByParent: true
}),
"optgroup": new HtmlTagDefinition({
closedByChildren: ["optgroup"],
closedByParent: true
}),
"option": new HtmlTagDefinition({
closedByChildren: ["option", "optgroup"],
closedByParent: true
}),
"pre": new HtmlTagDefinition({ ignoreFirstLf: true }),
"listing": new HtmlTagDefinition({ ignoreFirstLf: true }),
"style": new HtmlTagDefinition({ contentType: TagContentType.RAW_TEXT }),
"script": new HtmlTagDefinition({ contentType: TagContentType.RAW_TEXT }),
"title": new HtmlTagDefinition({ contentType: {
default: TagContentType.ESCAPABLE_RAW_TEXT,
svg: TagContentType.PARSABLE_DATA
} }),
"textarea": new HtmlTagDefinition({
contentType: TagContentType.ESCAPABLE_RAW_TEXT,
ignoreFirstLf: true
})
});
new DomElementSchemaRegistry().allKnownElementNames().forEach((knownTagName) => {
if (!TAG_DEFINITIONS[knownTagName] && getNsPrefix(knownTagName) === null) TAG_DEFINITIONS[knownTagName] = new HtmlTagDefinition({ canSelfClose: false });
});
}
return TAG_DEFINITIONS[tagName] ?? DEFAULT_TAG_DEFINITION;
}
//#endregion
export { getHtmlTagDefinition };
import { TagContentType, mergeNsAndName } from "./tags.mjs";
import { $$, $0, $9, $A, $AMPERSAND, $AT, $BACKSLASH, $BANG, $BSPACE, $COLON, $COMMA, $CR, $DQ, $EOF, $EQ, $FF, $GT, $HASH, $LBRACE, $LBRACKET, $LF, $LPAREN, $LT, $QUESTION, $RBRACE, $RBRACKET, $RPAREN, $SEMICOLON, $SLASH, $SQ, $TAB, $VTAB, $X, $Z, $_, $a, $b, $f, $n, $r, $t, $u, $v, $x, $z, isAsciiHexDigit, isAsciiLetter, isDigit, isNewLine, isOctalDigit, isQuote, isWhitespace } from "../chars.mjs";
import { ParseError, ParseLocation, ParseSourceFile, ParseSourceSpan } from "../parse_util.mjs";
import { NAMED_ENTITIES } from "./entities.mjs";
import { TokenType } from "./tokens.mjs";
//#region ../compiler/src/ml_parser/lexer.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
var TokenizeResult = class {
constructor(tokens, errors, nonNormalizedIcuExpressions) {
this.tokens = tokens;
this.errors = errors;
this.nonNormalizedIcuExpressions = nonNormalizedIcuExpressions;
}
};
function tokenize(source, url, getTagContentType, options = {}) {
const tokenizer = new _Tokenizer(new ParseSourceFile(source, url), getTagContentType, options);
tokenizer.tokenize();
return new TokenizeResult(mergeTextTokens(tokenizer.tokens), tokenizer.errors, tokenizer.nonNormalizedIcuExpressions);
}
const _CR_OR_CRLF_REGEXP = /\r\n?/g;
function _unexpectedCharacterErrorMsg(charCode) {
return `Unexpected character "${charCode === $EOF ? "EOF" : String.fromCharCode(charCode)}"`;
}
function _unknownEntityErrorMsg(entitySrc) {
return `Unknown entity "${entitySrc}" - use the "&#<decimal>;" or "&#x<hex>;" syntax`;
}
function _unparsableEntityErrorMsg(type, entityStr) {
return `Unable to parse entity "${entityStr}" - ${type} character reference entities must end with ";"`;
}
var CharacterReferenceType = /* @__PURE__ */ function(CharacterReferenceType$1) {
CharacterReferenceType$1["HEX"] = "hexadecimal";
CharacterReferenceType$1["DEC"] = "decimal";
return CharacterReferenceType$1;
}(CharacterReferenceType || {});
const SUPPORTED_BLOCKS = [
"@if",
"@else",
"@for",
"@switch",
"@case",
"@default",
"@empty",
"@defer",
"@placeholder",
"@loading",
"@error"
];
const INTERPOLATION = {
start: "{{",
end: "}}"
};
var _Tokenizer = class {
/**
* @param _file The html source file being tokenized.
* @param _getTagContentType A function that will retrieve a tag content type for a given tag
* name.
* @param options Configuration of the tokenization.
*/
constructor(_file, _getTagContentType, options) {
this._getTagContentType = _getTagContentType;
this._currentTokenStart = null;
this._currentTokenType = null;
this._expansionCaseStack = [];
this._openDirectiveCount = 0;
this._inInterpolation = false;
this._fullNameStack = [];
this.tokens = [];
this.errors = [];
this.nonNormalizedIcuExpressions = [];
this._tokenizeIcu = options.tokenizeExpansionForms || false;
this._leadingTriviaCodePoints = options.leadingTriviaChars && options.leadingTriviaChars.map((c) => c.codePointAt(0) || 0);
this._canSelfClose = options.canSelfClose || false;
this._allowHtmComponentClosingTags = options.allowHtmComponentClosingTags || false;
const range = options.range || {
endPos: _file.content.length,
startPos: 0,
startLine: 0,
startCol: 0
};
this._cursor = options.escapedString ? new EscapedCharacterCursor(_file, range) : new PlainCharacterCursor(_file, range);
this._preserveLineEndings = options.preserveLineEndings || false;
this._i18nNormalizeLineEndingsInICUs = options.i18nNormalizeLineEndingsInICUs || false;
this._tokenizeBlocks = options.tokenizeBlocks ?? true;
this._tokenizeLet = options.tokenizeLet ?? true;
this._selectorlessEnabled = options.selectorlessEnabled ?? false;
try {
this._cursor.init();
} catch (e) {
this.handleError(e);
}
}
_processCarriageReturns(content) {
if (this._preserveLineEndings) return content;
return content.replace(_CR_OR_CRLF_REGEXP, "\n");
}
tokenize() {
while (this._cursor.peek() !== $EOF) {
const start = this._cursor.clone();
try {
if (this._attemptCharCode($LT)) if (this._attemptCharCode($BANG)) if (this._attemptStr("[CDATA[")) this._consumeCdata(start);
else if (this._attemptStr("--")) this._consumeComment(start);
else if (this._attemptStrCaseInsensitive("doctype")) this._consumeDocType(start);
else this._consumeBogusComment(start);
else if (this._attemptCharCode($SLASH)) this._consumeTagClose(start);
else {
const savedPos = this._cursor.clone();
if (this._attemptCharCode($QUESTION)) {
this._cursor = savedPos;
this._consumeBogusComment(start);
} else this._consumeTagOpen(start);
}
else if (this._tokenizeLet && this._cursor.peek() === $AT && !this._inInterpolation && this._isLetStart()) this._consumeLetDeclaration(start);
else if (this._tokenizeBlocks && this._isBlockStart()) this._consumeBlockStart(start);
else if (this._tokenizeBlocks && !this._inInterpolation && !this._isInExpansionCase() && !this._isInExpansionForm() && this._attemptCharCode($RBRACE)) this._consumeBlockEnd(start);
else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) this._consumeWithInterpolation(TokenType.TEXT, TokenType.INTERPOLATION, () => this._isTextEnd(), () => this._isTagStart());
} catch (e) {
this.handleError(e);
}
}
this._beginToken(TokenType.EOF);
this._endToken([]);
}
_getBlockName() {
let spacesInNameAllowed = false;
const nameCursor = this._cursor.clone();
this._attemptCharCodeUntilFn((code) => {
if (isWhitespace(code)) return !spacesInNameAllowed;
if (isBlockNameChar(code)) {
spacesInNameAllowed = true;
return false;
}
return true;
});
return this._cursor.getChars(nameCursor).trim();
}
_consumeBlockStart(start) {
this._requireCharCode($AT);
this._beginToken(TokenType.BLOCK_OPEN_START, start);
const startToken = this._endToken([this._getBlockName()]);
if (this._cursor.peek() === $LPAREN) {
this._cursor.advance();
this._consumeBlockParameters();
this._attemptCharCodeUntilFn(isNotWhitespace);
if (this._attemptCharCode($RPAREN)) this._attemptCharCodeUntilFn(isNotWhitespace);
else {
startToken.type = TokenType.INCOMPLETE_BLOCK_OPEN;
return;
}
}
if (this._attemptCharCode($LBRACE)) {
this._beginToken(TokenType.BLOCK_OPEN_END);
this._endToken([]);
} else startToken.type = TokenType.INCOMPLETE_BLOCK_OPEN;
}
_consumeBlockEnd(start) {
this._beginToken(TokenType.BLOCK_CLOSE, start);
this._endToken([]);
}
_consumeBlockParameters() {
this._attemptCharCodeUntilFn(isBlockParameterChar);
while (this._cursor.peek() !== $RPAREN && this._cursor.peek() !== $EOF) {
this._beginToken(TokenType.BLOCK_PARAMETER);
const start = this._cursor.clone();
let inQuote = null;
let openParens = 0;
while (this._cursor.peek() !== $SEMICOLON && this._cursor.peek() !== $EOF || inQuote !== null) {
const char = this._cursor.peek();
if (char === $BACKSLASH) this._cursor.advance();
else if (char === inQuote) inQuote = null;
else if (inQuote === null && isQuote(char)) inQuote = char;
else if (char === $LPAREN && inQuote === null) openParens++;
else if (char === $RPAREN && inQuote === null) {
if (openParens === 0) break;
else if (openParens > 0) openParens--;
}
this._cursor.advance();
}
this._endToken([this._cursor.getChars(start)]);
this._attemptCharCodeUntilFn(isBlockParameterChar);
}
}
_consumeLetDeclaration(start) {
this._requireStr("@let");
this._beginToken(TokenType.LET_START, start);
if (isWhitespace(this._cursor.peek())) this._attemptCharCodeUntilFn(isNotWhitespace);
else {
const token = this._endToken([this._cursor.getChars(start)]);
token.type = TokenType.INCOMPLETE_LET;
return;
}
const startToken = this._endToken([this._getLetDeclarationName()]);
this._attemptCharCodeUntilFn(isNotWhitespace);
if (!this._attemptCharCode($EQ)) {
startToken.type = TokenType.INCOMPLETE_LET;
return;
}
this._attemptCharCodeUntilFn((code) => isNotWhitespace(code) && !isNewLine(code));
this._consumeLetDeclarationValue();
if (this._cursor.peek() === $SEMICOLON) {
this._beginToken(TokenType.LET_END);
this._endToken([]);
this._cursor.advance();
} else {
startToken.type = TokenType.INCOMPLETE_LET;
startToken.sourceSpan = this._cursor.getSpan(start);
}
}
_getLetDeclarationName() {
const nameCursor = this._cursor.clone();
let allowDigit = false;
this._attemptCharCodeUntilFn((code) => {
if (isAsciiLetter(code) || code === $$ || code === $_ || allowDigit && isDigit(code)) {
allowDigit = true;
return false;
}
return true;
});
return this._cursor.getChars(nameCursor).trim();
}
_consumeLetDeclarationValue() {
const start = this._cursor.clone();
this._beginToken(TokenType.LET_VALUE, start);
while (this._cursor.peek() !== $EOF) {
const char = this._cursor.peek();
if (char === $SEMICOLON) break;
if (isQuote(char)) {
this._cursor.advance();
this._attemptCharCodeUntilFn((inner) => {
if (inner === $BACKSLASH) {
this._cursor.advance();
return false;
}
return inner === char;
});
}
this._cursor.advance();
}
this._endToken([this._cursor.getChars(start)]);
}
/**
* @returns whether an ICU token has been created
* @internal
*/
_tokenizeExpansionForm() {
if (this.isExpansionFormStart()) {
this._consumeExpansionFormStart();
return true;
}
if (isExpansionCaseStart(this._cursor.peek()) && this._isInExpansionForm()) {
this._consumeExpansionCaseStart();
return true;
}
if (this._cursor.peek() === $RBRACE) {
if (this._isInExpansionCase()) {
this._consumeExpansionCaseEnd();
return true;
}
if (this._isInExpansionForm()) {
this._consumeExpansionFormEnd();
return true;
}
}
return false;
}
_beginToken(type, start = this._cursor.clone()) {
this._currentTokenStart = start;
this._currentTokenType = type;
}
_endToken(parts, end) {
if (this._currentTokenStart === null) throw new ParseError(this._cursor.getSpan(end), "Programming error - attempted to end a token when there was no start to the token");
if (this._currentTokenType === null) throw new ParseError(this._cursor.getSpan(this._currentTokenStart), "Programming error - attempted to end a token which has no token type");
const token = {
type: this._currentTokenType,
parts,
sourceSpan: (end ?? this._cursor).getSpan(this._currentTokenStart, this._leadingTriviaCodePoints)
};
this.tokens.push(token);
this._currentTokenStart = null;
this._currentTokenType = null;
return token;
}
_createError(msg, span) {
if (this._isInExpansionForm()) msg += ` (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.)`;
const error = new ParseError(span, msg);
this._currentTokenStart = null;
this._currentTokenType = null;
return error;
}
handleError(e) {
if (e instanceof CursorError) e = this._createError(e.msg, this._cursor.getSpan(e.cursor));
if (e instanceof ParseError) this.errors.push(e);
else throw e;
}
_attemptCharCode(charCode) {
if (this._cursor.peek() === charCode) {
this._cursor.advance();
return true;
}
return false;
}
_attemptCharCodeCaseInsensitive(charCode) {
if (compareCharCodeCaseInsensitive(this._cursor.peek(), charCode)) {
this._cursor.advance();
return true;
}
return false;
}
_requireCharCode(charCode) {
const location = this._cursor.clone();
if (!this._attemptCharCode(charCode)) throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(location));
}
_attemptStr(chars) {
const len = chars.length;
if (this._cursor.charsLeft() < len) return false;
const initialPosition = this._cursor.clone();
for (let i = 0; i < len; i++) if (!this._attemptCharCode(chars.charCodeAt(i))) {
this._cursor = initialPosition;
return false;
}
return true;
}
_attemptStrCaseInsensitive(chars) {
for (let i = 0; i < chars.length; i++) if (!this._attemptCharCodeCaseInsensitive(chars.charCodeAt(i))) return false;
return true;
}
_requireStr(chars) {
const location = this._cursor.clone();
if (!this._attemptStr(chars)) throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(location));
}
_requireStrCaseInsensitive(chars) {
const location = this._cursor.clone();
if (!this._attemptStrCaseInsensitive(chars)) throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(location));
}
_attemptCharCodeUntilFn(predicate) {
while (!predicate(this._cursor.peek())) this._cursor.advance();
}
_requireCharCodeUntilFn(predicate, len) {
const start = this._cursor.clone();
this._attemptCharCodeUntilFn(predicate);
if (this._cursor.diff(start) < len) throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(start));
}
_attemptUntilChar(char) {
while (this._cursor.peek() !== char) this._cursor.advance();
}
_readChar() {
const char = String.fromCodePoint(this._cursor.peek());
this._cursor.advance();
return char;
}
_peekStr(chars) {
const len = chars.length;
if (this._cursor.charsLeft() < len) return false;
const cursor = this._cursor.clone();
for (let i = 0; i < len; i++) {
if (cursor.peek() !== chars.charCodeAt(i)) return false;
cursor.advance();
}
return true;
}
_isBlockStart() {
return this._cursor.peek() === $AT && SUPPORTED_BLOCKS.some((blockName) => this._peekStr(blockName));
}
_isLetStart() {
return this._cursor.peek() === $AT && this._peekStr("@let");
}
_consumeEntity(textTokenType) {
this._beginToken(TokenType.ENCODED_ENTITY);
const start = this._cursor.clone();
this._cursor.advance();
if (this._attemptCharCode($HASH)) {
const isHex = this._attemptCharCode($x) || this._attemptCharCode($X);
const codeStart = this._cursor.clone();
this._attemptCharCodeUntilFn(isDigitEntityEnd);
if (this._cursor.peek() != $SEMICOLON) {
this._cursor.advance();
const entityType = isHex ? CharacterReferenceType.HEX : CharacterReferenceType.DEC;
throw this._createError(_unparsableEntityErrorMsg(entityType, this._cursor.getChars(start)), this._cursor.getSpan());
}
const strNum = this._cursor.getChars(codeStart);
this._cursor.advance();
try {
const charCode = parseInt(strNum, isHex ? 16 : 10);
this._endToken([String.fromCodePoint(charCode), this._cursor.getChars(start)]);
} catch {
throw this._createError(_unknownEntityErrorMsg(this._cursor.getChars(start)), this._cursor.getSpan());
}
} else {
const nameStart = this._cursor.clone();
this._attemptCharCodeUntilFn(isNamedEntityEnd);
if (this._cursor.peek() != $SEMICOLON) {
this._beginToken(textTokenType, start);
this._cursor = nameStart;
this._endToken(["&"]);
} else {
const name = this._cursor.getChars(nameStart);
this._cursor.advance();
const char = NAMED_ENTITIES.hasOwnProperty(name) && NAMED_ENTITIES[name];
if (!char) throw this._createError(_unknownEntityErrorMsg(name), this._cursor.getSpan(start));
this._endToken([char, `&${name};`]);
}
}
}
_consumeRawText(consumeEntities, endMarkerPredicate) {
this._beginToken(consumeEntities ? TokenType.ESCAPABLE_RAW_TEXT : TokenType.RAW_TEXT);
const parts = [];
while (true) {
const tagCloseStart = this._cursor.clone();
const foundEndMarker = endMarkerPredicate();
this._cursor = tagCloseStart;
if (foundEndMarker) break;
if (consumeEntities && this._cursor.peek() === $AMPERSAND) {
this._endToken([this._processCarriageReturns(parts.join(""))]);
parts.length = 0;
this._consumeEntity(TokenType.ESCAPABLE_RAW_TEXT);
this._beginToken(TokenType.ESCAPABLE_RAW_TEXT);
} else parts.push(this._readChar());
}
this._endToken([this._processCarriageReturns(parts.join(""))]);
}
_consumeComment(start) {
this._beginToken(TokenType.COMMENT_START, start);
this._endToken([]);
this._consumeRawText(false, () => this._attemptStr("-->"));
this._beginToken(TokenType.COMMENT_END);
this._requireStr("-->");
this._endToken([]);
}
_consumeBogusComment(start) {
this._beginToken(TokenType.COMMENT_START, start);
this._endToken([]);
this._consumeRawText(false, () => this._cursor.peek() === $GT);
this._beginToken(TokenType.COMMENT_END);
this._cursor.advance();
this._endToken([]);
}
_consumeCdata(start) {
this._beginToken(TokenType.CDATA_START, start);
this._endToken([]);
this._consumeRawText(false, () => this._attemptStr("]]>"));
this._beginToken(TokenType.CDATA_END);
this._requireStr("]]>");
this._endToken([]);
}
_consumeDocType(start) {
this._beginToken(TokenType.DOC_TYPE_START, start);
this._endToken([]);
this._consumeRawText(false, () => this._cursor.peek() === $GT);
this._beginToken(TokenType.DOC_TYPE_END);
this._cursor.advance();
this._endToken([]);
}
_consumePrefixAndName(endPredicate) {
const nameOrPrefixStart = this._cursor.clone();
let prefix = "";
while (this._cursor.peek() !== $COLON && !isPrefixEnd(this._cursor.peek())) this._cursor.advance();
let nameStart;
if (this._cursor.peek() === $COLON) {
prefix = this._cursor.getChars(nameOrPrefixStart);
this._cursor.advance();
nameStart = this._cursor.clone();
} else nameStart = nameOrPrefixStart;
this._requireCharCodeUntilFn(endPredicate, prefix === "" ? 0 : 1);
const name = this._cursor.getChars(nameStart);
return [prefix, name];
}
_consumeTagOpen(start) {
let tagName;
let prefix;
let closingTagName;
let openToken;
const attrs = [];
try {
if (this._selectorlessEnabled && isSelectorlessNameStart(this._cursor.peek())) {
openToken = this._consumeComponentOpenStart(start);
[closingTagName, prefix, tagName] = openToken.parts;
if (prefix) closingTagName += `:${prefix}`;
if (tagName) closingTagName += `:${tagName}`;
this._attemptCharCodeUntilFn(isNotWhitespace);
} else {
if (!isAsciiLetter(this._cursor.peek())) throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(start));
openToken = this._consumeTagOpenStart(start);
prefix = openToken.parts[0];
tagName = closingTagName = openToken.parts[1];
this._attemptCharCodeUntilFn(isNotWhitespace);
}
while (!isAttributeTerminator(this._cursor.peek())) if (this._selectorlessEnabled && this._cursor.peek() === $AT) {
const start$1 = this._cursor.clone();
const nameStart = start$1.clone();
nameStart.advance();
if (isSelectorlessNameStart(nameStart.peek())) this._consumeDirective(start$1, nameStart);
} else {
const attr = this._consumeAttribute();
attrs.push(attr);
}
if (openToken.type === TokenType.COMPONENT_OPEN_START) this._consumeComponentOpenEnd();
else this._consumeTagOpenEnd();
} catch (e) {
if (e instanceof ParseError) {
if (openToken) openToken.type = openToken.type === TokenType.COMPONENT_OPEN_START ? TokenType.INCOMPLETE_COMPONENT_OPEN : TokenType.INCOMPLETE_TAG_OPEN;
else {
this._beginToken(TokenType.TEXT, start);
this._endToken(["<"]);
}
return;
}
throw e;
}
if (this._canSelfClose && this.tokens[this.tokens.length - 1].type === TokenType.TAG_OPEN_END_VOID) return;
const contentTokenType = this._getTagContentType(tagName, prefix, this._fullNameStack.length > 0, attrs);
this._handleFullNameStackForTagOpen(prefix, tagName);
if (contentTokenType === TagContentType.RAW_TEXT) this._consumeRawTextWithTagClose(prefix, openToken, closingTagName, false);
else if (contentTokenType === TagContentType.ESCAPABLE_RAW_TEXT) this._consumeRawTextWithTagClose(prefix, openToken, closingTagName, true);
}
_consumeRawTextWithTagClose(prefix, openToken, tagName, consumeEntities) {
this._consumeRawText(consumeEntities, () => {
if (!this._attemptCharCode($LT)) return false;
if (!this._attemptCharCode($SLASH)) return false;
this._attemptCharCodeUntilFn(isNotWhitespace);
if (!this._attemptStrCaseInsensitive(prefix && openToken.type !== TokenType.COMPONENT_OPEN_START ? `${prefix}:${tagName}` : tagName)) return false;
this._attemptCharCodeUntilFn(isNotWhitespace);
return this._attemptCharCode($GT);
});
this._beginToken(openToken.type === TokenType.COMPONENT_OPEN_START ? TokenType.COMPONENT_CLOSE : TokenType.TAG_CLOSE);
this._requireCharCodeUntilFn((code) => code === $GT, 3);
this._cursor.advance();
this._endToken(openToken.parts);
this._handleFullNameStackForTagClose(prefix, tagName);
}
_consumeTagOpenStart(start) {
this._beginToken(TokenType.TAG_OPEN_START, start);
const parts = this._consumePrefixAndName(isNameEnd);
return this._endToken(parts);
}
_consumeComponentOpenStart(start) {
this._beginToken(TokenType.COMPONENT_OPEN_START, start);
const parts = this._consumeComponentName();
return this._endToken(parts);
}
_consumeComponentName() {
const nameStart = this._cursor.clone();
while (isSelectorlessNameChar(this._cursor.peek())) this._cursor.advance();
const name = this._cursor.getChars(nameStart);
let prefix = "";
let tagName = "";
if (this._cursor.peek() === $COLON) {
this._cursor.advance();
[prefix, tagName] = this._consumePrefixAndName(isNameEnd);
}
return [
name,
prefix,
tagName
];
}
_consumeAttribute() {
const [prefix, name] = this._consumeAttributeName();
let value;
this._attemptCharCodeUntilFn(isNotWhitespace);
if (this._attemptCharCode($EQ)) {
this._attemptCharCodeUntilFn(isNotWhitespace);
value = this._consumeAttributeValue();
}
this._attemptCharCodeUntilFn(isNotWhitespace);
return {
prefix,
name,
value
};
}
_consumeAttributeName() {
const attrNameStart = this._cursor.peek();
if (attrNameStart === $SQ || attrNameStart === $DQ) throw this._createError(_unexpectedCharacterErrorMsg(attrNameStart), this._cursor.getSpan());
this._beginToken(TokenType.ATTR_NAME);
let nameEndPredicate;
if (this._openDirectiveCount > 0) {
let openParens = 0;
nameEndPredicate = (code) => {
if (this._openDirectiveCount > 0) {
if (code === $LPAREN) openParens++;
else if (code === $RPAREN) {
if (openParens === 0) return true;
openParens--;
}
}
return isNameEnd(code);
};
} else if (attrNameStart === $LBRACKET) {
let openBrackets = 0;
nameEndPredicate = (code) => {
if (code === $LBRACKET) openBrackets++;
else if (code === $RBRACKET) openBrackets--;
return openBrackets <= 0 ? isNameEnd(code) : isNewLine(code);
};
} else nameEndPredicate = isNameEnd;
const prefixAndName = this._consumePrefixAndName(nameEndPredicate);
this._endToken(prefixAndName);
return prefixAndName;
}
_consumeAttributeValue() {
let value;
if (this._cursor.peek() === $SQ || this._cursor.peek() === $DQ) {
const quoteChar = this._cursor.peek();
this._consumeQuote(quoteChar);
const endPredicate = () => this._cursor.peek() === quoteChar;
value = this._consumeWithInterpolation(TokenType.ATTR_VALUE_TEXT, TokenType.ATTR_VALUE_INTERPOLATION, endPredicate, endPredicate);
this._consumeQuote(quoteChar);
} else {
const endPredicate = () => isNameEnd(this._cursor.peek());
value = this._consumeWithInterpolation(TokenType.ATTR_VALUE_TEXT, TokenType.ATTR_VALUE_INTERPOLATION, endPredicate, endPredicate);
}
return value;
}
_consumeQuote(quoteChar) {
this._beginToken(TokenType.ATTR_QUOTE);
this._requireCharCode(quoteChar);
this._endToken([String.fromCodePoint(quoteChar)]);
}
_consumeTagOpenEnd() {
const tokenType = this._attemptCharCode($SLASH) ? TokenType.TAG_OPEN_END_VOID : TokenType.TAG_OPEN_END;
this._beginToken(tokenType);
this._requireCharCode($GT);
this._endToken([]);
}
_consumeComponentOpenEnd() {
const tokenType = this._attemptCharCode($SLASH) ? TokenType.COMPONENT_OPEN_END_VOID : TokenType.COMPONENT_OPEN_END;
this._beginToken(tokenType);
this._requireCharCode($GT);
this._endToken([]);
}
_consumeTagClose(start) {
if (this._selectorlessEnabled) {
const clone = start.clone();
while (clone.peek() !== $GT && !isSelectorlessNameStart(clone.peek())) clone.advance();
if (isSelectorlessNameStart(clone.peek())) {
this._beginToken(TokenType.COMPONENT_CLOSE, start);
const parts = this._consumeComponentName();
this._attemptCharCodeUntilFn(isNotWhitespace);
this._requireCharCode($GT);
this._endToken(parts);
return;
}
}
this._beginToken(TokenType.TAG_CLOSE, start);
this._attemptCharCodeUntilFn(isNotWhitespace);
if (this._allowHtmComponentClosingTags && this._attemptCharCode($SLASH)) {
this._attemptCharCodeUntilFn(isNotWhitespace);
this._requireCharCode($GT);
this._endToken([]);
} else {
const [prefix, name] = this._consumePrefixAndName(isNameEnd);
this._attemptCharCodeUntilFn(isNotWhitespace);
this._requireCharCode($GT);
this._endToken([prefix, name]);
this._handleFullNameStackForTagClose(prefix, name);
}
}
_consumeExpansionFormStart() {
this._beginToken(TokenType.EXPANSION_FORM_START);
this._requireCharCode($LBRACE);
this._endToken([]);
this._expansionCaseStack.push(TokenType.EXPANSION_FORM_START);
this._beginToken(TokenType.RAW_TEXT);
const condition = this._readUntil($COMMA);
const normalizedCondition = this._processCarriageReturns(condition);
if (this._i18nNormalizeLineEndingsInICUs) this._endToken([normalizedCondition]);
else {
const conditionToken = this._endToken([condition]);
if (normalizedCondition !== condition) this.nonNormalizedIcuExpressions.push(conditionToken);
}
this._requireCharCode($COMMA);
this._attemptCharCodeUntilFn(isNotWhitespace);
this._beginToken(TokenType.RAW_TEXT);
const type = this._readUntil($COMMA);
this._endToken([type]);
this._requireCharCode($COMMA);
this._attemptCharCodeUntilFn(isNotWhitespace);
}
_consumeExpansionCaseStart() {
this._beginToken(TokenType.EXPANSION_CASE_VALUE);
const value = this._readUntil($LBRACE).trim();
this._endToken([value]);
this._attemptCharCodeUntilFn(isNotWhitespace);
this._beginToken(TokenType.EXPANSION_CASE_EXP_START);
this._requireCharCode($LBRACE);
this._endToken([]);
this._attemptCharCodeUntilFn(isNotWhitespace);
this._expansionCaseStack.push(TokenType.EXPANSION_CASE_EXP_START);
}
_consumeExpansionCaseEnd() {
this._beginToken(TokenType.EXPANSION_CASE_EXP_END);
this._requireCharCode($RBRACE);
this._endToken([]);
this._attemptCharCodeUntilFn(isNotWhitespace);
this._expansionCaseStack.pop();
}
_consumeExpansionFormEnd() {
this._beginToken(TokenType.EXPANSION_FORM_END);
this._requireCharCode($RBRACE);
this._endToken([]);
this._expansionCaseStack.pop();
}
/**
* Consume a string that may contain interpolation expressions.
*
* The first token consumed will be of `tokenType` and then there will be alternating
* `interpolationTokenType` and `tokenType` tokens until the `endPredicate()` returns true.
*
* If an interpolation token ends prematurely it will have no end marker in its `parts` array.
*
* @param textTokenType the kind of tokens to interleave around interpolation tokens.
* @param interpolationTokenType the kind of tokens that contain interpolation.
* @param endPredicate a function that should return true when we should stop consuming.
* @param endInterpolation a function that should return true if there is a premature end to an
* interpolation expression - i.e. before we get to the normal interpolation closing marker.
*/
_consumeWithInterpolation(textTokenType, interpolationTokenType, endPredicate, endInterpolation) {
this._beginToken(textTokenType);
const parts = [];
while (!endPredicate()) {
const current = this._cursor.clone();
if (this._attemptStr(INTERPOLATION.start)) {
this._endToken([this._processCarriageReturns(parts.join(""))], current);
parts.length = 0;
this._consumeInterpolation(interpolationTokenType, current, endInterpolation);
this._beginToken(textTokenType);
} else if (this._cursor.peek() === $AMPERSAND) {
this._endToken([this._processCarriageReturns(parts.join(""))]);
parts.length = 0;
this._consumeEntity(textTokenType);
this._beginToken(textTokenType);
} else parts.push(this._readChar());
}
this._inInterpolation = false;
const value = this._processCarriageReturns(parts.join(""));
this._endToken([value]);
return value;
}
/**
* Consume a block of text that has been interpreted as an Angular interpolation.
*
* @param interpolationTokenType the type of the interpolation token to generate.
* @param interpolationStart a cursor that points to the start of this interpolation.
* @param prematureEndPredicate a function that should return true if the next characters indicate
* an end to the interpolation before its normal closing marker.
*/
_consumeInterpolation(interpolationTokenType, interpolationStart, prematureEndPredicate) {
const parts = [];
this._beginToken(interpolationTokenType, interpolationStart);
parts.push(INTERPOLATION.start);
const expressionStart = this._cursor.clone();
let inQuote = null;
let inComment = false;
while (this._cursor.peek() !== $EOF && (prematureEndPredicate === null || !prematureEndPredicate())) {
const current = this._cursor.clone();
if (this._isTagStart()) {
this._cursor = current;
parts.push(this._getProcessedChars(expressionStart, current));
this._endToken(parts);
return;
}
if (inQuote === null) {
if (this._attemptStr(INTERPOLATION.end)) {
parts.push(this._getProcessedChars(expressionStart, current));
parts.push(INTERPOLATION.end);
this._endToken(parts);
return;
} else if (this._attemptStr("//")) inComment = true;
}
const char = this._cursor.peek();
this._cursor.advance();
if (char === $BACKSLASH) this._cursor.advance();
else if (char === inQuote) inQuote = null;
else if (!inComment && inQuote === null && isQuote(char)) inQuote = char;
}
parts.push(this._getProcessedChars(expressionStart, this._cursor));
this._endToken(parts);
}
_consumeDirective(start, nameStart) {
this._requireCharCode($AT);
this._cursor.advance();
while (isSelectorlessNameChar(this._cursor.peek())) this._cursor.advance();
this._beginToken(TokenType.DIRECTIVE_NAME, start);
const name = this._cursor.getChars(nameStart);
this._endToken([name]);
this._attemptCharCodeUntilFn(isNotWhitespace);
if (this._cursor.peek() !== $LPAREN) return;
this._openDirectiveCount++;
this._beginToken(TokenType.DIRECTIVE_OPEN);
this._cursor.advance();
this._endToken([]);
this._attemptCharCodeUntilFn(isNotWhitespace);
while (!isAttributeTerminator(this._cursor.peek()) && this._cursor.peek() !== $RPAREN) this._consumeAttribute();
this._attemptCharCodeUntilFn(isNotWhitespace);
this._openDirectiveCount--;
if (this._cursor.peek() !== $RPAREN) {
if (this._cursor.peek() === $GT || this._cursor.peek() === $SLASH) return;
throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(start));
}
this._beginToken(TokenType.DIRECTIVE_CLOSE);
this._cursor.advance();
this._endToken([]);
this._attemptCharCodeUntilFn(isNotWhitespace);
}
_getProcessedChars(start, end) {
return this._processCarriageReturns(end.getChars(start));
}
_isTextEnd() {
if (this._isTagStart() || this._cursor.peek() === $EOF) return true;
if (this._tokenizeIcu && !this._inInterpolation) {
if (this.isExpansionFormStart()) return true;
if (this._cursor.peek() === $RBRACE && this._isInExpansionCase()) return true;
}
if (this._tokenizeBlocks && !this._inInterpolation && !this._isInExpansion() && (this._isBlockStart() || this._isLetStart() || this._cursor.peek() === $RBRACE)) return true;
return false;
}
/**
* Returns true if the current cursor is pointing to the start of a tag
* (opening/closing/comments/cdata/etc).
*/
_isTagStart() {
if (this._cursor.peek() === $LT) {
const tmp = this._cursor.clone();
tmp.advance();
const code = tmp.peek();
if ($a <= code && code <= $z || $A <= code && code <= $Z || code === $SLASH || code === $BANG) return true;
}
return false;
}
_readUntil(char) {
const start = this._cursor.clone();
this._attemptUntilChar(char);
return this._cursor.getChars(start);
}
_isInExpansion() {
return this._isInExpansionCase() || this._isInExpansionForm();
}
_isInExpansionCase() {
return this._expansionCaseStack.length > 0 && this._expansionCaseStack[this._expansionCaseStack.length - 1] === TokenType.EXPANSION_CASE_EXP_START;
}
_isInExpansionForm() {
return this._expansionCaseStack.length > 0 && this._expansionCaseStack[this._expansionCaseStack.length - 1] === TokenType.EXPANSION_FORM_START;
}
isExpansionFormStart() {
if (this._cursor.peek() !== $LBRACE) return false;
const start = this._cursor.clone();
const isInterpolation = this._attemptStr(INTERPOLATION.start);
this._cursor = start;
return !isInterpolation;
}
_handleFullNameStackForTagOpen(prefix, tagName) {
const fullName = mergeNsAndName(prefix, tagName);
if (this._fullNameStack.length === 0 || this._fullNameStack[this._fullNameStack.length - 1] === fullName) this._fullNameStack.push(fullName);
}
_handleFullNameStackForTagClose(prefix, tagName) {
const fullName = mergeNsAndName(prefix, tagName);
if (this._fullNameStack.length !== 0 && this._fullNameStack[this._fullNameStack.length - 1] === fullName) this._fullNameStack.pop();
}
};
function isNotWhitespace(code) {
return !isWhitespace(code) || code === $EOF;
}
function isNameEnd(code) {
return isWhitespace(code) || code === $GT || code === $LT || code === $SLASH || code === $SQ || code === $DQ || code === $EQ || code === $EOF;
}
function isPrefixEnd(code) {
return (code < $a || $z < code) && (code < $A || $Z < code) && (code < $0 || code > $9);
}
function isDigitEntityEnd(code) {
return code === $SEMICOLON || code === $EOF || !isAsciiHexDigit(code);
}
function isNamedEntityEnd(code) {
return code === $SEMICOLON || code === $EOF || !isAsciiLetter(code);
}
function isExpansionCaseStart(peek) {
return peek !== $RBRACE;
}
function compareCharCodeCaseInsensitive(code1, code2) {
return toUpperCaseCharCode(code1) === toUpperCaseCharCode(code2);
}
function toUpperCaseCharCode(code) {
return code >= $a && code <= $z ? code - $a + $A : code;
}
function isBlockNameChar(code) {
return isAsciiLetter(code) || isDigit(code) || code === $_;
}
function isBlockParameterChar(code) {
return code !== $SEMICOLON && isNotWhitespace(code);
}
function isSelectorlessNameStart(code) {
return code === $_ || code >= $A && code <= $Z;
}
function isSelectorlessNameChar(code) {
return isAsciiLetter(code) || isDigit(code) || code === $_;
}
function isAttributeTerminator(code) {
return code === $SLASH || code === $GT || code === $LT || code === $EOF;
}
function mergeTextTokens(srcTokens) {
const dstTokens = [];
let lastDstToken = void 0;
for (let i = 0; i < srcTokens.length; i++) {
const token = srcTokens[i];
if (lastDstToken && lastDstToken.type === TokenType.TEXT && token.type === TokenType.TEXT || lastDstToken && lastDstToken.type === TokenType.ATTR_VALUE_TEXT && token.type === TokenType.ATTR_VALUE_TEXT) {
lastDstToken.parts[0] += token.parts[0];
lastDstToken.sourceSpan.end = token.sourceSpan.end;
} else {
lastDstToken = token;
dstTokens.push(lastDstToken);
}
}
return dstTokens;
}
var PlainCharacterCursor = class PlainCharacterCursor {
constructor(fileOrCursor, range) {
if (fileOrCursor instanceof PlainCharacterCursor) {
this.file = fileOrCursor.file;
this.input = fileOrCursor.input;
this.end = fileOrCursor.end;
const state = fileOrCursor.state;
this.state = {
peek: state.peek,
offset: state.offset,
line: state.line,
column: state.column
};
} else {
if (!range) throw new Error("Programming error: the range argument must be provided with a file argument.");
this.file = fileOrCursor;
this.input = fileOrCursor.content;
this.end = range.endPos;
this.state = {
peek: -1,
offset: range.startPos,
line: range.startLine,
column: range.startCol
};
}
}
clone() {
return new PlainCharacterCursor(this);
}
peek() {
return this.state.peek;
}
charsLeft() {
return this.end - this.state.offset;
}
diff(other) {
return this.state.offset - other.state.offset;
}
advance() {
this.advanceState(this.state);
}
init() {
this.updatePeek(this.state);
}
getSpan(start, leadingTriviaCodePoints) {
start = start || this;
let fullStart = start;
if (leadingTriviaCodePoints) while (this.diff(start) > 0 && leadingTriviaCodePoints.indexOf(start.peek()) !== -1) {
if (fullStart === start) start = start.clone();
start.advance();
}
const startLocation = this.locationFromCursor(start);
return new ParseSourceSpan(startLocation, this.locationFromCursor(this), fullStart !== start ? this.locationFromCursor(fullStart) : startLocation);
}
getChars(start) {
return this.input.substring(start.state.offset, this.state.offset);
}
charAt(pos) {
return this.input.charCodeAt(pos);
}
advanceState(state) {
if (state.offset >= this.end) {
this.state = state;
throw new CursorError("Unexpected character \"EOF\"", this);
}
const currentChar = this.charAt(state.offset);
if (currentChar === $LF) {
state.line++;
state.column = 0;
} else if (!isNewLine(currentChar)) state.column++;
state.offset++;
this.updatePeek(state);
}
updatePeek(state) {
state.peek = state.offset >= this.end ? $EOF : this.charAt(state.offset);
}
locationFromCursor(cursor) {
return new ParseLocation(cursor.file, cursor.state.offset, cursor.state.line, cursor.state.column);
}
};
var EscapedCharacterCursor = class EscapedCharacterCursor extends PlainCharacterCursor {
constructor(fileOrCursor, range) {
if (fileOrCursor instanceof EscapedCharacterCursor) {
super(fileOrCursor);
this.internalState = { ...fileOrCursor.internalState };
} else {
super(fileOrCursor, range);
this.internalState = this.state;
}
}
advance() {
this.state = this.internalState;
super.advance();
this.processEscapeSequence();
}
init() {
super.init();
this.processEscapeSequence();
}
clone() {
return new EscapedCharacterCursor(this);
}
getChars(start) {
const cursor = start.clone();
let chars = "";
while (cursor.internalState.offset < this.internalState.offset) {
chars += String.fromCodePoint(cursor.peek());
cursor.advance();
}
return chars;
}
/**
* Process the escape sequence that starts at the current position in the text.
*
* This method is called to ensure that `peek` has the unescaped value of escape sequences.
*/
processEscapeSequence() {
const peek = () => this.internalState.peek;
if (peek() === $BACKSLASH) {
this.internalState = { ...this.state };
this.advanceState(this.internalState);
if (peek() === $n) this.state.peek = $LF;
else if (peek() === $r) this.state.peek = $CR;
else if (peek() === $v) this.state.peek = $VTAB;
else if (peek() === $t) this.state.peek = $TAB;
else if (peek() === $b) this.state.peek = $BSPACE;
else if (peek() === $f) this.state.peek = $FF;
else if (peek() === $u) {
this.advanceState(this.internalState);
if (peek() === $LBRACE) {
this.advanceState(this.internalState);
const digitStart = this.clone();
let length = 0;
while (peek() !== $RBRACE) {
this.advanceState(this.internalState);
length++;
}
this.state.peek = this.decodeHexDigits(digitStart, length);
} else {
const digitStart = this.clone();
this.advanceState(this.internalState);
this.advanceState(this.internalState);
this.advanceState(this.internalState);
this.state.peek = this.decodeHexDigits(digitStart, 4);
}
} else if (peek() === $x) {
this.advanceState(this.internalState);
const digitStart = this.clone();
this.advanceState(this.internalState);
this.state.peek = this.decodeHexDigits(digitStart, 2);
} else if (isOctalDigit(peek())) {
let octal = "";
let length = 0;
let previous = this.clone();
while (isOctalDigit(peek()) && length < 3) {
previous = this.clone();
octal += String.fromCodePoint(peek());
this.advanceState(this.internalState);
length++;
}
this.state.peek = parseInt(octal, 8);
this.internalState = previous.internalState;
} else if (isNewLine(this.internalState.peek)) {
this.advanceState(this.internalState);
this.state = this.internalState;
} else this.state.peek = this.internalState.peek;
}
}
decodeHexDigits(start, length) {
const hex = this.input.slice(start.internalState.offset, start.internalState.offset + length);
const charCode = parseInt(hex, 16);
if (!isNaN(charCode)) return charCode;
else {
start.state = start.internalState;
throw new CursorError("Invalid hexadecimal escape sequence", start);
}
}
};
var CursorError = class extends Error {
constructor(msg, cursor) {
super(msg);
this.msg = msg;
this.cursor = cursor;
Object.setPrototypeOf(this, new.target.prototype);
}
};
//#endregion
export { tokenize };
import { ParseError } from "../parse_util.mjs";
import { Node } from "./ast.mjs";
//#region ../compiler/src/ml_parser/parser.d.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
declare class ParseTreeResult {
rootNodes: Node[];
errors: ParseError[];
constructor(rootNodes: Node[], errors: ParseError[]);
}
//#endregion
export { ParseTreeResult };
import { getNsPrefix, mergeNsAndName, splitNsName } from "./tags.mjs";
import { ParseError, ParseSourceSpan } from "../parse_util.mjs";
import { Attribute, Block, BlockParameter, CDATA, Comment, Component, Directive, DocType, Element, Expansion, ExpansionCase, LetDeclaration, Text } from "./ast.mjs";
import { NAMED_ENTITIES } from "./entities.mjs";
import { TokenType } from "./tokens.mjs";
import { tokenize } from "./lexer.mjs";
//#region ../compiler/src/ml_parser/parser.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
var TreeError = class TreeError extends ParseError {
static create(elementName, span, msg) {
return new TreeError(elementName, span, msg);
}
constructor(elementName, span, msg) {
super(span, msg);
this.elementName = elementName;
}
};
var ParseTreeResult = class {
constructor(rootNodes, errors) {
this.rootNodes = rootNodes;
this.errors = errors;
}
};
var Parser = class {
constructor(getTagDefinition) {
this.getTagDefinition = getTagDefinition;
}
parse(source, url, options, isTagNameCaseSensitive = false, getTagContentType) {
const lowercasify = (fn) => (x, ...args) => fn(x.toLowerCase(), ...args);
const getTagDefinition = isTagNameCaseSensitive ? this.getTagDefinition : lowercasify(this.getTagDefinition);
const getDefaultTagContentType = (tagName) => getTagDefinition(tagName).getContentType();
const getTagContentTypeWithProcessedTagName = isTagNameCaseSensitive ? getTagContentType : lowercasify(getTagContentType);
const tokenizeResult = tokenize(source, url, getTagContentType ? (tagName, prefix, hasParent, attrs) => {
const contentType = getTagContentTypeWithProcessedTagName(tagName, prefix, hasParent, attrs);
return contentType !== void 0 ? contentType : getDefaultTagContentType(tagName);
} : getDefaultTagContentType, options);
const canSelfClose = options && options.canSelfClose || false;
const allowHtmComponentClosingTags = options && options.allowHtmComponentClosingTags || false;
const parser = new _TreeBuilder(tokenizeResult.tokens, getTagDefinition, canSelfClose, allowHtmComponentClosingTags, isTagNameCaseSensitive);
parser.build();
return new ParseTreeResult(parser.rootNodes, [...tokenizeResult.errors, ...parser.errors]);
}
};
var _TreeBuilder = class _TreeBuilder {
constructor(tokens, tagDefinitionResolver, canSelfClose, allowHtmComponentClosingTags, isTagNameCaseSensitive) {
this.tokens = tokens;
this.tagDefinitionResolver = tagDefinitionResolver;
this.canSelfClose = canSelfClose;
this.allowHtmComponentClosingTags = allowHtmComponentClosingTags;
this.isTagNameCaseSensitive = isTagNameCaseSensitive;
this._index = -1;
this._containerStack = [];
this.rootNodes = [];
this.errors = [];
this._advance();
}
build() {
while (this._peek.type !== TokenType.EOF) if (this._peek.type === TokenType.TAG_OPEN_START || this._peek.type === TokenType.INCOMPLETE_TAG_OPEN) this._consumeElementStartTag(this._advance());
else if (this._peek.type === TokenType.TAG_CLOSE) {
this._closeVoidElement();
this._consumeElementEndTag(this._advance());
} else if (this._peek.type === TokenType.CDATA_START) {
this._closeVoidElement();
this._consumeCdata(this._advance());
} else if (this._peek.type === TokenType.COMMENT_START) {
this._closeVoidElement();
this._consumeComment(this._advance());
} else if (this._peek.type === TokenType.TEXT || this._peek.type === TokenType.RAW_TEXT || this._peek.type === TokenType.ESCAPABLE_RAW_TEXT) {
this._closeVoidElement();
this._consumeText(this._advance());
} else if (this._peek.type === TokenType.EXPANSION_FORM_START) this._consumeExpansion(this._advance());
else if (this._peek.type === TokenType.BLOCK_OPEN_START) {
this._closeVoidElement();
this._consumeBlockOpen(this._advance());
} else if (this._peek.type === TokenType.BLOCK_CLOSE) {
this._closeVoidElement();
this._consumeBlockClose(this._advance());
} else if (this._peek.type === TokenType.INCOMPLETE_BLOCK_OPEN) {
this._closeVoidElement();
this._consumeIncompleteBlock(this._advance());
} else if (this._peek.type === TokenType.LET_START) {
this._closeVoidElement();
this._consumeLet(this._advance());
} else if (this._peek.type === TokenType.DOC_TYPE_START) this._consumeDocType(this._advance());
else if (this._peek.type === TokenType.INCOMPLETE_LET) {
this._closeVoidElement();
this._consumeIncompleteLet(this._advance());
} else if (this._peek.type === TokenType.COMPONENT_OPEN_START || this._peek.type === TokenType.INCOMPLETE_COMPONENT_OPEN) this._consumeComponentStartTag(this._advance());
else if (this._peek.type === TokenType.COMPONENT_CLOSE) this._consumeComponentEndTag(this._advance());
else this._advance();
for (const leftoverContainer of this._containerStack) if (leftoverContainer instanceof Block) this.errors.push(TreeError.create(leftoverContainer.name, leftoverContainer.sourceSpan, `Unclosed block "${leftoverContainer.name}"`));
}
_advance() {
const prev = this._peek;
if (this._index < this.tokens.length - 1) this._index++;
this._peek = this.tokens[this._index];
return prev;
}
_advanceIf(type) {
if (this._peek.type === type) return this._advance();
return null;
}
_consumeCdata(startToken) {
const text = this._advance();
const value = this._getText(text);
const endToken = this._advanceIf(TokenType.CDATA_END);
this._addToParent(new CDATA(value, new ParseSourceSpan(startToken.sourceSpan.start, (endToken || text).sourceSpan.end), [text]));
}
_consumeComment(token) {
const text = this._advanceIf(TokenType.RAW_TEXT);
const endToken = this._advanceIf(TokenType.COMMENT_END);
const value = text != null ? text.parts[0].trim() : null;
const sourceSpan = endToken == null ? token.sourceSpan : new ParseSourceSpan(token.sourceSpan.start, endToken.sourceSpan.end, token.sourceSpan.fullStart);
this._addToParent(new Comment(value, sourceSpan));
}
_consumeDocType(startToken) {
const text = this._advanceIf(TokenType.RAW_TEXT);
const endToken = this._advanceIf(TokenType.DOC_TYPE_END);
const value = text != null ? text.parts[0].trim() : null;
const sourceSpan = new ParseSourceSpan(startToken.sourceSpan.start, (endToken || text || startToken).sourceSpan.end);
this._addToParent(new DocType(value, sourceSpan));
}
_consumeExpansion(token) {
const switchValue = this._advance();
const type = this._advance();
const cases = [];
while (this._peek.type === TokenType.EXPANSION_CASE_VALUE) {
const expCase = this._parseExpansionCase();
if (!expCase) return;
cases.push(expCase);
}
if (this._peek.type !== TokenType.EXPANSION_FORM_END) {
this.errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '}'.`));
return;
}
const sourceSpan = new ParseSourceSpan(token.sourceSpan.start, this._peek.sourceSpan.end, token.sourceSpan.fullStart);
this._addToParent(new Expansion(switchValue.parts[0], type.parts[0], cases, sourceSpan, switchValue.sourceSpan));
this._advance();
}
_parseExpansionCase() {
const value = this._advance();
if (this._peek.type !== TokenType.EXPANSION_CASE_EXP_START) {
this.errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '{'.`));
return null;
}
const start = this._advance();
const exp = this._collectExpansionExpTokens(start);
if (!exp) return null;
const end = this._advance();
exp.push({
type: TokenType.EOF,
parts: [],
sourceSpan: end.sourceSpan
});
const expansionCaseParser = new _TreeBuilder(exp, this.tagDefinitionResolver, this.canSelfClose, this.allowHtmComponentClosingTags, this.isTagNameCaseSensitive);
expansionCaseParser.build();
if (expansionCaseParser.errors.length > 0) {
this.errors = this.errors.concat(expansionCaseParser.errors);
return null;
}
const sourceSpan = new ParseSourceSpan(value.sourceSpan.start, end.sourceSpan.end, value.sourceSpan.fullStart);
const expSourceSpan = new ParseSourceSpan(start.sourceSpan.start, end.sourceSpan.end, start.sourceSpan.fullStart);
return new ExpansionCase(value.parts[0], expansionCaseParser.rootNodes, sourceSpan, value.sourceSpan, expSourceSpan);
}
_collectExpansionExpTokens(start) {
const exp = [];
const expansionFormStack = [TokenType.EXPANSION_CASE_EXP_START];
while (true) {
if (this._peek.type === TokenType.EXPANSION_FORM_START || this._peek.type === TokenType.EXPANSION_CASE_EXP_START) expansionFormStack.push(this._peek.type);
if (this._peek.type === TokenType.EXPANSION_CASE_EXP_END) if (lastOnStack(expansionFormStack, TokenType.EXPANSION_CASE_EXP_START)) {
expansionFormStack.pop();
if (expansionFormStack.length === 0) return exp;
} else {
this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));
return null;
}
if (this._peek.type === TokenType.EXPANSION_FORM_END) if (lastOnStack(expansionFormStack, TokenType.EXPANSION_FORM_START)) expansionFormStack.pop();
else {
this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));
return null;
}
if (this._peek.type === TokenType.EOF) {
this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));
return null;
}
exp.push(this._advance());
}
}
_getText(token) {
let text = token.parts[0];
if (text.length > 0 && text[0] == "\n") {
var _this$_getTagDefiniti;
const parent = this._getClosestElementLikeParent();
if (parent != null && parent.children.length == 0 && ((_this$_getTagDefiniti = this._getTagDefinition(parent)) === null || _this$_getTagDefiniti === void 0 ? void 0 : _this$_getTagDefiniti.ignoreFirstLf)) text = text.substring(1);
}
return text;
}
_consumeText(token) {
const tokens = [token];
const startSpan = token.sourceSpan;
let text = token.parts[0];
if (text.length > 0 && text[0] === "\n") {
var _this$_getTagDefiniti2;
const parent = this._getContainer();
if (parent != null && parent.children.length === 0 && ((_this$_getTagDefiniti2 = this._getTagDefinition(parent)) === null || _this$_getTagDefiniti2 === void 0 ? void 0 : _this$_getTagDefiniti2.ignoreFirstLf)) {
text = text.substring(1);
tokens[0] = {
type: token.type,
sourceSpan: token.sourceSpan,
parts: [text]
};
}
}
while (this._peek.type === TokenType.INTERPOLATION || this._peek.type === TokenType.TEXT || this._peek.type === TokenType.ENCODED_ENTITY) {
token = this._advance();
tokens.push(token);
if (token.type === TokenType.INTERPOLATION) text += token.parts.join("").replace(/&([^;]+);/g, decodeEntity);
else if (token.type === TokenType.ENCODED_ENTITY) text += token.parts[0];
else text += token.parts.join("");
}
if (text.length > 0) {
const endSpan = token.sourceSpan;
this._addToParent(new Text(text, new ParseSourceSpan(startSpan.start, endSpan.end, startSpan.fullStart, startSpan.details), tokens));
}
}
_closeVoidElement() {
var _this$_getTagDefiniti3;
const el = this._getContainer();
if (el !== null && ((_this$_getTagDefiniti3 = this._getTagDefinition(el)) === null || _this$_getTagDefiniti3 === void 0 ? void 0 : _this$_getTagDefiniti3.isVoid)) this._containerStack.pop();
}
_consumeElementStartTag(startTagToken) {
var _this$_getTagDefiniti4;
const attrs = [];
const directives = [];
this._consumeAttributesAndDirectives(attrs, directives);
const fullName = this._getElementFullName(startTagToken, this._getClosestElementLikeParent());
const tagDef = this._getTagDefinition(fullName);
let selfClosing = false;
if (this._peek.type === TokenType.TAG_OPEN_END_VOID) {
this._advance();
selfClosing = true;
const tagDef$1 = this._getTagDefinition(fullName);
if (!(this.canSelfClose || (tagDef$1 === null || tagDef$1 === void 0 ? void 0 : tagDef$1.canSelfClose) || getNsPrefix(fullName) !== null || (tagDef$1 === null || tagDef$1 === void 0 ? void 0 : tagDef$1.isVoid))) this.errors.push(TreeError.create(fullName, startTagToken.sourceSpan, `Only void, custom and foreign elements can be self closed "${startTagToken.parts[1]}"`));
} else if (this._peek.type === TokenType.TAG_OPEN_END) {
this._advance();
selfClosing = false;
}
const end = this._peek.sourceSpan.fullStart;
const span = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
const startSpan = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
const nameSpan = new ParseSourceSpan(startTagToken.sourceSpan.start.moveBy(1), startTagToken.sourceSpan.end);
const el = new Element(fullName, attrs, directives, [], selfClosing, span, startSpan, void 0, nameSpan, (tagDef === null || tagDef === void 0 ? void 0 : tagDef.isVoid) ?? false);
const parent = this._getContainer();
const isClosedByChild = parent !== null && !!((_this$_getTagDefiniti4 = this._getTagDefinition(parent)) === null || _this$_getTagDefiniti4 === void 0 ? void 0 : _this$_getTagDefiniti4.isClosedByChild(el.name));
this._pushContainer(el, isClosedByChild);
if (selfClosing) this._popContainer(fullName, Element, span);
else if (startTagToken.type === TokenType.INCOMPLETE_TAG_OPEN) {
this._popContainer(fullName, Element, null);
this.errors.push(TreeError.create(fullName, span, `Opening tag "${fullName}" not terminated.`));
}
}
_consumeComponentStartTag(startToken) {
var _this$_getTagDefiniti5;
const componentName = startToken.parts[0];
const attrs = [];
const directives = [];
this._consumeAttributesAndDirectives(attrs, directives);
const closestElement = this._getClosestElementLikeParent();
const tagName = this._getComponentTagName(startToken, closestElement);
const fullName = this._getComponentFullName(startToken, closestElement);
const selfClosing = this._peek.type === TokenType.COMPONENT_OPEN_END_VOID;
this._advance();
const end = this._peek.sourceSpan.fullStart;
const span = new ParseSourceSpan(startToken.sourceSpan.start, end, startToken.sourceSpan.fullStart);
const startSpan = new ParseSourceSpan(startToken.sourceSpan.start, end, startToken.sourceSpan.fullStart);
const node = new Component(componentName, tagName, fullName, attrs, directives, [], selfClosing, span, startSpan, void 0);
const parent = this._getContainer();
const isClosedByChild = parent !== null && node.tagName !== null && !!((_this$_getTagDefiniti5 = this._getTagDefinition(parent)) === null || _this$_getTagDefiniti5 === void 0 ? void 0 : _this$_getTagDefiniti5.isClosedByChild(node.tagName));
this._pushContainer(node, isClosedByChild);
if (selfClosing) this._popContainer(fullName, Component, span);
else if (startToken.type === TokenType.INCOMPLETE_COMPONENT_OPEN) {
this._popContainer(fullName, Component, null);
this.errors.push(TreeError.create(fullName, span, `Opening tag "${fullName}" not terminated.`));
}
}
_consumeAttributesAndDirectives(attributesResult, directivesResult) {
while (this._peek.type === TokenType.ATTR_NAME || this._peek.type === TokenType.DIRECTIVE_NAME) if (this._peek.type === TokenType.DIRECTIVE_NAME) directivesResult.push(this._consumeDirective(this._peek));
else attributesResult.push(this._consumeAttr(this._advance()));
}
_consumeComponentEndTag(endToken) {
const fullName = this._getComponentFullName(endToken, this._getClosestElementLikeParent());
if (!this._popContainer(fullName, Component, endToken.sourceSpan)) {
const container = this._containerStack[this._containerStack.length - 1];
let suffix;
if (container instanceof Component && container.componentName === endToken.parts[0]) suffix = `, did you mean "${container.fullName}"?`;
else suffix = ". It may happen when the tag has already been closed by another tag.";
const errMsg = `Unexpected closing tag "${fullName}"${suffix}`;
this.errors.push(TreeError.create(fullName, endToken.sourceSpan, errMsg));
}
}
_getTagDefinition(nodeOrName) {
if (typeof nodeOrName === "string") return this.tagDefinitionResolver(nodeOrName);
else if (nodeOrName instanceof Element) return this.tagDefinitionResolver(nodeOrName.name);
else if (nodeOrName instanceof Component && nodeOrName.tagName !== null) return this.tagDefinitionResolver(nodeOrName.tagName);
else return null;
}
_pushContainer(node, isClosedByChild) {
if (isClosedByChild) this._containerStack.pop();
this._addToParent(node);
this._containerStack.push(node);
}
_consumeElementEndTag(endTagToken) {
var _this$_getTagDefiniti6;
const fullName = this.allowHtmComponentClosingTags && endTagToken.parts.length === 0 ? null : this._getElementFullName(endTagToken, this._getClosestElementLikeParent());
if (fullName && ((_this$_getTagDefiniti6 = this._getTagDefinition(fullName)) === null || _this$_getTagDefiniti6 === void 0 ? void 0 : _this$_getTagDefiniti6.isVoid)) this.errors.push(TreeError.create(fullName, endTagToken.sourceSpan, `Void elements do not have end tags "${endTagToken.parts[1]}"`));
else if (!this._popContainer(fullName, Element, endTagToken.sourceSpan)) {
const errMsg = `Unexpected closing tag "${fullName}". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags`;
this.errors.push(TreeError.create(fullName, endTagToken.sourceSpan, errMsg));
}
}
/**
* Closes the nearest element with the tag name `fullName` in the parse tree.
* `endSourceSpan` is the span of the closing tag, or null if the element does
* not have a closing tag (for example, this happens when an incomplete
* opening tag is recovered).
*/
_popContainer(expectedName, expectedType, endSourceSpan) {
let unexpectedCloseTagDetected = false;
for (let stackIndex = this._containerStack.length - 1; stackIndex >= 0; stackIndex--) {
var _this$_getTagDefiniti7;
const node = this._containerStack[stackIndex];
const nodeName = node instanceof Component ? node.fullName : node.name;
if (getNsPrefix(nodeName) ? nodeName === expectedName : (nodeName === expectedName || expectedName === null) && node instanceof expectedType) {
node.endSourceSpan = endSourceSpan;
node.sourceSpan.end = endSourceSpan !== null ? endSourceSpan.end : node.sourceSpan.end;
this._containerStack.splice(stackIndex, this._containerStack.length - stackIndex);
return !unexpectedCloseTagDetected;
}
if (node instanceof Block || !((_this$_getTagDefiniti7 = this._getTagDefinition(node)) === null || _this$_getTagDefiniti7 === void 0 ? void 0 : _this$_getTagDefiniti7.closedByParent)) unexpectedCloseTagDetected = true;
}
return false;
}
_consumeAttr(attrName) {
const fullName = mergeNsAndName(attrName.parts[0], attrName.parts[1]);
let attrEnd = attrName.sourceSpan.end;
let startQuoteToken;
if (this._peek.type === TokenType.ATTR_QUOTE) startQuoteToken = this._advance();
let value = "";
const valueTokens = [];
let valueStartSpan = void 0;
let valueEnd = void 0;
if (this._peek.type === TokenType.ATTR_VALUE_TEXT) {
valueStartSpan = this._peek.sourceSpan;
valueEnd = this._peek.sourceSpan.end;
while (this._peek.type === TokenType.ATTR_VALUE_TEXT || this._peek.type === TokenType.ATTR_VALUE_INTERPOLATION || this._peek.type === TokenType.ENCODED_ENTITY) {
const valueToken = this._advance();
valueTokens.push(valueToken);
if (valueToken.type === TokenType.ATTR_VALUE_INTERPOLATION) value += valueToken.parts.join("").replace(/&([^;]+);/g, decodeEntity);
else if (valueToken.type === TokenType.ENCODED_ENTITY) value += valueToken.parts[0];
else value += valueToken.parts.join("");
valueEnd = attrEnd = valueToken.sourceSpan.end;
}
}
if (this._peek.type === TokenType.ATTR_QUOTE) valueEnd = attrEnd = this._advance().sourceSpan.end;
const valueSpan = valueStartSpan && valueEnd && new ParseSourceSpan((startQuoteToken === null || startQuoteToken === void 0 ? void 0 : startQuoteToken.sourceSpan.start) ?? valueStartSpan.start, valueEnd, (startQuoteToken === null || startQuoteToken === void 0 ? void 0 : startQuoteToken.sourceSpan.fullStart) ?? valueStartSpan.fullStart);
return new Attribute(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, attrEnd, attrName.sourceSpan.fullStart), attrName.sourceSpan, valueSpan, valueTokens.length > 0 ? valueTokens : void 0, void 0);
}
_consumeDirective(nameToken) {
const attributes = [];
let startSourceSpanEnd = nameToken.sourceSpan.end;
let endSourceSpan = null;
this._advance();
if (this._peek.type === TokenType.DIRECTIVE_OPEN) {
startSourceSpanEnd = this._peek.sourceSpan.end;
this._advance();
while (this._peek.type === TokenType.ATTR_NAME) attributes.push(this._consumeAttr(this._advance()));
if (this._peek.type === TokenType.DIRECTIVE_CLOSE) {
endSourceSpan = this._peek.sourceSpan;
this._advance();
} else this.errors.push(TreeError.create(null, nameToken.sourceSpan, "Unterminated directive definition"));
}
const startSourceSpan = new ParseSourceSpan(nameToken.sourceSpan.start, startSourceSpanEnd, nameToken.sourceSpan.fullStart);
const sourceSpan = new ParseSourceSpan(startSourceSpan.start, endSourceSpan === null ? nameToken.sourceSpan.end : endSourceSpan.end, startSourceSpan.fullStart);
return new Directive(nameToken.parts[0], attributes, sourceSpan, startSourceSpan, endSourceSpan);
}
_consumeBlockOpen(token) {
const parameters = [];
while (this._peek.type === TokenType.BLOCK_PARAMETER) {
const paramToken = this._advance();
parameters.push(new BlockParameter(paramToken.parts[0], paramToken.sourceSpan));
}
if (this._peek.type === TokenType.BLOCK_OPEN_END) this._advance();
const end = this._peek.sourceSpan.fullStart;
const span = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
const startSpan = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
const block = new Block(token.parts[0], parameters, [], span, token.sourceSpan, startSpan);
this._pushContainer(block, false);
}
_consumeBlockClose(token) {
if (!this._popContainer(null, Block, token.sourceSpan)) this.errors.push(TreeError.create(null, token.sourceSpan, "Unexpected closing block. The block may have been closed earlier. If you meant to write the } character, you should use the \"&#125;\" HTML entity instead."));
}
_consumeIncompleteBlock(token) {
const parameters = [];
while (this._peek.type === TokenType.BLOCK_PARAMETER) {
const paramToken = this._advance();
parameters.push(new BlockParameter(paramToken.parts[0], paramToken.sourceSpan));
}
const end = this._peek.sourceSpan.fullStart;
const span = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
const startSpan = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
const block = new Block(token.parts[0], parameters, [], span, token.sourceSpan, startSpan);
this._pushContainer(block, false);
this._popContainer(null, Block, null);
this.errors.push(TreeError.create(token.parts[0], span, `Incomplete block "${token.parts[0]}". If you meant to write the @ character, you should use the "&#64;" HTML entity instead.`));
}
_consumeLet(startToken) {
const name = startToken.parts[0];
let valueToken;
let endToken;
if (this._peek.type !== TokenType.LET_VALUE) {
this.errors.push(TreeError.create(startToken.parts[0], startToken.sourceSpan, `Invalid @let declaration "${name}". Declaration must have a value.`));
return;
} else valueToken = this._advance();
if (this._peek.type !== TokenType.LET_END) {
this.errors.push(TreeError.create(startToken.parts[0], startToken.sourceSpan, `Unterminated @let declaration "${name}". Declaration must be terminated with a semicolon.`));
return;
} else endToken = this._advance();
const end = endToken.sourceSpan.fullStart;
const span = new ParseSourceSpan(startToken.sourceSpan.start, end, startToken.sourceSpan.fullStart);
const startOffset = startToken.sourceSpan.toString().lastIndexOf(name);
const nameSpan = new ParseSourceSpan(startToken.sourceSpan.start.moveBy(startOffset), startToken.sourceSpan.end);
const node = new LetDeclaration(name, valueToken.parts[0], span, nameSpan, valueToken.sourceSpan);
this._addToParent(node);
}
_consumeIncompleteLet(token) {
const name = token.parts[0] ?? "";
const nameString = name ? ` "${name}"` : "";
if (name.length > 0) {
const startOffset = token.sourceSpan.toString().lastIndexOf(name);
const nameSpan = new ParseSourceSpan(token.sourceSpan.start.moveBy(startOffset), token.sourceSpan.end);
const valueSpan = new ParseSourceSpan(token.sourceSpan.start, token.sourceSpan.start.moveBy(0));
const node = new LetDeclaration(name, "", token.sourceSpan, nameSpan, valueSpan);
this._addToParent(node);
}
this.errors.push(TreeError.create(token.parts[0], token.sourceSpan, `Incomplete @let declaration${nameString}. @let declarations must be written as \`@let <name> = <value>;\``));
}
_getContainer() {
return this._containerStack.length > 0 ? this._containerStack[this._containerStack.length - 1] : null;
}
_getClosestElementLikeParent() {
for (let i = this._containerStack.length - 1; i > -1; i--) {
const current = this._containerStack[i];
if (current instanceof Element || current instanceof Component) return current;
}
return null;
}
_addToParent(node) {
const parent = this._getContainer();
if (parent === null) this.rootNodes.push(node);
else parent.children.push(node);
}
_getElementFullName(token, parent) {
return mergeNsAndName(this._getPrefix(token, parent), token.parts[1]);
}
_getComponentFullName(token, parent) {
const componentName = token.parts[0];
const tagName = this._getComponentTagName(token, parent);
if (tagName === null) return componentName;
return tagName.startsWith(":") ? componentName + tagName : `${componentName}:${tagName}`;
}
_getComponentTagName(token, parent) {
const prefix = this._getPrefix(token, parent);
const tagName = token.parts[2];
if (!prefix && !tagName) return null;
else if (!prefix && tagName) return tagName;
else return mergeNsAndName(prefix, tagName || "ng-component");
}
_getPrefix(token, parent) {
var _this$_getTagDefiniti8;
let prefix;
let tagName;
if (token.type === TokenType.COMPONENT_OPEN_START || token.type === TokenType.INCOMPLETE_COMPONENT_OPEN || token.type === TokenType.COMPONENT_CLOSE) {
prefix = token.parts[1];
tagName = token.parts[2];
} else {
prefix = token.parts[0];
tagName = token.parts[1];
}
prefix = prefix || ((_this$_getTagDefiniti8 = this._getTagDefinition(tagName)) === null || _this$_getTagDefiniti8 === void 0 ? void 0 : _this$_getTagDefiniti8.implicitNamespacePrefix) || "";
if (!prefix && parent) {
const parentName = parent instanceof Element ? parent.name : parent.tagName;
if (parentName !== null) {
const parentTagName = splitNsName(parentName)[1];
const parentTagDefinition = this._getTagDefinition(parentTagName);
if (parentTagDefinition !== null && !parentTagDefinition.preventNamespaceInheritance) prefix = getNsPrefix(parentName);
}
}
return prefix;
}
};
function lastOnStack(stack, element) {
return stack.length > 0 && stack[stack.length - 1] === element;
}
/**
* Decode the `entity` string, which we believe is the contents of an HTML entity.
*
* If the string is not actually a valid/known entity then just return the original `match` string.
*/
function decodeEntity(match, entity) {
if (NAMED_ENTITIES[entity] !== void 0) return NAMED_ENTITIES[entity] || match;
if (/^#x[a-f0-9]+$/i.test(entity)) return String.fromCodePoint(parseInt(entity.slice(2), 16));
if (/^#\d+$/.test(entity)) return String.fromCodePoint(parseInt(entity.slice(1), 10));
return match;
}
//#endregion
export { Parser };
//#region ../compiler/src/ml_parser/tags.d.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
declare enum TagContentType {
RAW_TEXT = 0,
ESCAPABLE_RAW_TEXT = 1,
PARSABLE_DATA = 2,
}
interface TagDefinition {
closedByParent: boolean;
implicitNamespacePrefix: string | null;
isVoid: boolean;
ignoreFirstLf: boolean;
canSelfClose: boolean;
preventNamespaceInheritance: boolean;
isClosedByChild(name: string): boolean;
getContentType(prefix?: string): TagContentType;
}
//#endregion
export { TagContentType, TagDefinition };
//#region ../compiler/src/ml_parser/tags.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
let TagContentType = /* @__PURE__ */ function(TagContentType$1) {
TagContentType$1[TagContentType$1["RAW_TEXT"] = 0] = "RAW_TEXT";
TagContentType$1[TagContentType$1["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
TagContentType$1[TagContentType$1["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
return TagContentType$1;
}({});
function splitNsName(elementName, fatal = true) {
if (elementName[0] != ":") return [null, elementName];
const colonIndex = elementName.indexOf(":", 1);
if (colonIndex === -1) if (fatal) throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
else return [null, elementName];
return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
}
function isNgContainer(tagName) {
return splitNsName(tagName)[1] === "ng-container";
}
function isNgContent(tagName) {
return splitNsName(tagName)[1] === "ng-content";
}
function getNsPrefix(fullName) {
return fullName === null ? null : splitNsName(fullName)[0];
}
function mergeNsAndName(prefix, localName) {
return prefix ? `:${prefix}:${localName}` : localName;
}
//#endregion
export { TagContentType, getNsPrefix, isNgContainer, isNgContent, mergeNsAndName, splitNsName };
import { ParseSourceSpan } from "../parse_util.mjs";
//#region ../compiler/src/ml_parser/tokens.d.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
declare const enum TokenType {
TAG_OPEN_START = 0,
TAG_OPEN_END = 1,
TAG_OPEN_END_VOID = 2,
TAG_CLOSE = 3,
INCOMPLETE_TAG_OPEN = 4,
TEXT = 5,
ESCAPABLE_RAW_TEXT = 6,
RAW_TEXT = 7,
INTERPOLATION = 8,
ENCODED_ENTITY = 9,
COMMENT_START = 10,
COMMENT_END = 11,
CDATA_START = 12,
CDATA_END = 13,
ATTR_NAME = 14,
ATTR_QUOTE = 15,
ATTR_VALUE_TEXT = 16,
ATTR_VALUE_INTERPOLATION = 17,
DOC_TYPE_START = 18,
DOC_TYPE_END = 19,
EXPANSION_FORM_START = 20,
EXPANSION_CASE_VALUE = 21,
EXPANSION_CASE_EXP_START = 22,
EXPANSION_CASE_EXP_END = 23,
EXPANSION_FORM_END = 24,
BLOCK_OPEN_START = 25,
BLOCK_OPEN_END = 26,
BLOCK_CLOSE = 27,
BLOCK_PARAMETER = 28,
INCOMPLETE_BLOCK_OPEN = 29,
LET_START = 30,
LET_VALUE = 31,
LET_END = 32,
INCOMPLETE_LET = 33,
COMPONENT_OPEN_START = 34,
COMPONENT_OPEN_END = 35,
COMPONENT_OPEN_END_VOID = 36,
COMPONENT_CLOSE = 37,
INCOMPLETE_COMPONENT_OPEN = 38,
DIRECTIVE_NAME = 39,
DIRECTIVE_OPEN = 40,
DIRECTIVE_CLOSE = 41,
EOF = 42,
}
type InterpolatedTextToken = TextToken | InterpolationToken | EncodedEntityToken;
type InterpolatedAttributeToken = AttributeValueTextToken | AttributeValueInterpolationToken | EncodedEntityToken;
interface TokenBase {
type: TokenType;
parts: string[];
sourceSpan: ParseSourceSpan;
}
interface TextToken extends TokenBase {
type: TokenType.TEXT | TokenType.ESCAPABLE_RAW_TEXT | TokenType.RAW_TEXT;
parts: [text: string];
}
interface InterpolationToken extends TokenBase {
type: TokenType.INTERPOLATION;
parts: [startMarker: string, expression: string, endMarker: string] | [startMarker: string, expression: string];
}
interface EncodedEntityToken extends TokenBase {
type: TokenType.ENCODED_ENTITY;
parts: [decoded: string, encoded: string];
}
interface AttributeValueTextToken extends TokenBase {
type: TokenType.ATTR_VALUE_TEXT;
parts: [value: string];
}
interface AttributeValueInterpolationToken extends TokenBase {
type: TokenType.ATTR_VALUE_INTERPOLATION;
parts: [startMarker: string, expression: string, endMarker: string] | [startMarker: string, expression: string];
}
//#endregion
export { InterpolatedAttributeToken, InterpolatedTextToken };
//#region ../compiler/src/ml_parser/tokens.ts
let TokenType = /* @__PURE__ */ function(TokenType$1) {
TokenType$1[TokenType$1["TAG_OPEN_START"] = 0] = "TAG_OPEN_START";
TokenType$1[TokenType$1["TAG_OPEN_END"] = 1] = "TAG_OPEN_END";
TokenType$1[TokenType$1["TAG_OPEN_END_VOID"] = 2] = "TAG_OPEN_END_VOID";
TokenType$1[TokenType$1["TAG_CLOSE"] = 3] = "TAG_CLOSE";
TokenType$1[TokenType$1["INCOMPLETE_TAG_OPEN"] = 4] = "INCOMPLETE_TAG_OPEN";
TokenType$1[TokenType$1["TEXT"] = 5] = "TEXT";
TokenType$1[TokenType$1["ESCAPABLE_RAW_TEXT"] = 6] = "ESCAPABLE_RAW_TEXT";
TokenType$1[TokenType$1["RAW_TEXT"] = 7] = "RAW_TEXT";
TokenType$1[TokenType$1["INTERPOLATION"] = 8] = "INTERPOLATION";
TokenType$1[TokenType$1["ENCODED_ENTITY"] = 9] = "ENCODED_ENTITY";
TokenType$1[TokenType$1["COMMENT_START"] = 10] = "COMMENT_START";
TokenType$1[TokenType$1["COMMENT_END"] = 11] = "COMMENT_END";
TokenType$1[TokenType$1["CDATA_START"] = 12] = "CDATA_START";
TokenType$1[TokenType$1["CDATA_END"] = 13] = "CDATA_END";
TokenType$1[TokenType$1["ATTR_NAME"] = 14] = "ATTR_NAME";
TokenType$1[TokenType$1["ATTR_QUOTE"] = 15] = "ATTR_QUOTE";
TokenType$1[TokenType$1["ATTR_VALUE_TEXT"] = 16] = "ATTR_VALUE_TEXT";
TokenType$1[TokenType$1["ATTR_VALUE_INTERPOLATION"] = 17] = "ATTR_VALUE_INTERPOLATION";
TokenType$1[TokenType$1["DOC_TYPE_START"] = 18] = "DOC_TYPE_START";
TokenType$1[TokenType$1["DOC_TYPE_END"] = 19] = "DOC_TYPE_END";
TokenType$1[TokenType$1["EXPANSION_FORM_START"] = 20] = "EXPANSION_FORM_START";
TokenType$1[TokenType$1["EXPANSION_CASE_VALUE"] = 21] = "EXPANSION_CASE_VALUE";
TokenType$1[TokenType$1["EXPANSION_CASE_EXP_START"] = 22] = "EXPANSION_CASE_EXP_START";
TokenType$1[TokenType$1["EXPANSION_CASE_EXP_END"] = 23] = "EXPANSION_CASE_EXP_END";
TokenType$1[TokenType$1["EXPANSION_FORM_END"] = 24] = "EXPANSION_FORM_END";
TokenType$1[TokenType$1["BLOCK_OPEN_START"] = 25] = "BLOCK_OPEN_START";
TokenType$1[TokenType$1["BLOCK_OPEN_END"] = 26] = "BLOCK_OPEN_END";
TokenType$1[TokenType$1["BLOCK_CLOSE"] = 27] = "BLOCK_CLOSE";
TokenType$1[TokenType$1["BLOCK_PARAMETER"] = 28] = "BLOCK_PARAMETER";
TokenType$1[TokenType$1["INCOMPLETE_BLOCK_OPEN"] = 29] = "INCOMPLETE_BLOCK_OPEN";
TokenType$1[TokenType$1["LET_START"] = 30] = "LET_START";
TokenType$1[TokenType$1["LET_VALUE"] = 31] = "LET_VALUE";
TokenType$1[TokenType$1["LET_END"] = 32] = "LET_END";
TokenType$1[TokenType$1["INCOMPLETE_LET"] = 33] = "INCOMPLETE_LET";
TokenType$1[TokenType$1["COMPONENT_OPEN_START"] = 34] = "COMPONENT_OPEN_START";
TokenType$1[TokenType$1["COMPONENT_OPEN_END"] = 35] = "COMPONENT_OPEN_END";
TokenType$1[TokenType$1["COMPONENT_OPEN_END_VOID"] = 36] = "COMPONENT_OPEN_END_VOID";
TokenType$1[TokenType$1["COMPONENT_CLOSE"] = 37] = "COMPONENT_CLOSE";
TokenType$1[TokenType$1["INCOMPLETE_COMPONENT_OPEN"] = 38] = "INCOMPLETE_COMPONENT_OPEN";
TokenType$1[TokenType$1["DIRECTIVE_NAME"] = 39] = "DIRECTIVE_NAME";
TokenType$1[TokenType$1["DIRECTIVE_OPEN"] = 40] = "DIRECTIVE_OPEN";
TokenType$1[TokenType$1["DIRECTIVE_CLOSE"] = 41] = "DIRECTIVE_CLOSE";
TokenType$1[TokenType$1["EOF"] = 42] = "EOF";
return TokenType$1;
}({});
//#endregion
export { TokenType };
//#region ../compiler/src/parse_util.d.ts
declare class ParseLocation {
file: ParseSourceFile;
offset: number;
line: number;
col: number;
constructor(file: ParseSourceFile, offset: number, line: number, col: number);
toString(): string;
moveBy(delta: number): ParseLocation;
getContext(maxChars: number, maxLines: number): {
before: string;
after: string;
} | null;
}
declare class ParseSourceFile {
content: string;
url: string;
constructor(content: string, url: string);
}
declare class ParseSourceSpan {
start: ParseLocation;
end: ParseLocation;
fullStart: ParseLocation;
details: string | null;
/**
* Create an object that holds information about spans of tokens/nodes captured during
* lexing/parsing of text.
*
* @param start
* The location of the start of the span (having skipped leading trivia).
* Skipping leading trivia makes source-spans more "user friendly", since things like HTML
* elements will appear to begin at the start of the opening tag, rather than at the start of any
* leading trivia, which could include newlines.
*
* @param end
* The location of the end of the span.
*
* @param fullStart
* The start of the token without skipping the leading trivia.
* This is used by tooling that splits tokens further, such as extracting Angular interpolations
* from text tokens. Such tooling creates new source-spans relative to the original token's
* source-span. If leading trivia characters have been skipped then the new source-spans may be
* incorrectly offset.
*
* @param details
* Additional information (such as identifier names) that should be associated with the span.
*/
constructor(start: ParseLocation, end: ParseLocation, fullStart?: ParseLocation, details?: string | null);
toString(): string;
}
declare enum ParseErrorLevel {
WARNING = 0,
ERROR = 1,
}
declare class ParseError extends Error {
/** Location of the error. */
readonly span: ParseSourceSpan;
/** Error message. */
readonly msg: string;
/** Severity level of the error. */
readonly level: ParseErrorLevel;
/**
* Error that caused the error to be surfaced. For example, an error in a sub-expression that
* couldn't be parsed. Not guaranteed to be defined, but can be used to provide more context.
*/
readonly relatedError?: unknown;
constructor(/** Location of the error. */
span: ParseSourceSpan, /** Error message. */
msg: string, /** Severity level of the error. */
level?: ParseErrorLevel,
/**
* Error that caused the error to be surfaced. For example, an error in a sub-expression that
* couldn't be parsed. Not guaranteed to be defined, but can be used to provide more context.
*/
relatedError?: unknown);
contextualMessage(): string;
toString(): string;
}
//#endregion
export { ParseError, ParseLocation, ParseSourceFile, ParseSourceSpan };
import { $LF } from "./chars.mjs";
//#region ../compiler/src/parse_util.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
var ParseLocation = class ParseLocation {
constructor(file, offset, line, col) {
this.file = file;
this.offset = offset;
this.line = line;
this.col = col;
}
toString() {
return this.offset != null ? `${this.file.url}@${this.line}:${this.col}` : this.file.url;
}
moveBy(delta) {
const source = this.file.content;
const len = source.length;
let offset = this.offset;
let line = this.line;
let col = this.col;
while (offset > 0 && delta < 0) {
offset--;
delta++;
if (source.charCodeAt(offset) == $LF) {
line--;
const priorLine = source.substring(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
col = priorLine > 0 ? offset - priorLine : offset;
} else col--;
}
while (offset < len && delta > 0) {
const ch = source.charCodeAt(offset);
offset++;
delta--;
if (ch == $LF) {
line++;
col = 0;
} else col++;
}
return new ParseLocation(this.file, offset, line, col);
}
getContext(maxChars, maxLines) {
const content = this.file.content;
let startOffset = this.offset;
if (startOffset != null) {
if (startOffset > content.length - 1) startOffset = content.length - 1;
let endOffset = startOffset;
let ctxChars = 0;
let ctxLines = 0;
while (ctxChars < maxChars && startOffset > 0) {
startOffset--;
ctxChars++;
if (content[startOffset] == "\n") {
if (++ctxLines == maxLines) break;
}
}
ctxChars = 0;
ctxLines = 0;
while (ctxChars < maxChars && endOffset < content.length - 1) {
endOffset++;
ctxChars++;
if (content[endOffset] == "\n") {
if (++ctxLines == maxLines) break;
}
}
return {
before: content.substring(startOffset, this.offset),
after: content.substring(this.offset, endOffset + 1)
};
}
return null;
}
};
var ParseSourceFile = class {
constructor(content, url) {
this.content = content;
this.url = url;
}
};
var ParseSourceSpan = class {
/**
* Create an object that holds information about spans of tokens/nodes captured during
* lexing/parsing of text.
*
* @param start
* The location of the start of the span (having skipped leading trivia).
* Skipping leading trivia makes source-spans more "user friendly", since things like HTML
* elements will appear to begin at the start of the opening tag, rather than at the start of any
* leading trivia, which could include newlines.
*
* @param end
* The location of the end of the span.
*
* @param fullStart
* The start of the token without skipping the leading trivia.
* This is used by tooling that splits tokens further, such as extracting Angular interpolations
* from text tokens. Such tooling creates new source-spans relative to the original token's
* source-span. If leading trivia characters have been skipped then the new source-spans may be
* incorrectly offset.
*
* @param details
* Additional information (such as identifier names) that should be associated with the span.
*/
constructor(start, end, fullStart = start, details = null) {
this.start = start;
this.end = end;
this.fullStart = fullStart;
this.details = details;
}
toString() {
return this.start.file.content.substring(this.start.offset, this.end.offset);
}
};
let ParseErrorLevel = /* @__PURE__ */ function(ParseErrorLevel$1) {
ParseErrorLevel$1[ParseErrorLevel$1["WARNING"] = 0] = "WARNING";
ParseErrorLevel$1[ParseErrorLevel$1["ERROR"] = 1] = "ERROR";
return ParseErrorLevel$1;
}({});
var ParseError = class extends Error {
constructor(span, msg, level = ParseErrorLevel.ERROR, relatedError) {
super(msg);
this.span = span;
this.msg = msg;
this.level = level;
this.relatedError = relatedError;
Object.setPrototypeOf(this, new.target.prototype);
}
contextualMessage() {
const ctx = this.span.start.getContext(100, 3);
return ctx ? `${this.msg} ("${ctx.before}[${ParseErrorLevel[this.level]} ->]${ctx.after}")` : this.msg;
}
toString() {
const details = this.span.details ? `, ${this.span.details}` : "";
return `${this.contextualMessage()}: ${this.span.start}${details}`;
}
};
//#endregion
export { ParseError, ParseLocation, ParseSourceFile, ParseSourceSpan };
import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SecurityContext } from "../core.mjs";
import { isNgContainer, isNgContent } from "../ml_parser/tags.mjs";
import { dashCaseToCamelCase } from "../util.mjs";
import { SECURITY_SCHEMA } from "./dom_security_schema.mjs";
import { ElementSchemaRegistry } from "./element_schema_registry.mjs";
//#region ../compiler/src/schema/dom_element_schema_registry.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
const BOOLEAN = "boolean";
const NUMBER = "number";
const STRING = "string";
const OBJECT = "object";
/**
* This array represents the DOM schema. It encodes inheritance, properties, and events.
*
* ## Overview
*
* Each line represents one kind of element. The `element_inheritance` and properties are joined
* using `element_inheritance|properties` syntax.
*
* ## Element Inheritance
*
* The `element_inheritance` can be further subdivided as `element1,element2,...^parentElement`.
* Here the individual elements are separated by `,` (commas). Every element in the list
* has identical properties.
*
* An `element` may inherit additional properties from `parentElement` If no `^parentElement` is
* specified then `""` (blank) element is assumed.
*
* NOTE: The blank element inherits from root `[Element]` element, the super element of all
* elements.
*
* NOTE an element prefix such as `:svg:` has no special meaning to the schema.
*
* ## Properties
*
* Each element has a set of properties separated by `,` (commas). Each property can be prefixed
* by a special character designating its type:
*
* - (no prefix): property is a string.
* - `*`: property represents an event.
* - `!`: property is a boolean.
* - `#`: property is a number.
* - `%`: property is an object.
*
* ## Query
*
* The class creates an internal squas representation which allows to easily answer the query of
* if a given property exist on a given element.
*
* NOTE: We don't yet support querying for types or events.
* NOTE: This schema is auto extracted from `schema_extractor.ts` located in the test folder,
* see dom_element_schema_registry_spec.ts
*/
const SCHEMA = [
"[Element]|textContent,%ariaActiveDescendantElement,%ariaAtomic,%ariaAutoComplete,%ariaBusy,%ariaChecked,%ariaColCount,%ariaColIndex,%ariaColIndexText,%ariaColSpan,%ariaControlsElements,%ariaCurrent,%ariaDescribedByElements,%ariaDescription,%ariaDetailsElements,%ariaDisabled,%ariaErrorMessageElements,%ariaExpanded,%ariaFlowToElements,%ariaHasPopup,%ariaHidden,%ariaInvalid,%ariaKeyShortcuts,%ariaLabel,%ariaLabelledByElements,%ariaLevel,%ariaLive,%ariaModal,%ariaMultiLine,%ariaMultiSelectable,%ariaOrientation,%ariaOwnsElements,%ariaPlaceholder,%ariaPosInSet,%ariaPressed,%ariaReadOnly,%ariaRelevant,%ariaRequired,%ariaRoleDescription,%ariaRowCount,%ariaRowIndex,%ariaRowIndexText,%ariaRowSpan,%ariaSelected,%ariaSetSize,%ariaSort,%ariaValueMax,%ariaValueMin,%ariaValueNow,%ariaValueText,%classList,className,elementTiming,id,innerHTML,*beforecopy,*beforecut,*beforepaste,*fullscreenchange,*fullscreenerror,*search,*webkitfullscreenchange,*webkitfullscreenerror,outerHTML,%part,#scrollLeft,#scrollTop,slot,*message,*mozfullscreenchange,*mozfullscreenerror,*mozpointerlockchange,*mozpointerlockerror,*webglcontextcreationerror,*webglcontextlost,*webglcontextrestored",
"[HTMLElement]^[Element]|accessKey,autocapitalize,!autofocus,contentEditable,dir,!draggable,enterKeyHint,!hidden,!inert,innerText,inputMode,lang,nonce,*abort,*animationend,*animationiteration,*animationstart,*auxclick,*beforexrselect,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*formdata,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*paste,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerrawupdate,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*securitypolicyviolation,*seeked,*seeking,*select,*selectionchange,*selectstart,*slotchange,*stalled,*submit,*suspend,*timeupdate,*toggle,*transitioncancel,*transitionend,*transitionrun,*transitionstart,*volumechange,*waiting,*webkitanimationend,*webkitanimationiteration,*webkitanimationstart,*webkittransitionend,*wheel,outerText,!spellcheck,%style,#tabIndex,title,!translate,virtualKeyboardPolicy",
"abbr,address,article,aside,b,bdi,bdo,cite,content,code,dd,dfn,dt,em,figcaption,figure,footer,header,hgroup,i,kbd,main,mark,nav,noscript,rb,rp,rt,rtc,ruby,s,samp,search,section,small,strong,sub,sup,u,var,wbr^[HTMLElement]|accessKey,autocapitalize,!autofocus,contentEditable,dir,!draggable,enterKeyHint,!hidden,innerText,inputMode,lang,nonce,*abort,*animationend,*animationiteration,*animationstart,*auxclick,*beforexrselect,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*formdata,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*paste,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerrawupdate,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*securitypolicyviolation,*seeked,*seeking,*select,*selectionchange,*selectstart,*slotchange,*stalled,*submit,*suspend,*timeupdate,*toggle,*transitioncancel,*transitionend,*transitionrun,*transitionstart,*volumechange,*waiting,*webkitanimationend,*webkitanimationiteration,*webkitanimationstart,*webkittransitionend,*wheel,outerText,!spellcheck,%style,#tabIndex,title,!translate,virtualKeyboardPolicy",
"media^[HTMLElement]|!autoplay,!controls,%controlsList,%crossOrigin,#currentTime,!defaultMuted,#defaultPlaybackRate,!disableRemotePlayback,!loop,!muted,*encrypted,*waitingforkey,#playbackRate,preload,!preservesPitch,src,%srcObject,#volume",
":svg:^[HTMLElement]|!autofocus,nonce,*abort,*animationend,*animationiteration,*animationstart,*auxclick,*beforexrselect,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*formdata,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*paste,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerrawupdate,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*securitypolicyviolation,*seeked,*seeking,*select,*selectionchange,*selectstart,*slotchange,*stalled,*submit,*suspend,*timeupdate,*toggle,*transitioncancel,*transitionend,*transitionrun,*transitionstart,*volumechange,*waiting,*webkitanimationend,*webkitanimationiteration,*webkitanimationstart,*webkittransitionend,*wheel,%style,#tabIndex",
":svg:graphics^:svg:|",
":svg:animation^:svg:|*begin,*end,*repeat",
":svg:geometry^:svg:|",
":svg:componentTransferFunction^:svg:|",
":svg:gradient^:svg:|",
":svg:textContent^:svg:graphics|",
":svg:textPositioning^:svg:textContent|",
"a^[HTMLElement]|charset,coords,download,hash,host,hostname,href,hreflang,name,password,pathname,ping,port,protocol,referrerPolicy,rel,%relList,rev,search,shape,target,text,type,username",
"area^[HTMLElement]|alt,coords,download,hash,host,hostname,href,!noHref,password,pathname,ping,port,protocol,referrerPolicy,rel,%relList,search,shape,target,username",
"audio^media|",
"br^[HTMLElement]|clear",
"base^[HTMLElement]|href,target",
"body^[HTMLElement]|aLink,background,bgColor,link,*afterprint,*beforeprint,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*messageerror,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,text,vLink",
"button^[HTMLElement]|!disabled,formAction,formEnctype,formMethod,!formNoValidate,formTarget,name,type,value",
"canvas^[HTMLElement]|#height,#width",
"content^[HTMLElement]|select",
"dl^[HTMLElement]|!compact",
"data^[HTMLElement]|value",
"datalist^[HTMLElement]|",
"details^[HTMLElement]|!open",
"dialog^[HTMLElement]|!open,returnValue",
"dir^[HTMLElement]|!compact",
"div^[HTMLElement]|align",
"embed^[HTMLElement]|align,height,name,src,type,width",
"fieldset^[HTMLElement]|!disabled,name",
"font^[HTMLElement]|color,face,size",
"form^[HTMLElement]|acceptCharset,action,autocomplete,encoding,enctype,method,name,!noValidate,target",
"frame^[HTMLElement]|frameBorder,longDesc,marginHeight,marginWidth,name,!noResize,scrolling,src",
"frameset^[HTMLElement]|cols,*afterprint,*beforeprint,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*messageerror,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,rows",
"hr^[HTMLElement]|align,color,!noShade,size,width",
"head^[HTMLElement]|",
"h1,h2,h3,h4,h5,h6^[HTMLElement]|align",
"html^[HTMLElement]|version",
"iframe^[HTMLElement]|align,allow,!allowFullscreen,!allowPaymentRequest,csp,frameBorder,height,loading,longDesc,marginHeight,marginWidth,name,referrerPolicy,%sandbox,scrolling,src,srcdoc,width",
"img^[HTMLElement]|align,alt,border,%crossOrigin,decoding,#height,#hspace,!isMap,loading,longDesc,lowsrc,name,referrerPolicy,sizes,src,srcset,useMap,#vspace,#width",
"input^[HTMLElement]|accept,align,alt,autocomplete,!checked,!defaultChecked,defaultValue,dirName,!disabled,%files,formAction,formEnctype,formMethod,!formNoValidate,formTarget,#height,!incremental,!indeterminate,max,#maxLength,min,#minLength,!multiple,name,pattern,placeholder,!readOnly,!required,selectionDirection,#selectionEnd,#selectionStart,#size,src,step,type,useMap,value,%valueAsDate,#valueAsNumber,#width",
"li^[HTMLElement]|type,#value",
"label^[HTMLElement]|htmlFor",
"legend^[HTMLElement]|align",
"link^[HTMLElement]|as,charset,%crossOrigin,!disabled,href,hreflang,imageSizes,imageSrcset,integrity,media,referrerPolicy,rel,%relList,rev,%sizes,target,type",
"map^[HTMLElement]|name",
"marquee^[HTMLElement]|behavior,bgColor,direction,height,#hspace,#loop,#scrollAmount,#scrollDelay,!trueSpeed,#vspace,width",
"menu^[HTMLElement]|!compact",
"meta^[HTMLElement]|content,httpEquiv,media,name,scheme",
"meter^[HTMLElement]|#high,#low,#max,#min,#optimum,#value",
"ins,del^[HTMLElement]|cite,dateTime",
"ol^[HTMLElement]|!compact,!reversed,#start,type",
"object^[HTMLElement]|align,archive,border,code,codeBase,codeType,data,!declare,height,#hspace,name,standby,type,useMap,#vspace,width",
"optgroup^[HTMLElement]|!disabled,label",
"option^[HTMLElement]|!defaultSelected,!disabled,label,!selected,text,value",
"output^[HTMLElement]|defaultValue,%htmlFor,name,value",
"p^[HTMLElement]|align",
"param^[HTMLElement]|name,type,value,valueType",
"picture^[HTMLElement]|",
"pre^[HTMLElement]|#width",
"progress^[HTMLElement]|#max,#value",
"q,blockquote,cite^[HTMLElement]|",
"script^[HTMLElement]|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,!noModule,%referrerPolicy,src,text,type",
"select^[HTMLElement]|autocomplete,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value",
"selectedcontent^[HTMLElement]|",
"slot^[HTMLElement]|name",
"source^[HTMLElement]|#height,media,sizes,src,srcset,type,#width",
"span^[HTMLElement]|",
"style^[HTMLElement]|!disabled,media,type",
"search^[HTMLELement]|",
"caption^[HTMLElement]|align",
"th,td^[HTMLElement]|abbr,align,axis,bgColor,ch,chOff,#colSpan,headers,height,!noWrap,#rowSpan,scope,vAlign,width",
"col,colgroup^[HTMLElement]|align,ch,chOff,#span,vAlign,width",
"table^[HTMLElement]|align,bgColor,border,%caption,cellPadding,cellSpacing,frame,rules,summary,%tFoot,%tHead,width",
"tr^[HTMLElement]|align,bgColor,ch,chOff,vAlign",
"tfoot,thead,tbody^[HTMLElement]|align,ch,chOff,vAlign",
"template^[HTMLElement]|",
"textarea^[HTMLElement]|autocomplete,#cols,defaultValue,dirName,!disabled,#maxLength,#minLength,name,placeholder,!readOnly,!required,#rows,selectionDirection,#selectionEnd,#selectionStart,value,wrap",
"time^[HTMLElement]|dateTime",
"title^[HTMLElement]|text",
"track^[HTMLElement]|!default,kind,label,src,srclang",
"ul^[HTMLElement]|!compact,type",
"unknown^[HTMLElement]|",
"video^media|!disablePictureInPicture,#height,*enterpictureinpicture,*leavepictureinpicture,!playsInline,poster,#width",
":svg:a^:svg:graphics|",
":svg:animate^:svg:animation|",
":svg:animateMotion^:svg:animation|",
":svg:animateTransform^:svg:animation|",
":svg:circle^:svg:geometry|",
":svg:clipPath^:svg:graphics|",
":svg:defs^:svg:graphics|",
":svg:desc^:svg:|",
":svg:discard^:svg:|",
":svg:ellipse^:svg:geometry|",
":svg:feBlend^:svg:|",
":svg:feColorMatrix^:svg:|",
":svg:feComponentTransfer^:svg:|",
":svg:feComposite^:svg:|",
":svg:feConvolveMatrix^:svg:|",
":svg:feDiffuseLighting^:svg:|",
":svg:feDisplacementMap^:svg:|",
":svg:feDistantLight^:svg:|",
":svg:feDropShadow^:svg:|",
":svg:feFlood^:svg:|",
":svg:feFuncA^:svg:componentTransferFunction|",
":svg:feFuncB^:svg:componentTransferFunction|",
":svg:feFuncG^:svg:componentTransferFunction|",
":svg:feFuncR^:svg:componentTransferFunction|",
":svg:feGaussianBlur^:svg:|",
":svg:feImage^:svg:|",
":svg:feMerge^:svg:|",
":svg:feMergeNode^:svg:|",
":svg:feMorphology^:svg:|",
":svg:feOffset^:svg:|",
":svg:fePointLight^:svg:|",
":svg:feSpecularLighting^:svg:|",
":svg:feSpotLight^:svg:|",
":svg:feTile^:svg:|",
":svg:feTurbulence^:svg:|",
":svg:filter^:svg:|",
":svg:foreignObject^:svg:graphics|",
":svg:g^:svg:graphics|",
":svg:image^:svg:graphics|decoding",
":svg:line^:svg:geometry|",
":svg:linearGradient^:svg:gradient|",
":svg:mpath^:svg:|",
":svg:marker^:svg:|",
":svg:mask^:svg:|",
":svg:metadata^:svg:|",
":svg:path^:svg:geometry|",
":svg:pattern^:svg:|",
":svg:polygon^:svg:geometry|",
":svg:polyline^:svg:geometry|",
":svg:radialGradient^:svg:gradient|",
":svg:rect^:svg:geometry|",
":svg:svg^:svg:graphics|#currentScale,#zoomAndPan",
":svg:script^:svg:|type",
":svg:set^:svg:animation|",
":svg:stop^:svg:|",
":svg:style^:svg:|!disabled,media,title,type",
":svg:switch^:svg:graphics|",
":svg:symbol^:svg:|",
":svg:tspan^:svg:textPositioning|",
":svg:text^:svg:textPositioning|",
":svg:textPath^:svg:textContent|",
":svg:title^:svg:|",
":svg:use^:svg:graphics|",
":svg:view^:svg:|#zoomAndPan",
"data^[HTMLElement]|value",
"keygen^[HTMLElement]|!autofocus,challenge,!disabled,form,keytype,name",
"menuitem^[HTMLElement]|type,label,icon,!disabled,!checked,radiogroup,!default",
"summary^[HTMLElement]|",
"time^[HTMLElement]|dateTime",
":svg:cursor^:svg:|",
":math:^[HTMLElement]|!autofocus,nonce,*abort,*animationend,*animationiteration,*animationstart,*auxclick,*beforeinput,*beforematch,*beforetoggle,*beforexrselect,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contentvisibilityautostatechange,*contextlost,*contextmenu,*contextrestored,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*formdata,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*paste,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerrawupdate,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*scrollend,*securitypolicyviolation,*seeked,*seeking,*select,*selectionchange,*selectstart,*slotchange,*stalled,*submit,*suspend,*timeupdate,*toggle,*transitioncancel,*transitionend,*transitionrun,*transitionstart,*volumechange,*waiting,*webkitanimationend,*webkitanimationiteration,*webkitanimationstart,*webkittransitionend,*wheel,%style,#tabIndex",
":math:math^:math:|",
":math:maction^:math:|",
":math:menclose^:math:|",
":math:merror^:math:|",
":math:mfenced^:math:|",
":math:mfrac^:math:|",
":math:mi^:math:|",
":math:mmultiscripts^:math:|",
":math:mn^:math:|",
":math:mo^:math:|",
":math:mover^:math:|",
":math:mpadded^:math:|",
":math:mphantom^:math:|",
":math:mroot^:math:|",
":math:mrow^:math:|",
":math:ms^:math:|",
":math:mspace^:math:|",
":math:msqrt^:math:|",
":math:mstyle^:math:|",
":math:msub^:math:|",
":math:msubsup^:math:|",
":math:msup^:math:|",
":math:mtable^:math:|",
":math:mtd^:math:|",
":math:mtext^:math:|",
":math:mtr^:math:|",
":math:munder^:math:|",
":math:munderover^:math:|",
":math:semantics^:math:|"
];
const _ATTR_TO_PROP = new Map(Object.entries({
"class": "className",
"for": "htmlFor",
"formaction": "formAction",
"innerHtml": "innerHTML",
"readonly": "readOnly",
"tabindex": "tabIndex",
"aria-activedescendant": "ariaActiveDescendantElement",
"aria-atomic": "ariaAtomic",
"aria-autocomplete": "ariaAutoComplete",
"aria-busy": "ariaBusy",
"aria-checked": "ariaChecked",
"aria-colcount": "ariaColCount",
"aria-colindex": "ariaColIndex",
"aria-colindextext": "ariaColIndexText",
"aria-colspan": "ariaColSpan",
"aria-controls": "ariaControlsElements",
"aria-current": "ariaCurrent",
"aria-describedby": "ariaDescribedByElements",
"aria-description": "ariaDescription",
"aria-details": "ariaDetailsElements",
"aria-disabled": "ariaDisabled",
"aria-errormessage": "ariaErrorMessageElements",
"aria-expanded": "ariaExpanded",
"aria-flowto": "ariaFlowToElements",
"aria-haspopup": "ariaHasPopup",
"aria-hidden": "ariaHidden",
"aria-invalid": "ariaInvalid",
"aria-keyshortcuts": "ariaKeyShortcuts",
"aria-label": "ariaLabel",
"aria-labelledby": "ariaLabelledByElements",
"aria-level": "ariaLevel",
"aria-live": "ariaLive",
"aria-modal": "ariaModal",
"aria-multiline": "ariaMultiLine",
"aria-multiselectable": "ariaMultiSelectable",
"aria-orientation": "ariaOrientation",
"aria-owns": "ariaOwnsElements",
"aria-placeholder": "ariaPlaceholder",
"aria-posinset": "ariaPosInSet",
"aria-pressed": "ariaPressed",
"aria-readonly": "ariaReadOnly",
"aria-required": "ariaRequired",
"aria-roledescription": "ariaRoleDescription",
"aria-rowcount": "ariaRowCount",
"aria-rowindex": "ariaRowIndex",
"aria-rowindextext": "ariaRowIndexText",
"aria-rowspan": "ariaRowSpan",
"aria-selected": "ariaSelected",
"aria-setsize": "ariaSetSize",
"aria-sort": "ariaSort",
"aria-valuemax": "ariaValueMax",
"aria-valuemin": "ariaValueMin",
"aria-valuenow": "ariaValueNow",
"aria-valuetext": "ariaValueText"
}));
const _PROP_TO_ATTR = Array.from(_ATTR_TO_PROP).reduce((inverted, [propertyName, attributeName]) => {
inverted.set(propertyName, attributeName);
return inverted;
}, /* @__PURE__ */ new Map());
var DomElementSchemaRegistry = class extends ElementSchemaRegistry {
constructor() {
super();
this._schema = /* @__PURE__ */ new Map();
this._eventSchema = /* @__PURE__ */ new Map();
SCHEMA.forEach((encodedType) => {
const type = /* @__PURE__ */ new Map();
const events = /* @__PURE__ */ new Set();
const [strType, strProperties] = encodedType.split("|");
const properties = strProperties.split(",");
const [typeNames, superName] = strType.split("^");
typeNames.split(",").forEach((tag) => {
this._schema.set(tag.toLowerCase(), type);
this._eventSchema.set(tag.toLowerCase(), events);
});
const superType = superName && this._schema.get(superName.toLowerCase());
if (superType) {
for (const [prop, value] of superType) type.set(prop, value);
for (const superEvent of this._eventSchema.get(superName.toLowerCase())) events.add(superEvent);
}
properties.forEach((property) => {
if (property.length > 0) switch (property[0]) {
case "*":
events.add(property.substring(1));
break;
case "!":
type.set(property.substring(1), BOOLEAN);
break;
case "#":
type.set(property.substring(1), NUMBER);
break;
case "%":
type.set(property.substring(1), OBJECT);
break;
default: type.set(property, STRING);
}
});
});
}
hasProperty(tagName, propName, schemaMetas) {
if (schemaMetas.some((schema) => schema.name === NO_ERRORS_SCHEMA.name)) return true;
if (tagName.indexOf("-") > -1) {
if (isNgContainer(tagName) || isNgContent(tagName)) return false;
if (schemaMetas.some((schema) => schema.name === CUSTOM_ELEMENTS_SCHEMA.name)) return true;
}
return (this._schema.get(tagName.toLowerCase()) || this._schema.get("unknown")).has(propName);
}
hasElement(tagName, schemaMetas) {
if (schemaMetas.some((schema) => schema.name === NO_ERRORS_SCHEMA.name)) return true;
if (tagName.indexOf("-") > -1) {
if (isNgContainer(tagName) || isNgContent(tagName)) return true;
if (schemaMetas.some((schema) => schema.name === CUSTOM_ELEMENTS_SCHEMA.name)) return true;
}
return this._schema.has(tagName.toLowerCase());
}
/**
* securityContext returns the security context for the given property on the given DOM tag.
*
* Tag and property name are statically known and cannot change at runtime, i.e. it is not
* possible to bind a value into a changing attribute or tag name.
*
* The filtering is based on a list of allowed tags|attributes. All attributes in the schema
* above are assumed to have the 'NONE' security context, i.e. that they are safe inert
* string values. Only specific well known attack vectors are assigned their appropriate context.
*/
securityContext(tagName, propName, isAttribute) {
if (isAttribute) propName = this.getMappedPropName(propName);
tagName = tagName.toLowerCase();
propName = propName.toLowerCase();
let ctx = SECURITY_SCHEMA()[tagName + "|" + propName];
if (ctx) return ctx;
ctx = SECURITY_SCHEMA()["*|" + propName];
return ctx ? ctx : SecurityContext.NONE;
}
getMappedPropName(propName) {
return _ATTR_TO_PROP.get(propName) ?? propName;
}
getDefaultComponentElementName() {
return "ng-component";
}
validateProperty(name) {
if (name.toLowerCase().startsWith("on")) return {
error: true,
msg: `Binding to event property '${name}' is disallowed for security reasons, please use (${name.slice(2)})=...\nIf '${name}' is a directive input, make sure the directive is imported by the current module.`
};
else return { error: false };
}
validateAttribute(name) {
if (name.toLowerCase().startsWith("on")) return {
error: true,
msg: `Binding to event attribute '${name}' is disallowed for security reasons, please use (${name.slice(2)})=...`
};
else return { error: false };
}
allKnownElementNames() {
return Array.from(this._schema.keys());
}
allKnownAttributesOfElement(tagName) {
const elementProperties = this._schema.get(tagName.toLowerCase()) || this._schema.get("unknown");
return Array.from(elementProperties.keys()).map((prop) => _PROP_TO_ATTR.get(prop) ?? prop);
}
allKnownEventsOfElement(tagName) {
return Array.from(this._eventSchema.get(tagName.toLowerCase()) ?? []);
}
normalizeAnimationStyleProperty(propName) {
return dashCaseToCamelCase(propName);
}
normalizeAnimationStyleValue(camelCaseProp, userProvidedProp, val) {
let unit = "";
const strVal = val.toString().trim();
let errorMsg = null;
if (_isPixelDimensionStyle(camelCaseProp) && val !== 0 && val !== "0") if (typeof val === "number") unit = "px";
else {
const valAndSuffixMatch = val.match(/^[+-]?[\d\.]+([a-z]*)$/);
if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) errorMsg = `Please provide a CSS unit value for ${userProvidedProp}:${val}`;
}
return {
error: errorMsg,
value: strVal + unit
};
}
};
function _isPixelDimensionStyle(prop) {
switch (prop) {
case "width":
case "height":
case "minWidth":
case "minHeight":
case "maxWidth":
case "maxHeight":
case "left":
case "top":
case "bottom":
case "right":
case "fontSize":
case "outlineWidth":
case "outlineOffset":
case "paddingTop":
case "paddingLeft":
case "paddingBottom":
case "paddingRight":
case "marginTop":
case "marginLeft":
case "marginBottom":
case "marginRight":
case "borderRadius":
case "borderWidth":
case "borderTopWidth":
case "borderLeftWidth":
case "borderRightWidth":
case "borderBottomWidth":
case "textIndent": return true;
default: return false;
}
}
//#endregion
export { DomElementSchemaRegistry };
import { SecurityContext } from "../core.mjs";
//#region ../compiler/src/schema/dom_security_schema.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/** Map from tagName|propertyName to SecurityContext. Properties applying to all tags use '*'. */
let _SECURITY_SCHEMA;
function SECURITY_SCHEMA() {
if (!_SECURITY_SCHEMA) {
_SECURITY_SCHEMA = {};
registerContext(SecurityContext.HTML, [
"iframe|srcdoc",
"*|innerHTML",
"*|outerHTML"
]);
registerContext(SecurityContext.STYLE, ["*|style"]);
registerContext(SecurityContext.URL, [
"*|formAction",
"area|href",
"area|ping",
"audio|src",
"a|href",
"a|ping",
"blockquote|cite",
"body|background",
"del|cite",
"form|action",
"img|src",
"input|src",
"ins|cite",
"q|cite",
"source|src",
"track|src",
"video|poster",
"video|src"
]);
registerContext(SecurityContext.RESOURCE_URL, [
"applet|code",
"applet|codebase",
"base|href",
"embed|src",
"frame|src",
"head|profile",
"html|manifest",
"iframe|src",
"link|href",
"media|src",
"object|codebase",
"object|data",
"script|src"
]);
}
return _SECURITY_SCHEMA;
}
function registerContext(ctx, specs) {
for (const spec of specs) _SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
}
//#endregion
export { SECURITY_SCHEMA };
//#region ../compiler/src/schema/element_schema_registry.ts
var ElementSchemaRegistry = class {};
//#endregion
export { ElementSchemaRegistry };
//#region ../compiler/src/util.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
const DASH_CASE_REGEXP = /-+([a-z0-9])/g;
function dashCaseToCamelCase(input) {
return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
}
//#endregion
export { dashCaseToCamelCase };
import { TagContentType } from "./compiler/src/ml_parser/tags.mjs";
import { ParseLocation, ParseSourceFile, ParseSourceSpan } from "./compiler/src/parse_util.mjs";
import { RecursiveVisitor, ast_d_exports, visitAll } from "./compiler/src/ml_parser/ast.mjs";
import { ParseTreeResult } from "./compiler/src/ml_parser/parser.mjs";
import { getHtmlTagDefinition } from "./compiler/src/ml_parser/html_tags.mjs";
//#region src/index.d.ts
interface ParseOptions {
/**
* any element can self close
*
* defaults to false
*/
canSelfClose?: boolean;
/**
* support [`htm`](https://github.com/developit/htm) component closing tags (`<//>`)
*
* defaults to false
*/
allowHtmComponentClosingTags?: boolean;
/**
* do not lowercase tag names before querying their tag definitions
*
* defaults to false
*/
isTagNameCaseSensitive?: boolean;
/**
* customize tag content type
*
* defaults to the content type defined in the HTML spec
*/
getTagContentType?: (tagName: string, prefix: string, hasParent: boolean, attrs: Array<{
prefix: string;
name: string;
value?: string;
}>) => void | TagContentType;
/**
* tokenize angular control flow block syntax
*/
tokenizeAngularBlocks?: boolean;
/**
* tokenize angular let declaration syntax
*/
tokenizeAngularLetDeclaration?: boolean;
/**
* enable angular selectorless syntax
*/
enableAngularSelectorlessSyntax?: boolean;
}
declare function parse(input: string, options?: ParseOptions): ParseTreeResult;
//#endregion
export { type ast_d_exports as Ast, ParseLocation, ParseOptions, ParseSourceFile, ParseSourceSpan, type ParseTreeResult, RecursiveVisitor, TagContentType, getHtmlTagDefinition, parse, visitAll };
import { TagContentType } from "./compiler/src/ml_parser/tags.mjs";
import { getHtmlTagDefinition } from "./compiler/src/ml_parser/html_tags.mjs";
import { ParseLocation, ParseSourceFile, ParseSourceSpan } from "./compiler/src/parse_util.mjs";
import { RecursiveVisitor, visitAll } from "./compiler/src/ml_parser/ast.mjs";
import { HtmlParser } from "./compiler/src/ml_parser/html_parser.mjs";
//#region src/index.ts
let parser = null;
const getParser = () => {
if (!parser) parser = new HtmlParser();
return parser;
};
function parse(input, options = {}) {
const { canSelfClose = false, allowHtmComponentClosingTags = false, isTagNameCaseSensitive = false, getTagContentType, tokenizeAngularBlocks = false, tokenizeAngularLetDeclaration = false, enableAngularSelectorlessSyntax = false } = options;
return getParser().parse(input, "angular-html-parser", {
tokenizeExpansionForms: tokenizeAngularBlocks,
canSelfClose,
allowHtmComponentClosingTags,
tokenizeBlocks: tokenizeAngularBlocks,
tokenizeLet: tokenizeAngularLetDeclaration,
selectorlessEnabled: enableAngularSelectorlessSyntax
}, isTagNameCaseSensitive, getTagContentType);
}
//#endregion
export { ParseLocation, ParseSourceFile, ParseSourceSpan, RecursiveVisitor, TagContentType, getHtmlTagDefinition, parse, visitAll };
+7
-7
{
"name": "angular-html-parser",
"version": "10.0.0",
"version": "10.1.0",
"description": "A HTML parser extracted from Angular with some modifications",

@@ -22,3 +22,3 @@ "repository": "https://github.com/prettier/angular-html-parser/blob/HEAD/packages/angular-html-parser",

"prepublish": "yarn run build",
"build": "tsdown",
"build": "tsdown --unbundle",
"test": "vitest",

@@ -30,10 +30,10 @@ "release": "release-it",

"devDependencies": {
"@types/node": "24.7.1",
"@vitest/coverage-v8": "3.2.4",
"@types/node": "24.10.1",
"@vitest/coverage-v8": "4.0.12",
"prettier": "3.6.2",
"release-it": "19.0.5",
"release-it": "19.0.6",
"tsconfig-paths": "4.2.0",
"tsdown": "0.15.6",
"tsdown": "0.16.6",
"typescript": "5.9.3",
"vitest": "3.2.4"
"vitest": "4.0.12"
},

@@ -40,0 +40,0 @@ "engines": {

//#endregion
//#region ../compiler/src/ml_parser/tags.d.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
declare enum TagContentType {
RAW_TEXT = 0,
ESCAPABLE_RAW_TEXT = 1,
PARSABLE_DATA = 2,
}
interface TagDefinition {
closedByParent: boolean;
implicitNamespacePrefix: string | null;
isVoid: boolean;
ignoreFirstLf: boolean;
canSelfClose: boolean;
preventNamespaceInheritance: boolean;
isClosedByChild(name: string): boolean;
getContentType(prefix?: string): TagContentType;
}
//#endregion
//#region ../compiler/src/parse_util.d.ts
declare class ParseLocation {
file: ParseSourceFile;
offset: number;
line: number;
col: number;
constructor(file: ParseSourceFile, offset: number, line: number, col: number);
toString(): string;
moveBy(delta: number): ParseLocation;
getContext(maxChars: number, maxLines: number): {
before: string;
after: string;
} | null;
}
declare class ParseSourceFile {
content: string;
url: string;
constructor(content: string, url: string);
}
declare class ParseSourceSpan {
start: ParseLocation;
end: ParseLocation;
fullStart: ParseLocation;
details: string | null;
/**
* Create an object that holds information about spans of tokens/nodes captured during
* lexing/parsing of text.
*
* @param start
* The location of the start of the span (having skipped leading trivia).
* Skipping leading trivia makes source-spans more "user friendly", since things like HTML
* elements will appear to begin at the start of the opening tag, rather than at the start of any
* leading trivia, which could include newlines.
*
* @param end
* The location of the end of the span.
*
* @param fullStart
* The start of the token without skipping the leading trivia.
* This is used by tooling that splits tokens further, such as extracting Angular interpolations
* from text tokens. Such tooling creates new source-spans relative to the original token's
* source-span. If leading trivia characters have been skipped then the new source-spans may be
* incorrectly offset.
*
* @param details
* Additional information (such as identifier names) that should be associated with the span.
*/
constructor(start: ParseLocation, end: ParseLocation, fullStart?: ParseLocation, details?: string | null);
toString(): string;
}
declare enum ParseErrorLevel {
WARNING = 0,
ERROR = 1,
}
declare class ParseError extends Error {
/** Location of the error. */
readonly span: ParseSourceSpan;
/** Error message. */
readonly msg: string;
/** Severity level of the error. */
readonly level: ParseErrorLevel;
/**
* Error that caused the error to be surfaced. For example, an error in a sub-expression that
* couldn't be parsed. Not guaranteed to be defined, but can be used to provide more context.
*/
readonly relatedError?: unknown;
constructor(/** Location of the error. */
span: ParseSourceSpan, /** Error message. */
msg: string, /** Severity level of the error. */
level?: ParseErrorLevel,
/**
* Error that caused the error to be surfaced. For example, an error in a sub-expression that
* couldn't be parsed. Not guaranteed to be defined, but can be used to provide more context.
*/
relatedError?: unknown);
contextualMessage(): string;
toString(): string;
}
//#endregion
//#region ../compiler/src/i18n/i18n_ast.d.ts
/**
* Describes the text contents of a placeholder as it appears in an ICU expression, including its
* source span information.
*/
interface MessagePlaceholder {
/** The text contents of the placeholder */
text: string;
/** The source span of the placeholder */
sourceSpan: ParseSourceSpan;
}
declare class Message {
nodes: Node$1[];
placeholders: {
[phName: string]: MessagePlaceholder;
};
placeholderToMessage: {
[phName: string]: Message;
};
meaning: string;
description: string;
customId: string;
sources: MessageSpan[];
id: string;
/** The ids to use if there are no custom id and if `i18nLegacyMessageIdFormat` is not empty */
legacyIds: string[];
messageString: string;
/**
* @param nodes message AST
* @param placeholders maps placeholder names to static content and their source spans
* @param placeholderToMessage maps placeholder names to messages (used for nested ICU messages)
* @param meaning
* @param description
* @param customId
*/
constructor(nodes: Node$1[], placeholders: {
[phName: string]: MessagePlaceholder;
}, placeholderToMessage: {
[phName: string]: Message;
}, meaning: string, description: string, customId: string);
}
interface MessageSpan {
filePath: string;
startLine: number;
startCol: number;
endLine: number;
endCol: number;
}
interface Node$1 {
sourceSpan: ParseSourceSpan;
visit(visitor: Visitor$1, context?: any): any;
}
declare class Text$1 implements Node$1 {
value: string;
sourceSpan: ParseSourceSpan;
constructor(value: string, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor$1, context?: any): any;
}
declare class Container implements Node$1 {
children: Node$1[];
sourceSpan: ParseSourceSpan;
constructor(children: Node$1[], sourceSpan: ParseSourceSpan);
visit(visitor: Visitor$1, context?: any): any;
}
declare class Icu implements Node$1 {
expression: string;
type: string;
cases: {
[k: string]: Node$1;
};
sourceSpan: ParseSourceSpan;
expressionPlaceholder?: string;
constructor(expression: string, type: string, cases: {
[k: string]: Node$1;
}, sourceSpan: ParseSourceSpan, expressionPlaceholder?: string);
visit(visitor: Visitor$1, context?: any): any;
}
declare class TagPlaceholder implements Node$1 {
tag: string;
attrs: {
[k: string]: string;
};
startName: string;
closeName: string;
children: Node$1[];
isVoid: boolean;
sourceSpan: ParseSourceSpan;
startSourceSpan: ParseSourceSpan | null;
endSourceSpan: ParseSourceSpan | null;
constructor(tag: string, attrs: {
[k: string]: string;
}, startName: string, closeName: string, children: Node$1[], isVoid: boolean, sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan | null, endSourceSpan: ParseSourceSpan | null);
visit(visitor: Visitor$1, context?: any): any;
}
declare class Placeholder implements Node$1 {
value: string;
name: string;
sourceSpan: ParseSourceSpan;
constructor(value: string, name: string, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor$1, context?: any): any;
}
declare class IcuPlaceholder implements Node$1 {
value: Icu;
name: string;
sourceSpan: ParseSourceSpan;
/** Used to capture a message computed from a previous processing pass (see `setI18nRefs()`). */
previousMessage?: Message;
constructor(value: Icu, name: string, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor$1, context?: any): any;
}
declare class BlockPlaceholder implements Node$1 {
name: string;
parameters: string[];
startName: string;
closeName: string;
children: Node$1[];
sourceSpan: ParseSourceSpan;
startSourceSpan: ParseSourceSpan | null;
endSourceSpan: ParseSourceSpan | null;
constructor(name: string, parameters: string[], startName: string, closeName: string, children: Node$1[], sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan | null, endSourceSpan: ParseSourceSpan | null);
visit(visitor: Visitor$1, context?: any): any;
}
/**
* Each HTML node that is affect by an i18n tag will also have an `i18n` property that is of type
* `I18nMeta`.
* This information is either a `Message`, which indicates it is the root of an i18n message, or a
* `Node`, which indicates is it part of a containing `Message`.
*/
type I18nMeta = Message | Node$1;
interface Visitor$1 {
visitText(text: Text$1, context?: any): any;
visitContainer(container: Container, context?: any): any;
visitIcu(icu: Icu, context?: any): any;
visitTagPlaceholder(ph: TagPlaceholder, context?: any): any;
visitPlaceholder(ph: Placeholder, context?: any): any;
visitIcuPlaceholder(ph: IcuPlaceholder, context?: any): any;
visitBlockPlaceholder(ph: BlockPlaceholder, context?: any): any;
}
//#endregion
//#region ../compiler/src/ml_parser/tokens.d.ts
declare const enum TokenType {
TAG_OPEN_START = 0,
TAG_OPEN_END = 1,
TAG_OPEN_END_VOID = 2,
TAG_CLOSE = 3,
INCOMPLETE_TAG_OPEN = 4,
TEXT = 5,
ESCAPABLE_RAW_TEXT = 6,
RAW_TEXT = 7,
INTERPOLATION = 8,
ENCODED_ENTITY = 9,
COMMENT_START = 10,
COMMENT_END = 11,
CDATA_START = 12,
CDATA_END = 13,
ATTR_NAME = 14,
ATTR_QUOTE = 15,
ATTR_VALUE_TEXT = 16,
ATTR_VALUE_INTERPOLATION = 17,
DOC_TYPE_START = 18,
DOC_TYPE_END = 19,
EXPANSION_FORM_START = 20,
EXPANSION_CASE_VALUE = 21,
EXPANSION_CASE_EXP_START = 22,
EXPANSION_CASE_EXP_END = 23,
EXPANSION_FORM_END = 24,
BLOCK_OPEN_START = 25,
BLOCK_OPEN_END = 26,
BLOCK_CLOSE = 27,
BLOCK_PARAMETER = 28,
INCOMPLETE_BLOCK_OPEN = 29,
LET_START = 30,
LET_VALUE = 31,
LET_END = 32,
INCOMPLETE_LET = 33,
COMPONENT_OPEN_START = 34,
COMPONENT_OPEN_END = 35,
COMPONENT_OPEN_END_VOID = 36,
COMPONENT_CLOSE = 37,
INCOMPLETE_COMPONENT_OPEN = 38,
DIRECTIVE_NAME = 39,
DIRECTIVE_OPEN = 40,
DIRECTIVE_CLOSE = 41,
EOF = 42,
}
type InterpolatedTextToken = TextToken | InterpolationToken | EncodedEntityToken;
type InterpolatedAttributeToken = AttributeValueTextToken | AttributeValueInterpolationToken | EncodedEntityToken;
interface TokenBase {
type: TokenType;
parts: string[];
sourceSpan: ParseSourceSpan;
}
interface TextToken extends TokenBase {
type: TokenType.TEXT | TokenType.ESCAPABLE_RAW_TEXT | TokenType.RAW_TEXT;
parts: [text: string];
}
interface InterpolationToken extends TokenBase {
type: TokenType.INTERPOLATION;
parts: [startMarker: string, expression: string, endMarker: string] | [startMarker: string, expression: string];
}
interface EncodedEntityToken extends TokenBase {
type: TokenType.ENCODED_ENTITY;
parts: [decoded: string, encoded: string];
}
interface AttributeValueTextToken extends TokenBase {
type: TokenType.ATTR_VALUE_TEXT;
parts: [value: string];
}
interface AttributeValueInterpolationToken extends TokenBase {
type: TokenType.ATTR_VALUE_INTERPOLATION;
parts: [startMarker: string, expression: string, endMarker: string] | [startMarker: string, expression: string];
}
declare namespace ast_d_exports {
export { Attribute, Block, BlockParameter, CDATA, Comment, Component, Directive, DocType, Element, Expansion, ExpansionCase, LetDeclaration, Node, NodeWithI18n, RecursiveVisitor, Text, Visitor, visitAll };
}
interface BaseNode {
sourceSpan: ParseSourceSpan;
visit(visitor: Visitor, context: any): any;
}
type Node = Attribute | CDATA | Comment | DocType | Element | Expansion | ExpansionCase | Text | Block | BlockParameter | LetDeclaration | Component | Directive;
declare abstract class NodeWithI18n implements BaseNode {
sourceSpan: ParseSourceSpan;
i18n?: I18nMeta;
constructor(sourceSpan: ParseSourceSpan, i18n?: I18nMeta);
abstract visit(visitor: Visitor, context: any): any;
}
declare class Text extends NodeWithI18n {
value: string;
tokens: InterpolatedTextToken[];
constructor(value: string, sourceSpan: ParseSourceSpan, tokens: InterpolatedTextToken[], i18n?: I18nMeta);
visit(visitor: Visitor, context: any): any;
readonly kind = "text";
}
declare class CDATA extends NodeWithI18n {
value: string;
tokens: InterpolatedTextToken[];
constructor(value: string, sourceSpan: ParseSourceSpan, tokens: InterpolatedTextToken[], i18n?: I18nMeta);
visit(visitor: Visitor, context: any): any;
readonly kind = "cdata";
}
declare class Expansion extends NodeWithI18n {
switchValue: string;
type: string;
cases: ExpansionCase[];
switchValueSourceSpan: ParseSourceSpan;
constructor(switchValue: string, type: string, cases: ExpansionCase[], sourceSpan: ParseSourceSpan, switchValueSourceSpan: ParseSourceSpan, i18n?: I18nMeta);
visit(visitor: Visitor, context: any): any;
readonly kind = "expansion";
}
declare class ExpansionCase implements BaseNode {
value: string;
expression: Node[];
sourceSpan: ParseSourceSpan;
valueSourceSpan: ParseSourceSpan;
expSourceSpan: ParseSourceSpan;
constructor(value: string, expression: Node[], sourceSpan: ParseSourceSpan, valueSourceSpan: ParseSourceSpan, expSourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context: any): any;
readonly kind = "expansionCase";
}
declare class Attribute extends NodeWithI18n {
name: string;
value: string;
readonly keySpan: ParseSourceSpan | undefined;
valueSpan: ParseSourceSpan | undefined;
valueTokens: InterpolatedAttributeToken[] | undefined;
constructor(name: string, value: string, sourceSpan: ParseSourceSpan, keySpan: ParseSourceSpan | undefined, valueSpan: ParseSourceSpan | undefined, valueTokens: InterpolatedAttributeToken[] | undefined, i18n: I18nMeta | undefined);
visit(visitor: Visitor, context: any): any;
readonly kind = "attribute";
get nameSpan(): ParseSourceSpan;
}
declare class Element extends NodeWithI18n {
name: string;
attrs: Attribute[];
readonly directives: Directive[];
children: Node[];
readonly isSelfClosing: boolean;
startSourceSpan: ParseSourceSpan;
endSourceSpan: ParseSourceSpan | null;
nameSpan: ParseSourceSpan | null;
readonly isVoid: boolean;
constructor(name: string, attrs: Attribute[], directives: Directive[], children: Node[], isSelfClosing: boolean, sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan: ParseSourceSpan | null, nameSpan: ParseSourceSpan | null, isVoid: boolean, i18n?: I18nMeta);
visit(visitor: Visitor, context: any): any;
readonly kind = "element";
}
declare class Comment implements BaseNode {
value: string | null;
sourceSpan: ParseSourceSpan;
constructor(value: string | null, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context: any): any;
readonly kind = "comment";
}
declare class DocType implements BaseNode {
value: string | null;
sourceSpan: ParseSourceSpan;
constructor(value: string | null, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context: any): any;
readonly kind = "docType";
}
declare class Block extends NodeWithI18n {
name: string;
parameters: BlockParameter[];
children: Node[];
nameSpan: ParseSourceSpan;
startSourceSpan: ParseSourceSpan;
endSourceSpan: ParseSourceSpan | null;
constructor(name: string, parameters: BlockParameter[], children: Node[], sourceSpan: ParseSourceSpan, nameSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan?: ParseSourceSpan | null, i18n?: I18nMeta);
visit(visitor: Visitor, context: any): any;
readonly kind = "block";
}
declare class Component extends NodeWithI18n {
readonly componentName: string;
readonly tagName: string | null;
readonly fullName: string;
attrs: Attribute[];
readonly directives: Directive[];
readonly children: Node[];
readonly isSelfClosing: boolean;
readonly startSourceSpan: ParseSourceSpan;
endSourceSpan: ParseSourceSpan | null;
constructor(componentName: string, tagName: string | null, fullName: string, attrs: Attribute[], directives: Directive[], children: Node[], isSelfClosing: boolean, sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan?: ParseSourceSpan | null, i18n?: I18nMeta);
visit(visitor: Visitor, context: any): any;
readonly kind = "component";
}
declare class Directive implements BaseNode {
readonly name: string;
readonly attrs: Attribute[];
readonly sourceSpan: ParseSourceSpan;
readonly startSourceSpan: ParseSourceSpan;
readonly endSourceSpan: ParseSourceSpan | null;
constructor(name: string, attrs: Attribute[], sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan?: ParseSourceSpan | null);
visit(visitor: Visitor, context: any): any;
readonly kind = "directive";
}
declare class BlockParameter implements BaseNode {
expression: string;
sourceSpan: ParseSourceSpan;
constructor(expression: string, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context: any): any;
readonly kind = "blockParameter";
readonly startSourceSpan: null;
readonly endSourceSpan: null;
}
declare class LetDeclaration implements BaseNode {
name: string;
value: string;
sourceSpan: ParseSourceSpan;
readonly nameSpan: ParseSourceSpan;
valueSpan: ParseSourceSpan;
constructor(name: string, value: string, sourceSpan: ParseSourceSpan, nameSpan: ParseSourceSpan, valueSpan: ParseSourceSpan);
visit(visitor: Visitor, context: any): any;
readonly kind = "letDeclaration";
readonly startSourceSpan: null;
readonly endSourceSpan: null;
}
interface Visitor {
visit?(node: Node, context: any): any;
visitElement(element: Element, context: any): any;
visitAttribute(attribute: Attribute, context: any): any;
visitText(text: Text, context: any): any;
visitCdata(text: CDATA, context: any): any;
visitComment(comment: Comment, context: any): any;
visitDocType(docType: DocType, context: any): any;
visitExpansion(expansion: Expansion, context: any): any;
visitExpansionCase(expansionCase: ExpansionCase, context: any): any;
visitBlock(block: Block, context: any): any;
visitBlockParameter(parameter: BlockParameter, context: any): any;
visitLetDeclaration(decl: LetDeclaration, context: any): any;
visitComponent(component: Component, context: any): any;
visitDirective(directive: Directive, context: any): any;
}
declare function visitAll(visitor: Visitor, nodes: Node[], context?: any): any[];
declare class RecursiveVisitor implements Visitor {
constructor();
visitElement(ast: Element, context: any): any;
visitAttribute(ast: Attribute, context: any): any;
visitText(ast: Text, context: any): any;
visitCdata(ast: CDATA, context: any): any;
visitComment(ast: Comment, context: any): any;
visitDocType(ast: DocType, context: any): any;
visitExpansion(ast: Expansion, context: any): any;
visitExpansionCase(ast: ExpansionCase, context: any): any;
visitBlock(block: Block, context: any): any;
visitBlockParameter(ast: BlockParameter, context: any): any;
visitLetDeclaration(decl: LetDeclaration, context: any): void;
visitComponent(component: Component, context: any): void;
visitDirective(directive: Directive, context: any): void;
private visitChildren;
}
//#endregion
//#region ../compiler/src/ml_parser/parser.d.ts
declare class ParseTreeResult {
rootNodes: Node[];
errors: ParseError[];
constructor(rootNodes: Node[], errors: ParseError[]);
}
//#endregion
//#region ../compiler/src/ml_parser/html_tags.d.ts
declare class HtmlTagDefinition implements TagDefinition {
private closedByChildren;
private contentType;
closedByParent: boolean;
implicitNamespacePrefix: string | null;
isVoid: boolean;
ignoreFirstLf: boolean;
canSelfClose: boolean;
preventNamespaceInheritance: boolean;
constructor({
closedByChildren,
implicitNamespacePrefix,
contentType,
closedByParent,
isVoid,
ignoreFirstLf,
preventNamespaceInheritance,
canSelfClose
}?: {
closedByChildren?: string[];
closedByParent?: boolean;
implicitNamespacePrefix?: string;
contentType?: TagContentType | {
default: TagContentType;
[namespace: string]: TagContentType;
};
isVoid?: boolean;
ignoreFirstLf?: boolean;
preventNamespaceInheritance?: boolean;
canSelfClose?: boolean;
});
isClosedByChild(name: string): boolean;
getContentType(prefix?: string): TagContentType;
}
declare function getHtmlTagDefinition(tagName: string): HtmlTagDefinition;
//#endregion
//#region src/index.d.ts
interface ParseOptions {
/**
* any element can self close
*
* defaults to false
*/
canSelfClose?: boolean;
/**
* support [`htm`](https://github.com/developit/htm) component closing tags (`<//>`)
*
* defaults to false
*/
allowHtmComponentClosingTags?: boolean;
/**
* do not lowercase tag names before querying their tag definitions
*
* defaults to false
*/
isTagNameCaseSensitive?: boolean;
/**
* customize tag content type
*
* defaults to the content type defined in the HTML spec
*/
getTagContentType?: (tagName: string, prefix: string, hasParent: boolean, attrs: Array<{
prefix: string;
name: string;
value?: string;
}>) => void | TagContentType;
/**
* tokenize angular control flow block syntax
*/
tokenizeAngularBlocks?: boolean;
/**
* tokenize angular let declaration syntax
*/
tokenizeAngularLetDeclaration?: boolean;
/**
* enable angular selectorless syntax
*/
enableAngularSelectorlessSyntax?: boolean;
}
declare function parse(input: string, options?: ParseOptions): ParseTreeResult;
//#endregion
export { type ast_d_exports as Ast, ParseLocation, ParseOptions, ParseSourceFile, ParseSourceSpan, type ParseTreeResult, RecursiveVisitor, TagContentType, getHtmlTagDefinition, parse, visitAll };

Sorry, the diff of this file is too big to display