@cyberskill/shared 1.201.0 → 1.202.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 (51) hide show
  1. package/dist/magic-string.es-D_iPNVbJ.cjs +10 -0
  2. package/dist/magic-string.es-cELbkQ5L.js +901 -0
  3. package/dist/{path.constant-Y6ImOuVK.cjs → path.constant-CPGOAxEp.cjs} +2 -2
  4. package/dist/{path.constant-CFKXX6cG.js → path.constant-DJq0jtD0.js} +63 -64
  5. package/dist/src/config/vitest/vitest.unit.cjs +1 -1
  6. package/dist/src/config/vitest/vitest.unit.js +1 -1
  7. package/dist/src/config/vitest/vitest.unit.setup.cjs +1 -1
  8. package/dist/src/config/vitest/vitest.unit.setup.js +1 -1
  9. package/dist/src/node/cli/cli.util.cjs +1 -1
  10. package/dist/src/node/cli/cli.util.js +19 -19
  11. package/dist/src/node/command/command.util.cjs +1 -1
  12. package/dist/src/node/command/command.util.js +1 -1
  13. package/dist/src/node/command/index.cjs +1 -1
  14. package/dist/src/node/command/index.js +1 -1
  15. package/dist/src/node/express/express.util.cjs +1 -1
  16. package/dist/src/node/express/express.util.js +43 -42
  17. package/dist/src/node/mongo/mongo.util.cjs +1 -1
  18. package/dist/src/node/mongo/mongo.util.js +1 -1
  19. package/dist/src/node/package/index.cjs +1 -1
  20. package/dist/src/node/package/index.js +1 -1
  21. package/dist/src/node/package/package.util.cjs +1 -1
  22. package/dist/src/node/package/package.util.js +1 -1
  23. package/dist/src/node/path/index.cjs +1 -1
  24. package/dist/src/node/path/index.js +20 -21
  25. package/dist/src/node/path/path.constant.cjs +1 -1
  26. package/dist/src/node/path/path.constant.d.ts +0 -1
  27. package/dist/src/node/path/path.constant.js +25 -26
  28. package/dist/src/node/upload/upload.util.cjs +1 -1
  29. package/dist/src/node/upload/upload.util.js +1 -1
  30. package/dist/src/react/apollo-client/apollo-client.util.cjs +1 -1
  31. package/dist/src/react/apollo-client/apollo-client.util.js +29 -29
  32. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.component.cjs +1 -0
  33. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.component.d.ts +3 -0
  34. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.component.js +20 -0
  35. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.cjs +1 -0
  36. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.d.ts +6 -0
  37. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.js +6 -0
  38. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.util.cjs +1 -0
  39. package/dist/src/react/apollo-client-nextjs/{apollo-client.util.d.ts → apollo-client-nextjs.util.d.ts} +1 -1
  40. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.util.js +24 -0
  41. package/dist/src/react/apollo-client-nextjs/index.cjs +1 -1
  42. package/dist/src/react/apollo-client-nextjs/index.d.ts +2 -2
  43. package/dist/src/react/apollo-client-nextjs/index.js +4 -4
  44. package/package.json +9 -5
  45. package/dist/magic-string.es-CyLHbrL2.js +0 -871
  46. package/dist/magic-string.es-hjygV5wN.cjs +0 -10
  47. package/dist/src/react/apollo-client-nextjs/apollo-client.component.cjs +0 -1
  48. package/dist/src/react/apollo-client-nextjs/apollo-client.component.d.ts +0 -3
  49. package/dist/src/react/apollo-client-nextjs/apollo-client.component.js +0 -33
  50. package/dist/src/react/apollo-client-nextjs/apollo-client.util.cjs +0 -1
  51. package/dist/src/react/apollo-client-nextjs/apollo-client.util.js +0 -31
