shelfware 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/.output/nitro.json +15 -0
  2. package/.output/public/_nuxt/6IstVYrV.js +1 -0
  3. package/.output/public/_nuxt/9C5WUlLE.js +36 -0
  4. package/.output/public/_nuxt/BDNMzG2s.js +1 -0
  5. package/.output/public/_nuxt/BW3xJdEx.js +1 -0
  6. package/.output/public/_nuxt/BXXtFil5.js +1 -0
  7. package/.output/public/_nuxt/BZuUK3cr.js +1 -0
  8. package/.output/public/_nuxt/BeLyMmd4.js +1 -0
  9. package/.output/public/_nuxt/C_VgD9ZI.js +3 -0
  10. package/.output/public/_nuxt/DB5Vxbte.js +2 -0
  11. package/.output/public/_nuxt/DMg0j7gv.js +14 -0
  12. package/.output/public/_nuxt/builds/latest.json +1 -0
  13. package/.output/public/_nuxt/builds/meta/4c307968-4837-497b-a570-d6ee336accc4.json +1 -0
  14. package/.output/public/_nuxt/entry.b3_DJTEt.css +2 -0
  15. package/.output/public/_nuxt/error-404.CHsn7XF-.css +1 -0
  16. package/.output/public/_nuxt/error-500.Bawx2bLr.css +1 -0
  17. package/.output/server/chunks/_/api-handler.mjs +44 -0
  18. package/.output/server/chunks/_/batch.mjs +27 -0
  19. package/.output/server/chunks/_/catalog.mjs +1115 -0
  20. package/.output/server/chunks/_/detail.mjs +16 -0
  21. package/.output/server/chunks/_/error-500.mjs +19 -0
  22. package/.output/server/chunks/_/quarantine.mjs +159 -0
  23. package/.output/server/chunks/nitro/nitro.mjs +5399 -0
  24. package/.output/server/chunks/routes/api/_..._.mjs +16 -0
  25. package/.output/server/chunks/routes/api/health.get.mjs +13 -0
  26. package/.output/server/chunks/routes/api/skills/_id/file.get.mjs +25 -0
  27. package/.output/server/chunks/routes/api/skills/_id_.get.mjs +25 -0
  28. package/.output/server/chunks/routes/api/skills/_id_.put.mjs +74 -0
  29. package/.output/server/chunks/routes/api/skills/delete.post.mjs +48 -0
  30. package/.output/server/chunks/routes/api/skills/quarantine.post.mjs +26 -0
  31. package/.output/server/chunks/routes/api/skills/restore.post.mjs +26 -0
  32. package/.output/server/chunks/routes/api/skills.get.mjs +41 -0
  33. package/.output/server/chunks/routes/renderer.mjs +341 -0
  34. package/.output/server/chunks/virtual/_virtual_spa-template.mjs +3 -0
  35. package/.output/server/chunks/virtual/precomputed.mjs +3 -0
  36. package/.output/server/index.mjs +9 -0
  37. package/.output/server/node_modules/@babel/parser/lib/index.js +14611 -0
  38. package/.output/server/node_modules/@babel/parser/package.json +50 -0
  39. package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6801 -0
  40. package/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
  41. package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +692 -0
  42. package/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
  43. package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1420 -0
  44. package/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
  45. package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1903 -0
  46. package/.output/server/node_modules/@vue/reactivity/package.json +55 -0
  47. package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6980 -0
  48. package/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
  49. package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1867 -0
  50. package/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
  51. package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +904 -0
  52. package/.output/server/node_modules/@vue/server-renderer/package.json +53 -0
  53. package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +636 -0
  54. package/.output/server/node_modules/@vue/shared/package.json +47 -0
  55. package/.output/server/node_modules/devalue/index.js +17 -0
  56. package/.output/server/node_modules/devalue/package.json +39 -0
  57. package/.output/server/node_modules/devalue/src/base64.js +60 -0
  58. package/.output/server/node_modules/devalue/src/constants.js +12 -0
  59. package/.output/server/node_modules/devalue/src/operations.js +193 -0
  60. package/.output/server/node_modules/devalue/src/parse.js +274 -0
  61. package/.output/server/node_modules/devalue/src/stringify.js +428 -0
  62. package/.output/server/node_modules/devalue/src/uneval.js +606 -0
  63. package/.output/server/node_modules/devalue/src/utils.js +185 -0
  64. package/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
  65. package/.output/server/node_modules/entities/dist/commonjs/decode.js +568 -0
  66. package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
  67. package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
  68. package/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
  69. package/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
  70. package/.output/server/node_modules/entities/dist/commonjs/package.json +3 -0
  71. package/.output/server/node_modules/entities/package.json +120 -0
  72. package/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
  73. package/.output/server/node_modules/estree-walker/package.json +37 -0
  74. package/.output/server/node_modules/hookable/dist/index.mjs +257 -0
  75. package/.output/server/node_modules/hookable/package.json +53 -0
  76. package/.output/server/node_modules/nostics/dist/formatters/ansi.mjs +19 -0
  77. package/.output/server/node_modules/nostics/dist/index.mjs +187 -0
  78. package/.output/server/node_modules/nostics/package.json +125 -0
  79. package/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
  80. package/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  81. package/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
  82. package/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
  83. package/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
  84. package/.output/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
  85. package/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
  86. package/.output/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
  87. package/.output/server/node_modules/source-map-js/lib/source-node.js +413 -0
  88. package/.output/server/node_modules/source-map-js/lib/util.js +594 -0
  89. package/.output/server/node_modules/source-map-js/package.json +71 -0
  90. package/.output/server/node_modules/source-map-js/source-map.js +8 -0
  91. package/.output/server/node_modules/ufo/dist/index.mjs +645 -0
  92. package/.output/server/node_modules/ufo/package.json +48 -0
  93. package/.output/server/node_modules/unhead/dist/client.mjs +22 -0
  94. package/.output/server/node_modules/unhead/dist/legacy.mjs +33 -0
  95. package/.output/server/node_modules/unhead/dist/minify.mjs +183 -0
  96. package/.output/server/node_modules/unhead/dist/parser.mjs +518 -0
  97. package/.output/server/node_modules/unhead/dist/plugins.mjs +720 -0
  98. package/.output/server/node_modules/unhead/dist/server.mjs +99 -0
  99. package/.output/server/node_modules/unhead/dist/shared/unhead.-hZVKou0.mjs +400 -0
  100. package/.output/server/node_modules/unhead/dist/shared/unhead.BEmVMkeA.mjs +673 -0
  101. package/.output/server/node_modules/unhead/dist/shared/unhead.BGFxPGPQ.mjs +47 -0
  102. package/.output/server/node_modules/unhead/dist/shared/unhead.BQWSw36o.mjs +192 -0
  103. package/.output/server/node_modules/unhead/dist/shared/unhead.Bf_fPVYA.mjs +6 -0
  104. package/.output/server/node_modules/unhead/dist/shared/unhead.Bjbp1C8D.mjs +224 -0
  105. package/.output/server/node_modules/unhead/dist/shared/unhead.Bm4Y6XQI.mjs +17 -0
  106. package/.output/server/node_modules/unhead/dist/shared/unhead.C5Bksi2B.mjs +49 -0
  107. package/.output/server/node_modules/unhead/dist/shared/unhead.CGPOfp5O.mjs +32 -0
  108. package/.output/server/node_modules/unhead/dist/shared/unhead.CHEy9ana.mjs +7 -0
  109. package/.output/server/node_modules/unhead/dist/shared/unhead.D7HkBzZn.mjs +59 -0
  110. package/.output/server/node_modules/unhead/dist/shared/unhead.Dssd7L5I.mjs +196 -0
  111. package/.output/server/node_modules/unhead/dist/shared/unhead.jEy9BmRq.mjs +264 -0
  112. package/.output/server/node_modules/unhead/dist/shared/unhead.oZ7pkTV1.mjs +19 -0
  113. package/.output/server/node_modules/unhead/dist/shared/unhead.tQnRaXfX.mjs +240 -0
  114. package/.output/server/node_modules/unhead/dist/stream/client.mjs +33 -0
  115. package/.output/server/node_modules/unhead/dist/stream/iife.mjs +2 -0
  116. package/.output/server/node_modules/unhead/dist/stream/server.mjs +445 -0
  117. package/.output/server/node_modules/unhead/dist/utils.mjs +7 -0
  118. package/.output/server/node_modules/unhead/package.json +179 -0
  119. package/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
  120. package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
  121. package/.output/server/node_modules/vue/index.js +7 -0
  122. package/.output/server/node_modules/vue/index.mjs +1 -0
  123. package/.output/server/node_modules/vue/package.json +112 -0
  124. package/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
  125. package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +278 -0
  126. package/.output/server/node_modules/vue-bundle-renderer/package.json +54 -0
  127. package/.output/server/node_modules/yaml/dist/compose/compose-collection.js +90 -0
  128. package/.output/server/node_modules/yaml/dist/compose/compose-doc.js +45 -0
  129. package/.output/server/node_modules/yaml/dist/compose/compose-node.js +112 -0
  130. package/.output/server/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
  131. package/.output/server/node_modules/yaml/dist/compose/composer.js +224 -0
  132. package/.output/server/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
  133. package/.output/server/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
  134. package/.output/server/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
  135. package/.output/server/node_modules/yaml/dist/compose/resolve-end.js +39 -0
  136. package/.output/server/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
  137. package/.output/server/node_modules/yaml/dist/compose/resolve-flow-scalar.js +227 -0
  138. package/.output/server/node_modules/yaml/dist/compose/resolve-props.js +148 -0
  139. package/.output/server/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
  140. package/.output/server/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
  141. package/.output/server/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
  142. package/.output/server/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
  143. package/.output/server/node_modules/yaml/dist/doc/Document.js +337 -0
  144. package/.output/server/node_modules/yaml/dist/doc/anchors.js +76 -0
  145. package/.output/server/node_modules/yaml/dist/doc/applyReviver.js +57 -0
  146. package/.output/server/node_modules/yaml/dist/doc/createNode.js +90 -0
  147. package/.output/server/node_modules/yaml/dist/doc/directives.js +178 -0
  148. package/.output/server/node_modules/yaml/dist/errors.js +62 -0
  149. package/.output/server/node_modules/yaml/dist/index.js +50 -0
  150. package/.output/server/node_modules/yaml/dist/log.js +19 -0
  151. package/.output/server/node_modules/yaml/dist/nodes/Alias.js +118 -0
  152. package/.output/server/node_modules/yaml/dist/nodes/Collection.js +151 -0
  153. package/.output/server/node_modules/yaml/dist/nodes/Node.js +40 -0
  154. package/.output/server/node_modules/yaml/dist/nodes/Pair.js +39 -0
  155. package/.output/server/node_modules/yaml/dist/nodes/Scalar.js +27 -0
  156. package/.output/server/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
  157. package/.output/server/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
  158. package/.output/server/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
  159. package/.output/server/node_modules/yaml/dist/nodes/identity.js +53 -0
  160. package/.output/server/node_modules/yaml/dist/nodes/toJS.js +39 -0
  161. package/.output/server/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
  162. package/.output/server/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
  163. package/.output/server/node_modules/yaml/dist/parse/cst-visit.js +99 -0
  164. package/.output/server/node_modules/yaml/dist/parse/cst.js +112 -0
  165. package/.output/server/node_modules/yaml/dist/parse/lexer.js +723 -0
  166. package/.output/server/node_modules/yaml/dist/parse/line-counter.js +41 -0
  167. package/.output/server/node_modules/yaml/dist/parse/parser.js +980 -0
  168. package/.output/server/node_modules/yaml/dist/public-api.js +107 -0
  169. package/.output/server/node_modules/yaml/dist/schema/Schema.js +39 -0
  170. package/.output/server/node_modules/yaml/dist/schema/common/map.js +19 -0
  171. package/.output/server/node_modules/yaml/dist/schema/common/null.js +17 -0
  172. package/.output/server/node_modules/yaml/dist/schema/common/seq.js +19 -0
  173. package/.output/server/node_modules/yaml/dist/schema/common/string.js +16 -0
  174. package/.output/server/node_modules/yaml/dist/schema/core/bool.js +21 -0
  175. package/.output/server/node_modules/yaml/dist/schema/core/float.js +47 -0
  176. package/.output/server/node_modules/yaml/dist/schema/core/int.js +42 -0
  177. package/.output/server/node_modules/yaml/dist/schema/core/schema.js +25 -0
  178. package/.output/server/node_modules/yaml/dist/schema/json/schema.js +64 -0
  179. package/.output/server/node_modules/yaml/dist/schema/tags.js +99 -0
  180. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
  181. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
  182. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
  183. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
  184. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
  185. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
  186. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
  187. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
  188. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
  189. package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
  190. package/.output/server/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
  191. package/.output/server/node_modules/yaml/dist/stringify/stringify.js +132 -0
  192. package/.output/server/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
  193. package/.output/server/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
  194. package/.output/server/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
  195. package/.output/server/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
  196. package/.output/server/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
  197. package/.output/server/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
  198. package/.output/server/node_modules/yaml/dist/visit.js +236 -0
  199. package/.output/server/node_modules/yaml/package.json +97 -0
  200. package/.output/server/package.json +28 -0
  201. package/LICENSE +21 -0
  202. package/README.md +57 -1
  203. package/bin/launch.mjs +158 -0
  204. package/bin/shelfware.mjs +6 -0
  205. package/package.json +64 -5
  206. package/cli.mjs +0 -3
