@platforma-sdk/block-tools 2.8.4 → 2.9.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.
@@ -1,109 +1,100 @@
1
1
  import e from "node:path";
2
2
  import * as t from "node:fs";
3
- import { z as n } from "zod";
4
- import r from "node:fs/promises";
5
- import * as i from "mime-types";
6
- import * as a from "tar";
7
- import { tryResolve as o } from "@milaboratories/resolve-helper";
8
- import { AnyChannel as s, BlockComponents as c, BlockComponentsManifest as l, BlockPackDescriptionFromPackageJsonRaw as u, BlockPackDescriptionManifest as d, BlockPackIdNoVersion as f, BlockPackManifest as p, BlockPackManifestFile as m, BlockPackMeta as h, BlockPackMetaEmbeddedBase64 as g, BlockPackMetaEmbeddedBytes as _, ContentAbsoluteBinaryLocal as v, ContentAbsoluteFolder as y, ContentAbsoluteTextLocal as b, ContentRelative as x, ContentRelativeBinary as S, ContentRelativeText as C, CreateBlockPackDescriptionSchema as w, DescriptionContentBinary as ee, DescriptionContentText as te, SemVer as T, Sha256Schema as E, VersionWithChannels as ne, addPrefixToRelative as re, blockPackIdNoVersionEquals as ie, blockPackIdToString as ae, mapRemoteToAbsolute as oe } from "@milaboratories/pl-model-middle-layer";
9
- import { extractConfigGeneric as se } from "@milaboratories/pl-model-common";
10
- import { gunzip as ce, gunzipSync as le, gzip as ue } from "node:zlib";
11
- import { createHash as de, randomUUID as fe } from "node:crypto";
12
- import { ConsoleLoggerAdapter as pe, Retry2TimesWithDelay as D, notEmpty as me, retry as O } from "@milaboratories/ts-helpers";
13
- import { promisify as he } from "node:util";
14
- import ge from "canonicalize";
15
- import { LRUCache as _e } from "lru-cache";
16
- import k from "node:path/posix";
17
- import { S3 as ve, paginateListObjectsV2 as ye } from "@aws-sdk/client-s3";
18
- import { request as be } from "undici";
19
- import { defaultHttpDispatcher as xe } from "@milaboratories/pl-http";
20
- import Se from "yaml";
21
- import * as Ce from "node:os";
3
+ import n from "node:fs/promises";
4
+ import * as r from "mime-types";
5
+ import * as i from "tar";
6
+ import { tryResolve as a } from "@milaboratories/resolve-helper";
7
+ import { AnyChannel as o, BlockPackDescriptionFromPackageJsonRaw as s, BlockPackDescriptionManifest as c, BlockPackIdNoVersion as l, BlockPackManifest as u, BlockPackManifestFile as d, SemVer as f, Sha256Schema as p, VersionWithChannels as m, addPrefixToRelative as h, blockPackIdNoVersionEquals as g, blockPackIdToString as _, mapRemoteToAbsolute as v } from "@milaboratories/pl-model-middle-layer";
8
+ import { extractConfigGeneric as y } from "@milaboratories/pl-model-common";
9
+ import { gunzip as b, gunzipSync as ee, gzip as te } from "node:zlib";
10
+ import { createHash as ne, randomUUID as re } from "node:crypto";
11
+ import { ConsoleLoggerAdapter as ie, Retry2TimesWithDelay as x, notEmpty as ae, retry as S } from "@milaboratories/ts-helpers";
12
+ import { promisify as oe } from "node:util";
13
+ import { z as C } from "zod";
14
+ import se from "canonicalize";
15
+ import { LRUCache as ce } from "lru-cache";
16
+ import w from "node:path/posix";
17
+ import { S3 as le, paginateListObjectsV2 as ue } from "@aws-sdk/client-s3";
18
+ import { request as de } from "undici";
19
+ import { defaultHttpDispatcher as fe } from "@milaboratories/pl-http";
20
+ import pe from "yaml";
21
+ import * as me from "node:os";
22
22
  //#region \0rolldown/runtime.js
