svg-eslint-parser 0.0.7 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,17 +1,11 @@
1
- import { t as __exportAll } from "./chunk-CzXV76rE.js";
1
+ import { t as __exportAll } from "./chunk-D7D4PA-g.js";
2
2
  import { unionWith } from "eslint-visitor-keys";
3
-
4
- //#region package.json
5
- var name$1 = "svg-eslint-parser";
6
- var version = "0.0.7";
7
-
8
3
  //#endregion
9
4
  //#region src/meta.ts
10
5
  const meta = {
11
- name: name$1,
12
- version
6
+ name: "svg-eslint-parser",
7
+ version: "0.2.0"
13
8
  };
14
-
15
9
  //#endregion
16
10
  //#region src/parser/error.ts
17
11
  /**
@@ -29,7 +23,6 @@ var ParseError = class extends SyntaxError {
29
23
  this.column = column;
30
24
  }
31
25
  };
32
-
33
26
  //#endregion
34
27
  //#region src/constants/parse.ts
35
28
  /**
@@ -52,23 +45,22 @@ const XML_DECLARATION_END = "?>";
52
45
  * regexp for open tag start
53
46
  * @regex101 https://regex101.com/?regex=%5E%3C%5Cw&flavor=javascript
54
47
  */
55
- const RE_OPEN_TAG_START = /^<\w/;
48
+ const RE_OPEN_TAG_START = /^<\w/u;
56
49
  /**
57
50
  * regexp for open tag name
58
51
  * @regex101 https://regex101.com/?regex=%5E%3C%28%5CS%2B%29&flavor=javascript
59
52
  */
60
- const RE_OPEN_TAG_NAME = /^<(\S+)/;
53
+ const RE_OPEN_TAG_NAME = /^<(?<tagName>\S+)/u;
61
54
  /**
62
55
  * regexp for close tag name
63
56
  * @regex101 https://regex101.com/?regex=%5E%3C%5C%2F%28%28%3F%3A.%7C%5Cr%3F%5Cn%29*%29%3E%24&flavor=javascript
64
57
  */
65
- const RE_CLOSE_TAG_NAME = /^<\/((?:.|\r?\n)*)>$/;
58
+ const RE_CLOSE_TAG_NAME = /^<\/(?<tagName>(?:.|\r?\n)*)>$/u;
66
59
  /**
67
60
  * regexp for incomplete closing tag
68
61
  * @regex101 https://regex101.com/?regex=%3C%5C%2F%5B%5E%3E%5D%2B%24&flavor=javascript
69
62
  */
70
- const RE_INCOMPLETE_CLOSING_TAG = /<\/[^>]+$/;
71
-
63
+ const RE_INCOMPLETE_CLOSING_TAG = /<\/[^>]+$/u;
72
64
  //#endregion
73
65
  //#region src/constants/nodeTypes.ts