@@ -0,0 +1,185 @@
1
+ import { MAX_ARRAY_INDEX, MAX_ARRAY_LEN } from './constants.js';
2
+
3
+ /** @type {Record<string, string>} */
4
+ export const escaped = {
5
+ '<': '\\u003C',
6
+ '\\': '\\\\',
7
+ '\b': '\\b',
8
+ '\f': '\\f',
9
+ '\n': '\\n',
10
+ '\r': '\\r',
11
+ '\t': '\\t',
12
+ '\u2028': '\\u2028',
13
+ '\u2029': '\\u2029'
14
+ };
15
+
16
+ export class DevalueError extends Error {
17
+ /**
18
+ * @param {string} message
19
+ * @param {string[]} keys
20
+ * @param {any} [value] - The value that failed to be serialized
21
+ * @param {any} [root] - The root value being serialized
22
+ */
23
+ constructor(message, keys, value, root) {
24
+ super(message);
25
+ this.name = 'DevalueError';
26
+ this.path = keys.join('');
27
+ this.value = value;
28
+ this.root = root;
29
+ }
30
+ }
31
+
32
+ /** @param {any} thing */
33
+ export function is_primitive(thing) {
34
+ return thing === null || (typeof thing !== 'object' && typeof thing !== 'function');
35
+ }
36
+
37
+ const object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype)
38
+ .sort()
39
+ .join('\0');
40
+
41
+ /** @param {any} thing */
42
+ export function is_plain_object(thing) {
43
+ const proto = Object.getPrototypeOf(thing);
44
+
45
+ return (
46
+ proto === Object.prototype ||
47
+ proto === null ||
48
+ Object.getPrototypeOf(proto) === null ||
49
+ Object.getOwnPropertyNames(proto).sort().join('\0') === object_proto_names
50
+ );
51
+ }
52
+
53
+ /** @param {any} thing */
54
+ export function get_type(thing) {
55
+ return Object.prototype.toString.call(thing).slice(8, -1);
56
+ }
57
+
58
+ /** @param {string} char */
59
+ function get_escaped_char(char) {
60
+ switch (char) {
61
+ case '"':
62
+ return '\\"';
63
+ case '<':
64
+ return '\\u003C';
65
+ case '\\':
66
+ return '\\\\';
67
+ case '\n':
68
+ return '\\n';
69
+ case '\r':
70
+ return '\\r';
71
+ case '\t':
72
+ return '\\t';
73
+ case '\b':
74
+ return '\\b';
75
+ case '\f':
76
+ return '\\f';
77
+ case '\u2028':
78
+ return '\\u2028';
79
+ case '\u2029':
80
+ return '\\u2029';
81
+ default:
82
+ return char < ' ' ? `\\u${char.charCodeAt(0).toString(16).padStart(4, '0')}` : '';
83
+ }
84
+ }
85
+
86
+ /** @param {string} str */
87
+ export function stringify_string(str) {
88
+ let result = '';
89
+ let last_pos = 0;
90
+ const len = str.length;
91
+
92
+ for (let i = 0; i < len; i += 1) {
93
+ const char = str[i];
94
+ const replacement = get_escaped_char(char);
95
+ if (replacement) {
96
+ result += str.slice(last_pos, i) + replacement;
97
+ last_pos = i + 1;
98
+ }
99
+ }
100
+
101
+ return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`;
102
+ }
103
+
104
+ /** @param {Record<string | symbol, any>} object */
105
+ export function enumerable_symbols(object) {
106
+ return Object.getOwnPropertySymbols(object).filter(
107
+ (symbol) => Object.getOwnPropertyDescriptor(object, symbol).enumerable
108
+ );
109
+ }
110
+
111
+ const is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
112
+
113
+ /** @param {string} key */
114
+ export function stringify_key(key) {
115
+ return is_identifier.test(key) ? '.' + key : '[' + JSON.stringify(key) + ']';
116
+ }
117
+
118
+ /** @param {number} n */
119
+ export function is_valid_array_index(n) {
120
+ if (!Number.isInteger(n)) return false;
121
+ if (n < 0) return false;
122
+ if (n > MAX_ARRAY_INDEX) return false;
123
+ return true;
124
+ }
125
+
126
+ /** @param {number} n */
127
+ export function is_valid_array_len(n) {
128
+ if (!Number.isInteger(n)) return false;
129
+ if (n < 0) return false;
130
+ if (n > MAX_ARRAY_LEN) return false;
131
+ return true;
132
+ }
133
+
134
+ /** @param {string} s */
135
+ function is_valid_array_index_string(s) {
136
+ if (s.length === 0) return false;
137
+ if (s.length > 1 && s.charCodeAt(0) === 48) return false; // leading zero
138
+ for (let i = 0; i < s.length; i++) {
139
+ const c = s.charCodeAt(i);
140
+ if (c < 48 || c > 57) return false;
141
+ }
142
+ // by this point we know it's a string of digits, but it has to be within
143
+ // the range of valid array indices
144
+ return is_valid_array_index(+s);
145
+ }
146
+
147
+ /**
148
+ * Returns the length of the leading run of valid array indices in `keys`.
149
+ * @param {readonly string[]} keys
150
+ */
151
+ function array_index_cut(keys) {
152
+ for (var i = keys.length - 1; i >= 0; i--) {
153
+ if (is_valid_array_index_string(keys[i])) {
154
+ break;
155
+ }
156
+ }
157
+ return i + 1;
158
+ }
159
+
160
+ /**
161
+ * Finds the populated indices of an array.
162
+ * @param {unknown[]} array
163
+ */
164
+ export function valid_array_indices(array) {
165
+ const keys = Object.keys(array);
166
+ keys.length = array_index_cut(keys);
167
+ return keys;
168
+ }
169
+
170
+ /**
171
+ * Given the own enumerable string keys of an array-like value, in property
172
+ * order, returns the leading run of them that are valid array indices.
173
+ *
174
+ * This is the filtering half of the `indicesOf` stringify operation,
175
+ * exposed so that custom operations — which typically already have the keys
176
+ * in hand, e.g. from a foreign runtime — don't have to reimplement it.
177
+ *
178
+ * Does not modify `keys`.
179
+ *
180
+ * @param {readonly string[]} keys
181
+ * @returns {string[]}
182
+ */
183
+ export function filter_array_indices(keys) {
184
+ return keys.slice(0, array_index_cut(keys));
185
+ }
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ // Adapted from https://github.com/mathiasbynens/he/blob/36afe179392226cf1b6ccdb16ebbb7a5a844d93a/src/he.js#L106-L134
3
+ var _a;
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.fromCodePoint = void 0;
6
+ exports.replaceCodePoint = replaceCodePoint;
7
+ exports.decodeCodePoint = decodeCodePoint;
8
+ const decodeMap = new Map([
9
+ [0, 65533],
10
+ // C1 Unicode control character reference replacements
11
+ [128, 8364],
12
+ [130, 8218],
13
+ [131, 402],
14
+ [132, 8222],
15
+ [133, 8230],
16
+ [134, 8224],
17
+ [135, 8225],
18
+ [136, 710],
19
+ [137, 8240],
20
+ [138, 352],
21
+ [139, 8249],
22
+ [140, 338],
23
+ [142, 381],
24
+ [145, 8216],
25
+ [146, 8217],
26
+ [147, 8220],
27
+ [148, 8221],
28
+ [149, 8226],
29
+ [150, 8211],
30
+ [151, 8212],
31
+ [152, 732],
32
+ [153, 8482],
33
+ [154, 353],
34
+ [155, 8250],
35
+ [156, 339],
36
+ [158, 382],
37
+ [159, 376],
38
+ ]);
39
+ /**
40
+ * Polyfill for `String.fromCodePoint`. It is used to create a string from a Unicode code point.
41
+ */
42
+ exports.fromCodePoint =
43
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, n/no-unsupported-features/es-builtins
44
+ (_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : ((codePoint) => {
45
+ let output = "";
46
+ if (codePoint > 65535) {
47
+ codePoint -= 65536;
48
+ output += String.fromCharCode(((codePoint >>> 10) & 1023) | 55296);
49
+ codePoint = 56320 | (codePoint & 1023);
50
+ }
51
+ output += String.fromCharCode(codePoint);
52
+ return output;
53
+ });
54
+ /**
55
+ * Replace the given code point with a replacement character if it is a
56
+ * surrogate or is outside the valid range. Otherwise return the code
57
+ * point unchanged.
58
+ */
59
+ function replaceCodePoint(codePoint) {
60
+ var _a;
61
+ if ((codePoint >= 55296 && codePoint <= 57343) ||
62
+ codePoint > 1114111) {
63
+ return 65533;
64
+ }
65
+ return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint;
66
+ }
67
+ /**
68
+ * Replace the code point if relevant, then convert it to a string.
69
+ *
70
+ * @deprecated Use `fromCodePoint(replaceCodePoint(codePoint))` instead.
71
+ * @param codePoint The code point to decode.
72
+ * @returns The decoded code point.
73
+ */
74
+ function decodeCodePoint(codePoint) {
75
+ return (0, exports.fromCodePoint)(replaceCodePoint(codePoint));
76
+ }
77
+ //# sourceMappingURL=decode-codepoint.js.map