@cyberskill/shared 1.203.0 → 1.205.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 (89) hide show
  1. package/dist/config.util-Ci2CZDut.cjs +1 -0
  2. package/dist/config.util-DKBwEBKR.js +61 -0
  3. package/dist/log.type-CMvG6Box.cjs +1 -0
  4. package/dist/{src/node/log/log.type.js → log.type-DTOvZHyz.js} +1 -1
  5. package/dist/magic-string.es-C6Zk6wMx.js +671 -0
  6. package/dist/magic-string.es-CjWtD8Pa.cjs +10 -0
  7. package/dist/path.constant-CWtb99gS.cjs +2 -0
  8. package/dist/{path.constant-DJq0jtD0.js → path.constant-CvSr0Rrx.js} +186 -185
  9. package/dist/src/config/config.util.cjs +1 -1
  10. package/dist/src/config/config.util.js +7 -58
  11. package/dist/src/config/eslint/index.d.ts +8 -0
  12. package/dist/src/config/index.cjs +1 -1
  13. package/dist/src/config/index.js +2 -3
  14. package/dist/src/config/vitest/vitest.unit.cjs +1 -1
  15. package/dist/src/config/vitest/vitest.unit.js +1 -1
  16. package/dist/src/config/vitest/vitest.unit.setup.cjs +1 -1
  17. package/dist/src/config/vitest/vitest.unit.setup.js +1 -1
  18. package/dist/src/node/cli/cli.util.cjs +1 -1
  19. package/dist/src/node/cli/cli.util.js +15 -15
  20. package/dist/src/node/command/command.util.cjs +1 -1
  21. package/dist/src/node/command/command.util.js +2 -2
  22. package/dist/src/node/command/index.cjs +1 -1
  23. package/dist/src/node/command/index.js +6 -7
  24. package/dist/src/node/log/index.cjs +1 -1
  25. package/dist/src/node/log/index.js +5 -5
  26. package/dist/src/node/mongo/index.cjs +1 -1
  27. package/dist/src/node/mongo/index.js +24 -15
  28. package/dist/src/node/mongo/mongo.util.cjs +5 -5
  29. package/dist/src/node/mongo/mongo.util.d.ts +1 -4
  30. package/dist/src/node/mongo/mongo.util.js +47 -54
  31. package/dist/src/node/package/index.cjs +1 -1
  32. package/dist/src/node/package/index.js +5 -6
  33. package/dist/src/node/package/package.util.cjs +1 -1
  34. package/dist/src/node/package/package.util.js +5 -6
  35. package/dist/src/node/path/index.cjs +1 -1
  36. package/dist/src/node/path/index.js +1 -1
  37. package/dist/src/node/path/path.constant.cjs +1 -1
  38. package/dist/src/node/path/path.constant.js +43 -45
  39. package/dist/src/node/upload/index.cjs +1 -1
  40. package/dist/src/node/upload/index.js +3 -4
  41. package/dist/src/node/upload/upload.util.cjs +1 -1
  42. package/dist/src/node/upload/upload.util.js +6 -157
  43. package/dist/upload.util-CE3MjBdh.cjs +1 -0
  44. package/dist/upload.util-D4aUdmPo.js +160 -0
  45. package/package.json +11 -11
  46. package/dist/magic-string.es-D_iPNVbJ.cjs +0 -10
  47. package/dist/magic-string.es-cELbkQ5L.js +0 -901
  48. package/dist/path.constant-CPGOAxEp.cjs +0 -2
  49. package/dist/src/config/config.type.cjs +0 -1
  50. package/dist/src/config/config.type.js +0 -4
  51. package/dist/src/config/env/env.type.cjs +0 -1
  52. package/dist/src/config/env/env.type.js +0 -1
  53. package/dist/src/config/graphql-codegen/graphql-codegen.type.cjs +0 -1
  54. package/dist/src/config/graphql-codegen/graphql-codegen.type.js +0 -1
  55. package/dist/src/node/apollo-server/apollo-server.type.cjs +0 -1
  56. package/dist/src/node/apollo-server/apollo-server.type.js +0 -1
  57. package/dist/src/node/command/command.type.cjs +0 -1
  58. package/dist/src/node/command/command.type.js +0 -4
  59. package/dist/src/node/express/express.type.cjs +0 -1
  60. package/dist/src/node/express/express.type.js +0 -4
  61. package/dist/src/node/fs/fs.type.cjs +0 -1
  62. package/dist/src/node/fs/fs.type.js +0 -1
  63. package/dist/src/node/log/log.type.cjs +0 -1
  64. package/dist/src/node/mongo/mongo.type.cjs +0 -1
  65. package/dist/src/node/mongo/mongo.type.js +0 -16
  66. package/dist/src/node/package/package.type.cjs +0 -1
  67. package/dist/src/node/package/package.type.js +0 -4
  68. package/dist/src/node/upload/upload.type.cjs +0 -1
  69. package/dist/src/node/upload/upload.type.js +0 -4
  70. package/dist/src/node/ws/ws.type.cjs +0 -1
  71. package/dist/src/node/ws/ws.type.js +0 -1
  72. package/dist/src/react/apollo-client/apollo-client.type.cjs +0 -1
  73. package/dist/src/react/apollo-client/apollo-client.type.js +0 -1
  74. package/dist/src/react/apollo-error/apollo-error.type.cjs +0 -1
  75. package/dist/src/react/apollo-error/apollo-error.type.js +0 -1
  76. package/dist/src/react/loading/loading.type.cjs +0 -1
  77. package/dist/src/react/loading/loading.type.js +0 -1
  78. package/dist/src/react/log/log.type.cjs +0 -1
  79. package/dist/src/react/log/log.type.js +0 -1
  80. package/dist/src/react/next-intl/next-intl.type.cjs +0 -1
  81. package/dist/src/react/next-intl/next-intl.type.js +0 -1
  82. package/dist/src/react/userback/userback.type.cjs +0 -1
  83. package/dist/src/react/userback/userback.type.js +0 -1
  84. package/dist/src/util/common/common.type.cjs +0 -1
  85. package/dist/src/util/common/common.type.js +0 -1
  86. package/dist/src/util/serializer/serializer.type.cjs +0 -1
  87. package/dist/src/util/serializer/serializer.type.js +0 -1
  88. package/dist/src/util/string/string.type.cjs +0 -1
  89. package/dist/src/util/string/string.type.js +0 -1