23
- var we = Object.create, Te = Object.defineProperty, Ee = Object.getOwnPropertyDescriptor, De = Object.getOwnPropertyNames, Oe = Object.getPrototypeOf, ke = Object.prototype.hasOwnProperty, A = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), Ae = (e, t) => {
23
+ var he = Object.create, T = Object.defineProperty, ge = Object.getOwnPropertyDescriptor, _e = Object.getOwnPropertyNames, ve = Object.getPrototypeOf, ye = Object.prototype.hasOwnProperty, E = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), be = (e, t) => {
24
24
  let n = {};
25
- for (var r in e) Te(n, r, {
25
+ for (var r in e) T(n, r, {
26
26
  get: e[r],
27
27
  enumerable: !0
28
28
  });
29
- return t || Te(n, Symbol.toStringTag, { value: "Module" }), n;
30
- }, je = (e, t, n, r) => {
31
- if (t && typeof t == "object" || typeof t == "function") for (var i = De(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !ke.call(e, s) && s !== n && Te(e, s, {
29
+ return t || T(n, Symbol.toStringTag, { value: "Module" }), n;
30
+ }, xe = (e, t, n, r) => {
31
+ if (t && typeof t == "object" || typeof t == "function") for (var i = _e(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !ye.call(e, s) && s !== n && T(e, s, {
32
32
  get: ((e) => t[e]).bind(null, s),
33
- enumerable: !(r = Ee(t, s)) || r.enumerable
33
+ enumerable: !(r = ge(t, s)) || r.enumerable
34
34
  });
35
35
  return e;
36
- }, Me = (e, t, n) => (n = e == null ? {} : we(Oe(e)), je(t || !e || !e.__esModule ? Te(n, "default", {
36
+ }, Se = (e, t, n) => (n = e == null ? {} : he(ve(e)), xe(t || !e || !e.__esModule ? T(n, "default", {
37
37
  value: e,
38
38
  enumerable: !0
39
- }) : n, e)), Ne = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
39
+ }) : n, e)), Ce = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
40
40
  if (typeof require < "u") return require.apply(this, arguments);
41
41
  throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
42
42
  });
43
43
  //#endregion
44
44
  //#region src/v2/model/content_conversion.ts
45
- function Pe(e) {
46
- return n.string().transform((t, r) => {
47
- let i = o(e, t);
48
- return i === void 0 ? (r.addIssue({
49
- code: n.ZodIssueCode.custom,
50
- message: `Can't resolve ${t} against ${e}`
51
- }), n.NEVER) : {
52
- type: "absolute-file",
53
- file: i
54
- };
55
- });
45
+ function we(e, t) {
46
+ let n = a(e, t);
47
+ if (n === void 0) throw Error(`Can't resolve ${t} against ${e}`);
48
+ return {
49
+ type: "absolute-file",
50
+ file: n
51
+ };
56
52
  }
57
- function Fe(e, ...t) {
58
- return n.string().transform((r, i) => {
59
- let a = r.endsWith("/") ? r : `${r}/`;
60
- for (let n of t) {
61
- let t = o(e, a + n);
62
- if (t !== void 0) {
63
- if (!t.endsWith(n)) throw Error(`Unexpected resolve result ${t} with index file ${n}`);
64
- return {
65
- type: "absolute-folder",
66
- folder: t.slice(0, t.length - n.length)
67
- };
68
- }
53
+ function Te(e, t, n) {
54
+ let r = t.endsWith("/") ? t : `${t}/`;
55
+ for (let t of n) {
56
+ let n = a(e, r + t);
57
+ if (n !== void 0) {
58
+ if (!n.endsWith(t)) throw Error(`Unexpected resolve result ${n} with index file ${t}`);
59
+ return {
60
+ type: "absolute-folder",
61
+ folder: n.slice(0, n.length - t.length)
62
+ };
69
63
  }
70
- return i.addIssue({
71
- code: n.ZodIssueCode.custom,
72
- message: `Can't resolve ${r} folder against ${e}, no index file found (${t.join(", ")})`
73
- }), n.NEVER;
74
- });
64
+ }
65
+ throw Error(`Can't resolve ${t} folder against ${e}, no index file found (${n.join(", ")})`);
75
66
  }
76
- function Ie(t) {
67
+ function Ee(t) {
77
68
  return (n) => n.type === "relative" ? {
78
69
  type: "absolute-file",
79
70
  file: e.resolve(t, n.path)
80
71
  } : n;
81
72
  }
82
- function Le() {
83
- return async (e) => e.type === "absolute-file" ? await r.readFile(e.file, { encoding: "utf-8" }) : e.content;
73
+ function De() {
74
+ return async (e) => e.type === "absolute-file" ? await n.readFile(e.file, { encoding: "utf-8" }) : e.content;
84
75
  }
85
- function Re() {
76
+ function Oe() {
86
77
  return async (e) => {
87
78
  if (e.type === "absolute-file") {
88
- let t = i.lookup(e.file);
79
+ let t = r.lookup(e.file);
89
80
  if (!t) throw Error(`Can't recognize mime type of the file: ${e.file}.`);
90
81
  return {
91
82
  type: "explicit-base64",
92
83
  mimeType: t,
93
- content: await r.readFile(e.file, { encoding: "base64" })
84
+ content: await n.readFile(e.file, { encoding: "base64" })
94
85
  };
95
86
  } else return e;
96
87
  };
97
88
  }
98
- function ze() {
89
+ function ke() {
99
90
  return async (e) => {
100
91
  if (e.type === "absolute-file") {
101
- let t = i.lookup(e.file);
92
+ let t = r.lookup(e.file);
102
93
  if (!t) throw Error(`Can't recognize mime type of the file: ${e.file}.`);
103
94
  return {
104
95
  type: "explicit-bytes",
105
96
  mimeType: t,
106
- content: Buffer.from(await r.readFile(e.file))
97
+ content: Buffer.from(await n.readFile(e.file))
107
98
  };
108
99
  } else if (e.type === "explicit-base64") return {
109
100
  type: "explicit-bytes",
@@ -113,44 +104,44 @@ function ze() {
113
104
  else return e;
114
105
  };
115
106
  }
116
- function j(t, n) {
107
+ function Ae(t, r) {
117
108
  return async (i) => {
118
109
  if (i.type === "absolute-file") {
119
110
  let a = e.basename(i.file), o = e.resolve(t, a);
120
- return n?.push(a), await r.cp(i.file, o), {
111
+ return r?.push(a), await n.cp(i.file, o), {
121
112
  type: "relative",
122
113
  path: a
123
114
  };
124
115
  } else return i;
125
116
  };
126
117
  }
127
- function Be(t, n, r) {
118
+ function je(t, n, r) {
128
119
  if (!n.endsWith(".tgz")) throw Error(`Unexpected tgz file name: ${n}`);
129
- return async (i) => {
120
+ return async (a) => {
130
121
  let o = e.resolve(t, n);
131
- return await a.create({
122
+ return await i.create({
132
123
  gzip: !0,
133
124
  file: o,
134
- cwd: i.folder
125
+ cwd: a.folder
135
126
  }, ["."]), r?.push(n), {
136
127
  type: "relative",
137
128
  path: n
138
129
  };
139
130
  };
140
131
  }
141
- function M(e) {
132
+ function Me(e) {
142
133
  return async (t) => t.type === "explicit-string" ? t : {
143
134
  type: "explicit-string",
144
135
  content: (await e(t.path)).toString("utf8")
145
136
  };
146
137
  }
147
- function Ve(e) {
138
+ function Ne(e) {
148
139
  return async (t) => t.type === "explicit-string" ? t.content : (await e(t.path)).toString("utf8");
149
140
  }
150
- function He(e) {
141
+ function Pe(e) {
151
142
  return async (t) => {
152
143
  if (t.type === "explicit-base64") return t;
153
- let n = i.lookup(t.path);
144
+ let n = r.lookup(t.path);
154
145
  if (!n) throw Error(`Can't recognize mime type of the file: ${t.path}.`);
155
146
  return {
156
147
  type: "explicit-base64",
@@ -159,14 +150,14 @@ function He(e) {
159
150
  };
160
151
  };
161
152
  }
162
- function N(e) {
153
+ function Fe(e) {
163
154
  return async (t) => {
164
155
  if (t.type === "explicit-base64") return {
165
156
  type: "explicit-bytes",
166
157
  mimeType: t.mimeType,
167
158
  content: new Uint8Array(Buffer.from(t.content, "base64"))
168
159
  };
169
- let n = i.lookup(t.path);
160
+ let n = r.lookup(t.path);
170
161
  if (!n) throw Error(`Can't recognize mime type of the file: ${t.path}.`);
171
162
  return {
172
163
  type: "explicit-bytes",
@@ -177,64 +168,138 @@ function N(e) {
177
168
  }
178
169
  //#endregion
179
170
  //#region src/v2/model/block_meta.ts
180
- function Ue(e) {
181
- return h(te.transform(Ie(e)), ee.transform(Ie(e)));
171
+ async function D(e, t, n) {
172
+ let { organization: r } = e, { logo: i, ...a } = r;
173
+ return {
174
+ ...e,
175
+ organization: {
176
+ ...a,
177
+ ...i === void 0 ? {} : { logo: await n(i) }
178
+ },
179
+ ...e.longDescription === void 0 ? {} : { longDescription: await t(e.longDescription) },
180
+ ...e.changelog === void 0 ? {} : { changelog: await t(e.changelog) },
181
+ ...e.logo === void 0 ? {} : { logo: await n(e.logo) }
182
+ };
182
183
  }
183
- function We(e, t) {
184
- return h(b.transform(j(e, t)), v.transform(j(e, t)));
184
+ async function Ie(e, t) {
185
+ let n = Ee(t);
186
+ return D(e, async (e) => n(e), async (e) => n(e));
185
187
  }
186
- var Ge = h(b.transform(Le()), v.transform(Re())).pipe(g), Ke = h(b.transform(Le()), v.transform(ze())).pipe(_);
187
- function qe(e) {
188
- return h(C.transform(Ve(e)), S.transform(N(e))).pipe(_);
188
+ async function Le(e, t, n) {
189
+ let r = Ae(t, n);
190
+ return D(e, async (e) => r(e), async (e) => r(e));
191
+ }
192
+ async function Re(e) {
193
+ return D(e, De(), Oe());
194
+ }
195
+ async function ze(e) {
196
+ return D(e, De(), ke());
197
+ }
198
+ async function Be(e, t) {
199
+ return D(e, Ne(t), Fe(t));
189
200
  }
190
201
  //#endregion
191
202
  //#region src/v2/model/block_components.ts
192
- function Je(e) {
193
- return c(Pe(e), Fe(e, "index.html"));
203
+ function Ve(e, t) {
204
+ return {
205
+ workflow: {
206
+ type: "workflow-v1",
207
+ main: we(t, e.workflow.main)
208
+ },
209
+ model: we(t, e.model),
210
+ ui: Te(t, e.ui, ["index.html"])
211
+ };
194
212
  }
195
- function Ye(e, t) {
196
- return c(v.transform(j(e, t)), y.transform(Be(e, "ui.tgz", t))).pipe(l);
213
+ async function He(e, t, n) {
214
+ let r = Ae(t, n), i = je(t, "ui.tgz", n);
215
+ return {
216
+ workflow: {
217
+ type: "workflow-v1",
218
+ main: await r(e.workflow.main)
219
+ },
220
+ model: await r(e.model),
221
+ ui: await i(e.ui)
222
+ };
197
223
  }
198
- function Xe(e) {
199
- return c(x.transform(oe(e)), x.transform(oe(e)));
224
+ function Ue(e, t) {
225
+ let n = v(t);
226
+ return {
227
+ workflow: {
228
+ type: "workflow-v1",
229
+ main: n(e.workflow.main)
230
+ },
231
+ model: n(e.model),
232
+ ui: n(e.ui)
233
+ };
200
234
  }
201
235
  //#endregion
202
236
  //#region src/v2/model/block_description.ts
203
- function Ze(e) {
204
- return w(Je(e), Ue(e)).transform(async (e, t) => {
205
- let n = se(JSON.parse(await r.readFile(e.components.model.file, "utf-8"))).featureFlags;
237
+ async function We(e, t) {
238
+ let r = Ve(e.components, t), i = await Ie(e.meta, t), a = y(JSON.parse(await n.readFile(r.model.file, "utf-8")));
239
+ return {
240
+ ...e,
241
+ components: r,
242
+ meta: i,
243
+ featureFlags: a.featureFlags
244
+ };
245
+ }
246
+ async function Ge(e, t, n) {
247
+ let r = await He(e.components, t, n), i = await Le(e.meta, t, n);
248
+ return {
249
+ ...e,
250
+ components: r,
251
+ meta: i
252
+ };
253
+ }
254
+ function Ke(e, t, n) {
255
+ return {
256
+ ...e,
257
+ components: t(e.components),
258
+ meta: n(e.meta)
259
+ };
260
+ }
261
+ function O(e, t) {
262
+ let n = h(t);
263
+ return Ke(e, (e) => ({
264
+ workflow: {
265
+ type: "workflow-v1",
266
+ main: n(e.workflow.main)
267
+ },
268
+ model: n(e.model),
269
+ ui: n(e.ui)
270
+ }), (e) => {
271
+ let { logo: t, ...r } = e.organization;
206
272
  return {
207
273
  ...e,
208
- featureFlags: n
274
+ organization: {
275
+ ...r,
276
+ ...t === void 0 ? {} : { logo: n(t) }
277
+ },
278
+ ...e.longDescription === void 0 ? {} : { longDescription: n(e.longDescription) },
279
+ ...e.changelog === void 0 ? {} : { changelog: n(e.changelog) },
280
+ ...e.logo === void 0 ? {} : { logo: n(e.logo) }
209
281
  };
210
282
  });
211
283
  }
212
- function Qe(e, t) {
213
- return w(Ye(e, t), We(e, t)).pipe(d);
214
- }
215
- function $e(e) {
216
- let t = re(e);
217
- return d.pipe(w(c(x.transform(t), x.transform(t)), h(C.transform(t), S.transform(t)))).pipe(d);
218
- }
219
284
  //#endregion
220
285
  //#region src/util.ts
221
- async function et(e, t) {
286
+ async function qe(e, t) {
222
287
  try {
223
- return t(await r.readFile(e));
288
+ return t(await n.readFile(e));
224
289
  } catch (e) {
225
290
  if (e instanceof Error && "code" in e && e.code === "ENOENT") return;
226
291
  throw e;
227
292
  }
228
293
  }
229
- function P(e) {
230
- return Promise.resolve(de("sha256").update(ArrayBuffer.isView(e) ? e : Buffer.from(e)).digest("hex").toUpperCase());
294
+ function k(e) {
295
+ return Promise.resolve(ne("sha256").update(ArrayBuffer.isView(e) ? e : Buffer.from(e)).digest("hex").toUpperCase());
231
296
  }
232
297
  //#endregion
233
298
  //#region src/v2/build_dist.ts
234
- async function tt(t, n) {
235
- let i = t.components.workflow.main, a = await r.readFile(e.resolve(n, i.path)), o;
299
+ async function Je(t, r) {
300
+ let i = t.components.workflow.main, a = await n.readFile(e.resolve(r, i.path)), o;
236
301
  try {
237
- let e = le(a).toString("utf-8");
302
+ let e = ee(a).toString("utf-8");
238
303
  o = JSON.parse(e);
239
304
  } catch {
240
305
  return;
@@ -242,33 +307,33 @@ async function tt(t, n) {
242
307
  let s = o;
243
308
  if (!(s.type !== "pl.tengo-template.v3" || !s.template)) return s.template.requiredCapabilities;
244
309
  }
245
- async function nt(t, n) {
246
- await r.mkdir(n, { recursive: !0 });
247
- let i = [], a = await Qe(n, i).parseAsync(t), o = await tt(a, n);
310
+ async function Ye(t, r) {
311
+ await n.mkdir(r, { recursive: !0 });
312
+ let i = [], a = await Ge(t, r, i), o = await Je(a, r);
248
313
  o && o.length > 0 && (a.meta = {
249
314
  ...a.meta,
250
315
  requiredCapabilities: o
251
316
  });
252
317
  let s = await Promise.all(i.map(async (t) => {
253
- let i = await r.readFile(e.resolve(n, t)), a = await P(i);
318
+ let i = await n.readFile(e.resolve(r, t)), a = await k(i);
254
319
  return {
255
320
  name: t,
256
321
  size: i.length,
257
322
  sha256: a
258
323
  };
259
- })), c = p.parse({
324
+ })), c = u.parse({
260
325
  schema: "v2",
261
326
  description: { ...a },
262
327
  files: s,
263
328
  timestamp: Date.now()
264
329
  });
265
- return await r.writeFile(e.resolve(n, m), JSON.stringify(c)), c;
330
+ return await n.writeFile(e.resolve(r, d), JSON.stringify(c)), c;
266
331
  }
267
332
  //#endregion
268
333
  //#region src/v2/source_package.ts
269
- var F = "block", rt = /(?:@[a-zA-Z0-9-.]+\/)?(?<organization>[a-zA-Z0-9-]+)\.(?<name>[a-zA-Z0-9-]+)/;
270
- function it(e) {
271
- let t = e.match(rt);
334
+ var A = "block", Xe = /(?:@[a-zA-Z0-9-.]+\/)?(?<organization>[a-zA-Z0-9-]+)\.(?<name>[a-zA-Z0-9-]+)/;
335
+ function Ze(e) {
336
+ let t = e.match(Xe);
272
337
  if (!t) throw Error(`Malformed package name (${e}), can't infer organization and block pack name.`);
273
338
  let { name: n, organization: r } = t.groups;
274
339
  return {
@@ -276,47 +341,42 @@ function it(e) {
276
341
  organization: r
277
342
  };
278
343
  }
279
- async function at(t, n) {
344
+ async function Qe(t, n) {
280
345
  let r = e.resolve(t, "package.json");
281
346
  try {
282
- let e = await et(r, (e) => JSON.parse(e.toString("utf-8")));
347
+ let e = await qe(r, (e) => JSON.parse(e.toString("utf-8")));
283
348
  if (e === void 0) return;
284
- let i = e[F];
285
- if (i === void 0) return;
286
- let a = {
287
- ...u.parse(i),
349
+ let n = e[A];
350
+ return n === void 0 ? void 0 : await We({
351
+ ...s.parse(n),
288
352
  id: {
289
- ...it(me(e.name, `"name" not found in ${r}`)),
290
- version: T.parse(e.version)
353
+ ...Ze(ae(e.name, `"name" not found in ${r}`)),
354
+ version: f.parse(e.version)
291
355
  }
292
- }, o = await Ze(t).safeParseAsync(a);
293
- if (o.success) return o.data;
294
- n?.warn(o.error);
295
- return;
356
+ }, t);
296
357
  } catch (e) {
297
358
  n?.warn(e);
298
359
  return;
299
360
  }
300
361
  }
301
- async function ot(t) {
302
- let n = e.resolve(t, "package.json"), i = JSON.parse(await r.readFile(n, { encoding: "utf-8" })), a = i[F];
303
- if (a === void 0) throw Error(`Block description (field ${F}) not found in ${n}.`);
362
+ async function $e(t) {
363
+ let r = e.resolve(t, "package.json"), i = JSON.parse(await n.readFile(r, { encoding: "utf-8" })), a = i[A];
364
+ if (a === void 0) throw Error(`Block description (field ${A}) not found in ${r}.`);
304
365
  return {
305
- ...u.parse(a),
366
+ ...s.parse(a),
306
367
  id: {
307
- ...it(me(i.name, `"name" not found in ${n}`)),
308
- version: T.parse(i.version)
368
+ ...Ze(ae(i.name, `"name" not found in ${r}`)),
369
+ version: f.parse(i.version)
309
370
  },
310
371
  featureFlags: {}
311
372
  };
312
373
  }
313
- async function st(e) {
314
- let t = await ot(e);
315
- return await Ze(e).parseAsync(t);
374
+ async function et(e) {
375
+ return await We(await $e(e), e);
316
376
  }
317
377
  //#endregion
318
378
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js
319
- var I = /* @__PURE__ */ A(((e, t) => {
379
+ var j = /* @__PURE__ */ E(((e, t) => {
320
380
  var n = "2.0.0", r = 256;
321
381
  t.exports = {
322
382
  MAX_LENGTH: r,
@@ -336,10 +396,10 @@ var I = /* @__PURE__ */ A(((e, t) => {
336
396
  FLAG_INCLUDE_PRERELEASE: 1,
337
397
  FLAG_LOOSE: 2
338
398
  };
339
- })), L = /* @__PURE__ */ A(((e, t) => {
399
+ })), M = /* @__PURE__ */ E(((e, t) => {
340
400
  t.exports = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...e) => console.error("SEMVER", ...e) : () => {};
341
- })), R = /* @__PURE__ */ A(((e, t) => {
342
- var { MAX_SAFE_COMPONENT_LENGTH: n, MAX_SAFE_BUILD_LENGTH: r, MAX_LENGTH: i } = I(), a = L();
401
+ })), N = /* @__PURE__ */ E(((e, t) => {
402
+ var { MAX_SAFE_COMPONENT_LENGTH: n, MAX_SAFE_BUILD_LENGTH: r, MAX_LENGTH: i } = j(), a = M();
343
403
  e = t.exports = {};
344
404
  var o = e.re = [], s = e.safeRe = [], c = e.src = [], l = e.safeSrc = [], u = e.t = {}, d = 0, f = "[a-zA-Z0-9-]", p = [
345
405
  ["\\s", 1],
@@ -353,10 +413,10 @@ var I = /* @__PURE__ */ A(((e, t) => {
353
413
  a(e, i, t), u[e] = i, c[i] = t, l[i] = r, o[i] = new RegExp(t, n ? "g" : void 0), s[i] = new RegExp(r, n ? "g" : void 0);
354
414
  };
355
415
  h("NUMERICIDENTIFIER", "0|[1-9]\\d*"), h("NUMERICIDENTIFIERLOOSE", "\\d+"), h("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${f}*`), h("MAINVERSION", `(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`), h("MAINVERSIONLOOSE", `(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`), h("PRERELEASEIDENTIFIER", `(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`), h("PRERELEASEIDENTIFIERLOOSE", `(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`), h("PRERELEASE", `(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`), h("PRERELEASELOOSE", `(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`), h("BUILDIDENTIFIER", `${f}+`), h("BUILD", `(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`), h("FULLPLAIN", `v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`), h("FULL", `^${c[u.FULLPLAIN]}$`), h("LOOSEPLAIN", `[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`), h("LOOSE", `^${c[u.LOOSEPLAIN]}$`), h("GTLT", "((?:<|>)?=?)"), h("XRANGEIDENTIFIERLOOSE", `${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), h("XRANGEIDENTIFIER", `${c[u.NUMERICIDENTIFIER]}|x|X|\\*`), h("XRANGEPLAIN", `[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`), h("XRANGEPLAINLOOSE", `[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`), h("XRANGE", `^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`), h("XRANGELOOSE", `^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`), h("COERCEPLAIN", `(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`), h("COERCE", `${c[u.COERCEPLAIN]}(?:$|[^\\d])`), h("COERCEFULL", c[u.COERCEPLAIN] + `(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`), h("COERCERTL", c[u.COERCE], !0), h("COERCERTLFULL", c[u.COERCEFULL], !0), h("LONETILDE", "(?:~>?)"), h("TILDETRIM", `(\\s*)${c[u.LONETILDE]}\\s+`, !0), e.tildeTrimReplace = "$1~", h("TILDE", `^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`), h("TILDELOOSE", `^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`), h("LONECARET", "(?:\\^)"), h("CARETTRIM", `(\\s*)${c[u.LONECARET]}\\s+`, !0), e.caretTrimReplace = "$1^", h("CARET", `^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`), h("CARETLOOSE", `^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`), h("COMPARATORLOOSE", `^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`), h("COMPARATOR", `^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`), h("COMPARATORTRIM", `(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`, !0), e.comparatorTrimReplace = "$1$2$3", h("HYPHENRANGE", `^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`), h("HYPHENRANGELOOSE", `^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`), h("STAR", "(<|>)?=?\\s*\\*"), h("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), h("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
356
- })), ct = /* @__PURE__ */ A(((e, t) => {
416
+ })), tt = /* @__PURE__ */ E(((e, t) => {
357
417
  var n = Object.freeze({ loose: !0 }), r = Object.freeze({});
358
418
  t.exports = (e) => e ? typeof e == "object" ? e : n : r;
359
- })), lt = /* @__PURE__ */ A(((e, t) => {
419
+ })), nt = /* @__PURE__ */ E(((e, t) => {
360
420
  var n = /^[0-9]+$/, r = (e, t) => {
361
421
  let r = n.test(e), i = n.test(t);
362
422
  return r && i && (e = +e, t = +t), e === t ? 0 : r && !i ? -1 : i && !r ? 1 : e < t ? -1 : 1;
@@ -365,8 +425,8 @@ var I = /* @__PURE__ */ A(((e, t) => {
365
425
  compareIdentifiers: r,
366
426
  rcompareIdentifiers: (e, t) => r(t, e)
367
427
  };
368
- })), z = /* @__PURE__ */ A(((e, t) => {
369
- var n = L(), { MAX_LENGTH: r, MAX_SAFE_INTEGER: i } = I(), { safeRe: a, t: o } = R(), s = ct(), { compareIdentifiers: c } = lt();
428
+ })), P = /* @__PURE__ */ E(((e, t) => {
429
+ var n = M(), { MAX_LENGTH: r, MAX_SAFE_INTEGER: i } = j(), { safeRe: a, t: o } = N(), s = tt(), { compareIdentifiers: c } = nt();
370
430
  t.exports = class e {
371
431
  constructor(t, c) {
372
432
  if (c = s(c), t instanceof e) {
@@ -486,8 +546,8 @@ var I = /* @__PURE__ */ A(((e, t) => {
486
546
  return this.raw = this.format(), this.build.length && (this.raw += `+${this.build.join(".")}`), this;
487
547
  }
488
548
  };
489
- })), B = /* @__PURE__ */ A(((e, t) => {
490
- var n = z();
549
+ })), F = /* @__PURE__ */ E(((e, t) => {
550
+ var n = P();
491
551
  t.exports = (e, t, r = !1) => {
492
552
  if (e instanceof n) return e;
493
553
  try {
@@ -497,20 +557,20 @@ var I = /* @__PURE__ */ A(((e, t) => {
497
557
  throw e;
498
558
  }
499
559
  };
500
- })), ut = /* @__PURE__ */ A(((e, t) => {
501
- var n = B();
560
+ })), rt = /* @__PURE__ */ E(((e, t) => {
561
+ var n = F();
502
562
  t.exports = (e, t) => {
503
563
  let r = n(e, t);
504
564
  return r ? r.version : null;
505
565
  };
506
- })), dt = /* @__PURE__ */ A(((e, t) => {
507
- var n = B();
566
+ })), it = /* @__PURE__ */ E(((e, t) => {
567
+ var n = F();
508
568
  t.exports = (e, t) => {
509
569
  let r = n(e.trim().replace(/^[=v]+/, ""), t);
510
570
  return r ? r.version : null;
511
571
  };
512
- })), ft = /* @__PURE__ */ A(((e, t) => {
513
- var n = z();
572
+ })), at = /* @__PURE__ */ E(((e, t) => {
573
+ var n = P();
514
574
  t.exports = (e, t, r, i, a) => {
515
575
  typeof r == "string" && (a = i, i = r, r = void 0);
516
576
  try {
@@ -519,8 +579,8 @@ var I = /* @__PURE__ */ A(((e, t) => {
519
579
  return null;
520
580
  }
521
581
  };
522
- })), pt = /* @__PURE__ */ A(((e, t) => {
523
- var n = B();
582
+ })), ot = /* @__PURE__ */ E(((e, t) => {
583
+ var n = F();
524
584
  t.exports = (e, t) => {
525
585
  let r = n(e, null, !0), i = n(t, null, !0), a = r.compare(i);
526
586
  if (a === 0) return null;
@@ -532,62 +592,62 @@ var I = /* @__PURE__ */ A(((e, t) => {
532
592
  let u = l ? "pre" : "";
533
593
  return r.major === i.major ? r.minor === i.minor ? r.patch === i.patch ? "prerelease" : u + "patch" : u + "minor" : u + "major";
534
594
  };
535
- })), mt = /* @__PURE__ */ A(((e, t) => {
536
- var n = z();
595
+ })), st = /* @__PURE__ */ E(((e, t) => {
596
+ var n = P();
537
597
  t.exports = (e, t) => new n(e, t).major;
538
- })), ht = /* @__PURE__ */ A(((e, t) => {
539
- var n = z();
598
+ })), ct = /* @__PURE__ */ E(((e, t) => {
599
+ var n = P();
540
600
  t.exports = (e, t) => new n(e, t).minor;
541
- })), gt = /* @__PURE__ */ A(((e, t) => {
542
- var n = z();
601
+ })), lt = /* @__PURE__ */ E(((e, t) => {
602
+ var n = P();
543
603
  t.exports = (e, t) => new n(e, t).patch;
544
- })), _t = /* @__PURE__ */ A(((e, t) => {
545
- var n = B();
604
+ })), ut = /* @__PURE__ */ E(((e, t) => {
605
+ var n = F();
546
606
  t.exports = (e, t) => {
547
607
  let r = n(e, t);
548
608
  return r && r.prerelease.length ? r.prerelease : null;
549
609
  };
550
- })), V = /* @__PURE__ */ A(((e, t) => {
551
- var n = z();
610
+ })), I = /* @__PURE__ */ E(((e, t) => {
611
+ var n = P();
552
612
  t.exports = (e, t, r) => new n(e, r).compare(new n(t, r));
553
- })), vt = /* @__PURE__ */ A(((e, t) => {
554
- var n = V();
613
+ })), dt = /* @__PURE__ */ E(((e, t) => {
614
+ var n = I();
555
615
  t.exports = (e, t, r) => n(t, e, r);
556
- })), yt = /* @__PURE__ */ A(((e, t) => {
557
- var n = V();
616
+ })), ft = /* @__PURE__ */ E(((e, t) => {
617
+ var n = I();
558
618
  t.exports = (e, t) => n(e, t, !0);
559
- })), bt = /* @__PURE__ */ A(((e, t) => {
560
- var n = z();
619
+ })), pt = /* @__PURE__ */ E(((e, t) => {
620
+ var n = P();
561
621
  t.exports = (e, t, r) => {
562
622
  let i = new n(e, r), a = new n(t, r);
563
623
  return i.compare(a) || i.compareBuild(a);
564
624
  };
565
- })), xt = /* @__PURE__ */ A(((e, t) => {
566
- var n = bt();
625
+ })), mt = /* @__PURE__ */ E(((e, t) => {
626
+ var n = pt();
567
627
  t.exports = (e, t) => e.sort((e, r) => n(e, r, t));
568
- })), St = /* @__PURE__ */ A(((e, t) => {
569
- var n = bt();
628
+ })), ht = /* @__PURE__ */ E(((e, t) => {
629
+ var n = pt();
570
630
  t.exports = (e, t) => e.sort((e, r) => n(r, e, t));
571
- })), H = /* @__PURE__ */ A(((e, t) => {
572
- var n = V();
631
+ })), L = /* @__PURE__ */ E(((e, t) => {
632
+ var n = I();
573
633
  t.exports = (e, t, r) => n(e, t, r) > 0;
574
- })), Ct = /* @__PURE__ */ A(((e, t) => {
575
- var n = V();
634
+ })), gt = /* @__PURE__ */ E(((e, t) => {
635
+ var n = I();
576
636
  t.exports = (e, t, r) => n(e, t, r) < 0;
577
- })), wt = /* @__PURE__ */ A(((e, t) => {
578
- var n = V();
637
+ })), _t = /* @__PURE__ */ E(((e, t) => {
638
+ var n = I();
579
639
  t.exports = (e, t, r) => n(e, t, r) === 0;
580
- })), Tt = /* @__PURE__ */ A(((e, t) => {
581
- var n = V();
640
+ })), vt = /* @__PURE__ */ E(((e, t) => {
641
+ var n = I();
582
642
  t.exports = (e, t, r) => n(e, t, r) !== 0;
583
- })), Et = /* @__PURE__ */ A(((e, t) => {
584
- var n = V();
643
+ })), yt = /* @__PURE__ */ E(((e, t) => {
644
+ var n = I();
585
645
  t.exports = (e, t, r) => n(e, t, r) >= 0;
586
- })), Dt = /* @__PURE__ */ A(((e, t) => {
587
- var n = V();
646
+ })), bt = /* @__PURE__ */ E(((e, t) => {
647
+ var n = I();
588
648
  t.exports = (e, t, r) => n(e, t, r) <= 0;
589
- })), Ot = /* @__PURE__ */ A(((e, t) => {
590
- var n = wt(), r = Tt(), i = H(), a = Et(), o = Ct(), s = Dt();
649
+ })), xt = /* @__PURE__ */ E(((e, t) => {
650
+ var n = _t(), r = vt(), i = L(), a = yt(), o = gt(), s = bt();
591
651
  t.exports = (e, t, c, l) => {
592
652
  switch (t) {
593
653
  case "===": return typeof e == "object" && (e = e.version), typeof c == "object" && (c = c.version), e === c;
@@ -603,8 +663,8 @@ var I = /* @__PURE__ */ A(((e, t) => {
603
663
  default: throw TypeError(`Invalid operator: ${t}`);
604
664
  }
605
665
  };
606
- })), kt = /* @__PURE__ */ A(((e, t) => {
607
- var n = z(), r = B(), { safeRe: i, t: a } = R();
666
+ })), St = /* @__PURE__ */ E(((e, t) => {
667
+ var n = P(), r = F(), { safeRe: i, t: a } = N();
608
668
  t.exports = (e, t) => {
609
669
  if (e instanceof n) return e;
610
670
  if (typeof e == "number" && (e = String(e)), typeof e != "string") return null;
@@ -620,7 +680,7 @@ var I = /* @__PURE__ */ A(((e, t) => {
620
680
  let s = o[2];
621
681
  return r(`${s}.${o[3] || "0"}.${o[4] || "0"}${t.includePrerelease && o[5] ? `-${o[5]}` : ""}${t.includePrerelease && o[6] ? `+${o[6]}` : ""}`, t);
622
682
  };
623
- })), At = /* @__PURE__ */ A(((e, t) => {
683
+ })), Ct = /* @__PURE__ */ E(((e, t) => {
624
684
  t.exports = class {
625
685
  constructor() {
626
686
  this.max = 1e3, this.map = /* @__PURE__ */ new Map();
@@ -643,7 +703,7 @@ var I = /* @__PURE__ */ A(((e, t) => {
643
703
  return this;
644
704
  }
645
705
  };
646
- })), U = /* @__PURE__ */ A(((e, t) => {
706
+ })), R = /* @__PURE__ */ E(((e, t) => {
647
707
  var n = /\s+/g;
648
708
  t.exports = class e {
649
709
  constructor(t, r) {
@@ -683,8 +743,8 @@ var I = /* @__PURE__ */ A(((e, t) => {
683
743
  let t = ((this.options.includePrerelease && p) | (this.options.loose && m)) + ":" + e, n = r.get(t);
684
744
  if (n) return n;
685
745
  let i = this.options.loose, s = i ? c[l.HYPHENRANGELOOSE] : c[l.HYPHENRANGE];
686
- e = e.replace(s, E(this.options.includePrerelease)), o("hyphen replace", e), e = e.replace(c[l.COMPARATORTRIM], u), o("comparator trim", e), e = e.replace(c[l.TILDETRIM], d), o("tilde trim", e), e = e.replace(c[l.CARETTRIM], f), o("caret trim", e);
687
- let g = e.split(" ").map((e) => v(e, this.options)).join(" ").split(/\s+/).map((e) => T(e, this.options));
746
+ e = e.replace(s, S(this.options.includePrerelease)), o("hyphen replace", e), e = e.replace(c[l.COMPARATORTRIM], u), o("comparator trim", e), e = e.replace(c[l.TILDETRIM], d), o("tilde trim", e), e = e.replace(c[l.CARETTRIM], f), o("caret trim", e);
747
+ let g = e.split(" ").map((e) => v(e, this.options)).join(" ").split(/\s+/).map((e) => ae(e, this.options));
688
748
  i && (g = g.filter((e) => (o("loose invalid filter", e, this.options), !!e.match(c[l.COMPARATORLOOSE])))), o("range list", g);
689
749
  let _ = /* @__PURE__ */ new Map(), y = g.map((e) => new a(e, this.options));
690
750
  for (let e of y) {
@@ -706,22 +766,22 @@ var I = /* @__PURE__ */ A(((e, t) => {
706
766
  } catch {
707
767
  return !1;
708
768
  }
709
- for (let t = 0; t < this.set.length; t++) if (ne(this.set[t], e, this.options)) return !0;
769
+ for (let t = 0; t < this.set.length; t++) if (oe(this.set[t], e, this.options)) return !0;
710
770
  return !1;
711
771
  }
712
772
  };
713
- var r = new (At())(), i = ct(), a = W(), o = L(), s = z(), { safeRe: c, t: l, comparatorTrimReplace: u, tildeTrimReplace: d, caretTrimReplace: f } = R(), { FLAG_INCLUDE_PRERELEASE: p, FLAG_LOOSE: m } = I(), h = (e) => e.value === "<0.0.0-0", g = (e) => e.value === "", _ = (e, t) => {
773
+ var r = new (Ct())(), i = tt(), a = z(), o = M(), s = P(), { safeRe: c, t: l, comparatorTrimReplace: u, tildeTrimReplace: d, caretTrimReplace: f } = N(), { FLAG_INCLUDE_PRERELEASE: p, FLAG_LOOSE: m } = j(), h = (e) => e.value === "<0.0.0-0", g = (e) => e.value === "", _ = (e, t) => {
714
774
  let n = !0, r = e.slice(), i = r.pop();
715
775
  for (; n && r.length;) n = r.every((e) => i.intersects(e, t)), i = r.pop();
716
776
  return n;
717
- }, v = (e, t) => (o("comp", e, t), e = S(e, t), o("caret", e), e = b(e, t), o("tildes", e), e = w(e, t), o("xrange", e), e = te(e, t), o("stars", e), e), y = (e) => !e || e.toLowerCase() === "x" || e === "*", b = (e, t) => e.trim().split(/\s+/).map((e) => x(e, t)).join(" "), x = (e, t) => {
777
+ }, v = (e, t) => (o("comp", e, t), e = te(e, t), o("caret", e), e = b(e, t), o("tildes", e), e = re(e, t), o("xrange", e), e = x(e, t), o("stars", e), e), y = (e) => !e || e.toLowerCase() === "x" || e === "*", b = (e, t) => e.trim().split(/\s+/).map((e) => ee(e, t)).join(" "), ee = (e, t) => {
718
778
  let n = t.loose ? c[l.TILDELOOSE] : c[l.TILDE];
719
779
  return e.replace(n, (t, n, r, i, a) => {
720
780
  o("tilde", e, t, n, r, i, a);
721
781
  let s;
722
782
  return y(n) ? s = "" : y(r) ? s = `>=${n}.0.0 <${+n + 1}.0.0-0` : y(i) ? s = `>=${n}.${r}.0 <${n}.${+r + 1}.0-0` : a ? (o("replaceTilde pr", a), s = `>=${n}.${r}.${i}-${a} <${n}.${+r + 1}.0-0`) : s = `>=${n}.${r}.${i} <${n}.${+r + 1}.0-0`, o("tilde return", s), s;
723
783
  });
724
- }, S = (e, t) => e.trim().split(/\s+/).map((e) => C(e, t)).join(" "), C = (e, t) => {
784
+ }, te = (e, t) => e.trim().split(/\s+/).map((e) => ne(e, t)).join(" "), ne = (e, t) => {
725
785
  o("caret", e, t);
726
786
  let n = t.loose ? c[l.CARETLOOSE] : c[l.CARET], r = t.includePrerelease ? "-0" : "";
727
787
  return e.replace(n, (t, n, i, a, s) => {
@@ -729,7 +789,7 @@ var I = /* @__PURE__ */ A(((e, t) => {
729
789
  let c;
730
790
  return y(n) ? c = "" : y(i) ? c = `>=${n}.0.0${r} <${+n + 1}.0.0-0` : y(a) ? c = n === "0" ? `>=${n}.${i}.0${r} <${n}.${+i + 1}.0-0` : `>=${n}.${i}.0${r} <${+n + 1}.0.0-0` : s ? (o("replaceCaret pr", s), c = n === "0" ? i === "0" ? `>=${n}.${i}.${a}-${s} <${n}.${i}.${+a + 1}-0` : `>=${n}.${i}.${a}-${s} <${n}.${+i + 1}.0-0` : `>=${n}.${i}.${a}-${s} <${+n + 1}.0.0-0`) : (o("no pr"), c = n === "0" ? i === "0" ? `>=${n}.${i}.${a}${r} <${n}.${i}.${+a + 1}-0` : `>=${n}.${i}.${a}${r} <${n}.${+i + 1}.0-0` : `>=${n}.${i}.${a} <${+n + 1}.0.0-0`), o("caret return", c), c;
731
791
  });
732
- }, w = (e, t) => (o("replaceXRanges", e, t), e.split(/\s+/).map((e) => ee(e, t)).join(" ")), ee = (e, t) => {
792
+ }, re = (e, t) => (o("replaceXRanges", e, t), e.split(/\s+/).map((e) => ie(e, t)).join(" ")), ie = (e, t) => {
733
793
  e = e.trim();
734
794
  let n = t.loose ? c[l.XRANGELOOSE] : c[l.XRANGE];
735
795
  return e.replace(n, (n, r, i, a, s, c) => {
@@ -737,7 +797,7 @@ var I = /* @__PURE__ */ A(((e, t) => {
737
797
  let l = y(i), u = l || y(a), d = u || y(s), f = d;
738
798
  return r === "=" && f && (r = ""), c = t.includePrerelease ? "-0" : "", l ? n = r === ">" || r === "<" ? "<0.0.0-0" : "*" : r && f ? (u && (a = 0), s = 0, r === ">" ? (r = ">=", u ? (i = +i + 1, a = 0, s = 0) : (a = +a + 1, s = 0)) : r === "<=" && (r = "<", u ? i = +i + 1 : a = +a + 1), r === "<" && (c = "-0"), n = `${r + i}.${a}.${s}${c}`) : u ? n = `>=${i}.0.0${c} <${+i + 1}.0.0-0` : d && (n = `>=${i}.${a}.0${c} <${i}.${+a + 1}.0-0`), o("xRange return", n), n;
739
799
  });
740
- }, te = (e, t) => (o("replaceStars", e, t), e.trim().replace(c[l.STAR], "")), T = (e, t) => (o("replaceGTE0", e, t), e.trim().replace(c[t.includePrerelease ? l.GTE0PRE : l.GTE0], "")), E = (e) => (t, n, r, i, a, o, s, c, l, u, d, f) => (n = y(r) ? "" : y(i) ? `>=${r}.0.0${e ? "-0" : ""}` : y(a) ? `>=${r}.${i}.0${e ? "-0" : ""}` : o ? `>=${n}` : `>=${n}${e ? "-0" : ""}`, c = y(l) ? "" : y(u) ? `<${+l + 1}.0.0-0` : y(d) ? `<${l}.${+u + 1}.0-0` : f ? `<=${l}.${u}.${d}-${f}` : e ? `<${l}.${u}.${+d + 1}-0` : `<=${c}`, `${n} ${c}`.trim()), ne = (e, t, n) => {
800
+ }, x = (e, t) => (o("replaceStars", e, t), e.trim().replace(c[l.STAR], "")), ae = (e, t) => (o("replaceGTE0", e, t), e.trim().replace(c[t.includePrerelease ? l.GTE0PRE : l.GTE0], "")), S = (e) => (t, n, r, i, a, o, s, c, l, u, d, f) => (n = y(r) ? "" : y(i) ? `>=${r}.0.0${e ? "-0" : ""}` : y(a) ? `>=${r}.${i}.0${e ? "-0" : ""}` : o ? `>=${n}` : `>=${n}${e ? "-0" : ""}`, c = y(l) ? "" : y(u) ? `<${+l + 1}.0.0-0` : y(d) ? `<${l}.${+u + 1}.0-0` : f ? `<=${l}.${u}.${d}-${f}` : e ? `<${l}.${u}.${+d + 1}-0` : `<=${c}`, `${n} ${c}`.trim()), oe = (e, t, n) => {
741
801
  for (let n = 0; n < e.length; n++) if (!e[n].test(t)) return !1;
742
802
  if (t.prerelease.length && !n.includePrerelease) {
743
803
  for (let n = 0; n < e.length; n++) if (o(e[n].semver), e[n].semver !== a.ANY && e[n].semver.prerelease.length > 0) {
@@ -748,7 +808,7 @@ var I = /* @__PURE__ */ A(((e, t) => {
748
808
  }
749
809
  return !0;
750
810
  };
751
- })), W = /* @__PURE__ */ A(((e, t) => {
811
+ })), z = /* @__PURE__ */ E(((e, t) => {
752
812
  var n = Symbol("SemVer ANY");
753
813
  t.exports = class e {
754
814
  static get ANY() {
@@ -783,9 +843,9 @@ var I = /* @__PURE__ */ A(((e, t) => {
783
843
  return this.operator === "" ? this.value === "" ? !0 : new l(t.value, n).test(this.value) : t.operator === "" ? t.value === "" ? !0 : new l(this.value, n).test(t.semver) : (n = r(n), n.includePrerelease && (this.value === "<0.0.0-0" || t.value === "<0.0.0-0") || !n.includePrerelease && (this.value.startsWith("<0.0.0") || t.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && t.operator.startsWith(">") || this.operator.startsWith("<") && t.operator.startsWith("<") || this.semver.version === t.semver.version && this.operator.includes("=") && t.operator.includes("=") || o(this.semver, "<", t.semver, n) && this.operator.startsWith(">") && t.operator.startsWith("<") || o(this.semver, ">", t.semver, n) && this.operator.startsWith("<") && t.operator.startsWith(">")));
784
844
  }
785
845
  };
786
- var r = ct(), { safeRe: i, t: a } = R(), o = Ot(), s = L(), c = z(), l = U();
787
- })), G = /* @__PURE__ */ A(((e, t) => {
788
- var n = U();
846
+ var r = tt(), { safeRe: i, t: a } = N(), o = xt(), s = M(), c = P(), l = R();
847
+ })), B = /* @__PURE__ */ E(((e, t) => {
848
+ var n = R();
789
849
  t.exports = (e, t, r) => {
790
850
  try {
791
851
  t = new n(t, r);
@@ -794,11 +854,11 @@ var I = /* @__PURE__ */ A(((e, t) => {
794
854
  }
795
855
  return t.test(e);
796
856
  };
797
- })), jt = /* @__PURE__ */ A(((e, t) => {
798
- var n = U();
857
+ })), wt = /* @__PURE__ */ E(((e, t) => {
858
+ var n = R();
799
859
  t.exports = (e, t) => new n(e, t).set.map((e) => e.map((e) => e.value).join(" ").trim().split(" "));
800
- })), Mt = /* @__PURE__ */ A(((e, t) => {
801
- var n = z(), r = U();
860
+ })), Tt = /* @__PURE__ */ E(((e, t) => {
861
+ var n = P(), r = R();
802
862
  t.exports = (e, t, i) => {
803
863
  let a = null, o = null, s = null;
804
864
  try {
@@ -810,8 +870,8 @@ var I = /* @__PURE__ */ A(((e, t) => {
810
870
  s.test(e) && (!a || o.compare(e) === -1) && (a = e, o = new n(a, i));
811
871
  }), a;
812
872
  };
813
- })), Nt = /* @__PURE__ */ A(((e, t) => {
814
- var n = z(), r = U();
873
+ })), Et = /* @__PURE__ */ E(((e, t) => {
874
+ var n = P(), r = R();
815
875
  t.exports = (e, t, i) => {
816
876
  let a = null, o = null, s = null;
817
877
  try {
@@ -823,8 +883,8 @@ var I = /* @__PURE__ */ A(((e, t) => {
823
883
  s.test(e) && (!a || o.compare(e) === 1) && (a = e, o = new n(a, i));
824
884
  }), a;
825
885
  };
826
- })), Pt = /* @__PURE__ */ A(((e, t) => {
827
- var n = z(), r = U(), i = H();
886
+ })), Dt = /* @__PURE__ */ E(((e, t) => {
887
+ var n = P(), r = R(), i = L();
828
888
  t.exports = (e, t) => {
829
889
  e = new r(e, t);
830
890
  let a = new n("0.0.0");
@@ -849,8 +909,8 @@ var I = /* @__PURE__ */ A(((e, t) => {
849
909
  }
850
910
  return a && e.test(a) ? a : null;
851
911
  };
852
- })), Ft = /* @__PURE__ */ A(((e, t) => {
853
- var n = U();
912
+ })), Ot = /* @__PURE__ */ E(((e, t) => {
913
+ var n = R();
854
914
  t.exports = (e, t) => {
855
915
  try {
856
916
  return new n(e, t).range || "*";
@@ -858,8 +918,8 @@ var I = /* @__PURE__ */ A(((e, t) => {
858
918
  return null;
859
919
  }
860
920
  };
861
- })), It = /* @__PURE__ */ A(((e, t) => {
862
- var n = z(), r = W(), { ANY: i } = r, a = U(), o = G(), s = H(), c = Ct(), l = Dt(), u = Et();
921
+ })), kt = /* @__PURE__ */ E(((e, t) => {
922
+ var n = P(), r = z(), { ANY: i } = r, a = R(), o = B(), s = L(), c = gt(), l = bt(), u = yt();
863
923
  t.exports = (e, t, d, f) => {
864
924
  e = new n(e, f), t = new a(t, f);
865
925
  let p, m, h, g, _;
@@ -881,17 +941,17 @@ var I = /* @__PURE__ */ A(((e, t) => {
881
941
  }
882
942
  return !0;
883
943
  };
884
- })), Lt = /* @__PURE__ */ A(((e, t) => {
885
- var n = It();
944
+ })), At = /* @__PURE__ */ E(((e, t) => {
945
+ var n = kt();
886
946
  t.exports = (e, t, r) => n(e, t, ">", r);
887
- })), Rt = /* @__PURE__ */ A(((e, t) => {
888
- var n = It();
947
+ })), jt = /* @__PURE__ */ E(((e, t) => {
948
+ var n = kt();
889
949
  t.exports = (e, t, r) => n(e, t, "<", r);
890
- })), zt = /* @__PURE__ */ A(((e, t) => {
891
- var n = U();
950
+ })), Mt = /* @__PURE__ */ E(((e, t) => {
951
+ var n = R();
892
952
  t.exports = (e, t, r) => (e = new n(e, r), t = new n(t, r), e.intersects(t, r));
893
- })), Bt = /* @__PURE__ */ A(((e, t) => {
894
- var n = G(), r = V();
953
+ })), Nt = /* @__PURE__ */ E(((e, t) => {
954
+ var n = B(), r = I();
895
955
  t.exports = (e, t, i) => {
896
956
  let a = [], o = null, s = null, c = e.sort((e, t) => r(e, t, i));
897
957
  for (let e of c) n(e, t, i) ? (s = e, o ||= e) : (s && a.push([o, s]), s = null, o = null);
@@ -901,8 +961,8 @@ var I = /* @__PURE__ */ A(((e, t) => {
901
961
  let u = l.join(" || "), d = typeof t.raw == "string" ? t.raw : String(t);
902
962
  return u.length < d.length ? u : t;
903
963
  };
904
- })), Vt = /* @__PURE__ */ A(((e, t) => {
905
- var n = U(), r = W(), { ANY: i } = r, a = G(), o = V(), s = (e, t, r = {}) => {
964
+ })), Pt = /* @__PURE__ */ E(((e, t) => {
965
+ var n = R(), r = z(), { ANY: i } = r, a = B(), o = I(), s = (e, t, r = {}) => {
906
966
  if (e === t) return !0;
907
967
  e = new n(e, r), t = new n(t, r);
908
968
  let i = !1;
@@ -960,46 +1020,46 @@ var I = /* @__PURE__ */ A(((e, t) => {
960
1020
  return r < 0 ? e : r > 0 || t.operator === "<" && e.operator === "<=" ? t : e;
961
1021
  };
962
1022
  t.exports = s;
963
- })), K = /* @__PURE__ */ Me((/* @__PURE__ */ A(((e, t) => {
964
- var n = R(), r = I(), i = z(), a = lt();
1023
+ })), V = /* @__PURE__ */ Se((/* @__PURE__ */ E(((e, t) => {
1024
+ var n = N(), r = j(), i = P(), a = nt();
965
1025
  t.exports = {
966
- parse: B(),
967
- valid: ut(),
968
- clean: dt(),
969
- inc: ft(),
970
- diff: pt(),
971
- major: mt(),
972
- minor: ht(),
973
- patch: gt(),
974
- prerelease: _t(),
975
- compare: V(),
976
- rcompare: vt(),
977
- compareLoose: yt(),
978
- compareBuild: bt(),
979
- sort: xt(),
980
- rsort: St(),
981
- gt: H(),
982
- lt: Ct(),
983
- eq: wt(),
984
- neq: Tt(),
985
- gte: Et(),
986
- lte: Dt(),
987
- cmp: Ot(),
988
- coerce: kt(),
989
- Comparator: W(),
990
- Range: U(),
991
- satisfies: G(),
992
- toComparators: jt(),
993
- maxSatisfying: Mt(),
994
- minSatisfying: Nt(),
995
- minVersion: Pt(),
996
- validRange: Ft(),
997
- outside: It(),
998
- gtr: Lt(),
999
- ltr: Rt(),
1000
- intersects: zt(),
1001
- simplifyRange: Bt(),
1002
- subset: Vt(),
1026
+ parse: F(),
1027
+ valid: rt(),
1028
+ clean: it(),
1029
+ inc: at(),
1030
+ diff: ot(),
1031
+ major: st(),
1032
+ minor: ct(),
1033
+ patch: lt(),
1034
+ prerelease: ut(),
1035
+ compare: I(),
1036
+ rcompare: dt(),
1037
+ compareLoose: ft(),
1038
+ compareBuild: pt(),
1039
+ sort: mt(),
1040
+ rsort: ht(),
1041
+ gt: L(),
1042
+ lt: gt(),
1043
+ eq: _t(),
1044
+ neq: vt(),
1045
+ gte: yt(),
1046
+ lte: bt(),
1047
+ cmp: xt(),
1048
+ coerce: St(),
1049
+ Comparator: z(),
1050
+ Range: R(),
1051
+ satisfies: B(),
1052
+ toComparators: wt(),
1053
+ maxSatisfying: Tt(),
1054
+ minSatisfying: Et(),
1055
+ minVersion: Dt(),
1056
+ validRange: Ot(),
1057
+ outside: kt(),
1058
+ gtr: At(),
1059
+ ltr: jt(),
1060
+ intersects: Mt(),
1061
+ simplifyRange: Nt(),
1062
+ subset: Pt(),
1003
1063
  SemVer: i,
1004
1064
  re: n.re,
1005
1065
  src: n.src,
@@ -1009,99 +1069,100 @@ var I = /* @__PURE__ */ A(((e, t) => {
1009
1069
  compareIdentifiers: a.compareIdentifiers,
1010
1070
  rcompareIdentifiers: a.rcompareIdentifiers
1011
1071
  };
1012
- })))()), Ht = "_updates_v2/per_package_version/";
1013
- function Ut(e, t) {
1014
- return `${Ht}${e.organization}/${e.name}/${e.version}/${t}`;
1072
+ })))()), Ft = "_updates_v2/per_package_version/";
1073
+ function It(e, t) {
1074
+ return `${Ft}${e.organization}/${e.name}/${e.version}/${t}`;
1015
1075
  }
1016
- var Wt = /(?<packageKeyWithoutVersion>(?<organization>[^/]+)\/(?<name>[^/]+))\/(?<version>[^/]+)\/(?<seed>[^/]+)$/, Gt = "_updates_v2/_global_update_in", Kt = "_updates_v2/_global_update_out", qt = "_overview_snapshots_v2/global/", Jt = "_overview_snapshots_v2/per_package/", Yt = /^(?<timestamp>\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}\.\d{3}Z-[a-z0-9]+)\.json\.gz$/;
1017
- function Xt(e) {
1018
- return `${qt}${e}.json.gz`;
1076
+ var Lt = /(?<packageKeyWithoutVersion>(?<organization>[^/]+)\/(?<name>[^/]+))\/(?<version>[^/]+)\/(?<seed>[^/]+)$/, Rt = "_updates_v2/_global_update_in", zt = "_updates_v2/_global_update_out", Bt = "_overview_snapshots_v2/global/", Vt = "_overview_snapshots_v2/per_package/", Ht = /^(?<timestamp>\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}\.\d{3}Z-[a-z0-9]+)\.json\.gz$/;
1077
+ function Ut(e) {
1078
+ return `${Bt}${e}.json.gz`;
1019
1079
  }
1020
- function Zt(e, t) {
1021
- return `${Jt}${e.organization}/${e.name}/${t}.json.gz`;
1080
+ function Wt(e, t) {
1081
+ return `${Vt}${e.organization}/${e.name}/${t}.json.gz`;
1022
1082
  }
1023
1083
  //#endregion
1024
1084
  //#region src/v2/registry/schema_public.ts
1025
- var Qt = "v2/", $t = "overview.json", en = "overview.json.gz", tn = "overview.json", q = "manifest.json", J = "channels", nn = /^[-a-z0-9]+$/;
1026
- function Y(e) {
1085
+ var Gt = "v2/", Kt = "overview.json", qt = "overview.json.gz", Jt = "overview.json", H = "manifest.json", U = "channels", W = /^[-a-z0-9]+$/;
1086
+ function G(e) {
1027
1087
  return `${e.organization}/${e.name}/${e.version}`;
1028
1088
  }
1029
- function X(e) {
1030
- return `v2/${Y(e)}`;
1089
+ function K(e) {
1090
+ return `v2/${G(e)}`;
1031
1091
  }
1032
- var rn = "/" + q, an = n.object({
1033
- description: d,
1034
- channels: n.array(n.string()).default(() => []),
1035
- manifestSha256: E
1036
- }).passthrough(), on = n.object({
1037
- schema: n.literal("v2"),
1038
- versions: n.array(an)
1092
+ var Yt = "/" + H, Xt = C.object({
1093
+ description: c,
1094
+ channels: C.array(C.string()).default(() => []),
1095
+ manifestSha256: p
1096
+ }).passthrough(), q = C.object({
1097
+ schema: C.literal("v2"),
1098
+ versions: C.array(Xt)
1039
1099
  }).passthrough();
1040
- function sn(e) {
1041
- return `${e.organization}/${e.name}/${tn}`;
1100
+ function Zt(e) {
1101
+ return `${e.organization}/${e.name}/${Jt}`;
1042
1102
  }
1043
- function cn(e) {
1044
- return `v2/${sn(e)}`;
1103
+ function Qt(e) {
1104
+ return `v2/${Zt(e)}`;
1045
1105
  }
1046
- function ln(e) {
1047
- return `${Y(e)}/${J}/`;
1106
+ function $t(e) {
1107
+ return `${G(e)}/${U}/`;
1048
1108
  }
1049
- function un(e) {
1050
- return `v2/${ln(e)}`;
1109
+ function en(e) {
1110
+ return `v2/${$t(e)}`;
1051
1111
  }
1052
- var dn = /(?<packageKeyWithoutVersion>(?<organization>[^/]+)\/(?<name>[^/]+))\/(?<version>[^/]+)\/manifest\.json$/, Z = `v2/${$t}`, fn = `v2/${en}`;
1053
- function pn(e) {
1054
- let t = n.object({
1055
- id: f,
1056
- allVersions: n.array(n.string()).optional(),
1057
- allVersionsWithChannels: n.array(ne).optional(),
1058
- latest: e,
1059
- latestManifestSha256: E,
1060
- latestByChannel: n.record(n.string(), n.object({
1061
- description: e,
1062
- manifestSha256: E
1063
- }).passthrough()).default({})
1064
- }).passthrough();
1065
- return t.transform((e) => e.allVersionsWithChannels ? e : {
1066
- ...e,
1067
- allVersionsWithChannels: e.allVersions.map((e) => ({
1112
+ var tn = /(?<packageKeyWithoutVersion>(?<organization>[^/]+)\/(?<name>[^/]+))\/(?<version>[^/]+)\/manifest\.json$/, J = `v2/${Kt}`, nn = `v2/${qt}`, rn = C.object({
1113
+ id: l,
1114
+ allVersions: C.array(C.string()).optional(),
1115
+ allVersionsWithChannels: C.array(m).optional(),
1116
+ latest: c.optional(),
1117
+ latestManifestSha256: p.optional(),
1118
+ latestByChannel: C.record(C.string(), C.object({
1119
+ description: c,
1120
+ manifestSha256: p
1121
+ }).passthrough()).default({})
1122
+ }).passthrough();
1123
+ function an(e) {
1124
+ let t = `${e.id.organization}/${e.id.name}`, n = e.allVersionsWithChannels;
1125
+ if (n === void 0) {
1126
+ if (e.allVersions === void 0) throw Error(`GlobalOverviewEntry ${t} is missing both 'allVersionsWithChannels' and the deprecated 'allVersions' fallback`);
1127
+ n = e.allVersions.map((e) => ({
1068
1128
  version: e,
1069
1129
  channels: []
1070
- }))
1071
- }).transform((e) => e.latestByChannel[s] ? e : {
1072
- ...e,
1073
- latestByChannel: {
1074
- ...e.latestByChannel,
1075
- [s]: {
1130
+ }));
1131
+ }
1132
+ let r = e.latestByChannel;
1133
+ if (!r[o]) {
1134
+ if (e.latest === void 0 || e.latestManifestSha256 === void 0) throw Error(`GlobalOverviewEntry ${t} is missing the 'latestByChannel[any]' slot and the deprecated 'latest'/'latestManifestSha256' fallback`);
1135
+ r = {
1136
+ ...r,
1137
+ [o]: {
1076
1138
  description: e.latest,
1077
1139
  manifestSha256: e.latestManifestSha256
1078
1140
  }
1079
- }
1080
- }).pipe(t.required({ allVersionsWithChannels: !0 }));
1081
- }
1082
- var mn = pn(d);
1083
- function hn(e) {
1084
- return n.object({
1085
- schema: n.literal("v2"),
1086
- packages: n.array(pn(e))
1087
- }).passthrough();
1088
- }
1089
- var Q = hn(d);
1090
- function gn(e) {
1091
- return w(l, h(C.transform(M(e)), S.transform(N(e))));
1092
- }
1093
- function _n(e) {
1094
- return hn(w(l, h(C.transform(M(e)), S.transform(N(e)))));
1141
+ };
1142
+ }
1143
+ return {
1144
+ ...e,
1145
+ allVersionsWithChannels: n,
1146
+ latestByChannel: r
1147
+ };
1095
1148
  }
1096
- function vn(e) {
1097
- return hn(w(l, h(C.transform(M(e)), S.transform(N(e)))));
1149
+ var on = C.object({
1150
+ schema: C.literal("v2"),
1151
+ packages: C.array(rn)
1152
+ }).passthrough();
1153
+ function Y(e) {
1154
+ let t = on.parse(e);
1155
+ return {
1156
+ ...t,
1157
+ packages: t.packages.map(an)
1158
+ };
1098
1159
  }
1099
1160
  //#endregion
1100
1161
  //#region src/v2/registry/registry.ts
1101
- var yn = class {
1102
- gzipAsync = he(ue);
1103
- gunzipAsync = he(ce);
1104
- constructor(e, t = new pe(), n = {}) {
1162
+ var sn = class {
1163
+ gzipAsync = oe(te);
1164
+ gunzipAsync = oe(b);
1165
+ constructor(e, t = new ie(), n = {}) {
1105
1166
  this.storage = e, this.logger = t, this.settings = n;
1106
1167
  }
1107
1168
  generateTimestamp() {
@@ -1112,7 +1173,7 @@ var yn = class {
1112
1173
  }
1113
1174
  async createGlobalOverviewSnapshot(e, t) {
1114
1175
  if (!this.settings.skipSnapshotCreation) try {
1115
- let n = await this.gzipAsync(e), r = Xt(t);
1176
+ let n = await this.gzipAsync(e), r = Ut(t);
1116
1177
  await this.storage.putFile(r, Buffer.from(n)), this.logger.info(`Global overview snapshot created at ${r}`);
1117
1178
  } catch (e) {
1118
1179
  this.logger.warn(`Failed to create global overview snapshot: ${String(e)}`);
@@ -1120,7 +1181,7 @@ var yn = class {
1120
1181
  }
1121
1182
  async createPackageOverviewSnapshot(e, t, n) {
1122
1183
  if (!this.settings.skipSnapshotCreation) try {
1123
- let r = JSON.stringify(t), i = await this.gzipAsync(r), a = Zt(e, n);
1184
+ let r = JSON.stringify(t), i = await this.gzipAsync(r), a = Wt(e, n);
1124
1185
  await this.storage.putFile(a, Buffer.from(i)), this.logger.info(`Package overview snapshot created at ${a} for ${e.organization}:${e.name}`);
1125
1186
  } catch (t) {
1126
1187
  this.logger.warn(`Failed to create package overview snapshot for ${e.organization}:${e.name}: ${String(t)}`);
@@ -1128,7 +1189,7 @@ var yn = class {
1128
1189
  }
1129
1190
  async updateRegistry(e = "normal") {
1130
1191
  this.logger.info("Initiating registry refresh...");
1131
- let t = this.generateTimestamp(), n = /* @__PURE__ */ new Map(), r = [], i = await this.storage.listFiles(Ht), a = ({ organization: e, name: t, version: r }) => {
1192
+ let t = this.generateTimestamp(), n = /* @__PURE__ */ new Map(), r = [], i = await this.storage.listFiles(Ft), a = ({ organization: e, name: t, version: r }) => {
1132
1193
  let i = `${e}:${t}`, a = n.get(i);
1133
1194
  return a ? a.versions.has(r) ? !1 : (a.versions.add(r), !0) : (n.set(i, {
1134
1195
  package: {
@@ -1140,7 +1201,7 @@ var yn = class {
1140
1201
  };
1141
1202
  this.logger.info("Packages to be updated:");
1142
1203
  for (let e of i) {
1143
- let t = e.match(Wt);
1204
+ let t = e.match(Lt);
1144
1205
  if (!t) continue;
1145
1206
  r.push(e);
1146
1207
  let { organization: n, name: i, version: o, seed: s } = t.groups, c = a({
@@ -1153,7 +1214,7 @@ var yn = class {
1153
1214
  if (e === "force") {
1154
1215
  let e = await this.storage.listFiles("v2/");
1155
1216
  for (let t of e) {
1156
- let e = t.match(dn);
1217
+ let e = t.match(tn);
1157
1218
  if (!e) continue;
1158
1219
  let { organization: n, name: r, version: i } = e.groups, o = a({
1159
1220
  organization: n,
@@ -1163,68 +1224,68 @@ var yn = class {
1163
1224
  this.logger.info(` - ${n}:${r}:${i} force_added:${o}`);
1164
1225
  }
1165
1226
  }
1166
- let o = await this.storage.getFile(Z);
1167
- if (e === "force" && o !== void 0) {
1227
+ let s = await this.storage.getFile(J);
1228
+ if (e === "force" && s !== void 0) {
1168
1229
  let e = this.generatePreWriteTimestamp();
1169
- await this.createGlobalOverviewSnapshot(o.toString(), e);
1230
+ await this.createGlobalOverviewSnapshot(s.toString(), e);
1170
1231
  }
1171
- let c = (e === "force" || o === void 0 ? {
1232
+ let c = (e === "force" || s === void 0 ? {
1172
1233
  schema: "v2",
1173
1234
  packages: []
1174
- } : Q.parse(JSON.parse(o.toString()))).packages;
1235
+ } : Y(JSON.parse(s.toString()))).packages;
1175
1236
  this.logger.info(`Global overview ${e === "force" ? "starting empty (force mode)" : "loaded"}, ${c.length} records`);
1176
1237
  for (let [, r] of n.entries()) {
1177
- let n = cn(r.package), i = await this.storage.getFile(n);
1238
+ let n = Qt(r.package), i = await this.storage.getFile(n);
1178
1239
  if (e === "force" && i !== void 0) {
1179
- let e = this.generatePreWriteTimestamp(), t = on.parse(JSON.parse(i.toString()));
1240
+ let e = this.generatePreWriteTimestamp(), t = q.parse(JSON.parse(i.toString()));
1180
1241
  await this.createPackageOverviewSnapshot(r.package, t, e);
1181
1242
  }
1182
1243
  let a = e === "force" || i === void 0 ? {
1183
1244
  schema: "v2",
1184
1245
  versions: []
1185
- } : on.parse(JSON.parse(i.toString()));
1246
+ } : q.parse(JSON.parse(i.toString()));
1186
1247
  this.logger.info(`Updating ${r.package.organization}:${r.package.name} overview${e === "force" ? " (starting empty in force mode)" : ""}, ${a.versions.length} records`);
1187
- let o = a.versions.filter((e) => !r.versions.has(e.description.id.version));
1248
+ let s = a.versions.filter((e) => !r.versions.has(e.description.id.version));
1188
1249
  for (let [e] of r.versions.entries()) {
1189
1250
  let t = e.toString(), n = {
1190
1251
  ...r.package,
1191
1252
  version: t
1192
- }, i = await this.storage.getFile(X(n) + rn);
1253
+ }, i = await this.storage.getFile(K(n) + Yt);
1193
1254
  if (!i) continue;
1194
- let a = await P(i), s = (await this.storage.listFiles(un(n))).filter((e) => e.match(nn) ? !0 : (this.logger.warn(`Unexpected channel in ${ae(n)}: ${e}`), !1));
1195
- o.push({
1196
- description: $e(t).parse(p.parse(JSON.parse(i.toString("utf8"))).description),
1255
+ let a = await k(i), o = (await this.storage.listFiles(en(n))).filter((e) => e.match(W) ? !0 : (this.logger.warn(`Unexpected channel in ${_(n)}: ${e}`), !1));
1256
+ s.push({
1257
+ description: O(u.parse(JSON.parse(i.toString("utf8"))).description, t),
1197
1258
  manifestSha256: a,
1198
- channels: s
1259
+ channels: o
1199
1260
  });
1200
1261
  }
1201
- o.sort((e, t) => (0, K.compare)(t.description.id.version, e.description.id.version));
1262
+ s.sort((e, t) => (0, V.compare)(t.description.id.version, e.description.id.version));
1202
1263
  let l = {
1203
1264
  schema: "v2",
1204
- versions: o
1265
+ versions: s
1205
1266
  };
1206
- e !== "dry-run" && (await this.storage.putFile(n, Buffer.from(JSON.stringify(l))), await this.createPackageOverviewSnapshot(r.package, l, t)), this.logger.info(`Done (${o.length} records)`);
1207
- let u = /* @__PURE__ */ new Set();
1208
- for (let e of o) for (let t of e.channels) u.add(t);
1267
+ e !== "dry-run" && (await this.storage.putFile(n, Buffer.from(JSON.stringify(l))), await this.createPackageOverviewSnapshot(r.package, l, t)), this.logger.info(`Done (${s.length} records)`);
1268
+ let d = /* @__PURE__ */ new Set();
1269
+ for (let e of s) for (let t of e.channels) d.add(t);
1209
1270
  c = c.filter((e) => e.id.organization !== r.package.organization || e.id.name !== r.package.name);
1210
- let d = $e(`${r.package.organization}/${r.package.name}`);
1271
+ let f = `${r.package.organization}/${r.package.name}`;
1211
1272
  c.push({
1212
1273
  id: {
1213
1274
  organization: r.package.organization,
1214
1275
  name: r.package.name
1215
1276
  },
1216
- allVersions: o.map((e) => e.description.id.version).reverse(),
1217
- allVersionsWithChannels: o.map((e) => ({
1277
+ allVersions: s.map((e) => e.description.id.version).reverse(),
1278
+ allVersionsWithChannels: s.map((e) => ({
1218
1279
  version: e.description.id.version,
1219
1280
  channels: e.channels
1220
1281
  })).reverse(),
1221
- latest: d.parse(o[0].description),
1222
- latestManifestSha256: o[0].manifestSha256,
1223
- latestByChannel: Object.fromEntries([...u, s].map((e) => {
1224
- let t = o.find((t) => e === s || t.channels.indexOf(e) !== -1);
1282
+ latest: O(s[0].description, f),
1283
+ latestManifestSha256: s[0].manifestSha256,
1284
+ latestByChannel: Object.fromEntries([...d, o].map((e) => {
1285
+ let t = s.find((t) => e === o || t.channels.indexOf(e) !== -1);
1225
1286
  if (!t) throw Error("Assertion error");
1226
1287
  return [e, {
1227
- description: d.parse(t.description),
1288
+ description: O(t.description, f),
1228
1289
  manifestSha256: t?.manifestSha256
1229
1290
  }];
1230
1291
  }))
@@ -1235,15 +1296,15 @@ var yn = class {
1235
1296
  schema: "v2",
1236
1297
  packages: c
1237
1298
  }), n = Buffer.from(e);
1238
- await this.storage.putFile(Z, n);
1299
+ await this.storage.putFile(J, n);
1239
1300
  let r = await this.gzipAsync(e);
1240
- await this.storage.putFile(fn, Buffer.from(r)), await this.createGlobalOverviewSnapshot(e, t);
1301
+ await this.storage.putFile(nn, Buffer.from(r)), await this.createGlobalOverviewSnapshot(e, t);
1241
1302
  }
1242
- this.logger.info(`Global overview updated (${c.length} records)`), e !== "dry-run" && await this.storage.deleteFiles(...r.map((e) => `${Ht}${e}`)), this.logger.info("Version update requests cleared");
1303
+ this.logger.info(`Global overview updated (${c.length} records)`), e !== "dry-run" && await this.storage.deleteFiles(...r.map((e) => `${Ft}${e}`)), this.logger.info("Version update requests cleared");
1243
1304
  }
1244
1305
  async updateIfNeeded(e = "normal") {
1245
1306
  this.logger.info("Checking if registry requires refresh...");
1246
- let t = await this.storage.getFile(Gt), n = await this.storage.getFile(Kt);
1307
+ let t = await this.storage.getFile(Rt), n = await this.storage.getFile(zt);
1247
1308
  if (e !== "force" && t === void 0 && n === void 0) {
1248
1309
  this.logger.info("No global seed files found, update not needed.");
1249
1310
  return;
@@ -1252,76 +1313,76 @@ var yn = class {
1252
1313
  this.logger.info("Registry is up to date.");
1253
1314
  return;
1254
1315
  }
1255
- await this.updateRegistry(e), t && (e !== "dry-run" && await this.storage.putFile(Kt, t), this.logger.info("Refresh finished."));
1316
+ await this.updateRegistry(e), t && (e !== "dry-run" && await this.storage.putFile(zt, t), this.logger.info("Refresh finished."));
1256
1317
  }
1257
1318
  async getPackageOverview(e) {
1258
- let t = await this.storage.getFile(cn(e));
1259
- if (t !== void 0) return on.parse(JSON.parse(t.toString()));
1319
+ let t = await this.storage.getFile(Qt(e));
1320
+ if (t !== void 0) return q.parse(JSON.parse(t.toString()));
1260
1321
  }
1261
1322
  async getGlobalOverview() {
1262
- let e = await this.storage.getFile(Z);
1263
- if (e !== void 0) return Q.parse(JSON.parse(e.toString()));
1323
+ let e = await this.storage.getFile(J);
1324
+ if (e !== void 0) return Y(JSON.parse(e.toString()));
1264
1325
  }
1265
1326
  async marchChanged(e) {
1266
- let t = fe(), n = Ut(e, t);
1267
- this.logger.info(`Creating update seed at ${n} ...`), await this.storage.putFile(n, Buffer.from(t)), this.logger.info(`Touching global update seed ${Gt} ...`), await this.storage.putFile(Gt, Buffer.from(t));
1327
+ let t = re(), n = It(e, t);
1328
+ this.logger.info(`Creating update seed at ${n} ...`), await this.storage.putFile(n, Buffer.from(t)), this.logger.info(`Touching global update seed ${Rt} ...`), await this.storage.putFile(Rt, Buffer.from(t));
1268
1329
  }
1269
1330
  async addPackageToChannel(e, t) {
1270
- if (!t.match(nn)) throw Error(`Illegal characters in channel name: ${t}`);
1271
- let n = X(e);
1272
- if (await this.storage.getFile(`${n}/manifest.json`) === void 0) throw Error(`Package ${ae(e)} not found in the registry.`);
1273
- await this.storage.putFile(`${n}/${J}/${t}`, Buffer.from(t)), await this.marchChanged(e);
1331
+ if (!t.match(W)) throw Error(`Illegal characters in channel name: ${t}`);
1332
+ let n = K(e);
1333
+ if (await this.storage.getFile(`${n}/manifest.json`) === void 0) throw Error(`Package ${_(e)} not found in the registry.`);
1334
+ await this.storage.putFile(`${n}/${U}/${t}`, Buffer.from(t)), await this.marchChanged(e);
1274
1335
  }
1275
1336
  async removePackageFromChannel(e, t) {
1276
- if (!t.match(nn)) throw Error(`Illegal characters in channel name: ${t}`);
1277
- let n = X(e);
1278
- if (await this.storage.getFile(`${n}/manifest.json`) === void 0) throw Error(`Package ${ae(e)} not found in the registry.`);
1279
- await this.storage.deleteFiles(`${n}/${J}/${t}`), await this.marchChanged(e);
1337
+ if (!t.match(W)) throw Error(`Illegal characters in channel name: ${t}`);
1338
+ let n = K(e);
1339
+ if (await this.storage.getFile(`${n}/manifest.json`) === void 0) throw Error(`Package ${_(e)} not found in the registry.`);
1340
+ await this.storage.deleteFiles(`${n}/${U}/${t}`), await this.marchChanged(e);
1280
1341
  }
1281
1342
  async listGlobalOverviewSnapshots() {
1282
- let e = await this.storage.listFiles(qt), t = [];
1343
+ let e = await this.storage.listFiles(Bt), t = [];
1283
1344
  for (let n of e) {
1284
- let e = n.indexOf("/") === -1 ? n : n.substring(n.lastIndexOf("/") + 1), r = e.match(Yt);
1345
+ let e = n.indexOf("/") === -1 ? n : n.substring(n.lastIndexOf("/") + 1), r = e.match(Ht);
1285
1346
  r && t.push({
1286
1347
  timestamp: r.groups.timestamp,
1287
- path: qt + e
1348
+ path: Bt + e
1288
1349
  });
1289
1350
  }
1290
1351
  return t.sort((e, t) => t.timestamp.localeCompare(e.timestamp)), t;
1291
1352
  }
1292
1353
  async restoreGlobalOverviewFromSnapshot(e) {
1293
- let t = Xt(e), n = await this.storage.getFile(t);
1354
+ let t = Ut(e), n = await this.storage.getFile(t);
1294
1355
  if (!n) throw Error(`Snapshot ${e} not found at ${t}`);
1295
1356
  let r = (await this.gunzipAsync(n)).toString("utf8");
1296
1357
  try {
1297
- Q.parse(JSON.parse(r));
1358
+ Y(JSON.parse(r));
1298
1359
  } catch (t) {
1299
1360
  throw Error(`Invalid snapshot data in ${e}: ${String(t)}`);
1300
1361
  }
1301
1362
  let i = Buffer.from(r);
1302
- await this.storage.putFile(Z, i);
1363
+ await this.storage.putFile(J, i);
1303
1364
  let a = await this.gzipAsync(r);
1304
- await this.storage.putFile(fn, Buffer.from(a)), this.logger.info(`Global overview restored from snapshot ${e}`);
1365
+ await this.storage.putFile(nn, Buffer.from(a)), this.logger.info(`Global overview restored from snapshot ${e}`);
1305
1366
  }
1306
1367
  async publishPackage(e, t) {
1307
- let n = X(e.description.id);
1368
+ let n = K(e.description.id);
1308
1369
  for (let r of e.files) {
1309
1370
  let e = await t(r.name);
1310
1371
  if (e.length !== r.size) throw Error(`Actual file size don't match file size from the manifest file for ${r.name} (actual = ${e.length}; manifest = ${r.size})`);
1311
- let i = await P(e);
1372
+ let i = await k(e);
1312
1373
  if (i !== r.sha256.toUpperCase()) throw Error(`Actual file SHA-256 don't match the checksum from the manifest file for ${r.name} (actual = ${i}; manifest = ${r.sha256.toUpperCase()})`);
1313
1374
  let a = n + "/" + r.name;
1314
1375
  this.logger.info(`Uploading ${r.name} -> ${a} ...`), await this.storage.putFile(a, e);
1315
1376
  }
1316
- let r = n + "/" + q;
1377
+ let r = n + "/" + H;
1317
1378
  this.logger.info(`Uploading manifest to ${r} ...`), await this.storage.putFile(r, Buffer.from(JSON.stringify(e))), await this.marchChanged(e.description.id);
1318
1379
  }
1319
- }, bn = {
1380
+ }, cn = {
1320
1381
  cacheBlockListFor: 45e3,
1321
1382
  keepStaleBlockListFor: 3e5
1322
1383
  };
1323
- function xn(e, t) {
1324
- let n = K.inc(e, "minor"), r = K.inc(e, "major"), i = [], a = t.find((t) => K.gt(t, e) && K.lt(t, n)), o = t.find((e) => K.gte(e, n) && K.lt(e, r)), s = t.find((e) => K.gte(e, r));
1384
+ function ln(e, t) {
1385
+ let n = V.inc(e, "minor"), r = V.inc(e, "major"), i = [], a = t.find((t) => V.gt(t, e) && V.lt(t, n)), o = t.find((e) => V.gte(e, n) && V.lt(e, r)), s = t.find((e) => V.gte(e, r));
1325
1386
  return a && i.push({
1326
1387
  type: "patch",
1327
1388
  update: a
@@ -1333,21 +1394,24 @@ function xn(e, t) {
1333
1394
  update: s
1334
1395
  }), i;
1335
1396
  }
1336
- var Sn = class {
1397
+ var un = class {
1337
1398
  v2RootFolderReader;
1338
1399
  ops;
1339
1400
  constructor(e, t) {
1340
1401
  this.registryReader = e, this.v2RootFolderReader = e.relativeReader("v2/"), this.ops = {
1341
- ...bn,
1402
+ ...cn,
1342
1403
  ...t
1343
1404
  };
1344
1405
  }
1345
- embeddedGlobalMetaCache = new _e({
1406
+ embeddedGlobalMetaCache = new ce({
1346
1407
  max: 500,
1347
- fetchMethod: async (e, t, n) => await O(async () => await qe(n.context.relativeTo === void 0 ? this.v2RootFolderReader.getContentReader() : this.v2RootFolderReader.relativeReader(Y(n.context.relativeTo)).getContentReader()).parseAsync(n.context.meta), D)
1408
+ fetchMethod: async (e, t, n) => await S(async () => {
1409
+ let e = n.context.relativeTo === void 0 ? this.v2RootFolderReader.getContentReader() : this.v2RootFolderReader.relativeReader(G(n.context.relativeTo)).getContentReader();
1410
+ return await Be(n.context.meta, e);
1411
+ }, x)
1348
1412
  });
1349
1413
  async embedMetaContent(e, t, n, r) {
1350
- return await this.embeddedGlobalMetaCache.forceFetch(ge({
1414
+ return await this.embeddedGlobalMetaCache.forceFetch(se({
1351
1415
  id: e,
1352
1416
  sha256: t,
1353
1417
  absolutePath: n
@@ -1361,8 +1425,8 @@ var Sn = class {
1361
1425
  async listBlockPacks(e) {
1362
1426
  if (this.listCache !== void 0 && Date.now() - this.listCacheTimestamp <= this.ops.cacheBlockListFor) return this.listCache;
1363
1427
  try {
1364
- return await O(async () => {
1365
- let t = Q.parse(JSON.parse(Buffer.from(await this.v2RootFolderReader.readFile($t, { signal: e?.signal })).toString())), n = await Promise.all(t.packages.map(async (e) => {
1428
+ return await S(async () => {
1429
+ let t = Y(JSON.parse(Buffer.from(await this.v2RootFolderReader.readFile(Kt, { signal: e?.signal })).toString())), n = await Promise.all(t.packages.map(async (e) => {
1366
1430
  let t = await Promise.all(Object.entries(e.latestByChannel).map(async ([e, t]) => [e, {
1367
1431
  id: t.description.id,
1368
1432
  meta: await this.embedMetaContent(t.description.id, t.manifestSha256, !0, t.description.meta),
@@ -1381,28 +1445,28 @@ var Sn = class {
1381
1445
  };
1382
1446
  }));
1383
1447
  return this.listCache = n, this.listCacheTimestamp = Date.now(), n;
1384
- }, D);
1448
+ }, x);
1385
1449
  } catch (e) {
1386
1450
  if (this.listCache !== void 0 && Date.now() - this.listCacheTimestamp <= this.ops.keepStaleBlockListFor) return this.listCache;
1387
1451
  throw e;
1388
1452
  }
1389
1453
  }
1390
1454
  async getLatestOverview(e, t) {
1391
- let n = (await this.listBlockPacks()).find((t) => ie(e, t.id));
1455
+ let n = (await this.listBlockPacks()).find((t) => g(e, t.id));
1392
1456
  if (n !== void 0) return n.latestByChannel[t];
1393
1457
  }
1394
1458
  async getUpdateSuggestions(e, t) {
1395
- let n = (await this.listBlockPacks()).find((t) => ie(e, t.id));
1459
+ let n = (await this.listBlockPacks()).find((t) => g(e, t.id));
1396
1460
  if (n === void 0) return;
1397
- let r = n.allVersions.filter((e) => t === s || e.channels.indexOf(t) >= 0).map((e) => e.version);
1398
- return r.reverse(), xn(e.version, r);
1461
+ let r = n.allVersions.filter((e) => t === o || e.channels.indexOf(t) >= 0).map((e) => e.version);
1462
+ return r.reverse(), ln(e.version, r);
1399
1463
  }
1400
1464
  async getSpecificOverview(e, t) {
1401
- return await O(async () => {
1402
- let n = await this.v2RootFolderReader.readFile(Y(e) + rn), r = p.parse(JSON.parse(Buffer.from(n).toString()));
1465
+ return await S(async () => {
1466
+ let n = await this.v2RootFolderReader.readFile(G(e) + Yt), r = u.parse(JSON.parse(Buffer.from(n).toString()));
1403
1467
  return {
1404
1468
  id: e,
1405
- meta: await this.embedMetaContent(e, await P(n), !1, r.description.meta),
1469
+ meta: await this.embedMetaContent(e, await k(n), !1, r.description.meta),
1406
1470
  spec: {
1407
1471
  type: "from-registry-v2",
1408
1472
  id: e,
@@ -1410,19 +1474,19 @@ var Sn = class {
1410
1474
  channel: t
1411
1475
  }
1412
1476
  };
1413
- }, D);
1477
+ }, x);
1414
1478
  }
1415
- componentsCache = new _e({
1479
+ componentsCache = new ce({
1416
1480
  max: 500,
1417
- fetchMethod: async (e, t, { context: n }) => await O(async () => {
1418
- let e = this.v2RootFolderReader.relativeReader(Y(n)), t = p.parse(JSON.parse(Buffer.from(await e.readFile(q)).toString()));
1419
- return Xe(e.rootUrl.toString()).parse(t.description.components);
1420
- }, D)
1481
+ fetchMethod: async (e, t, { context: n }) => await S(async () => {
1482
+ let e = this.v2RootFolderReader.relativeReader(G(n));
1483
+ return Ue(u.parse(JSON.parse(Buffer.from(await e.readFile(H)).toString())).description.components, e.rootUrl.toString());
1484
+ }, x)
1421
1485
  });
1422
1486
  async getComponents(e) {
1423
- return await this.componentsCache.forceFetch(ge(e), { context: e });
1487
+ return await this.componentsCache.forceFetch(se(e), { context: e });
1424
1488
  }
1425
- }, Cn = class {
1489
+ }, dn = class {
1426
1490
  constructor(e, t, n) {
1427
1491
  this.client = e, this.bucket = t, this.root = n;
1428
1492
  }
@@ -1430,7 +1494,7 @@ var Sn = class {
1430
1494
  try {
1431
1495
  return Buffer.from(await (await this.client.getObject({
1432
1496
  Bucket: this.bucket,
1433
- Key: k.join(this.root, e)
1497
+ Key: w.join(this.root, e)
1434
1498
  })).Body.transformToByteArray());
1435
1499
  } catch (e) {
1436
1500
  if (e instanceof Error && e.name === "NoSuchKey") return;
@@ -1438,35 +1502,35 @@ var Sn = class {
1438
1502
  }
1439
1503
  }
1440
1504
  async listFiles(e) {
1441
- let t = k.join(this.root, e), n = ye({ client: this.client }, {
1505
+ let t = w.join(this.root, e), n = ue({ client: this.client }, {
1442
1506
  Bucket: this.bucket,
1443
1507
  Prefix: t
1444
1508
  }), r = [];
1445
- for await (let e of n) r.push(...(e.Contents ?? []).map((e) => k.relative(t, e.Key)));
1509
+ for await (let e of n) r.push(...(e.Contents ?? []).map((e) => w.relative(t, e.Key)));
1446
1510
  return r;
1447
1511
  }
1448
1512
  async putFile(e, t) {
1449
1513
  await this.client.putObject({
1450
1514
  Bucket: this.bucket,
1451
- Key: k.join(this.root, e),
1515
+ Key: w.join(this.root, e),
1452
1516
  Body: t
1453
1517
  });
1454
1518
  }
1455
1519
  async deleteFiles(...e) {
1456
1520
  let t = await this.client.deleteObjects({
1457
1521
  Bucket: this.bucket,
1458
- Delete: { Objects: e.map((e) => ({ Key: k.join(this.root, e) })) }
1522
+ Delete: { Objects: e.map((e) => ({ Key: w.join(this.root, e) })) }
1459
1523
  });
1460
1524
  if (t.Errors !== void 0 && t.Errors.length > 0) throw Error(`Errors encountered while deleting files: ${t.Errors.map((e) => e.Message ?? e.Code ?? "Unknown error").join("\n")}`);
1461
1525
  }
1462
- }, wn = class {
1526
+ }, fn = class {
1463
1527
  root;
1464
1528
  constructor(t) {
1465
1529
  this.root = e.resolve(t);
1466
1530
  }
1467
1531
  toAbsolutePath(t) {
1468
- if (k.isAbsolute(t)) throw Error("absolute path");
1469
- return e.resolve(this.root, t.split(k.sep).join(e.sep));
1532
+ if (w.isAbsolute(t)) throw Error("absolute path");
1533
+ return e.resolve(this.root, t.split(w.sep).join(e.sep));
1470
1534
  }
1471
1535
  async getFile(e) {
1472
1536
  try {
@@ -1482,7 +1546,7 @@ var Sn = class {
1482
1546
  return (await t.promises.readdir(r, {
1483
1547
  recursive: !0,
1484
1548
  withFileTypes: !0
1485
- })).filter((e) => e.isFile()).map((t) => e.relative(r, e.resolve(t.parentPath, t.name)).split(e.sep).join(k.sep));
1549
+ })).filter((e) => e.isFile()).map((t) => e.relative(r, e.resolve(t.parentPath, t.name)).split(e.sep).join(w.sep));
1486
1550
  } catch (e) {
1487
1551
  if (e instanceof Error && "code" in e && e.code === "ENOENT") return [];
1488
1552
  throw e;
@@ -1496,27 +1560,27 @@ var Sn = class {
1496
1560
  for (let n of e) await t.promises.rm(this.toAbsolutePath(n));
1497
1561
  }
1498
1562
  };
1499
- function Tn(t) {
1500
- let n = new URL(t, `file:${e.resolve(".").split(e.sep).join(k.sep)}/`);
1563
+ function pn(t) {
1564
+ let n = new URL(t, `file:${e.resolve(".").split(e.sep).join(w.sep)}/`);
1501
1565
  switch (n.protocol) {
1502
- case "file:": return new wn(e.resolve(n.pathname));
1566
+ case "file:": return new fn(e.resolve(n.pathname));
1503
1567
  case "s3:": {
1504
1568
  let e = {}, t = n.searchParams.get("region");
1505
1569
  t && (e.region = t);
1506
1570
  let r = n.hostname;
1507
- return new Cn(new ve(e), r, n.pathname.replace(/^\//, ""));
1571
+ return new dn(new le(e), r, n.pathname.replace(/^\//, ""));
1508
1572
  }
1509
1573
  default: throw Error(`Unknown protocol: ${n.protocol}`);
1510
1574
  }
1511
1575
  }
1512
1576
  //#endregion
1513
1577
  //#region src/io/folder_reader.ts
1514
- var En = class e {
1578
+ var mn = class e {
1515
1579
  constructor(e, t) {
1516
1580
  this.rootUrl = e, this.httpDispatcher = t;
1517
1581
  }
1518
1582
  async readFile(e, t) {
1519
- let n = await be(new URL(e, this.rootUrl), {
1583
+ let n = await de(new URL(e, this.rootUrl), {
1520
1584
  dispatcher: this.httpDispatcher,
1521
1585
  signal: t?.signal
1522
1586
  });
@@ -1529,82 +1593,82 @@ var En = class e {
1529
1593
  let t = e === void 0 ? this : this.relativeReader(e);
1530
1594
  return (e) => t.readFile(e);
1531
1595
  }
1532
- }, Dn = class t {
1596
+ }, hn = class t {
1533
1597
  constructor(e, t) {
1534
1598
  this.rootUrl = e, this.root = t;
1535
1599
  }
1536
- async readFile(t, n) {
1537
- let i = e.join(this.root, ...t.split(k.sep));
1538
- return await r.readFile(i, { signal: n?.signal });
1600
+ async readFile(t, r) {
1601
+ let i = e.join(this.root, ...t.split(w.sep));
1602
+ return await n.readFile(i, { signal: r?.signal });
1539
1603
  }
1540
1604
  relativeReader(n) {
1541
- return n.endsWith("/") || (n += "/"), new t(new URL(n, this.rootUrl), e.join(this.root, ...n.split(k.sep)));
1605
+ return n.endsWith("/") || (n += "/"), new t(new URL(n, this.rootUrl), e.join(this.root, ...n.split(w.sep)));
1542
1606
  }
1543
1607
  getContentReader(e) {
1544
1608
  let t = e === void 0 ? this : this.relativeReader(e);
1545
1609
  return (e) => t.readFile(e);
1546
1610
  }
1547
1611
  };
1548
- function On(t) {
1549
- return t.split(k.sep).join(e.sep);
1612
+ function gn(t) {
1613
+ return t.split(w.sep).join(e.sep);
1550
1614
  }
1551
- function kn(t) {
1552
- return t.split(e.sep).join(k.sep);
1615
+ function _n(t) {
1616
+ return t.split(e.sep).join(w.sep);
1553
1617
  }
1554
- function An(t, n) {
1618
+ function vn(t, n) {
1555
1619
  t.endsWith("/") || (t += "/");
1556
- let r = new URL(t, `file:${kn(e.resolve("."))}/`);
1620
+ let r = new URL(t, `file:${_n(e.resolve("."))}/`);
1557
1621
  switch (r.protocol) {
1558
- case "file:": return new Dn(r, On(r.pathname));
1622
+ case "file:": return new hn(r, gn(r.pathname));
1559
1623
  case "https:":
1560
- case "http:": return new En(r, n ?? xe());
1624
+ case "http:": return new mn(r, n ?? fe());
1561
1625
  default: throw Error(`Unknown protocol: ${r.protocol}`);
1562
1626
  }
1563
1627
  }
1564
1628
  //#endregion
1565
1629
  //#region src/common_types.ts
1566
- var jn = n.string().regex(/^(?:s3:|file:)/), Mn = n.object({
1567
- organization: n.string(),
1568
- package: n.string(),
1569
- version: T.optional(),
1570
- files: n.record(n.string().regex(/^[^/]+$/), n.string()).default({}),
1571
- meta: n.object({}).passthrough()
1572
- }), Nn = n.object({
1573
- registries: n.record(n.string(), jn).default({}),
1574
- registry: n.string().optional()
1575
- }), Pn = Nn.merge(Mn).required({
1630
+ var yn = C.string().regex(/^(?:s3:|file:)/), bn = C.object({
1631
+ organization: C.string(),
1632
+ package: C.string(),
1633
+ version: f.optional(),
1634
+ files: C.record(C.string().regex(/^[^/]+$/), C.string()).default({}),
1635
+ meta: C.object({}).passthrough()
1636
+ }), xn = C.object({
1637
+ registries: C.record(C.string(), yn).default({}),
1638
+ registry: C.string().optional()
1639
+ }), Sn = xn.merge(bn).required({
1576
1640
  registry: !0,
1577
1641
  version: !0
1578
- }), Fn = Pn.partial().required({
1642
+ }), X = Sn.partial().required({
1579
1643
  registries: !0,
1580
1644
  files: !0
1581
- }), In = "pl.package.json", Ln = "pl.package.yaml", Rn = "v1/";
1582
- function zn(e) {
1583
- return `${Rn}${e.organization}/${e.package}/${e.version}`;
1645
+ }), Cn = "pl.package.json", wn = "pl.package.yaml", Z = "v1/";
1646
+ function Tn(e) {
1647
+ return `${Z}${e.organization}/${e.package}/${e.version}`;
1584
1648
  }
1585
- function Bn(e, t) {
1586
- return `${Rn}${e.organization}/${e.package}/${e.version}/${t}`;
1649
+ function En(e, t) {
1650
+ return `${Z}${e.organization}/${e.package}/${e.version}/${t}`;
1587
1651
  }
1588
- function Vn(e) {
1589
- return `${Rn}${e.organization}/${e.package}/overview.json`;
1652
+ function Dn(e) {
1653
+ return `${Z}${e.organization}/${e.package}/overview.json`;
1590
1654
  }
1591
- var Hn = `${Rn}overview.json`, Un = "meta.json", Wn = "_updates_v1/per_package_version/";
1592
- function Gn(e, t) {
1593
- return `${Wn}${e.organization}/${e.package}/${e.version}/${t}`;
1655
+ var Q = `${Z}overview.json`, On = "meta.json", kn = "_updates_v1/per_package_version/";
1656
+ function An(e, t) {
1657
+ return `${kn}${e.organization}/${e.package}/${e.version}/${t}`;
1594
1658
  }
1595
- var Kn = /(?<packageKeyWithoutVersion>(?<organization>[^/]+)\/(?<pkg>[^/]+))\/(?<version>[^/]+)\/(?<seed>[^/]+)$/, qn = "_updates_v1/_global_update_in", Jn = "_updates_v1/_global_update_out", Yn = class {
1659
+ var jn = /(?<packageKeyWithoutVersion>(?<organization>[^/]+)\/(?<pkg>[^/]+))\/(?<version>[^/]+)\/(?<seed>[^/]+)$/, Mn = "_updates_v1/_global_update_in", Nn = "_updates_v1/_global_update_out", Pn = class {
1596
1660
  constructor(e, t) {
1597
1661
  this.storage = e, this.logger = t;
1598
1662
  }
1599
1663
  constructNewPackage(e) {
1600
- return new Xn(this.storage, e);
1664
+ return new Fn(this.storage, e);
1601
1665
  }
1602
1666
  async updateRegistry() {
1603
1667
  this.logger?.info("Initiating registry refresh...");
1604
- let e = /* @__PURE__ */ new Map(), t = [], n = await this.storage.listFiles(Wn);
1668
+ let e = /* @__PURE__ */ new Map(), t = [], n = await this.storage.listFiles(kn);
1605
1669
  this.logger?.info("Packages to be updated:");
1606
1670
  for (let r of n) {
1607
- let n = r.match(Kn);
1671
+ let n = r.match(jn);
1608
1672
  if (!n) continue;
1609
1673
  t.push(r);
1610
1674
  let { packageKeyWithoutVersion: i, organization: a, pkg: o, version: s, seed: c } = n.groups, l = e.get(i);
@@ -1616,22 +1680,22 @@ var Kn = /(?<packageKeyWithoutVersion>(?<organization>[^/]+)\/(?<pkg>[^/]+))\/(?
1616
1680
  versions: new Set([s])
1617
1681
  }), this.logger?.info(` - ${a}:${o}:${s}`);
1618
1682
  }
1619
- let r = await this.storage.getFile(Hn), i = r === void 0 ? [] : JSON.parse(r.toString());
1683
+ let r = await this.storage.getFile(Q), i = r === void 0 ? [] : JSON.parse(r.toString());
1620
1684
  this.logger?.info(`Global overview loaded, ${i.length} records`);
1621
1685
  for (let [, t] of e.entries()) {
1622
- let e = Vn(t.package), n = await this.storage.getFile(e), r = n === void 0 ? [] : JSON.parse(n.toString());
1686
+ let e = Dn(t.package), n = await this.storage.getFile(e), r = n === void 0 ? [] : JSON.parse(n.toString());
1623
1687
  this.logger?.info(`Updating ${t.package.organization}:${t.package.package} overview, ${r.length} records`), r = r.filter((e) => !t.versions.has(e.version));
1624
1688
  for (let [e] of t.versions.entries()) {
1625
- let n = e.toString(), i = await this.storage.getFile(Bn({
1689
+ let n = e.toString(), i = await this.storage.getFile(En({
1626
1690
  ...t.package,
1627
1691
  version: n
1628
- }, Un));
1692
+ }, On));
1629
1693
  i && r.push({
1630
1694
  version: n,
1631
1695
  meta: JSON.parse(i.toString())
1632
1696
  });
1633
1697
  }
1634
- r.sort((e, t) => K.compare(t.version, e.version)), await this.storage.putFile(e, Buffer.from(JSON.stringify(r))), this.logger?.info(`Done (${r.length} records)`), i = i.filter((e) => e.organization !== t.package.organization || e.package !== t.package.package), i.push({
1698
+ r.sort((e, t) => V.compare(t.version, e.version)), await this.storage.putFile(e, Buffer.from(JSON.stringify(r))), this.logger?.info(`Done (${r.length} records)`), i = i.filter((e) => e.organization !== t.package.organization || e.package !== t.package.package), i.push({
1635
1699
  organization: t.package.organization,
1636
1700
  package: t.package.package,
1637
1701
  allVersions: r.map((e) => e.version).reverse(),
@@ -1639,36 +1703,36 @@ var Kn = /(?<packageKeyWithoutVersion>(?<organization>[^/]+)\/(?<pkg>[^/]+))\/(?
1639
1703
  latestMeta: r[0].meta
1640
1704
  });
1641
1705
  }
1642
- await this.storage.putFile(Hn, Buffer.from(JSON.stringify(i))), this.logger?.info(`Global overview updated (${i.length} records)`), await this.storage.deleteFiles(...t.map((e) => `${Wn}${e}`)), this.logger?.info("Version update requests cleared");
1706
+ await this.storage.putFile(Q, Buffer.from(JSON.stringify(i))), this.logger?.info(`Global overview updated (${i.length} records)`), await this.storage.deleteFiles(...t.map((e) => `${kn}${e}`)), this.logger?.info("Version update requests cleared");
1643
1707
  }
1644
1708
  async updateIfNeeded(e = !1) {
1645
1709
  this.logger?.info("Checking if registry requires refresh...");
1646
- let t = await this.storage.getFile(qn), n = await this.storage.getFile(Jn);
1647
- !e && t === void 0 && n === void 0 || !e && t !== void 0 && n !== void 0 && t.equals(n) || (await this.updateRegistry(), t && (await this.storage.putFile(Jn, t), this.logger?.info("Refresh finished")));
1710
+ let t = await this.storage.getFile(Mn), n = await this.storage.getFile(Nn);
1711
+ !e && t === void 0 && n === void 0 || !e && t !== void 0 && n !== void 0 && t.equals(n) || (await this.updateRegistry(), t && (await this.storage.putFile(Nn, t), this.logger?.info("Refresh finished")));
1648
1712
  }
1649
1713
  async getPackageOverview(e) {
1650
- let t = await this.storage.getFile(Vn(e));
1714
+ let t = await this.storage.getFile(Dn(e));
1651
1715
  if (t !== void 0) return JSON.parse(t.toString());
1652
1716
  }
1653
1717
  async getGlobalOverview() {
1654
- let e = await this.storage.getFile(Hn);
1718
+ let e = await this.storage.getFile(Q);
1655
1719
  if (e !== void 0) return JSON.parse(e.toString());
1656
1720
  }
1657
- }, Xn = class {
1721
+ }, Fn = class {
1658
1722
  metaAdded = !1;
1659
- seed = fe();
1723
+ seed = re();
1660
1724
  constructor(e, t) {
1661
1725
  this.storage = e, this.name = t;
1662
1726
  }
1663
1727
  async addFile(e, t) {
1664
- await this.storage.putFile(Bn(this.name, e), t);
1728
+ await this.storage.putFile(En(this.name, e), t);
1665
1729
  }
1666
1730
  async writeMeta(e) {
1667
- await this.addFile(Un, Buffer.from(JSON.stringify(e))), this.metaAdded = !0;
1731
+ await this.addFile(On, Buffer.from(JSON.stringify(e))), this.metaAdded = !0;
1668
1732
  }
1669
1733
  async finish() {
1670
1734
  if (!this.metaAdded) throw Error("meta not added");
1671
- await this.storage.putFile(Gn(this.name, this.seed), Buffer.of(0)), await this.storage.putFile(qn, Buffer.from(this.seed));
1735
+ await this.storage.putFile(An(this.name, this.seed), Buffer.of(0)), await this.storage.putFile(Mn, Buffer.from(this.seed));
1672
1736
  }
1673
1737
  };
1674
1738
  //#endregion
@@ -1687,17 +1751,17 @@ function $(e, t) {
1687
1751
  }
1688
1752
  };
1689
1753
  }
1690
- async function Zn(e) {
1691
- return et(e, (e) => Fn.parse(JSON.parse(e.toString())));
1754
+ async function In(e) {
1755
+ return qe(e, (e) => X.parse(JSON.parse(e.toString())));
1692
1756
  }
1693
- async function Qn(e) {
1694
- return et(e, (e) => Fn.parse(Se.parse(e.toString())));
1757
+ async function Ln(e) {
1758
+ return qe(e, (e) => X.parse(pe.parse(e.toString())));
1695
1759
  }
1696
- async function $n() {
1697
- let e = Fn.parse({});
1698
- return e = $(e, await Zn("./.pl.reg.json")), e = $(e, await Qn("./.pl.reg.yaml")), e = $(e, await Zn(`${Ce.homedir()}/.pl.reg.json`)), e = $(e, await Qn(`${Ce.homedir()}/.pl.reg.yaml`)), e = $(e, await Zn(In)), e = $(e, await Qn(Ln)), e;
1760
+ async function Rn() {
1761
+ let e = X.parse({});
1762
+ return e = $(e, await In("./.pl.reg.json")), e = $(e, await Ln("./.pl.reg.yaml")), e = $(e, await In(`${me.homedir()}/.pl.reg.json`)), e = $(e, await Ln(`${me.homedir()}/.pl.reg.yaml`)), e = $(e, await In(Cn)), e = $(e, await Ln(wn)), e;
1699
1763
  }
1700
- var er = class {
1764
+ var zn = class {
1701
1765
  constructor(e) {
1702
1766
  this.conf = e;
1703
1767
  }
@@ -1708,7 +1772,7 @@ var er = class {
1708
1772
  if (!e) throw Error(`Registry with alias "${t}" not found`);
1709
1773
  t = e;
1710
1774
  }
1711
- return new Yn(Tn(t), e);
1775
+ return new Pn(pn(t), e);
1712
1776
  }
1713
1777
  get fullPackageName() {
1714
1778
  return {
@@ -1718,11 +1782,11 @@ var er = class {
1718
1782
  };
1719
1783
  }
1720
1784
  };
1721
- async function tr(e) {
1722
- let t = await $n();
1723
- return new er(Pn.parse($(t, e)));
1785
+ async function Bn(e) {
1786
+ let t = await Rn();
1787
+ return new zn(Sn.parse($(t, e)));
1724
1788
  }
1725
1789
  //#endregion
1726
- export { Qe as $, Z as A, an as B, J as C, Ne as Ct, $t as D, mn as E, q as F, cn as G, ln as H, rn as I, st as J, sn as K, dn as L, vn as M, _n as N, en as O, Qt as P, nt as Q, on as R, nn as S, Ae as St, pn as T, X as U, un as V, Y as W, it as X, ot as Y, at as Z, Tn as _, Be as _t, zn as a, We as at, yn as b, N as bt, Mn as c, Ke as ct, Nn as d, Fe as dt, $e as et, Pn as f, Re as ft, Cn as g, Ie as gt, wn as h, j as ht, Un as i, Je as it, Q as j, fn as k, In as l, qe as lt, An as m, Le as mt, tr as n, Xe as nt, Vn as o, Ue as ot, Fn as p, ze as pt, F as q, Hn as r, Ye as rt, Bn as s, Ge as st, er as t, Ze as tt, Ln as u, Pe as ut, Sn as v, Ve as vt, hn as w, gn as x, M as xt, xn as y, He as yt, tn as z };
1790
+ export { Le as $, tn as A, Y as B, Kt as C, Gt as D, J as E, $t as F, Qe as G, et as H, K as I, Ge as J, Ye as K, G as L, Jt as M, Xt as N, H as O, en as P, Ve as Q, Qt as R, U as S, nn as T, $e as U, A as V, Ze as W, Ue as X, We as Y, He as Z, pn as _, Ce as _t, Tn as a, ke as at, sn as b, bn as c, Ee as ct, xn as d, Pe as dt, Re as et, Sn as f, Fe as ft, dn as g, be as gt, fn as h, Te as ht, On as i, Oe as it, q as j, Yt as k, Cn as l, je as lt, vn as m, we as mt, Bn as n, Be as nt, Dn as o, De as ot, X as p, Me as pt, O as q, Q as r, Ie as rt, En as s, Ae as st, zn as t, ze as tt, wn as u, Ne as ut, un as v, qt as w, W as x, ln as y, Zt as z };
1727
1791
 
1728
- //# sourceMappingURL=config-CzNlwcwn.mjs.map
1792
+ //# sourceMappingURL=config-DpfTzcgG.mjs.map