@qelos/aidev 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/providers/clickup.d.ts.map +1 -1
  2. package/dist/providers/clickup.js +2 -11
  3. package/dist/providers/clickup.js.map +1 -1
  4. package/package.json +1 -1
  5. package/ui/.output/nitro.json +1 -1
  6. package/ui/.output/public/_nuxt/builds/latest.json +1 -1
  7. package/ui/.output/public/_nuxt/builds/meta/201c9849-97b7-4436-b6e4-26a47cf05d53.json +1 -0
  8. package/ui/.output/server/chunks/build/styles.mjs +4 -4
  9. package/ui/.output/server/chunks/build/styles.mjs.map +1 -1
  10. package/ui/.output/server/chunks/nitro/nitro.mjs +86 -86
  11. package/ui/.output/server/node_modules/entities/LICENSE +11 -0
  12. package/ui/.output/server/node_modules/entities/decode.d.ts +3 -0
  13. package/ui/.output/server/node_modules/entities/decode.js +3 -0
  14. package/ui/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.d.ts +19 -0
  15. package/ui/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.d.ts.map +1 -0
  16. package/ui/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
  17. package/ui/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.js.map +1 -0
  18. package/ui/.output/server/node_modules/entities/dist/commonjs/decode.d.ts +205 -0
  19. package/ui/.output/server/node_modules/entities/dist/commonjs/decode.d.ts.map +1 -0
  20. package/ui/.output/server/node_modules/entities/dist/commonjs/decode.js +568 -0
  21. package/ui/.output/server/node_modules/entities/dist/commonjs/decode.js.map +1 -0
  22. package/ui/.output/server/node_modules/entities/dist/commonjs/encode.d.ts +22 -0
  23. package/ui/.output/server/node_modules/entities/dist/commonjs/encode.d.ts.map +1 -0
  24. package/ui/.output/server/node_modules/entities/dist/commonjs/encode.js +92 -0
  25. package/ui/.output/server/node_modules/entities/dist/commonjs/encode.js.map +1 -0
  26. package/ui/.output/server/node_modules/entities/dist/commonjs/escape.d.ts +46 -0
  27. package/ui/.output/server/node_modules/entities/dist/commonjs/escape.d.ts.map +1 -0
  28. package/ui/.output/server/node_modules/entities/dist/commonjs/escape.js +138 -0
  29. package/ui/.output/server/node_modules/entities/dist/commonjs/escape.js.map +1 -0
  30. package/ui/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.d.ts +2 -0
  31. package/ui/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.d.ts.map +1 -0
  32. package/ui/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
  33. package/ui/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js.map +1 -0
  34. package/ui/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.d.ts +2 -0
  35. package/ui/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.d.ts.map +1 -0
  36. package/ui/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
  37. package/ui/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js.map +1 -0
  38. package/ui/.output/server/node_modules/entities/dist/commonjs/generated/encode-html.d.ts +3 -0
  39. package/ui/.output/server/node_modules/entities/dist/commonjs/generated/encode-html.d.ts.map +1 -0
  40. package/ui/.output/server/node_modules/entities/dist/commonjs/generated/encode-html.js +14 -0
  41. package/ui/.output/server/node_modules/entities/dist/commonjs/generated/encode-html.js.map +1 -0
  42. package/ui/.output/server/node_modules/entities/dist/commonjs/index.d.ts +96 -0
  43. package/ui/.output/server/node_modules/entities/dist/commonjs/index.d.ts.map +1 -0
  44. package/ui/.output/server/node_modules/entities/dist/commonjs/index.js +131 -0
  45. package/ui/.output/server/node_modules/entities/dist/commonjs/index.js.map +1 -0
  46. package/ui/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.d.ts +17 -0
  47. package/ui/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.d.ts.map +1 -0
  48. package/ui/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
  49. package/ui/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js.map +1 -0
  50. package/ui/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.d.ts +2 -0
  51. package/ui/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.d.ts.map +1 -0
  52. package/ui/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
  53. package/ui/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js.map +1 -0
  54. package/ui/.output/server/node_modules/entities/dist/commonjs/internal/encode-shared.d.ts +32 -0
  55. package/ui/.output/server/node_modules/entities/dist/commonjs/internal/encode-shared.d.ts.map +1 -0
  56. package/ui/.output/server/node_modules/entities/dist/commonjs/internal/encode-shared.js +94 -0
  57. package/ui/.output/server/node_modules/entities/dist/commonjs/internal/encode-shared.js.map +1 -0
  58. package/ui/.output/server/node_modules/entities/dist/commonjs/package.json +3 -0
  59. package/ui/.output/server/node_modules/entities/dist/esm/decode-codepoint.d.ts +19 -0
  60. package/ui/.output/server/node_modules/entities/dist/esm/decode-codepoint.d.ts.map +1 -0
  61. package/ui/.output/server/node_modules/entities/dist/esm/decode-codepoint.js +72 -0
  62. package/ui/.output/server/node_modules/entities/dist/esm/decode-codepoint.js.map +1 -0
  63. package/ui/.output/server/node_modules/entities/dist/esm/decode.d.ts +205 -0
  64. package/ui/.output/server/node_modules/entities/dist/esm/decode.d.ts.map +1 -0
  65. package/ui/.output/server/node_modules/entities/dist/esm/decode.js +554 -0
  66. package/ui/.output/server/node_modules/entities/dist/esm/decode.js.map +1 -0
  67. package/ui/.output/server/node_modules/entities/dist/esm/encode.d.ts +22 -0
  68. package/ui/.output/server/node_modules/entities/dist/esm/encode.d.ts.map +1 -0
  69. package/ui/.output/server/node_modules/entities/dist/esm/encode.js +88 -0
  70. package/ui/.output/server/node_modules/entities/dist/esm/encode.js.map +1 -0
  71. package/ui/.output/server/node_modules/entities/dist/esm/escape.d.ts +46 -0
  72. package/ui/.output/server/node_modules/entities/dist/esm/escape.d.ts.map +1 -0
  73. package/ui/.output/server/node_modules/entities/dist/esm/escape.js +134 -0
  74. package/ui/.output/server/node_modules/entities/dist/esm/escape.js.map +1 -0
  75. package/ui/.output/server/node_modules/entities/dist/esm/generated/decode-data-html.d.ts +2 -0
  76. package/ui/.output/server/node_modules/entities/dist/esm/generated/decode-data-html.d.ts.map +1 -0
  77. package/ui/.output/server/node_modules/entities/dist/esm/generated/decode-data-html.js +4 -0
  78. package/ui/.output/server/node_modules/entities/dist/esm/generated/decode-data-html.js.map +1 -0
  79. package/ui/.output/server/node_modules/entities/dist/esm/generated/decode-data-xml.d.ts +2 -0
  80. package/ui/.output/server/node_modules/entities/dist/esm/generated/decode-data-xml.d.ts.map +1 -0
  81. package/ui/.output/server/node_modules/entities/dist/esm/generated/decode-data-xml.js +4 -0
  82. package/ui/.output/server/node_modules/entities/dist/esm/generated/decode-data-xml.js.map +1 -0
  83. package/ui/.output/server/node_modules/entities/dist/esm/generated/encode-html.d.ts +3 -0
  84. package/ui/.output/server/node_modules/entities/dist/esm/generated/encode-html.d.ts.map +1 -0
  85. package/ui/.output/server/node_modules/entities/dist/esm/generated/encode-html.js +11 -0
  86. package/ui/.output/server/node_modules/entities/dist/esm/generated/encode-html.js.map +1 -0
  87. package/ui/.output/server/node_modules/entities/dist/esm/index.d.ts +96 -0
  88. package/ui/.output/server/node_modules/entities/dist/esm/index.d.ts.map +1 -0
  89. package/ui/.output/server/node_modules/entities/dist/esm/index.js +107 -0
  90. package/ui/.output/server/node_modules/entities/dist/esm/index.js.map +1 -0
  91. package/ui/.output/server/node_modules/entities/dist/esm/internal/bin-trie-flags.d.ts +17 -0
  92. package/ui/.output/server/node_modules/entities/dist/esm/internal/bin-trie-flags.d.ts.map +1 -0
  93. package/ui/.output/server/node_modules/entities/dist/esm/internal/bin-trie-flags.js +18 -0
  94. package/ui/.output/server/node_modules/entities/dist/esm/internal/bin-trie-flags.js.map +1 -0
  95. package/ui/.output/server/node_modules/entities/dist/esm/internal/decode-shared.d.ts +2 -0
  96. package/ui/.output/server/node_modules/entities/dist/esm/internal/decode-shared.d.ts.map +1 -0
  97. package/ui/.output/server/node_modules/entities/dist/esm/internal/decode-shared.js +28 -0
  98. package/ui/.output/server/node_modules/entities/dist/esm/internal/decode-shared.js.map +1 -0
  99. package/ui/.output/server/node_modules/entities/dist/esm/internal/encode-shared.d.ts +32 -0
  100. package/ui/.output/server/node_modules/entities/dist/esm/internal/encode-shared.d.ts.map +1 -0
  101. package/ui/.output/server/node_modules/entities/dist/esm/internal/encode-shared.js +91 -0
  102. package/ui/.output/server/node_modules/entities/dist/esm/internal/encode-shared.js.map +1 -0
  103. package/ui/.output/server/node_modules/entities/dist/esm/package.json +3 -0
  104. package/ui/.output/server/node_modules/entities/escape.d.ts +3 -0
  105. package/ui/.output/server/node_modules/entities/escape.js +3 -0
  106. package/ui/.output/server/node_modules/entities/package.json +120 -0
  107. package/ui/.output/server/node_modules/entities/readme.md +143 -0
  108. package/ui/.output/server/node_modules/entities/src/decode-codepoint.ts +81 -0
  109. package/ui/.output/server/node_modules/entities/src/decode.ts +685 -0
  110. package/ui/.output/server/node_modules/entities/src/encode.ts +93 -0
  111. package/ui/.output/server/node_modules/entities/src/escape.ts +161 -0
  112. package/ui/.output/server/node_modules/entities/src/generated/.eslintrc.json +10 -0
  113. package/ui/.output/server/node_modules/entities/src/generated/decode-data-html.ts +6 -0
  114. package/ui/.output/server/node_modules/entities/src/generated/decode-data-xml.ts +6 -0
  115. package/ui/.output/server/node_modules/entities/src/generated/encode-html.ts +17 -0
  116. package/ui/.output/server/node_modules/entities/src/index.ts +187 -0
  117. package/ui/.output/server/node_modules/entities/src/internal/bin-trie-flags.ts +16 -0
  118. package/ui/.output/server/node_modules/entities/src/internal/decode-shared.ts +30 -0
  119. package/ui/.output/server/node_modules/entities/src/internal/encode-shared.ts +121 -0
  120. package/ui/.output/public/_nuxt/builds/meta/c6a56b63-9280-455c-96ed-843f8029ca3a.json +0 -1
