@powerlines/deepkit 0.5.0 → 0.5.1

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 (97) hide show
  1. package/dist/capnp.cjs +48 -47
  2. package/dist/capnp.js +3 -2
  3. package/dist/{chunk-TVDEXHJN.js → chunk-4V4LIAN2.js} +8 -9
  4. package/dist/chunk-7J3ZDT6O.cjs +30 -0
  5. package/dist/{chunk-U4JSDAXK.js → chunk-B6GTAZEL.js} +8 -7
  6. package/dist/{chunk-KYFUOGZ6.cjs → chunk-ESVH44QW.cjs} +9 -10
  7. package/dist/chunk-FFBZWTR7.cjs +63 -0
  8. package/dist/chunk-GRNJVY7I.cjs +19 -0
  9. package/dist/{chunk-DGXATHAN.js → chunk-I5CVIT7W.js} +41 -46
  10. package/dist/chunk-IRPJW6HH.js +16 -0
  11. package/dist/{chunk-SKYW5GV2.cjs → chunk-J2FVIV7W.cjs} +127 -132
  12. package/dist/chunk-J4SVRFV4.js +127 -0
  13. package/dist/{chunk-FEBG7WWO.js → chunk-MEMIQ5AA.js} +1 -3
  14. package/dist/chunk-ORA4UQMU.cjs +2 -0
  15. package/dist/chunk-OULCUN6I.js +1 -0
  16. package/dist/chunk-PKLLVKY2.cjs +193 -0
  17. package/dist/chunk-QLKLDV3V.cjs +135 -0
  18. package/dist/chunk-U5O6DHJ2.js +187 -0
  19. package/dist/{chunk-JHEBLHYK.cjs → chunk-VMRRVNO2.cjs} +2 -4
  20. package/dist/{chunk-55HOZO7D.cjs → chunk-VWKKT7CM.cjs} +5 -7
  21. package/dist/chunk-XGQQM64U.js +8 -0
  22. package/dist/{chunk-BTXPY3B4.js → chunk-YQQIT5YX.js} +2 -4
  23. package/dist/esbuild-plugin.cjs +5 -5
  24. package/dist/esbuild-plugin.d.cts +3 -2
  25. package/dist/esbuild-plugin.d.ts +3 -2
  26. package/dist/esbuild-plugin.js +4 -4
  27. package/dist/index.cjs +69 -69
  28. package/dist/index.js +10 -12
  29. package/dist/reflect-type.cjs +7 -6
  30. package/dist/reflect-type.js +6 -5
  31. package/dist/resolve-reflections.cjs +3 -3
  32. package/dist/resolve-reflections.js +2 -2
  33. package/dist/transformer.cjs +4 -4
  34. package/dist/transformer.js +2 -2
  35. package/dist/transpile.cjs +4 -4
  36. package/dist/transpile.js +3 -3
  37. package/dist/types.cjs +1 -2
  38. package/dist/types.js +1 -2
  39. package/dist/utilities.cjs +10 -9
  40. package/dist/utilities.js +3 -2
  41. package/dist/{chunk-YKFG2BZQ.cjs → vendor/chunk-5NPGWGPO.cjs} +0 -6
  42. package/dist/vendor/{chunk-BLN7QVCP.js → chunk-7LAB3COT.js} +7 -154
  43. package/dist/vendor/chunk-IOMA7ABE.js +359 -0
  44. package/dist/vendor/chunk-K5KCTNDL.cjs +2678 -0
  45. package/dist/vendor/chunk-L3KIZV6P.js +2664 -0
  46. package/dist/vendor/chunk-M3FJ3QXG.cjs +377 -0
  47. package/dist/vendor/chunk-SHUYVCID.js +4 -0
  48. package/dist/vendor/chunk-USNT2KNT.cjs +6 -0
  49. package/dist/{chunk-4WJJKR53.js → vendor/chunk-ZDFKNN7Y.cjs} +281 -322
  50. package/dist/vendor/compiler.cjs +12 -13
  51. package/dist/vendor/compiler.js +2 -5
  52. package/dist/vendor/config.cjs +9 -10
  53. package/dist/vendor/config.js +1 -5
  54. package/dist/vendor/core.cjs +130 -131
  55. package/dist/vendor/core.js +2 -5
  56. package/dist/vendor/index.cjs +14 -22
  57. package/dist/vendor/index.js +3 -11
  58. package/dist/vendor/type-spec.cjs +5 -6
  59. package/dist/vendor/type-spec.js +2 -5
  60. package/dist/vendor/type.cjs +631 -758
  61. package/dist/vendor/type.js +15 -138
  62. package/package.json +4 -4
  63. package/dist/chunk-2V4ET57D.js +0 -6954
  64. package/dist/chunk-6ETLMANX.js +0 -3472
  65. package/dist/chunk-6IQVU53O.cjs +0 -24
  66. package/dist/chunk-6OXPIOZY.cjs +0 -43
  67. package/dist/chunk-7WAH4JD3.js +0 -115
  68. package/dist/chunk-B4PTD5KQ.js +0 -4
  69. package/dist/chunk-ITQKPDCW.cjs +0 -3859
  70. package/dist/chunk-LBHO5BRF.js +0 -2251
  71. package/dist/chunk-OYRIJX67.cjs +0 -3487
  72. package/dist/chunk-PANPZ6S6.cjs +0 -6
  73. package/dist/chunk-QPSZUUB6.cjs +0 -2259
  74. package/dist/chunk-QQ7GKXIS.js +0 -43
  75. package/dist/chunk-SA3DCC4M.cjs +0 -6968
  76. package/dist/chunk-WVKPC33H.cjs +0 -49
  77. package/dist/chunk-YUO4MCOI.js +0 -18
  78. package/dist/vendor/chunk-5BKT4CS5.js +0 -28
  79. package/dist/vendor/chunk-BDXVTHBY.cjs +0 -3859
  80. package/dist/vendor/chunk-EQXMWOHO.cjs +0 -115
  81. package/dist/vendor/chunk-MCNMRQDT.js +0 -3513
  82. package/dist/vendor/chunk-MO4O4UYI.cjs +0 -42
  83. package/dist/vendor/chunk-RH4YMONA.js +0 -7064
  84. package/dist/vendor/chunk-RZKB5IQZ.cjs +0 -3531
  85. package/dist/vendor/chunk-WOXMCJJU.cjs +0 -7078
  86. package/dist/vendor/type-compiler/compiler.cjs +0 -46
  87. package/dist/vendor/type-compiler/compiler.d.cts +0 -1
  88. package/dist/vendor/type-compiler/compiler.d.ts +0 -1
  89. package/dist/vendor/type-compiler/compiler.js +0 -7
  90. package/dist/vendor/type-compiler/config.cjs +0 -36
  91. package/dist/vendor/type-compiler/config.d.cts +0 -6
  92. package/dist/vendor/type-compiler/config.d.ts +0 -6
  93. package/dist/vendor/type-compiler/config.js +0 -5
  94. package/dist/vendor/type-compiler/index.cjs +0 -108
  95. package/dist/vendor/type-compiler/index.d.cts +0 -1
  96. package/dist/vendor/type-compiler/index.d.ts +0 -1
  97. package/dist/vendor/type-compiler/index.js +0 -67
