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