@@ -1,159 +1,8 @@
1
- var v = Object.defineProperty;
2
- var x = Object.getOwnPropertySymbols;
3
- var z = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable;
4
- var E = (s, i, e) => i in s ? v(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e, p = (s, i) => {
5
- for (var e in i || (i = {}))
6
- z.call(i, e) && E(s, e, i[e]);
7
- if (x)
8
- for (var e of x(i))
9
- y.call(i, e) && E(s, e, i[e]);
10
- return s;
11
- };
12
- var g = (s, i, e) => new Promise((t, a) => {
13
- var n = (o) => {
14
- try {
15
- l(e.next(o));
16
- } catch (c) {
17
- a(c);
18
- }
19
- }, r = (o) => {
20
- try {
21
- l(e.throw(o));
22
- } catch (c) {
23
- a(c);
24
- }
25
- }, l = (o) => o.done ? t(o.value) : Promise.resolve(o.value).then(n, r);
26
- l((e = e.apply(s, i)).next());
27
- });
28
- import { pathExistsSync as L, mkdirSync as C, createWriteStream as I } from "../fs/fs.util.js";
29
- import "../../../path.constant-DJq0jtD0.js";
30
- import { dirname as S } from "../path/path.util.js";
31
- import { E_UploadType as f } from "./upload.type.js";
32
- function h(s) {
33
- return g(this, null, function* () {
34
- return new Promise((i, e) => {
35
- let t = 0;
36
- s.on("data", (a) => {
37
- t += a.length;
38
- }), s.on("end", () => i(t)), s.on("error", e);
39
- });
40
- });
41
- }
42
- function F(s, i) {
43
- const e = s.lastIndexOf(".");
44
- if (e === -1)
45
- return !1;
46
- const t = s.substring(e + 1).toLowerCase();
47
- return i.includes(t);
48
- }
49
- function M(s, i, e) {
50
- const { filename: t, fileSize: a } = s, n = i[e], { allowedExtensions: r, sizeLimit: l } = n;
51
- if (!F(t, r))
52
- return {
53
- isValid: !1,
54
- error: `File extension not allowed for ${e.toLowerCase()} files. Allowed extensions: ${r.join(", ")}`
55
- };
56
- if (a !== void 0 && a > l) {
57
- const o = Math.round(l / 1048576);
58
- return {
59
- isValid: !1,
60
- error: `File size exceeds limit for ${e.toLowerCase()} files. Maximum size: ${o}MB`
61
- };
62
- }
63
- return { isValid: !0 };
64
- }
65
- function A(s) {
66
- const i = {
67
- [f.IMAGE]: {
68
- allowedExtensions: ["jpg", "jpeg", "png", "gif", "webp", "svg"],
69
- sizeLimit: 5242880
70
- // 5MB
71
- },
72
- [f.VIDEO]: {
73
- allowedExtensions: ["mp4", "avi", "mov", "wmv", "flv", "webm"],
74
- sizeLimit: 524288e3
75
- // 500MB
76
- },
77
- [f.DOCUMENT]: {
78
- allowedExtensions: ["pdf", "doc", "docx", "txt", "rtf"],
79
- sizeLimit: 10485760
80
- // 10MB
81
- },
82
- [f.OTHER]: {
83
- allowedExtensions: ["zip", "rar", "tar", "gz"],
84
- sizeLimit: 5242880
85
- // 5MB
86
- }
87
- };
88
- return p(p({}, i), s);
89
- }
90
- function T(s) {
91
- return g(this, null, function* () {
92
- const { path: i, file: e, config: t, type: a } = s;
93
- if (!i || typeof i != "string")
94
- return {
95
- success: !1,
96
- message: "Invalid path provided",
97
- result: ""
98
- };
99
- if (!e || typeof e != "object")
100
- return {
101
- success: !1,
102
- message: "Invalid file provided",
103
- result: ""
104
- };
105
- if (t) {
106
- const n = [f.IMAGE, f.VIDEO, f.DOCUMENT, f.OTHER];
107
- for (const r of n) {
108
- if (!t[r] || !Array.isArray(t[r].allowedExtensions) || t[r].allowedExtensions.length === 0)
109
- return {
110
- success: !1,
111
- message: `Invalid config for ${r.toLowerCase()} files`,
112
- result: ""
113
- };
114
- if (typeof t[r].sizeLimit != "number" || t[r].sizeLimit <= 0)
115
- return {
116
- success: !1,
117
- message: `Invalid size limit for ${r.toLowerCase()} files`,
118
- result: ""
119
- };
120
- }
121
- }
122
- try {
123
- const n = yield (yield e).file, { filename: r, createReadStream: l } = n;
124
- if (t) {
125
- const m = l(), d = yield h(m), w = M(
126
- { filename: r, fileSize: d },
127
- t,
128
- a
129
- );
130
- if (!w.isValid)
131
- return {
132
- success: !1,
133
- message: w.error || "File validation failed",
134
- result: ""
135
- };
136
- }
137
- const o = S(i);
138
- L(o) || C(o, { recursive: !0 });
139
- const c = l(), u = I(i);
140
- return c.pipe(u), yield new Promise((m, d) => {
141
- u.on("finish", () => m()), u.on("error", d), c.on("error", d);
142
- }), {
143
- success: !0,
144
- message: "File uploaded successfully",
145
- result: i
146
- };
147
- } catch (n) {
148
- return {
149
- success: !1,
150
- message: n instanceof Error ? n.message : "File upload failed",
151
- result: ""
152
- };
153
- }
154
- });
155
- }
1
+ import "../fs/fs.util.js";
2
+ import "../../../path.constant-CvSr0Rrx.js";
3
+ import "../path/path.util.js";
4
+ import { c as i, u as m } from "../../../upload.util-D4aUdmPo.js";
156
5
  export {
157
- A as createUploadConfig,
158
- T as upload
6
+ i as createUploadConfig,
7
+ m as upload
159
8
  };
@@ -0,0 +1 @@
1
+ "use strict";var z=Object.defineProperty;var x=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var v=(e,i,s)=>i in e?z(e,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[i]=s,g=(e,i)=>{for(var s in i||(i={}))I.call(i,s)&&v(e,s,i[s]);if(x)for(var s of x(i))C.call(i,s)&&v(e,s,i[s]);return e};var w=(e,i,s)=>new Promise((t,l)=>{var o=n=>{try{f(s.next(n))}catch(c){l(c)}},r=n=>{try{f(s.throw(n))}catch(c){l(c)}},f=n=>n.done?t(n.value):Promise.resolve(n.value).then(o,r);f((s=s.apply(e,i)).next())});const E=require("./src/node/fs/fs.util.cjs");require("./path.constant-CWtb99gS.cjs");const O=require("./src/node/path/path.util.cjs");var a=(e=>(e.IMAGE="IMAGE",e.VIDEO="VIDEO",e.DOCUMENT="DOCUMENT",e.OTHER="OTHER",e))(a||{});function L(e){return w(this,null,function*(){return new Promise((i,s)=>{let t=0;e.on("data",l=>{t+=l.length}),e.on("end",()=>i(t)),e.on("error",s)})})}function M(e,i){const s=e.lastIndexOf(".");if(s===-1)return!1;const t=e.substring(s+1).toLowerCase();return i.includes(t)}function y(e,i,s){const{filename:t,fileSize:l}=e,o=i[s],{allowedExtensions:r,sizeLimit:f}=o;if(!M(t,r))return{isValid:!1,error:`File extension not allowed for ${s.toLowerCase()} files. Allowed extensions: ${r.join(", ")}`};if(l!==void 0&&l>f){const n=Math.round(f/1048576);return{isValid:!1,error:`File size exceeds limit for ${s.toLowerCase()} files. Maximum size: ${n}MB`}}return{isValid:!0}}function h(e){const i={[a.IMAGE]:{allowedExtensions:["jpg","jpeg","png","gif","webp","svg"],sizeLimit:5242880},[a.VIDEO]:{allowedExtensions:["mp4","avi","mov","wmv","flv","webm"],sizeLimit:524288e3},[a.DOCUMENT]:{allowedExtensions:["pdf","doc","docx","txt","rtf"],sizeLimit:10485760},[a.OTHER]:{allowedExtensions:["zip","rar","tar","gz"],sizeLimit:5242880}};return g(g({},i),e)}function D(e){return w(this,null,function*(){const{path:i,file:s,config:t,type:l}=e;if(!i||typeof i!="string")return{success:!1,message:"Invalid path provided",result:""};if(!s||typeof s!="object")return{success:!1,message:"Invalid file provided",result:""};if(t){const o=[a.IMAGE,a.VIDEO,a.DOCUMENT,a.OTHER];for(const r of o){if(!t[r]||!Array.isArray(t[r].allowedExtensions)||t[r].allowedExtensions.length===0)return{success:!1,message:`Invalid config for ${r.toLowerCase()} files`,result:""};if(typeof t[r].sizeLimit!="number"||t[r].sizeLimit<=0)return{success:!1,message:`Invalid size limit for ${r.toLowerCase()} files`,result:""}}}try{const o=yield(yield s).file,{filename:r,createReadStream:f}=o;if(t){const m=f(),u=yield L(m),p=y({filename:r,fileSize:u},t,l);if(!p.isValid)return{success:!1,message:p.error||"File validation failed",result:""}}const n=O.dirname(i);E.pathExistsSync(n)||E.mkdirSync(n,{recursive:!0});const c=f(),d=E.createWriteStream(i);return c.pipe(d),yield new Promise((m,u)=>{d.on("finish",()=>m()),d.on("error",u),c.on("error",u)}),{success:!0,message:"File uploaded successfully",result:i}}catch(o){return{success:!1,message:o instanceof Error?o.message:"File upload failed",result:""}}})}exports.E_UploadType=a;exports.createUploadConfig=h;exports.upload=D;
@@ -0,0 +1,160 @@
1
+ var v = Object.defineProperty;
2
+ var p = Object.getOwnPropertySymbols;
3
+ var z = Object.prototype.hasOwnProperty, I = Object.prototype.propertyIsEnumerable;
4
+ var x = (e, i, s) => i in e ? v(e, i, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[i] = s, g = (e, i) => {
5
+ for (var s in i || (i = {}))
6
+ z.call(i, s) && x(e, s, i[s]);
7
+ if (p)
8
+ for (var s of p(i))
9
+ I.call(i, s) && x(e, s, i[s]);
10
+ return e;
11
+ };
12
+ var w = (e, i, s) => new Promise((t, a) => {
13
+ var o = (n) => {
14
+ try {
15
+ l(s.next(n));
16
+ } catch (c) {
17
+ a(c);
18
+ }
19
+ }, r = (n) => {
20
+ try {
21
+ l(s.throw(n));
22
+ } catch (c) {
23
+ a(c);
24
+ }
25
+ }, l = (n) => n.done ? t(n.value) : Promise.resolve(n.value).then(o, r);
26
+ l((s = s.apply(e, i)).next());
27
+ });
28
+ import { pathExistsSync as O, mkdirSync as C, createWriteStream as L } from "./src/node/fs/fs.util.js";
29
+ import "./path.constant-CvSr0Rrx.js";
30
+ import { dirname as M } from "./src/node/path/path.util.js";
31
+ var f = /* @__PURE__ */ ((e) => (e.IMAGE = "IMAGE", e.VIDEO = "VIDEO", e.DOCUMENT = "DOCUMENT", e.OTHER = "OTHER", e))(f || {});
32
+ function y(e) {
33
+ return w(this, null, function* () {
34
+ return new Promise((i, s) => {
35
+ let t = 0;
36
+ e.on("data", (a) => {
37
+ t += a.length;
38
+ }), e.on("end", () => i(t)), e.on("error", s);
39
+ });
40
+ });
41
+ }
42
+ function D(e, i) {
43
+ const s = e.lastIndexOf(".");
44
+ if (s === -1)
45
+ return !1;
46
+ const t = e.substring(s + 1).toLowerCase();
47
+ return i.includes(t);
48
+ }
49
+ function S(e, i, s) {
50
+ const { filename: t, fileSize: a } = e, o = i[s], { allowedExtensions: r, sizeLimit: l } = o;
51
+ if (!D(t, r))
52
+ return {
53
+ isValid: !1,
54
+ error: `File extension not allowed for ${s.toLowerCase()} files. Allowed extensions: ${r.join(", ")}`
55
+ };
56
+ if (a !== void 0 && a > l) {
57
+ const n = Math.round(l / 1048576);
58
+ return {
59
+ isValid: !1,
60
+ error: `File size exceeds limit for ${s.toLowerCase()} files. Maximum size: ${n}MB`
61
+ };
62
+ }
63
+ return { isValid: !0 };
64
+ }
65
+ function R(e) {
66
+ const i = {
67
+ [f.IMAGE]: {
68
+ allowedExtensions: ["jpg", "jpeg", "png", "gif", "webp", "svg"],
69
+ sizeLimit: 5242880
70
+ // 5MB
71
+ },
72
+ [f.VIDEO]: {
73
+ allowedExtensions: ["mp4", "avi", "mov", "wmv", "flv", "webm"],
74
+ sizeLimit: 524288e3
75
+ // 500MB
76
+ },
77
+ [f.DOCUMENT]: {
78
+ allowedExtensions: ["pdf", "doc", "docx", "txt", "rtf"],
79
+ sizeLimit: 10485760
80
+ // 10MB
81
+ },
82
+ [f.OTHER]: {
83
+ allowedExtensions: ["zip", "rar", "tar", "gz"],
84
+ sizeLimit: 5242880
85
+ // 5MB
86
+ }
87
+ };
88
+ return g(g({}, i), e);
89
+ }
90
+ function $(e) {
91
+ return w(this, null, function* () {
92
+ const { path: i, file: s, config: t, type: a } = e;
93
+ if (!i || typeof i != "string")
94
+ return {
95
+ success: !1,
96
+ message: "Invalid path provided",
97
+ result: ""
98
+ };
99
+ if (!s || typeof s != "object")
100
+ return {
101
+ success: !1,
102
+ message: "Invalid file provided",
103
+ result: ""
104
+ };
105
+ if (t) {
106
+ const o = [f.IMAGE, f.VIDEO, f.DOCUMENT, f.OTHER];
107
+ for (const r of o) {
108
+ if (!t[r] || !Array.isArray(t[r].allowedExtensions) || t[r].allowedExtensions.length === 0)
109
+ return {
110
+ success: !1,
111
+ message: `Invalid config for ${r.toLowerCase()} files`,
112
+ result: ""
113
+ };
114
+ if (typeof t[r].sizeLimit != "number" || t[r].sizeLimit <= 0)
115
+ return {
116
+ success: !1,
117
+ message: `Invalid size limit for ${r.toLowerCase()} files`,
118
+ result: ""
119
+ };
120
+ }
121
+ }
122
+ try {
123
+ const o = yield (yield s).file, { filename: r, createReadStream: l } = o;
124
+ if (t) {
125
+ const m = l(), u = yield y(m), E = S(
126
+ { filename: r, fileSize: u },
127
+ t,
128
+ a
129
+ );
130
+ if (!E.isValid)
131
+ return {
132
+ success: !1,
133
+ message: E.error || "File validation failed",
134
+ result: ""
135
+ };
136
+ }
137
+ const n = M(i);
138
+ O(n) || C(n, { recursive: !0 });
139
+ const c = l(), d = L(i);
140
+ return c.pipe(d), yield new Promise((m, u) => {
141
+ d.on("finish", () => m()), d.on("error", u), c.on("error", u);
142
+ }), {
143
+ success: !0,
144
+ message: "File uploaded successfully",
145
+ result: i
146
+ };
147
+ } catch (o) {
148
+ return {
149
+ success: !1,
150
+ message: o instanceof Error ? o.message : "File upload failed",
151
+ result: ""
152
+ };
153
+ }
154
+ });
155
+ }
156
+ export {
157
+ f as E,
158
+ R as c,
159
+ $ as u
160
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cyberskill/shared",
3
3
  "type": "module",
4
- "version": "1.203.0",
4
+ "version": "1.205.0",
5
5
  "description": "CyberSkill Shared",
6
6
  "author": "Stephen Cheng",
7
7
  "license": "MIT",
@@ -205,12 +205,13 @@
205
205
  "test:unit": "tsx src/node/cli/index.ts test:unit"
206
206
  },
207
207
  "dependencies": {
208
- "@antfu/eslint-config": "4.16.1",
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.1",
212
+ "@dotenvx/dotenvx": "1.45.2",
213
213
  "@eddeee888/gcg-typescript-resolver-files": "0.12.1",
214
+ "@eslint-react/eslint-plugin": "1.52.2",
214
215
  "@graphql-codegen/cli": "5.0.7",
215
216
  "@graphql-codegen/client-preset": "4.8.3",
216
217
  "@nestjs/common": "11.1.3",
@@ -227,11 +228,14 @@
227
228
  "crypto-js": "4.2.0",
228
229
  "date-fns": "4.1.0",
229
230
  "envalid": "8.0.0",
231
+ "eslint-plugin-format": "1.0.1",
232
+ "eslint-plugin-react-hooks": "5.2.0",
233
+ "eslint-plugin-react-refresh": "0.4.20",
230
234
  "express": "4.21.2",
231
235
  "express-session": "1.18.1",
232
236
  "express-useragent": "1.0.15",
233
237
  "fs-extra": "11.3.0",
234
- "globals": "16.2.0",
238
+ "globals": "16.3.0",
235
239
  "graphql": "16.11.0",
236
240
  "graphql-upload": "17.0.0",
237
241
  "graphql-ws": "6.0.5",
@@ -243,7 +247,7 @@
243
247
  "mongoose": "8.16.1",
244
248
  "mongoose-aggregate-paginate-v2": "1.1.4",
245
249
  "mongoose-paginate-v2": "1.9.1",
246
- "next-intl": "4.3.1",
250
+ "next-intl": "4.3.4",
247
251
  "node-fetch": "3.3.2",
248
252
  "node-persist": "4.0.4",
249
253
  "qs": "6.14.0",
@@ -261,7 +265,6 @@
261
265
  "devDependencies": {
262
266
  "@commitlint/cli": "19.8.1",
263
267
  "@commitlint/config-conventional": "19.8.1",
264
- "@eslint-react/eslint-plugin": "1.52.2",
265
268
  "@eslint/config-inspector": "1.1.0",
266
269
  "@microsoft/api-extractor": "7.52.8",
267
270
  "@next/eslint-plugin-next": "15.3.4",
@@ -278,7 +281,7 @@
278
281
  "@types/fs-extra": "11.0.4",
279
282
  "@types/graphql-upload": "17.0.0",
280
283
  "@types/migrate-mongo": "10.0.5",
281
- "@types/node": "24.0.7",
284
+ "@types/node": "24.0.10",
282
285
  "@types/node-persist": "3.1.8",
283
286
  "@types/react": "19.1.8",
284
287
  "@types/react-dom": "19.1.6",
@@ -287,11 +290,8 @@
287
290
  "@types/ws": "8.18.1",
288
291
  "@types/yargs": "17.0.33",
289
292
  "@vitest/browser": "3.2.4",
290
- "eslint": "9.30.0",
293
+ "eslint": "9.30.1",
291
294
  "eslint-config-next": "15.3.4",
292
- "eslint-plugin-format": "1.0.1",
293
- "eslint-plugin-react-hooks": "5.2.0",
294
- "eslint-plugin-react-refresh": "0.4.20",
295
295
  "glob": "11.0.3",
296
296
  "lint-staged": "16.1.2",
297
297
  "node-modules-inspector": "1.0.0",
@@ -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;