74
66
  let NodeTypes = /* @__PURE__ */ function(NodeTypes) {
@@ -80,9 +72,9 @@ let NodeTypes = /* @__PURE__ */ function(NodeTypes) {
80
72
  NodeTypes["DoctypeAttribute"] = "DoctypeAttribute";
81
73
  NodeTypes["DoctypeAttributeValue"] = "DoctypeAttributeValue";
82
74
  NodeTypes["Document"] = "Document";
75
+ NodeTypes["Element"] = "Element";
83
76
  NodeTypes["Error"] = "Error";
84
77
  NodeTypes["Program"] = "Program";
85
- NodeTypes["Tag"] = "Tag";
86
78
  NodeTypes["Text"] = "Text";
87
79
  NodeTypes["XMLDeclaration"] = "XMLDeclaration";
88
80
  NodeTypes["XMLDeclarationAttribute"] = "XMLDeclarationAttribute";
@@ -90,7 +82,6 @@ let NodeTypes = /* @__PURE__ */ function(NodeTypes) {
90
82
  NodeTypes["XMLDeclarationAttributeValue"] = "XMLDeclarationAttributeValue";
91
83
  return NodeTypes;
92
84
  }({});
93
-
94
85
  //#endregion
95
86
  //#region src/constants/tokenTypes.ts
96
87
  let TokenTypes = /* @__PURE__ */ function(TokenTypes) {
@@ -138,7 +129,6 @@ let TokenTypes = /* @__PURE__ */ function(TokenTypes) {
138
129
  TokenTypes["XMLDeclarationOpen"] = "XMLDeclarationOpen";
139
130
  return TokenTypes;
140
131
  }({});
141
-
142
132
  //#endregion
143
133
  //#region src/constants/specialChar.ts
144
134
  const SPECIAL_CHAR = {
@@ -158,7 +148,6 @@ const SPECIAL_CHAR = {
158
148
  space: ` `,
159
149
  tab: `\t`
160
150
  };
161
-
162
151
  //#endregion
163
152
  //#region src/constants/svgElements.ts
164
153
  /**
@@ -292,7 +281,6 @@ const SELF_CLOSING_ELEMENTS = new Set([
292
281
  "use",
293
282
  "view"
294
283
  ]);
295
-
296
284
  //#endregion
297
285
  //#region src/constants/tokenizerContextTypes.ts
298
286
  let TokenizerContextTypes = /* @__PURE__ */ function(TokenizerContextTypes) {
@@ -321,7 +309,6 @@ let TokenizerContextTypes = /* @__PURE__ */ function(TokenizerContextTypes) {
321
309
  TokenizerContextTypes["XMLDeclarationOpen"] = "XMLDeclarationOpen";
322
310
  return TokenizerContextTypes;
323
311
  }({});
324
-
325
312
  //#endregion
326
313
  //#region src/constants/constructTreeContextTypes.ts
327
314
  let ConstructTreeContextTypes = /* @__PURE__ */ function(ConstructTreeContextTypes) {
@@ -341,7 +328,6 @@ let ConstructTreeContextTypes = /* @__PURE__ */ function(ConstructTreeContextTyp
341
328
  ConstructTreeContextTypes["XMLDeclarationAttributeValue"] = "XMLDeclarationAttributeValue";
342
329
  return ConstructTreeContextTypes;
343
330
  }({});
344
-
345
331
  //#endregion
346
332
  //#region src/utils/cloneNode.ts
347
333
  /**
@@ -354,7 +340,7 @@ function cloneNode(node) {
354
340
  if (Array.isArray(node)) return node.map((item) => cloneNode(item));
355
341
  const cloned = {};
356
342
  for (const key in node) {
357
- if (!Object.prototype.hasOwnProperty.call(node, key)) continue;
343
+ if (!Object.hasOwn(node, key)) continue;
358
344
  if (key === "parentRef" || key === "parent") continue;
359
345
  const value = node[key];
360
346
  if (value && typeof value === "object") if (Array.isArray(value)) cloned[key] = value.map((item) => cloneNode(item));
@@ -374,7 +360,7 @@ function cloneNodeWithParent(node, parent) {
374
360
  if (Array.isArray(node)) return node.map((item) => cloneNodeWithParent(item));
375
361
  const cloned = {};
376
362
  for (const key in node) {
377
- if (!Object.prototype.hasOwnProperty.call(node, key)) continue;
363
+ if (!Object.hasOwn(node, key)) continue;
378
364
  if (key === "parentRef" || key === "parent") continue;
379
365
  const value = node[key];
380
366
  if (value && typeof value === "object") if (Array.isArray(value)) cloned[key] = value.map((item) => cloneNodeWithParent(item, cloned));
@@ -384,7 +370,6 @@ function cloneNodeWithParent(node, parent) {
384
370
  if (parent) cloned.parentRef = parent;
385
371
  return cloned;
386
372
  }
387
-
388
373
  //#endregion
389
374
  //#region src/utils/firstLast.ts
390
375
  /**
@@ -403,7 +388,6 @@ function first(items) {
403
388
  function last(items) {
404
389
  return items[items.length - 1];
405
390
  }
406
-
407
391
  //#endregion
408
392
  //#region src/utils/cloneRange.ts
409
393
  /**
@@ -414,7 +398,6 @@ function last(items) {
414
398
  function cloneRange(range) {
415
399
  return [range[0], range[1]];
416
400
  }
417
-
418
401
  //#endregion
419
402
  //#region src/utils/initIfNone.ts
420
403
  /**
@@ -433,7 +416,6 @@ function initChildrenIfNone(node) {
433
416
  function initAttributesIfNone(node) {
434
417
  if (!node.attributes) node.attributes = [];
435
418
  }
436
-
437
419
  //#endregion
438
420
  //#region src/utils/clearParent.ts
439
421
  /**
@@ -444,12 +426,9 @@ function initAttributesIfNone(node) {
444
426
  function clearParent(ast) {
445
427
  const cleanAst = ast;
446
428
  delete cleanAst.parentRef;
447
- if (Array.isArray(ast.children)) cleanAst.children = ast.children.map((node) => {
448
- return clearParent(node);
449
- });
429
+ if (Array.isArray(ast.children)) cleanAst.children = ast.children.map((node) => clearParent(node));
450
430
  return cleanAst;
451
431
  }
452
-
453
432
  //#endregion
454
433
  //#region src/utils/getLineInfo.ts
455
434
  /**
@@ -492,7 +471,6 @@ function getLineInfo(input, offset) {
492
471
  cur = nextBreak;
493
472
  }
494
473
  }
495
-
496
474
  //#endregion
497
475
  //#region src/utils/nodeHelpers.ts
498
476
  /**
@@ -503,12 +481,12 @@ function getLineInfo(input, offset) {
503
481
  */
504
482
  function filterNodes(node, predicate) {
505
483
  const results = [];
506
- function traverse$1(currentNode) {
484
+ function traverse(currentNode) {
507
485
  if (predicate(currentNode)) results.push(currentNode);
508
- if ("children" in currentNode && Array.isArray(currentNode.children)) for (const child of currentNode.children) traverse$1(child);
509
- if ("attributes" in currentNode && Array.isArray(currentNode.attributes)) for (const attr of currentNode.attributes) traverse$1(attr);
486
+ if ("children" in currentNode && Array.isArray(currentNode.children)) for (const child of currentNode.children) traverse(child);
487
+ if ("attributes" in currentNode && Array.isArray(currentNode.attributes)) for (const attr of currentNode.attributes) traverse(attr);
510
488
  }
511
- traverse$1(node);
489
+ traverse(node);
512
490
  return results;
513
491
  }
514
492
  /**
@@ -562,7 +540,6 @@ function countNodes(node) {
562
540
  if ("attributes" in node && Array.isArray(node.attributes)) for (const attr of node.attributes) count += countNodes(attr);
563
541
  return count;
564
542
  }
565
-
566
543
  //#endregion
567
544
  //#region src/utils/traverseAST.ts
568
545
  /**
@@ -590,7 +567,6 @@ function traverseAST(node, visitor, parent = null) {
590
567
  function walkAST(node, callback) {
591
568
  traverseAST(node, { enter: callback });
592
569
  }
593
-
594
570
  //#endregion
595
571
  //#region src/utils/isWhitespace.ts
596
572
  /**
@@ -601,30 +577,9 @@ function walkAST(node, callback) {
601
577
  function isWhitespace(char) {
602
578
  return char === SPECIAL_CHAR.space || char === SPECIAL_CHAR.newline || char === SPECIAL_CHAR.return || char === SPECIAL_CHAR.tab;
603
579
  }
604
-
605
580
  //#endregion
606
581
  //#region src/utils/validateNode.ts
607
- /**
608
- * Validate if a node matches its expected structure
609
- * @param node - Node to validate
610
- * @returns True if node is valid
611
- */
612
- function validateNode(node) {
613
- if (!node || typeof node !== "object") return false;
614
- if (!("type" in node) || !("range" in node) || !("loc" in node)) return false;
615
- if (!Array.isArray(node.range) || node.range.length !== 2 || typeof node.range[0] !== "number" || typeof node.range[1] !== "number") return false;
616
- if (!node.loc || !node.loc.start || !node.loc.end || typeof node.loc.start.line !== "number" || typeof node.loc.start.column !== "number" || typeof node.loc.end.line !== "number" || typeof node.loc.end.column !== "number") return false;
617
- switch (node.type) {
618
- case NodeTypes.Tag: return validateTagNode(node);
619
- case NodeTypes.Attribute: return validateAttributeNode(node);
620
- case NodeTypes.Text: return validateTextNode(node);
621
- case NodeTypes.Comment: return validateCommentNode(node);
622
- case NodeTypes.Document: return validateDocumentNode(node);
623
- case NodeTypes.Doctype: return validateDoctypeNode(node);
624
- default: return true;
625
- }
626
- }
627
- function validateTagNode(node) {
582
+ function validateElementNode(node) {
628
583
  if (!("name" in node) || typeof node.name !== "string") return false;
629
584
  if ("children" in node && !Array.isArray(node.children)) return false;
630
585
  if ("attributes" in node && !Array.isArray(node.attributes)) return false;
@@ -649,6 +604,26 @@ function validateDoctypeNode(node) {
649
604
  return true;
650
605
  }
651
606
  /**
607
+ * Validate if a node matches its expected structure
608
+ * @param node - Node to validate
609
+ * @returns True if node is valid
610
+ */
611
+ function validateNode(node) {
612
+ if (!node || typeof node !== "object") return false;
613
+ if (!("type" in node) || !("range" in node) || !("loc" in node)) return false;
614
+ if (!Array.isArray(node.range) || node.range.length !== 2 || typeof node.range[0] !== "number" || typeof node.range[1] !== "number") return false;
615
+ if (!node.loc || !node.loc.start || !node.loc.end || typeof node.loc.start.line !== "number" || typeof node.loc.start.column !== "number" || typeof node.loc.end.line !== "number" || typeof node.loc.end.column !== "number") return false;
616
+ switch (node.type) {
617
+ case "Element": return validateElementNode(node);
618
+ case "Attribute": return validateAttributeNode(node);
619
+ case "Text": return validateTextNode(node);
620
+ case "Comment": return validateCommentNode(node);
621
+ case "Document": return validateDocumentNode(node);
622
+ case "Doctype": return validateDoctypeNode(node);
623
+ default: return true;
624
+ }
625
+ }
626
+ /**
652
627
  * Check if a node is of a specific type with type guard
653
628
  * @param node - Node to check
654
629
  * @param type - Expected node type
@@ -657,7 +632,6 @@ function validateDoctypeNode(node) {
657
632
  function isNodeType(node, type) {
658
633
  return node.type === type;
659
634
  }
660
-
661
635
  //#endregion
662
636
  //#region src/utils/cloneLocation.ts
663
637
  /**
@@ -677,7 +651,6 @@ function cloneLocation(loc) {
677
651
  }
678
652
  };
679
653
  }
680
-
681
654
  //#endregion
682
655
  //#region src/utils/updateNodeEnd.ts
683
656
  /**
@@ -689,7 +662,6 @@ function updateNodeEnd(node, token) {
689
662
  node.range[1] = token.range[1];
690
663
  node.loc.end = { ...token.loc.end };
691
664
  }
692
-
693
665
  //#endregion
694
666
  //#region src/utils/createNodeFrom.ts
695
667
  /**
@@ -707,7 +679,6 @@ function createNodeFrom(token) {
707
679
  range
708
680
  };
709
681
  }
710
-
711
682
  //#endregion
712
683
  //#region src/utils/findNodeByType.ts
713
684
  /**
@@ -718,12 +689,12 @@ function createNodeFrom(token) {
718
689
  */
719
690
  function findNodeByType(node, type) {
720
691
  const results = [];
721
- function traverse$1(currentNode) {
692
+ function traverse(currentNode) {
722
693
  if (currentNode.type === type) results.push(currentNode);
723
- if ("children" in currentNode && Array.isArray(currentNode.children)) for (const child of currentNode.children) traverse$1(child);
724
- if ("attributes" in currentNode && Array.isArray(currentNode.attributes)) for (const attr of currentNode.attributes) traverse$1(attr);
694
+ if ("children" in currentNode && Array.isArray(currentNode.children)) for (const child of currentNode.children) traverse(child);
695
+ if ("attributes" in currentNode && Array.isArray(currentNode.attributes)) for (const attr of currentNode.attributes) traverse(attr);
725
696
  }
726
- traverse$1(node);
697
+ traverse(node);
727
698
  return results;
728
699
  }
729
700
  /**
@@ -733,27 +704,25 @@ function findNodeByType(node, type) {
733
704
  * @returns First matching node or undefined
734
705
  */
735
706
  function findFirstNodeByType(node, type) {
736
- function traverse$1(currentNode) {
707
+ function traverse(currentNode) {
737
708
  if (currentNode.type === type) return currentNode;
738
709
  if ("children" in currentNode && Array.isArray(currentNode.children)) for (const child of currentNode.children) {
739
- const result = traverse$1(child);
710
+ const result = traverse(child);
740
711
  if (result) return result;
741
712
  }
742
713
  if ("attributes" in currentNode && Array.isArray(currentNode.attributes)) for (const attr of currentNode.attributes) {
743
- const result = traverse$1(attr);
714
+ const result = traverse(attr);
744
715
  if (result) return result;
745
716
  }
746
717
  }
747
- return traverse$1(node);
718
+ return traverse(node);
748
719
  }
749
-
750
720
  //#endregion
751
721
  //#region src/utils/getLastAttribute.ts
752
722
  function getLastAttribute(state) {
753
723
  const attributes = state.currentNode.attributes;
754
724
  return last(attributes);
755
725
  }
756
-
757
726
  //#endregion
758
727
  //#region src/utils/parseOpenTagName.ts
759
728
  /**
@@ -765,9 +734,10 @@ function getLastAttribute(state) {
765
734
  function parseOpenTagName(openTagStartTokenContent) {
766
735
  const match = openTagStartTokenContent.match(RE_OPEN_TAG_NAME);
767
736
  if (match === null) throw new Error(`Unable to parse open tag name.\n${openTagStartTokenContent} does not match pattern of opening tag.`);
768
- return match[1].toLowerCase();
737
+ const tagName = match.groups?.tagName;
738
+ if (tagName === void 0) throw new Error(`Unable to parse open tag name. Named capture group "tagName" is missing.`);
739
+ return tagName.toLowerCase();
769
740
  }
770
-
771
741
  //#endregion
772
742
  //#region src/utils/parseCloseTagName.ts
773
743
  /**
@@ -779,9 +749,10 @@ function parseOpenTagName(openTagStartTokenContent) {
779
749
  function parseCloseTagName(closeTagTokenContent) {
780
750
  const match = closeTagTokenContent.match(RE_CLOSE_TAG_NAME);
781
751
  if (match === null) throw new Error(`Unable to parse close tag name.\n${closeTagTokenContent} does not match pattern of closing tag.`);
782
- return match[1].trim().toLowerCase();
752
+ const tagName = match.groups?.tagName;
753
+ if (tagName === void 0) throw new Error(`Unable to parse close tag name. Named capture group "tagName" is missing.`);
754
+ return tagName.trim().toLowerCase();
783
755
  }
784
-
785
756
  //#endregion
786
757
  //#region src/utils/calculateTokenLocation.ts
787
758
  /**
@@ -796,7 +767,6 @@ function calculateTokenLocation(source, range) {
796
767
  end: getLineInfo(source, range[1])
797
768
  };
798
769
  }
799
-
800
770
  //#endregion
801
771
  //#region src/utils/calculateTokenCharactersRange.ts
802
772
  /**
@@ -808,12 +778,11 @@ function calculateTokenLocation(source, range) {
808
778
  */
809
779
  function calculateTokenCharactersRange(state, options) {
810
780
  const startPosition = state.sourceCode.index() - (state.accumulatedContent.length() - 1) - state.decisionBuffer.length();
811
- let endPosition;
781
+ let endPosition = 0;
812
782
  if (options.keepBuffer) endPosition = state.sourceCode.index();
813
783
  else endPosition = state.sourceCode.index() - state.decisionBuffer.length();
814
784
  return [startPosition, endPosition + 1];
815
785
  }
816
-
817
786
  //#endregion
818
787
  //#region src/utils/calculateTokenPosition.ts
819
788
  /**
@@ -830,7 +799,6 @@ function calculateTokenPosition(state, options) {
830
799
  loc: calculateTokenLocation(state.sourceCode.source, range)
831
800
  };
832
801
  }
833
-
834
802
  //#endregion
835
803
  //#region src/constructor/handlerFactory.ts
836
804
  /**
@@ -846,35 +814,33 @@ function createTokenDispatcher(handlers, defaultHandler) {
846
814
  return state;
847
815
  };
848
816
  }
849
-
850
817
  //#endregion
851
818
  //#region src/constructor/handlers/tag.ts
852
819
  var tag_exports = /* @__PURE__ */ __exportAll({ construct: () => construct$13 });
853
- const ATTRIBUTE_START_TOKENS$3 = new Set([TokenTypes.AttributeKey, TokenTypes.AttributeAssignment]);
854
820
  const dispatch$13 = createTokenDispatcher([
855
821
  {
856
- tokenType: TokenTypes.OpenTagStart,
822
+ tokenType: "OpenTagStart",
857
823
  handler(token, state) {
858
824
  state.currentNode.openStart = createNodeFrom(token);
859
825
  state.currentContext = {
860
826
  parentRef: state.currentContext,
861
- type: ConstructTreeContextTypes.TagName
827
+ type: "TagName"
862
828
  };
863
829
  return state;
864
830
  }
865
831
  },
866
832
  {
867
- tokenType: ATTRIBUTE_START_TOKENS$3,
833
+ tokenType: new Set(["AttributeKey", "AttributeAssignment"]),
868
834
  handler(_, state) {
869
835
  state.currentContext = {
870
836
  parentRef: state.currentContext,
871
- type: ConstructTreeContextTypes.Attributes
837
+ type: "Attributes"
872
838
  };
873
839
  return state;
874
840
  }
875
841
  },
876
842
  {
877
- tokenType: TokenTypes.OpenTagEnd,
843
+ tokenType: "OpenTagEnd",
878
844
  handler(token, state) {
879
845
  const tagName = state.currentNode.name;
880
846
  state.currentNode.openEnd = createNodeFrom(token);
@@ -889,14 +855,14 @@ const dispatch$13 = createTokenDispatcher([
889
855
  state.currentNode.selfClosing = false;
890
856
  state.currentContext = {
891
857
  parentRef: state.currentContext,
892
- type: ConstructTreeContextTypes.TagContent
858
+ type: "TagContent"
893
859
  };
894
860
  state.caretPosition++;
895
861
  return state;
896
862
  }
897
863
  },
898
864
  {
899
- tokenType: TokenTypes.CloseTag,
865
+ tokenType: "CloseTag",
900
866
  handler(token, state) {
901
867
  state.currentNode.close = createNodeFrom(token);
902
868
  updateNodeEnd(state.currentNode, token);
@@ -913,20 +879,19 @@ const dispatch$13 = createTokenDispatcher([
913
879
  function construct$13(token, state) {
914
880
  return dispatch$13(token, state);
915
881
  }
916
-
917
882
  //#endregion
918
883
  //#region src/constructor/handlers/comment.ts
919
884
  var comment_exports = /* @__PURE__ */ __exportAll({ construct: () => construct$12 });
920
885
  const dispatch$12 = createTokenDispatcher([
921
886
  {
922
- tokenType: TokenTypes.CommentOpen,
887
+ tokenType: "CommentOpen",
923
888
  handler(_, state) {
924
889
  state.caretPosition++;
925
890
  return state;
926
891
  }
927
892
  },
928
893
  {
929
- tokenType: TokenTypes.CommentContent,
894
+ tokenType: "CommentContent",
930
895
  handler(token, state) {
931
896
  state.currentNode.content = token.value;
932
897
  state.caretPosition++;
@@ -934,7 +899,7 @@ const dispatch$12 = createTokenDispatcher([
934
899
  }
935
900
  },
936
901
  {
937
- tokenType: TokenTypes.CommentClose,
902
+ tokenType: "CommentClose",
938
903
  handler(token, state) {
939
904
  updateNodeEnd(state.currentNode, token);
940
905
  state.currentNode = state.currentNode.parentRef;
@@ -947,14 +912,12 @@ const dispatch$12 = createTokenDispatcher([
947
912
  function construct$12(token, state) {
948
913
  return dispatch$12(token, state);
949
914
  }
950
-
951
915
  //#endregion
952
916
  //#region src/constructor/handlers/doctype.ts
953
917
  var doctype_exports = /* @__PURE__ */ __exportAll({ construct: () => construct$11 });
954
- const ATTRIBUTES_START_TOKENS = new Set([TokenTypes.DoctypeAttributeWrapperStart, TokenTypes.DoctypeAttributeValue]);
955
918
  const dispatch$11 = createTokenDispatcher([
956
919
  {
957
- tokenType: TokenTypes.DoctypeOpen,
920
+ tokenType: "DoctypeOpen",
958
921
  handler(token, state) {
959
922
  state.currentNode.open = createNodeFrom(token);
960
923
  state.caretPosition++;
@@ -962,7 +925,7 @@ const dispatch$11 = createTokenDispatcher([
962
925
  }
963
926
  },
964
927
  {
965
- tokenType: TokenTypes.DoctypeClose,
928
+ tokenType: "DoctypeClose",
966
929
  handler(token, state) {
967
930
  state.currentNode.close = createNodeFrom(token);
968
931
  updateNodeEnd(state.currentNode, token);
@@ -973,11 +936,11 @@ const dispatch$11 = createTokenDispatcher([
973
936
  }
974
937
  },
975
938
  {
976
- tokenType: ATTRIBUTES_START_TOKENS,
939
+ tokenType: new Set(["DoctypeAttributeWrapperStart", "DoctypeAttributeValue"]),
977
940
  handler(_, state) {
978
941
  state.currentContext = {
979
942
  parentRef: state.currentContext,
980
- type: ConstructTreeContextTypes.DoctypeAttributes
943
+ type: "DoctypeAttributes"
981
944
  };
982
945
  return state;
983
946
  }
@@ -989,12 +952,11 @@ const dispatch$11 = createTokenDispatcher([
989
952
  function construct$11(token, state) {
990
953
  return dispatch$11(token, state);
991
954
  }
992
-
993
955
  //#endregion
994
956
  //#region src/constructor/handlers/tagName.ts
995
957
  var tagName_exports = /* @__PURE__ */ __exportAll({ construct: () => construct$10 });
996
958
  const dispatch$10 = createTokenDispatcher([{
997
- tokenType: TokenTypes.OpenTagStart,
959
+ tokenType: "OpenTagStart",
998
960
  handler(token, state) {
999
961
  state.currentNode.name = parseOpenTagName(token.value);
1000
962
  state.currentContext = state.currentContext.parentRef;
@@ -1008,20 +970,19 @@ const dispatch$10 = createTokenDispatcher([{
1008
970
  function construct$10(token, state) {
1009
971
  return dispatch$10(token, state);
1010
972
  }
1011
-
1012
973
  //#endregion
1013
974
  //#region src/constructor/handlers/attribute.ts
1014
975
  var attribute_exports = /* @__PURE__ */ __exportAll({ construct: () => construct$9 });
1015
976
  const dispatch$9 = createTokenDispatcher([
1016
977
  {
1017
- tokenType: new Set([TokenTypes.OpenTagEnd]),
978
+ tokenType: new Set(["OpenTagEnd"]),
1018
979
  handler(_, state) {
1019
980
  state.currentContext = state.currentContext.parentRef;
1020
981
  return state;
1021
982
  }
1022
983
  },
1023
984
  {
1024
- tokenType: TokenTypes.AttributeKey,
985
+ tokenType: "AttributeKey",
1025
986
  handler(token, state) {
1026
987
  const attribute = getLastAttribute(state);
1027
988
  if (attribute.key !== void 0 || attribute.value !== void 0) {
@@ -1034,7 +995,7 @@ const dispatch$9 = createTokenDispatcher([
1034
995
  }
1035
996
  },
1036
997
  {
1037
- tokenType: TokenTypes.AttributeAssignment,
998
+ tokenType: "AttributeAssignment",
1038
999
  handler(_, state) {
1039
1000
  if (getLastAttribute(state).value !== void 0) {
1040
1001
  state.currentContext = state.currentContext.parentRef;
@@ -1042,7 +1003,7 @@ const dispatch$9 = createTokenDispatcher([
1042
1003
  }
1043
1004
  state.currentContext = {
1044
1005
  parentRef: state.currentContext,
1045
- type: ConstructTreeContextTypes.AttributeValue
1006
+ type: "AttributeValue"
1046
1007
  };
1047
1008
  state.caretPosition++;
1048
1009
  return state;
@@ -1055,29 +1016,26 @@ const dispatch$9 = createTokenDispatcher([
1055
1016
  function construct$9(token, state) {
1056
1017
  return dispatch$9(token, state);
1057
1018
  }
1058
-
1059
1019
  //#endregion
1060
1020
  //#region src/constructor/handlers/attributes.ts
1061
1021
  var attributes_exports$1 = /* @__PURE__ */ __exportAll({ construct: () => construct$8 });
1062
- const ATTRIBUTE_START_TOKENS$2 = new Set([TokenTypes.AttributeKey, TokenTypes.AttributeAssignment]);
1063
- const ATTRIBUTE_END_TOKENS = new Set([TokenTypes.OpenTagEnd]);
1064
1022
  const dispatch$8 = createTokenDispatcher([{
1065
- tokenType: ATTRIBUTE_START_TOKENS$2,
1023
+ tokenType: new Set(["AttributeKey", "AttributeAssignment"]),
1066
1024
  handler(token, state) {
1067
1025
  initAttributesIfNone(state.currentNode);
1068
1026
  state.currentNode.attributes.push({
1069
- type: NodeTypes.Attribute,
1027
+ type: "Attribute",
1070
1028
  range: cloneRange(token.range),
1071
1029
  loc: cloneLocation(token.loc)
1072
1030
  });
1073
1031
  state.currentContext = {
1074
1032
  parentRef: state.currentContext,
1075
- type: ConstructTreeContextTypes.Attribute
1033
+ type: "Attribute"
1076
1034
  };
1077
1035
  return state;
1078
1036
  }
1079
1037
  }, {
1080
- tokenType: ATTRIBUTE_END_TOKENS,
1038
+ tokenType: new Set(["OpenTagEnd"]),
1081
1039
  handler(_, state) {
1082
1040
  state.currentContext = state.currentContext.parentRef;
1083
1041
  return state;
@@ -1089,34 +1047,57 @@ const dispatch$8 = createTokenDispatcher([{
1089
1047
  function construct$8(token, state) {
1090
1048
  return dispatch$8(token, state);
1091
1049
  }
1092
-
1093
1050
  //#endregion
1094
1051
  //#region src/constructor/handlers/tagContent.ts
1095
1052
  var tagContent_exports = /* @__PURE__ */ __exportAll({ construct: () => construct$7 });
1096
1053
  const dispatch$7 = createTokenDispatcher([
1097
1054
  {
1098
- tokenType: TokenTypes.OpenTagStart,
1055
+ tokenType: "OpenTagStart",
1099
1056
  handler(token, state) {
1100
1057
  initChildrenIfNone(state.currentNode);
1101
- const tagNode = {
1102
- type: NodeTypes.Tag,
1058
+ const elementNode = {
1059
+ type: "Element",
1103
1060
  parentRef: state.currentNode,
1104
1061
  range: cloneRange(token.range),
1105
1062
  loc: cloneLocation(token.loc),
1106
1063
  attributes: [],
1107
1064
  children: []
1108
1065
  };
1109
- state.currentNode.children.push(tagNode);
1110
- state.currentNode = tagNode;
1066
+ state.currentNode.children.push(elementNode);
1067
+ state.currentNode = elementNode;
1111
1068
  state.currentContext = {
1112
1069
  parentRef: state.currentContext,
1113
- type: ConstructTreeContextTypes.Tag
1070
+ type: "Tag"
1114
1071
  };
1115
1072
  return state;
1116
1073
  }
1117
1074
  },
1118
1075
  {
1119
- tokenType: TokenTypes.Text,
1076
+ tokenType: "DoctypeOpen",
1077
+ handler(token, state) {
1078
+ if (state.currentNode.type !== "Document") {
1079
+ state.caretPosition++;
1080
+ return state;
1081
+ }
1082
+ initChildrenIfNone(state.currentNode);
1083
+ const doctypeNode = {
1084
+ type: "Doctype",
1085
+ parentRef: state.currentNode,
1086
+ range: cloneRange(token.range),
1087
+ loc: cloneLocation(token.loc),
1088
+ attributes: []
1089
+ };
1090
+ state.currentNode.children.push(doctypeNode);
1091
+ state.currentNode = doctypeNode;
1092
+ state.currentContext = {
1093
+ parentRef: state.currentContext,
1094
+ type: "Doctype"
1095
+ };
1096
+ return state;
1097
+ }
1098
+ },
1099
+ {
1100
+ tokenType: "Text",
1120
1101
  handler(token, state) {
1121
1102
  initChildrenIfNone(state.currentNode);
1122
1103
  const textNode = createNodeFrom(token);
@@ -1126,7 +1107,7 @@ const dispatch$7 = createTokenDispatcher([
1126
1107
  }
1127
1108
  },
1128
1109
  {
1129
- tokenType: TokenTypes.CloseTag,
1110
+ tokenType: "CloseTag",
1130
1111
  handler(token, state) {
1131
1112
  if (parseCloseTagName(token.value) !== state.currentNode.name) {
1132
1113
  state.caretPosition++;
@@ -1137,11 +1118,11 @@ const dispatch$7 = createTokenDispatcher([
1137
1118
  }
1138
1119
  },
1139
1120
  {
1140
- tokenType: TokenTypes.CommentOpen,
1121
+ tokenType: "CommentOpen",
1141
1122
  handler(token, state) {
1142
1123
  initChildrenIfNone(state.currentNode);
1143
1124
  const commentNode = {
1144
- type: NodeTypes.Comment,
1125
+ type: "Comment",
1145
1126
  parentRef: state.currentNode,
1146
1127
  range: cloneRange(token.range),
1147
1128
  loc: cloneLocation(token.loc)
@@ -1150,27 +1131,7 @@ const dispatch$7 = createTokenDispatcher([
1150
1131
  state.currentNode = commentNode;
1151
1132
  state.currentContext = {
1152
1133
  parentRef: state.currentContext,
1153
- type: ConstructTreeContextTypes.Comment
1154
- };
1155
- return state;
1156
- }
1157
- },
1158
- {
1159
- tokenType: TokenTypes.DoctypeOpen,
1160
- handler(token, state) {
1161
- initChildrenIfNone(state.currentNode);
1162
- const doctypeNode = {
1163
- type: NodeTypes.Doctype,
1164
- parentRef: state.currentNode,
1165
- range: cloneRange(token.range),
1166
- loc: cloneLocation(token.loc),
1167
- attributes: []
1168
- };
1169
- state.currentNode.children.push(doctypeNode);
1170
- state.currentNode = doctypeNode;
1171
- state.currentContext = {
1172
- parentRef: state.currentContext,
1173
- type: ConstructTreeContextTypes.Doctype
1134
+ type: "Comment"
1174
1135
  };
1175
1136
  return state;
1176
1137
  }
@@ -1182,16 +1143,15 @@ const dispatch$7 = createTokenDispatcher([
1182
1143
  function construct$7(token, state) {
1183
1144
  return dispatch$7(token, state);
1184
1145
  }
1185
-
1186
1146
  //#endregion
1187
1147
  //#region src/constructor/handlers/attributeValue.ts
1188
1148
  var attributeValue_exports$1 = /* @__PURE__ */ __exportAll({ construct: () => construct$6 });
1189
1149
  const dispatch$6 = createTokenDispatcher([
1190
1150
  {
1191
1151
  tokenType: new Set([
1192
- TokenTypes.OpenTagEnd,
1193
- TokenTypes.AttributeKey,
1194
- TokenTypes.AttributeAssignment
1152
+ "OpenTagEnd",
1153
+ "AttributeKey",
1154
+ "AttributeAssignment"
1195
1155
  ]),
1196
1156
  handler(_, state) {
1197
1157
  state.currentContext = state.currentContext.parentRef;
@@ -1199,7 +1159,7 @@ const dispatch$6 = createTokenDispatcher([
1199
1159
  }
1200
1160
  },
1201
1161
  {
1202
- tokenType: TokenTypes.AttributeValue,
1162
+ tokenType: "AttributeValue",
1203
1163
  handler(token, state) {
1204
1164
  const attribute = getLastAttribute(state);
1205
1165
  attribute.value = createNodeFrom(token);
@@ -1209,7 +1169,7 @@ const dispatch$6 = createTokenDispatcher([
1209
1169
  }
1210
1170
  },
1211
1171
  {
1212
- tokenType: TokenTypes.AttributeValueWrapperStart,
1172
+ tokenType: "AttributeValueWrapperStart",
1213
1173
  handler(token, state) {
1214
1174
  const attribute = getLastAttribute(state);
1215
1175
  attribute.quoteChar = token.value;
@@ -1222,7 +1182,7 @@ const dispatch$6 = createTokenDispatcher([
1222
1182
  }
1223
1183
  },
1224
1184
  {
1225
- tokenType: TokenTypes.AttributeValueWrapperEnd,
1185
+ tokenType: "AttributeValueWrapperEnd",
1226
1186
  handler(token, state) {
1227
1187
  updateNodeEnd(getLastAttribute(state), token);
1228
1188
  state.caretPosition++;
@@ -1236,12 +1196,11 @@ const dispatch$6 = createTokenDispatcher([
1236
1196
  function construct$6(token, state) {
1237
1197
  return dispatch$6(token, state);
1238
1198
  }
1239
-
1240
1199
  //#endregion
1241
1200
  //#region src/constructor/handlers/xmlDeclaration.ts
1242
1201
  var xmlDeclaration_exports = /* @__PURE__ */ __exportAll({ construct: () => construct$5 });
1243
1202
  const dispatch$5 = createTokenDispatcher([{
1244
- tokenType: TokenTypes.OpenTagStart,
1203
+ tokenType: "OpenTagStart",
1245
1204
  handler(token, state) {
1246
1205
  state.currentNode.name = parseOpenTagName(token.value);
1247
1206
  state.currentContext = state.currentContext.parentRef;
@@ -1255,20 +1214,19 @@ const dispatch$5 = createTokenDispatcher([{
1255
1214
  function construct$5(token, state) {
1256
1215
  return dispatch$5(token, state);
1257
1216
  }
1258
-
1259
1217
  //#endregion
1260
1218
  //#region src/constructor/handlers/doctypeAttribute.ts
1261
1219
  var doctypeAttribute_exports = /* @__PURE__ */ __exportAll({ construct: () => construct$4 });
1262
1220
  const dispatch$4 = createTokenDispatcher([
1263
1221
  {
1264
- tokenType: TokenTypes.DoctypeClose,
1222
+ tokenType: "DoctypeClose",
1265
1223
  handler(_, state) {
1266
1224
  state.currentContext = state.currentContext.parentRef;
1267
1225
  return state;
1268
1226
  }
1269
1227
  },
1270
1228
  {
1271
- tokenType: TokenTypes.DoctypeAttributeWrapperStart,
1229
+ tokenType: "DoctypeAttributeWrapperStart",
1272
1230
  handler(token, state) {
1273
1231
  const attribute = getLastAttribute(state);
1274
1232
  if (attribute.value !== void 0) {
@@ -1282,7 +1240,7 @@ const dispatch$4 = createTokenDispatcher([
1282
1240
  }
1283
1241
  },
1284
1242
  {
1285
- tokenType: TokenTypes.DoctypeAttributeWrapperEnd,
1243
+ tokenType: "DoctypeAttributeWrapperEnd",
1286
1244
  handler(token, state) {
1287
1245
  updateNodeEnd(getLastAttribute(state), token);
1288
1246
  state.currentContext = state.currentContext.parentRef;
@@ -1291,7 +1249,7 @@ const dispatch$4 = createTokenDispatcher([
1291
1249
  }
1292
1250
  },
1293
1251
  {
1294
- tokenType: TokenTypes.DoctypeAttributeValue,
1252
+ tokenType: "DoctypeAttributeValue",
1295
1253
  handler(token, state) {
1296
1254
  const attribute = getLastAttribute(state);
1297
1255
  if (attribute.value !== void 0) {
@@ -1311,28 +1269,26 @@ const dispatch$4 = createTokenDispatcher([
1311
1269
  function construct$4(token, state) {
1312
1270
  return dispatch$4(token, state);
1313
1271
  }
1314
-
1315
1272
  //#endregion
1316
1273
  //#region src/constructor/handlers/doctypeAttributes.ts
1317
1274
  var doctypeAttributes_exports$1 = /* @__PURE__ */ __exportAll({ construct: () => construct$3 });
1318
- const ATTRIBUTE_START_TOKENS$1 = new Set([TokenTypes.DoctypeAttributeWrapperStart, TokenTypes.DoctypeAttributeValue]);
1319
1275
  const dispatch$3 = createTokenDispatcher([{
1320
- tokenType: TokenTypes.DoctypeClose,
1276
+ tokenType: "DoctypeClose",
1321
1277
  handler(_, state) {
1322
1278
  state.currentContext = state.currentContext.parentRef;
1323
1279
  return state;
1324
1280
  }
1325
1281
  }, {
1326
- tokenType: ATTRIBUTE_START_TOKENS$1,
1282
+ tokenType: new Set(["DoctypeAttributeWrapperStart", "DoctypeAttributeValue"]),
1327
1283
  handler(token, state) {
1328
1284
  initAttributesIfNone(state.currentNode);
1329
1285
  state.currentNode.attributes.push({
1330
- type: NodeTypes.DoctypeAttribute,
1286
+ type: "DoctypeAttribute",
1331
1287
  range: cloneRange(token.range),
1332
1288
  loc: cloneLocation(token.loc)
1333
1289
  });
1334
1290
  state.currentContext = {
1335
- type: ConstructTreeContextTypes.DoctypeAttribute,
1291
+ type: "DoctypeAttribute",
1336
1292
  parentRef: state.currentContext
1337
1293
  };
1338
1294
  return state;
@@ -1344,16 +1300,15 @@ const dispatch$3 = createTokenDispatcher([{
1344
1300
  function construct$3(token, state) {
1345
1301
  return dispatch$3(token, state);
1346
1302
  }
1347
-
1348
1303
  //#endregion
1349
1304
  //#region src/constructor/handlers/xmlDeclarationAttribute.ts
1350
1305
  var xmlDeclarationAttribute_exports = /* @__PURE__ */ __exportAll({ construct: () => construct$2 });
1351
1306
  const dispatch$2 = createTokenDispatcher([
1352
1307
  {
1353
1308
  tokenType: new Set([
1354
- TokenTypes.OpenTagEnd,
1355
- TokenTypes.AttributeKey,
1356
- TokenTypes.AttributeAssignment
1309
+ "OpenTagEnd",
1310
+ "AttributeKey",
1311
+ "AttributeAssignment"
1357
1312
  ]),
1358
1313
  handler(_, state) {
1359
1314
  state.currentContext = state.currentContext.parentRef;
@@ -1361,7 +1316,7 @@ const dispatch$2 = createTokenDispatcher([
1361
1316
  }
1362
1317
  },
1363
1318
  {
1364
- tokenType: TokenTypes.AttributeValue,
1319
+ tokenType: "AttributeValue",
1365
1320
  handler(token, state) {
1366
1321
  const attribute = getLastAttribute(state);
1367
1322
  attribute.value = createNodeFrom(token);
@@ -1371,7 +1326,7 @@ const dispatch$2 = createTokenDispatcher([
1371
1326
  }
1372
1327
  },
1373
1328
  {
1374
- tokenType: TokenTypes.AttributeValueWrapperStart,
1329
+ tokenType: "AttributeValueWrapperStart",
1375
1330
  handler(token, state) {
1376
1331
  const attribute = getLastAttribute(state);
1377
1332
  attribute.quoteChar = token.value;
@@ -1381,7 +1336,7 @@ const dispatch$2 = createTokenDispatcher([
1381
1336
  }
1382
1337
  },
1383
1338
  {
1384
- tokenType: TokenTypes.AttributeValueWrapperEnd,
1339
+ tokenType: "AttributeValueWrapperEnd",
1385
1340
  handler(token, state) {
1386
1341
  updateNodeEnd(getLastAttribute(state), token);
1387
1342
  state.caretPosition++;
@@ -1395,28 +1350,26 @@ const dispatch$2 = createTokenDispatcher([
1395
1350
  function construct$2(token, state) {
1396
1351
  return dispatch$2(token, state);
1397
1352
  }
1398
-
1399
1353
  //#endregion
1400
1354
  //#region src/constructor/handlers/xmlDeclarationAttributes.ts
1401
1355
  var xmlDeclarationAttributes_exports$1 = /* @__PURE__ */ __exportAll({ construct: () => construct$1 });
1402
- const ATTRIBUTE_START_TOKENS = new Set([TokenTypes.AttributeKey, TokenTypes.AttributeAssignment]);
1403
1356
  const dispatch$1 = createTokenDispatcher([{
1404
- tokenType: TokenTypes.OpenTagEnd,
1357
+ tokenType: "OpenTagEnd",
1405
1358
  handler(_, state) {
1406
1359
  state.currentContext = state.currentContext.parentRef;
1407
1360
  return state;
1408
1361
  }
1409
1362
  }, {
1410
- tokenType: ATTRIBUTE_START_TOKENS,
1363
+ tokenType: new Set(["AttributeKey", "AttributeAssignment"]),
1411
1364
  handler(token, state) {
1412
1365
  initAttributesIfNone(state.currentNode);
1413
1366
  state.currentNode.attributes.push({
1414
- type: NodeTypes.Attribute,
1367
+ type: "Attribute",
1415
1368
  range: cloneRange(token.range),
1416
1369
  loc: cloneLocation(token.loc)
1417
1370
  });
1418
1371
  state.currentContext = {
1419
- type: ConstructTreeContextTypes.XMLDeclarationAttribute,
1372
+ type: "XMLDeclarationAttribute",
1420
1373
  parentRef: state.currentContext
1421
1374
  };
1422
1375
  return state;
@@ -1428,20 +1381,19 @@ const dispatch$1 = createTokenDispatcher([{
1428
1381
  function construct$1(token, state) {
1429
1382
  return dispatch$1(token, state);
1430
1383
  }
1431
-
1432
1384
  //#endregion
1433
1385
  //#region src/constructor/handlers/xmlDeclarationAttributeValue.ts
1434
1386
  var xmlDeclarationAttributeValue_exports$1 = /* @__PURE__ */ __exportAll({ construct: () => construct });
1435
1387
  const dispatch = createTokenDispatcher([
1436
1388
  {
1437
- tokenType: TokenTypes.OpenTagEnd,
1389
+ tokenType: "OpenTagEnd",
1438
1390
  handler(_, state) {
1439
1391
  state.currentContext = state.currentContext.parentRef;
1440
1392
  return state;
1441
1393
  }
1442
1394
  },
1443
1395
  {
1444
- tokenType: TokenTypes.AttributeValue,
1396
+ tokenType: "AttributeValue",
1445
1397
  handler(token, state) {
1446
1398
  const attribute = getLastAttribute(state);
1447
1399
  if (attribute.value !== void 0) {
@@ -1455,7 +1407,7 @@ const dispatch = createTokenDispatcher([
1455
1407
  }
1456
1408
  },
1457
1409
  {
1458
- tokenType: TokenTypes.AttributeValueWrapperStart,
1410
+ tokenType: "AttributeValueWrapperStart",
1459
1411
  handler(token, state) {
1460
1412
  const attribute = getLastAttribute(state);
1461
1413
  if (attribute.value !== void 0) {
@@ -1469,7 +1421,7 @@ const dispatch = createTokenDispatcher([
1469
1421
  }
1470
1422
  },
1471
1423
  {
1472
- tokenType: TokenTypes.AttributeValueWrapperEnd,
1424
+ tokenType: "AttributeValueWrapperEnd",
1473
1425
  handler(token, state) {
1474
1426
  updateNodeEnd(getLastAttribute(state), token);
1475
1427
  state.currentContext = state.currentContext.parentRef;
@@ -1484,7 +1436,6 @@ const dispatch = createTokenDispatcher([
1484
1436
  function construct(token, state) {
1485
1437
  return dispatch(token, state);
1486
1438
  }
1487
-
1488
1439
  //#endregion
1489
1440
  //#region src/constructor/constructTree.ts
1490
1441
  const EMPTY_RANGE = [0, 0];
@@ -1499,24 +1450,34 @@ const EMPTY_LOC = {
1499
1450
  }
1500
1451
  };
1501
1452
  const contextHandlers$1 = {
1502
- [ConstructTreeContextTypes.Tag]: tag_exports,
1503
- [ConstructTreeContextTypes.TagName]: tagName_exports,
1504
- [ConstructTreeContextTypes.TagContent]: tagContent_exports,
1505
- [ConstructTreeContextTypes.Attributes]: attributes_exports$1,
1506
- [ConstructTreeContextTypes.Attribute]: attribute_exports,
1507
- [ConstructTreeContextTypes.AttributeValue]: attributeValue_exports$1,
1508
- [ConstructTreeContextTypes.Doctype]: doctype_exports,
1509
- [ConstructTreeContextTypes.DoctypeAttribute]: doctypeAttribute_exports,
1510
- [ConstructTreeContextTypes.DoctypeAttributes]: doctypeAttributes_exports$1,
1511
- [ConstructTreeContextTypes.Comment]: comment_exports,
1512
- [ConstructTreeContextTypes.XMLDeclaration]: xmlDeclaration_exports,
1513
- [ConstructTreeContextTypes.XMLDeclarationAttribute]: xmlDeclarationAttribute_exports,
1514
- [ConstructTreeContextTypes.XMLDeclarationAttributes]: xmlDeclarationAttributes_exports$1,
1515
- [ConstructTreeContextTypes.XMLDeclarationAttributeValue]: xmlDeclarationAttributeValue_exports$1
1453
+ ["Tag"]: tag_exports,
1454
+ ["TagName"]: tagName_exports,
1455
+ ["TagContent"]: tagContent_exports,
1456
+ ["Attributes"]: attributes_exports$1,
1457
+ ["Attribute"]: attribute_exports,
1458
+ ["AttributeValue"]: attributeValue_exports$1,
1459
+ ["Doctype"]: doctype_exports,
1460
+ ["DoctypeAttribute"]: doctypeAttribute_exports,
1461
+ ["DoctypeAttributes"]: doctypeAttributes_exports$1,
1462
+ ["Comment"]: comment_exports,
1463
+ ["XMLDeclaration"]: xmlDeclaration_exports,
1464
+ ["XMLDeclarationAttribute"]: xmlDeclarationAttribute_exports,
1465
+ ["XMLDeclarationAttributes"]: xmlDeclarationAttributes_exports$1,
1466
+ ["XMLDeclarationAttributeValue"]: xmlDeclarationAttributeValue_exports$1
1516
1467
  };
1468
+ function processTokens(tokens, state, positionOffset) {
1469
+ let tokenIndex = state.caretPosition - positionOffset;
1470
+ while (tokenIndex < tokens.length) {
1471
+ const token = tokens[tokenIndex];
1472
+ const handler = contextHandlers$1[state.currentContext.type].construct;
1473
+ state = handler(token, state);
1474
+ tokenIndex = state.caretPosition - positionOffset;
1475
+ }
1476
+ return state;
1477
+ }
1517
1478
  function constructTree(tokens) {
1518
1479
  const rootContext = {
1519
- type: ConstructTreeContextTypes.TagContent,
1480
+ type: "TagContent",
1520
1481
  parentRef: void 0,
1521
1482
  content: []
1522
1483
  };
@@ -1529,7 +1490,7 @@ function constructTree(tokens) {
1529
1490
  } : EMPTY_LOC;
1530
1491
  loc.start.line = 1;
1531
1492
  const rootNode = {
1532
- type: NodeTypes.Document,
1493
+ type: "Document",
1533
1494
  range,
1534
1495
  children: [],
1535
1496
  loc
@@ -1547,24 +1508,13 @@ function constructTree(tokens) {
1547
1508
  ast: state.rootNode
1548
1509
  };
1549
1510
  }
1550
- function processTokens(tokens, state, positionOffset) {
1551
- let tokenIndex = state.caretPosition - positionOffset;
1552
- while (tokenIndex < tokens.length) {
1553
- const token = tokens[tokenIndex];
1554
- const handler = contextHandlers$1[state.currentContext.type].construct;
1555
- state = handler(token, state);
1556
- tokenIndex = state.caretPosition - positionOffset;
1557
- }
1558
- return state;
1559
- }
1560
-
1561
1511
  //#endregion
1562
1512
  //#region src/tokenizer/charsBuffer.ts
1563
1513
  var CharsBuffer = class {
1564
1514
  charsBuffer = [];
1565
1515
  concat(chars) {
1566
- const last$1 = this.last();
1567
- if (last$1) last$1.concat(chars);
1516
+ const theLast = this.last();
1517
+ if (theLast) theLast.concat(chars);
1568
1518
  else this.charsBuffer.push(chars);
1569
1519
  }
1570
1520
  concatBuffer(buffer) {
@@ -1595,7 +1545,6 @@ var CharsBuffer = class {
1595
1545
  this.charsBuffer = [...other.charsBuffer];
1596
1546
  }
1597
1547
  };
1598
-
1599
1548
  //#endregion
1600
1549
  //#region src/tokenizer/handlers/data.ts
1601
1550
  var data_exports = /* @__PURE__ */ __exportAll({
@@ -1611,35 +1560,10 @@ const INCOMPLETE_DOCTYPE_CHARS = new Set([
1611
1560
  "<!DOCTY",
1612
1561
  "<!DOCTYP"
1613
1562
  ]);
1614
- function parse$22(chars, state) {
1615
- const value = chars.value();
1616
- if (value === XML_DECLARATION_START) return parseXMLDeclarationOpen(state);
1617
- if (RE_OPEN_TAG_START.test(value)) return parseOpeningCornerBraceWithText(state);
1618
- if (value === "</") return parseOpeningCornerBraceWithSlash(state);
1619
- if (value === SPECIAL_CHAR.openingCorner || value === "<!" || value === "<!-") return state.sourceCode.next();
1620
- if (value === COMMENT_START) return parseCommentOpen(state);
1621
- if (isIncompleteDoctype(value)) return state.sourceCode.next();
1622
- if (value.toUpperCase() === "<!DOCTYPE") return parseDoctypeOpen(state);
1623
- state.accumulatedContent.concatBuffer(state.decisionBuffer);
1624
- state.decisionBuffer.clear();
1625
- state.sourceCode.next();
1626
- }
1627
- function handleContentEnd(state) {
1628
- const textContent = state.accumulatedContent.value() + state.decisionBuffer.value();
1629
- if (textContent.length !== 0) {
1630
- const position = calculateTokenPosition(state, { keepBuffer: false });
1631
- state.tokens.push({
1632
- type: TokenTypes.Text,
1633
- value: textContent,
1634
- range: position.range,
1635
- loc: position.loc
1636
- });
1637
- }
1638
- }
1639
1563
  function generateTextToken(state) {
1640
1564
  const position = calculateTokenPosition(state, { keepBuffer: false });
1641
1565
  return {
1642
- type: TokenTypes.Text,
1566
+ type: "Text",
1643
1567
  value: state.accumulatedContent.value(),
1644
1568
  range: position.range,
1645
1569
  loc: position.loc
@@ -1652,145 +1576,159 @@ function parseOpeningCornerBraceWithText(state) {
1652
1576
  if (state.accumulatedContent.length() !== 0) state.tokens.push(generateTextToken(state));
1653
1577
  state.accumulatedContent.replace(state.decisionBuffer);
1654
1578
  state.decisionBuffer.clear();
1655
- state.currentContext = TokenizerContextTypes.OpenTagStart;
1579
+ state.currentContext = "OpenTagStart";
1656
1580
  state.sourceCode.next();
1657
1581
  }
1658
1582
  function parseOpeningCornerBraceWithSlash(state) {
1659
1583
  if (state.accumulatedContent.length() !== 0) state.tokens.push(generateTextToken(state));
1660
1584
  state.accumulatedContent.replace(state.decisionBuffer);
1661
1585
  state.decisionBuffer.clear();
1662
- state.currentContext = TokenizerContextTypes.CloseTag;
1586
+ state.currentContext = "CloseTag";
1663
1587
  state.sourceCode.next();
1664
1588
  }
1665
1589
  function parseCommentOpen(state) {
1666
1590
  if (state.accumulatedContent.length() !== 0) state.tokens.push(generateTextToken(state));
1667
- const range = [state.sourceCode.index() - (COMMENT_START.length - 1), state.sourceCode.index() + 1];
1591
+ const range = [state.sourceCode.index() - 3, state.sourceCode.index() + 1];
1668
1592
  state.tokens.push({
1669
- type: TokenTypes.CommentOpen,
1593
+ type: "CommentOpen",
1670
1594
  value: state.decisionBuffer.value(),
1671
1595
  range,
1672
1596
  loc: state.sourceCode.getLocationOf(range)
1673
1597
  });
1674
1598
  state.accumulatedContent.clear();
1675
1599
  state.decisionBuffer.clear();
1676
- state.currentContext = TokenizerContextTypes.CommentContent;
1600
+ state.currentContext = "CommentContent";
1677
1601
  state.sourceCode.next();
1678
1602
  }
1679
1603
  function parseDoctypeOpen(state) {
1680
1604
  if (state.accumulatedContent.length() !== 0) state.tokens.push(generateTextToken(state));
1681
1605
  state.accumulatedContent.replace(state.decisionBuffer);
1682
1606
  state.decisionBuffer.clear();
1683
- state.currentContext = TokenizerContextTypes.DoctypeOpen;
1607
+ state.currentContext = "DoctypeOpen";
1684
1608
  state.sourceCode.next();
1685
1609
  }
1686
1610
  function parseXMLDeclarationOpen(state) {
1687
1611
  if (state.accumulatedContent.length() !== 0) state.tokens.push(generateTextToken(state));
1688
1612
  state.accumulatedContent.clear();
1689
1613
  state.decisionBuffer.clear();
1690
- state.currentContext = TokenizerContextTypes.XMLDeclarationAttributes;
1614
+ state.currentContext = "XMLDeclarationAttributes";
1691
1615
  state.sourceCode.next();
1692
1616
  }
1693
-
1694
- //#endregion
1695
- //#region src/tokenizer/handlers/closeTag.ts
1696
- var closeTag_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$21 });
1697
- function parse$21(chars, state) {
1698
- if (chars.value() === SPECIAL_CHAR.closingCorner) return parseClosingCornerBrace$5(state);
1617
+ function parse$22(chars, state) {
1618
+ const value = chars.value();
1619
+ if (value === "<?xml") return parseXMLDeclarationOpen(state);
1620
+ if (RE_OPEN_TAG_START.test(value)) return parseOpeningCornerBraceWithText(state);
1621
+ if (value === "</") return parseOpeningCornerBraceWithSlash(state);
1622
+ if (value === SPECIAL_CHAR.openingCorner || value === "<!" || value === "<!-") return state.sourceCode.next();
1623
+ if (value === "<!--") return parseCommentOpen(state);
1624
+ if (isIncompleteDoctype(value)) return state.sourceCode.next();
1625
+ if (value.toUpperCase() === "<!DOCTYPE") return parseDoctypeOpen(state);
1699
1626
  state.accumulatedContent.concatBuffer(state.decisionBuffer);
1700
1627
  state.decisionBuffer.clear();
1701
1628
  state.sourceCode.next();
1702
1629
  }
1630
+ function handleContentEnd(state) {
1631
+ const textContent = state.accumulatedContent.value() + state.decisionBuffer.value();
1632
+ if (textContent.length !== 0) {
1633
+ const position = calculateTokenPosition(state, { keepBuffer: false });
1634
+ state.tokens.push({
1635
+ type: "Text",
1636
+ value: textContent,
1637
+ range: position.range,
1638
+ loc: position.loc
1639
+ });
1640
+ }
1641
+ }
1642
+ //#endregion
1643
+ //#region src/tokenizer/handlers/closeTag.ts
1644
+ var closeTag_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$21 });
1703
1645
  function parseClosingCornerBrace$5(state) {
1704
1646
  const position = calculateTokenPosition(state, { keepBuffer: true });
1705
1647
  state.tokens.push({
1706
- type: TokenTypes.CloseTag,
1648
+ type: "CloseTag",
1707
1649
  value: state.accumulatedContent.value() + state.decisionBuffer.value(),
1708
1650
  range: position.range,
1709
1651
  loc: position.loc
1710
1652
  });
1711
1653
  state.accumulatedContent.clear();
1712
1654
  state.decisionBuffer.clear();
1713
- state.currentContext = TokenizerContextTypes.Data;
1655
+ state.currentContext = "Data";
1714
1656
  state.sourceCode.next();
1715
1657
  }
1716
-
1717
- //#endregion
1718
- //#region src/tokenizer/handlers/attributes.ts
1719
- var attributes_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$20 });
1720
- function parse$20(chars, state) {
1721
- const value = chars.value();
1722
- if (value === SPECIAL_CHAR.closingCorner || value === SPECIAL_CHAR.slash) return parseTagEnd$3(state);
1723
- if (value === SPECIAL_CHAR.equal) return parseEqual(state);
1724
- if (!isWhitespace(value)) return parseNoneWhitespace(chars, state);
1658
+ function parse$21(chars, state) {
1659
+ if (chars.value() === SPECIAL_CHAR.closingCorner) return parseClosingCornerBrace$5(state);
1660
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
1725
1661
  state.decisionBuffer.clear();
1726
1662
  state.sourceCode.next();
1727
1663
  }
1664
+ //#endregion
1665
+ //#region src/tokenizer/handlers/attributes.ts
1666
+ var attributes_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$20 });
1728
1667
  function parseTagEnd$3(state) {
1729
- const tagName = state.contextParams[TokenizerContextTypes.Attributes]?.tagName;
1668
+ const tagName = state.contextParams["Attributes"]?.tagName;
1730
1669
  state.accumulatedContent.clear();
1731
1670
  state.decisionBuffer.clear();
1732
- state.currentContext = TokenizerContextTypes.OpenTagEnd;
1733
- state.contextParams[TokenizerContextTypes.OpenTagEnd] = { tagName };
1734
- state.contextParams[TokenizerContextTypes.Attributes] = void 0;
1671
+ state.currentContext = "OpenTagEnd";
1672
+ state.contextParams["OpenTagEnd"] = { tagName };
1673
+ state.contextParams["Attributes"] = void 0;
1735
1674
  }
1736
1675
  function parseEqual(state) {
1737
1676
  const position = calculateTokenPosition(state, { keepBuffer: true });
1738
1677
  state.tokens.push({
1739
- type: TokenTypes.AttributeAssignment,
1678
+ type: "AttributeAssignment",
1740
1679
  value: state.decisionBuffer.value(),
1741
1680
  range: position.range,
1742
1681
  loc: position.loc
1743
1682
  });
1744
1683
  state.accumulatedContent.clear();
1745
1684
  state.decisionBuffer.clear();
1746
- state.currentContext = TokenizerContextTypes.AttributeValue;
1685
+ state.currentContext = "AttributeValue";
1747
1686
  state.sourceCode.next();
1748
1687
  }
1749
1688
  function parseNoneWhitespace(chars, state) {
1750
1689
  state.accumulatedContent.replace(state.decisionBuffer);
1751
- state.currentContext = TokenizerContextTypes.AttributeKey;
1690
+ state.currentContext = "AttributeKey";
1752
1691
  state.decisionBuffer.clear();
1753
1692
  state.sourceCode.next();
1754
1693
  }
1755
-
1756
- //#endregion
1757
- //#region src/tokenizer/handlers/openTagEnd.ts
1758
- var openTagEnd_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$19 });
1759
- function parse$19(chars, state) {
1760
- if (chars.value() === SPECIAL_CHAR.closingCorner) return parseClosingCornerBrace$4(state);
1761
- state.accumulatedContent.concatBuffer(state.decisionBuffer);
1694
+ function parse$20(chars, state) {
1695
+ const value = chars.value();
1696
+ if (value === SPECIAL_CHAR.closingCorner || value === SPECIAL_CHAR.slash) return parseTagEnd$3(state);
1697
+ if (value === SPECIAL_CHAR.equal) return parseEqual(state);
1698
+ if (!isWhitespace(value)) return parseNoneWhitespace(chars, state);
1762
1699
  state.decisionBuffer.clear();
1763
1700
  state.sourceCode.next();
1764
1701
  }
1702
+ //#endregion
1703
+ //#region src/tokenizer/handlers/openTagEnd.ts
1704
+ var openTagEnd_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$19 });
1765
1705
  function parseClosingCornerBrace$4(state) {
1766
1706
  const position = calculateTokenPosition(state, { keepBuffer: true });
1767
1707
  state.tokens.push({
1768
- type: TokenTypes.OpenTagEnd,
1708
+ type: "OpenTagEnd",
1769
1709
  value: state.accumulatedContent.value() + state.decisionBuffer.value(),
1770
1710
  range: position.range,
1771
1711
  loc: position.loc
1772
1712
  });
1773
1713
  state.accumulatedContent.clear();
1774
1714
  state.decisionBuffer.clear();
1775
- state.currentContext = TokenizerContextTypes.Data;
1715
+ state.currentContext = "Data";
1776
1716
  state.sourceCode.next();
1777
- state.contextParams[TokenizerContextTypes.OpenTagEnd] = void 0;
1717
+ state.contextParams["OpenTagEnd"] = void 0;
1778
1718
  }
1779
-
1780
- //#endregion
1781
- //#region src/tokenizer/handlers/doctypeOpen.ts
1782
- var doctypeOpen_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$18 });
1783
- function parse$18(chars, state) {
1784
- const value = chars.value();
1785
- if (isWhitespace(value)) return parseWhitespace$1(state);
1786
- if (value === SPECIAL_CHAR.closingCorner) return parseClosingCornerBrace$3(state);
1719
+ function parse$19(chars, state) {
1720
+ if (chars.value() === SPECIAL_CHAR.closingCorner) return parseClosingCornerBrace$4(state);
1721
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
1787
1722
  state.decisionBuffer.clear();
1788
1723
  state.sourceCode.next();
1789
1724
  }
1725
+ //#endregion
1726
+ //#region src/tokenizer/handlers/doctypeOpen.ts
1727
+ var doctypeOpen_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$18 });
1790
1728
  function generateDoctypeOpenToken(state) {
1791
1729
  const position = calculateTokenPosition(state, { keepBuffer: false });
1792
1730
  return {
1793
- type: TokenTypes.DoctypeOpen,
1731
+ type: "DoctypeOpen",
1794
1732
  value: state.accumulatedContent.value(),
1795
1733
  range: position.range,
1796
1734
  loc: position.loc
@@ -1800,24 +1738,24 @@ function parseWhitespace$1(state) {
1800
1738
  state.tokens.push(generateDoctypeOpenToken(state));
1801
1739
  state.accumulatedContent.clear();
1802
1740
  state.decisionBuffer.clear();
1803
- state.currentContext = TokenizerContextTypes.DoctypeAttributes;
1741
+ state.currentContext = "DoctypeAttributes";
1804
1742
  }
1805
1743
  function parseClosingCornerBrace$3(state) {
1806
1744
  state.tokens.push(generateDoctypeOpenToken(state));
1807
1745
  state.accumulatedContent.clear();
1808
1746
  state.decisionBuffer.clear();
1809
- state.currentContext = TokenizerContextTypes.DoctypeClose;
1747
+ state.currentContext = "DoctypeClose";
1810
1748
  }
1811
-
1812
- //#endregion
1813
- //#region src/tokenizer/handlers/attributeKey.ts
1814
- var attributeKey_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$17 });
1815
- function parse$17(chars, state) {
1816
- if (isKeyBreak$1(chars)) return parseKeyEnd$1(state);
1817
- state.accumulatedContent.concatBuffer(state.decisionBuffer);
1749
+ function parse$18(chars, state) {
1750
+ const value = chars.value();
1751
+ if (isWhitespace(value)) return parseWhitespace$1(state);
1752
+ if (value === SPECIAL_CHAR.closingCorner) return parseClosingCornerBrace$3(state);
1818
1753
  state.decisionBuffer.clear();
1819
1754
  state.sourceCode.next();
1820
1755
  }
1756
+ //#endregion
1757
+ //#region src/tokenizer/handlers/attributeKey.ts
1758
+ var attributeKey_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$17 });
1821
1759
  function isKeyBreak$1(chars) {
1822
1760
  const value = chars.value();
1823
1761
  return value === SPECIAL_CHAR.equal || value === SPECIAL_CHAR.slash || value === SPECIAL_CHAR.closingCorner || isWhitespace(value);
@@ -1825,376 +1763,363 @@ function isKeyBreak$1(chars) {
1825
1763
  function parseKeyEnd$1(state) {
1826
1764
  const position = calculateTokenPosition(state, { keepBuffer: false });
1827
1765
  state.tokens.push({
1828
- type: TokenTypes.AttributeKey,
1766
+ type: "AttributeKey",
1829
1767
  value: state.accumulatedContent.value(),
1830
1768
  range: position.range,
1831
1769
  loc: position.loc
1832
1770
  });
1833
1771
  state.accumulatedContent.clear();
1834
1772
  state.decisionBuffer.clear();
1835
- state.currentContext = TokenizerContextTypes.Attributes;
1773
+ state.currentContext = "Attributes";
1774
+ }
1775
+ function parse$17(chars, state) {
1776
+ if (isKeyBreak$1(chars)) return parseKeyEnd$1(state);
1777
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
1778
+ state.decisionBuffer.clear();
1779
+ state.sourceCode.next();
1836
1780
  }
1837
-
1838
1781
  //#endregion
1839
1782
  //#region src/tokenizer/handlers/doctypeClose.ts
1840
1783
  var doctypeClose_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$16 });
1841
1784
  function parse$16(chars, state) {
1842
1785
  const position = calculateTokenPosition(state, { keepBuffer: true });
1843
1786
  state.tokens.push({
1844
- type: TokenTypes.DoctypeClose,
1787
+ type: "DoctypeClose",
1845
1788
  value: state.decisionBuffer.value(),
1846
1789
  range: position.range,
1847
1790
  loc: position.loc
1848
1791
  });
1849
1792
  state.accumulatedContent.clear();
1850
1793
  state.decisionBuffer.clear();
1851
- state.currentContext = TokenizerContextTypes.Data;
1794
+ state.currentContext = "Data";
1852
1795
  state.sourceCode.next();
1853
1796
  }
1854
-
1855
1797
  //#endregion
1856
1798
  //#region src/tokenizer/handlers/openTagStart.ts
1857
1799
  var openTagStart_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$15 });
1858
- function parse$15(chars, state) {
1859
- const value = chars.value();
1860
- if (value === SPECIAL_CHAR.closingCorner || value === SPECIAL_CHAR.slash) return parseTagEnd$2(state);
1861
- if (isWhitespace(value)) return parseWhitespace(state);
1862
- state.accumulatedContent.concatBuffer(state.decisionBuffer);
1863
- state.decisionBuffer.clear();
1864
- state.sourceCode.next();
1865
- }
1866
1800
  function parseTagEnd$2(state) {
1867
1801
  const tagName = parseOpenTagName(state.accumulatedContent.value());
1868
1802
  const position = calculateTokenPosition(state, { keepBuffer: false });
1869
1803
  state.tokens.push({
1870
- type: TokenTypes.OpenTagStart,
1804
+ type: "OpenTagStart",
1871
1805
  value: state.accumulatedContent.value(),
1872
1806
  range: position.range,
1873
1807
  loc: position.loc
1874
1808
  });
1875
1809
  state.accumulatedContent.clear();
1876
1810
  state.decisionBuffer.clear();
1877
- state.currentContext = TokenizerContextTypes.OpenTagEnd;
1878
- state.contextParams[TokenizerContextTypes.OpenTagEnd] = { tagName };
1811
+ state.currentContext = "OpenTagEnd";
1812
+ state.contextParams["OpenTagEnd"] = { tagName };
1879
1813
  }
1880
1814
  function parseWhitespace(state) {
1881
1815
  const tagName = parseOpenTagName(state.accumulatedContent.value());
1882
1816
  const position = calculateTokenPosition(state, { keepBuffer: false });
1883
1817
  state.tokens.push({
1884
- type: TokenTypes.OpenTagStart,
1818
+ type: "OpenTagStart",
1885
1819
  value: state.accumulatedContent.value(),
1886
1820
  range: position.range,
1887
1821
  loc: position.loc
1888
1822
  });
1889
1823
  state.accumulatedContent.clear();
1890
1824
  state.decisionBuffer.clear();
1891
- state.currentContext = TokenizerContextTypes.Attributes;
1892
- state.contextParams[TokenizerContextTypes.Attributes] = { tagName };
1825
+ state.currentContext = "Attributes";
1826
+ state.contextParams["Attributes"] = { tagName };
1893
1827
  state.sourceCode.next();
1894
1828
  }
1895
-
1896
- //#endregion
1897
- //#region src/tokenizer/handlers/attributeValue.ts
1898
- var attributeValue_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$14 });
1899
- function parse$14(chars, state) {
1829
+ function parse$15(chars, state) {
1900
1830
  const value = chars.value();
1901
- if (value === SPECIAL_CHAR.doubleQuote || value === SPECIAL_CHAR.singleQuote) return parseWrapper$5(state);
1902
- if (value === SPECIAL_CHAR.closingCorner || value === SPECIAL_CHAR.slash) return parseTagEnd$1(state);
1903
- if (!isWhitespace(value)) return parseBare$2(state);
1831
+ if (value === SPECIAL_CHAR.closingCorner || value === SPECIAL_CHAR.slash) return parseTagEnd$2(state);
1832
+ if (isWhitespace(value)) return parseWhitespace(state);
1833
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
1904
1834
  state.decisionBuffer.clear();
1905
1835
  state.sourceCode.next();
1906
1836
  }
1837
+ //#endregion
1838
+ //#region src/tokenizer/handlers/attributeValue.ts
1839
+ var attributeValue_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$14 });
1907
1840
  function parseWrapper$5(state) {
1908
1841
  const wrapper = state.decisionBuffer.value();
1909
1842
  const range = [state.sourceCode.index(), state.sourceCode.index() + 1];
1910
1843
  state.tokens.push({
1911
- type: TokenTypes.AttributeValueWrapperStart,
1844
+ type: "AttributeValueWrapperStart",
1912
1845
  value: wrapper,
1913
1846
  range,
1914
1847
  loc: state.sourceCode.getLocationOf(range)
1915
1848
  });
1916
1849
  state.accumulatedContent.clear();
1917
1850
  state.decisionBuffer.clear();
1918
- state.currentContext = TokenizerContextTypes.AttributeValueWrapped;
1919
- state.contextParams[TokenizerContextTypes.AttributeValueWrapped] = { wrapper };
1851
+ state.currentContext = "AttributeValueWrapped";
1852
+ state.contextParams["AttributeValueWrapped"] = { wrapper };
1920
1853
  state.sourceCode.next();
1921
1854
  }
1922
1855
  function parseTagEnd$1(state) {
1923
1856
  state.accumulatedContent.clear();
1924
1857
  state.decisionBuffer.clear();
1925
- state.currentContext = TokenizerContextTypes.Attributes;
1858
+ state.currentContext = "Attributes";
1926
1859
  }
1927
1860
  function parseBare$2(state) {
1928
1861
  state.accumulatedContent.replace(state.decisionBuffer);
1929
1862
  state.decisionBuffer.clear();
1930
- state.currentContext = TokenizerContextTypes.AttributeValueBare;
1863
+ state.currentContext = "AttributeValueBare";
1931
1864
  state.sourceCode.next();
1932
1865
  }
1933
-
1934
- //#endregion
1935
- //#region src/tokenizer/handlers/commentContent.ts
1936
- var commentContent_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$13 });
1937
- function parse$13(chars, state) {
1866
+ function parse$14(chars, state) {
1938
1867
  const value = chars.value();
1939
- if (value === SPECIAL_CHAR.hyphen || value === "--") return state.sourceCode.next();
1940
- if (value === COMMENT_END) return parseCommentClose(state);
1941
- state.accumulatedContent.concatBuffer(state.decisionBuffer);
1868
+ if (value === SPECIAL_CHAR.doubleQuote || value === SPECIAL_CHAR.singleQuote) return parseWrapper$5(state);
1869
+ if (value === SPECIAL_CHAR.closingCorner || value === SPECIAL_CHAR.slash) return parseTagEnd$1(state);
1870
+ if (!isWhitespace(value)) return parseBare$2(state);
1942
1871
  state.decisionBuffer.clear();
1943
1872
  state.sourceCode.next();
1944
1873
  }
1874
+ //#endregion
1875
+ //#region src/tokenizer/handlers/commentContent.ts
1876
+ var commentContent_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$13 });
1945
1877
  function parseCommentClose(state) {
1946
1878
  const position = calculateTokenPosition(state, { keepBuffer: false });
1947
- const endRange = [position.range[1], position.range[1] + COMMENT_END.length];
1879
+ const endRange = [position.range[1], position.range[1] + 3];
1948
1880
  state.tokens.push({
1949
- type: TokenTypes.CommentContent,
1881
+ type: "CommentContent",
1950
1882
  value: state.accumulatedContent.value(),
1951
1883
  range: position.range,
1952
1884
  loc: position.loc
1953
1885
  });
1954
1886
  state.tokens.push({
1955
- type: TokenTypes.CommentClose,
1887
+ type: "CommentClose",
1956
1888
  value: state.decisionBuffer.value(),
1957
1889
  range: endRange,
1958
1890
  loc: state.sourceCode.getLocationOf(endRange)
1959
1891
  });
1960
1892
  state.accumulatedContent.clear();
1961
1893
  state.decisionBuffer.clear();
1962
- state.currentContext = TokenizerContextTypes.Data;
1894
+ state.currentContext = "Data";
1963
1895
  state.sourceCode.next();
1964
1896
  }
1965
-
1966
- //#endregion
1967
- //#region src/tokenizer/handlers/doctypeAttributes.ts
1968
- var doctypeAttributes_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$12 });
1969
- function parse$12(chars, state) {
1897
+ function parse$13(chars, state) {
1970
1898
  const value = chars.value();
1971
- if (value === SPECIAL_CHAR.doubleQuote || value === SPECIAL_CHAR.singleQuote) return parseWrapper$4(state);
1972
- if (value === SPECIAL_CHAR.closingCorner) return parseClosingCornerBrace$2(state);
1973
- if (!isWhitespace(value)) return parseBare$1(state);
1899
+ if (value === SPECIAL_CHAR.hyphen || value === "--") return state.sourceCode.next();
1900
+ if (value === "-->") return parseCommentClose(state);
1901
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
1974
1902
  state.decisionBuffer.clear();
1975
1903
  state.sourceCode.next();
1976
1904
  }
1905
+ //#endregion
1906
+ //#region src/tokenizer/handlers/doctypeAttributes.ts
1907
+ var doctypeAttributes_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$12 });
1977
1908
  function parseWrapper$4(state) {
1978
1909
  const wrapper = state.decisionBuffer.value();
1979
1910
  const range = [state.sourceCode.index(), state.sourceCode.index() + wrapper.length];
1980
1911
  state.tokens.push({
1981
- type: TokenTypes.DoctypeAttributeWrapperStart,
1912
+ type: "DoctypeAttributeWrapperStart",
1982
1913
  value: wrapper,
1983
1914
  range,
1984
1915
  loc: state.sourceCode.getLocationOf(range)
1985
1916
  });
1986
1917
  state.accumulatedContent.clear();
1987
1918
  state.decisionBuffer.clear();
1988
- state.currentContext = TokenizerContextTypes.DoctypeAttributeWrapped;
1989
- state.contextParams[TokenizerContextTypes.DoctypeAttributeWrapped] = { wrapper };
1919
+ state.currentContext = "DoctypeAttributeWrapped";
1920
+ state.contextParams["DoctypeAttributeWrapped"] = { wrapper };
1990
1921
  state.sourceCode.next();
1991
1922
  }
1992
1923
  function parseClosingCornerBrace$2(state) {
1993
1924
  state.accumulatedContent.clear();
1994
1925
  state.decisionBuffer.clear();
1995
- state.currentContext = TokenizerContextTypes.DoctypeClose;
1926
+ state.currentContext = "DoctypeClose";
1996
1927
  }
1997
1928
  function parseBare$1(state) {
1998
1929
  state.accumulatedContent.replace(state.decisionBuffer);
1999
1930
  state.decisionBuffer.clear();
2000
- state.currentContext = TokenizerContextTypes.DoctypeAttributeBare;
1931
+ state.currentContext = "DoctypeAttributeBare";
2001
1932
  state.sourceCode.next();
2002
1933
  }
2003
-
2004
- //#endregion
2005
- //#region src/tokenizer/handlers/attributeValueBare.ts
2006
- var attributeValueBare_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$11 });
2007
- function parse$11(chars, state) {
1934
+ function parse$12(chars, state) {
2008
1935
  const value = chars.value();
2009
- if (isWhitespace(value) || value === SPECIAL_CHAR.closingCorner || value === SPECIAL_CHAR.slash) return parseValueEnd(state);
2010
- state.accumulatedContent.concatBuffer(state.decisionBuffer);
1936
+ if (value === SPECIAL_CHAR.doubleQuote || value === SPECIAL_CHAR.singleQuote) return parseWrapper$4(state);
1937
+ if (value === SPECIAL_CHAR.closingCorner) return parseClosingCornerBrace$2(state);
1938
+ if (!isWhitespace(value)) return parseBare$1(state);
2011
1939
  state.decisionBuffer.clear();
2012
1940
  state.sourceCode.next();
2013
1941
  }
1942
+ //#endregion
1943
+ //#region src/tokenizer/handlers/attributeValueBare.ts
1944
+ var attributeValueBare_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$11 });
2014
1945
  function parseValueEnd(state) {
2015
1946
  const position = calculateTokenPosition(state, { keepBuffer: false });
2016
1947
  state.tokens.push({
2017
- type: TokenTypes.AttributeValue,
1948
+ type: "AttributeValue",
2018
1949
  value: state.accumulatedContent.value(),
2019
1950
  range: position.range,
2020
1951
  loc: position.loc
2021
1952
  });
2022
1953
  state.accumulatedContent.clear();
2023
1954
  state.decisionBuffer.clear();
2024
- state.currentContext = TokenizerContextTypes.Attributes;
1955
+ state.currentContext = "Attributes";
2025
1956
  }
2026
-
2027
- //#endregion
2028
- //#region src/tokenizer/handlers/xmlDeclarationOpen.ts
2029
- var xmlDeclarationOpen_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$10 });
2030
- function parse$10(chars, state) {
2031
- if (chars.value() === SPECIAL_CHAR.closingCorner) return parseClosingCornerBrace$1(state);
1957
+ function parse$11(chars, state) {
1958
+ const value = chars.value();
1959
+ if (isWhitespace(value) || value === SPECIAL_CHAR.closingCorner || value === SPECIAL_CHAR.slash) return parseValueEnd(state);
2032
1960
  state.accumulatedContent.concatBuffer(state.decisionBuffer);
2033
1961
  state.decisionBuffer.clear();
2034
1962
  state.sourceCode.next();
2035
1963
  }
1964
+ //#endregion
1965
+ //#region src/tokenizer/handlers/xmlDeclarationOpen.ts
1966
+ var xmlDeclarationOpen_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$10 });
2036
1967
  function parseClosingCornerBrace$1(state) {
2037
1968
  const position = calculateTokenPosition(state, { keepBuffer: true });
2038
1969
  state.tokens.push({
2039
- type: TokenTypes.OpenTagEnd,
1970
+ type: "OpenTagEnd",
2040
1971
  value: state.accumulatedContent.value() + state.decisionBuffer.value(),
2041
1972
  range: position.range,
2042
1973
  loc: position.loc
2043
1974
  });
2044
1975
  state.accumulatedContent.clear();
2045
1976
  state.decisionBuffer.clear();
2046
- state.currentContext = TokenizerContextTypes.Data;
1977
+ state.currentContext = "Data";
2047
1978
  state.sourceCode.next();
2048
- state.contextParams[TokenizerContextTypes.OpenTagEnd] = void 0;
1979
+ state.contextParams["OpenTagEnd"] = void 0;
2049
1980
  }
2050
-
2051
- //#endregion
2052
- //#region src/tokenizer/handlers/xmlDeclarationClose.ts
2053
- var xmlDeclarationClose_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$9 });
2054
- function parse$9(chars, state) {
2055
- if (chars.value() === SPECIAL_CHAR.closingCorner) return parseClosingCornerBrace(state);
1981
+ function parse$10(chars, state) {
1982
+ if (chars.value() === SPECIAL_CHAR.closingCorner) return parseClosingCornerBrace$1(state);
2056
1983
  state.accumulatedContent.concatBuffer(state.decisionBuffer);
2057
1984
  state.decisionBuffer.clear();
2058
1985
  state.sourceCode.next();
2059
1986
  }
1987
+ //#endregion
1988
+ //#region src/tokenizer/handlers/xmlDeclarationClose.ts
1989
+ var xmlDeclarationClose_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$9 });
2060
1990
  function parseClosingCornerBrace(state) {
2061
1991
  const position = calculateTokenPosition(state, { keepBuffer: true });
2062
1992
  state.tokens.push({
2063
- type: TokenTypes.OpenTagEnd,
1993
+ type: "OpenTagEnd",
2064
1994
  value: state.accumulatedContent.value() + state.decisionBuffer.value(),
2065
1995
  range: position.range,
2066
1996
  loc: position.loc
2067
1997
  });
2068
1998
  state.accumulatedContent.clear();
2069
1999
  state.decisionBuffer.clear();
2070
- state.currentContext = TokenizerContextTypes.Data;
2000
+ state.currentContext = "Data";
2071
2001
  state.sourceCode.next();
2072
- state.contextParams[TokenizerContextTypes.OpenTagEnd] = void 0;
2002
+ state.contextParams["OpenTagEnd"] = void 0;
2073
2003
  }
2074
-
2075
- //#endregion
2076
- //#region src/tokenizer/handlers/doctypeAttributeBare.ts
2077
- var doctypeAttributeBare_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$8 });
2078
- function parse$8(chars, state) {
2079
- const value = chars.value();
2080
- if (isWhitespace(value) || value === SPECIAL_CHAR.closingCorner) return parseAttributeEnd(state);
2004
+ function parse$9(chars, state) {
2005
+ if (chars.value() === SPECIAL_CHAR.closingCorner) return parseClosingCornerBrace(state);
2081
2006
  state.accumulatedContent.concatBuffer(state.decisionBuffer);
2082
2007
  state.decisionBuffer.clear();
2083
2008
  state.sourceCode.next();
2084
2009
  }
2010
+ //#endregion
2011
+ //#region src/tokenizer/handlers/doctypeAttributeBare.ts
2012
+ var doctypeAttributeBare_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$8 });
2085
2013
  function parseAttributeEnd(state) {
2086
2014
  const position = calculateTokenPosition(state, { keepBuffer: false });
2087
2015
  state.tokens.push({
2088
- type: TokenTypes.DoctypeAttributeValue,
2016
+ type: "DoctypeAttributeValue",
2089
2017
  value: state.accumulatedContent.value(),
2090
2018
  range: position.range,
2091
2019
  loc: position.loc
2092
2020
  });
2093
2021
  state.accumulatedContent.clear();
2094
2022
  state.decisionBuffer.clear();
2095
- state.currentContext = TokenizerContextTypes.DoctypeAttributes;
2023
+ state.currentContext = "DoctypeAttributes";
2096
2024
  }
2097
-
2098
- //#endregion
2099
- //#region src/tokenizer/handlers/attributeValueWrapped.ts
2100
- var attributeValueWrapped_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$7 });
2101
- function parse$7(chars, state) {
2102
- const wrapperChar = state.contextParams[TokenizerContextTypes.AttributeValueWrapped]?.wrapper;
2103
- if (chars.value() === wrapperChar) return parseWrapper$3(state);
2025
+ function parse$8(chars, state) {
2026
+ const value = chars.value();
2027
+ if (isWhitespace(value) || value === SPECIAL_CHAR.closingCorner) return parseAttributeEnd(state);
2104
2028
  state.accumulatedContent.concatBuffer(state.decisionBuffer);
2105
2029
  state.decisionBuffer.clear();
2106
2030
  state.sourceCode.next();
2107
2031
  }
2032
+ //#endregion
2033
+ //#region src/tokenizer/handlers/attributeValueWrapped.ts
2034
+ var attributeValueWrapped_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$7 });
2108
2035
  function parseWrapper$3(state) {
2109
2036
  const position = calculateTokenPosition(state, { keepBuffer: false });
2110
2037
  const endWrapperPosition = position.range[1];
2111
2038
  state.tokens.push({
2112
- type: TokenTypes.AttributeValue,
2039
+ type: "AttributeValue",
2113
2040
  value: state.accumulatedContent.value(),
2114
2041
  range: position.range,
2115
2042
  loc: position.loc
2116
2043
  });
2117
2044
  const range = [endWrapperPosition, endWrapperPosition + 1];
2118
2045
  state.tokens.push({
2119
- type: TokenTypes.AttributeValueWrapperEnd,
2046
+ type: "AttributeValueWrapperEnd",
2120
2047
  value: state.decisionBuffer.value(),
2121
2048
  range,
2122
2049
  loc: state.sourceCode.getLocationOf(range)
2123
2050
  });
2124
2051
  state.accumulatedContent.clear();
2125
2052
  state.decisionBuffer.clear();
2126
- state.currentContext = TokenizerContextTypes.Attributes;
2053
+ state.currentContext = "Attributes";
2127
2054
  state.sourceCode.next();
2128
- state.contextParams[TokenizerContextTypes.AttributeValueWrapped] = void 0;
2055
+ state.contextParams["AttributeValueWrapped"] = void 0;
2129
2056
  }
2130
-
2131
- //#endregion
2132
- //#region src/tokenizer/handlers/doctypeAttributeWrapped.ts
2133
- var doctypeAttributeWrapped_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$6 });
2134
- function parse$6(chars, state) {
2135
- if (chars.value() === state.contextParams[TokenizerContextTypes.DoctypeAttributeWrapped]?.wrapper) return parseWrapper$2(state);
2057
+ function parse$7(chars, state) {
2058
+ const wrapperChar = state.contextParams["AttributeValueWrapped"]?.wrapper;
2059
+ if (chars.value() === wrapperChar) return parseWrapper$3(state);
2136
2060
  state.accumulatedContent.concatBuffer(state.decisionBuffer);
2137
2061
  state.decisionBuffer.clear();
2138
2062
  state.sourceCode.next();
2139
2063
  }
2064
+ //#endregion
2065
+ //#region src/tokenizer/handlers/doctypeAttributeWrapped.ts
2066
+ var doctypeAttributeWrapped_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$6 });
2140
2067
  function parseWrapper$2(state) {
2141
2068
  const position = calculateTokenPosition(state, { keepBuffer: false });
2142
2069
  const endWrapperPosition = position.range[1];
2143
2070
  state.tokens.push({
2144
- type: TokenTypes.DoctypeAttributeValue,
2071
+ type: "DoctypeAttributeValue",
2145
2072
  value: state.accumulatedContent.value(),
2146
2073
  range: position.range,
2147
2074
  loc: position.loc
2148
2075
  });
2149
2076
  const range = [endWrapperPosition, endWrapperPosition + 1];
2150
2077
  state.tokens.push({
2151
- type: TokenTypes.DoctypeAttributeWrapperEnd,
2078
+ type: "DoctypeAttributeWrapperEnd",
2152
2079
  value: state.decisionBuffer.value(),
2153
2080
  range,
2154
2081
  loc: state.sourceCode.getLocationOf(range)
2155
2082
  });
2156
2083
  state.accumulatedContent.clear();
2157
2084
  state.decisionBuffer.clear();
2158
- state.currentContext = TokenizerContextTypes.DoctypeAttributes;
2085
+ state.currentContext = "DoctypeAttributes";
2159
2086
  state.sourceCode.next();
2160
- state.contextParams[TokenizerContextTypes.DoctypeAttributeWrapped] = void 0;
2087
+ state.contextParams["DoctypeAttributeWrapped"] = void 0;
2161
2088
  }
2162
-
2163
- //#endregion
2164
- //#region src/tokenizer/handlers/xmlDeclarationAttributes.ts
2165
- var xmlDeclarationAttributes_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$5 });
2166
- function parse$5(chars, state) {
2167
- const value = chars.value();
2168
- if (value === SPECIAL_CHAR.question || value === SPECIAL_CHAR.closingCorner) return parseXMLDeclarationClose(state);
2169
- if (value === XML_DECLARATION_END) return parseXMLDeclarationClose(state);
2089
+ function parse$6(chars, state) {
2090
+ if (chars.value() === state.contextParams["DoctypeAttributeWrapped"]?.wrapper) return parseWrapper$2(state);
2170
2091
  state.accumulatedContent.concatBuffer(state.decisionBuffer);
2171
2092
  state.decisionBuffer.clear();
2172
2093
  state.sourceCode.next();
2173
2094
  }
2095
+ //#endregion
2096
+ //#region src/tokenizer/handlers/xmlDeclarationAttributes.ts
2097
+ var xmlDeclarationAttributes_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$5 });
2174
2098
  function parseXMLDeclarationClose(state) {
2175
2099
  const position = calculateTokenPosition(state, { keepBuffer: false });
2176
- const endRange = [position.range[1], position.range[1] + XML_DECLARATION_END.length];
2100
+ const endRange = [position.range[1], position.range[1] + 2];
2177
2101
  state.tokens.push({
2178
- type: TokenTypes.XMLDeclarationClose,
2102
+ type: "XMLDeclarationClose",
2179
2103
  value: state.decisionBuffer.value(),
2180
2104
  range: endRange,
2181
2105
  loc: state.sourceCode.getLocationOf(endRange)
2182
2106
  });
2183
2107
  state.accumulatedContent.clear();
2184
2108
  state.decisionBuffer.clear();
2185
- state.currentContext = TokenizerContextTypes.Data;
2109
+ state.currentContext = "Data";
2186
2110
  state.sourceCode.next();
2187
2111
  }
2188
-
2189
- //#endregion
2190
- //#region src/tokenizer/handlers/xmlDeclarationAttributeKey.ts
2191
- var xmlDeclarationAttributeKey_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$4 });
2192
- function parse$4(chars, state) {
2193
- if (isKeyBreak(chars)) return parseKeyEnd(state);
2112
+ function parse$5(chars, state) {
2113
+ const value = chars.value();
2114
+ if (value === SPECIAL_CHAR.question || value === SPECIAL_CHAR.closingCorner) return parseXMLDeclarationClose(state);
2115
+ if (value === "?>") return parseXMLDeclarationClose(state);
2194
2116
  state.accumulatedContent.concatBuffer(state.decisionBuffer);
2195
2117
  state.decisionBuffer.clear();
2196
2118
  state.sourceCode.next();
2197
2119
  }
2120
+ //#endregion
2121
+ //#region src/tokenizer/handlers/xmlDeclarationAttributeKey.ts
2122
+ var xmlDeclarationAttributeKey_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$4 });
2198
2123
  function isKeyBreak(chars) {
2199
2124
  const value = chars.value();
2200
2125
  return value === SPECIAL_CHAR.equal || value === SPECIAL_CHAR.slash || value === SPECIAL_CHAR.closingCorner || isWhitespace(value);
@@ -2202,94 +2127,98 @@ function isKeyBreak(chars) {
2202
2127
  function parseKeyEnd(state) {
2203
2128
  const position = calculateTokenPosition(state, { keepBuffer: false });
2204
2129
  state.tokens.push({
2205
- type: TokenTypes.XMLDeclarationAttributeKey,
2130
+ type: "XMLDeclarationAttributeKey",
2206
2131
  value: state.accumulatedContent.value(),
2207
2132
  range: position.range,
2208
2133
  loc: position.loc
2209
2134
  });
2210
2135
  state.accumulatedContent.clear();
2211
2136
  state.decisionBuffer.clear();
2212
- state.currentContext = TokenizerContextTypes.XMLDeclarationAttributes;
2137
+ state.currentContext = "XMLDeclarationAttributes";
2213
2138
  }
2214
-
2215
- //#endregion
2216
- //#region src/tokenizer/handlers/xmlDeclarationAttributeValue.ts
2217
- var xmlDeclarationAttributeValue_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$3 });
2218
- function parse$3(chars, state) {
2219
- const value = chars.value();
2220
- if (value === SPECIAL_CHAR.doubleQuote || value === SPECIAL_CHAR.singleQuote) return parseWrapper$1(state);
2221
- if (value === SPECIAL_CHAR.closingCorner || value === SPECIAL_CHAR.slash) return parseTagEnd(state);
2222
- if (!isWhitespace(value)) return parseBare(state);
2139
+ function parse$4(chars, state) {
2140
+ if (isKeyBreak(chars)) return parseKeyEnd(state);
2141
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
2223
2142
  state.decisionBuffer.clear();
2224
2143
  state.sourceCode.next();
2225
2144
  }
2145
+ //#endregion
2146
+ //#region src/tokenizer/handlers/xmlDeclarationAttributeValue.ts
2147
+ var xmlDeclarationAttributeValue_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$3 });
2226
2148
  function parseWrapper$1(state) {
2227
2149
  const wrapper = state.decisionBuffer.value();
2228
2150
  const range = [state.sourceCode.index(), state.sourceCode.index() + 1];
2229
2151
  state.tokens.push({
2230
- type: TokenTypes.AttributeValueWrapperStart,
2152
+ type: "AttributeValueWrapperStart",
2231
2153
  value: wrapper,
2232
2154
  range,
2233
2155
  loc: state.sourceCode.getLocationOf(range)
2234
2156
  });
2235
2157
  state.accumulatedContent.clear();
2236
2158
  state.decisionBuffer.clear();
2237
- state.currentContext = TokenizerContextTypes.AttributeValueWrapped;
2238
- state.contextParams[TokenizerContextTypes.AttributeValueWrapped] = { wrapper };
2159
+ state.currentContext = "AttributeValueWrapped";
2160
+ state.contextParams["AttributeValueWrapped"] = { wrapper };
2239
2161
  state.sourceCode.next();
2240
2162
  }
2241
2163
  function parseTagEnd(state) {
2242
2164
  state.accumulatedContent.clear();
2243
2165
  state.decisionBuffer.clear();
2244
- state.currentContext = TokenizerContextTypes.Attributes;
2166
+ state.currentContext = "Attributes";
2245
2167
  }
2246
2168
  function parseBare(state) {
2247
2169
  state.accumulatedContent.replace(state.decisionBuffer);
2248
2170
  state.decisionBuffer.clear();
2249
- state.currentContext = TokenizerContextTypes.AttributeValueBare;
2171
+ state.currentContext = "AttributeValueBare";
2250
2172
  state.sourceCode.next();
2251
2173
  }
2252
-
2253
- //#endregion
2254
- //#region src/tokenizer/handlers/xmlDeclarationAttributeValueWrapped.ts
2255
- var xmlDeclarationAttributeValueWrapped_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$2 });
2256
- function parse$2(chars, state) {
2257
- const wrapperChar = state.contextParams[TokenizerContextTypes.AttributeValueWrapped]?.wrapper;
2258
- if (chars.value() === wrapperChar) return parseWrapper(state);
2259
- state.accumulatedContent.concatBuffer(state.decisionBuffer);
2174
+ function parse$3(chars, state) {
2175
+ const value = chars.value();
2176
+ if (value === SPECIAL_CHAR.doubleQuote || value === SPECIAL_CHAR.singleQuote) return parseWrapper$1(state);
2177
+ if (value === SPECIAL_CHAR.closingCorner || value === SPECIAL_CHAR.slash) return parseTagEnd(state);
2178
+ if (!isWhitespace(value)) return parseBare(state);
2260
2179
  state.decisionBuffer.clear();
2261
2180
  state.sourceCode.next();
2262
2181
  }
2182
+ //#endregion
2183
+ //#region src/tokenizer/handlers/xmlDeclarationAttributeValueWrapped.ts
2184
+ var xmlDeclarationAttributeValueWrapped_exports = /* @__PURE__ */ __exportAll({ parse: () => parse$2 });
2263
2185
  function parseWrapper(state) {
2264
2186
  const position = calculateTokenPosition(state, { keepBuffer: false });
2265
2187
  const endWrapperPosition = position.range[1];
2266
2188
  state.tokens.push({
2267
- type: TokenTypes.AttributeValue,
2189
+ type: "AttributeValue",
2268
2190
  value: state.accumulatedContent.value(),
2269
2191
  range: position.range,
2270
2192
  loc: position.loc
2271
2193
  });
2272
2194
  const range = [endWrapperPosition, endWrapperPosition + 1];
2273
2195
  state.tokens.push({
2274
- type: TokenTypes.AttributeValueWrapperEnd,
2196
+ type: "AttributeValueWrapperEnd",
2275
2197
  value: state.decisionBuffer.value(),
2276
2198
  range,
2277
2199
  loc: state.sourceCode.getLocationOf(range)
2278
2200
  });
2279
2201
  state.accumulatedContent.clear();
2280
2202
  state.decisionBuffer.clear();
2281
- state.currentContext = TokenizerContextTypes.Attributes;
2203
+ state.currentContext = "Attributes";
2204
+ state.sourceCode.next();
2205
+ state.contextParams["AttributeValueWrapped"] = void 0;
2206
+ }
2207
+ function parse$2(chars, state) {
2208
+ const wrapperChar = state.contextParams["AttributeValueWrapped"]?.wrapper;
2209
+ if (chars.value() === wrapperChar) return parseWrapper(state);
2210
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
2211
+ state.decisionBuffer.clear();
2282
2212
  state.sourceCode.next();
2283
- state.contextParams[TokenizerContextTypes.AttributeValueWrapped] = void 0;
2284
2213
  }
2285
-
2286
2214
  //#endregion
2287
2215
  //#region src/tokenizer/handlers/index.ts
2288
2216
  const noop = { parse: () => {} };
2289
-
2290
2217
  //#endregion
2291
2218
  //#region src/tokenizer/chars.ts
2292
2219
  var Chars = class {
2220
+ value;
2221
+ range;
2293
2222
  constructor(value, range) {
2294
2223
  this.value = value;
2295
2224
  this.range = range;
@@ -2305,10 +2234,10 @@ var Chars = class {
2305
2234
  return this.value.length;
2306
2235
  }
2307
2236
  };
2308
-
2309
2237
  //#endregion
2310
2238
  //#region src/tokenizer/sourceCode.ts
2311
2239
  var SourceCode = class {
2240
+ source;
2312
2241
  charsList;
2313
2242
  charsIndex = 0;
2314
2243
  constructor(source) {
@@ -2346,39 +2275,38 @@ var SourceCode = class {
2346
2275
  return charsList;
2347
2276
  }
2348
2277
  };
2349
-
2350
2278
  //#endregion
2351
2279
  //#region src/tokenizer/tokenize.ts
2352
2280
  const contextHandlers = {
2353
- [TokenizerContextTypes.Data]: data_exports,
2354
- [TokenizerContextTypes.XMLDeclarationOpen]: xmlDeclarationOpen_exports,
2355
- [TokenizerContextTypes.XMLDeclarationClose]: xmlDeclarationClose_exports,
2356
- [TokenizerContextTypes.XMLDeclarationAttributes]: xmlDeclarationAttributes_exports,
2357
- [TokenizerContextTypes.XMLDeclarationAttributeKey]: xmlDeclarationAttributeKey_exports,
2358
- [TokenizerContextTypes.XMLDeclarationAttributeValue]: xmlDeclarationAttributeValue_exports,
2359
- [TokenizerContextTypes.XMLDeclarationAttributeValueWrapped]: xmlDeclarationAttributeValueWrapped_exports,
2360
- [TokenizerContextTypes.Attributes]: attributes_exports,
2361
- [TokenizerContextTypes.AttributeKey]: attributeKey_exports,
2362
- [TokenizerContextTypes.AttributeValue]: attributeValue_exports,
2363
- [TokenizerContextTypes.AttributeValueBare]: attributeValueBare_exports,
2364
- [TokenizerContextTypes.AttributeValueWrapped]: attributeValueWrapped_exports,
2365
- [TokenizerContextTypes.OpenTagStart]: openTagStart_exports,
2366
- [TokenizerContextTypes.OpenTagEnd]: openTagEnd_exports,
2367
- [TokenizerContextTypes.CloseTag]: closeTag_exports,
2368
- [TokenizerContextTypes.DoctypeOpen]: doctypeOpen_exports,
2369
- [TokenizerContextTypes.DoctypeClose]: doctypeClose_exports,
2370
- [TokenizerContextTypes.DoctypeAttributes]: doctypeAttributes_exports,
2371
- [TokenizerContextTypes.DoctypeAttributeBare]: doctypeAttributeBare_exports,
2372
- [TokenizerContextTypes.DoctypeAttributeWrapped]: doctypeAttributeWrapped_exports,
2373
- [TokenizerContextTypes.CommentContent]: commentContent_exports,
2374
- [TokenizerContextTypes.CommentOpen]: noop,
2375
- [TokenizerContextTypes.CommentClose]: noop
2281
+ ["Data"]: data_exports,
2282
+ ["XMLDeclarationOpen"]: xmlDeclarationOpen_exports,
2283
+ ["XMLDeclarationClose"]: xmlDeclarationClose_exports,
2284
+ ["XMLDeclarationAttributes"]: xmlDeclarationAttributes_exports,
2285
+ ["XMLDeclarationAttributeKey"]: xmlDeclarationAttributeKey_exports,
2286
+ ["XMLDeclarationAttributeValue"]: xmlDeclarationAttributeValue_exports,
2287
+ ["XMLDeclarationAttributeValueWrapped"]: xmlDeclarationAttributeValueWrapped_exports,
2288
+ ["Attributes"]: attributes_exports,
2289
+ ["AttributeKey"]: attributeKey_exports,
2290
+ ["AttributeValue"]: attributeValue_exports,
2291
+ ["AttributeValueBare"]: attributeValueBare_exports,
2292
+ ["AttributeValueWrapped"]: attributeValueWrapped_exports,
2293
+ ["OpenTagStart"]: openTagStart_exports,
2294
+ ["OpenTagEnd"]: openTagEnd_exports,
2295
+ ["CloseTag"]: closeTag_exports,
2296
+ ["DoctypeOpen"]: doctypeOpen_exports,
2297
+ ["DoctypeClose"]: doctypeClose_exports,
2298
+ ["DoctypeAttributes"]: doctypeAttributes_exports,
2299
+ ["DoctypeAttributeBare"]: doctypeAttributeBare_exports,
2300
+ ["DoctypeAttributeWrapped"]: doctypeAttributeWrapped_exports,
2301
+ ["CommentContent"]: commentContent_exports,
2302
+ ["CommentOpen"]: noop,
2303
+ ["CommentClose"]: noop
2376
2304
  };
2377
2305
  function tokenizeChars(state) {
2378
2306
  while (!state.sourceCode.isEof()) {
2379
- const handler$1 = contextHandlers[state.currentContext];
2307
+ const handler = contextHandlers[state.currentContext];
2380
2308
  state.decisionBuffer.concat(state.sourceCode.current());
2381
- handler$1.parse(state.decisionBuffer, state);
2309
+ handler.parse(state.decisionBuffer, state);
2382
2310
  }
2383
2311
  const handler = contextHandlers[state.currentContext];
2384
2312
  state.sourceCode.prev();
@@ -2388,7 +2316,7 @@ function tokenize(source) {
2388
2316
  const tokens = [];
2389
2317
  const state = {
2390
2318
  contextParams: {},
2391
- currentContext: TokenizerContextTypes.Data,
2319
+ currentContext: "Data",
2392
2320
  sourceCode: new SourceCode(source),
2393
2321
  decisionBuffer: new CharsBuffer(),
2394
2322
  accumulatedContent: new CharsBuffer(),
@@ -2402,7 +2330,6 @@ function tokenize(source) {
2402
2330
  tokens
2403
2331
  };
2404
2332
  }
2405
-
2406
2333
  //#endregion
2407
2334
  //#region src/parser/parse.ts
2408
2335
  function parse$1(source, _options = {}) {
@@ -2413,11 +2340,10 @@ function parse$1(source, _options = {}) {
2413
2340
  tokens
2414
2341
  };
2415
2342
  }
2416
-
2417
2343
  //#endregion
2418
2344
  //#region src/visitorKeys.ts
2419
2345
  const keys = {
2420
- Program: ["body"],
2346
+ Program: ["document"],
2421
2347
  Document: ["children"],
2422
2348
  XMLDeclaration: ["attributes"],
2423
2349
  XMLDeclarationAttribute: ["key", "value"],
@@ -2429,47 +2355,52 @@ const keys = {
2429
2355
  Attribute: ["key", "value"],
2430
2356
  AttributeKey: [],
2431
2357
  AttributeValue: [],
2432
- Tag: ["attributes", "children"],
2358
+ Element: ["attributes", "children"],
2433
2359
  Comment: [],
2434
2360
  Text: [],
2435
2361
  Error: []
2436
2362
  };
2437
2363
  let vistorKeysCache = null;
2438
2364
  function getVisitorKeys() {
2439
- if (!vistorKeysCache) vistorKeysCache = unionWith(keys);
2365
+ if (!vistorKeysCache) {
2366
+ const merged = unionWith(keys);
2367
+ vistorKeysCache = {
2368
+ ...merged,
2369
+ Tag: merged.Element
2370
+ };
2371
+ }
2440
2372
  return vistorKeysCache;
2441
2373
  }
2442
2374
  const visitorKeys = getVisitorKeys();
2443
-
2444
2375
  //#endregion
2445
2376
  //#region src/parser/traverse.ts
2446
2377
  function traverse(node, visitor) {
2447
2378
  if (!node) return;
2448
2379
  visitor(node);
2449
- const keys$1 = visitorKeys[node.type];
2450
- if (!keys$1 || keys$1.length <= 0) return;
2451
- keys$1.forEach((key) => {
2380
+ const keys = visitorKeys[node.type];
2381
+ if (!keys || keys.length <= 0) return;
2382
+ keys.forEach((key) => {
2452
2383
  const value = node[key];
2453
- if (value) if (Array.isArray(value)) value.forEach((n) => traverse(n, visitor));
2384
+ if (value) if (Array.isArray(value)) value.forEach((v) => traverse(v, visitor));
2454
2385
  else traverse(value, visitor);
2455
2386
  });
2456
2387
  }
2457
-
2458
2388
  //#endregion
2459
2389
  //#region src/parser/parseForESLint.ts
2460
2390
  function parseForESLint(source, options = {}) {
2461
2391
  const { ast, tokens } = parse$1(source, options);
2462
2392
  const programNode = {
2463
- type: NodeTypes.Program,
2464
- body: [ast],
2393
+ type: "Program",
2394
+ body: [],
2465
2395
  comments: [],
2466
- tokens: tokens.filter((token) => token.type !== TokenTypes.CommentOpen && token.type !== TokenTypes.CommentClose && token.type !== TokenTypes.CommentContent),
2396
+ document: ast,
2397
+ tokens: tokens.filter((token) => token.type !== "CommentOpen" && token.type !== "CommentClose" && token.type !== "CommentContent"),
2467
2398
  range: ast.range,
2468
2399
  loc: ast.loc
2469
2400
  };
2470
2401
  const comments = [];
2471
2402
  traverse(programNode, (node) => {
2472
- if (node.type === NodeTypes.Comment) comments.push({
2403
+ if (node.type === "Comment") comments.push({
2473
2404
  type: "Block",
2474
2405
  value: node.content,
2475
2406
  range: node.range,
@@ -2484,14 +2415,12 @@ function parseForESLint(source, options = {}) {
2484
2415
  services: { isSVG: true }
2485
2416
  };
2486
2417
  }
2487
-
2488
2418
  //#endregion
2489
2419
  //#region src/index.ts
2490
2420
  const name = meta.name;
2491
2421
  const VisitorKeys = visitorKeys;
2492
2422
  function parse(code, options = {}) {
2493
- return parseForESLint(code, options).ast;
2423
+ return parseForESLint(code, options).ast.document;
2494
2424
  }
2495
-
2496
2425
  //#endregion
2497
- export { COMMENT_END, COMMENT_START, ConstructTreeContextTypes, DEPRECATED_SVG_ELEMENTS, NodeTypes, ParseError, RE_CLOSE_TAG_NAME, RE_INCOMPLETE_CLOSING_TAG, RE_OPEN_TAG_NAME, RE_OPEN_TAG_START, SELF_CLOSING_ELEMENTS, SPECIAL_CHAR, SVG_ELEMENTS, TokenTypes, TokenizerContextTypes, VisitorKeys, XML_DECLARATION_END, XML_DECLARATION_START, cloneNode, cloneNodeWithParent, countNodes, filterNodes, findFirstNodeByType, findNodeByType, getNodeDepth, getParentChain, isNodeType, mapNodes, meta, name, parse, parseForESLint, traverseAST, validateNode, walkAST };
2426
+ export { COMMENT_END, COMMENT_START, ConstructTreeContextTypes, DEPRECATED_SVG_ELEMENTS, NodeTypes, ParseError, RE_CLOSE_TAG_NAME, RE_INCOMPLETE_CLOSING_TAG, RE_OPEN_TAG_NAME, RE_OPEN_TAG_START, SELF_CLOSING_ELEMENTS, SPECIAL_CHAR, SVG_ELEMENTS, TokenTypes, TokenizerContextTypes, VisitorKeys, XML_DECLARATION_END, XML_DECLARATION_START, cloneNode, cloneNodeWithParent, countNodes, filterNodes, findFirstNodeByType, findNodeByType, getNodeDepth, getParentChain, isNodeType, mapNodes, meta, name, parse, parseForESLint, traverseAST, validateNode, walkAST };