@cyberskill/shared 1.204.0 → 1.205.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.
- package/dist/magic-string.es-C6Zk6wMx.js +671 -0
- package/dist/magic-string.es-CjWtD8Pa.cjs +10 -0
- package/dist/src/config/env/env.util.cjs +1 -1
- package/dist/src/config/env/env.util.js +16 -15
- package/dist/src/config/eslint/index.d.ts +8 -0
- package/dist/src/config/vitest/vitest.unit.setup.cjs +1 -1
- package/dist/src/config/vitest/vitest.unit.setup.js +1 -1
- package/dist/src/node/cli/cli.util.cjs +1 -1
- package/dist/src/node/cli/cli.util.js +2 -2
- package/dist/src/node/mongo/mongo.util.cjs +5 -5
- package/dist/src/node/mongo/mongo.util.d.ts +1 -4
- package/dist/src/node/mongo/mongo.util.js +46 -53
- package/package.json +9 -9
- package/dist/magic-string.es-D_iPNVbJ.cjs +0 -10
- package/dist/magic-string.es-cELbkQ5L.js +0 -901
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
1
|
+
var I = Object.defineProperty, M = Object.defineProperties;
|
|
2
2
|
var b = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var S = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var p = (c, t, e) => t in c ?
|
|
4
|
+
var A = Object.prototype.hasOwnProperty, T = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var p = (c, t, e) => t in c ? I(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e, m = (c, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
|
|
7
|
+
A.call(t, e) && p(c, e, t[e]);
|
|
8
8
|
if (S)
|
|
9
9
|
for (var e of S(t))
|
|
10
|
-
|
|
10
|
+
T.call(t, e) && p(c, e, t[e]);
|
|
11
11
|
return c;
|
|
12
|
-
}, h = (c, t) =>
|
|
13
|
-
var
|
|
12
|
+
}, h = (c, t) => M(c, b(t));
|
|
13
|
+
var N = (c, t, e) => p(c, typeof t != "symbol" ? t + "" : t, e);
|
|
14
14
|
var a = (c, t, e) => new Promise((r, s) => {
|
|
15
15
|
var n = (l) => {
|
|
16
16
|
try {
|
|
@@ -27,36 +27,29 @@ var a = (c, t, e) => new Promise((r, s) => {
|
|
|
27
27
|
}, i = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(n, u);
|
|
28
28
|
i((e = e.apply(c, t)).next());
|
|
29
29
|
});
|
|
30
|
-
import
|
|
31
|
-
import G from "
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import {
|
|
37
|
-
import { v4 as N } from "uuid";
|
|
30
|
+
import F from "migrate-mongo";
|
|
31
|
+
import { Document as G } from "mongoose";
|
|
32
|
+
import $ from "mongoose-aggregate-paginate-v2";
|
|
33
|
+
import { default as de } from "mongoose-aggregate-paginate-v2";
|
|
34
|
+
import j from "mongoose-paginate-v2";
|
|
35
|
+
import { default as fe } from "mongoose-paginate-v2";
|
|
36
|
+
import { v4 as w } from "uuid";
|
|
38
37
|
import { RESPONSE_STATUS as d } from "../../constant/response-status.js";
|
|
39
|
-
import { regexSearchMapper as
|
|
40
|
-
import { deepClone as
|
|
41
|
-
import { generateShortId as
|
|
42
|
-
import { validate as
|
|
43
|
-
import { writeFileSync as x, pathExistsSync as Q, readFileSync as
|
|
38
|
+
import { regexSearchMapper as q } from "../../util/common/common.util.js";
|
|
39
|
+
import { deepClone as V, getNestedValue as v, setNestedValue as P, isObject as D } from "../../util/object/object.util.js";
|
|
40
|
+
import { generateShortId as U, generateSlug as E } from "../../util/string/string.util.js";
|
|
41
|
+
import { validate as L } from "../../util/validate/validate.util.js";
|
|
42
|
+
import { writeFileSync as x, pathExistsSync as Q, readFileSync as H, appendFileSync as k } from "../fs/fs.util.js";
|
|
44
43
|
import { catchError as o } from "../log/log.util.js";
|
|
45
44
|
import { F as y, M as C } from "../../../path.constant-CvSr0Rrx.js";
|
|
46
45
|
import "../path/path.util.js";
|
|
47
46
|
const g = {
|
|
48
|
-
|
|
49
|
-
return F(c, "yyyy-MM-dd HH:mm:ss.SSS");
|
|
50
|
-
},
|
|
51
|
-
createGenericFields({
|
|
52
|
-
returnDateAs: c = "string"
|
|
53
|
-
} = {}) {
|
|
54
|
-
const t = c === "string" ? g.getDateTime() : /* @__PURE__ */ new Date();
|
|
47
|
+
createGenericFields() {
|
|
55
48
|
return {
|
|
56
|
-
id:
|
|
49
|
+
id: w(),
|
|
57
50
|
isDel: !1,
|
|
58
|
-
createdAt:
|
|
59
|
-
updatedAt:
|
|
51
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
52
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
60
53
|
};
|
|
61
54
|
},
|
|
62
55
|
applyPlugins(c, t) {
|
|
@@ -70,7 +63,7 @@ const g = {
|
|
|
70
63
|
createGenericSchema(c) {
|
|
71
64
|
return new c.Schema(
|
|
72
65
|
{
|
|
73
|
-
id: { type: String, default:
|
|
66
|
+
id: { type: String, default: w, unique: !0 },
|
|
74
67
|
isDel: { type: Boolean, default: !1 }
|
|
75
68
|
},
|
|
76
69
|
{ timestamps: !0 }
|
|
@@ -103,15 +96,15 @@ const g = {
|
|
|
103
96
|
return c.models[t];
|
|
104
97
|
const i = g.createSchema({ mongoose: c, schema: e, virtuals: n });
|
|
105
98
|
return g.applyPlugins(i, [
|
|
106
|
-
r &&
|
|
107
|
-
s &&
|
|
99
|
+
r && j,
|
|
100
|
+
s && $
|
|
108
101
|
]), g.applyMiddlewares(i, u), c.model(t, i);
|
|
109
102
|
},
|
|
110
103
|
validator: {
|
|
111
104
|
isRequired() {
|
|
112
105
|
return function(c) {
|
|
113
106
|
return a(this, null, function* () {
|
|
114
|
-
return !
|
|
107
|
+
return !L.isEmpty(c);
|
|
115
108
|
});
|
|
116
109
|
};
|
|
117
110
|
},
|
|
@@ -135,7 +128,7 @@ const g = {
|
|
|
135
128
|
};
|
|
136
129
|
}
|
|
137
130
|
},
|
|
138
|
-
migrate: h(m({},
|
|
131
|
+
migrate: h(m({}, F), {
|
|
139
132
|
setConfig: (c) => {
|
|
140
133
|
const t = `// This file is automatically generated by the Cyberskill CLI.
|
|
141
134
|
module.exports = ${JSON.stringify(c, null, 4)}`;
|
|
@@ -143,32 +136,32 @@ module.exports = ${JSON.stringify(c, null, 4)}`;
|
|
|
143
136
|
const e = `
|
|
144
137
|
${C}
|
|
145
138
|
`;
|
|
146
|
-
Q(y.GIT_IGNORE) ?
|
|
147
|
-
`).includes(C) ||
|
|
139
|
+
Q(y.GIT_IGNORE) ? H(y.GIT_IGNORE, "utf-8").split(`
|
|
140
|
+
`).includes(C) || k(y.GIT_IGNORE, e) : x(y.GIT_IGNORE, e);
|
|
148
141
|
}
|
|
149
142
|
}),
|
|
150
143
|
regexify(c, t) {
|
|
151
144
|
if (!c)
|
|
152
145
|
return {};
|
|
153
|
-
let e =
|
|
146
|
+
let e = V(c);
|
|
154
147
|
if (!t || t.length === 0)
|
|
155
148
|
return e;
|
|
156
149
|
for (const r of t) {
|
|
157
|
-
const s = r.toString().split("."), n =
|
|
150
|
+
const s = r.toString().split("."), n = v(e, s);
|
|
158
151
|
if (typeof n == "string" && n.length > 0) {
|
|
159
152
|
const u = {
|
|
160
|
-
$regex: `.*${
|
|
153
|
+
$regex: `.*${q(n)}.*`,
|
|
161
154
|
$options: "i"
|
|
162
155
|
};
|
|
163
|
-
e =
|
|
156
|
+
e = P(e, s, u);
|
|
164
157
|
}
|
|
165
158
|
}
|
|
166
159
|
return e;
|
|
167
160
|
}
|
|
168
161
|
};
|
|
169
|
-
class
|
|
162
|
+
class ae {
|
|
170
163
|
constructor(t, e) {
|
|
171
|
-
|
|
164
|
+
N(this, "collection");
|
|
172
165
|
this.collection = t.collection(e);
|
|
173
166
|
}
|
|
174
167
|
createOne(t) {
|
|
@@ -320,7 +313,7 @@ class ie {
|
|
|
320
313
|
});
|
|
321
314
|
}
|
|
322
315
|
}
|
|
323
|
-
class
|
|
316
|
+
class oe {
|
|
324
317
|
constructor(t) {
|
|
325
318
|
this.model = t;
|
|
326
319
|
}
|
|
@@ -395,7 +388,7 @@ class le {
|
|
|
395
388
|
createMany(r) {
|
|
396
389
|
return a(this, arguments, function* (t, e = {}) {
|
|
397
390
|
try {
|
|
398
|
-
return { success: !0, result: (yield this.model.insertMany(t, e)).map((u) => u instanceof
|
|
391
|
+
return { success: !0, result: (yield this.model.insertMany(t, e)).map((u) => u instanceof G ? u.toObject() : null).filter((u) => u !== null) };
|
|
399
392
|
} catch (s) {
|
|
400
393
|
return o(s);
|
|
401
394
|
}
|
|
@@ -459,7 +452,7 @@ class le {
|
|
|
459
452
|
try {
|
|
460
453
|
const s = /* @__PURE__ */ new Set();
|
|
461
454
|
for (let n = 0; n < 10; n++) {
|
|
462
|
-
const u =
|
|
455
|
+
const u = U(t, n + e);
|
|
463
456
|
if (!s.has(u) && (s.add(u), !(yield this.model.exists({ shortId: u }))))
|
|
464
457
|
return { success: !0, result: u };
|
|
465
458
|
}
|
|
@@ -502,7 +495,7 @@ class le {
|
|
|
502
495
|
const n = e[t];
|
|
503
496
|
return D(n) ? { success: !0, result: Object.fromEntries(
|
|
504
497
|
yield Promise.all(
|
|
505
|
-
Object.entries(n).map((
|
|
498
|
+
Object.entries(n).map((_) => a(this, [_], function* ([f, O]) {
|
|
506
499
|
const R = yield this.createUniqueSlug({
|
|
507
500
|
slug: O,
|
|
508
501
|
field: f,
|
|
@@ -529,9 +522,9 @@ class le {
|
|
|
529
522
|
const u = r[e];
|
|
530
523
|
if (D(u)) {
|
|
531
524
|
for (const O of Object.values(u)) {
|
|
532
|
-
const
|
|
525
|
+
const _ = E(O);
|
|
533
526
|
if (yield this.model.exists(this.createSlugQuery({
|
|
534
|
-
slug:
|
|
527
|
+
slug: _,
|
|
535
528
|
field: e,
|
|
536
529
|
isObject: !0,
|
|
537
530
|
filter: s
|
|
@@ -563,9 +556,9 @@ class le {
|
|
|
563
556
|
}
|
|
564
557
|
}
|
|
565
558
|
export {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
559
|
+
ae as MongoController,
|
|
560
|
+
oe as MongooseController,
|
|
561
|
+
de as aggregatePaginate,
|
|
569
562
|
g as mongo,
|
|
570
|
-
|
|
563
|
+
fe as mongoosePaginate
|
|
571
564
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyberskill/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.205.1",
|
|
5
5
|
"description": "CyberSkill Shared",
|
|
6
6
|
"author": "Stephen Cheng",
|
|
7
7
|
"license": "MIT",
|
|
@@ -205,11 +205,11 @@
|
|
|
205
205
|
"test:unit": "tsx src/node/cli/index.ts test:unit"
|
|
206
206
|
},
|
|
207
207
|
"dependencies": {
|
|
208
|
-
"@antfu/eslint-config": "4.16.
|
|
208
|
+
"@antfu/eslint-config": "4.16.2",
|
|
209
209
|
"@apollo/client": "3.13.8",
|
|
210
210
|
"@apollo/client-integration-nextjs": "0.12.2",
|
|
211
211
|
"@apollo/server": "4.12.2",
|
|
212
|
-
"@dotenvx/dotenvx": "1.45.
|
|
212
|
+
"@dotenvx/dotenvx": "1.45.2",
|
|
213
213
|
"@eddeee888/gcg-typescript-resolver-files": "0.12.1",
|
|
214
214
|
"@eslint-react/eslint-plugin": "1.52.2",
|
|
215
215
|
"@graphql-codegen/cli": "5.0.7",
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
"express-session": "1.18.1",
|
|
236
236
|
"express-useragent": "1.0.15",
|
|
237
237
|
"fs-extra": "11.3.0",
|
|
238
|
-
"globals": "16.
|
|
238
|
+
"globals": "16.3.0",
|
|
239
239
|
"graphql": "16.11.0",
|
|
240
240
|
"graphql-upload": "17.0.0",
|
|
241
241
|
"graphql-ws": "6.0.5",
|
|
@@ -247,7 +247,7 @@
|
|
|
247
247
|
"mongoose": "8.16.1",
|
|
248
248
|
"mongoose-aggregate-paginate-v2": "1.1.4",
|
|
249
249
|
"mongoose-paginate-v2": "1.9.1",
|
|
250
|
-
"next-intl": "4.3.
|
|
250
|
+
"next-intl": "4.3.4",
|
|
251
251
|
"node-fetch": "3.3.2",
|
|
252
252
|
"node-persist": "4.0.4",
|
|
253
253
|
"qs": "6.14.0",
|
|
@@ -258,7 +258,7 @@
|
|
|
258
258
|
"slugify": "1.6.6",
|
|
259
259
|
"unorm": "1.6.0",
|
|
260
260
|
"uuid": "11.1.0",
|
|
261
|
-
"vite": "7.0.
|
|
261
|
+
"vite": "7.0.1",
|
|
262
262
|
"ws": "8.18.3",
|
|
263
263
|
"yargs": "18.0.0"
|
|
264
264
|
},
|
|
@@ -281,7 +281,7 @@
|
|
|
281
281
|
"@types/fs-extra": "11.0.4",
|
|
282
282
|
"@types/graphql-upload": "17.0.0",
|
|
283
283
|
"@types/migrate-mongo": "10.0.5",
|
|
284
|
-
"@types/node": "24.0.
|
|
284
|
+
"@types/node": "24.0.10",
|
|
285
285
|
"@types/node-persist": "3.1.8",
|
|
286
286
|
"@types/react": "19.1.8",
|
|
287
287
|
"@types/react-dom": "19.1.6",
|
|
@@ -290,7 +290,7 @@
|
|
|
290
290
|
"@types/ws": "8.18.1",
|
|
291
291
|
"@types/yargs": "17.0.33",
|
|
292
292
|
"@vitest/browser": "3.2.4",
|
|
293
|
-
"eslint": "9.30.
|
|
293
|
+
"eslint": "9.30.1",
|
|
294
294
|
"eslint-config-next": "15.3.4",
|
|
295
295
|
"glob": "11.0.3",
|
|
296
296
|
"lint-staged": "16.1.2",
|
|
@@ -299,7 +299,7 @@
|
|
|
299
299
|
"simple-git-hooks": "2.13.0",
|
|
300
300
|
"tsx": "4.20.3",
|
|
301
301
|
"typescript": "5.8.3",
|
|
302
|
-
"vite": "7.0.
|
|
302
|
+
"vite": "7.0.1",
|
|
303
303
|
"vite-plugin-dts": "4.5.4",
|
|
304
304
|
"vitest": "3.2.4"
|
|
305
305
|
},
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";var yt=Object.defineProperty,xt=Object.defineProperties;var Et=Object.getOwnPropertyDescriptors;var st=Object.getOwnPropertySymbols;var kt=Object.prototype.hasOwnProperty,Lt=Object.prototype.propertyIsEnumerable;var ot=(m,t,e)=>t in m?yt(m,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):m[t]=e,ht=(m,t)=>{for(var e in t||(t={}))kt.call(t,e)&&ot(m,e,t[e]);if(st)for(var e of st(t))Lt.call(t,e)&&ot(m,e,t[e]);return m},lt=(m,t)=>xt(m,Et(t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var B={exports:{}},_t=B.exports,ut;function Ot(){return ut||(ut=1,function(m,t){(function(e,n,r,s){n(t,m)})(_t,function(e,n){Object.getOwnPropertyDescriptors||(Object.getOwnPropertyDescriptors=function(h){return Reflect.ownKeys(h).reduce(function(o,i){return Object.defineProperty(o,i,Object.getOwnPropertyDescriptor(h,i)),o},{})});var r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,a=(h,o)=>{for(var i in o)r(h,i,{get:o[i],enumerable:!0})},d=(h,o,i,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of u(o))!c.call(h,f)&&f!==i&&r(h,f,{get:()=>o[f],enumerable:!(l=s(o,f))||l.enumerable});return h},I=h=>d(r({},"__esModule",{value:!0}),h),j={};a(j,{decode:()=>wt,decodeGeneratedRanges:()=>gt,decodeOriginalScopes:()=>ft,encode:()=>Ct,encodeGeneratedRanges:()=>pt,encodeOriginalScopes:()=>dt}),n.exports=I(j);var P=44,W=59,Y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Q=new Uint8Array(64),X=new Uint8Array(128);for(let h=0;h<Y.length;h++){const o=Y.charCodeAt(h);Q[h]=o,X[o]=h}function S(h,o){let i=0,l=0,f=0;do{const v=h.next();f=X[v],i|=(f&31)<<l,l+=5}while(f&32);const g=i&1;return i>>>=1,g&&(i=-2147483648|-i),o+i}function w(h,o,i){let l=o-i;l=l<0?-l<<1|1:l<<1;do{let f=l&31;l>>>=5,l>0&&(f|=32),h.write(Q[f])}while(l>0);return o}function R(h,o){return h.pos>=o?!1:h.peek()!==P}var Z=1024*16,V=typeof TextDecoder!="undefined"?new TextDecoder:typeof Buffer!="undefined"?{decode(h){return Buffer.from(h.buffer,h.byteOffset,h.byteLength).toString()}}:{decode(h){let o="";for(let i=0;i<h.length;i++)o+=String.fromCharCode(h[i]);return o}},z=class{constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(Z)}write(h){const{buffer:o}=this;o[this.pos++]=h,this.pos===Z&&(this.out+=V.decode(o),this.pos=0)}flush(){const{buffer:h,out:o,pos:i}=this;return i>0?o+V.decode(h.subarray(0,i)):o}},F=class{constructor(h){this.pos=0,this.buffer=h}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(h){const{buffer:o,pos:i}=this,l=o.indexOf(h,i);return l===-1?o.length:l}},tt=[];function ft(h){const{length:o}=h,i=new F(h),l=[],f=[];let g=0;for(;i.pos<o;i.pos++){g=S(i,g);const v=S(i,0);if(!R(i,o)){const k=f.pop();k[2]=g,k[3]=v;continue}const b=S(i,0),C=S(i,0)&1?[g,v,0,0,b,S(i,0)]:[g,v,0,0,b];let E=tt;if(R(i,o)){E=[];do{const k=S(i,0);E.push(k)}while(R(i,o))}C.vars=E,l.push(C),f.push(C)}return l}function dt(h){const o=new z;for(let i=0;i<h.length;)i=et(h,i,o,[0]);return o.flush()}function et(h,o,i,l){const f=h[o],{0:g,1:v,2:b,3:x,4:y,vars:C}=f;o>0&&i.write(P),l[0]=w(i,g,l[0]),w(i,v,0),w(i,y,0);const E=f.length===6?1:0;w(i,E,0),f.length===6&&w(i,f[5],0);for(const k of C)w(i,k,0);for(o++;o<h.length;){const k=h[o],{0:p,1:L}=k;if(p>b||p===b&&L>=x)break;o=et(h,o,i,l)}return i.write(P),l[0]=w(i,b,l[0]),w(i,x,0),o}function gt(h){const{length:o}=h,i=new F(h),l=[],f=[];let g=0,v=0,b=0,x=0,y=0,C=0,E=0,k=0;do{const p=i.indexOf(";");let L=0;for(;i.pos<p;i.pos++){if(L=S(i,L),!R(i,p)){const _=f.pop();_[2]=g,_[3]=L;continue}const O=S(i,0),q=O&1,$=O&2,M=O&4;let rt=null,H=tt,N;if(q){const _=S(i,v);b=S(i,v===_?b:0),v=_,N=[g,L,0,0,_,b]}else N=[g,L,0,0];if(N.isScope=!!M,$){const _=x,A=y;x=S(i,x);const U=_===x;y=S(i,U?y:0),C=S(i,U&&A===y?C:0),rt=[x,y,C]}if(N.callsite=rt,R(i,p)){H=[];do{E=g,k=L;const _=S(i,0);let A;if(_<-1){A=[[S(i,0)]];for(let U=-1;U>_;U--){const St=E;E=S(i,E),k=S(i,E===St?k:0);const vt=S(i,0);A.push([vt,E,k])}}else A=[[_]];H.push(A)}while(R(i,p))}N.bindings=H,l.push(N),f.push(N)}g++,i.pos=p+1}while(i.pos<o);return l}function pt(h){if(h.length===0)return"";const o=new z;for(let i=0;i<h.length;)i=nt(h,i,o,[0,0,0,0,0,0,0]);return o.flush()}function nt(h,o,i,l){const f=h[o],{0:g,1:v,2:b,3:x,isScope:y,callsite:C,bindings:E}=f;l[0]<g?(it(i,l[0],g),l[0]=g,l[1]=0):o>0&&i.write(P),l[1]=w(i,f[1],l[1]);const k=(f.length===6?1:0)|(C?2:0)|(y?4:0);if(w(i,k,0),f.length===6){const{4:p,5:L}=f;p!==l[2]&&(l[3]=0),l[2]=w(i,p,l[2]),l[3]=w(i,L,l[3])}if(C){const{0:p,1:L,2:O}=f.callsite;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])}if(E)for(const p of E){p.length>1&&w(i,-p.length,0);const L=p[0][0];w(i,L,0);let O=g,q=v;for(let $=1;$<p.length;$++){const M=p[$];O=w(i,M[1],O),q=w(i,M[2],q),w(i,M[0],0)}}for(o++;o<h.length;){const p=h[o],{0:L,1:O}=p;if(L>b||L===b&&O>=x)break;o=nt(h,o,i,l)}return l[0]<b?(it(i,l[0],b),l[0]=b,l[1]=0):i.write(P),l[1]=w(i,x,l[1]),o}function it(h,o,i){do h.write(W);while(++o<i)}function wt(h){const{length:o}=h,i=new F(h),l=[];let f=0,g=0,v=0,b=0,x=0;do{const y=i.indexOf(";"),C=[];let E=!0,k=0;for(f=0;i.pos<y;){let p;f=S(i,f),f<k&&(E=!1),k=f,R(i,y)?(g=S(i,g),v=S(i,v),b=S(i,b),R(i,y)?(x=S(i,x),p=[f,g,v,b,x]):p=[f,g,v,b]):p=[f],C.push(p),i.pos++}E||mt(C),l.push(C),i.pos=y+1}while(i.pos<=o);return l}function mt(h){h.sort(bt)}function bt(h,o){return h[0]-o[0]}function Ct(h){const o=new z;let i=0,l=0,f=0,g=0;for(let v=0;v<h.length;v++){const b=h[v];if(v>0&&o.write(W),b.length===0)continue;let x=0;for(let y=0;y<b.length;y++){const C=b[y];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)))}}return o.flush()}})}(B,B.exports)),B.exports}var Rt=Ot();class J{constructor(t){this.bits=t instanceof J?t.bits.slice():[]}add(t){this.bits[t>>5]|=1<<(t&31)}has(t){return!!(this.bits[t>>5]&1<<(t&31))}}class G{constructor(t,e,n){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}appendLeft(t){this.outro+=t}appendRight(t){this.intro=this.intro+t}clone(){const t=new G(this.start,this.end,this.original);return t.intro=this.intro,t.outro=this.outro,t.content=this.content,t.storeName=this.storeName,t.edited=this.edited,t}contains(t){return this.start<t&&t<this.end}eachNext(t){let e=this;for(;e;)t(e),e=e.next}eachPrevious(t){let e=this;for(;e;)t(e),e=e.previous}edit(t,e,n){return this.content=t,n||(this.intro="",this.outro=""),this.storeName=e,this.edited=!0,this}prependLeft(t){this.outro=t+this.outro}prependRight(t){this.intro=t+this.intro}reset(){this.intro="",this.outro="",this.edited&&(this.content=this.original,this.storeName=!1,this.edited=!1)}split(t){const e=t-this.start,n=this.original.slice(0,e),r=this.original.slice(e);this.original=n;const s=new G(t,this.end,r);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}toString(){return this.intro+this.content+this.outro}trimEnd(t){if(this.outro=this.outro.replace(t,""),this.outro.length)return!0;const e=this.content.replace(t,"");if(e.length)return e!==this.content&&(this.split(this.start+e.length).edit("",void 0,!0),this.edited&&this.edit(e,this.storeName,!0)),!0;if(this.edit("",void 0,!0),this.intro=this.intro.replace(t,""),this.intro.length)return!0}trimStart(t){if(this.intro=this.intro.replace(t,""),this.intro.length)return!0;const e=this.content.replace(t,"");if(e.length){if(e!==this.content){const n=this.split(this.end-e.length);this.edited&&n.edit(e,this.storeName,!0),this.edit("",void 0,!0)}return!0}else if(this.edit("",void 0,!0),this.outro=this.outro.replace(t,""),this.outro.length)return!0}}function It(){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"):()=>{throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.")}}const Nt=It();class ct{constructor(t){this.version=3,this.file=t.file,this.sources=t.sources,this.sourcesContent=t.sourcesContent,this.names=t.names,this.mappings=Rt.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)}toString(){return JSON.stringify(this)}toUrl(){return"data:application/json;charset=utf-8;base64,"+Nt(this.toString())}}function jt(m){const t=m.split(`
|
|
2
|
-
`),e=t.filter(s=>/^\t+/.test(s)),n=t.filter(s=>/^ {2,}/.test(s));if(e.length===0&&n.length===0)return null;if(e.length>=n.length)return" ";const r=n.reduce((s,u)=>{const c=/^ +/.exec(u)[0].length;return Math.min(c,s)},1/0);return new Array(r+1).join(" ")}function Pt(m,t){const e=m.split(/[/\\]/),n=t.split(/[/\\]/);for(e.pop();e[0]===n[0];)e.shift(),n.shift();if(e.length){let r=e.length;for(;r--;)e[r]=".."}return e.concat(n).join("/")}const At=Object.prototype.toString;function Tt(m){return At.call(m)==="[object Object]"}function at(m){const t=m.split(`
|
|
3
|
-
`),e=[];for(let n=0,r=0;n<t.length;n++)e.push(r),r+=t[n].length+1;return function(r){let s=0,u=e.length;for(;s<u;){const d=s+u>>1;r<e[d]?u=d:s=d+1}const c=s-1,a=r-e[c];return{line:c,column:a}}}const $t=/\w/;class Mt{constructor(t){this.hires=t,this.generatedCodeLine=0,this.generatedCodeColumn=0,this.raw=[],this.rawSegments=this.raw[this.generatedCodeLine]=[],this.pending=null}addEdit(t,e,n,r){if(e.length){const s=e.length-1;let u=e.indexOf(`
|
|
4
|
-
`,0),c=-1;for(;u>=0&&s>u;){const d=[this.generatedCodeColumn,t,n.line,n.column];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(`
|
|
5
|
-
`,u+1)}const a=[this.generatedCodeColumn,t,n.line,n.column];r>=0&&a.push(r),this.rawSegments.push(a),this.advance(e.slice(c+1))}else this.pending&&(this.rawSegments.push(this.pending),this.advance(e));this.pending=null}addUneditedChunk(t,e,n,r,s){let u=e.start,c=!0,a=!1;for(;u<e.end;){if(n[u]===`
|
|
6
|
-
`)r.line+=1,r.column=0,this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,c=!0,a=!1;else{if(this.hires||c||s.has(u)){const d=[this.generatedCodeColumn,t,r.line,r.column];this.hires==="boundary"?$t.test(n[u])?a||(this.rawSegments.push(d),a=!0):(this.rawSegments.push(d),a=!1):this.rawSegments.push(d)}r.column+=1,this.generatedCodeColumn+=1,c=!1}u+=1}this.pending=null}advance(t){if(!t)return;const e=t.split(`
|
|
7
|
-
`);if(e.length>1){for(let n=0;n<e.length-1;n++)this.generatedCodeLine++,this.raw[this.generatedCodeLine]=this.rawSegments=[];this.generatedCodeColumn=0}this.generatedCodeColumn+=e[e.length-1].length}}const D=`
|
|
8
|
-
`,T={insertLeft:!1,insertRight:!1,storeName:!1};class K{constructor(t,e={}){const n=new G(0,t.length,t);Object.defineProperties(this,{original:{writable:!0,value:t},outro:{writable:!0,value:""},intro:{writable:!0,value:""},firstChunk:{writable:!0,value:n},lastChunk:{writable:!0,value:n},lastSearchedChunk:{writable:!0,value:n},byStart:{writable:!0,value:{}},byEnd:{writable:!0,value:{}},filename:{writable:!0,value:e.filename},indentExclusionRanges:{writable:!0,value:e.indentExclusionRanges},sourcemapLocations:{writable:!0,value:new J},storedNames:{writable:!0,value:{}},indentStr:{writable:!0,value:void 0},ignoreList:{writable:!0,value:e.ignoreList},offset:{writable:!0,value:e.offset||0}}),this.byStart[0]=n,this.byEnd[t.length]=n}addSourcemapLocation(t){this.sourcemapLocations.add(t)}append(t){if(typeof t!="string")throw new TypeError("outro content must be a string");return this.outro+=t,this}appendLeft(t,e){if(t=t+this.offset,typeof e!="string")throw new TypeError("inserted content must be a string");this._split(t);const n=this.byEnd[t];return n?n.appendLeft(e):this.intro+=e,this}appendRight(t,e){if(t=t+this.offset,typeof e!="string")throw new TypeError("inserted content must be a string");this._split(t);const n=this.byStart[t];return n?n.appendRight(e):this.outro+=e,this}clone(){const t=new K(this.original,{filename:this.filename,offset:this.offset});let e=this.firstChunk,n=t.firstChunk=t.lastSearchedChunk=e.clone();for(;e;){t.byStart[n.start]=n,t.byEnd[n.end]=n;const r=e.next,s=r&&r.clone();s&&(n.next=s,s.previous=n,n=s),e=r}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}generateDecodedMap(t){t=t||{};const e=0,n=Object.keys(this.storedNames),r=new Mt(t.hires),s=at(this.original);return this.intro&&r.advance(this.intro),this.firstChunk.eachNext(u=>{const c=s(u.start);u.intro.length&&r.advance(u.intro),u.edited?r.addEdit(e,u.content,c,u.storeName?n.indexOf(u.original):-1):r.addUneditedChunk(e,u,this.original,c,this.sourcemapLocations),u.outro.length&&r.advance(u.outro)}),{file:t.file?t.file.split(/[/\\]/).pop():void 0,sources:[t.source?Pt(t.file||"",t.source):t.file||""],sourcesContent:t.includeContent?[this.original]:void 0,names:n,mappings:r.raw,x_google_ignoreList:this.ignoreList?[e]:void 0}}generateMap(t){return new ct(this.generateDecodedMap(t))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=jt(this.original))}_getRawIndentString(){return this._ensureindentStr(),this.indentStr}getIndentString(){return this._ensureindentStr(),this.indentStr===null?" ":this.indentStr}indent(t,e){const n=/^[^\r\n]/gm;if(Tt(t)&&(e=t,t=void 0),t===void 0&&(this._ensureindentStr(),t=this.indentStr||" "),t==="")return this;e=e||{};const r={};e.exclude&&(typeof e.exclude[0]=="number"?[e.exclude]:e.exclude).forEach(I=>{for(let j=I[0];j<I[1];j+=1)r[j]=!0});let s=e.indentStart!==!1;const u=d=>s?`${t}${d}`:(s=!0,d);this.intro=this.intro.replace(n,u);let c=0,a=this.firstChunk;for(;a;){const d=a.end;if(a.edited)r[c]||(a.content=a.content.replace(n,u),a.content.length&&(s=a.content[a.content.length-1]===`
|
|
9
|
-
`));else for(c=a.start;c<d;){if(!r[c]){const I=this.original[c];I===`
|
|
10
|
-
`?s=!0:I!=="\r"&&s&&(s=!1,c===a.start||(this._splitChunk(a,c),a=a.next),a.prependRight(t))}c+=1}c=a.end,a=a.next}return this.outro=this.outro.replace(n,u),this}insert(){throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)")}insertLeft(t,e){return T.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),T.insertLeft=!0),this.appendLeft(t,e)}insertRight(t,e){return T.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),T.insertRight=!0),this.prependRight(t,e)}move(t,e,n){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");this._split(t),this._split(e),this._split(n);const r=this.byStart[t],s=this.byEnd[e],u=r.previous,c=s.next,a=this.byStart[n];if(!a&&s===this.lastChunk)return this;const d=a?a.previous:this.lastChunk;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}overwrite(t,e,n,r){return r=r||{},this.update(t,e,n,lt(ht({},r),{overwrite:!r.contentOnly}))}update(t,e,n,r){if(t=t+this.offset,e=e+this.offset,typeof n!="string")throw new TypeError("replacement content must be a string");if(this.original.length!==0){for(;t<0;)t+=this.original.length;for(;e<0;)e+=this.original.length}if(e>this.original.length)throw new Error("end is out of bounds");if(t===e)throw new Error("Cannot overwrite a zero-length range – use appendLeft or prependRight instead");this._split(t),this._split(e),r===!0&&(T.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),T.storeName=!0),r={storeName:!0});const s=r!==void 0?r.storeName:!1,u=r!==void 0?r.overwrite:!1;if(s){const d=this.original.slice(t,e);Object.defineProperty(this.storedNames,d,{writable:!0,value:!0,enumerable:!0})}const c=this.byStart[t],a=this.byEnd[e];if(c){let d=c;for(;d!==a;){if(d.next!==this.byStart[d.end])throw new Error("Cannot overwrite across a split point");d=d.next,d.edit("",!1)}c.edit(n,s,!u)}else{const d=new G(t,e,"").edit(n,s);a.next=d,d.previous=a}return this}prepend(t){if(typeof t!="string")throw new TypeError("outro content must be a string");return this.intro=t+this.intro,this}prependLeft(t,e){if(t=t+this.offset,typeof e!="string")throw new TypeError("inserted content must be a string");this._split(t);const n=this.byEnd[t];return n?n.prependLeft(e):this.intro=e+this.intro,this}prependRight(t,e){if(t=t+this.offset,typeof e!="string")throw new TypeError("inserted content must be a string");this._split(t);const n=this.byStart[t];return n?n.prependRight(e):this.outro=e+this.outro,this}remove(t,e){if(t=t+this.offset,e=e+this.offset,this.original.length!==0){for(;t<0;)t+=this.original.length;for(;e<0;)e+=this.original.length}if(t===e)return this;if(t<0||e>this.original.length)throw new Error("Character is out of bounds");if(t>e)throw new Error("end must be greater than start");this._split(t),this._split(e);let n=this.byStart[t];for(;n;)n.intro="",n.outro="",n.edit(""),n=e>n.end?this.byStart[n.end]:null;return this}reset(t,e){if(t=t+this.offset,e=e+this.offset,this.original.length!==0){for(;t<0;)t+=this.original.length;for(;e<0;)e+=this.original.length}if(t===e)return this;if(t<0||e>this.original.length)throw new Error("Character is out of bounds");if(t>e)throw new Error("end must be greater than start");this._split(t),this._split(e);let n=this.byStart[t];for(;n;)n.reset(),n=e>n.end?this.byStart[n.end]:null;return this}lastChar(){if(this.outro.length)return this.outro[this.outro.length-1];let t=this.lastChunk;do{if(t.outro.length)return t.outro[t.outro.length-1];if(t.content.length)return t.content[t.content.length-1];if(t.intro.length)return t.intro[t.intro.length-1]}while(t=t.previous);return this.intro.length?this.intro[this.intro.length-1]:""}lastLine(){let t=this.outro.lastIndexOf(D);if(t!==-1)return this.outro.substr(t+1);let e=this.outro,n=this.lastChunk;do{if(n.outro.length>0){if(t=n.outro.lastIndexOf(D),t!==-1)return n.outro.substr(t+1)+e;e=n.outro+e}if(n.content.length>0){if(t=n.content.lastIndexOf(D),t!==-1)return n.content.substr(t+1)+e;e=n.content+e}if(n.intro.length>0){if(t=n.intro.lastIndexOf(D),t!==-1)return n.intro.substr(t+1)+e;e=n.intro+e}}while(n=n.previous);return t=this.intro.lastIndexOf(D),t!==-1?this.intro.substr(t+1)+e:this.intro+e}slice(t=0,e=this.original.length-this.offset){if(t=t+this.offset,e=e+this.offset,this.original.length!==0){for(;t<0;)t+=this.original.length;for(;e<0;)e+=this.original.length}let n="",r=this.firstChunk;for(;r&&(r.start>t||r.end<=t);){if(r.start<e&&r.end>=e)return n;r=r.next}if(r&&r.edited&&r.start!==t)throw new Error(`Cannot use replaced character ${t} as slice start anchor.`);const s=r;for(;r;){r.intro&&(s!==r||r.start===t)&&(n+=r.intro);const u=r.start<e&&r.end>=e;if(u&&r.edited&&r.end!==e)throw new Error(`Cannot use replaced character ${e} as slice end anchor.`);const c=s===r?t-r.start:0,a=u?r.content.length+e-r.end:r.content.length;if(n+=r.content.slice(c,a),r.outro&&(!u||r.end===e)&&(n+=r.outro),u)break;r=r.next}return n}snip(t,e){const n=this.clone();return n.remove(0,t),n.remove(e,n.original.length),n}_split(t){if(this.byStart[t]||this.byEnd[t])return;let e=this.lastSearchedChunk;const n=t>e.end;for(;e;){if(e.contains(t))return this._splitChunk(e,t);e=n?this.byStart[e.end]:this.byEnd[e.start]}}_splitChunk(t,e){if(t.edited&&t.content.length){const r=at(this.original)(e);throw new Error(`Cannot split a chunk that has already been edited (${r.line}:${r.column} – "${t.original}")`)}const n=t.split(e);return this.byEnd[e]=t,this.byStart[e]=n,this.byEnd[n.end]=n,t===this.lastChunk&&(this.lastChunk=n),this.lastSearchedChunk=t,!0}toString(){let t=this.intro,e=this.firstChunk;for(;e;)t+=e.toString(),e=e.next;return t+this.outro}isEmpty(){let t=this.firstChunk;do if(t.intro.length&&t.intro.trim()||t.content.length&&t.content.trim()||t.outro.length&&t.outro.trim())return!1;while(t=t.next);return!0}length(){let t=this.firstChunk,e=0;do e+=t.intro.length+t.content.length+t.outro.length;while(t=t.next);return e}trimLines(){return this.trim("[\\r\\n]")}trim(t){return this.trimStart(t).trimEnd(t)}trimEndAborted(t){const e=new RegExp((t||"\\s")+"+$");if(this.outro=this.outro.replace(e,""),this.outro.length)return!0;let n=this.lastChunk;do{const r=n.end,s=n.trimEnd(e);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;n=n.previous}while(n);return!1}trimEnd(t){return this.trimEndAborted(t),this}trimStartAborted(t){const e=new RegExp("^"+(t||"\\s")+"+");if(this.intro=this.intro.replace(e,""),this.intro.length)return!0;let n=this.firstChunk;do{const r=n.end,s=n.trimStart(e);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;n=n.next}while(n);return!1}trimStart(t){return this.trimStartAborted(t),this}hasChanged(){return this.original!==this.toString()}_replaceRegexp(t,e){function n(s,u){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)}function r(s,u){let c;const a=[];for(;c=s.exec(u);)a.push(c);return a}if(t.global)r(t,this.original).forEach(u=>{if(u.index!=null){const c=n(u,this.original);c!==u[0]&&this.overwrite(u.index,u.index+u[0].length,c)}});else{const s=this.original.match(t);if(s&&s.index!=null){const u=n(s,this.original);u!==s[0]&&this.overwrite(s.index,s.index+s[0].length,u)}}return this}_replaceString(t,e){const{original:n}=this,r=n.indexOf(t);return r!==-1&&this.overwrite(r,r+t.length,e),this}replace(t,e){return typeof t=="string"?this._replaceString(t,e):this._replaceRegexp(t,e)}_replaceAllString(t,e){const{original:n}=this,r=t.length;for(let s=n.indexOf(t);s!==-1;s=n.indexOf(t,s+r))n.slice(s,s+r)!==e&&this.overwrite(s,s+r,e);return this}replaceAll(t,e){if(typeof t=="string")return this._replaceAllString(t,e);if(!t.global)throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");return this._replaceRegexp(t,e)}}exports.SourceMap=ct;exports.default=K;
|