@@ -1,2251 +0,0 @@
1
- import { init_esm_shims, __name } from './chunk-QQ7GKXIS.js';
2
- import { ReflectionKind } from '@powerlines/deepkit/vendor/type';
3
- import { Buffer } from 'node:buffer';
4
- import { isNull as isNull$1 } from '@stryke/type-checks/is-null';
5
- import { isString as isString$1 } from '@stryke/type-checks/is-string';
6
- import { isUndefined as isUndefined$1 } from '@stryke/type-checks/is-undefined';
7
-
8
- // src/utilities.ts
9
- init_esm_shims();
10
-
11
- // ../../node_modules/.pnpm/@stryke+helpers@0.9.31/node_modules/@stryke/helpers/dist/get-unique.mjs
12
- init_esm_shims();
13
- function t(e7, t7 = (e8) => e8) {
14
- let n6 = /* @__PURE__ */ new Map();
15
- for (let r5 of e7) {
16
- let e8 = t7(r5);
17
- n6.has(e8) || n6.set(e8, r5);
18
- }
19
- return [...n6.values()];
20
- }
21
- __name(t, "t");
22
-
23
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/storm-json.mjs
24
- init_esm_shims();
25
-
26
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/type-checks/src/is-object.mjs
27
- init_esm_shims();
28
-
29
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/type-checks/src/is-plain-object.mjs
30
- init_esm_shims();
31
-
32
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/type-checks/src/get-object-tag.mjs
33
- init_esm_shims();
34
- var e = /* @__PURE__ */ __name((e7) => e7 == null ? e7 === void 0 ? `[object Undefined]` : `[object Null]` : Object.prototype.toString.call(e7), "e");
35
-
36
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/type-checks/src/is-plain-object.mjs
37
- var t2 = /* @__PURE__ */ __name((e7) => typeof e7 == `object` && !!e7, "t");
38
- var n = /* @__PURE__ */ __name((n6) => {
39
- if (!t2(n6) || e(n6) !== `[object Object]`) return false;
40
- if (Object.getPrototypeOf(n6) === null) return true;
41
- let r5 = n6;
42
- for (; Object.getPrototypeOf(r5) !== null; ) r5 = Object.getPrototypeOf(r5);
43
- return Object.getPrototypeOf(n6) === r5;
44
- }, "n");
45
-
46
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/type-checks/src/is-object.mjs
47
- var t3 = /* @__PURE__ */ __name((t7) => {
48
- try {
49
- return typeof t7 == `object` || !!t7 && t7?.constructor === Object || n(t7);
50
- } catch {
51
- return false;
52
- }
53
- }, "t");
54
-
55
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/type-checks/src/is-string.mjs
56
- init_esm_shims();
57
- var e2 = /* @__PURE__ */ __name((e7) => {
58
- try {
59
- return typeof e7 == `string`;
60
- } catch {
61
- return false;
62
- }
63
- }, "e");
64
-
65
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/utils/parse.mjs
66
- init_esm_shims();
67
-
68
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/utils/strip-comments.mjs
69
- init_esm_shims();
70
-
71
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/types/src/base.mjs
72
- init_esm_shims();
73
- var e3 = ``;
74
-
75
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/utils/strip-comments.mjs
76
- var t4 = Symbol(`singleComment`);
77
- var n2 = Symbol(`multiComment`);
78
- function r() {
79
- return ``;
80
- }
81
- __name(r, "r");
82
- function i(e7, t7, n6) {
83
- return e7.slice(t7, n6).replace(/\S/g, ` `);
84
- }
85
- __name(i, "i");
86
- function a(e7, t7) {
87
- let n6 = t7 - 1, r5 = 0;
88
- for (; e7[n6] === `\\`; ) --n6, r5 += 1;
89
- return !!(r5 % 2);
90
- }
91
- __name(a, "a");
92
- function o(o4, { whitespace: s = true, trailingCommas: c2 = false } = {}) {
93
- if (typeof o4 != `string`) throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof o4}\``);
94
- let l = s ? i : r, u = false, d = false, f = 0, p = ``, m = ``, h = -1;
95
- for (let r5 = 0; r5 < o4.length; r5++) {
96
- let i3 = o4[r5], s2 = o4[r5 + 1];
97
- !d && i3 === `"` && (a(o4, r5) || (u = !u)), !u && (!d && i3 + (s2 ?? e3) === `//` ? (p += o4.slice(f, r5), f = r5, d = t4, r5++) : d === t4 && i3 + (s2 ?? e3) === `\r
98
- ` ? (r5++, d = false, p += l(o4, f, r5), f = r5) : d === t4 && i3 === `
99
- ` ? (d = false, p += l(o4, f, r5), f = r5) : !d && i3 + (s2 ?? e3) === `/*` ? (p += o4.slice(f, r5), f = r5, d = n2, r5++) : d === n2 && i3 + (s2 ?? e3) === `*/` ? (r5++, d = false, p += l(o4, f, r5 + 1), f = r5 + 1) : c2 && !d && (h === -1 ? i3 === `,` && (m += p + o4.slice(f, r5), p = ``, f = r5, h = r5) : i3 === `}` || i3 === `]` ? (p += o4.slice(f, r5), m += l(p, 0, 1) + p.slice(1), p = ``, f = r5, h = -1) : i3 !== ` ` && i3 !== ` ` && i3 !== `\r` && i3 !== `
100
- ` && (p += o4.slice(f, r5), f = r5, h = -1)));
101
- }
102
- return m + p + (d ? l(o4.slice(f)) : o4.slice(f));
103
- }
104
- __name(o, "o");
105
-
106
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/utils/parse.mjs
107
- var t5 = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/;
108
- var n3 = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
109
- var r2 = /^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;
110
- function i2(e7, t7) {
111
- if (e7 === `__proto__` || e7 === `constructor` && t7 && typeof t7 == `object` && `prototype` in t7) {
112
- console.warn(`Dropping "${e7}" key to prevent prototype pollution.`);
113
- return;
114
- }
115
- return t7;
116
- }
117
- __name(i2, "i");
118
- function a2(a3, o4 = {}) {
119
- if (typeof a3 != `string`) return a3;
120
- let s = o(a3);
121
- if (s[0] === `"` && s[s.length - 1] === `"` && !s.includes(`\\`)) return s.slice(1, -1);
122
- if (s = s.trim(), s.length <= 9) switch (s.toLowerCase()) {
123
- case `true`:
124
- return true;
125
- case `false`:
126
- return false;
127
- case `undefined`:
128
- return;
129
- case `null`:
130
- return null;
131
- case `nan`:
132
- return NaN;
133
- case `infinity`:
134
- return 1 / 0;
135
- case `-infinity`:
136
- return -1 / 0;
137
- }
138
- if (!r2.test(s)) {
139
- if (o4.strict) throw Error(`Invalid JSON`);
140
- return s;
141
- }
142
- try {
143
- if (t5.test(s) || n3.test(s)) {
144
- if (o4.strict) throw Error(`Possible prototype pollution`);
145
- return JSON.parse(s, i2);
146
- }
147
- return JSON.parse(s);
148
- } catch (e7) {
149
- if (o4.strict) throw e7;
150
- return a3;
151
- }
152
- }
153
- __name(a2, "a");
154
-
155
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/utils/parse-error.mjs
156
- init_esm_shims();
157
-
158
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/utils/code-frames.mjs
159
- init_esm_shims();
160
- var e4 = /\r\n|[\n\r\u2028\u2029]/;
161
- function t6(e7, t7, n6 = {}) {
162
- let r5 = { column: 0, line: -1, ...e7.start }, i3 = { ...r5, ...e7.end }, { linesAbove: a3 = 2, linesBelow: o4 = 3 } = n6 || {}, s = r5.line, c2 = r5.column, l = i3.line, u = i3.column, d = Math.max(s - (a3 + 1), 0), f = Math.min(t7.length, l + o4);
163
- s === -1 && (d = 0), l === -1 && (f = t7.length);
164
- let p = l - s, m = {};
165
- if (p) for (let e8 = 0; e8 <= p; e8++) {
166
- let n7 = e8 + s;
167
- c2 ? e8 === 0 ? m[n7] = [c2, (t7[n7 - 1]?.length ?? 0) - c2 + 1] : e8 === p ? m[n7] = [0, u] : m[n7] = [0, t7[n7 - e8]?.length ?? 0] : m[n7] = true;
168
- }
169
- else c2 === u ? m[s] = c2 ? [c2, 0] : true : m[s] = [c2, u - c2];
170
- return { start: d, end: f, markerLines: m };
171
- }
172
- __name(t6, "t");
173
- function n4(n6, r5, i3 = {}) {
174
- let { start: a3, end: o4, markerLines: s } = t6(r5, n6.split(e4), i3), c2 = String(o4).length;
175
- return (i3.highlight ? i3.highlight(n6) : n6).split(e4).slice(a3, o4).map((e7, t7) => {
176
- let n7 = a3 + 1 + t7, r6 = ` ${` ${n7}`.slice(-c2)} | `, i4 = !!(s[n7] ?? false);
177
- if (i4) {
178
- let t8 = ``;
179
- if (Array.isArray(i4)) {
180
- let n8 = e7.slice(0, Math.max(i4[0] - 1, 0)).replace(/[^\t]/g, ` `), a4 = i4[1] || 1;
181
- t8 = [`
182
- `, r6.replace(/\d/g, ` `), n8, `^`.repeat(a4)].join(``);
183
- }
184
- return [`>`, r6, e7, t8].join(``);
185
- }
186
- return ` ${r6}${e7}`;
187
- }).join(`
188
- `);
189
- }
190
- __name(n4, "n");
191
-
192
- // ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/main.js
193
- init_esm_shims();
194
-
195
- // ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/format.js
196
- init_esm_shims();
197
-
198
- // ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/scanner.js
199
- init_esm_shims();
200
- function createScanner(text, ignoreTrivia = false) {
201
- const len = text.length;
202
- let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
203
- function scanHexDigits(count, exact) {
204
- let digits = 0;
205
- let value2 = 0;
206
- while (digits < count || !exact) {
207
- let ch = text.charCodeAt(pos);
208
- if (ch >= 48 && ch <= 57) {
209
- value2 = value2 * 16 + ch - 48;
210
- } else if (ch >= 65 && ch <= 70) {
211
- value2 = value2 * 16 + ch - 65 + 10;
212
- } else if (ch >= 97 && ch <= 102) {
213
- value2 = value2 * 16 + ch - 97 + 10;
214
- } else {
215
- break;
216
- }
217
- pos++;
218
- digits++;
219
- }
220
- if (digits < count) {
221
- value2 = -1;
222
- }
223
- return value2;
224
- }
225
- __name(scanHexDigits, "scanHexDigits");
226
- function setPosition(newPosition) {
227
- pos = newPosition;
228
- value = "";
229
- tokenOffset = 0;
230
- token = 16;
231
- scanError = 0;
232
- }
233
- __name(setPosition, "setPosition");
234
- function scanNumber() {
235
- let start = pos;
236
- if (text.charCodeAt(pos) === 48) {
237
- pos++;
238
- } else {
239
- pos++;
240
- while (pos < text.length && isDigit(text.charCodeAt(pos))) {
241
- pos++;
242
- }
243
- }
244
- if (pos < text.length && text.charCodeAt(pos) === 46) {
245
- pos++;
246
- if (pos < text.length && isDigit(text.charCodeAt(pos))) {
247
- pos++;
248
- while (pos < text.length && isDigit(text.charCodeAt(pos))) {
249
- pos++;
250
- }
251
- } else {
252
- scanError = 3;
253
- return text.substring(start, pos);
254
- }
255
- }
256
- let end = pos;
257
- if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
258
- pos++;
259
- if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
260
- pos++;
261
- }
262
- if (pos < text.length && isDigit(text.charCodeAt(pos))) {
263
- pos++;
264
- while (pos < text.length && isDigit(text.charCodeAt(pos))) {
265
- pos++;
266
- }
267
- end = pos;
268
- } else {
269
- scanError = 3;
270
- }
271
- }
272
- return text.substring(start, end);
273
- }
274
- __name(scanNumber, "scanNumber");
275
- function scanString() {
276
- let result = "", start = pos;
277
- while (true) {
278
- if (pos >= len) {
279
- result += text.substring(start, pos);
280
- scanError = 2;
281
- break;
282
- }
283
- const ch = text.charCodeAt(pos);
284
- if (ch === 34) {
285
- result += text.substring(start, pos);
286
- pos++;
287
- break;
288
- }
289
- if (ch === 92) {
290
- result += text.substring(start, pos);
291
- pos++;
292
- if (pos >= len) {
293
- scanError = 2;
294
- break;
295
- }
296
- const ch2 = text.charCodeAt(pos++);
297
- switch (ch2) {
298
- case 34:
299
- result += '"';
300
- break;
301
- case 92:
302
- result += "\\";
303
- break;
304
- case 47:
305
- result += "/";
306
- break;
307
- case 98:
308
- result += "\b";
309
- break;
310
- case 102:
311
- result += "\f";
312
- break;
313
- case 110:
314
- result += "\n";
315
- break;
316
- case 114:
317
- result += "\r";
318
- break;
319
- case 116:
320
- result += " ";
321
- break;
322
- case 117:
323
- const ch3 = scanHexDigits(4, true);
324
- if (ch3 >= 0) {
325
- result += String.fromCharCode(ch3);
326
- } else {
327
- scanError = 4;
328
- }
329
- break;
330
- default:
331
- scanError = 5;
332
- }
333
- start = pos;
334
- continue;
335
- }
336
- if (ch >= 0 && ch <= 31) {
337
- if (isLineBreak(ch)) {
338
- result += text.substring(start, pos);
339
- scanError = 2;
340
- break;
341
- } else {
342
- scanError = 6;
343
- }
344
- }
345
- pos++;
346
- }
347
- return result;
348
- }
349
- __name(scanString, "scanString");
350
- function scanNext() {
351
- value = "";
352
- scanError = 0;
353
- tokenOffset = pos;
354
- lineStartOffset = lineNumber;
355
- prevTokenLineStartOffset = tokenLineStartOffset;
356
- if (pos >= len) {
357
- tokenOffset = len;
358
- return token = 17;
359
- }
360
- let code = text.charCodeAt(pos);
361
- if (isWhiteSpace(code)) {
362
- do {
363
- pos++;
364
- value += String.fromCharCode(code);
365
- code = text.charCodeAt(pos);
366
- } while (isWhiteSpace(code));
367
- return token = 15;
368
- }
369
- if (isLineBreak(code)) {
370
- pos++;
371
- value += String.fromCharCode(code);
372
- if (code === 13 && text.charCodeAt(pos) === 10) {
373
- pos++;
374
- value += "\n";
375
- }
376
- lineNumber++;
377
- tokenLineStartOffset = pos;
378
- return token = 14;
379
- }
380
- switch (code) {
381
- // tokens: []{}:,
382
- case 123:
383
- pos++;
384
- return token = 1;
385
- case 125:
386
- pos++;
387
- return token = 2;
388
- case 91:
389
- pos++;
390
- return token = 3;
391
- case 93:
392
- pos++;
393
- return token = 4;
394
- case 58:
395
- pos++;
396
- return token = 6;
397
- case 44:
398
- pos++;
399
- return token = 5;
400
- // strings
401
- case 34:
402
- pos++;
403
- value = scanString();
404
- return token = 10;
405
- // comments
406
- case 47:
407
- const start = pos - 1;
408
- if (text.charCodeAt(pos + 1) === 47) {
409
- pos += 2;
410
- while (pos < len) {
411
- if (isLineBreak(text.charCodeAt(pos))) {
412
- break;
413
- }
414
- pos++;
415
- }
416
- value = text.substring(start, pos);
417
- return token = 12;
418
- }
419
- if (text.charCodeAt(pos + 1) === 42) {
420
- pos += 2;
421
- const safeLength = len - 1;
422
- let commentClosed = false;
423
- while (pos < safeLength) {
424
- const ch = text.charCodeAt(pos);
425
- if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
426
- pos += 2;
427
- commentClosed = true;
428
- break;
429
- }
430
- pos++;
431
- if (isLineBreak(ch)) {
432
- if (ch === 13 && text.charCodeAt(pos) === 10) {
433
- pos++;
434
- }
435
- lineNumber++;
436
- tokenLineStartOffset = pos;
437
- }
438
- }
439
- if (!commentClosed) {
440
- pos++;
441
- scanError = 1;
442
- }
443
- value = text.substring(start, pos);
444
- return token = 13;
445
- }
446
- value += String.fromCharCode(code);
447
- pos++;
448
- return token = 16;
449
- // numbers
450
- case 45:
451
- value += String.fromCharCode(code);
452
- pos++;
453
- if (pos === len || !isDigit(text.charCodeAt(pos))) {
454
- return token = 16;
455
- }
456
- // found a minus, followed by a number so
457
- // we fall through to proceed with scanning
458
- // numbers
459
- case 48:
460
- case 49:
461
- case 50:
462
- case 51:
463
- case 52:
464
- case 53:
465
- case 54:
466
- case 55:
467
- case 56:
468
- case 57:
469
- value += scanNumber();
470
- return token = 11;
471
- // literals and unknown symbols
472
- default:
473
- while (pos < len && isUnknownContentCharacter(code)) {
474
- pos++;
475
- code = text.charCodeAt(pos);
476
- }
477
- if (tokenOffset !== pos) {
478
- value = text.substring(tokenOffset, pos);
479
- switch (value) {
480
- case "true":
481
- return token = 8;
482
- case "false":
483
- return token = 9;
484
- case "null":
485
- return token = 7;
486
- }
487
- return token = 16;
488
- }
489
- value += String.fromCharCode(code);
490
- pos++;
491
- return token = 16;
492
- }
493
- }
494
- __name(scanNext, "scanNext");
495
- function isUnknownContentCharacter(code) {
496
- if (isWhiteSpace(code) || isLineBreak(code)) {
497
- return false;
498
- }
499
- switch (code) {
500
- case 125:
501
- case 93:
502
- case 123:
503
- case 91:
504
- case 34:
505
- case 58:
506
- case 44:
507
- case 47:
508
- return false;
509
- }
510
- return true;
511
- }
512
- __name(isUnknownContentCharacter, "isUnknownContentCharacter");
513
- function scanNextNonTrivia() {
514
- let result;
515
- do {
516
- result = scanNext();
517
- } while (result >= 12 && result <= 15);
518
- return result;
519
- }
520
- __name(scanNextNonTrivia, "scanNextNonTrivia");
521
- return {
522
- setPosition,
523
- getPosition: /* @__PURE__ */ __name(() => pos, "getPosition"),
524
- scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
525
- getToken: /* @__PURE__ */ __name(() => token, "getToken"),
526
- getTokenValue: /* @__PURE__ */ __name(() => value, "getTokenValue"),
527
- getTokenOffset: /* @__PURE__ */ __name(() => tokenOffset, "getTokenOffset"),
528
- getTokenLength: /* @__PURE__ */ __name(() => pos - tokenOffset, "getTokenLength"),
529
- getTokenStartLine: /* @__PURE__ */ __name(() => lineStartOffset, "getTokenStartLine"),
530
- getTokenStartCharacter: /* @__PURE__ */ __name(() => tokenOffset - prevTokenLineStartOffset, "getTokenStartCharacter"),
531
- getTokenError: /* @__PURE__ */ __name(() => scanError, "getTokenError")
532
- };
533
- }
534
- __name(createScanner, "createScanner");
535
- function isWhiteSpace(ch) {
536
- return ch === 32 || ch === 9;
537
- }
538
- __name(isWhiteSpace, "isWhiteSpace");
539
- function isLineBreak(ch) {
540
- return ch === 10 || ch === 13;
541
- }
542
- __name(isLineBreak, "isLineBreak");
543
- function isDigit(ch) {
544
- return ch >= 48 && ch <= 57;
545
- }
546
- __name(isDigit, "isDigit");
547
- var CharacterCodes;
548
- (function(CharacterCodes2) {
549
- CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
550
- CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
551
- CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
552
- CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
553
- CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
554
- CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
555
- CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
556
- CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
557
- CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
558
- CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
559
- CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
560
- CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
561
- CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
562
- CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
563
- CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
564
- CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
565
- CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
566
- CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
567
- CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
568
- CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
569
- CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
570
- CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
571
- CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
572
- CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
573
- CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
574
- CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
575
- CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
576
- CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
577
- CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
578
- CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
579
- CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
580
- CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
581
- CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
582
- CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
583
- CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
584
- CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
585
- CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
586
- CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
587
- CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
588
- CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
589
- CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
590
- CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
591
- CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
592
- CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
593
- CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
594
- CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
595
- CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
596
- CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
597
- CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
598
- CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
599
- CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
600
- CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
601
- CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
602
- CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
603
- CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
604
- CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
605
- CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
606
- CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
607
- CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
608
- CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
609
- CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
610
- CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
611
- CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
612
- CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
613
- CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
614
- CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
615
- CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
616
- CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
617
- CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
618
- CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
619
- CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
620
- CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
621
- CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
622
- CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
623
- CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
624
- CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
625
- CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
626
- CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
627
- CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
628
- CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
629
- })(CharacterCodes || (CharacterCodes = {}));
630
-
631
- // ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/edit.js
632
- init_esm_shims();
633
-
634
- // ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/parser.js
635
- init_esm_shims();
636
- var ParseOptions;
637
- (function(ParseOptions2) {
638
- ParseOptions2.DEFAULT = {
639
- allowTrailingComma: false
640
- };
641
- })(ParseOptions || (ParseOptions = {}));
642
- function parse(text, errors = [], options = ParseOptions.DEFAULT) {
643
- let currentProperty = null;
644
- let currentParent = [];
645
- const previousParents = [];
646
- function onValue(value) {
647
- if (Array.isArray(currentParent)) {
648
- currentParent.push(value);
649
- } else if (currentProperty !== null) {
650
- currentParent[currentProperty] = value;
651
- }
652
- }
653
- __name(onValue, "onValue");
654
- const visitor = {
655
- onObjectBegin: /* @__PURE__ */ __name(() => {
656
- const object = {};
657
- onValue(object);
658
- previousParents.push(currentParent);
659
- currentParent = object;
660
- currentProperty = null;
661
- }, "onObjectBegin"),
662
- onObjectProperty: /* @__PURE__ */ __name((name) => {
663
- currentProperty = name;
664
- }, "onObjectProperty"),
665
- onObjectEnd: /* @__PURE__ */ __name(() => {
666
- currentParent = previousParents.pop();
667
- }, "onObjectEnd"),
668
- onArrayBegin: /* @__PURE__ */ __name(() => {
669
- const array = [];
670
- onValue(array);
671
- previousParents.push(currentParent);
672
- currentParent = array;
673
- currentProperty = null;
674
- }, "onArrayBegin"),
675
- onArrayEnd: /* @__PURE__ */ __name(() => {
676
- currentParent = previousParents.pop();
677
- }, "onArrayEnd"),
678
- onLiteralValue: onValue,
679
- onError: /* @__PURE__ */ __name((error, offset, length) => {
680
- errors.push({
681
- error,
682
- offset,
683
- length
684
- });
685
- }, "onError")
686
- };
687
- visit(text, visitor, options);
688
- return currentParent[0];
689
- }
690
- __name(parse, "parse");
691
- function visit(text, visitor, options = ParseOptions.DEFAULT) {
692
- const _scanner = createScanner(text, false);
693
- const _jsonPath = [];
694
- function toNoArgVisit(visitFunction) {
695
- return visitFunction ? () => visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
696
- }
697
- __name(toNoArgVisit, "toNoArgVisit");
698
- function toNoArgVisitWithPath(visitFunction) {
699
- return visitFunction ? () => visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
700
- }
701
- __name(toNoArgVisitWithPath, "toNoArgVisitWithPath");
702
- function toOneArgVisit(visitFunction) {
703
- return visitFunction ? (arg) => visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
704
- }
705
- __name(toOneArgVisit, "toOneArgVisit");
706
- function toOneArgVisitWithPath(visitFunction) {
707
- return visitFunction ? (arg) => visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
708
- }
709
- __name(toOneArgVisitWithPath, "toOneArgVisitWithPath");
710
- const onObjectBegin = toNoArgVisitWithPath(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toNoArgVisit(visitor.onObjectEnd), onArrayBegin = toNoArgVisitWithPath(visitor.onArrayBegin), onArrayEnd = toNoArgVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
711
- const disallowComments = options && options.disallowComments;
712
- const allowTrailingComma = options && options.allowTrailingComma;
713
- function scanNext() {
714
- while (true) {
715
- const token = _scanner.scan();
716
- switch (_scanner.getTokenError()) {
717
- case 4:
718
- handleError(
719
- 14
720
- /* ParseErrorCode.InvalidUnicode */
721
- );
722
- break;
723
- case 5:
724
- handleError(
725
- 15
726
- /* ParseErrorCode.InvalidEscapeCharacter */
727
- );
728
- break;
729
- case 3:
730
- handleError(
731
- 13
732
- /* ParseErrorCode.UnexpectedEndOfNumber */
733
- );
734
- break;
735
- case 1:
736
- if (!disallowComments) {
737
- handleError(
738
- 11
739
- /* ParseErrorCode.UnexpectedEndOfComment */
740
- );
741
- }
742
- break;
743
- case 2:
744
- handleError(
745
- 12
746
- /* ParseErrorCode.UnexpectedEndOfString */
747
- );
748
- break;
749
- case 6:
750
- handleError(
751
- 16
752
- /* ParseErrorCode.InvalidCharacter */
753
- );
754
- break;
755
- }
756
- switch (token) {
757
- case 12:
758
- case 13:
759
- if (disallowComments) {
760
- handleError(
761
- 10
762
- /* ParseErrorCode.InvalidCommentToken */
763
- );
764
- } else {
765
- onComment();
766
- }
767
- break;
768
- case 16:
769
- handleError(
770
- 1
771
- /* ParseErrorCode.InvalidSymbol */
772
- );
773
- break;
774
- case 15:
775
- case 14:
776
- break;
777
- default:
778
- return token;
779
- }
780
- }
781
- }
782
- __name(scanNext, "scanNext");
783
- function handleError(error, skipUntilAfter = [], skipUntil = []) {
784
- onError(error);
785
- if (skipUntilAfter.length + skipUntil.length > 0) {
786
- let token = _scanner.getToken();
787
- while (token !== 17) {
788
- if (skipUntilAfter.indexOf(token) !== -1) {
789
- scanNext();
790
- break;
791
- } else if (skipUntil.indexOf(token) !== -1) {
792
- break;
793
- }
794
- token = scanNext();
795
- }
796
- }
797
- }
798
- __name(handleError, "handleError");
799
- function parseString(isValue) {
800
- const value = _scanner.getTokenValue();
801
- if (isValue) {
802
- onLiteralValue(value);
803
- } else {
804
- onObjectProperty(value);
805
- _jsonPath.push(value);
806
- }
807
- scanNext();
808
- return true;
809
- }
810
- __name(parseString, "parseString");
811
- function parseLiteral() {
812
- switch (_scanner.getToken()) {
813
- case 11:
814
- const tokenValue = _scanner.getTokenValue();
815
- let value = Number(tokenValue);
816
- if (isNaN(value)) {
817
- handleError(
818
- 2
819
- /* ParseErrorCode.InvalidNumberFormat */
820
- );
821
- value = 0;
822
- }
823
- onLiteralValue(value);
824
- break;
825
- case 7:
826
- onLiteralValue(null);
827
- break;
828
- case 8:
829
- onLiteralValue(true);
830
- break;
831
- case 9:
832
- onLiteralValue(false);
833
- break;
834
- default:
835
- return false;
836
- }
837
- scanNext();
838
- return true;
839
- }
840
- __name(parseLiteral, "parseLiteral");
841
- function parseProperty() {
842
- if (_scanner.getToken() !== 10) {
843
- handleError(3, [], [
844
- 2,
845
- 5
846
- /* SyntaxKind.CommaToken */
847
- ]);
848
- return false;
849
- }
850
- parseString(false);
851
- if (_scanner.getToken() === 6) {
852
- onSeparator(":");
853
- scanNext();
854
- if (!parseValue()) {
855
- handleError(4, [], [
856
- 2,
857
- 5
858
- /* SyntaxKind.CommaToken */
859
- ]);
860
- }
861
- } else {
862
- handleError(5, [], [
863
- 2,
864
- 5
865
- /* SyntaxKind.CommaToken */
866
- ]);
867
- }
868
- _jsonPath.pop();
869
- return true;
870
- }
871
- __name(parseProperty, "parseProperty");
872
- function parseObject() {
873
- onObjectBegin();
874
- scanNext();
875
- let needsComma = false;
876
- while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
877
- if (_scanner.getToken() === 5) {
878
- if (!needsComma) {
879
- handleError(4, [], []);
880
- }
881
- onSeparator(",");
882
- scanNext();
883
- if (_scanner.getToken() === 2 && allowTrailingComma) {
884
- break;
885
- }
886
- } else if (needsComma) {
887
- handleError(6, [], []);
888
- }
889
- if (!parseProperty()) {
890
- handleError(4, [], [
891
- 2,
892
- 5
893
- /* SyntaxKind.CommaToken */
894
- ]);
895
- }
896
- needsComma = true;
897
- }
898
- onObjectEnd();
899
- if (_scanner.getToken() !== 2) {
900
- handleError(7, [
901
- 2
902
- /* SyntaxKind.CloseBraceToken */
903
- ], []);
904
- } else {
905
- scanNext();
906
- }
907
- return true;
908
- }
909
- __name(parseObject, "parseObject");
910
- function parseArray() {
911
- onArrayBegin();
912
- scanNext();
913
- let isFirstElement = true;
914
- let needsComma = false;
915
- while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
916
- if (_scanner.getToken() === 5) {
917
- if (!needsComma) {
918
- handleError(4, [], []);
919
- }
920
- onSeparator(",");
921
- scanNext();
922
- if (_scanner.getToken() === 4 && allowTrailingComma) {
923
- break;
924
- }
925
- } else if (needsComma) {
926
- handleError(6, [], []);
927
- }
928
- if (isFirstElement) {
929
- _jsonPath.push(0);
930
- isFirstElement = false;
931
- } else {
932
- _jsonPath[_jsonPath.length - 1]++;
933
- }
934
- if (!parseValue()) {
935
- handleError(4, [], [
936
- 4,
937
- 5
938
- /* SyntaxKind.CommaToken */
939
- ]);
940
- }
941
- needsComma = true;
942
- }
943
- onArrayEnd();
944
- if (!isFirstElement) {
945
- _jsonPath.pop();
946
- }
947
- if (_scanner.getToken() !== 4) {
948
- handleError(8, [
949
- 4
950
- /* SyntaxKind.CloseBracketToken */
951
- ], []);
952
- } else {
953
- scanNext();
954
- }
955
- return true;
956
- }
957
- __name(parseArray, "parseArray");
958
- function parseValue() {
959
- switch (_scanner.getToken()) {
960
- case 3:
961
- return parseArray();
962
- case 1:
963
- return parseObject();
964
- case 10:
965
- return parseString(true);
966
- default:
967
- return parseLiteral();
968
- }
969
- }
970
- __name(parseValue, "parseValue");
971
- scanNext();
972
- if (_scanner.getToken() === 17) {
973
- if (options.allowEmptyContent) {
974
- return true;
975
- }
976
- handleError(4, [], []);
977
- return false;
978
- }
979
- if (!parseValue()) {
980
- handleError(4, [], []);
981
- return false;
982
- }
983
- if (_scanner.getToken() !== 17) {
984
- handleError(9, [], []);
985
- }
986
- return true;
987
- }
988
- __name(visit, "visit");
989
-
990
- // ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/main.js
991
- var ScanError;
992
- (function(ScanError2) {
993
- ScanError2[ScanError2["None"] = 0] = "None";
994
- ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
995
- ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
996
- ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
997
- ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
998
- ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
999
- ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
1000
- })(ScanError || (ScanError = {}));
1001
- var SyntaxKind;
1002
- (function(SyntaxKind2) {
1003
- SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
1004
- SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
1005
- SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
1006
- SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
1007
- SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
1008
- SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
1009
- SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
1010
- SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
1011
- SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
1012
- SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
1013
- SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
1014
- SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
1015
- SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
1016
- SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
1017
- SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
1018
- SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
1019
- SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
1020
- })(SyntaxKind || (SyntaxKind = {}));
1021
- var parse2 = parse;
1022
- var ParseErrorCode;
1023
- (function(ParseErrorCode2) {
1024
- ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
1025
- ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
1026
- ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
1027
- ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
1028
- ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
1029
- ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
1030
- ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
1031
- ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
1032
- ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
1033
- ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
1034
- ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
1035
- ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
1036
- ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
1037
- ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
1038
- ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
1039
- ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
1040
- })(ParseErrorCode || (ParseErrorCode = {}));
1041
- function printParseErrorCode(code) {
1042
- switch (code) {
1043
- case 1:
1044
- return "InvalidSymbol";
1045
- case 2:
1046
- return "InvalidNumberFormat";
1047
- case 3:
1048
- return "PropertyNameExpected";
1049
- case 4:
1050
- return "ValueExpected";
1051
- case 5:
1052
- return "ColonExpected";
1053
- case 6:
1054
- return "CommaExpected";
1055
- case 7:
1056
- return "CloseBraceExpected";
1057
- case 8:
1058
- return "CloseBracketExpected";
1059
- case 9:
1060
- return "EndOfFileExpected";
1061
- case 10:
1062
- return "InvalidCommentToken";
1063
- case 11:
1064
- return "UnexpectedEndOfComment";
1065
- case 12:
1066
- return "UnexpectedEndOfString";
1067
- case 13:
1068
- return "UnexpectedEndOfNumber";
1069
- case 14:
1070
- return "InvalidUnicode";
1071
- case 15:
1072
- return "InvalidEscapeCharacter";
1073
- case 16:
1074
- return "InvalidCharacter";
1075
- }
1076
- return "<unknown ParseErrorCode>";
1077
- }
1078
- __name(printParseErrorCode, "printParseErrorCode");
1079
-
1080
- // ../../node_modules/.pnpm/lines-and-columns@2.0.4/node_modules/lines-and-columns/build/index.mjs
1081
- init_esm_shims();
1082
- var LF = "\n";
1083
- var CR = "\r";
1084
- var LinesAndColumns = (
1085
- /** @class */
1086
- (function() {
1087
- function LinesAndColumns2(string) {
1088
- this.length = string.length;
1089
- var offsets = [0];
1090
- for (var offset = 0; offset < string.length; ) {
1091
- switch (string[offset]) {
1092
- case LF:
1093
- offset += LF.length;
1094
- offsets.push(offset);
1095
- break;
1096
- case CR:
1097
- offset += CR.length;
1098
- if (string[offset] === LF) {
1099
- offset += LF.length;
1100
- }
1101
- offsets.push(offset);
1102
- break;
1103
- default:
1104
- offset++;
1105
- break;
1106
- }
1107
- }
1108
- this.offsets = offsets;
1109
- }
1110
- __name(LinesAndColumns2, "LinesAndColumns");
1111
- LinesAndColumns2.prototype.locationForIndex = function(index) {
1112
- if (index < 0 || index > this.length) {
1113
- return null;
1114
- }
1115
- var line = 0;
1116
- var offsets = this.offsets;
1117
- while (offsets[line + 1] <= index) {
1118
- line++;
1119
- }
1120
- var column = index - offsets[line];
1121
- return { line, column };
1122
- };
1123
- LinesAndColumns2.prototype.indexForLocation = function(location) {
1124
- var line = location.line, column = location.column;
1125
- if (line < 0 || line >= this.offsets.length) {
1126
- return null;
1127
- }
1128
- if (column < 0 || column > this.lengthOfLine(line)) {
1129
- return null;
1130
- }
1131
- return this.offsets[line] + column;
1132
- };
1133
- LinesAndColumns2.prototype.lengthOfLine = function(line) {
1134
- var offset = this.offsets[line];
1135
- var nextOffset = line === this.offsets.length - 1 ? this.length : this.offsets[line + 1];
1136
- return nextOffset - offset;
1137
- };
1138
- return LinesAndColumns2;
1139
- })()
1140
- );
1141
-
1142
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/utils/parse-error.mjs
1143
- function r3(r5, i3) {
1144
- let { error: a3, offset: o4, length: s } = i3, c2 = new LinesAndColumns(r5).locationForIndex(o4), l = c2?.line ?? 0, u = c2?.column ?? 0;
1145
- return l++, u++, `${printParseErrorCode(a3)} in JSON at ${l}:${u}
1146
- ${n4(r5, { start: { line: l, column: u }, end: { line: l, column: u + s } })}
1147
- `;
1148
- }
1149
- __name(r3, "r");
1150
-
1151
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/utils/stringify.mjs
1152
- init_esm_shims();
1153
-
1154
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/type-checks/src/is-number.mjs
1155
- init_esm_shims();
1156
- var e5 = /* @__PURE__ */ __name((e7) => {
1157
- try {
1158
- return e7 instanceof Number || typeof e7 == `number` || Number(e7) === e7;
1159
- } catch {
1160
- return false;
1161
- }
1162
- }, "e");
1163
-
1164
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/type-checks/src/is-undefined.mjs
1165
- init_esm_shims();
1166
- var e6 = /* @__PURE__ */ __name((e7) => e7 === void 0, "e");
1167
-
1168
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/utils/stringify.mjs
1169
- var n5 = `@/#$ :;,.!?&=+-*%^~|\\"'\`{}[]()<>`.split(``);
1170
- var r4 = /* @__PURE__ */ __name((i3, a3 = 2) => {
1171
- let o4 = e5(a3) ? ` `.repeat(a3) : a3;
1172
- switch (i3) {
1173
- case null:
1174
- return `null`;
1175
- case void 0:
1176
- return `"undefined"`;
1177
- case true:
1178
- return `true`;
1179
- case false:
1180
- return `false`;
1181
- case 1 / 0:
1182
- return `infinity`;
1183
- case -1 / 0:
1184
- return `-infinity`;
1185
- }
1186
- if (Array.isArray(i3)) return `[${o4}${i3.map((e7) => r4(e7, o4)).join(`,${o4}`)}${o4}]`;
1187
- if (i3 instanceof Uint8Array) return i3.toString();
1188
- switch (typeof i3) {
1189
- case `number`:
1190
- return `${i3}`;
1191
- case `string`:
1192
- return JSON.stringify(i3);
1193
- case `object`:
1194
- return `{${o4}${Object.keys(i3).filter((e7) => !e6(i3[e7])).map((e7) => `${n5.some((t7) => e7.includes(t7)) ? `"${e7}"` : e7}: ${o4}${r4(i3[e7], o4)}`).join(`,${o4}`)}${o4}}`;
1195
- default:
1196
- return `null`;
1197
- }
1198
- }, "r");
1199
-
1200
- // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.js
1201
- init_esm_shims();
1202
-
1203
- // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.js
1204
- init_esm_shims();
1205
-
1206
- // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.js
1207
- init_esm_shims();
1208
-
1209
- // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.js
1210
- init_esm_shims();
1211
- var DoubleIndexedKV = class {
1212
- static {
1213
- __name(this, "DoubleIndexedKV");
1214
- }
1215
- constructor() {
1216
- this.keyToValue = /* @__PURE__ */ new Map();
1217
- this.valueToKey = /* @__PURE__ */ new Map();
1218
- }
1219
- set(key, value) {
1220
- this.keyToValue.set(key, value);
1221
- this.valueToKey.set(value, key);
1222
- }
1223
- getByKey(key) {
1224
- return this.keyToValue.get(key);
1225
- }
1226
- getByValue(value) {
1227
- return this.valueToKey.get(value);
1228
- }
1229
- clear() {
1230
- this.keyToValue.clear();
1231
- this.valueToKey.clear();
1232
- }
1233
- };
1234
-
1235
- // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.js
1236
- var Registry = class {
1237
- static {
1238
- __name(this, "Registry");
1239
- }
1240
- constructor(generateIdentifier) {
1241
- this.generateIdentifier = generateIdentifier;
1242
- this.kv = new DoubleIndexedKV();
1243
- }
1244
- register(value, identifier) {
1245
- if (this.kv.getByValue(value)) {
1246
- return;
1247
- }
1248
- if (!identifier) {
1249
- identifier = this.generateIdentifier(value);
1250
- }
1251
- this.kv.set(identifier, value);
1252
- }
1253
- clear() {
1254
- this.kv.clear();
1255
- }
1256
- getIdentifier(value) {
1257
- return this.kv.getByValue(value);
1258
- }
1259
- getValue(identifier) {
1260
- return this.kv.getByKey(identifier);
1261
- }
1262
- };
1263
-
1264
- // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.js
1265
- var ClassRegistry = class extends Registry {
1266
- static {
1267
- __name(this, "ClassRegistry");
1268
- }
1269
- constructor() {
1270
- super((c2) => c2.name);
1271
- this.classToAllowedProps = /* @__PURE__ */ new Map();
1272
- }
1273
- register(value, options) {
1274
- if (typeof options === "object") {
1275
- if (options.allowProps) {
1276
- this.classToAllowedProps.set(value, options.allowProps);
1277
- }
1278
- super.register(value, options.identifier);
1279
- } else {
1280
- super.register(value, options);
1281
- }
1282
- }
1283
- getAllowedProps(value) {
1284
- return this.classToAllowedProps.get(value);
1285
- }
1286
- };
1287
-
1288
- // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.js
1289
- init_esm_shims();
1290
-
1291
- // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/util.js
1292
- init_esm_shims();
1293
- function valuesOfObj(record) {
1294
- if ("values" in Object) {
1295
- return Object.values(record);
1296
- }
1297
- const values = [];
1298
- for (const key in record) {
1299
- if (record.hasOwnProperty(key)) {
1300
- values.push(record[key]);
1301
- }
1302
- }
1303
- return values;
1304
- }
1305
- __name(valuesOfObj, "valuesOfObj");
1306
- function find(record, predicate) {
1307
- const values = valuesOfObj(record);
1308
- if ("find" in values) {
1309
- return values.find(predicate);
1310
- }
1311
- const valuesNotNever = values;
1312
- for (let i3 = 0; i3 < valuesNotNever.length; i3++) {
1313
- const value = valuesNotNever[i3];
1314
- if (predicate(value)) {
1315
- return value;
1316
- }
1317
- }
1318
- return void 0;
1319
- }
1320
- __name(find, "find");
1321
- function forEach(record, run) {
1322
- Object.entries(record).forEach(([key, value]) => run(value, key));
1323
- }
1324
- __name(forEach, "forEach");
1325
- function includes(arr, value) {
1326
- return arr.indexOf(value) !== -1;
1327
- }
1328
- __name(includes, "includes");
1329
- function findArr(record, predicate) {
1330
- for (let i3 = 0; i3 < record.length; i3++) {
1331
- const value = record[i3];
1332
- if (predicate(value)) {
1333
- return value;
1334
- }
1335
- }
1336
- return void 0;
1337
- }
1338
- __name(findArr, "findArr");
1339
-
1340
- // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.js
1341
- var CustomTransformerRegistry = class {
1342
- static {
1343
- __name(this, "CustomTransformerRegistry");
1344
- }
1345
- constructor() {
1346
- this.transfomers = {};
1347
- }
1348
- register(transformer) {
1349
- this.transfomers[transformer.name] = transformer;
1350
- }
1351
- findApplicable(v) {
1352
- return find(this.transfomers, (transformer) => transformer.isApplicable(v));
1353
- }
1354
- findByName(name) {
1355
- return this.transfomers[name];
1356
- }
1357
- };
1358
-
1359
- // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.js
1360
- init_esm_shims();
1361
-
1362
- // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.js
1363
- init_esm_shims();
1364
- var getType = /* @__PURE__ */ __name((payload) => Object.prototype.toString.call(payload).slice(8, -1), "getType");
1365
- var isUndefined = /* @__PURE__ */ __name((payload) => typeof payload === "undefined", "isUndefined");
1366
- var isNull = /* @__PURE__ */ __name((payload) => payload === null, "isNull");
1367
- var isPlainObject = /* @__PURE__ */ __name((payload) => {
1368
- if (typeof payload !== "object" || payload === null) return false;
1369
- if (payload === Object.prototype) return false;
1370
- if (Object.getPrototypeOf(payload) === null) return true;
1371
- return Object.getPrototypeOf(payload) === Object.prototype;
1372
- }, "isPlainObject");
1373
- var isEmptyObject = /* @__PURE__ */ __name((payload) => isPlainObject(payload) && Object.keys(payload).length === 0, "isEmptyObject");
1374
- var isArray = /* @__PURE__ */ __name((payload) => Array.isArray(payload), "isArray");
1375
- var isString = /* @__PURE__ */ __name((payload) => typeof payload === "string", "isString");
1376
- var isNumber = /* @__PURE__ */ __name((payload) => typeof payload === "number" && !isNaN(payload), "isNumber");
1377
- var isBoolean = /* @__PURE__ */ __name((payload) => typeof payload === "boolean", "isBoolean");
1378
- var isRegExp = /* @__PURE__ */ __name((payload) => payload instanceof RegExp, "isRegExp");
1379
- var isMap = /* @__PURE__ */ __name((payload) => payload instanceof Map, "isMap");
1380
- var isSet = /* @__PURE__ */ __name((payload) => payload instanceof Set, "isSet");
1381
- var isSymbol = /* @__PURE__ */ __name((payload) => getType(payload) === "Symbol", "isSymbol");
1382
- var isDate = /* @__PURE__ */ __name((payload) => payload instanceof Date && !isNaN(payload.valueOf()), "isDate");
1383
- var isError = /* @__PURE__ */ __name((payload) => payload instanceof Error, "isError");
1384
- var isNaNValue = /* @__PURE__ */ __name((payload) => typeof payload === "number" && isNaN(payload), "isNaNValue");
1385
- var isPrimitive = /* @__PURE__ */ __name((payload) => isBoolean(payload) || isNull(payload) || isUndefined(payload) || isNumber(payload) || isString(payload) || isSymbol(payload), "isPrimitive");
1386
- var isBigint = /* @__PURE__ */ __name((payload) => typeof payload === "bigint", "isBigint");
1387
- var isInfinite = /* @__PURE__ */ __name((payload) => payload === Infinity || payload === -Infinity, "isInfinite");
1388
- var isTypedArray = /* @__PURE__ */ __name((payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView), "isTypedArray");
1389
- var isURL = /* @__PURE__ */ __name((payload) => payload instanceof URL, "isURL");
1390
-
1391
- // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.js
1392
- init_esm_shims();
1393
- var escapeKey = /* @__PURE__ */ __name((key) => key.replace(/\./g, "\\."), "escapeKey");
1394
- var stringifyPath = /* @__PURE__ */ __name((path) => path.map(String).map(escapeKey).join("."), "stringifyPath");
1395
- var parsePath = /* @__PURE__ */ __name((string) => {
1396
- const result = [];
1397
- let segment = "";
1398
- for (let i3 = 0; i3 < string.length; i3++) {
1399
- let char = string.charAt(i3);
1400
- const isEscapedDot = char === "\\" && string.charAt(i3 + 1) === ".";
1401
- if (isEscapedDot) {
1402
- segment += ".";
1403
- i3++;
1404
- continue;
1405
- }
1406
- const isEndOfSegment = char === ".";
1407
- if (isEndOfSegment) {
1408
- result.push(segment);
1409
- segment = "";
1410
- continue;
1411
- }
1412
- segment += char;
1413
- }
1414
- const lastSegment = segment;
1415
- result.push(lastSegment);
1416
- return result;
1417
- }, "parsePath");
1418
-
1419
- // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/transformer.js
1420
- init_esm_shims();
1421
- function simpleTransformation(isApplicable, annotation, transform, untransform) {
1422
- return {
1423
- isApplicable,
1424
- annotation,
1425
- transform,
1426
- untransform
1427
- };
1428
- }
1429
- __name(simpleTransformation, "simpleTransformation");
1430
- var simpleRules = [
1431
- simpleTransformation(isUndefined, "undefined", () => null, () => void 0),
1432
- simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
1433
- if (typeof BigInt !== "undefined") {
1434
- return BigInt(v);
1435
- }
1436
- console.error("Please add a BigInt polyfill.");
1437
- return v;
1438
- }),
1439
- simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
1440
- simpleTransformation(isError, "Error", (v, superJson) => {
1441
- const baseError = {
1442
- name: v.name,
1443
- message: v.message
1444
- };
1445
- superJson.allowedErrorProps.forEach((prop) => {
1446
- baseError[prop] = v[prop];
1447
- });
1448
- return baseError;
1449
- }, (v, superJson) => {
1450
- const e7 = new Error(v.message);
1451
- e7.name = v.name;
1452
- e7.stack = v.stack;
1453
- superJson.allowedErrorProps.forEach((prop) => {
1454
- e7[prop] = v[prop];
1455
- });
1456
- return e7;
1457
- }),
1458
- simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
1459
- const body = regex.slice(1, regex.lastIndexOf("/"));
1460
- const flags = regex.slice(regex.lastIndexOf("/") + 1);
1461
- return new RegExp(body, flags);
1462
- }),
1463
- simpleTransformation(
1464
- isSet,
1465
- "set",
1466
- // (sets only exist in es6+)
1467
- // eslint-disable-next-line es5/no-es6-methods
1468
- (v) => [
1469
- ...v.values()
1470
- ],
1471
- (v) => new Set(v)
1472
- ),
1473
- simpleTransformation(isMap, "map", (v) => [
1474
- ...v.entries()
1475
- ], (v) => new Map(v)),
1476
- simpleTransformation((v) => isNaNValue(v) || isInfinite(v), "number", (v) => {
1477
- if (isNaNValue(v)) {
1478
- return "NaN";
1479
- }
1480
- if (v > 0) {
1481
- return "Infinity";
1482
- } else {
1483
- return "-Infinity";
1484
- }
1485
- }, Number),
1486
- simpleTransformation((v) => v === 0 && 1 / v === -Infinity, "number", () => {
1487
- return "-0";
1488
- }, Number),
1489
- simpleTransformation(isURL, "URL", (v) => v.toString(), (v) => new URL(v))
1490
- ];
1491
- function compositeTransformation(isApplicable, annotation, transform, untransform) {
1492
- return {
1493
- isApplicable,
1494
- annotation,
1495
- transform,
1496
- untransform
1497
- };
1498
- }
1499
- __name(compositeTransformation, "compositeTransformation");
1500
- var symbolRule = compositeTransformation((s, superJson) => {
1501
- if (isSymbol(s)) {
1502
- const isRegistered = !!superJson.symbolRegistry.getIdentifier(s);
1503
- return isRegistered;
1504
- }
1505
- return false;
1506
- }, (s, superJson) => {
1507
- const identifier = superJson.symbolRegistry.getIdentifier(s);
1508
- return [
1509
- "symbol",
1510
- identifier
1511
- ];
1512
- }, (v) => v.description, (_, a3, superJson) => {
1513
- const value = superJson.symbolRegistry.getValue(a3[1]);
1514
- if (!value) {
1515
- throw new Error("Trying to deserialize unknown symbol");
1516
- }
1517
- return value;
1518
- });
1519
- var constructorToName = [
1520
- Int8Array,
1521
- Uint8Array,
1522
- Int16Array,
1523
- Uint16Array,
1524
- Int32Array,
1525
- Uint32Array,
1526
- Float32Array,
1527
- Float64Array,
1528
- Uint8ClampedArray
1529
- ].reduce((obj, ctor) => {
1530
- obj[ctor.name] = ctor;
1531
- return obj;
1532
- }, {});
1533
- var typedArrayRule = compositeTransformation(isTypedArray, (v) => [
1534
- "typed-array",
1535
- v.constructor.name
1536
- ], (v) => [
1537
- ...v
1538
- ], (v, a3) => {
1539
- const ctor = constructorToName[a3[1]];
1540
- if (!ctor) {
1541
- throw new Error("Trying to deserialize unknown typed array");
1542
- }
1543
- return new ctor(v);
1544
- });
1545
- function isInstanceOfRegisteredClass(potentialClass, superJson) {
1546
- if (potentialClass?.constructor) {
1547
- const isRegistered = !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
1548
- return isRegistered;
1549
- }
1550
- return false;
1551
- }
1552
- __name(isInstanceOfRegisteredClass, "isInstanceOfRegisteredClass");
1553
- var classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
1554
- const identifier = superJson.classRegistry.getIdentifier(clazz.constructor);
1555
- return [
1556
- "class",
1557
- identifier
1558
- ];
1559
- }, (clazz, superJson) => {
1560
- const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
1561
- if (!allowedProps) {
1562
- return {
1563
- ...clazz
1564
- };
1565
- }
1566
- const result = {};
1567
- allowedProps.forEach((prop) => {
1568
- result[prop] = clazz[prop];
1569
- });
1570
- return result;
1571
- }, (v, a3, superJson) => {
1572
- const clazz = superJson.classRegistry.getValue(a3[1]);
1573
- if (!clazz) {
1574
- throw new Error(`Trying to deserialize unknown class '${a3[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
1575
- }
1576
- return Object.assign(Object.create(clazz.prototype), v);
1577
- });
1578
- var customRule = compositeTransformation((value, superJson) => {
1579
- return !!superJson.customTransformerRegistry.findApplicable(value);
1580
- }, (value, superJson) => {
1581
- const transformer = superJson.customTransformerRegistry.findApplicable(value);
1582
- return [
1583
- "custom",
1584
- transformer.name
1585
- ];
1586
- }, (value, superJson) => {
1587
- const transformer = superJson.customTransformerRegistry.findApplicable(value);
1588
- return transformer.serialize(value);
1589
- }, (v, a3, superJson) => {
1590
- const transformer = superJson.customTransformerRegistry.findByName(a3[1]);
1591
- if (!transformer) {
1592
- throw new Error("Trying to deserialize unknown custom value");
1593
- }
1594
- return transformer.deserialize(v);
1595
- });
1596
- var compositeRules = [
1597
- classRule,
1598
- symbolRule,
1599
- customRule,
1600
- typedArrayRule
1601
- ];
1602
- var transformValue = /* @__PURE__ */ __name((value, superJson) => {
1603
- const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
1604
- if (applicableCompositeRule) {
1605
- return {
1606
- value: applicableCompositeRule.transform(value, superJson),
1607
- type: applicableCompositeRule.annotation(value, superJson)
1608
- };
1609
- }
1610
- const applicableSimpleRule = findArr(simpleRules, (rule) => rule.isApplicable(value, superJson));
1611
- if (applicableSimpleRule) {
1612
- return {
1613
- value: applicableSimpleRule.transform(value, superJson),
1614
- type: applicableSimpleRule.annotation
1615
- };
1616
- }
1617
- return void 0;
1618
- }, "transformValue");
1619
- var simpleRulesByAnnotation = {};
1620
- simpleRules.forEach((rule) => {
1621
- simpleRulesByAnnotation[rule.annotation] = rule;
1622
- });
1623
- var untransformValue = /* @__PURE__ */ __name((json, type, superJson) => {
1624
- if (isArray(type)) {
1625
- switch (type[0]) {
1626
- case "symbol":
1627
- return symbolRule.untransform(json, type, superJson);
1628
- case "class":
1629
- return classRule.untransform(json, type, superJson);
1630
- case "custom":
1631
- return customRule.untransform(json, type, superJson);
1632
- case "typed-array":
1633
- return typedArrayRule.untransform(json, type, superJson);
1634
- default:
1635
- throw new Error("Unknown transformation: " + type);
1636
- }
1637
- } else {
1638
- const transformation = simpleRulesByAnnotation[type];
1639
- if (!transformation) {
1640
- throw new Error("Unknown transformation: " + type);
1641
- }
1642
- return transformation.untransform(json, superJson);
1643
- }
1644
- }, "untransformValue");
1645
-
1646
- // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.js
1647
- init_esm_shims();
1648
- var getNthKey = /* @__PURE__ */ __name((value, n6) => {
1649
- if (n6 > value.size) throw new Error("index out of bounds");
1650
- const keys = value.keys();
1651
- while (n6 > 0) {
1652
- keys.next();
1653
- n6--;
1654
- }
1655
- return keys.next().value;
1656
- }, "getNthKey");
1657
- function validatePath(path) {
1658
- if (includes(path, "__proto__")) {
1659
- throw new Error("__proto__ is not allowed as a property");
1660
- }
1661
- if (includes(path, "prototype")) {
1662
- throw new Error("prototype is not allowed as a property");
1663
- }
1664
- if (includes(path, "constructor")) {
1665
- throw new Error("constructor is not allowed as a property");
1666
- }
1667
- }
1668
- __name(validatePath, "validatePath");
1669
- var getDeep = /* @__PURE__ */ __name((object, path) => {
1670
- validatePath(path);
1671
- for (let i3 = 0; i3 < path.length; i3++) {
1672
- const key = path[i3];
1673
- if (isSet(object)) {
1674
- object = getNthKey(object, +key);
1675
- } else if (isMap(object)) {
1676
- const row = +key;
1677
- const type = +path[++i3] === 0 ? "key" : "value";
1678
- const keyOfRow = getNthKey(object, row);
1679
- switch (type) {
1680
- case "key":
1681
- object = keyOfRow;
1682
- break;
1683
- case "value":
1684
- object = object.get(keyOfRow);
1685
- break;
1686
- }
1687
- } else {
1688
- object = object[key];
1689
- }
1690
- }
1691
- return object;
1692
- }, "getDeep");
1693
- var setDeep = /* @__PURE__ */ __name((object, path, mapper) => {
1694
- validatePath(path);
1695
- if (path.length === 0) {
1696
- return mapper(object);
1697
- }
1698
- let parent = object;
1699
- for (let i3 = 0; i3 < path.length - 1; i3++) {
1700
- const key = path[i3];
1701
- if (isArray(parent)) {
1702
- const index = +key;
1703
- parent = parent[index];
1704
- } else if (isPlainObject(parent)) {
1705
- parent = parent[key];
1706
- } else if (isSet(parent)) {
1707
- const row = +key;
1708
- parent = getNthKey(parent, row);
1709
- } else if (isMap(parent)) {
1710
- const isEnd = i3 === path.length - 2;
1711
- if (isEnd) {
1712
- break;
1713
- }
1714
- const row = +key;
1715
- const type = +path[++i3] === 0 ? "key" : "value";
1716
- const keyOfRow = getNthKey(parent, row);
1717
- switch (type) {
1718
- case "key":
1719
- parent = keyOfRow;
1720
- break;
1721
- case "value":
1722
- parent = parent.get(keyOfRow);
1723
- break;
1724
- }
1725
- }
1726
- }
1727
- const lastKey = path[path.length - 1];
1728
- if (isArray(parent)) {
1729
- parent[+lastKey] = mapper(parent[+lastKey]);
1730
- } else if (isPlainObject(parent)) {
1731
- parent[lastKey] = mapper(parent[lastKey]);
1732
- }
1733
- if (isSet(parent)) {
1734
- const oldValue = getNthKey(parent, +lastKey);
1735
- const newValue = mapper(oldValue);
1736
- if (oldValue !== newValue) {
1737
- parent.delete(oldValue);
1738
- parent.add(newValue);
1739
- }
1740
- }
1741
- if (isMap(parent)) {
1742
- const row = +path[path.length - 2];
1743
- const keyToRow = getNthKey(parent, row);
1744
- const type = +lastKey === 0 ? "key" : "value";
1745
- switch (type) {
1746
- case "key": {
1747
- const newKey = mapper(keyToRow);
1748
- parent.set(newKey, parent.get(keyToRow));
1749
- if (newKey !== keyToRow) {
1750
- parent.delete(keyToRow);
1751
- }
1752
- break;
1753
- }
1754
- case "value": {
1755
- parent.set(keyToRow, mapper(parent.get(keyToRow)));
1756
- break;
1757
- }
1758
- }
1759
- }
1760
- return object;
1761
- }, "setDeep");
1762
-
1763
- // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.js
1764
- function traverse(tree, walker2, origin = []) {
1765
- if (!tree) {
1766
- return;
1767
- }
1768
- if (!isArray(tree)) {
1769
- forEach(tree, (subtree, key) => traverse(subtree, walker2, [
1770
- ...origin,
1771
- ...parsePath(key)
1772
- ]));
1773
- return;
1774
- }
1775
- const [nodeValue, children] = tree;
1776
- if (children) {
1777
- forEach(children, (child, key) => {
1778
- traverse(child, walker2, [
1779
- ...origin,
1780
- ...parsePath(key)
1781
- ]);
1782
- });
1783
- }
1784
- walker2(nodeValue, origin);
1785
- }
1786
- __name(traverse, "traverse");
1787
- function applyValueAnnotations(plain, annotations, superJson) {
1788
- traverse(annotations, (type, path) => {
1789
- plain = setDeep(plain, path, (v) => untransformValue(v, type, superJson));
1790
- });
1791
- return plain;
1792
- }
1793
- __name(applyValueAnnotations, "applyValueAnnotations");
1794
- function applyReferentialEqualityAnnotations(plain, annotations) {
1795
- function apply(identicalPaths, path) {
1796
- const object = getDeep(plain, parsePath(path));
1797
- identicalPaths.map(parsePath).forEach((identicalObjectPath) => {
1798
- plain = setDeep(plain, identicalObjectPath, () => object);
1799
- });
1800
- }
1801
- __name(apply, "apply");
1802
- if (isArray(annotations)) {
1803
- const [root, other] = annotations;
1804
- root.forEach((identicalPath) => {
1805
- plain = setDeep(plain, parsePath(identicalPath), () => plain);
1806
- });
1807
- if (other) {
1808
- forEach(other, apply);
1809
- }
1810
- } else {
1811
- forEach(annotations, apply);
1812
- }
1813
- return plain;
1814
- }
1815
- __name(applyReferentialEqualityAnnotations, "applyReferentialEqualityAnnotations");
1816
- var isDeep = /* @__PURE__ */ __name((object, superJson) => isPlainObject(object) || isArray(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson), "isDeep");
1817
- function addIdentity(object, path, identities) {
1818
- const existingSet = identities.get(object);
1819
- if (existingSet) {
1820
- existingSet.push(path);
1821
- } else {
1822
- identities.set(object, [
1823
- path
1824
- ]);
1825
- }
1826
- }
1827
- __name(addIdentity, "addIdentity");
1828
- function generateReferentialEqualityAnnotations(identitites, dedupe) {
1829
- const result = {};
1830
- let rootEqualityPaths = void 0;
1831
- identitites.forEach((paths) => {
1832
- if (paths.length <= 1) {
1833
- return;
1834
- }
1835
- if (!dedupe) {
1836
- paths = paths.map((path) => path.map(String)).sort((a3, b) => a3.length - b.length);
1837
- }
1838
- const [representativePath, ...identicalPaths] = paths;
1839
- if (representativePath.length === 0) {
1840
- rootEqualityPaths = identicalPaths.map(stringifyPath);
1841
- } else {
1842
- result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
1843
- }
1844
- });
1845
- if (rootEqualityPaths) {
1846
- if (isEmptyObject(result)) {
1847
- return [
1848
- rootEqualityPaths
1849
- ];
1850
- } else {
1851
- return [
1852
- rootEqualityPaths,
1853
- result
1854
- ];
1855
- }
1856
- } else {
1857
- return isEmptyObject(result) ? void 0 : result;
1858
- }
1859
- }
1860
- __name(generateReferentialEqualityAnnotations, "generateReferentialEqualityAnnotations");
1861
- var walker = /* @__PURE__ */ __name((object, identities, superJson, dedupe, path = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
1862
- const primitive = isPrimitive(object);
1863
- if (!primitive) {
1864
- addIdentity(object, path, identities);
1865
- const seen = seenObjects.get(object);
1866
- if (seen) {
1867
- return dedupe ? {
1868
- transformedValue: null
1869
- } : seen;
1870
- }
1871
- }
1872
- if (!isDeep(object, superJson)) {
1873
- const transformed2 = transformValue(object, superJson);
1874
- const result2 = transformed2 ? {
1875
- transformedValue: transformed2.value,
1876
- annotations: [
1877
- transformed2.type
1878
- ]
1879
- } : {
1880
- transformedValue: object
1881
- };
1882
- if (!primitive) {
1883
- seenObjects.set(object, result2);
1884
- }
1885
- return result2;
1886
- }
1887
- if (includes(objectsInThisPath, object)) {
1888
- return {
1889
- transformedValue: null
1890
- };
1891
- }
1892
- const transformationResult = transformValue(object, superJson);
1893
- const transformed = transformationResult?.value ?? object;
1894
- const transformedValue = isArray(transformed) ? [] : {};
1895
- const innerAnnotations = {};
1896
- forEach(transformed, (value, index) => {
1897
- if (index === "__proto__" || index === "constructor" || index === "prototype") {
1898
- throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
1899
- }
1900
- const recursiveResult = walker(value, identities, superJson, dedupe, [
1901
- ...path,
1902
- index
1903
- ], [
1904
- ...objectsInThisPath,
1905
- object
1906
- ], seenObjects);
1907
- transformedValue[index] = recursiveResult.transformedValue;
1908
- if (isArray(recursiveResult.annotations)) {
1909
- innerAnnotations[index] = recursiveResult.annotations;
1910
- } else if (isPlainObject(recursiveResult.annotations)) {
1911
- forEach(recursiveResult.annotations, (tree, key) => {
1912
- innerAnnotations[escapeKey(index) + "." + key] = tree;
1913
- });
1914
- }
1915
- });
1916
- const result = isEmptyObject(innerAnnotations) ? {
1917
- transformedValue,
1918
- annotations: !!transformationResult ? [
1919
- transformationResult.type
1920
- ] : void 0
1921
- } : {
1922
- transformedValue,
1923
- annotations: !!transformationResult ? [
1924
- transformationResult.type,
1925
- innerAnnotations
1926
- ] : innerAnnotations
1927
- };
1928
- if (!primitive) {
1929
- seenObjects.set(object, result);
1930
- }
1931
- return result;
1932
- }, "walker");
1933
-
1934
- // ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
1935
- init_esm_shims();
1936
-
1937
- // ../../node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.js
1938
- init_esm_shims();
1939
- function getType2(payload) {
1940
- return Object.prototype.toString.call(payload).slice(8, -1);
1941
- }
1942
- __name(getType2, "getType");
1943
- function isArray2(payload) {
1944
- return getType2(payload) === "Array";
1945
- }
1946
- __name(isArray2, "isArray");
1947
- function isPlainObject2(payload) {
1948
- if (getType2(payload) !== "Object") return false;
1949
- const prototype = Object.getPrototypeOf(payload);
1950
- return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
1951
- }
1952
- __name(isPlainObject2, "isPlainObject");
1953
- function isNull2(payload) {
1954
- return getType2(payload) === "Null";
1955
- }
1956
- __name(isNull2, "isNull");
1957
- function isOneOf(a3, b, c2, d, e7) {
1958
- return (value) => a3(value) || b(value) || !!c2 && c2(value) || !!d && d(value) || !!e7 && e7(value);
1959
- }
1960
- __name(isOneOf, "isOneOf");
1961
- function isUndefined2(payload) {
1962
- return getType2(payload) === "Undefined";
1963
- }
1964
- __name(isUndefined2, "isUndefined");
1965
-
1966
- // ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
1967
- function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
1968
- const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
1969
- if (propType === "enumerable") carry[key] = newVal;
1970
- if (includeNonenumerable && propType === "nonenumerable") {
1971
- Object.defineProperty(carry, key, {
1972
- value: newVal,
1973
- enumerable: false,
1974
- writable: true,
1975
- configurable: true
1976
- });
1977
- }
1978
- }
1979
- __name(assignProp, "assignProp");
1980
- function copy(target, options = {}) {
1981
- if (isArray2(target)) {
1982
- return target.map((item) => copy(item, options));
1983
- }
1984
- if (!isPlainObject2(target)) {
1985
- return target;
1986
- }
1987
- const props = Object.getOwnPropertyNames(target);
1988
- const symbols = Object.getOwnPropertySymbols(target);
1989
- return [
1990
- ...props,
1991
- ...symbols
1992
- ].reduce((carry, key) => {
1993
- if (isArray2(options.props) && !options.props.includes(key)) {
1994
- return carry;
1995
- }
1996
- const val = target[key];
1997
- const newVal = copy(val, options);
1998
- assignProp(carry, key, newVal, target, options.nonenumerable);
1999
- return carry;
2000
- }, {});
2001
- }
2002
- __name(copy, "copy");
2003
-
2004
- // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.js
2005
- var SuperJSON = class {
2006
- static {
2007
- __name(this, "SuperJSON");
2008
- }
2009
- /**
2010
- * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
2011
- */
2012
- constructor({ dedupe = false } = {}) {
2013
- this.classRegistry = new ClassRegistry();
2014
- this.symbolRegistry = new Registry((s) => s.description ?? "");
2015
- this.customTransformerRegistry = new CustomTransformerRegistry();
2016
- this.allowedErrorProps = [];
2017
- this.dedupe = dedupe;
2018
- }
2019
- serialize(object) {
2020
- const identities = /* @__PURE__ */ new Map();
2021
- const output = walker(object, identities, this, this.dedupe);
2022
- const res = {
2023
- json: output.transformedValue
2024
- };
2025
- if (output.annotations) {
2026
- res.meta = {
2027
- ...res.meta,
2028
- values: output.annotations
2029
- };
2030
- }
2031
- const equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
2032
- if (equalityAnnotations) {
2033
- res.meta = {
2034
- ...res.meta,
2035
- referentialEqualities: equalityAnnotations
2036
- };
2037
- }
2038
- return res;
2039
- }
2040
- deserialize(payload) {
2041
- const { json, meta } = payload;
2042
- let result = copy(json);
2043
- if (meta?.values) {
2044
- result = applyValueAnnotations(result, meta.values, this);
2045
- }
2046
- if (meta?.referentialEqualities) {
2047
- result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
2048
- }
2049
- return result;
2050
- }
2051
- stringify(object) {
2052
- return JSON.stringify(this.serialize(object));
2053
- }
2054
- parse(string) {
2055
- return this.deserialize(JSON.parse(string));
2056
- }
2057
- registerClass(v, options) {
2058
- this.classRegistry.register(v, options);
2059
- }
2060
- registerSymbol(v, identifier) {
2061
- this.symbolRegistry.register(v, identifier);
2062
- }
2063
- registerCustom(transformer, name) {
2064
- this.customTransformerRegistry.register({
2065
- name,
2066
- ...transformer
2067
- });
2068
- }
2069
- allowErrorProps(...props) {
2070
- this.allowedErrorProps.push(...props);
2071
- }
2072
- };
2073
- SuperJSON.defaultInstance = new SuperJSON();
2074
- SuperJSON.serialize = SuperJSON.defaultInstance.serialize.bind(SuperJSON.defaultInstance);
2075
- SuperJSON.deserialize = SuperJSON.defaultInstance.deserialize.bind(SuperJSON.defaultInstance);
2076
- SuperJSON.stringify = SuperJSON.defaultInstance.stringify.bind(SuperJSON.defaultInstance);
2077
- SuperJSON.parse = SuperJSON.defaultInstance.parse.bind(SuperJSON.defaultInstance);
2078
- SuperJSON.registerClass = SuperJSON.defaultInstance.registerClass.bind(SuperJSON.defaultInstance);
2079
- SuperJSON.registerSymbol = SuperJSON.defaultInstance.registerSymbol.bind(SuperJSON.defaultInstance);
2080
- SuperJSON.registerCustom = SuperJSON.defaultInstance.registerCustom.bind(SuperJSON.defaultInstance);
2081
- SuperJSON.allowErrorProps = SuperJSON.defaultInstance.allowErrorProps.bind(SuperJSON.defaultInstance);
2082
- SuperJSON.serialize;
2083
- SuperJSON.deserialize;
2084
- SuperJSON.stringify;
2085
- SuperJSON.parse;
2086
- SuperJSON.registerClass;
2087
- SuperJSON.registerCustom;
2088
- SuperJSON.registerSymbol;
2089
- SuperJSON.allowErrorProps;
2090
-
2091
- // ../../node_modules/.pnpm/@stryke+json@0.9.32/node_modules/@stryke/json/dist/storm-json.mjs
2092
- var c = class o3 extends SuperJSON {
2093
- static {
2094
- __name(this, "o");
2095
- }
2096
- static #e;
2097
- static get instance() {
2098
- return o3.#e ||= new o3(), o3.#e;
2099
- }
2100
- static deserialize(e7) {
2101
- return o3.instance.deserialize(e7);
2102
- }
2103
- static serialize(e7) {
2104
- return o3.instance.serialize(e7);
2105
- }
2106
- static parse(e7) {
2107
- return a2(e7);
2108
- }
2109
- static stringify(e7, t7) {
2110
- let n6 = o3.instance.customTransformerRegistry.findApplicable(e7), r5 = e7;
2111
- return n6 && n6.isApplicable(e7) && (r5 = n6.serialize(r5)), r4(r5);
2112
- }
2113
- static parseJson(e7, t7) {
2114
- try {
2115
- if (t7?.expectComments === false) return o3.instance.parse(e7);
2116
- } catch {
2117
- }
2118
- let n6 = [], i3 = parse2(e7, n6, { allowTrailingComma: true, ...t7 });
2119
- if (n6.length > 0 && n6[0]) throw Error(r3(e7, n6[0]));
2120
- return i3;
2121
- }
2122
- static register(e7, t7, n6, r5) {
2123
- o3.instance.registerCustom({ isApplicable: r5, serialize: t7, deserialize: n6 }, e7);
2124
- }
2125
- static registerClass(n6, r5) {
2126
- o3.instance.registerClass(n6, { identifier: e2(r5) ? r5 : r5?.identifier || n6.name, allowProps: r5 && t3(r5) && r5?.allowProps && Array.isArray(r5.allowProps) ? r5.allowProps : [`__typename`] });
2127
- }
2128
- constructor() {
2129
- super({ dedupe: true });
2130
- }
2131
- };
2132
- c.instance.registerCustom({ isApplicable: /* @__PURE__ */ __name((e7) => Buffer.isBuffer(e7), "isApplicable"), serialize: /* @__PURE__ */ __name((e7) => e7.toString(`base64`), "serialize"), deserialize: /* @__PURE__ */ __name((e7) => Buffer.from(e7, `base64`), "deserialize") }, `Bytes`);
2133
- function stringifyDefaultValue(property, value) {
2134
- return stringifyValue(property.type, value ?? property.getDefaultValue());
2135
- }
2136
- __name(stringifyDefaultValue, "stringifyDefaultValue");
2137
- function stringifyStringValue(value) {
2138
- return `"${String(value).replaceAll('"', '\\"')}"`;
2139
- }
2140
- __name(stringifyStringValue, "stringifyStringValue");
2141
- function stringifyValue(type, value) {
2142
- return isUndefined$1(value) ? "undefined" : isNull$1(value) ? "null" : type.kind === ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type.kind === ReflectionKind.string || type.kind === ReflectionKind.literal && isString$1(type.literal) ? stringifyStringValue(value) : type.kind === ReflectionKind.enum ? getEnumReflectionType(type).kind === ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.union ? isStringUnion(type) ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.array ? stringifyStringValue(c.stringify(value)) : type.kind === ReflectionKind.object || type.kind === ReflectionKind.objectLiteral ? c.stringify(value) : type.kind === ReflectionKind.property || type.kind === ReflectionKind.parameter ? stringifyValue(type.type, value) : String(value);
2143
- }
2144
- __name(stringifyValue, "stringifyValue");
2145
- function getEnumReflectionType(type) {
2146
- if (type.kind !== ReflectionKind.enum) {
2147
- throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);
2148
- }
2149
- const unique = t(type.values.filter((value) => value !== void 0 && value !== null), (enumMember) => isString$1(enumMember) ? {
2150
- kind: ReflectionKind.string
2151
- } : {
2152
- kind: ReflectionKind.number
2153
- });
2154
- if (unique.length === 0) {
2155
- throw new Error(`No valid enum members could be found.`);
2156
- }
2157
- return unique[0] && isString$1(unique[0]) ? {
2158
- kind: ReflectionKind.string
2159
- } : {
2160
- kind: ReflectionKind.number
2161
- };
2162
- }
2163
- __name(getEnumReflectionType, "getEnumReflectionType");
2164
- function getUnionTypes(type) {
2165
- if (type.kind === ReflectionKind.union && type.types.length > 0) {
2166
- return t(type.types, (member) => member.kind);
2167
- }
2168
- throw new Error(`Expected a TypeUnion, but received ${type.kind}.`);
2169
- }
2170
- __name(getUnionTypes, "getUnionTypes");
2171
- function isStringUnion(type) {
2172
- return getUnionTypes(type).some((member) => member.kind === ReflectionKind.string || member.kind === ReflectionKind.literal && isString$1(member.literal));
2173
- }
2174
- __name(isStringUnion, "isStringUnion");
2175
- function kindToName(kind) {
2176
- if (kind === ReflectionKind.void) {
2177
- return "void";
2178
- } else if (kind === ReflectionKind.never) {
2179
- return "never";
2180
- } else if (kind === ReflectionKind.null) {
2181
- return "null";
2182
- } else if (kind === ReflectionKind.undefined) {
2183
- return "undefined";
2184
- } else if (kind === ReflectionKind.symbol) {
2185
- return "symbol";
2186
- } else if (kind === ReflectionKind.bigint) {
2187
- return "bigint";
2188
- } else if (kind === ReflectionKind.number) {
2189
- return "number";
2190
- } else if (kind === ReflectionKind.string) {
2191
- return "string";
2192
- } else if (kind === ReflectionKind.boolean) {
2193
- return "boolean";
2194
- } else if (kind === ReflectionKind.literal) {
2195
- return "literal";
2196
- } else if (kind === ReflectionKind.class) {
2197
- return "class";
2198
- } else if (kind === ReflectionKind.array) {
2199
- return "array";
2200
- } else if (kind === ReflectionKind.object) {
2201
- return "object";
2202
- } else if (kind === ReflectionKind.objectLiteral) {
2203
- return "objectLiteral";
2204
- } else if (kind === ReflectionKind.union) {
2205
- return "union";
2206
- } else if (kind === ReflectionKind.enum) {
2207
- return "enum";
2208
- } else if (kind === ReflectionKind.regexp) {
2209
- return "regexp";
2210
- } else if (kind === ReflectionKind.templateLiteral) {
2211
- return "templateLiteral";
2212
- } else if (kind === ReflectionKind.property) {
2213
- return "property";
2214
- } else if (kind === ReflectionKind.method) {
2215
- return "method";
2216
- } else if (kind === ReflectionKind.function) {
2217
- return "function";
2218
- } else if (kind === ReflectionKind.parameter) {
2219
- return "parameter";
2220
- } else if (kind === ReflectionKind.promise) {
2221
- return "promise";
2222
- } else if (kind === ReflectionKind.typeParameter) {
2223
- return "typeParameter";
2224
- } else if (kind === ReflectionKind.tuple) {
2225
- return "tuple";
2226
- } else if (kind === ReflectionKind.tupleMember) {
2227
- return "tupleMember";
2228
- } else if (kind === ReflectionKind.enumMember) {
2229
- return "enumMember";
2230
- } else if (kind === ReflectionKind.rest) {
2231
- return "rest";
2232
- } else if (kind === ReflectionKind.indexSignature) {
2233
- return "indexSignature";
2234
- } else if (kind === ReflectionKind.propertySignature) {
2235
- return "propertySignature";
2236
- } else if (kind === ReflectionKind.methodSignature) {
2237
- return "methodSignature";
2238
- } else if (kind === ReflectionKind.infer) {
2239
- return "infer";
2240
- } else if (kind === ReflectionKind.callSignature) {
2241
- return "callSignature";
2242
- } else if (kind === ReflectionKind.any) {
2243
- return "any";
2244
- } else if (kind === ReflectionKind.intersection) {
2245
- return "intersection";
2246
- }
2247
- return "unknown";
2248
- }
2249
- __name(kindToName, "kindToName");
2250
-
2251
- export { getEnumReflectionType, getUnionTypes, isStringUnion, kindToName, stringifyDefaultValue, stringifyStringValue, stringifyValue };