@@ -1,871 +0,0 @@
1
- var ft = Object.defineProperty, dt = Object.defineProperties;
2
- var gt = Object.getOwnPropertyDescriptors;
3
- var K = Object.getOwnPropertySymbols;
4
- var pt = Object.prototype.hasOwnProperty, mt = Object.prototype.propertyIsEnumerable;
5
- var Q = (w, t, e) => t in w ? ft(w, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : w[t] = e, X = (w, t) => {
6
- for (var e in t || (t = {}))
7
- pt.call(t, e) && Q(w, e, t[e]);
8
- if (K)
9
- for (var e of K(t))
10
- mt.call(t, e) && Q(w, e, t[e]);
11
- return w;
12
- }, Z = (w, t) => dt(w, gt(t));
13
- var M = { exports: {} }, wt = M.exports, V;
14
- function bt() {
15
- return V || (V = 1, function(w, t) {
16
- (function(e, n) {
17
- n(t);
18
- })(wt, function(e) {
19
- const r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", u = new Uint8Array(64), f = new Uint8Array(128);
20
- for (let a = 0; a < r.length; a++) {
21
- const h = r.charCodeAt(a);
22
- u[a] = h, f[h] = a;
23
- }
24
- function o(a, h) {
25
- let i = 0, l = 0, d = 0;
26
- do {
27
- const C = a.next();
28
- d = f[C], i |= (d & 31) << l, l += 5;
29
- } while (d & 32);
30
- const g = i & 1;
31
- return i >>>= 1, g && (i = -2147483648 | -i), h + i;
32
- }
33
- function c(a, h, i) {
34
- let l = h - i;
35
- l = l < 0 ? -l << 1 | 1 : l << 1;
36
- do {
37
- let d = l & 31;
38
- l >>>= 5, l > 0 && (d |= 32), a.write(u[d]);
39
- } while (l > 0);
40
- return h;
41
- }
42
- function k(a, h) {
43
- return a.pos >= h ? !1 : a.peek() !== 44;
44
- }
45
- const O = 1024 * 16, z = typeof TextDecoder != "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer != "undefined" ? {
46
- decode(a) {
47
- return Buffer.from(a.buffer, a.byteOffset, a.byteLength).toString();
48
- }
49
- } : {
50
- decode(a) {
51
- let h = "";
52
- for (let i = 0; i < a.length; i++)
53
- h += String.fromCharCode(a[i]);
54
- return h;
55
- }
56
- };
57
- class D {
58
- constructor() {
59
- this.pos = 0, this.out = "", this.buffer = new Uint8Array(O);
60
- }
61
- write(h) {
62
- const { buffer: i } = this;
63
- i[this.pos++] = h, this.pos === O && (this.out += z.decode(i), this.pos = 0);
64
- }
65
- flush() {
66
- const { buffer: h, out: i, pos: l } = this;
67
- return l > 0 ? i + z.decode(h.subarray(0, l)) : i;
68
- }
69
- }
70
- class G {
71
- constructor(h) {
72
- this.pos = 0, this.buffer = h;
73
- }
74
- next() {
75
- return this.buffer.charCodeAt(this.pos++);
76
- }
77
- peek() {
78
- return this.buffer.charCodeAt(this.pos);
79
- }
80
- indexOf(h) {
81
- const { buffer: i, pos: l } = this, d = i.indexOf(h, l);
82
- return d === -1 ? i.length : d;
83
- }
84
- }
85
- const F = [];
86
- function nt(a) {
87
- const { length: h } = a, i = new G(a), l = [], d = [];
88
- let g = 0;
89
- for (; i.pos < h; i.pos++) {
90
- g = o(i, g);
91
- const C = o(i, 0);
92
- if (!k(i, h)) {
93
- const x = d.pop();
94
- x[2] = g, x[3] = C;
95
- continue;
96
- }
97
- const m = o(i, 0), b = o(i, 0) & 1 ? [g, C, 0, 0, m, o(i, 0)] : [g, C, 0, 0, m];
98
- let v = F;
99
- if (k(i, h)) {
100
- v = [];
101
- do {
102
- const x = o(i, 0);
103
- v.push(x);
104
- } while (k(i, h));
105
- }
106
- b.vars = v, l.push(b), d.push(b);
107
- }
108
- return l;
109
- }
110
- function it(a) {
111
- const h = new D();
112
- for (let i = 0; i < a.length; )
113
- i = H(a, i, h, [0]);
114
- return h.flush();
115
- }
116
- function H(a, h, i, l) {
117
- const d = a[h], { 0: g, 1: C, 2: m, 3: y, 4: S, vars: b } = d;
118
- h > 0 && i.write(44), l[0] = c(i, g, l[0]), c(i, C, 0), c(i, S, 0);
119
- const v = d.length === 6 ? 1 : 0;
120
- c(i, v, 0), d.length === 6 && c(i, d[5], 0);
121
- for (const x of b)
122
- c(i, x, 0);
123
- for (h++; h < a.length; ) {
124
- const x = a[h], { 0: p, 1: E } = x;
125
- if (p > m || p === m && E >= y)
126
- break;
127
- h = H(a, h, i, l);
128
- }
129
- return i.write(44), l[0] = c(i, m, l[0]), c(i, y, 0), h;
130
- }
131
- function st(a) {
132
- const { length: h } = a, i = new G(a), l = [], d = [];
133
- let g = 0, C = 0, m = 0, y = 0, S = 0, b = 0, v = 0, x = 0;
134
- do {
135
- const p = i.indexOf(";");
136
- let E = 0;
137
- for (; i.pos < p; i.pos++) {
138
- if (E = o(i, E), !k(i, p)) {
139
- const L = d.pop();
140
- L[2] = g, L[3] = E;
141
- continue;
142
- }
143
- const R = o(i, 0), B = R & 1, A = R & 2, T = R & 4;
144
- let Y = null, q = F, _;
145
- if (B) {
146
- const L = o(i, C);
147
- m = o(i, C === L ? m : 0), C = L, _ = [g, E, 0, 0, L, m];
148
- } else
149
- _ = [g, E, 0, 0];
150
- if (_.isScope = !!T, A) {
151
- const L = y, I = S;
152
- y = o(i, y);
153
- const j = L === y;
154
- S = o(i, j ? S : 0), b = o(i, j && I === S ? b : 0), Y = [y, S, b];
155
- }
156
- if (_.callsite = Y, k(i, p)) {
157
- q = [];
158
- do {
159
- v = g, x = E;
160
- const L = o(i, 0);
161
- let I;
162
- if (L < -1) {
163
- I = [[o(i, 0)]];
164
- for (let j = -1; j > L; j--) {
165
- const ct = v;
166
- v = o(i, v), x = o(i, v === ct ? x : 0);
167
- const at = o(i, 0);
168
- I.push([at, v, x]);
169
- }
170
- } else
171
- I = [[L]];
172
- q.push(I);
173
- } while (k(i, p));
174
- }
175
- _.bindings = q, l.push(_), d.push(_);
176
- }
177
- g++, i.pos = p + 1;
178
- } while (i.pos < h);
179
- return l;
180
- }
181
- function rt(a) {
182
- if (a.length === 0)
183
- return "";
184
- const h = new D();
185
- for (let i = 0; i < a.length; )
186
- i = J(a, i, h, [0, 0, 0, 0, 0, 0, 0]);
187
- return h.flush();
188
- }
189
- function J(a, h, i, l) {
190
- const d = a[h], { 0: g, 1: C, 2: m, 3: y, isScope: S, callsite: b, bindings: v } = d;
191
- l[0] < g ? (W(i, l[0], g), l[0] = g, l[1] = 0) : h > 0 && i.write(44), l[1] = c(i, d[1], l[1]);
192
- const x = (d.length === 6 ? 1 : 0) | (b ? 2 : 0) | (S ? 4 : 0);
193
- if (c(i, x, 0), d.length === 6) {
194
- const { 4: p, 5: E } = d;
195
- p !== l[2] && (l[3] = 0), l[2] = c(i, p, l[2]), l[3] = c(i, E, l[3]);
196
- }
197
- if (b) {
198
- const { 0: p, 1: E, 2: R } = d.callsite;
199
- p !== l[4] ? (l[5] = 0, l[6] = 0) : E !== l[5] && (l[6] = 0), l[4] = c(i, p, l[4]), l[5] = c(i, E, l[5]), l[6] = c(i, R, l[6]);
200
- }
201
- if (v)
202
- for (const p of v) {
203
- p.length > 1 && c(i, -p.length, 0);
204
- const E = p[0][0];
205
- c(i, E, 0);
206
- let R = g, B = C;
207
- for (let A = 1; A < p.length; A++) {
208
- const T = p[A];
209
- R = c(i, T[1], R), B = c(i, T[2], B), c(i, T[0], 0);
210
- }
211
- }
212
- for (h++; h < a.length; ) {
213
- const p = a[h], { 0: E, 1: R } = p;
214
- if (E > m || E === m && R >= y)
215
- break;
216
- h = J(a, h, i, l);
217
- }
218
- return l[0] < m ? (W(i, l[0], m), l[0] = m, l[1] = 0) : i.write(44), l[1] = c(i, y, l[1]), h;
219
- }
220
- function W(a, h, i) {
221
- do
222
- a.write(59);
223
- while (++h < i);
224
- }
225
- function ot(a) {
226
- const { length: h } = a, i = new G(a), l = [];
227
- let d = 0, g = 0, C = 0, m = 0, y = 0;
228
- do {
229
- const S = i.indexOf(";"), b = [];
230
- let v = !0, x = 0;
231
- for (d = 0; i.pos < S; ) {
232
- let p;
233
- d = o(i, d), d < x && (v = !1), x = d, k(i, S) ? (g = o(i, g), C = o(i, C), m = o(i, m), k(i, S) ? (y = o(i, y), p = [d, g, C, m, y]) : p = [d, g, C, m]) : p = [d], b.push(p), i.pos++;
234
- }
235
- v || ht(b), l.push(b), i.pos = S + 1;
236
- } while (i.pos <= h);
237
- return l;
238
- }
239
- function ht(a) {
240
- a.sort(lt);
241
- }
242
- function lt(a, h) {
243
- return a[0] - h[0];
244
- }
245
- function ut(a) {
246
- const h = new D();
247
- let i = 0, l = 0, d = 0, g = 0;
248
- for (let C = 0; C < a.length; C++) {
249
- const m = a[C];
250
- if (C > 0 && h.write(59), m.length === 0)
251
- continue;
252
- let y = 0;
253
- for (let S = 0; S < m.length; S++) {
254
- const b = m[S];
255
- S > 0 && h.write(44), y = c(h, b[0], y), b.length !== 1 && (i = c(h, b[1], i), l = c(h, b[2], l), d = c(h, b[3], d), b.length !== 4 && (g = c(h, b[4], g)));
256
- }
257
- }
258
- return h.flush();
259
- }
260
- e.decode = ot, e.decodeGeneratedRanges = st, e.decodeOriginalScopes = nt, e.encode = ut, e.encodeGeneratedRanges = rt, e.encodeOriginalScopes = it, Object.defineProperty(e, "__esModule", { value: !0 });
261
- });
262
- }(M, M.exports)), M.exports;
263
- }
264
- var Ct = bt();
265
- class P {
266
- constructor(t) {
267
- this.bits = t instanceof P ? t.bits.slice() : [];
268
- }
269
- add(t) {
270
- this.bits[t >> 5] |= 1 << (t & 31);
271
- }
272
- has(t) {
273
- return !!(this.bits[t >> 5] & 1 << (t & 31));
274
- }
275
- }
276
- class U {
277
- constructor(t, e, n) {
278
- this.start = t, this.end = e, this.original = n, this.intro = "", this.outro = "", this.content = n, this.storeName = !1, this.edited = !1, this.previous = null, this.next = null;
279
- }
280
- appendLeft(t) {
281
- this.outro += t;
282
- }
283
- appendRight(t) {
284
- this.intro = this.intro + t;
285
- }
286
- clone() {
287
- const t = new U(this.start, this.end, this.original);
288
- return t.intro = this.intro, t.outro = this.outro, t.content = this.content, t.storeName = this.storeName, t.edited = this.edited, t;
289
- }
290
- contains(t) {
291
- return this.start < t && t < this.end;
292
- }
293
- eachNext(t) {
294
- let e = this;
295
- for (; e; )
296
- t(e), e = e.next;
297
- }
298
- eachPrevious(t) {
299
- let e = this;
300
- for (; e; )
301
- t(e), e = e.previous;
302
- }
303
- edit(t, e, n) {
304
- return this.content = t, n || (this.intro = "", this.outro = ""), this.storeName = e, this.edited = !0, this;
305
- }
306
- prependLeft(t) {
307
- this.outro = t + this.outro;
308
- }
309
- prependRight(t) {
310
- this.intro = t + this.intro;
311
- }
312
- reset() {
313
- this.intro = "", this.outro = "", this.edited && (this.content = this.original, this.storeName = !1, this.edited = !1);
314
- }
315
- split(t) {
316
- const e = t - this.start, n = this.original.slice(0, e), s = this.original.slice(e);
317
- this.original = n;
318
- const r = new U(t, this.end, s);
319
- return r.outro = this.outro, this.outro = "", this.end = t, this.edited ? (r.edit("", !1), this.content = "") : this.content = n, r.next = this.next, r.next && (r.next.previous = r), r.previous = this, this.next = r, r;
320
- }
321
- toString() {
322
- return this.intro + this.content + this.outro;
323
- }
324
- trimEnd(t) {
325
- if (this.outro = this.outro.replace(t, ""), this.outro.length) return !0;
326
- const e = this.content.replace(t, "");
327
- if (e.length)
328
- return e !== this.content && (this.split(this.start + e.length).edit("", void 0, !0), this.edited && this.edit(e, this.storeName, !0)), !0;
329
- if (this.edit("", void 0, !0), this.intro = this.intro.replace(t, ""), this.intro.length) return !0;
330
- }
331
- trimStart(t) {
332
- if (this.intro = this.intro.replace(t, ""), this.intro.length) return !0;
333
- const e = this.content.replace(t, "");
334
- if (e.length) {
335
- if (e !== this.content) {
336
- const n = this.split(this.end - e.length);
337
- this.edited && n.edit(e, this.storeName, !0), this.edit("", void 0, !0);
338
- }
339
- return !0;
340
- } else if (this.edit("", void 0, !0), this.outro = this.outro.replace(t, ""), this.outro.length) return !0;
341
- }
342
- }
343
- function St() {
344
- return typeof globalThis != "undefined" && typeof globalThis.btoa == "function" ? (w) => globalThis.btoa(unescape(encodeURIComponent(w))) : typeof Buffer == "function" ? (w) => Buffer.from(w, "utf-8").toString("base64") : () => {
345
- throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
346
- };
347
- }
348
- const yt = /* @__PURE__ */ St();
349
- class vt {
350
- constructor(t) {
351
- this.version = 3, this.file = t.file, this.sources = t.sources, this.sourcesContent = t.sourcesContent, this.names = t.names, this.mappings = Ct.encode(t.mappings), typeof t.x_google_ignoreList != "undefined" && (this.x_google_ignoreList = t.x_google_ignoreList), typeof t.debugId != "undefined" && (this.debugId = t.debugId);
352
- }
353
- toString() {
354
- return JSON.stringify(this);
355
- }
356
- toUrl() {
357
- return "data:application/json;charset=utf-8;base64," + yt(this.toString());
358
- }
359
- }
360
- function xt(w) {
361
- const t = w.split(`
362
- `), e = t.filter((r) => /^\t+/.test(r)), n = t.filter((r) => /^ {2,}/.test(r));
363
- if (e.length === 0 && n.length === 0)
364
- return null;
365
- if (e.length >= n.length)
366
- return " ";
367
- const s = n.reduce((r, u) => {
368
- const f = /^ +/.exec(u)[0].length;
369
- return Math.min(f, r);
370
- }, 1 / 0);
371
- return new Array(s + 1).join(" ");
372
- }
373
- function Et(w, t) {
374
- const e = w.split(/[/\\]/), n = t.split(/[/\\]/);
375
- for (e.pop(); e[0] === n[0]; )
376
- e.shift(), n.shift();
377
- if (e.length) {
378
- let s = e.length;
379
- for (; s--; ) e[s] = "..";
380
- }
381
- return e.concat(n).join("/");
382
- }
383
- const kt = Object.prototype.toString;
384
- function Lt(w) {
385
- return kt.call(w) === "[object Object]";
386
- }
387
- function tt(w) {
388
- const t = w.split(`
389
- `), e = [];
390
- for (let n = 0, s = 0; n < t.length; n++)
391
- e.push(s), s += t[n].length + 1;
392
- return function(s) {
393
- let r = 0, u = e.length;
394
- for (; r < u; ) {
395
- const c = r + u >> 1;
396
- s < e[c] ? u = c : r = c + 1;
397
- }
398
- const f = r - 1, o = s - e[f];
399
- return { line: f, column: o };
400
- };
401
- }
402
- const Rt = /\w/;
403
- class _t {
404
- constructor(t) {
405
- this.hires = t, this.generatedCodeLine = 0, this.generatedCodeColumn = 0, this.raw = [], this.rawSegments = this.raw[this.generatedCodeLine] = [], this.pending = null;
406
- }
407
- addEdit(t, e, n, s) {
408
- if (e.length) {
409
- const r = e.length - 1;
410
- let u = e.indexOf(`
411
- `, 0), f = -1;
412
- for (; u >= 0 && r > u; ) {
413
- const c = [this.generatedCodeColumn, t, n.line, n.column];
414
- s >= 0 && c.push(s), this.rawSegments.push(c), this.generatedCodeLine += 1, this.raw[this.generatedCodeLine] = this.rawSegments = [], this.generatedCodeColumn = 0, f = u, u = e.indexOf(`
415
- `, u + 1);
416
- }
417
- const o = [this.generatedCodeColumn, t, n.line, n.column];
418
- s >= 0 && o.push(s), this.rawSegments.push(o), this.advance(e.slice(f + 1));
419
- } else this.pending && (this.rawSegments.push(this.pending), this.advance(e));
420
- this.pending = null;
421
- }
422
- addUneditedChunk(t, e, n, s, r) {
423
- let u = e.start, f = !0, o = !1;
424
- for (; u < e.end; ) {
425
- if (n[u] === `
426
- `)
427
- s.line += 1, s.column = 0, this.generatedCodeLine += 1, this.raw[this.generatedCodeLine] = this.rawSegments = [], this.generatedCodeColumn = 0, f = !0, o = !1;
428
- else {
429
- if (this.hires || f || r.has(u)) {
430
- const c = [this.generatedCodeColumn, t, s.line, s.column];
431
- this.hires === "boundary" ? Rt.test(n[u]) ? o || (this.rawSegments.push(c), o = !0) : (this.rawSegments.push(c), o = !1) : this.rawSegments.push(c);
432
- }
433
- s.column += 1, this.generatedCodeColumn += 1, f = !1;
434
- }
435
- u += 1;
436
- }
437
- this.pending = null;
438
- }
439
- advance(t) {
440
- if (!t) return;
441
- const e = t.split(`
442
- `);
443
- if (e.length > 1) {
444
- for (let n = 0; n < e.length - 1; n++)
445
- this.generatedCodeLine++, this.raw[this.generatedCodeLine] = this.rawSegments = [];
446
- this.generatedCodeColumn = 0;
447
- }
448
- this.generatedCodeColumn += e[e.length - 1].length;
449
- }
450
- }
451
- const $ = `
452
- `, N = {
453
- insertLeft: !1,
454
- insertRight: !1,
455
- storeName: !1
456
- };
457
- class et {
458
- constructor(t, e = {}) {
459
- const n = new U(0, t.length, t);
460
- Object.defineProperties(this, {
461
- original: { writable: !0, value: t },
462
- outro: { writable: !0, value: "" },
463
- intro: { writable: !0, value: "" },
464
- firstChunk: { writable: !0, value: n },
465
- lastChunk: { writable: !0, value: n },
466
- lastSearchedChunk: { writable: !0, value: n },
467
- byStart: { writable: !0, value: {} },
468
- byEnd: { writable: !0, value: {} },
469
- filename: { writable: !0, value: e.filename },
470
- indentExclusionRanges: { writable: !0, value: e.indentExclusionRanges },
471
- sourcemapLocations: { writable: !0, value: new P() },
472
- storedNames: { writable: !0, value: {} },
473
- indentStr: { writable: !0, value: void 0 },
474
- ignoreList: { writable: !0, value: e.ignoreList },
475
- offset: { writable: !0, value: e.offset || 0 }
476
- }), this.byStart[0] = n, this.byEnd[t.length] = n;
477
- }
478
- addSourcemapLocation(t) {
479
- this.sourcemapLocations.add(t);
480
- }
481
- append(t) {
482
- if (typeof t != "string") throw new TypeError("outro content must be a string");
483
- return this.outro += t, this;
484
- }
485
- appendLeft(t, e) {
486
- if (t = t + this.offset, typeof e != "string") throw new TypeError("inserted content must be a string");
487
- this._split(t);
488
- const n = this.byEnd[t];
489
- return n ? n.appendLeft(e) : this.intro += e, this;
490
- }
491
- appendRight(t, e) {
492
- if (t = t + this.offset, typeof e != "string") throw new TypeError("inserted content must be a string");
493
- this._split(t);
494
- const n = this.byStart[t];
495
- return n ? n.appendRight(e) : this.outro += e, this;
496
- }
497
- clone() {
498
- const t = new et(this.original, { filename: this.filename, offset: this.offset });
499
- let e = this.firstChunk, n = t.firstChunk = t.lastSearchedChunk = e.clone();
500
- for (; e; ) {
501
- t.byStart[n.start] = n, t.byEnd[n.end] = n;
502
- const s = e.next, r = s && s.clone();
503
- r && (n.next = r, r.previous = n, n = r), e = s;
504
- }
505
- return t.lastChunk = n, this.indentExclusionRanges && (t.indentExclusionRanges = this.indentExclusionRanges.slice()), t.sourcemapLocations = new P(this.sourcemapLocations), t.intro = this.intro, t.outro = this.outro, t;
506
- }
507
- generateDecodedMap(t) {
508
- t = t || {};
509
- const e = 0, n = Object.keys(this.storedNames), s = new _t(t.hires), r = tt(this.original);
510
- return this.intro && s.advance(this.intro), this.firstChunk.eachNext((u) => {
511
- const f = r(u.start);
512
- u.intro.length && s.advance(u.intro), u.edited ? s.addEdit(
513
- e,
514
- u.content,
515
- f,
516
- u.storeName ? n.indexOf(u.original) : -1
517
- ) : s.addUneditedChunk(e, u, this.original, f, this.sourcemapLocations), u.outro.length && s.advance(u.outro);
518
- }), {
519
- file: t.file ? t.file.split(/[/\\]/).pop() : void 0,
520
- sources: [
521
- t.source ? Et(t.file || "", t.source) : t.file || ""
522
- ],
523
- sourcesContent: t.includeContent ? [this.original] : void 0,
524
- names: n,
525
- mappings: s.raw,
526
- x_google_ignoreList: this.ignoreList ? [e] : void 0
527
- };
528
- }
529
- generateMap(t) {
530
- return new vt(this.generateDecodedMap(t));
531
- }
532
- _ensureindentStr() {
533
- this.indentStr === void 0 && (this.indentStr = xt(this.original));
534
- }
535
- _getRawIndentString() {
536
- return this._ensureindentStr(), this.indentStr;
537
- }
538
- getIndentString() {
539
- return this._ensureindentStr(), this.indentStr === null ? " " : this.indentStr;
540
- }
541
- indent(t, e) {
542
- const n = /^[^\r\n]/gm;
543
- if (Lt(t) && (e = t, t = void 0), t === void 0 && (this._ensureindentStr(), t = this.indentStr || " "), t === "") return this;
544
- e = e || {};
545
- const s = {};
546
- e.exclude && (typeof e.exclude[0] == "number" ? [e.exclude] : e.exclude).forEach((k) => {
547
- for (let O = k[0]; O < k[1]; O += 1)
548
- s[O] = !0;
549
- });
550
- let r = e.indentStart !== !1;
551
- const u = (c) => r ? `${t}${c}` : (r = !0, c);
552
- this.intro = this.intro.replace(n, u);
553
- let f = 0, o = this.firstChunk;
554
- for (; o; ) {
555
- const c = o.end;
556
- if (o.edited)
557
- s[f] || (o.content = o.content.replace(n, u), o.content.length && (r = o.content[o.content.length - 1] === `
558
- `));
559
- else
560
- for (f = o.start; f < c; ) {
561
- if (!s[f]) {
562
- const k = this.original[f];
563
- k === `
564
- ` ? r = !0 : k !== "\r" && r && (r = !1, f === o.start || (this._splitChunk(o, f), o = o.next), o.prependRight(t));
565
- }
566
- f += 1;
567
- }
568
- f = o.end, o = o.next;
569
- }
570
- return this.outro = this.outro.replace(n, u), this;
571
- }
572
- insert() {
573
- throw new Error(
574
- "magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)"
575
- );
576
- }
577
- insertLeft(t, e) {
578
- return N.insertLeft || (console.warn(
579
- "magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"
580
- ), N.insertLeft = !0), this.appendLeft(t, e);
581
- }
582
- insertRight(t, e) {
583
- return N.insertRight || (console.warn(
584
- "magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"
585
- ), N.insertRight = !0), this.prependRight(t, e);
586
- }
587
- move(t, e, n) {
588
- if (t = t + this.offset, e = e + this.offset, n = n + this.offset, n >= t && n <= e) throw new Error("Cannot move a selection inside itself");
589
- this._split(t), this._split(e), this._split(n);
590
- const s = this.byStart[t], r = this.byEnd[e], u = s.previous, f = r.next, o = this.byStart[n];
591
- if (!o && r === this.lastChunk) return this;
592
- const c = o ? o.previous : this.lastChunk;
593
- return u && (u.next = f), f && (f.previous = u), c && (c.next = s), o && (o.previous = r), s.previous || (this.firstChunk = r.next), r.next || (this.lastChunk = s.previous, this.lastChunk.next = null), s.previous = c, r.next = o || null, c || (this.firstChunk = s), o || (this.lastChunk = r), this;
594
- }
595
- overwrite(t, e, n, s) {
596
- return s = s || {}, this.update(t, e, n, Z(X({}, s), { overwrite: !s.contentOnly }));
597
- }
598
- update(t, e, n, s) {
599
- if (t = t + this.offset, e = e + this.offset, typeof n != "string") throw new TypeError("replacement content must be a string");
600
- if (this.original.length !== 0) {
601
- for (; t < 0; ) t += this.original.length;
602
- for (; e < 0; ) e += this.original.length;
603
- }
604
- if (e > this.original.length) throw new Error("end is out of bounds");
605
- if (t === e)
606
- throw new Error(
607
- "Cannot overwrite a zero-length range – use appendLeft or prependRight instead"
608
- );
609
- this._split(t), this._split(e), s === !0 && (N.storeName || (console.warn(
610
- "The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"
611
- ), N.storeName = !0), s = { storeName: !0 });
612
- const r = s !== void 0 ? s.storeName : !1, u = s !== void 0 ? s.overwrite : !1;
613
- if (r) {
614
- const c = this.original.slice(t, e);
615
- Object.defineProperty(this.storedNames, c, {
616
- writable: !0,
617
- value: !0,
618
- enumerable: !0
619
- });
620
- }
621
- const f = this.byStart[t], o = this.byEnd[e];
622
- if (f) {
623
- let c = f;
624
- for (; c !== o; ) {
625
- if (c.next !== this.byStart[c.end])
626
- throw new Error("Cannot overwrite across a split point");
627
- c = c.next, c.edit("", !1);
628
- }
629
- f.edit(n, r, !u);
630
- } else {
631
- const c = new U(t, e, "").edit(n, r);
632
- o.next = c, c.previous = o;
633
- }
634
- return this;
635
- }
636
- prepend(t) {
637
- if (typeof t != "string") throw new TypeError("outro content must be a string");
638
- return this.intro = t + this.intro, this;
639
- }
640
- prependLeft(t, e) {
641
- if (t = t + this.offset, typeof e != "string") throw new TypeError("inserted content must be a string");
642
- this._split(t);
643
- const n = this.byEnd[t];
644
- return n ? n.prependLeft(e) : this.intro = e + this.intro, this;
645
- }
646
- prependRight(t, e) {
647
- if (t = t + this.offset, typeof e != "string") throw new TypeError("inserted content must be a string");
648
- this._split(t);
649
- const n = this.byStart[t];
650
- return n ? n.prependRight(e) : this.outro = e + this.outro, this;
651
- }
652
- remove(t, e) {
653
- if (t = t + this.offset, e = e + this.offset, this.original.length !== 0) {
654
- for (; t < 0; ) t += this.original.length;
655
- for (; e < 0; ) e += this.original.length;
656
- }
657
- if (t === e) return this;
658
- if (t < 0 || e > this.original.length) throw new Error("Character is out of bounds");
659
- if (t > e) throw new Error("end must be greater than start");
660
- this._split(t), this._split(e);
661
- let n = this.byStart[t];
662
- for (; n; )
663
- n.intro = "", n.outro = "", n.edit(""), n = e > n.end ? this.byStart[n.end] : null;
664
- return this;
665
- }
666
- reset(t, e) {
667
- if (t = t + this.offset, e = e + this.offset, this.original.length !== 0) {
668
- for (; t < 0; ) t += this.original.length;
669
- for (; e < 0; ) e += this.original.length;
670
- }
671
- if (t === e) return this;
672
- if (t < 0 || e > this.original.length) throw new Error("Character is out of bounds");
673
- if (t > e) throw new Error("end must be greater than start");
674
- this._split(t), this._split(e);
675
- let n = this.byStart[t];
676
- for (; n; )
677
- n.reset(), n = e > n.end ? this.byStart[n.end] : null;
678
- return this;
679
- }
680
- lastChar() {
681
- if (this.outro.length) return this.outro[this.outro.length - 1];
682
- let t = this.lastChunk;
683
- do {
684
- if (t.outro.length) return t.outro[t.outro.length - 1];
685
- if (t.content.length) return t.content[t.content.length - 1];
686
- if (t.intro.length) return t.intro[t.intro.length - 1];
687
- } while (t = t.previous);
688
- return this.intro.length ? this.intro[this.intro.length - 1] : "";
689
- }
690
- lastLine() {
691
- let t = this.outro.lastIndexOf($);
692
- if (t !== -1) return this.outro.substr(t + 1);
693
- let e = this.outro, n = this.lastChunk;
694
- do {
695
- if (n.outro.length > 0) {
696
- if (t = n.outro.lastIndexOf($), t !== -1) return n.outro.substr(t + 1) + e;
697
- e = n.outro + e;
698
- }
699
- if (n.content.length > 0) {
700
- if (t = n.content.lastIndexOf($), t !== -1) return n.content.substr(t + 1) + e;
701
- e = n.content + e;
702
- }
703
- if (n.intro.length > 0) {
704
- if (t = n.intro.lastIndexOf($), t !== -1) return n.intro.substr(t + 1) + e;
705
- e = n.intro + e;
706
- }
707
- } while (n = n.previous);
708
- return t = this.intro.lastIndexOf($), t !== -1 ? this.intro.substr(t + 1) + e : this.intro + e;
709
- }
710
- slice(t = 0, e = this.original.length - this.offset) {
711
- if (t = t + this.offset, e = e + this.offset, this.original.length !== 0) {
712
- for (; t < 0; ) t += this.original.length;
713
- for (; e < 0; ) e += this.original.length;
714
- }
715
- let n = "", s = this.firstChunk;
716
- for (; s && (s.start > t || s.end <= t); ) {
717
- if (s.start < e && s.end >= e)
718
- return n;
719
- s = s.next;
720
- }
721
- if (s && s.edited && s.start !== t)
722
- throw new Error(`Cannot use replaced character ${t} as slice start anchor.`);
723
- const r = s;
724
- for (; s; ) {
725
- s.intro && (r !== s || s.start === t) && (n += s.intro);
726
- const u = s.start < e && s.end >= e;
727
- if (u && s.edited && s.end !== e)
728
- throw new Error(`Cannot use replaced character ${e} as slice end anchor.`);
729
- const f = r === s ? t - s.start : 0, o = u ? s.content.length + e - s.end : s.content.length;
730
- if (n += s.content.slice(f, o), s.outro && (!u || s.end === e) && (n += s.outro), u)
731
- break;
732
- s = s.next;
733
- }
734
- return n;
735
- }
736
- // TODO deprecate this? not really very useful
737
- snip(t, e) {
738
- const n = this.clone();
739
- return n.remove(0, t), n.remove(e, n.original.length), n;
740
- }
741
- _split(t) {
742
- if (this.byStart[t] || this.byEnd[t]) return;
743
- let e = this.lastSearchedChunk;
744
- const n = t > e.end;
745
- for (; e; ) {
746
- if (e.contains(t)) return this._splitChunk(e, t);
747
- e = n ? this.byStart[e.end] : this.byEnd[e.start];
748
- }
749
- }
750
- _splitChunk(t, e) {
751
- if (t.edited && t.content.length) {
752
- const s = tt(this.original)(e);
753
- throw new Error(
754
- `Cannot split a chunk that has already been edited (${s.line}:${s.column} – "${t.original}")`
755
- );
756
- }
757
- const n = t.split(e);
758
- return this.byEnd[e] = t, this.byStart[e] = n, this.byEnd[n.end] = n, t === this.lastChunk && (this.lastChunk = n), this.lastSearchedChunk = t, !0;
759
- }
760
- toString() {
761
- let t = this.intro, e = this.firstChunk;
762
- for (; e; )
763
- t += e.toString(), e = e.next;
764
- return t + this.outro;
765
- }
766
- isEmpty() {
767
- let t = this.firstChunk;
768
- do
769
- if (t.intro.length && t.intro.trim() || t.content.length && t.content.trim() || t.outro.length && t.outro.trim())
770
- return !1;
771
- while (t = t.next);
772
- return !0;
773
- }
774
- length() {
775
- let t = this.firstChunk, e = 0;
776
- do
777
- e += t.intro.length + t.content.length + t.outro.length;
778
- while (t = t.next);
779
- return e;
780
- }
781
- trimLines() {
782
- return this.trim("[\\r\\n]");
783
- }
784
- trim(t) {
785
- return this.trimStart(t).trimEnd(t);
786
- }
787
- trimEndAborted(t) {
788
- const e = new RegExp((t || "\\s") + "+$");
789
- if (this.outro = this.outro.replace(e, ""), this.outro.length) return !0;
790
- let n = this.lastChunk;
791
- do {
792
- const s = n.end, r = n.trimEnd(e);
793
- if (n.end !== s && (this.lastChunk === n && (this.lastChunk = n.next), this.byEnd[n.end] = n, this.byStart[n.next.start] = n.next, this.byEnd[n.next.end] = n.next), r) return !0;
794
- n = n.previous;
795
- } while (n);
796
- return !1;
797
- }
798
- trimEnd(t) {
799
- return this.trimEndAborted(t), this;
800
- }
801
- trimStartAborted(t) {
802
- const e = new RegExp("^" + (t || "\\s") + "+");
803
- if (this.intro = this.intro.replace(e, ""), this.intro.length) return !0;
804
- let n = this.firstChunk;
805
- do {
806
- const s = n.end, r = n.trimStart(e);
807
- if (n.end !== s && (n === this.lastChunk && (this.lastChunk = n.next), this.byEnd[n.end] = n, this.byStart[n.next.start] = n.next, this.byEnd[n.next.end] = n.next), r) return !0;
808
- n = n.next;
809
- } while (n);
810
- return !1;
811
- }
812
- trimStart(t) {
813
- return this.trimStartAborted(t), this;
814
- }
815
- hasChanged() {
816
- return this.original !== this.toString();
817
- }
818
- _replaceRegexp(t, e) {
819
- function n(r, u) {
820
- return typeof e == "string" ? e.replace(/\$(\$|&|\d+)/g, (f, o) => o === "$" ? "$" : o === "&" ? r[0] : +o < r.length ? r[+o] : `$${o}`) : e(...r, r.index, u, r.groups);
821
- }
822
- function s(r, u) {
823
- let f;
824
- const o = [];
825
- for (; f = r.exec(u); )
826
- o.push(f);
827
- return o;
828
- }
829
- if (t.global)
830
- s(t, this.original).forEach((u) => {
831
- if (u.index != null) {
832
- const f = n(u, this.original);
833
- f !== u[0] && this.overwrite(u.index, u.index + u[0].length, f);
834
- }
835
- });
836
- else {
837
- const r = this.original.match(t);
838
- if (r && r.index != null) {
839
- const u = n(r, this.original);
840
- u !== r[0] && this.overwrite(r.index, r.index + r[0].length, u);
841
- }
842
- }
843
- return this;
844
- }
845
- _replaceString(t, e) {
846
- const { original: n } = this, s = n.indexOf(t);
847
- return s !== -1 && this.overwrite(s, s + t.length, e), this;
848
- }
849
- replace(t, e) {
850
- return typeof t == "string" ? this._replaceString(t, e) : this._replaceRegexp(t, e);
851
- }
852
- _replaceAllString(t, e) {
853
- const { original: n } = this, s = t.length;
854
- for (let r = n.indexOf(t); r !== -1; r = n.indexOf(t, r + s))
855
- n.slice(r, r + s) !== e && this.overwrite(r, r + s, e);
856
- return this;
857
- }
858
- replaceAll(t, e) {
859
- if (typeof t == "string")
860
- return this._replaceAllString(t, e);
861
- if (!t.global)
862
- throw new TypeError(
863
- "MagicString.prototype.replaceAll called with a non-global RegExp argument"
864
- );
865
- return this._replaceRegexp(t, e);
866
- }
867
- }
868
- export {
869
- vt as SourceMap,
870
- et as default
871
- };