@@ -0,0 +1,107 @@
1
+ import { DecodingMode, decodeHTML, decodeXML } from "./decode.js";
2
+ import { encodeHTML, encodeNonAsciiHTML } from "./encode.js";
3
+ import { encodeXML, escapeAttribute, escapeText, escapeUTF8, } from "./escape.js";
4
+ /** The level of entities to support. */
5
+ export var EntityLevel;
6
+ (function (EntityLevel) {
7
+ /** Support only XML entities. */
8
+ EntityLevel[EntityLevel["XML"] = 0] = "XML";
9
+ /** Support HTML entities, which are a superset of XML entities. */
10
+ EntityLevel[EntityLevel["HTML"] = 1] = "HTML";
11
+ })(EntityLevel || (EntityLevel = {}));
12
+ export var EncodingMode;
13
+ (function (EncodingMode) {
14
+ /**
15
+ * The output is UTF-8 encoded. Only characters that need escaping within
16
+ * XML will be escaped.
17
+ */
18
+ EncodingMode[EncodingMode["UTF8"] = 0] = "UTF8";
19
+ /**
20
+ * The output consists only of ASCII characters. Characters that need
21
+ * escaping within HTML, and characters that aren't ASCII characters will
22
+ * be escaped.
23
+ */
24
+ EncodingMode[EncodingMode["ASCII"] = 1] = "ASCII";
25
+ /**
26
+ * Encode all characters that have an equivalent entity, as well as all
27
+ * characters that are not ASCII characters.
28
+ */
29
+ EncodingMode[EncodingMode["Extensive"] = 2] = "Extensive";
30
+ /**
31
+ * Encode all characters that have to be escaped in HTML attributes,
32
+ * following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}.
33
+ */
34
+ EncodingMode[EncodingMode["Attribute"] = 3] = "Attribute";
35
+ /**
36
+ * Encode all characters that have to be escaped in HTML text,
37
+ * following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}.
38
+ */
39
+ EncodingMode[EncodingMode["Text"] = 4] = "Text";
40
+ })(EncodingMode || (EncodingMode = {}));
41
+ /**
42
+ * Decodes a string with entities.
43
+ *
44
+ * @param input String to decode.
45
+ * @param options Decoding options.
46
+ */
47
+ export function decode(input, options = EntityLevel.XML) {
48
+ const level = typeof options === "number" ? options : options.level;
49
+ if (level === EntityLevel.HTML) {
50
+ const mode = typeof options === "object" ? options.mode : undefined;
51
+ return decodeHTML(input, mode);
52
+ }
53
+ return decodeXML(input);
54
+ }
55
+ /**
56
+ * Decodes a string with entities. Does not allow missing trailing semicolons for entities.
57
+ *
58
+ * @param input String to decode.
59
+ * @param options Decoding options.
60
+ * @deprecated Use `decode` with the `mode` set to `Strict`.
61
+ */
62
+ export function decodeStrict(input, options = EntityLevel.XML) {
63
+ var _a;
64
+ const normalizedOptions = typeof options === "number" ? { level: options } : options;
65
+ (_a = normalizedOptions.mode) !== null && _a !== void 0 ? _a : (normalizedOptions.mode = DecodingMode.Strict);
66
+ return decode(input, normalizedOptions);
67
+ }
68
+ /**
69
+ * Encodes a string with entities.
70
+ *
71
+ * @param input String to encode.
72
+ * @param options Encoding options.
73
+ */
74
+ export function encode(input, options = EntityLevel.XML) {
75
+ const { mode = EncodingMode.Extensive, level = EntityLevel.XML } = typeof options === "number" ? { level: options } : options;
76
+ switch (mode) {
77
+ case EncodingMode.UTF8: {
78
+ return escapeUTF8(input);
79
+ }
80
+ case EncodingMode.Attribute: {
81
+ return escapeAttribute(input);
82
+ }
83
+ case EncodingMode.Text: {
84
+ return escapeText(input);
85
+ }
86
+ case EncodingMode.ASCII: {
87
+ return level === EntityLevel.HTML
88
+ ? encodeNonAsciiHTML(input)
89
+ : encodeXML(input);
90
+ }
91
+ // biome-ignore lint/complexity/noUselessSwitchCase: we get an error for the switch not being exhaustive
92
+ case EncodingMode.Extensive: // eslint-disable-line unicorn/no-useless-switch-case
93
+ default: {
94
+ return level === EntityLevel.HTML
95
+ ? encodeHTML(input)
96
+ : encodeXML(input);
97
+ }
98
+ }
99
+ }
100
+ export { DecodingMode, decodeHTML,
101
+ // Legacy aliases (deprecated)
102
+ decodeHTML as decodeHTML4, decodeHTML as decodeHTML5, decodeHTMLAttribute, decodeHTMLStrict, decodeHTMLStrict as decodeHTML4Strict, decodeHTMLStrict as decodeHTML5Strict, decodeXML, decodeXML as decodeXMLStrict, EntityDecoder, } from "./decode.js";
103
+ export { encodeHTML,
104
+ // Legacy aliases (deprecated)
105
+ encodeHTML as encodeHTML4, encodeHTML as encodeHTML5, encodeNonAsciiHTML, } from "./encode.js";
106
+ export { encodeXML, escape, escapeAttribute, escapeText, escapeUTF8, } from "./escape.js";
107
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACH,SAAS,EACT,eAAe,EACf,UAAU,EACV,UAAU,GACb,MAAM,aAAa,CAAC;AAErB,wCAAwC;AACxC,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACnB,iCAAiC;IACjC,2CAAO,CAAA;IACP,mEAAmE;IACnE,6CAAQ,CAAA;AACZ,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB;AAED,MAAM,CAAN,IAAY,YA2BX;AA3BD,WAAY,YAAY;IACpB;;;OAGG;IACH,+CAAI,CAAA;IACJ;;;;OAIG;IACH,iDAAK,CAAA;IACL;;;OAGG;IACH,yDAAS,CAAA;IACT;;;OAGG;IACH,yDAAS,CAAA;IACT;;;OAGG;IACH,+CAAI,CAAA;AACR,CAAC,EA3BW,YAAY,KAAZ,YAAY,QA2BvB;AAsBD;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAClB,KAAa,EACb,UAAyC,WAAW,CAAC,GAAG;IAExD,MAAM,KAAK,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAEpE,IAAI,KAAK,KAAK,WAAW,CAAC,IAAI,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,OAAO,OAAO,KAAK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AC,CAAC;YACtB,OAAO,KAAK,KAAK,WAAW,CAAC,IAAI;gBAC7B,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC;gBAC3B,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;QACD,wGAAwG;QACxG,KAAK,YAAY,CAAC,SAAS,CAAC,CAAC,qDAAqD;QAClF,OAAO,CAAC,CAAC,CAAC;YACN,OAAO,KAAK,KAAK,WAAW,CAAC,IAAI;gBAC7B,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;gBACnB,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;IACL,CAAC;AACL,CAAC;AAED,OAAO,EACH,YAAY,EACZ,UAAU;AACV,8BAA8B;AAC9B,UAAU,IAAI,WAAW,EACzB,UAAU,IAAI,WAAW,EACzB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,IAAI,iBAAiB,EACrC,gBAAgB,IAAI,iBAAiB,EACrC,SAAS,EACT,SAAS,IAAI,eAAe,EAC5B,aAAa,GAChB,MAAM,aAAa,CAAC;AAErB,OAAO,EACH,UAAU;AACV,8BAA8B;AAC9B,UAAU,IAAI,WAAW,EACzB,UAAU,IAAI,WAAW,EACzB,kBAAkB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EACH,SAAS,EACT,MAAM,EACN,eAAe,EACf,UAAU,EACV,UAAU,GACb,MAAM,aAAa,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Bit flags & masks for the binary trie encoding used for entity decoding.
3
+ *
4
+ * Bit layout (16 bits total):
5
+ * 15..14 VALUE_LENGTH (+1 encoding; 0 => no value)
6
+ * 13 FLAG13. If valueLength>0: semicolon required flag (implicit ';').
7
+ * If valueLength==0: compact run flag.
8
+ * 12..7 BRANCH_LENGTH Branch length (0 => single branch in 6..0 if jumpOffset==char) OR run length (when compact run)
9
+ * 6..0 JUMP_TABLE Jump offset (jump table) OR single-branch char code OR first run char
10
+ */
11
+ export declare enum BinTrieFlags {
12
+ VALUE_LENGTH = 49152,
13
+ FLAG13 = 8192,
14
+ BRANCH_LENGTH = 8064,
15
+ JUMP_TABLE = 127
16
+ }
17
+ //# sourceMappingURL=bin-trie-flags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin-trie-flags.d.ts","sourceRoot":"","sources":["../../../src/internal/bin-trie-flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,oBAAY,YAAY;IACpB,YAAY,QAAwB;IACpC,MAAM,OAAwB;IAC9B,aAAa,OAAwB;IACrC,UAAU,MAAwB;CACrC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Bit flags & masks for the binary trie encoding used for entity decoding.
3
+ *
4
+ * Bit layout (16 bits total):
5
+ * 15..14 VALUE_LENGTH (+1 encoding; 0 => no value)
6
+ * 13 FLAG13. If valueLength>0: semicolon required flag (implicit ';').
7
+ * If valueLength==0: compact run flag.
8
+ * 12..7 BRANCH_LENGTH Branch length (0 => single branch in 6..0 if jumpOffset==char) OR run length (when compact run)
9
+ * 6..0 JUMP_TABLE Jump offset (jump table) OR single-branch char code OR first run char
10
+ */
11
+ export var BinTrieFlags;
12
+ (function (BinTrieFlags) {
13
+ BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
14
+ BinTrieFlags[BinTrieFlags["FLAG13"] = 8192] = "FLAG13";
15
+ BinTrieFlags[BinTrieFlags["BRANCH_LENGTH"] = 8064] = "BRANCH_LENGTH";
16
+ BinTrieFlags[BinTrieFlags["JUMP_TABLE"] = 127] = "JUMP_TABLE";
17
+ })(BinTrieFlags || (BinTrieFlags = {}));
18
+ //# sourceMappingURL=bin-trie-flags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin-trie-flags.js","sourceRoot":"","sources":["../../../src/internal/bin-trie-flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACpB,mEAAoC,CAAA;IACpC,sDAA8B,CAAA;IAC9B,oEAAqC,CAAA;IACrC,6DAAkC,CAAA;AACtC,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB"}
@@ -0,0 +1,2 @@
1
+ export declare function decodeBase64(input: string): Uint16Array;
2
+ //# sourceMappingURL=decode-shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decode-shared.d.ts","sourceRoot":"","sources":["../../../src/internal/decode-shared.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAyBvD"}
@@ -0,0 +1,28 @@
1
+ /*
2
+ * Shared base64 decode helper for generated decode data.
3
+ * Assumes global atob is available.
4
+ */
5
+ export function decodeBase64(input) {
6
+ const binary =
7
+ // eslint-disable-next-line n/no-unsupported-features/node-builtins
8
+ typeof atob === "function"
9
+ ? // Browser (and Node >=16)
10
+ // eslint-disable-next-line n/no-unsupported-features/node-builtins
11
+ atob(input)
12
+ : // Older Node versions (<16)
13
+ // eslint-disable-next-line n/no-unsupported-features/node-builtins
14
+ typeof Buffer.from === "function"
15
+ ? // eslint-disable-next-line n/no-unsupported-features/node-builtins
16
+ Buffer.from(input, "base64").toString("binary")
17
+ : // eslint-disable-next-line unicorn/no-new-buffer, n/no-deprecated-api
18
+ new Buffer(input, "base64").toString("binary");
19
+ const evenLength = binary.length & ~1; // Round down to even length
20
+ const out = new Uint16Array(evenLength / 2);
21
+ for (let index = 0, outIndex = 0; index < evenLength; index += 2) {
22
+ const lo = binary.charCodeAt(index);
23
+ const hi = binary.charCodeAt(index + 1);
24
+ out[outIndex++] = lo | (hi << 8);
25
+ }
26
+ return out;
27
+ }
28
+ //# sourceMappingURL=decode-shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decode-shared.js","sourceRoot":"","sources":["../../../src/internal/decode-shared.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACtC,MAAM,MAAM;IACR,mEAAmE;IACnE,OAAO,IAAI,KAAK,UAAU;QACtB,CAAC,CAAC,0BAA0B;YAC1B,mEAAmE;YACnE,IAAI,CAAC,KAAK,CAAC;QACb,CAAC,CAAC,4BAA4B;YAC5B,mEAAmE;YACnE,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU;gBACjC,CAAC,CAAC,mEAAmE;oBACnE,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBACjD,CAAC,CAAC,sEAAsE;oBACtE,IAAI,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAE3D,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,4BAA4B;IACnE,MAAM,GAAG,GAAG,IAAI,WAAW,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;IAE5C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,QAAQ,GAAG,CAAC,EAAE,KAAK,GAAG,UAAU,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC/D,MAAM,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QACxC,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * A node inside the encoding trie used by `encode.ts`.
3
+ *
4
+ * There are two physical shapes to minimize allocations and lookup cost:
5
+ *
6
+ * 1. Leaf node (string)
7
+ * - A plain string (already in the form `"&name;"`).
8
+ * - Represents a terminal match with no children.
9
+ *
10
+ * 2. Branch / value node (object)
11
+ */
12
+ export type EncodeTrieNode = string | {
13
+ /**
14
+ * Entity value for the current code point sequence (wrapped: `&...;`).
15
+ * Present when the path to this node itself is a valid named entity.
16
+ */
17
+ value: string | undefined;
18
+ /** If a number, the next code unit of the only next character. */
19
+ next: number | Map<number, EncodeTrieNode>;
20
+ /** If next is a number, `nextValue` contains the entity value. */
21
+ nextValue?: string;
22
+ };
23
+ /**
24
+ * Parse a compact encode trie string into a Map structure used for encoding.
25
+ *
26
+ * Format per entry (ascending code points using delta encoding):
27
+ * <diffBase36>[&name;][{<children>}] -- diff omitted when 0
28
+ * Where diff = currentKey - previousKey - 1 (first entry stores absolute key).
29
+ * `&name;` is the entity value (already wrapped); a following `{` denotes children.
30
+ */
31
+ export declare function parseEncodeTrie(serialized: string): Map<number, EncodeTrieNode>;
32
+ //# sourceMappingURL=encode-shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encode-shared.d.ts","sourceRoot":"","sources":["../../../src/internal/encode-shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,GACpB,MAAM,GACN;IACI;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,kEAAkE;IAClE,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC3C,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAER;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC3B,UAAU,EAAE,MAAM,GACnB,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAqF7B"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Parse a compact encode trie string into a Map structure used for encoding.
3
+ *
4
+ * Format per entry (ascending code points using delta encoding):
5
+ * <diffBase36>[&name;][{<children>}] -- diff omitted when 0
6
+ * Where diff = currentKey - previousKey - 1 (first entry stores absolute key).
7
+ * `&name;` is the entity value (already wrapped); a following `{` denotes children.
8
+ */
9
+ export function parseEncodeTrie(serialized) {
10
+ const top = new Map();
11
+ const totalLength = serialized.length;
12
+ let cursor = 0;
13
+ let lastTopKey = -1;
14
+ function readDiff() {
15
+ const start = cursor;
16
+ while (cursor < totalLength) {
17
+ const char = serialized.charAt(cursor);
18
+ if ((char < "0" || char > "9") && (char < "a" || char > "z")) {
19
+ break;
20
+ }
21
+ cursor++;
22
+ }
23
+ if (cursor === start)
24
+ return 0;
25
+ return Number.parseInt(serialized.slice(start, cursor), 36);
26
+ }
27
+ function readEntity() {
28
+ if (serialized[cursor] !== "&") {
29
+ throw new Error(`Child entry missing value near index ${cursor}`);
30
+ }
31
+ // Cursor currently points at '&'
32
+ const start = cursor;
33
+ const end = serialized.indexOf(";", cursor + 1);
34
+ if (end === -1) {
35
+ throw new Error(`Unterminated entity starting at index ${start}`);
36
+ }
37
+ cursor = end + 1; // Move past ';'
38
+ return serialized.slice(start, cursor); // Includes & ... ;
39
+ }
40
+ while (cursor < totalLength) {
41
+ const keyDiff = readDiff();
42
+ const key = lastTopKey === -1 ? keyDiff : lastTopKey + keyDiff + 1;
43
+ let value;
44
+ if (serialized[cursor] === "&")
45
+ value = readEntity();
46
+ if (serialized[cursor] === "{") {
47
+ cursor++; // Skip '{'
48
+ // Parse first child
49
+ let diff = readDiff();
50
+ let childKey = diff; // First key (lastChildKey = -1)
51
+ const firstValue = readEntity();
52
+ if (serialized[cursor] === "{") {
53
+ throw new Error("Unexpected nested '{' beyond depth 2");
54
+ }
55
+ // If end of block -> single child optimization
56
+ if (serialized[cursor] === "}") {
57
+ top.set(key, { value, next: childKey, nextValue: firstValue });
58
+ cursor++; // Skip '}'
59
+ }
60
+ else {
61
+ const childMap = new Map();
62
+ childMap.set(childKey, firstValue);
63
+ let lastChildKey = childKey;
64
+ while (cursor < totalLength && serialized[cursor] !== "}") {
65
+ diff = readDiff();
66
+ childKey = lastChildKey + diff + 1;
67
+ const childValue = readEntity();
68
+ if (serialized[cursor] === "{") {
69
+ throw new Error("Unexpected nested '{' beyond depth 2");
70
+ }
71
+ childMap.set(childKey, childValue);
72
+ lastChildKey = childKey;
73
+ }
74
+ if (serialized[cursor] !== "}") {
75
+ throw new Error("Unterminated child block");
76
+ }
77
+ cursor++; // Skip '}'
78
+ top.set(key, { value, next: childMap });
79
+ }
80
+ }
81
+ else if (value === undefined) {
82
+ throw new Error(`Malformed encode trie: missing value at index ${cursor}`);
83
+ }
84
+ else {
85
+ top.set(key, value);
86
+ }
87
+ lastTopKey = key;
88
+ }
89
+ return top;
90
+ }
91
+ //# sourceMappingURL=encode-shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encode-shared.js","sourceRoot":"","sources":["../../../src/internal/encode-shared.ts"],"names":[],"mappings":"AAyBA;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC3B,UAAkB;IAElB,MAAM,GAAG,GAAG,IAAI,GAAG,EAA0B,CAAC;IAC9C,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC;IACtC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,UAAU,GAAG,CAAC,CAAC,CAAC;IAEpB,SAAS,QAAQ;QACb,MAAM,KAAK,GAAG,MAAM,CAAC;QACrB,OAAO,MAAM,GAAG,WAAW,EAAE,CAAC;YAC1B,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAEvC,IAAI,CAAC,IAAI,GAAG,GAAG,IAAI,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,IAAI,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;gBAC3D,MAAM;YACV,CAAC;YACD,MAAM,EAAE,CAAC;QACb,CAAC;QACD,IAAI,MAAM,KAAK,KAAK;YAAE,OAAO,CAAC,CAAC;QAC/B,OAAO,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;IAChE,CAAC;IA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C;YAC7B,MAAM,IAAI,KAAK,CACX,iDAAiD,MAAM,EAAE,CAC5D,CAAC;QACN,CAAC;aAAM,CAAC;YACJ,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACxB,CAAC;QACD,UAAU,GAAG,GAAG,CAAC;IACrB,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,3 @@
1
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
+ // @ts-ignore
3
+ export * from "./dist/commonjs/escape.js";
@@ -0,0 +1,3 @@
1
+ // Make exports work in Node < 12
2
+ // eslint-disable-next-line no-undef, unicorn/prefer-module
3
+ module.exports = require("./dist/commonjs/escape.js");
@@ -0,0 +1,120 @@
1
+ {
2
+ "name": "entities",
3
+ "version": "7.0.1",
4
+ "description": "Encode & decode XML and HTML entities with ease & speed",
5
+ "keywords": [
6
+ "html entities",
7
+ "entity decoder",
8
+ "entity encoding",
9
+ "html decoding",
10
+ "html encoding",
11
+ "xml decoding",
12
+ "xml encoding"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/fb55/entities.git"
17
+ },
18
+ "funding": "https://github.com/fb55/entities?sponsor=1",
19
+ "license": "BSD-2-Clause",
20
+ "author": "Felix Boehm <me@feedic.com>",
21
+ "sideEffects": false,
22
+ "type": "module",
23
+ "exports": {
24
+ ".": {
25
+ "import": {
26
+ "types": "./dist/esm/index.d.ts",
27
+ "default": "./dist/esm/index.js"
28
+ },
29
+ "require": {
30
+ "types": "./dist/commonjs/index.d.ts",
31
+ "default": "./dist/commonjs/index.js"
32
+ }
33
+ },
34
+ "./decode": {
35
+ "import": {
36
+ "types": "./dist/esm/decode.d.ts",
37
+ "default": "./dist/esm/decode.js"
38
+ },
39
+ "require": {
40
+ "types": "./dist/commonjs/decode.d.ts",
41
+ "default": "./dist/commonjs/decode.js"
42
+ }
43
+ },
44
+ "./escape": {
45
+ "import": {
46
+ "types": "./dist/esm/escape.d.ts",
47
+ "default": "./dist/esm/escape.js"
48
+ },
49
+ "require": {
50
+ "types": "./dist/commonjs/escape.d.ts",
51
+ "default": "./dist/commonjs/escape.js"
52
+ }
53
+ }
54
+ },
55
+ "main": "./dist/commonjs/index.js",
56
+ "module": "./dist/esm/index.js",
57
+ "types": "./dist/commonjs/index.d.ts",
58
+ "files": [
59
+ "decode.js",
60
+ "decode.d.ts",
61
+ "escape.js",
62
+ "escape.d.ts",
63
+ "dist",
64
+ "src",
65
+ "!**/*.spec.ts"
66
+ ],
67
+ "scripts": {
68
+ "build:docs": "typedoc --hideGenerator src/index.ts",
69
+ "build:encode-trie": "node --import=tsx scripts/write-encode-map.ts",
70
+ "build:trie": "node --import=tsx scripts/write-decode-map.ts",
71
+ "benchmark": "node --import=tsx scripts/benchmark.ts",
72
+ "format": "npm run format:es && npm run format:biome",
73
+ "format:es": "npm run lint:es -- --fix",
74
+ "format:biome": "biome check --fix .",
75
+ "lint": "npm run lint:es && npm run lint:ts && npm run lint:biome",
76
+ "lint:es": "eslint . --ignore-path .gitignore",
77
+ "lint:biome": "biome check .",
78
+ "lint:ts": "tsc --noEmit",
79
+ "prepublishOnly": "tshy",
80
+ "test": "npm run test:vi && npm run lint",
81
+ "test:vi": "vitest run"
82
+ },
83
+ "devDependencies": {
84
+ "@biomejs/biome": "^2.3.11",
85
+ "@types/node": "^25.0.9",
86
+ "@typescript-eslint/eslint-plugin": "^8.53.1",
87
+ "@typescript-eslint/parser": "^8.53.1",
88
+ "@vitest/coverage-v8": "^3.2.4",
89
+ "@types/he": "^1.2.3",
90
+ "eslint": "^8.57.1",
91
+ "eslint-config-biome": "^2.1.3",
92
+ "eslint-plugin-n": "^17.23.2",
93
+ "eslint-plugin-unicorn": "^56.0.1",
94
+ "he": "^1.2.0",
95
+ "html-entities": "^2.6.0",
96
+ "parse-entities": "^4.0.2",
97
+ "tinybench": "^5.1.0",
98
+ "tshy": "^3.1.0",
99
+ "tsx": "^4.21.0",
100
+ "typedoc": "^0.28.16",
101
+ "typescript": "^5.9.3",
102
+ "vitest": "^3.2.4"
103
+ },
104
+ "engines": {
105
+ "node": ">=0.12"
106
+ },
107
+ "tshy": {
108
+ "exclude": [
109
+ "**/*.spec.ts",
110
+ "**/__fixtures__/*",
111
+ "**/__tests__/*",
112
+ "**/__snapshots__/*"
113
+ ],
114
+ "exports": {
115
+ ".": "./src/index.ts",
116
+ "./decode": "./src/decode.ts",
117
+ "./escape": "./src/escape.ts"
118
+ }
119
+ }
120
+ }
@@ -0,0 +1,143 @@
1
+ # entities [![NPM version](https://img.shields.io/npm/v/entities.svg)](https://npmjs.org/package/entities) [![Downloads](https://img.shields.io/npm/dm/entities.svg)](https://npmjs.org/package/entities) [![Node.js CI](https://github.com/fb55/entities/actions/workflows/nodejs-test.yml/badge.svg)](https://github.com/fb55/entities/actions/workflows/nodejs-test.yml)
2
+
3
+ Encode & decode HTML & XML entities with ease & speed.
4
+
5
+ ## Features
6
+
7
+ - 😇 Tried and true: `entities` is used by many popular libraries; eg.
8
+ [`htmlparser2`](https://github.com/fb55/htmlparser2), the official
9
+ [AWS SDK](https://github.com/aws/aws-sdk-js-v3) and
10
+ [`commonmark`](https://github.com/commonmark/commonmark.js) use it to process
11
+ HTML entities.
12
+ - ⚡️ Fast: `entities` is the fastest library for decoding HTML entities (as of
13
+ September 2025); see [performance](#performance).
14
+ - 🎛 Configurable: Get an output tailored for your needs. You are fine with
15
+ UTF8? That'll save you some bytes. Prefer to only have ASCII characters? We
16
+ can do that as well!
17
+
18
+ ## How to…
19
+
20
+ ### …install `entities`
21
+
22
+ npm install entities
23
+
24
+ ### …use `entities`
25
+
26
+ ```javascript
27
+ const entities = require("entities");
28
+
29
+ // Encoding
30
+ entities.escapeUTF8("&#38; ü"); // "&amp;#38; ü"
31
+ entities.encodeXML("&#38; ü"); // "&amp;#38; &#xfc;"
32
+ entities.encodeHTML("&#38; ü"); // "&amp;&num;38&semi; &uuml;"
33
+
34
+ // Decoding
35
+ entities.decodeXML("asdf &amp; &#xFF; &#xFC; &apos;"); // "asdf & ÿ ü '"
36
+ entities.decodeHTML("asdf &amp; &yuml; &uuml; &apos;"); // "asdf & ÿ ü '"
37
+ ```
38
+
39
+ ## Performance
40
+
41
+ Benchmarked in September 2025 with Node v24.6.0 on Apple M2 using `tinybench`.
42
+ Higher ops/s is better; `avg (μs)` is the mean time per operation.
43
+ See `scripts/benchmark.ts` to reproduce.
44
+
45
+ ### Decoding
46
+
47
+ | Library | Version | ops/s | avg (μs) | ±% | slower |
48
+ | -------------- | ------- | --------- | -------- | ---- | ------ |
49
+ | entities | 7.0.0 | 5,838,416 | 175.57 | 0.06 | — |
50
+ | html-entities | 2.6.0 | 2,919,637 | 347.77 | 0.33 | 50.0% |
51
+ | he | 1.2.0 | 2,318,438 | 446.48 | 0.70 | 60.3% |
52
+ | parse-entities | 4.0.2 | 852,855 | 1,199.51 | 0.36 | 85.4% |
53
+
54
+ ### Encoding
55
+
56
+ | Library | Version | ops/s | avg (μs) | ±% | slower |
57
+ | -------------- | ------- | --------- | -------- | ---- | ------ |
58
+ | entities | 7.0.0 | 2,770,115 | 368.09 | 0.11 | — |
59
+ | html-entities | 2.6.0 | 1,491,963 | 679.96 | 0.58 | 46.2% |
60
+ | he | 1.2.0 | 481,278 | 2,118.25 | 0.61 | 82.6% |
61
+
62
+ ### Escaping
63
+
64
+ | Library | Version | ops/s | avg (μs) | ±% | slower |
65
+ | -------------- | ------- | --------- | -------- | ---- | ------ |
66
+ | entities | 7.0.0 | 4,616,468 | 223.84 | 0.17 | — |
67
+ | he | 1.2.0 | 3,659,301 | 280.76 | 0.58 | 20.7% |
68
+ | html-entities | 2.6.0 | 3,555,301 | 296.63 | 0.84 | 23.0% |
69
+
70
+ Note: Micro-benchmarks may vary across machines and Node versions.
71
+
72
+ ---
73
+
74
+ ## FAQ
75
+
76
+ > What methods should I actually use to encode my documents?
77
+
78
+ If your target supports UTF-8, the `escapeUTF8` method is going to be your best
79
+ choice. Otherwise, use either `encodeHTML` or `encodeXML` based on whether
80
+ you're dealing with an HTML or an XML document.
81
+
82
+ You can have a look at the options for the `encode` and `decode` methods to see
83
+ everything you can configure.
84
+
85
+ > When should I use strict decoding?
86
+
87
+ When strict decoding, entities not terminated with a semicolon will be ignored.
88
+ This is helpful for decoding entities in legacy environments.
89
+
90
+ > Why should I use `entities` instead of alternative modules?
91
+
92
+ As of September 2025, `entities` is faster than other modules. Still, this is
93
+ not a differentiated space and other modules can catch up.
94
+
95
+ **More importantly**, you might already have `entities` in your dependency graph
96
+ (as a dependency of eg. `cheerio`, or `htmlparser2`), and including it directly
97
+ might not even increase your bundle size. The same is true for other entity
98
+ libraries, so have a look through your `node_modules` directory!
99
+
100
+ > Does `entities` support tree shaking?
101
+
102
+ Yes! `entities` ships as both a CommonJS and a ES module. Note that for best
103
+ results, you should not use the `encode` and `decode` functions, as they wrap
104
+ around a number of other functions, all of which will remain in the bundle.
105
+ Instead, use the functions that you need directly.
106
+
107
+ ---
108
+
109
+ ## Acknowledgements
110
+
111
+ This library wouldn't be possible without the work of these individuals. Thanks
112
+ to
113
+
114
+ - [@mathiasbynens](https://github.com/mathiasbynens) for his explanations about
115
+ character encodings, and his library `he`, which was one of the inspirations
116
+ for `entities`
117
+ - [@inikulin](https://github.com/inikulin) for his work on optimized tries for
118
+ decoding HTML entities for the `parse5` project
119
+ - [@mdevils](https://github.com/mdevils) for taking on the challenge of
120
+ producing a quick entity library with his `html-entities` library. `entities`
121
+ would be quite a bit slower if there wasn't any competition. Right now
122
+ `entities` is on top, but we'll see how long that lasts!
123
+
124
+ ---
125
+
126
+ License: BSD-2-Clause
127
+
128
+ ## Security contact information
129
+
130
+ To report a security vulnerability, please use the
131
+ [Tidelift security contact](https://tidelift.com/security). Tidelift will
132
+ coordinate the fix and disclosure.
133
+
134
+ ## `entities` for enterprise
135
+
136
+ Available as part of the Tidelift Subscription
137
+
138
+ The maintainers of `entities` and thousands of other packages are working with
139
+ Tidelift to deliver commercial support and maintenance for the open source
140
+ dependencies you use to build your applications. Save time, reduce risk, and
141
+ improve code health, while paying the maintainers of the exact dependencies you
142
+ use.
143
+ [Learn more.](https://tidelift.com/subscription/pkg/npm-entities?utm_source=npm-entities&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)