blackmistcode commited on
Commit
5becaed
·
verified ·
1 Parent(s): 2c02e29

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. backend/node_modules/@prisma/fetch-engine/dist/BinaryType.d.ts +5 -0
  2. backend/node_modules/@prisma/fetch-engine/dist/BinaryType.js +25 -0
  3. backend/node_modules/@prisma/fetch-engine/dist/chmodPlusX.d.ts +1 -0
  4. backend/node_modules/@prisma/fetch-engine/dist/chunk-3VVCXIQ5.js +67 -0
  5. backend/node_modules/@prisma/fetch-engine/dist/chunk-4C3J5AMP.js +2588 -0
  6. backend/node_modules/@prisma/fetch-engine/dist/chunk-CCMBPDR2.js +2588 -0
  7. backend/node_modules/@prisma/fetch-engine/dist/chunk-FKGWOTGU.js +49 -0
  8. backend/node_modules/@prisma/fetch-engine/dist/chunk-FSAAZH62.js +190 -0
  9. backend/node_modules/@prisma/fetch-engine/dist/chunk-LONQL55G.js +2348 -0
  10. backend/node_modules/@prisma/fetch-engine/dist/chunk-QFA3XBMW.js +159 -0
  11. backend/node_modules/@prisma/fetch-engine/dist/chunk-QGM4M3NI.js +56 -0
  12. backend/node_modules/@prisma/fetch-engine/dist/chunk-VAPNG6TS.js +1642 -0
  13. backend/node_modules/@prisma/fetch-engine/dist/cleanupCache.d.ts +1 -0
  14. backend/node_modules/@prisma/fetch-engine/dist/cleanupCache.js +28 -0
  15. backend/node_modules/@prisma/fetch-engine/dist/download.d.ts +27 -0
  16. backend/node_modules/@prisma/fetch-engine/dist/env.d.ts +14 -0
  17. backend/node_modules/@prisma/fetch-engine/dist/env.js +29 -0
  18. backend/node_modules/@prisma/fetch-engine/dist/getHash.js +25 -0
  19. backend/node_modules/@prisma/fetch-engine/dist/getProxyAgent.d.ts +3 -0
  20. backend/node_modules/@prisma/fetch-engine/dist/getProxyAgent.js +25 -0
  21. backend/node_modules/@prisma/fetch-engine/dist/index.js +49 -0
  22. backend/node_modules/@prisma/fetch-engine/dist/log.d.ts +2 -0
  23. backend/node_modules/@prisma/fetch-engine/dist/log.js +25 -0
  24. backend/node_modules/@prisma/fetch-engine/dist/multipart-parser-ASKQAOL4.js +374 -0
  25. backend/node_modules/@prisma/fetch-engine/dist/utils.d.ts +11 -0
  26. backend/node_modules/effect/.index/package.json +6 -0
  27. backend/node_modules/effect/Arbitrary/package.json +6 -0
  28. backend/node_modules/effect/Array/package.json +6 -0
  29. backend/node_modules/effect/BigDecimal/package.json +6 -0
  30. backend/node_modules/effect/Boolean/package.json +6 -0
  31. backend/node_modules/effect/Brand/package.json +6 -0
  32. backend/node_modules/effect/Cache/package.json +6 -0
  33. backend/node_modules/effect/Cause/package.json +6 -0
  34. backend/node_modules/effect/Channel/package.json +6 -0
  35. backend/node_modules/effect/ChildExecutorDecision/package.json +6 -0
  36. backend/node_modules/effect/Chunk/package.json +6 -0
  37. backend/node_modules/effect/Config/package.json +6 -0
  38. backend/node_modules/effect/ConfigError/package.json +6 -0
  39. backend/node_modules/effect/DateTime/package.json +6 -0
  40. backend/node_modules/effect/DefaultServices/package.json +6 -0
  41. backend/node_modules/effect/Deferred/package.json +6 -0
  42. backend/node_modules/effect/Differ/package.json +6 -0
  43. backend/node_modules/effect/Effect/package.json +6 -0
  44. backend/node_modules/effect/Encoding/package.json +6 -0
  45. backend/node_modules/effect/Equivalence/package.json +6 -0
  46. backend/node_modules/effect/ExecutionPlan/package.json +6 -0
  47. backend/node_modules/effect/FastCheck/package.json +6 -0
  48. backend/node_modules/effect/FiberRef/package.json +6 -0
  49. backend/node_modules/effect/FiberRefs/package.json +6 -0
  50. backend/node_modules/effect/FiberSet/package.json +6 -0
backend/node_modules/@prisma/fetch-engine/dist/BinaryType.d.ts ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ export declare enum BinaryType {
2
+ QueryEngineBinary = "query-engine",
3
+ QueryEngineLibrary = "libquery-engine",
4
+ SchemaEngineBinary = "schema-engine"
5
+ }
backend/node_modules/@prisma/fetch-engine/dist/BinaryType.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var BinaryType_exports = {};
20
+ __export(BinaryType_exports, {
21
+ BinaryType: () => import_chunk_X37PZICB.BinaryType
22
+ });
23
+ module.exports = __toCommonJS(BinaryType_exports);
24
+ var import_chunk_X37PZICB = require("./chunk-X37PZICB.js");
25
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
backend/node_modules/@prisma/fetch-engine/dist/chmodPlusX.d.ts ADDED
@@ -0,0 +1 @@
 
 
1
+ export declare function chmodPlusX(file: string): void;
backend/node_modules/@prisma/fetch-engine/dist/chunk-3VVCXIQ5.js ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var chunk_3VVCXIQ5_exports = {};
30
+ __export(chunk_3VVCXIQ5_exports, {
31
+ cleanupCache: () => cleanupCache
32
+ });
33
+ module.exports = __toCommonJS(chunk_3VVCXIQ5_exports);
34
+ var import_chunk_FSAAZH62 = require("./chunk-FSAAZH62.js");
35
+ var import_chunk_LONQL55G = require("./chunk-LONQL55G.js");
36
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
37
+ var import_node_fs = __toESM(require("node:fs"));
38
+ var import_node_path = __toESM(require("node:path"));
39
+ var import_debug = __toESM(require("@prisma/debug"));
40
+ var import_p_map = (0, import_chunk_QGM4M3NI.__toESM)((0, import_chunk_FSAAZH62.require_p_map)());
41
+ var debug = (0, import_debug.default)("cleanupCache");
42
+ async function cleanupCache(n = 5) {
43
+ try {
44
+ const rootCacheDir = await (0, import_chunk_LONQL55G.getRootCacheDir)();
45
+ if (!rootCacheDir) {
46
+ debug("no rootCacheDir found");
47
+ return;
48
+ }
49
+ const channel = "master";
50
+ const cacheDir = import_node_path.default.join(rootCacheDir, channel);
51
+ const dirs = await import_node_fs.default.promises.readdir(cacheDir);
52
+ const dirsWithMeta = await Promise.all(
53
+ dirs.map(async (dirName) => {
54
+ const dir = import_node_path.default.join(cacheDir, dirName);
55
+ const statResult = await import_node_fs.default.promises.stat(dir);
56
+ return {
57
+ dir,
58
+ created: statResult.birthtime
59
+ };
60
+ })
61
+ );
62
+ dirsWithMeta.sort((a, b) => a.created < b.created ? 1 : -1);
63
+ const dirsToRemove = dirsWithMeta.slice(n);
64
+ await (0, import_p_map.default)(dirsToRemove, (dir) => import_node_fs.default.promises.rm(dir.dir, { force: true, recursive: true }), { concurrency: 20 });
65
+ } catch (e) {
66
+ }
67
+ }
backend/node_modules/@prisma/fetch-engine/dist/chunk-4C3J5AMP.js ADDED
@@ -0,0 +1,2588 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var chunk_4C3J5AMP_exports = {};
30
+ __export(chunk_4C3J5AMP_exports, {
31
+ download: () => download,
32
+ getBinaryName: () => getBinaryName,
33
+ getVersion: () => getVersion,
34
+ maybeCopyToTmp: () => maybeCopyToTmp,
35
+ plusX: () => plusX,
36
+ vercelPkgPathRegex: () => vercelPkgPathRegex
37
+ });
38
+ module.exports = __toCommonJS(chunk_4C3J5AMP_exports);
39
+ var import_chunk_MWVY55RY = require("./chunk-MWVY55RY.js");
40
+ var import_chunk_7JLQJWOR = require("./chunk-7JLQJWOR.js");
41
+ var import_chunk_3VVCXIQ5 = require("./chunk-3VVCXIQ5.js");
42
+ var import_chunk_CY52DY2B = require("./chunk-CY52DY2B.js");
43
+ var import_chunk_LONQL55G = require("./chunk-LONQL55G.js");
44
+ var import_chunk_QFA3XBMW = require("./chunk-QFA3XBMW.js");
45
+ var import_chunk_FKGWOTGU = require("./chunk-FKGWOTGU.js");
46
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
47
+ var import_node_fs = __toESM(require("node:fs"));
48
+ var import_node_path = __toESM(require("node:path"));
49
+ var import_node_util = require("node:util");
50
+ var import_debug = __toESM(require("@prisma/debug"));
51
+ var import_get_platform = require("@prisma/get-platform");
52
+ var import_node_buffer = require("node:buffer");
53
+ var import_node_path2 = __toESM(require("node:path"));
54
+ var import_node_child_process = __toESM(require("node:child_process"));
55
+ var import_node_process = __toESM(require("node:process"));
56
+ var import_node_process2 = __toESM(require("node:process"));
57
+ var import_node_path3 = __toESM(require("node:path"));
58
+ var import_node_url = require("node:url");
59
+ var import_node_process3 = __toESM(require("node:process"));
60
+ var import_node_os = require("node:os");
61
+ var import_node_os2 = require("node:os");
62
+ var import_node_os3 = __toESM(require("node:os"));
63
+ var import_node_fs2 = require("node:fs");
64
+ var import_node_child_process2 = require("node:child_process");
65
+ var import_node_fs3 = require("node:fs");
66
+ var import_promises = require("node:timers/promises");
67
+ var import_node_buffer2 = require("node:buffer");
68
+ var import_node_child_process3 = require("node:child_process");
69
+ var import_node_util2 = require("node:util");
70
+ var import_node_process4 = __toESM(require("node:process"));
71
+ var require_windows = (0, import_chunk_QGM4M3NI.__commonJS)({
72
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
73
+ "use strict";
74
+ module2.exports = isexe;
75
+ isexe.sync = sync;
76
+ var fs2 = (0, import_chunk_QGM4M3NI.__require)("fs");
77
+ function checkPathExt(path4, options) {
78
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
79
+ if (!pathext) {
80
+ return true;
81
+ }
82
+ pathext = pathext.split(";");
83
+ if (pathext.indexOf("") !== -1) {
84
+ return true;
85
+ }
86
+ for (var i = 0; i < pathext.length; i++) {
87
+ var p = pathext[i].toLowerCase();
88
+ if (p && path4.substr(-p.length).toLowerCase() === p) {
89
+ return true;
90
+ }
91
+ }
92
+ return false;
93
+ }
94
+ function checkStat(stat, path4, options) {
95
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
96
+ return false;
97
+ }
98
+ return checkPathExt(path4, options);
99
+ }
100
+ function isexe(path4, options, cb) {
101
+ fs2.stat(path4, function(er, stat) {
102
+ cb(er, er ? false : checkStat(stat, path4, options));
103
+ });
104
+ }
105
+ function sync(path4, options) {
106
+ return checkStat(fs2.statSync(path4), path4, options);
107
+ }
108
+ }
109
+ });
110
+ var require_mode = (0, import_chunk_QGM4M3NI.__commonJS)({
111
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
112
+ "use strict";
113
+ module2.exports = isexe;
114
+ isexe.sync = sync;
115
+ var fs2 = (0, import_chunk_QGM4M3NI.__require)("fs");
116
+ function isexe(path4, options, cb) {
117
+ fs2.stat(path4, function(er, stat) {
118
+ cb(er, er ? false : checkStat(stat, options));
119
+ });
120
+ }
121
+ function sync(path4, options) {
122
+ return checkStat(fs2.statSync(path4), options);
123
+ }
124
+ function checkStat(stat, options) {
125
+ return stat.isFile() && checkMode(stat, options);
126
+ }
127
+ function checkMode(stat, options) {
128
+ var mod = stat.mode;
129
+ var uid = stat.uid;
130
+ var gid = stat.gid;
131
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
132
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
133
+ var u = parseInt("100", 8);
134
+ var g = parseInt("010", 8);
135
+ var o = parseInt("001", 8);
136
+ var ug = u | g;
137
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
138
+ return ret;
139
+ }
140
+ }
141
+ });
142
+ var require_isexe = (0, import_chunk_QGM4M3NI.__commonJS)({
143
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
144
+ "use strict";
145
+ var fs2 = (0, import_chunk_QGM4M3NI.__require)("fs");
146
+ var core;
147
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
148
+ core = require_windows();
149
+ } else {
150
+ core = require_mode();
151
+ }
152
+ module2.exports = isexe;
153
+ isexe.sync = sync;
154
+ function isexe(path4, options, cb) {
155
+ if (typeof options === "function") {
156
+ cb = options;
157
+ options = {};
158
+ }
159
+ if (!cb) {
160
+ if (typeof Promise !== "function") {
161
+ throw new TypeError("callback not provided");
162
+ }
163
+ return new Promise(function(resolve, reject) {
164
+ isexe(path4, options || {}, function(er, is) {
165
+ if (er) {
166
+ reject(er);
167
+ } else {
168
+ resolve(is);
169
+ }
170
+ });
171
+ });
172
+ }
173
+ core(path4, options || {}, function(er, is) {
174
+ if (er) {
175
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
176
+ er = null;
177
+ is = false;
178
+ }
179
+ }
180
+ cb(er, is);
181
+ });
182
+ }
183
+ function sync(path4, options) {
184
+ try {
185
+ return core.sync(path4, options || {});
186
+ } catch (er) {
187
+ if (options && options.ignoreErrors || er.code === "EACCES") {
188
+ return false;
189
+ } else {
190
+ throw er;
191
+ }
192
+ }
193
+ }
194
+ }
195
+ });
196
+ var require_which = (0, import_chunk_QGM4M3NI.__commonJS)({
197
+ "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module2) {
198
+ "use strict";
199
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
200
+ var path4 = (0, import_chunk_QGM4M3NI.__require)("path");
201
+ var COLON = isWindows ? ";" : ":";
202
+ var isexe = require_isexe();
203
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
204
+ var getPathInfo = (cmd, opt) => {
205
+ const colon = opt.colon || COLON;
206
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
207
+ // windows always checks the cwd first
208
+ ...isWindows ? [process.cwd()] : [],
209
+ ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
210
+ "").split(colon)
211
+ ];
212
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
213
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
214
+ if (isWindows) {
215
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
216
+ pathExt.unshift("");
217
+ }
218
+ return {
219
+ pathEnv,
220
+ pathExt,
221
+ pathExtExe
222
+ };
223
+ };
224
+ var which = (cmd, opt, cb) => {
225
+ if (typeof opt === "function") {
226
+ cb = opt;
227
+ opt = {};
228
+ }
229
+ if (!opt)
230
+ opt = {};
231
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
232
+ const found = [];
233
+ const step = (i) => new Promise((resolve, reject) => {
234
+ if (i === pathEnv.length)
235
+ return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
236
+ const ppRaw = pathEnv[i];
237
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
238
+ const pCmd = path4.join(pathPart, cmd);
239
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
240
+ resolve(subStep(p, i, 0));
241
+ });
242
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
243
+ if (ii === pathExt.length)
244
+ return resolve(step(i + 1));
245
+ const ext = pathExt[ii];
246
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
247
+ if (!er && is) {
248
+ if (opt.all)
249
+ found.push(p + ext);
250
+ else
251
+ return resolve(p + ext);
252
+ }
253
+ return resolve(subStep(p, i, ii + 1));
254
+ });
255
+ });
256
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
257
+ };
258
+ var whichSync = (cmd, opt) => {
259
+ opt = opt || {};
260
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
261
+ const found = [];
262
+ for (let i = 0; i < pathEnv.length; i++) {
263
+ const ppRaw = pathEnv[i];
264
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
265
+ const pCmd = path4.join(pathPart, cmd);
266
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
267
+ for (let j = 0; j < pathExt.length; j++) {
268
+ const cur = p + pathExt[j];
269
+ try {
270
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
271
+ if (is) {
272
+ if (opt.all)
273
+ found.push(cur);
274
+ else
275
+ return cur;
276
+ }
277
+ } catch (ex) {
278
+ }
279
+ }
280
+ }
281
+ if (opt.all && found.length)
282
+ return found;
283
+ if (opt.nothrow)
284
+ return null;
285
+ throw getNotFoundError(cmd);
286
+ };
287
+ module2.exports = which;
288
+ which.sync = whichSync;
289
+ }
290
+ });
291
+ var require_path_key = (0, import_chunk_QGM4M3NI.__commonJS)({
292
+ "../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports, module2) {
293
+ "use strict";
294
+ var pathKey2 = (options = {}) => {
295
+ const environment = options.env || process.env;
296
+ const platform = options.platform || process.platform;
297
+ if (platform !== "win32") {
298
+ return "PATH";
299
+ }
300
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
301
+ };
302
+ module2.exports = pathKey2;
303
+ module2.exports.default = pathKey2;
304
+ }
305
+ });
306
+ var require_resolveCommand = (0, import_chunk_QGM4M3NI.__commonJS)({
307
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
308
+ "use strict";
309
+ var path4 = (0, import_chunk_QGM4M3NI.__require)("path");
310
+ var which = require_which();
311
+ var getPathKey = require_path_key();
312
+ function resolveCommandAttempt(parsed, withoutPathExt) {
313
+ const env = parsed.options.env || process.env;
314
+ const cwd = process.cwd();
315
+ const hasCustomCwd = parsed.options.cwd != null;
316
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
317
+ if (shouldSwitchCwd) {
318
+ try {
319
+ process.chdir(parsed.options.cwd);
320
+ } catch (err) {
321
+ }
322
+ }
323
+ let resolved;
324
+ try {
325
+ resolved = which.sync(parsed.command, {
326
+ path: env[getPathKey({ env })],
327
+ pathExt: withoutPathExt ? path4.delimiter : void 0
328
+ });
329
+ } catch (e) {
330
+ } finally {
331
+ if (shouldSwitchCwd) {
332
+ process.chdir(cwd);
333
+ }
334
+ }
335
+ if (resolved) {
336
+ resolved = path4.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
337
+ }
338
+ return resolved;
339
+ }
340
+ function resolveCommand(parsed) {
341
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
342
+ }
343
+ module2.exports = resolveCommand;
344
+ }
345
+ });
346
+ var require_escape = (0, import_chunk_QGM4M3NI.__commonJS)({
347
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports, module2) {
348
+ "use strict";
349
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
350
+ function escapeCommand(arg) {
351
+ arg = arg.replace(metaCharsRegExp, "^$1");
352
+ return arg;
353
+ }
354
+ function escapeArgument(arg, doubleEscapeMetaChars) {
355
+ arg = `${arg}`;
356
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
357
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
358
+ arg = `"${arg}"`;
359
+ arg = arg.replace(metaCharsRegExp, "^$1");
360
+ if (doubleEscapeMetaChars) {
361
+ arg = arg.replace(metaCharsRegExp, "^$1");
362
+ }
363
+ return arg;
364
+ }
365
+ module2.exports.command = escapeCommand;
366
+ module2.exports.argument = escapeArgument;
367
+ }
368
+ });
369
+ var require_shebang_regex = (0, import_chunk_QGM4M3NI.__commonJS)({
370
+ "../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports, module2) {
371
+ "use strict";
372
+ module2.exports = /^#!(.*)/;
373
+ }
374
+ });
375
+ var require_shebang_command = (0, import_chunk_QGM4M3NI.__commonJS)({
376
+ "../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports, module2) {
377
+ "use strict";
378
+ var shebangRegex = require_shebang_regex();
379
+ module2.exports = (string = "") => {
380
+ const match = string.match(shebangRegex);
381
+ if (!match) {
382
+ return null;
383
+ }
384
+ const [path4, argument] = match[0].replace(/#! ?/, "").split(" ");
385
+ const binary = path4.split("/").pop();
386
+ if (binary === "env") {
387
+ return argument;
388
+ }
389
+ return argument ? `${binary} ${argument}` : binary;
390
+ };
391
+ }
392
+ });
393
+ var require_readShebang = (0, import_chunk_QGM4M3NI.__commonJS)({
394
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
395
+ "use strict";
396
+ var fs2 = (0, import_chunk_QGM4M3NI.__require)("fs");
397
+ var shebangCommand = require_shebang_command();
398
+ function readShebang(command) {
399
+ const size = 150;
400
+ const buffer = Buffer.alloc(size);
401
+ let fd;
402
+ try {
403
+ fd = fs2.openSync(command, "r");
404
+ fs2.readSync(fd, buffer, 0, size, 0);
405
+ fs2.closeSync(fd);
406
+ } catch (e) {
407
+ }
408
+ return shebangCommand(buffer.toString());
409
+ }
410
+ module2.exports = readShebang;
411
+ }
412
+ });
413
+ var require_parse = (0, import_chunk_QGM4M3NI.__commonJS)({
414
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module2) {
415
+ "use strict";
416
+ var path4 = (0, import_chunk_QGM4M3NI.__require)("path");
417
+ var resolveCommand = require_resolveCommand();
418
+ var escape = require_escape();
419
+ var readShebang = require_readShebang();
420
+ var isWin = process.platform === "win32";
421
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
422
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
423
+ function detectShebang(parsed) {
424
+ parsed.file = resolveCommand(parsed);
425
+ const shebang = parsed.file && readShebang(parsed.file);
426
+ if (shebang) {
427
+ parsed.args.unshift(parsed.file);
428
+ parsed.command = shebang;
429
+ return resolveCommand(parsed);
430
+ }
431
+ return parsed.file;
432
+ }
433
+ function parseNonShell(parsed) {
434
+ if (!isWin) {
435
+ return parsed;
436
+ }
437
+ const commandFile = detectShebang(parsed);
438
+ const needsShell = !isExecutableRegExp.test(commandFile);
439
+ if (parsed.options.forceShell || needsShell) {
440
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
441
+ parsed.command = path4.normalize(parsed.command);
442
+ parsed.command = escape.command(parsed.command);
443
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
444
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
445
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
446
+ parsed.command = process.env.comspec || "cmd.exe";
447
+ parsed.options.windowsVerbatimArguments = true;
448
+ }
449
+ return parsed;
450
+ }
451
+ function parse(command, args, options) {
452
+ if (args && !Array.isArray(args)) {
453
+ options = args;
454
+ args = null;
455
+ }
456
+ args = args ? args.slice(0) : [];
457
+ options = Object.assign({}, options);
458
+ const parsed = {
459
+ command,
460
+ args,
461
+ options,
462
+ file: void 0,
463
+ original: {
464
+ command,
465
+ args
466
+ }
467
+ };
468
+ return options.shell ? parsed : parseNonShell(parsed);
469
+ }
470
+ module2.exports = parse;
471
+ }
472
+ });
473
+ var require_enoent = (0, import_chunk_QGM4M3NI.__commonJS)({
474
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports, module2) {
475
+ "use strict";
476
+ var isWin = process.platform === "win32";
477
+ function notFoundError(original, syscall) {
478
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
479
+ code: "ENOENT",
480
+ errno: "ENOENT",
481
+ syscall: `${syscall} ${original.command}`,
482
+ path: original.command,
483
+ spawnargs: original.args
484
+ });
485
+ }
486
+ function hookChildProcess(cp, parsed) {
487
+ if (!isWin) {
488
+ return;
489
+ }
490
+ const originalEmit = cp.emit;
491
+ cp.emit = function(name, arg1) {
492
+ if (name === "exit") {
493
+ const err = verifyENOENT(arg1, parsed);
494
+ if (err) {
495
+ return originalEmit.call(cp, "error", err);
496
+ }
497
+ }
498
+ return originalEmit.apply(cp, arguments);
499
+ };
500
+ }
501
+ function verifyENOENT(status, parsed) {
502
+ if (isWin && status === 1 && !parsed.file) {
503
+ return notFoundError(parsed.original, "spawn");
504
+ }
505
+ return null;
506
+ }
507
+ function verifyENOENTSync(status, parsed) {
508
+ if (isWin && status === 1 && !parsed.file) {
509
+ return notFoundError(parsed.original, "spawnSync");
510
+ }
511
+ return null;
512
+ }
513
+ module2.exports = {
514
+ hookChildProcess,
515
+ verifyENOENT,
516
+ verifyENOENTSync,
517
+ notFoundError
518
+ };
519
+ }
520
+ });
521
+ var require_cross_spawn = (0, import_chunk_QGM4M3NI.__commonJS)({
522
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports, module2) {
523
+ "use strict";
524
+ var cp = (0, import_chunk_QGM4M3NI.__require)("child_process");
525
+ var parse = require_parse();
526
+ var enoent = require_enoent();
527
+ function spawn(command, args, options) {
528
+ const parsed = parse(command, args, options);
529
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
530
+ enoent.hookChildProcess(spawned, parsed);
531
+ return spawned;
532
+ }
533
+ function spawnSync(command, args, options) {
534
+ const parsed = parse(command, args, options);
535
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
536
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
537
+ return result;
538
+ }
539
+ module2.exports = spawn;
540
+ module2.exports.spawn = spawn;
541
+ module2.exports.sync = spawnSync;
542
+ module2.exports._parse = parse;
543
+ module2.exports._enoent = enoent;
544
+ }
545
+ });
546
+ var require_merge_stream = (0, import_chunk_QGM4M3NI.__commonJS)({
547
+ "../../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js"(exports, module2) {
548
+ "use strict";
549
+ var { PassThrough } = (0, import_chunk_QGM4M3NI.__require)("stream");
550
+ module2.exports = function() {
551
+ var sources = [];
552
+ var output = new PassThrough({ objectMode: true });
553
+ output.setMaxListeners(0);
554
+ output.add = add;
555
+ output.isEmpty = isEmpty;
556
+ output.on("unpipe", remove);
557
+ Array.prototype.slice.call(arguments).forEach(add);
558
+ return output;
559
+ function add(source) {
560
+ if (Array.isArray(source)) {
561
+ source.forEach(add);
562
+ return this;
563
+ }
564
+ sources.push(source);
565
+ source.once("end", remove.bind(null, source));
566
+ source.once("error", output.emit.bind(output, "error"));
567
+ source.pipe(output, { end: false });
568
+ return this;
569
+ }
570
+ function isEmpty() {
571
+ return sources.length == 0;
572
+ }
573
+ function remove(source) {
574
+ sources = sources.filter(function(it) {
575
+ return it !== source;
576
+ });
577
+ if (!sources.length && output.readable) {
578
+ output.end();
579
+ }
580
+ }
581
+ };
582
+ }
583
+ });
584
+ var require_package = (0, import_chunk_QGM4M3NI.__commonJS)({
585
+ "package.json"(exports, module2) {
586
+ module2.exports = {
587
+ name: "@prisma/fetch-engine",
588
+ version: "0.0.0",
589
+ description: "This package is intended for Prisma's internal use",
590
+ main: "dist/index.js",
591
+ types: "dist/index.d.ts",
592
+ license: "Apache-2.0",
593
+ author: "Tim Suchanek <suchanek@prisma.io>",
594
+ homepage: "https://www.prisma.io",
595
+ repository: {
596
+ type: "git",
597
+ url: "https://github.com/prisma/prisma.git",
598
+ directory: "packages/fetch-engine"
599
+ },
600
+ bugs: "https://github.com/prisma/prisma/issues",
601
+ enginesOverride: {},
602
+ devDependencies: {
603
+ "@types/node": "18.19.76",
604
+ "@types/progress": "2.0.7",
605
+ del: "6.1.1",
606
+ execa: "8.0.1",
607
+ "find-cache-dir": "5.0.0",
608
+ "fs-extra": "11.3.0",
609
+ hasha: "5.2.2",
610
+ "http-proxy-agent": "7.0.2",
611
+ "https-proxy-agent": "7.0.6",
612
+ kleur: "4.1.5",
613
+ "node-fetch": "3.3.2",
614
+ "p-filter": "4.1.0",
615
+ "p-map": "4.0.0",
616
+ "p-retry": "4.6.2",
617
+ progress: "2.0.3",
618
+ "temp-dir": "2.0.0",
619
+ tempy: "1.0.1",
620
+ "timeout-signal": "2.0.0",
621
+ typescript: "5.4.5"
622
+ },
623
+ dependencies: {
624
+ "@prisma/debug": "workspace:*",
625
+ "@prisma/engines-version": "7.1.1-3.c2990dca591cba766e3b7ef5d9e8a84796e47ab7",
626
+ "@prisma/get-platform": "workspace:*"
627
+ },
628
+ scripts: {
629
+ dev: "DEV=true tsx helpers/build.ts",
630
+ build: "tsx helpers/build.ts",
631
+ test: "vitest run",
632
+ prepublishOnly: "pnpm run build"
633
+ },
634
+ files: [
635
+ "README.md",
636
+ "dist"
637
+ ],
638
+ sideEffects: false
639
+ };
640
+ }
641
+ });
642
+ var import_cross_spawn = (0, import_chunk_QGM4M3NI.__toESM)(require_cross_spawn(), 1);
643
+ function stripFinalNewline(input) {
644
+ const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
645
+ const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
646
+ if (input[input.length - 1] === LF) {
647
+ input = input.slice(0, -1);
648
+ }
649
+ if (input[input.length - 1] === CR) {
650
+ input = input.slice(0, -1);
651
+ }
652
+ return input;
653
+ }
654
+ function pathKey(options = {}) {
655
+ const {
656
+ env = process.env,
657
+ platform = process.platform
658
+ } = options;
659
+ if (platform !== "win32") {
660
+ return "PATH";
661
+ }
662
+ return Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
663
+ }
664
+ var npmRunPath = ({
665
+ cwd = import_node_process2.default.cwd(),
666
+ path: pathOption = import_node_process2.default.env[pathKey()],
667
+ preferLocal = true,
668
+ execPath = import_node_process2.default.execPath,
669
+ addExecPath = true
670
+ } = {}) => {
671
+ const cwdString = cwd instanceof URL ? (0, import_node_url.fileURLToPath)(cwd) : cwd;
672
+ const cwdPath = import_node_path3.default.resolve(cwdString);
673
+ const result = [];
674
+ if (preferLocal) {
675
+ applyPreferLocal(result, cwdPath);
676
+ }
677
+ if (addExecPath) {
678
+ applyExecPath(result, execPath, cwdPath);
679
+ }
680
+ return [...result, pathOption].join(import_node_path3.default.delimiter);
681
+ };
682
+ var applyPreferLocal = (result, cwdPath) => {
683
+ let previous;
684
+ while (previous !== cwdPath) {
685
+ result.push(import_node_path3.default.join(cwdPath, "node_modules/.bin"));
686
+ previous = cwdPath;
687
+ cwdPath = import_node_path3.default.resolve(cwdPath, "..");
688
+ }
689
+ };
690
+ var applyExecPath = (result, execPath, cwdPath) => {
691
+ const execPathString = execPath instanceof URL ? (0, import_node_url.fileURLToPath)(execPath) : execPath;
692
+ result.push(import_node_path3.default.resolve(cwdPath, execPathString, ".."));
693
+ };
694
+ var npmRunPathEnv = ({ env = import_node_process2.default.env, ...options } = {}) => {
695
+ env = { ...env };
696
+ const pathName = pathKey({ env });
697
+ options.path = env[pathName];
698
+ env[pathName] = npmRunPath(options);
699
+ return env;
700
+ };
701
+ var copyProperty = (to, from, property, ignoreNonConfigurable) => {
702
+ if (property === "length" || property === "prototype") {
703
+ return;
704
+ }
705
+ if (property === "arguments" || property === "caller") {
706
+ return;
707
+ }
708
+ const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
709
+ const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
710
+ if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
711
+ return;
712
+ }
713
+ Object.defineProperty(to, property, fromDescriptor);
714
+ };
715
+ var canCopyProperty = function(toDescriptor, fromDescriptor) {
716
+ return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
717
+ };
718
+ var changePrototype = (to, from) => {
719
+ const fromPrototype = Object.getPrototypeOf(from);
720
+ if (fromPrototype === Object.getPrototypeOf(to)) {
721
+ return;
722
+ }
723
+ Object.setPrototypeOf(to, fromPrototype);
724
+ };
725
+ var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
726
+ ${fromBody}`;
727
+ var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
728
+ var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
729
+ var changeToString = (to, from, name) => {
730
+ const withName = name === "" ? "" : `with ${name.trim()}() `;
731
+ const newToString = wrappedToString.bind(null, withName, from.toString());
732
+ Object.defineProperty(newToString, "name", toStringName);
733
+ Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
734
+ };
735
+ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
736
+ const { name } = to;
737
+ for (const property of Reflect.ownKeys(from)) {
738
+ copyProperty(to, from, property, ignoreNonConfigurable);
739
+ }
740
+ changePrototype(to, from);
741
+ changeToString(to, from, name);
742
+ return to;
743
+ }
744
+ var calledFunctions = /* @__PURE__ */ new WeakMap();
745
+ var onetime = (function_, options = {}) => {
746
+ if (typeof function_ !== "function") {
747
+ throw new TypeError("Expected a function");
748
+ }
749
+ let returnValue;
750
+ let callCount = 0;
751
+ const functionName = function_.displayName || function_.name || "<anonymous>";
752
+ const onetime2 = function(...arguments_) {
753
+ calledFunctions.set(onetime2, ++callCount);
754
+ if (callCount === 1) {
755
+ returnValue = function_.apply(this, arguments_);
756
+ function_ = null;
757
+ } else if (options.throw === true) {
758
+ throw new Error(`Function \`${functionName}\` can only be called once`);
759
+ }
760
+ return returnValue;
761
+ };
762
+ mimicFunction(onetime2, function_);
763
+ calledFunctions.set(onetime2, callCount);
764
+ return onetime2;
765
+ };
766
+ onetime.callCount = (function_) => {
767
+ if (!calledFunctions.has(function_)) {
768
+ throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
769
+ }
770
+ return calledFunctions.get(function_);
771
+ };
772
+ var onetime_default = onetime;
773
+ var getRealtimeSignals = () => {
774
+ const length = SIGRTMAX - SIGRTMIN + 1;
775
+ return Array.from({ length }, getRealtimeSignal);
776
+ };
777
+ var getRealtimeSignal = (value, index) => ({
778
+ name: `SIGRT${index + 1}`,
779
+ number: SIGRTMIN + index,
780
+ action: "terminate",
781
+ description: "Application-specific signal (realtime)",
782
+ standard: "posix"
783
+ });
784
+ var SIGRTMIN = 34;
785
+ var SIGRTMAX = 64;
786
+ var SIGNALS = [
787
+ {
788
+ name: "SIGHUP",
789
+ number: 1,
790
+ action: "terminate",
791
+ description: "Terminal closed",
792
+ standard: "posix"
793
+ },
794
+ {
795
+ name: "SIGINT",
796
+ number: 2,
797
+ action: "terminate",
798
+ description: "User interruption with CTRL-C",
799
+ standard: "ansi"
800
+ },
801
+ {
802
+ name: "SIGQUIT",
803
+ number: 3,
804
+ action: "core",
805
+ description: "User interruption with CTRL-\\",
806
+ standard: "posix"
807
+ },
808
+ {
809
+ name: "SIGILL",
810
+ number: 4,
811
+ action: "core",
812
+ description: "Invalid machine instruction",
813
+ standard: "ansi"
814
+ },
815
+ {
816
+ name: "SIGTRAP",
817
+ number: 5,
818
+ action: "core",
819
+ description: "Debugger breakpoint",
820
+ standard: "posix"
821
+ },
822
+ {
823
+ name: "SIGABRT",
824
+ number: 6,
825
+ action: "core",
826
+ description: "Aborted",
827
+ standard: "ansi"
828
+ },
829
+ {
830
+ name: "SIGIOT",
831
+ number: 6,
832
+ action: "core",
833
+ description: "Aborted",
834
+ standard: "bsd"
835
+ },
836
+ {
837
+ name: "SIGBUS",
838
+ number: 7,
839
+ action: "core",
840
+ description: "Bus error due to misaligned, non-existing address or paging error",
841
+ standard: "bsd"
842
+ },
843
+ {
844
+ name: "SIGEMT",
845
+ number: 7,
846
+ action: "terminate",
847
+ description: "Command should be emulated but is not implemented",
848
+ standard: "other"
849
+ },
850
+ {
851
+ name: "SIGFPE",
852
+ number: 8,
853
+ action: "core",
854
+ description: "Floating point arithmetic error",
855
+ standard: "ansi"
856
+ },
857
+ {
858
+ name: "SIGKILL",
859
+ number: 9,
860
+ action: "terminate",
861
+ description: "Forced termination",
862
+ standard: "posix",
863
+ forced: true
864
+ },
865
+ {
866
+ name: "SIGUSR1",
867
+ number: 10,
868
+ action: "terminate",
869
+ description: "Application-specific signal",
870
+ standard: "posix"
871
+ },
872
+ {
873
+ name: "SIGSEGV",
874
+ number: 11,
875
+ action: "core",
876
+ description: "Segmentation fault",
877
+ standard: "ansi"
878
+ },
879
+ {
880
+ name: "SIGUSR2",
881
+ number: 12,
882
+ action: "terminate",
883
+ description: "Application-specific signal",
884
+ standard: "posix"
885
+ },
886
+ {
887
+ name: "SIGPIPE",
888
+ number: 13,
889
+ action: "terminate",
890
+ description: "Broken pipe or socket",
891
+ standard: "posix"
892
+ },
893
+ {
894
+ name: "SIGALRM",
895
+ number: 14,
896
+ action: "terminate",
897
+ description: "Timeout or timer",
898
+ standard: "posix"
899
+ },
900
+ {
901
+ name: "SIGTERM",
902
+ number: 15,
903
+ action: "terminate",
904
+ description: "Termination",
905
+ standard: "ansi"
906
+ },
907
+ {
908
+ name: "SIGSTKFLT",
909
+ number: 16,
910
+ action: "terminate",
911
+ description: "Stack is empty or overflowed",
912
+ standard: "other"
913
+ },
914
+ {
915
+ name: "SIGCHLD",
916
+ number: 17,
917
+ action: "ignore",
918
+ description: "Child process terminated, paused or unpaused",
919
+ standard: "posix"
920
+ },
921
+ {
922
+ name: "SIGCLD",
923
+ number: 17,
924
+ action: "ignore",
925
+ description: "Child process terminated, paused or unpaused",
926
+ standard: "other"
927
+ },
928
+ {
929
+ name: "SIGCONT",
930
+ number: 18,
931
+ action: "unpause",
932
+ description: "Unpaused",
933
+ standard: "posix",
934
+ forced: true
935
+ },
936
+ {
937
+ name: "SIGSTOP",
938
+ number: 19,
939
+ action: "pause",
940
+ description: "Paused",
941
+ standard: "posix",
942
+ forced: true
943
+ },
944
+ {
945
+ name: "SIGTSTP",
946
+ number: 20,
947
+ action: "pause",
948
+ description: 'Paused using CTRL-Z or "suspend"',
949
+ standard: "posix"
950
+ },
951
+ {
952
+ name: "SIGTTIN",
953
+ number: 21,
954
+ action: "pause",
955
+ description: "Background process cannot read terminal input",
956
+ standard: "posix"
957
+ },
958
+ {
959
+ name: "SIGBREAK",
960
+ number: 21,
961
+ action: "terminate",
962
+ description: "User interruption with CTRL-BREAK",
963
+ standard: "other"
964
+ },
965
+ {
966
+ name: "SIGTTOU",
967
+ number: 22,
968
+ action: "pause",
969
+ description: "Background process cannot write to terminal output",
970
+ standard: "posix"
971
+ },
972
+ {
973
+ name: "SIGURG",
974
+ number: 23,
975
+ action: "ignore",
976
+ description: "Socket received out-of-band data",
977
+ standard: "bsd"
978
+ },
979
+ {
980
+ name: "SIGXCPU",
981
+ number: 24,
982
+ action: "core",
983
+ description: "Process timed out",
984
+ standard: "bsd"
985
+ },
986
+ {
987
+ name: "SIGXFSZ",
988
+ number: 25,
989
+ action: "core",
990
+ description: "File too big",
991
+ standard: "bsd"
992
+ },
993
+ {
994
+ name: "SIGVTALRM",
995
+ number: 26,
996
+ action: "terminate",
997
+ description: "Timeout or timer",
998
+ standard: "bsd"
999
+ },
1000
+ {
1001
+ name: "SIGPROF",
1002
+ number: 27,
1003
+ action: "terminate",
1004
+ description: "Timeout or timer",
1005
+ standard: "bsd"
1006
+ },
1007
+ {
1008
+ name: "SIGWINCH",
1009
+ number: 28,
1010
+ action: "ignore",
1011
+ description: "Terminal window size changed",
1012
+ standard: "bsd"
1013
+ },
1014
+ {
1015
+ name: "SIGIO",
1016
+ number: 29,
1017
+ action: "terminate",
1018
+ description: "I/O is available",
1019
+ standard: "other"
1020
+ },
1021
+ {
1022
+ name: "SIGPOLL",
1023
+ number: 29,
1024
+ action: "terminate",
1025
+ description: "Watched event",
1026
+ standard: "other"
1027
+ },
1028
+ {
1029
+ name: "SIGINFO",
1030
+ number: 29,
1031
+ action: "ignore",
1032
+ description: "Request for process information",
1033
+ standard: "other"
1034
+ },
1035
+ {
1036
+ name: "SIGPWR",
1037
+ number: 30,
1038
+ action: "terminate",
1039
+ description: "Device running out of power",
1040
+ standard: "systemv"
1041
+ },
1042
+ {
1043
+ name: "SIGSYS",
1044
+ number: 31,
1045
+ action: "core",
1046
+ description: "Invalid system call",
1047
+ standard: "other"
1048
+ },
1049
+ {
1050
+ name: "SIGUNUSED",
1051
+ number: 31,
1052
+ action: "terminate",
1053
+ description: "Invalid system call",
1054
+ standard: "other"
1055
+ }
1056
+ ];
1057
+ var getSignals = () => {
1058
+ const realtimeSignals = getRealtimeSignals();
1059
+ const signals2 = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
1060
+ return signals2;
1061
+ };
1062
+ var normalizeSignal = ({
1063
+ name,
1064
+ number: defaultNumber,
1065
+ description,
1066
+ action,
1067
+ forced = false,
1068
+ standard
1069
+ }) => {
1070
+ const {
1071
+ signals: { [name]: constantSignal }
1072
+ } = import_node_os2.constants;
1073
+ const supported = constantSignal !== void 0;
1074
+ const number = supported ? constantSignal : defaultNumber;
1075
+ return { name, number, description, supported, action, forced, standard };
1076
+ };
1077
+ var getSignalsByName = () => {
1078
+ const signals2 = getSignals();
1079
+ return Object.fromEntries(signals2.map(getSignalByName));
1080
+ };
1081
+ var getSignalByName = ({
1082
+ name,
1083
+ number,
1084
+ description,
1085
+ supported,
1086
+ action,
1087
+ forced,
1088
+ standard
1089
+ }) => [name, { name, number, description, supported, action, forced, standard }];
1090
+ var signalsByName = getSignalsByName();
1091
+ var getSignalsByNumber = () => {
1092
+ const signals2 = getSignals();
1093
+ const length = SIGRTMAX + 1;
1094
+ const signalsA = Array.from(
1095
+ { length },
1096
+ (value, number) => getSignalByNumber(number, signals2)
1097
+ );
1098
+ return Object.assign({}, ...signalsA);
1099
+ };
1100
+ var getSignalByNumber = (number, signals2) => {
1101
+ const signal = findSignalByNumber(number, signals2);
1102
+ if (signal === void 0) {
1103
+ return {};
1104
+ }
1105
+ const { name, description, supported, action, forced, standard } = signal;
1106
+ return {
1107
+ [number]: {
1108
+ name,
1109
+ number,
1110
+ description,
1111
+ supported,
1112
+ action,
1113
+ forced,
1114
+ standard
1115
+ }
1116
+ };
1117
+ };
1118
+ var findSignalByNumber = (number, signals2) => {
1119
+ const signal = signals2.find(({ name }) => import_node_os.constants.signals[name] === number);
1120
+ if (signal !== void 0) {
1121
+ return signal;
1122
+ }
1123
+ return signals2.find((signalA) => signalA.number === number);
1124
+ };
1125
+ var signalsByNumber = getSignalsByNumber();
1126
+ var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
1127
+ if (timedOut) {
1128
+ return `timed out after ${timeout} milliseconds`;
1129
+ }
1130
+ if (isCanceled) {
1131
+ return "was canceled";
1132
+ }
1133
+ if (errorCode !== void 0) {
1134
+ return `failed with ${errorCode}`;
1135
+ }
1136
+ if (signal !== void 0) {
1137
+ return `was killed with ${signal} (${signalDescription})`;
1138
+ }
1139
+ if (exitCode !== void 0) {
1140
+ return `failed with exit code ${exitCode}`;
1141
+ }
1142
+ return "failed";
1143
+ };
1144
+ var makeError = ({
1145
+ stdout,
1146
+ stderr,
1147
+ all,
1148
+ error,
1149
+ signal,
1150
+ exitCode,
1151
+ command,
1152
+ escapedCommand,
1153
+ timedOut,
1154
+ isCanceled,
1155
+ killed,
1156
+ parsed: { options: { timeout, cwd = import_node_process3.default.cwd() } }
1157
+ }) => {
1158
+ exitCode = exitCode === null ? void 0 : exitCode;
1159
+ signal = signal === null ? void 0 : signal;
1160
+ const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
1161
+ const errorCode = error && error.code;
1162
+ const prefix = getErrorPrefix({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
1163
+ const execaMessage = `Command ${prefix}: ${command}`;
1164
+ const isError = Object.prototype.toString.call(error) === "[object Error]";
1165
+ const shortMessage = isError ? `${execaMessage}
1166
+ ${error.message}` : execaMessage;
1167
+ const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
1168
+ if (isError) {
1169
+ error.originalMessage = error.message;
1170
+ error.message = message;
1171
+ } else {
1172
+ error = new Error(message);
1173
+ }
1174
+ error.shortMessage = shortMessage;
1175
+ error.command = command;
1176
+ error.escapedCommand = escapedCommand;
1177
+ error.exitCode = exitCode;
1178
+ error.signal = signal;
1179
+ error.signalDescription = signalDescription;
1180
+ error.stdout = stdout;
1181
+ error.stderr = stderr;
1182
+ error.cwd = cwd;
1183
+ if (all !== void 0) {
1184
+ error.all = all;
1185
+ }
1186
+ if ("bufferedData" in error) {
1187
+ delete error.bufferedData;
1188
+ }
1189
+ error.failed = true;
1190
+ error.timedOut = Boolean(timedOut);
1191
+ error.isCanceled = isCanceled;
1192
+ error.killed = killed && !timedOut;
1193
+ return error;
1194
+ };
1195
+ var aliases = ["stdin", "stdout", "stderr"];
1196
+ var hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
1197
+ var normalizeStdio = (options) => {
1198
+ if (!options) {
1199
+ return;
1200
+ }
1201
+ const { stdio } = options;
1202
+ if (stdio === void 0) {
1203
+ return aliases.map((alias) => options[alias]);
1204
+ }
1205
+ if (hasAlias(options)) {
1206
+ throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
1207
+ }
1208
+ if (typeof stdio === "string") {
1209
+ return stdio;
1210
+ }
1211
+ if (!Array.isArray(stdio)) {
1212
+ throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
1213
+ }
1214
+ const length = Math.max(stdio.length, aliases.length);
1215
+ return Array.from({ length }, (value, index) => stdio[index]);
1216
+ };
1217
+ var signals = [];
1218
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
1219
+ if (process.platform !== "win32") {
1220
+ signals.push(
1221
+ "SIGALRM",
1222
+ "SIGABRT",
1223
+ "SIGVTALRM",
1224
+ "SIGXCPU",
1225
+ "SIGXFSZ",
1226
+ "SIGUSR2",
1227
+ "SIGTRAP",
1228
+ "SIGSYS",
1229
+ "SIGQUIT",
1230
+ "SIGIOT"
1231
+ // should detect profiler and enable/disable accordingly.
1232
+ // see #21
1233
+ // 'SIGPROF'
1234
+ );
1235
+ }
1236
+ if (process.platform === "linux") {
1237
+ signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
1238
+ }
1239
+ var processOk = (process7) => !!process7 && typeof process7 === "object" && typeof process7.removeListener === "function" && typeof process7.emit === "function" && typeof process7.reallyExit === "function" && typeof process7.listeners === "function" && typeof process7.kill === "function" && typeof process7.pid === "number" && typeof process7.on === "function";
1240
+ var kExitEmitter = Symbol.for("signal-exit emitter");
1241
+ var global2 = globalThis;
1242
+ var ObjectDefineProperty = Object.defineProperty.bind(Object);
1243
+ var Emitter = class {
1244
+ emitted = {
1245
+ afterExit: false,
1246
+ exit: false
1247
+ };
1248
+ listeners = {
1249
+ afterExit: [],
1250
+ exit: []
1251
+ };
1252
+ count = 0;
1253
+ id = Math.random();
1254
+ constructor() {
1255
+ if (global2[kExitEmitter]) {
1256
+ return global2[kExitEmitter];
1257
+ }
1258
+ ObjectDefineProperty(global2, kExitEmitter, {
1259
+ value: this,
1260
+ writable: false,
1261
+ enumerable: false,
1262
+ configurable: false
1263
+ });
1264
+ }
1265
+ on(ev, fn) {
1266
+ this.listeners[ev].push(fn);
1267
+ }
1268
+ removeListener(ev, fn) {
1269
+ const list = this.listeners[ev];
1270
+ const i = list.indexOf(fn);
1271
+ if (i === -1) {
1272
+ return;
1273
+ }
1274
+ if (i === 0 && list.length === 1) {
1275
+ list.length = 0;
1276
+ } else {
1277
+ list.splice(i, 1);
1278
+ }
1279
+ }
1280
+ emit(ev, code, signal) {
1281
+ if (this.emitted[ev]) {
1282
+ return false;
1283
+ }
1284
+ this.emitted[ev] = true;
1285
+ let ret = false;
1286
+ for (const fn of this.listeners[ev]) {
1287
+ ret = fn(code, signal) === true || ret;
1288
+ }
1289
+ if (ev === "exit") {
1290
+ ret = this.emit("afterExit", code, signal) || ret;
1291
+ }
1292
+ return ret;
1293
+ }
1294
+ };
1295
+ var SignalExitBase = class {
1296
+ };
1297
+ var signalExitWrap = (handler) => {
1298
+ return {
1299
+ onExit(cb, opts) {
1300
+ return handler.onExit(cb, opts);
1301
+ },
1302
+ load() {
1303
+ return handler.load();
1304
+ },
1305
+ unload() {
1306
+ return handler.unload();
1307
+ }
1308
+ };
1309
+ };
1310
+ var SignalExitFallback = class extends SignalExitBase {
1311
+ onExit() {
1312
+ return () => {
1313
+ };
1314
+ }
1315
+ load() {
1316
+ }
1317
+ unload() {
1318
+ }
1319
+ };
1320
+ var SignalExit = class extends SignalExitBase {
1321
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
1322
+ // so use a supported signal instead
1323
+ /* c8 ignore start */
1324
+ #hupSig = process4.platform === "win32" ? "SIGINT" : "SIGHUP";
1325
+ /* c8 ignore stop */
1326
+ #emitter = new Emitter();
1327
+ #process;
1328
+ #originalProcessEmit;
1329
+ #originalProcessReallyExit;
1330
+ #sigListeners = {};
1331
+ #loaded = false;
1332
+ constructor(process7) {
1333
+ super();
1334
+ this.#process = process7;
1335
+ this.#sigListeners = {};
1336
+ for (const sig of signals) {
1337
+ this.#sigListeners[sig] = () => {
1338
+ const listeners = this.#process.listeners(sig);
1339
+ let { count } = this.#emitter;
1340
+ const p = process7;
1341
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
1342
+ count += p.__signal_exit_emitter__.count;
1343
+ }
1344
+ if (listeners.length === count) {
1345
+ this.unload();
1346
+ const ret = this.#emitter.emit("exit", null, sig);
1347
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
1348
+ if (!ret)
1349
+ process7.kill(process7.pid, s);
1350
+ }
1351
+ };
1352
+ }
1353
+ this.#originalProcessReallyExit = process7.reallyExit;
1354
+ this.#originalProcessEmit = process7.emit;
1355
+ }
1356
+ onExit(cb, opts) {
1357
+ if (!processOk(this.#process)) {
1358
+ return () => {
1359
+ };
1360
+ }
1361
+ if (this.#loaded === false) {
1362
+ this.load();
1363
+ }
1364
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
1365
+ this.#emitter.on(ev, cb);
1366
+ return () => {
1367
+ this.#emitter.removeListener(ev, cb);
1368
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
1369
+ this.unload();
1370
+ }
1371
+ };
1372
+ }
1373
+ load() {
1374
+ if (this.#loaded) {
1375
+ return;
1376
+ }
1377
+ this.#loaded = true;
1378
+ this.#emitter.count += 1;
1379
+ for (const sig of signals) {
1380
+ try {
1381
+ const fn = this.#sigListeners[sig];
1382
+ if (fn)
1383
+ this.#process.on(sig, fn);
1384
+ } catch (_) {
1385
+ }
1386
+ }
1387
+ this.#process.emit = (ev, ...a) => {
1388
+ return this.#processEmit(ev, ...a);
1389
+ };
1390
+ this.#process.reallyExit = (code) => {
1391
+ return this.#processReallyExit(code);
1392
+ };
1393
+ }
1394
+ unload() {
1395
+ if (!this.#loaded) {
1396
+ return;
1397
+ }
1398
+ this.#loaded = false;
1399
+ signals.forEach((sig) => {
1400
+ const listener = this.#sigListeners[sig];
1401
+ if (!listener) {
1402
+ throw new Error("Listener not defined for signal: " + sig);
1403
+ }
1404
+ try {
1405
+ this.#process.removeListener(sig, listener);
1406
+ } catch (_) {
1407
+ }
1408
+ });
1409
+ this.#process.emit = this.#originalProcessEmit;
1410
+ this.#process.reallyExit = this.#originalProcessReallyExit;
1411
+ this.#emitter.count -= 1;
1412
+ }
1413
+ #processReallyExit(code) {
1414
+ if (!processOk(this.#process)) {
1415
+ return 0;
1416
+ }
1417
+ this.#process.exitCode = code || 0;
1418
+ this.#emitter.emit("exit", this.#process.exitCode, null);
1419
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
1420
+ }
1421
+ #processEmit(ev, ...args) {
1422
+ const og = this.#originalProcessEmit;
1423
+ if (ev === "exit" && processOk(this.#process)) {
1424
+ if (typeof args[0] === "number") {
1425
+ this.#process.exitCode = args[0];
1426
+ }
1427
+ const ret = og.call(this.#process, ev, ...args);
1428
+ this.#emitter.emit("exit", this.#process.exitCode, null);
1429
+ return ret;
1430
+ } else {
1431
+ return og.call(this.#process, ev, ...args);
1432
+ }
1433
+ }
1434
+ };
1435
+ var process4 = globalThis.process;
1436
+ var {
1437
+ /**
1438
+ * Called when the process is exiting, whether via signal, explicit
1439
+ * exit, or running out of stuff to do.
1440
+ *
1441
+ * If the global process object is not suitable for instrumentation,
1442
+ * then this will be a no-op.
1443
+ *
1444
+ * Returns a function that may be used to unload signal-exit.
1445
+ */
1446
+ onExit,
1447
+ /**
1448
+ * Load the listeners. Likely you never need to call this, unless
1449
+ * doing a rather deep integration with signal-exit functionality.
1450
+ * Mostly exposed for the benefit of testing.
1451
+ *
1452
+ * @internal
1453
+ */
1454
+ load,
1455
+ /**
1456
+ * Unload the listeners. Likely you never need to call this, unless
1457
+ * doing a rather deep integration with signal-exit functionality.
1458
+ * Mostly exposed for the benefit of testing.
1459
+ *
1460
+ * @internal
1461
+ */
1462
+ unload
1463
+ } = signalExitWrap(processOk(process4) ? new SignalExit(process4) : new SignalExitFallback());
1464
+ var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
1465
+ var spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
1466
+ const killResult = kill(signal);
1467
+ setKillTimeout(kill, signal, options, killResult);
1468
+ return killResult;
1469
+ };
1470
+ var setKillTimeout = (kill, signal, options, killResult) => {
1471
+ if (!shouldForceKill(signal, options, killResult)) {
1472
+ return;
1473
+ }
1474
+ const timeout = getForceKillAfterTimeout(options);
1475
+ const t = setTimeout(() => {
1476
+ kill("SIGKILL");
1477
+ }, timeout);
1478
+ if (t.unref) {
1479
+ t.unref();
1480
+ }
1481
+ };
1482
+ var shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
1483
+ var isSigterm = (signal) => signal === import_node_os3.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
1484
+ var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
1485
+ if (forceKillAfterTimeout === true) {
1486
+ return DEFAULT_FORCE_KILL_TIMEOUT;
1487
+ }
1488
+ if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
1489
+ throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
1490
+ }
1491
+ return forceKillAfterTimeout;
1492
+ };
1493
+ var spawnedCancel = (spawned, context) => {
1494
+ const killResult = spawned.kill();
1495
+ if (killResult) {
1496
+ context.isCanceled = true;
1497
+ }
1498
+ };
1499
+ var timeoutKill = (spawned, signal, reject) => {
1500
+ spawned.kill(signal);
1501
+ reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
1502
+ };
1503
+ var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
1504
+ if (timeout === 0 || timeout === void 0) {
1505
+ return spawnedPromise;
1506
+ }
1507
+ let timeoutId;
1508
+ const timeoutPromise = new Promise((resolve, reject) => {
1509
+ timeoutId = setTimeout(() => {
1510
+ timeoutKill(spawned, killSignal, reject);
1511
+ }, timeout);
1512
+ });
1513
+ const safeSpawnedPromise = spawnedPromise.finally(() => {
1514
+ clearTimeout(timeoutId);
1515
+ });
1516
+ return Promise.race([timeoutPromise, safeSpawnedPromise]);
1517
+ };
1518
+ var validateTimeout = ({ timeout }) => {
1519
+ if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
1520
+ throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
1521
+ }
1522
+ };
1523
+ var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
1524
+ if (!cleanup || detached) {
1525
+ return timedPromise;
1526
+ }
1527
+ const removeExitHandler = onExit(() => {
1528
+ spawned.kill();
1529
+ });
1530
+ return timedPromise.finally(() => {
1531
+ removeExitHandler();
1532
+ });
1533
+ };
1534
+ function isStream(stream) {
1535
+ return stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
1536
+ }
1537
+ function isWritableStream(stream) {
1538
+ return isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
1539
+ }
1540
+ var isExecaChildProcess = (target) => target instanceof import_node_child_process2.ChildProcess && typeof target.then === "function";
1541
+ var pipeToTarget = (spawned, streamName, target) => {
1542
+ if (typeof target === "string") {
1543
+ spawned[streamName].pipe((0, import_node_fs2.createWriteStream)(target));
1544
+ return spawned;
1545
+ }
1546
+ if (isWritableStream(target)) {
1547
+ spawned[streamName].pipe(target);
1548
+ return spawned;
1549
+ }
1550
+ if (!isExecaChildProcess(target)) {
1551
+ throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
1552
+ }
1553
+ if (!isWritableStream(target.stdin)) {
1554
+ throw new TypeError("The target child process's stdin must be available.");
1555
+ }
1556
+ spawned[streamName].pipe(target.stdin);
1557
+ return target;
1558
+ };
1559
+ var addPipeMethods = (spawned) => {
1560
+ if (spawned.stdout !== null) {
1561
+ spawned.pipeStdout = pipeToTarget.bind(void 0, spawned, "stdout");
1562
+ }
1563
+ if (spawned.stderr !== null) {
1564
+ spawned.pipeStderr = pipeToTarget.bind(void 0, spawned, "stderr");
1565
+ }
1566
+ if (spawned.all !== void 0) {
1567
+ spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
1568
+ }
1569
+ };
1570
+ var getStreamContents = async (stream, { init, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
1571
+ if (!isAsyncIterable(stream)) {
1572
+ throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");
1573
+ }
1574
+ const state = init();
1575
+ state.length = 0;
1576
+ try {
1577
+ for await (const chunk of stream) {
1578
+ const chunkType = getChunkType(chunk);
1579
+ const convertedChunk = convertChunk[chunkType](chunk, state);
1580
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
1581
+ }
1582
+ appendFinalChunk({ state, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer });
1583
+ return finalize(state);
1584
+ } catch (error) {
1585
+ error.bufferedData = finalize(state);
1586
+ throw error;
1587
+ }
1588
+ };
1589
+ var appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
1590
+ const convertedChunk = getFinalChunk(state);
1591
+ if (convertedChunk !== void 0) {
1592
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
1593
+ }
1594
+ };
1595
+ var appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
1596
+ const chunkSize = getSize(convertedChunk);
1597
+ const newLength = state.length + chunkSize;
1598
+ if (newLength <= maxBuffer) {
1599
+ addNewChunk(convertedChunk, state, addChunk, newLength);
1600
+ return;
1601
+ }
1602
+ const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
1603
+ if (truncatedChunk !== void 0) {
1604
+ addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
1605
+ }
1606
+ throw new MaxBufferError();
1607
+ };
1608
+ var addNewChunk = (convertedChunk, state, addChunk, newLength) => {
1609
+ state.contents = addChunk(convertedChunk, state, newLength);
1610
+ state.length = newLength;
1611
+ };
1612
+ var isAsyncIterable = (stream) => typeof stream === "object" && stream !== null && typeof stream[Symbol.asyncIterator] === "function";
1613
+ var getChunkType = (chunk) => {
1614
+ const typeOfChunk = typeof chunk;
1615
+ if (typeOfChunk === "string") {
1616
+ return "string";
1617
+ }
1618
+ if (typeOfChunk !== "object" || chunk === null) {
1619
+ return "others";
1620
+ }
1621
+ if (globalThis.Buffer?.isBuffer(chunk)) {
1622
+ return "buffer";
1623
+ }
1624
+ const prototypeName = objectToString.call(chunk);
1625
+ if (prototypeName === "[object ArrayBuffer]") {
1626
+ return "arrayBuffer";
1627
+ }
1628
+ if (prototypeName === "[object DataView]") {
1629
+ return "dataView";
1630
+ }
1631
+ if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString.call(chunk.buffer) === "[object ArrayBuffer]") {
1632
+ return "typedArray";
1633
+ }
1634
+ return "others";
1635
+ };
1636
+ var { toString: objectToString } = Object.prototype;
1637
+ var MaxBufferError = class extends Error {
1638
+ name = "MaxBufferError";
1639
+ constructor() {
1640
+ super("maxBuffer exceeded");
1641
+ }
1642
+ };
1643
+ var identity = (value) => value;
1644
+ var noop = () => void 0;
1645
+ var getContentsProp = ({ contents }) => contents;
1646
+ var throwObjectStream = (chunk) => {
1647
+ throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
1648
+ };
1649
+ var getLengthProp = (convertedChunk) => convertedChunk.length;
1650
+ async function getStreamAsArrayBuffer(stream, options) {
1651
+ return getStreamContents(stream, arrayBufferMethods, options);
1652
+ }
1653
+ var initArrayBuffer = () => ({ contents: new ArrayBuffer(0) });
1654
+ var useTextEncoder = (chunk) => textEncoder.encode(chunk);
1655
+ var textEncoder = new TextEncoder();
1656
+ var useUint8Array = (chunk) => new Uint8Array(chunk);
1657
+ var useUint8ArrayWithOffset = (chunk) => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
1658
+ var truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
1659
+ var addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length) => {
1660
+ const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
1661
+ new Uint8Array(newContents).set(convertedChunk, previousLength);
1662
+ return newContents;
1663
+ };
1664
+ var resizeArrayBufferSlow = (contents, length) => {
1665
+ if (length <= contents.byteLength) {
1666
+ return contents;
1667
+ }
1668
+ const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
1669
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
1670
+ return arrayBuffer;
1671
+ };
1672
+ var resizeArrayBuffer = (contents, length) => {
1673
+ if (length <= contents.maxByteLength) {
1674
+ contents.resize(length);
1675
+ return contents;
1676
+ }
1677
+ const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
1678
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
1679
+ return arrayBuffer;
1680
+ };
1681
+ var getNewContentsLength = (length) => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
1682
+ var SCALE_FACTOR = 2;
1683
+ var finalizeArrayBuffer = ({ contents, length }) => hasArrayBufferResize() ? contents : contents.slice(0, length);
1684
+ var hasArrayBufferResize = () => "resize" in ArrayBuffer.prototype;
1685
+ var arrayBufferMethods = {
1686
+ init: initArrayBuffer,
1687
+ convertChunk: {
1688
+ string: useTextEncoder,
1689
+ buffer: useUint8Array,
1690
+ arrayBuffer: useUint8Array,
1691
+ dataView: useUint8ArrayWithOffset,
1692
+ typedArray: useUint8ArrayWithOffset,
1693
+ others: throwObjectStream
1694
+ },
1695
+ getSize: getLengthProp,
1696
+ truncateChunk: truncateArrayBufferChunk,
1697
+ addChunk: addArrayBufferChunk,
1698
+ getFinalChunk: noop,
1699
+ finalize: finalizeArrayBuffer
1700
+ };
1701
+ async function getStreamAsBuffer(stream, options) {
1702
+ if (!("Buffer" in globalThis)) {
1703
+ throw new Error("getStreamAsBuffer() is only supported in Node.js");
1704
+ }
1705
+ try {
1706
+ return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream, options));
1707
+ } catch (error) {
1708
+ if (error.bufferedData !== void 0) {
1709
+ error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
1710
+ }
1711
+ throw error;
1712
+ }
1713
+ }
1714
+ var arrayBufferToNodeBuffer = (arrayBuffer) => globalThis.Buffer.from(arrayBuffer);
1715
+ async function getStreamAsString(stream, options) {
1716
+ return getStreamContents(stream, stringMethods, options);
1717
+ }
1718
+ var initString = () => ({ contents: "", textDecoder: new TextDecoder() });
1719
+ var useTextDecoder = (chunk, { textDecoder }) => textDecoder.decode(chunk, { stream: true });
1720
+ var addStringChunk = (convertedChunk, { contents }) => contents + convertedChunk;
1721
+ var truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
1722
+ var getFinalStringChunk = ({ textDecoder }) => {
1723
+ const finalChunk = textDecoder.decode();
1724
+ return finalChunk === "" ? void 0 : finalChunk;
1725
+ };
1726
+ var stringMethods = {
1727
+ init: initString,
1728
+ convertChunk: {
1729
+ string: identity,
1730
+ buffer: useTextDecoder,
1731
+ arrayBuffer: useTextDecoder,
1732
+ dataView: useTextDecoder,
1733
+ typedArray: useTextDecoder,
1734
+ others: throwObjectStream
1735
+ },
1736
+ getSize: getLengthProp,
1737
+ truncateChunk: truncateStringChunk,
1738
+ addChunk: addStringChunk,
1739
+ getFinalChunk: getFinalStringChunk,
1740
+ finalize: getContentsProp
1741
+ };
1742
+ var import_merge_stream = (0, import_chunk_QGM4M3NI.__toESM)(require_merge_stream(), 1);
1743
+ var validateInputOptions = (input) => {
1744
+ if (input !== void 0) {
1745
+ throw new TypeError("The `input` and `inputFile` options cannot be both set.");
1746
+ }
1747
+ };
1748
+ var getInputSync = ({ input, inputFile }) => {
1749
+ if (typeof inputFile !== "string") {
1750
+ return input;
1751
+ }
1752
+ validateInputOptions(input);
1753
+ return (0, import_node_fs3.readFileSync)(inputFile);
1754
+ };
1755
+ var handleInputSync = (options) => {
1756
+ const input = getInputSync(options);
1757
+ if (isStream(input)) {
1758
+ throw new TypeError("The `input` option cannot be a stream in sync mode");
1759
+ }
1760
+ return input;
1761
+ };
1762
+ var getInput = ({ input, inputFile }) => {
1763
+ if (typeof inputFile !== "string") {
1764
+ return input;
1765
+ }
1766
+ validateInputOptions(input);
1767
+ return (0, import_node_fs3.createReadStream)(inputFile);
1768
+ };
1769
+ var handleInput = (spawned, options) => {
1770
+ const input = getInput(options);
1771
+ if (input === void 0) {
1772
+ return;
1773
+ }
1774
+ if (isStream(input)) {
1775
+ input.pipe(spawned.stdin);
1776
+ } else {
1777
+ spawned.stdin.end(input);
1778
+ }
1779
+ };
1780
+ var makeAllStream = (spawned, { all }) => {
1781
+ if (!all || !spawned.stdout && !spawned.stderr) {
1782
+ return;
1783
+ }
1784
+ const mixed = (0, import_merge_stream.default)();
1785
+ if (spawned.stdout) {
1786
+ mixed.add(spawned.stdout);
1787
+ }
1788
+ if (spawned.stderr) {
1789
+ mixed.add(spawned.stderr);
1790
+ }
1791
+ return mixed;
1792
+ };
1793
+ var getBufferedData = async (stream, streamPromise) => {
1794
+ if (!stream || streamPromise === void 0) {
1795
+ return;
1796
+ }
1797
+ await (0, import_promises.setTimeout)(0);
1798
+ stream.destroy();
1799
+ try {
1800
+ return await streamPromise;
1801
+ } catch (error) {
1802
+ return error.bufferedData;
1803
+ }
1804
+ };
1805
+ var getStreamPromise = (stream, { encoding, buffer, maxBuffer }) => {
1806
+ if (!stream || !buffer) {
1807
+ return;
1808
+ }
1809
+ if (encoding === "utf8" || encoding === "utf-8") {
1810
+ return getStreamAsString(stream, { maxBuffer });
1811
+ }
1812
+ if (encoding === null || encoding === "buffer") {
1813
+ return getStreamAsBuffer(stream, { maxBuffer });
1814
+ }
1815
+ return applyEncoding(stream, maxBuffer, encoding);
1816
+ };
1817
+ var applyEncoding = async (stream, maxBuffer, encoding) => {
1818
+ const buffer = await getStreamAsBuffer(stream, { maxBuffer });
1819
+ return buffer.toString(encoding);
1820
+ };
1821
+ var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
1822
+ const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
1823
+ const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
1824
+ const allPromise = getStreamPromise(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
1825
+ try {
1826
+ return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
1827
+ } catch (error) {
1828
+ return Promise.all([
1829
+ { error, signal: error.signal, timedOut: error.timedOut },
1830
+ getBufferedData(stdout, stdoutPromise),
1831
+ getBufferedData(stderr, stderrPromise),
1832
+ getBufferedData(all, allPromise)
1833
+ ]);
1834
+ }
1835
+ };
1836
+ var nativePromisePrototype = (async () => {
1837
+ })().constructor.prototype;
1838
+ var descriptors = ["then", "catch", "finally"].map((property) => [
1839
+ property,
1840
+ Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
1841
+ ]);
1842
+ var mergePromise = (spawned, promise) => {
1843
+ for (const [property, descriptor] of descriptors) {
1844
+ const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
1845
+ Reflect.defineProperty(spawned, property, { ...descriptor, value });
1846
+ }
1847
+ };
1848
+ var getSpawnedPromise = (spawned) => new Promise((resolve, reject) => {
1849
+ spawned.on("exit", (exitCode, signal) => {
1850
+ resolve({ exitCode, signal });
1851
+ });
1852
+ spawned.on("error", (error) => {
1853
+ reject(error);
1854
+ });
1855
+ if (spawned.stdin) {
1856
+ spawned.stdin.on("error", (error) => {
1857
+ reject(error);
1858
+ });
1859
+ }
1860
+ });
1861
+ var normalizeArgs = (file, args = []) => {
1862
+ if (!Array.isArray(args)) {
1863
+ return [file];
1864
+ }
1865
+ return [file, ...args];
1866
+ };
1867
+ var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
1868
+ var escapeArg = (arg) => {
1869
+ if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
1870
+ return arg;
1871
+ }
1872
+ return `"${arg.replaceAll('"', '\\"')}"`;
1873
+ };
1874
+ var joinCommand = (file, args) => normalizeArgs(file, args).join(" ");
1875
+ var getEscapedCommand = (file, args) => normalizeArgs(file, args).map((arg) => escapeArg(arg)).join(" ");
1876
+ var SPACES_REGEXP = / +/g;
1877
+ var parseExpression = (expression) => {
1878
+ const typeOfExpression = typeof expression;
1879
+ if (typeOfExpression === "string") {
1880
+ return expression;
1881
+ }
1882
+ if (typeOfExpression === "number") {
1883
+ return String(expression);
1884
+ }
1885
+ if (typeOfExpression === "object" && expression !== null && !(expression instanceof import_node_child_process3.ChildProcess) && "stdout" in expression) {
1886
+ const typeOfStdout = typeof expression.stdout;
1887
+ if (typeOfStdout === "string") {
1888
+ return expression.stdout;
1889
+ }
1890
+ if (import_node_buffer2.Buffer.isBuffer(expression.stdout)) {
1891
+ return expression.stdout.toString();
1892
+ }
1893
+ throw new TypeError(`Unexpected "${typeOfStdout}" stdout in template expression`);
1894
+ }
1895
+ throw new TypeError(`Unexpected "${typeOfExpression}" in template expression`);
1896
+ };
1897
+ var concatTokens = (tokens, nextTokens, isNew) => isNew || tokens.length === 0 || nextTokens.length === 0 ? [...tokens, ...nextTokens] : [
1898
+ ...tokens.slice(0, -1),
1899
+ `${tokens.at(-1)}${nextTokens[0]}`,
1900
+ ...nextTokens.slice(1)
1901
+ ];
1902
+ var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
1903
+ const templateString = template ?? templates.raw[index];
1904
+ const templateTokens = templateString.split(SPACES_REGEXP).filter(Boolean);
1905
+ const newTokens = concatTokens(
1906
+ tokens,
1907
+ templateTokens,
1908
+ templateString.startsWith(" ")
1909
+ );
1910
+ if (index === expressions.length) {
1911
+ return newTokens;
1912
+ }
1913
+ const expression = expressions[index];
1914
+ const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
1915
+ return concatTokens(
1916
+ newTokens,
1917
+ expressionTokens,
1918
+ templateString.endsWith(" ")
1919
+ );
1920
+ };
1921
+ var parseTemplates = (templates, expressions) => {
1922
+ let tokens = [];
1923
+ for (const [index, template] of templates.entries()) {
1924
+ tokens = parseTemplate({ templates, expressions, tokens, index, template });
1925
+ }
1926
+ return tokens;
1927
+ };
1928
+ var verboseDefault = (0, import_node_util2.debuglog)("execa").enabled;
1929
+ var padField = (field, padding) => String(field).padStart(padding, "0");
1930
+ var getTimestamp = () => {
1931
+ const date = /* @__PURE__ */ new Date();
1932
+ return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
1933
+ };
1934
+ var logCommand = (escapedCommand, { verbose }) => {
1935
+ if (!verbose) {
1936
+ return;
1937
+ }
1938
+ import_node_process4.default.stderr.write(`[${getTimestamp()}] ${escapedCommand}
1939
+ `);
1940
+ };
1941
+ var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
1942
+ var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
1943
+ const env = extendEnv ? { ...import_node_process.default.env, ...envOption } : envOption;
1944
+ if (preferLocal) {
1945
+ return npmRunPathEnv({ env, cwd: localDir, execPath });
1946
+ }
1947
+ return env;
1948
+ };
1949
+ var handleArguments = (file, args, options = {}) => {
1950
+ const parsed = import_cross_spawn.default._parse(file, args, options);
1951
+ file = parsed.command;
1952
+ args = parsed.args;
1953
+ options = parsed.options;
1954
+ options = {
1955
+ maxBuffer: DEFAULT_MAX_BUFFER,
1956
+ buffer: true,
1957
+ stripFinalNewline: true,
1958
+ extendEnv: true,
1959
+ preferLocal: false,
1960
+ localDir: options.cwd || import_node_process.default.cwd(),
1961
+ execPath: import_node_process.default.execPath,
1962
+ encoding: "utf8",
1963
+ reject: true,
1964
+ cleanup: true,
1965
+ all: false,
1966
+ windowsHide: true,
1967
+ verbose: verboseDefault,
1968
+ ...options
1969
+ };
1970
+ options.env = getEnv(options);
1971
+ options.stdio = normalizeStdio(options);
1972
+ if (import_node_process.default.platform === "win32" && import_node_path2.default.basename(file, ".exe") === "cmd") {
1973
+ args.unshift("/q");
1974
+ }
1975
+ return { file, args, options, parsed };
1976
+ };
1977
+ var handleOutput = (options, value, error) => {
1978
+ if (typeof value !== "string" && !import_node_buffer.Buffer.isBuffer(value)) {
1979
+ return error === void 0 ? void 0 : "";
1980
+ }
1981
+ if (options.stripFinalNewline) {
1982
+ return stripFinalNewline(value);
1983
+ }
1984
+ return value;
1985
+ };
1986
+ function execa(file, args, options) {
1987
+ const parsed = handleArguments(file, args, options);
1988
+ const command = joinCommand(file, args);
1989
+ const escapedCommand = getEscapedCommand(file, args);
1990
+ logCommand(escapedCommand, parsed.options);
1991
+ validateTimeout(parsed.options);
1992
+ let spawned;
1993
+ try {
1994
+ spawned = import_node_child_process.default.spawn(parsed.file, parsed.args, parsed.options);
1995
+ } catch (error) {
1996
+ const dummySpawned = new import_node_child_process.default.ChildProcess();
1997
+ const errorPromise = Promise.reject(makeError({
1998
+ error,
1999
+ stdout: "",
2000
+ stderr: "",
2001
+ all: "",
2002
+ command,
2003
+ escapedCommand,
2004
+ parsed,
2005
+ timedOut: false,
2006
+ isCanceled: false,
2007
+ killed: false
2008
+ }));
2009
+ mergePromise(dummySpawned, errorPromise);
2010
+ return dummySpawned;
2011
+ }
2012
+ const spawnedPromise = getSpawnedPromise(spawned);
2013
+ const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
2014
+ const processDone = setExitHandler(spawned, parsed.options, timedPromise);
2015
+ const context = { isCanceled: false };
2016
+ spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
2017
+ spawned.cancel = spawnedCancel.bind(null, spawned, context);
2018
+ const handlePromise = async () => {
2019
+ const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
2020
+ const stdout = handleOutput(parsed.options, stdoutResult);
2021
+ const stderr = handleOutput(parsed.options, stderrResult);
2022
+ const all = handleOutput(parsed.options, allResult);
2023
+ if (error || exitCode !== 0 || signal !== null) {
2024
+ const returnedError = makeError({
2025
+ error,
2026
+ exitCode,
2027
+ signal,
2028
+ stdout,
2029
+ stderr,
2030
+ all,
2031
+ command,
2032
+ escapedCommand,
2033
+ parsed,
2034
+ timedOut,
2035
+ isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
2036
+ killed: spawned.killed
2037
+ });
2038
+ if (!parsed.options.reject) {
2039
+ return returnedError;
2040
+ }
2041
+ throw returnedError;
2042
+ }
2043
+ return {
2044
+ command,
2045
+ escapedCommand,
2046
+ exitCode: 0,
2047
+ stdout,
2048
+ stderr,
2049
+ all,
2050
+ failed: false,
2051
+ timedOut: false,
2052
+ isCanceled: false,
2053
+ killed: false
2054
+ };
2055
+ };
2056
+ const handlePromiseOnce = onetime_default(handlePromise);
2057
+ handleInput(spawned, parsed.options);
2058
+ spawned.all = makeAllStream(spawned, parsed.options);
2059
+ addPipeMethods(spawned);
2060
+ mergePromise(spawned, handlePromiseOnce);
2061
+ return spawned;
2062
+ }
2063
+ function execaSync(file, args, options) {
2064
+ const parsed = handleArguments(file, args, options);
2065
+ const command = joinCommand(file, args);
2066
+ const escapedCommand = getEscapedCommand(file, args);
2067
+ logCommand(escapedCommand, parsed.options);
2068
+ const input = handleInputSync(parsed.options);
2069
+ let result;
2070
+ try {
2071
+ result = import_node_child_process.default.spawnSync(parsed.file, parsed.args, { ...parsed.options, input });
2072
+ } catch (error) {
2073
+ throw makeError({
2074
+ error,
2075
+ stdout: "",
2076
+ stderr: "",
2077
+ all: "",
2078
+ command,
2079
+ escapedCommand,
2080
+ parsed,
2081
+ timedOut: false,
2082
+ isCanceled: false,
2083
+ killed: false
2084
+ });
2085
+ }
2086
+ const stdout = handleOutput(parsed.options, result.stdout, result.error);
2087
+ const stderr = handleOutput(parsed.options, result.stderr, result.error);
2088
+ if (result.error || result.status !== 0 || result.signal !== null) {
2089
+ const error = makeError({
2090
+ stdout,
2091
+ stderr,
2092
+ error: result.error,
2093
+ signal: result.signal,
2094
+ exitCode: result.status,
2095
+ command,
2096
+ escapedCommand,
2097
+ parsed,
2098
+ timedOut: result.error && result.error.code === "ETIMEDOUT",
2099
+ isCanceled: false,
2100
+ killed: result.signal !== null
2101
+ });
2102
+ if (!parsed.options.reject) {
2103
+ return error;
2104
+ }
2105
+ throw error;
2106
+ }
2107
+ return {
2108
+ command,
2109
+ escapedCommand,
2110
+ exitCode: 0,
2111
+ stdout,
2112
+ stderr,
2113
+ failed: false,
2114
+ timedOut: false,
2115
+ isCanceled: false,
2116
+ killed: false
2117
+ };
2118
+ }
2119
+ var normalizeScriptStdin = ({ input, inputFile, stdio }) => input === void 0 && inputFile === void 0 && stdio === void 0 ? { stdin: "inherit" } : {};
2120
+ var normalizeScriptOptions = (options = {}) => ({
2121
+ preferLocal: true,
2122
+ ...normalizeScriptStdin(options),
2123
+ ...options
2124
+ });
2125
+ function create$(options) {
2126
+ function $2(templatesOrOptions, ...expressions) {
2127
+ if (!Array.isArray(templatesOrOptions)) {
2128
+ return create$({ ...options, ...templatesOrOptions });
2129
+ }
2130
+ const [file, ...args] = parseTemplates(templatesOrOptions, expressions);
2131
+ return execa(file, args, normalizeScriptOptions(options));
2132
+ }
2133
+ $2.sync = (templates, ...expressions) => {
2134
+ if (!Array.isArray(templates)) {
2135
+ throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");
2136
+ }
2137
+ const [file, ...args] = parseTemplates(templates, expressions);
2138
+ return execaSync(file, args, normalizeScriptOptions(options));
2139
+ };
2140
+ return $2;
2141
+ }
2142
+ var $ = create$();
2143
+ var import_fs_extra = (0, import_chunk_QGM4M3NI.__toESM)((0, import_chunk_LONQL55G.require_lib)());
2144
+ async function pMap(iterable, mapper, {
2145
+ concurrency = Number.POSITIVE_INFINITY,
2146
+ stopOnError = true,
2147
+ signal
2148
+ } = {}) {
2149
+ return new Promise((resolve_, reject_) => {
2150
+ if (iterable[Symbol.iterator] === void 0 && iterable[Symbol.asyncIterator] === void 0) {
2151
+ throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`);
2152
+ }
2153
+ if (typeof mapper !== "function") {
2154
+ throw new TypeError("Mapper function is required");
2155
+ }
2156
+ if (!(Number.isSafeInteger(concurrency) && concurrency >= 1 || concurrency === Number.POSITIVE_INFINITY)) {
2157
+ throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
2158
+ }
2159
+ const result = [];
2160
+ const errors = [];
2161
+ const skippedIndexesMap = /* @__PURE__ */ new Map();
2162
+ let isRejected = false;
2163
+ let isResolved = false;
2164
+ let isIterableDone = false;
2165
+ let resolvingCount = 0;
2166
+ let currentIndex = 0;
2167
+ const iterator = iterable[Symbol.iterator] === void 0 ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator]();
2168
+ const signalListener = () => {
2169
+ reject(signal.reason);
2170
+ };
2171
+ const cleanup = () => {
2172
+ signal?.removeEventListener("abort", signalListener);
2173
+ };
2174
+ const resolve = (value) => {
2175
+ resolve_(value);
2176
+ cleanup();
2177
+ };
2178
+ const reject = (reason) => {
2179
+ isRejected = true;
2180
+ isResolved = true;
2181
+ reject_(reason);
2182
+ cleanup();
2183
+ };
2184
+ if (signal) {
2185
+ if (signal.aborted) {
2186
+ reject(signal.reason);
2187
+ }
2188
+ signal.addEventListener("abort", signalListener, { once: true });
2189
+ }
2190
+ const next = async () => {
2191
+ if (isResolved) {
2192
+ return;
2193
+ }
2194
+ const nextItem = await iterator.next();
2195
+ const index = currentIndex;
2196
+ currentIndex++;
2197
+ if (nextItem.done) {
2198
+ isIterableDone = true;
2199
+ if (resolvingCount === 0 && !isResolved) {
2200
+ if (!stopOnError && errors.length > 0) {
2201
+ reject(new AggregateError(errors));
2202
+ return;
2203
+ }
2204
+ isResolved = true;
2205
+ if (skippedIndexesMap.size === 0) {
2206
+ resolve(result);
2207
+ return;
2208
+ }
2209
+ const pureResult = [];
2210
+ for (const [index2, value] of result.entries()) {
2211
+ if (skippedIndexesMap.get(index2) === pMapSkip) {
2212
+ continue;
2213
+ }
2214
+ pureResult.push(value);
2215
+ }
2216
+ resolve(pureResult);
2217
+ }
2218
+ return;
2219
+ }
2220
+ resolvingCount++;
2221
+ (async () => {
2222
+ try {
2223
+ const element = await nextItem.value;
2224
+ if (isResolved) {
2225
+ return;
2226
+ }
2227
+ const value = await mapper(element, index);
2228
+ if (value === pMapSkip) {
2229
+ skippedIndexesMap.set(index, value);
2230
+ }
2231
+ result[index] = value;
2232
+ resolvingCount--;
2233
+ await next();
2234
+ } catch (error) {
2235
+ if (stopOnError) {
2236
+ reject(error);
2237
+ } else {
2238
+ errors.push(error);
2239
+ resolvingCount--;
2240
+ try {
2241
+ await next();
2242
+ } catch (error2) {
2243
+ reject(error2);
2244
+ }
2245
+ }
2246
+ }
2247
+ })();
2248
+ };
2249
+ (async () => {
2250
+ for (let index = 0; index < concurrency; index++) {
2251
+ try {
2252
+ await next();
2253
+ } catch (error) {
2254
+ reject(error);
2255
+ break;
2256
+ }
2257
+ if (isIterableDone || isRejected) {
2258
+ break;
2259
+ }
2260
+ }
2261
+ })();
2262
+ });
2263
+ }
2264
+ var pMapSkip = Symbol("skip");
2265
+ async function pFilter(iterable, filterer, options) {
2266
+ const values = await pMap(
2267
+ iterable,
2268
+ (element, index) => Promise.all([filterer(element, index), element]),
2269
+ options
2270
+ );
2271
+ return values.filter((value) => Boolean(value[0])).map((value) => value[1]);
2272
+ }
2273
+ var import_temp_dir = (0, import_chunk_QGM4M3NI.__toESM)((0, import_chunk_CY52DY2B.require_temp_dir)());
2274
+ var { enginesOverride } = require_package();
2275
+ var debug = (0, import_debug.default)("prisma:fetch-engine:download");
2276
+ var exists = (0, import_node_util.promisify)(import_node_fs.default.exists);
2277
+ var channel = "master";
2278
+ var vercelPkgPathRegex = /^((\w:[\\\/])|\/)snapshot[\/\\]/;
2279
+ async function download(options) {
2280
+ if (!options.binaries || Object.values(options.binaries).length === 0) {
2281
+ return {};
2282
+ }
2283
+ if (enginesOverride?.["branch"] || enginesOverride?.["folder"]) {
2284
+ options.version = "_local_";
2285
+ options.skipCacheIntegrityCheck = true;
2286
+ }
2287
+ const { binaryTarget, ...os2 } = await (0, import_get_platform.getPlatformInfo)();
2288
+ if (os2.targetDistro && ["nixos"].includes(os2.targetDistro) && !(0, import_chunk_QFA3XBMW.allEngineEnvVarsSet)(Object.keys(options.binaries))) {
2289
+ console.error(
2290
+ `${(0, import_chunk_QFA3XBMW.yellow)("Warning")} Precompiled engine files are not available for ${os2.targetDistro}, please provide the paths via environment variables, see https://pris.ly/d/custom-engines`
2291
+ );
2292
+ } else if (["freebsd11", "freebsd12", "freebsd13", "freebsd14", "freebsd15", "openbsd", "netbsd"].includes(binaryTarget)) {
2293
+ console.error(
2294
+ `${(0, import_chunk_QFA3XBMW.yellow)(
2295
+ "Warning"
2296
+ )} Precompiled engine files are not available for ${binaryTarget}. Read more about building your own engines at https://pris.ly/d/build-engines`
2297
+ );
2298
+ } else if ("libquery-engine" in options.binaries) {
2299
+ (0, import_get_platform.assertNodeAPISupported)();
2300
+ }
2301
+ const opts = {
2302
+ ...options,
2303
+ binaryTargets: options.binaryTargets ?? [binaryTarget],
2304
+ version: options.version ?? "latest",
2305
+ binaries: options.binaries
2306
+ };
2307
+ const binaryJobs = Object.entries(opts.binaries).flatMap(
2308
+ ([binaryName, targetFolder]) => opts.binaryTargets.map((binaryTarget2) => {
2309
+ const fileName = getBinaryName(binaryName, binaryTarget2);
2310
+ const targetFilePath = import_node_path.default.join(targetFolder, fileName);
2311
+ return {
2312
+ binaryName,
2313
+ targetFolder,
2314
+ binaryTarget: binaryTarget2,
2315
+ fileName,
2316
+ targetFilePath,
2317
+ envVarPath: (0, import_chunk_QFA3XBMW.getBinaryEnvVarPath)(binaryName)?.path,
2318
+ skipCacheIntegrityCheck: !!opts.skipCacheIntegrityCheck
2319
+ };
2320
+ })
2321
+ );
2322
+ if (process.env.BINARY_DOWNLOAD_VERSION) {
2323
+ debug(`process.env.BINARY_DOWNLOAD_VERSION is set to "${process.env.BINARY_DOWNLOAD_VERSION}"`);
2324
+ opts.version = process.env.BINARY_DOWNLOAD_VERSION;
2325
+ }
2326
+ if (opts.printVersion) {
2327
+ console.log(`version: ${opts.version}`);
2328
+ }
2329
+ const binariesToDownload = await pFilter(binaryJobs, async (job) => {
2330
+ const needsToBeDownloaded = await binaryNeedsToBeDownloaded(job, binaryTarget, opts.version);
2331
+ const isSupported = import_get_platform.binaryTargets.includes(job.binaryTarget);
2332
+ const shouldDownload = isSupported && !job.envVarPath && // this is for custom binaries
2333
+ needsToBeDownloaded;
2334
+ if (needsToBeDownloaded && !isSupported) {
2335
+ throw new Error(`Unknown binaryTarget ${job.binaryTarget} and no custom engine files were provided`);
2336
+ }
2337
+ return shouldDownload;
2338
+ });
2339
+ if (binariesToDownload.length > 0) {
2340
+ const cleanupPromise = (0, import_chunk_3VVCXIQ5.cleanupCache)();
2341
+ let finishBar;
2342
+ let setProgress;
2343
+ if (opts.showProgress) {
2344
+ const collectiveBar = getCollectiveBar(opts);
2345
+ finishBar = collectiveBar.finishBar;
2346
+ setProgress = collectiveBar.setProgress;
2347
+ }
2348
+ const promises = binariesToDownload.map((job) => {
2349
+ const downloadUrl = (0, import_chunk_LONQL55G.getDownloadUrl)({
2350
+ channel: "all_commits",
2351
+ version: opts.version,
2352
+ binaryTarget: job.binaryTarget,
2353
+ binaryName: job.binaryName
2354
+ });
2355
+ debug(`${downloadUrl} will be downloaded to ${job.targetFilePath}`);
2356
+ return downloadBinary({
2357
+ ...job,
2358
+ downloadUrl,
2359
+ version: opts.version,
2360
+ failSilent: opts.failSilent,
2361
+ progressCb: setProgress ? setProgress(job.targetFilePath) : void 0
2362
+ });
2363
+ });
2364
+ await Promise.all(promises);
2365
+ await cleanupPromise;
2366
+ if (finishBar) {
2367
+ finishBar();
2368
+ }
2369
+ }
2370
+ const binaryPaths = binaryJobsToBinaryPaths(binaryJobs);
2371
+ if (__dirname.match(vercelPkgPathRegex)) {
2372
+ for (const engineType in binaryPaths) {
2373
+ const binaryTargets2 = binaryPaths[engineType];
2374
+ for (const binaryTarget2 in binaryTargets2) {
2375
+ const binaryPath = binaryTargets2[binaryTarget2];
2376
+ binaryTargets2[binaryTarget2] = await maybeCopyToTmp(binaryPath);
2377
+ }
2378
+ }
2379
+ }
2380
+ return binaryPaths;
2381
+ }
2382
+ function getCollectiveBar(options) {
2383
+ const hasNodeAPI = "libquery-engine" in options.binaries;
2384
+ const bar = (0, import_chunk_MWVY55RY.getBar)(
2385
+ `Downloading Prisma engines${hasNodeAPI ? " for Node-API" : ""} for ${options.binaryTargets?.map((p) => (0, import_chunk_QFA3XBMW.bold)(p)).join(" and ")}`
2386
+ );
2387
+ const progressMap = {};
2388
+ const numDownloads = Object.values(options.binaries).length * Object.values(options?.binaryTargets ?? []).length;
2389
+ const setProgress = (sourcePath) => (progress) => {
2390
+ progressMap[sourcePath] = progress;
2391
+ const progressValues = Object.values(progressMap);
2392
+ const totalProgress = progressValues.reduce((acc, curr) => {
2393
+ return acc + curr;
2394
+ }, 0) / numDownloads;
2395
+ if (options.progressCb) {
2396
+ options.progressCb(totalProgress);
2397
+ }
2398
+ if (bar) {
2399
+ bar.update(totalProgress);
2400
+ }
2401
+ };
2402
+ return {
2403
+ setProgress,
2404
+ finishBar: () => {
2405
+ bar.update(1);
2406
+ bar.terminate();
2407
+ }
2408
+ };
2409
+ }
2410
+ function binaryJobsToBinaryPaths(jobs) {
2411
+ return jobs.reduce((acc, job) => {
2412
+ if (!acc[job.binaryName]) {
2413
+ acc[job.binaryName] = {};
2414
+ }
2415
+ acc[job.binaryName][job.binaryTarget] = job.envVarPath || job.targetFilePath;
2416
+ return acc;
2417
+ }, {});
2418
+ }
2419
+ async function binaryNeedsToBeDownloaded(job, nativePlatform, version) {
2420
+ if (job.envVarPath && import_node_fs.default.existsSync(job.envVarPath)) {
2421
+ return false;
2422
+ }
2423
+ const targetExists = await exists(job.targetFilePath);
2424
+ const cachedFile = await getCachedBinaryPath({
2425
+ ...job,
2426
+ version
2427
+ });
2428
+ if (cachedFile) {
2429
+ if (job.skipCacheIntegrityCheck === true) {
2430
+ await (0, import_chunk_LONQL55G.overwriteFile)(cachedFile, job.targetFilePath);
2431
+ return false;
2432
+ }
2433
+ const sha256FilePath = cachedFile + ".sha256";
2434
+ if (await exists(sha256FilePath)) {
2435
+ const sha256File = await import_node_fs.default.promises.readFile(sha256FilePath, "utf-8");
2436
+ const sha256Cache = await (0, import_chunk_FKGWOTGU.getHash)(cachedFile);
2437
+ if (sha256File === sha256Cache) {
2438
+ if (!targetExists) {
2439
+ debug(`copying ${cachedFile} to ${job.targetFilePath}`);
2440
+ await import_node_fs.default.promises.utimes(cachedFile, /* @__PURE__ */ new Date(), /* @__PURE__ */ new Date());
2441
+ await (0, import_chunk_LONQL55G.overwriteFile)(cachedFile, job.targetFilePath);
2442
+ }
2443
+ const targetSha256 = await (0, import_chunk_FKGWOTGU.getHash)(job.targetFilePath);
2444
+ if (sha256File !== targetSha256) {
2445
+ debug(`overwriting ${job.targetFilePath} with ${cachedFile} as hashes do not match`);
2446
+ await (0, import_chunk_LONQL55G.overwriteFile)(cachedFile, job.targetFilePath);
2447
+ }
2448
+ return false;
2449
+ } else {
2450
+ return true;
2451
+ }
2452
+ } else if (process.env.PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING) {
2453
+ debug(
2454
+ `the checksum file ${sha256FilePath} is missing but this was ignored because the PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING environment variable is set`
2455
+ );
2456
+ if (targetExists) {
2457
+ return false;
2458
+ }
2459
+ if (cachedFile) {
2460
+ debug(`copying ${cachedFile} to ${job.targetFilePath}`);
2461
+ await (0, import_chunk_LONQL55G.overwriteFile)(cachedFile, job.targetFilePath);
2462
+ return false;
2463
+ }
2464
+ return true;
2465
+ } else {
2466
+ return true;
2467
+ }
2468
+ }
2469
+ if (!targetExists) {
2470
+ debug(`file ${job.targetFilePath} does not exist and must be downloaded`);
2471
+ return true;
2472
+ }
2473
+ if (job.binaryTarget === nativePlatform) {
2474
+ const currentVersion = await getVersion(job.targetFilePath, job.binaryName);
2475
+ if (currentVersion?.includes(version) !== true) {
2476
+ debug(`file ${job.targetFilePath} exists but its version is ${currentVersion} and we expect ${version}`);
2477
+ return true;
2478
+ }
2479
+ }
2480
+ return false;
2481
+ }
2482
+ async function getVersion(enginePath, binaryName) {
2483
+ try {
2484
+ if (binaryName === "libquery-engine") {
2485
+ (0, import_get_platform.assertNodeAPISupported)();
2486
+ const commitHash = (0, import_chunk_QGM4M3NI.__require)(enginePath).version().commit;
2487
+ return `${"libquery-engine"} ${commitHash}`;
2488
+ } else {
2489
+ const result = await execa(enginePath, ["--version"]);
2490
+ return result.stdout;
2491
+ }
2492
+ } catch {
2493
+ }
2494
+ return void 0;
2495
+ }
2496
+ function getBinaryName(binaryName, binaryTarget) {
2497
+ if (binaryName === "libquery-engine") {
2498
+ return `${(0, import_get_platform.getNodeAPIName)(binaryTarget, "fs")}`;
2499
+ }
2500
+ const extension = binaryTarget === "windows" ? ".exe" : "";
2501
+ return `${binaryName}-${binaryTarget}${extension}`;
2502
+ }
2503
+ async function getCachedBinaryPath({
2504
+ version,
2505
+ binaryTarget,
2506
+ binaryName
2507
+ }) {
2508
+ const cacheDir = await (0, import_chunk_LONQL55G.getCacheDir)(channel, version, binaryTarget);
2509
+ if (!cacheDir) {
2510
+ return null;
2511
+ }
2512
+ const cachedTargetPath = import_node_path.default.join(cacheDir, binaryName);
2513
+ if (!import_node_fs.default.existsSync(cachedTargetPath)) {
2514
+ return null;
2515
+ }
2516
+ if (version !== "latest") {
2517
+ return cachedTargetPath;
2518
+ }
2519
+ if (await exists(cachedTargetPath)) {
2520
+ return cachedTargetPath;
2521
+ }
2522
+ return null;
2523
+ }
2524
+ async function downloadBinary(options) {
2525
+ const { version, progressCb, targetFilePath, downloadUrl } = options;
2526
+ const targetDir = import_node_path.default.dirname(targetFilePath);
2527
+ try {
2528
+ import_node_fs.default.accessSync(targetDir, import_node_fs.default.constants.W_OK);
2529
+ await (0, import_fs_extra.ensureDir)(targetDir);
2530
+ } catch (e) {
2531
+ if (options.failSilent || e.code !== "EACCES") {
2532
+ return;
2533
+ } else {
2534
+ throw new Error(`Can't write to ${targetDir} please make sure you install "prisma" with the right permissions.`);
2535
+ }
2536
+ }
2537
+ debug(`Downloading ${downloadUrl} to ${targetFilePath} ...`);
2538
+ if (progressCb) {
2539
+ progressCb(0);
2540
+ }
2541
+ const { sha256, zippedSha256 } = await (0, import_chunk_CY52DY2B.downloadZip)(downloadUrl, targetFilePath, progressCb);
2542
+ if (progressCb) {
2543
+ progressCb(1);
2544
+ }
2545
+ (0, import_chunk_7JLQJWOR.chmodPlusX)(targetFilePath);
2546
+ await saveFileToCache(options, version, sha256, zippedSha256);
2547
+ }
2548
+ async function saveFileToCache(job, version, sha256, zippedSha256) {
2549
+ const cacheDir = await (0, import_chunk_LONQL55G.getCacheDir)(channel, version, job.binaryTarget);
2550
+ if (!cacheDir) {
2551
+ return;
2552
+ }
2553
+ const cachedTargetPath = import_node_path.default.join(cacheDir, job.binaryName);
2554
+ const cachedSha256Path = import_node_path.default.join(cacheDir, job.binaryName + ".sha256");
2555
+ const cachedSha256ZippedPath = import_node_path.default.join(cacheDir, job.binaryName + ".gz.sha256");
2556
+ try {
2557
+ await (0, import_chunk_LONQL55G.overwriteFile)(job.targetFilePath, cachedTargetPath);
2558
+ if (sha256 != null) {
2559
+ await import_node_fs.default.promises.writeFile(cachedSha256Path, sha256);
2560
+ }
2561
+ if (zippedSha256 != null) {
2562
+ await import_node_fs.default.promises.writeFile(cachedSha256ZippedPath, zippedSha256);
2563
+ }
2564
+ } catch (e) {
2565
+ debug(e);
2566
+ }
2567
+ }
2568
+ async function maybeCopyToTmp(file) {
2569
+ if (__dirname.match(vercelPkgPathRegex)) {
2570
+ const targetDir = import_node_path.default.join(import_temp_dir.default, "prisma-binaries");
2571
+ await (0, import_fs_extra.ensureDir)(targetDir);
2572
+ const target = import_node_path.default.join(targetDir, import_node_path.default.basename(file));
2573
+ const data = await import_node_fs.default.promises.readFile(file);
2574
+ await import_node_fs.default.promises.writeFile(target, data);
2575
+ plusX(target);
2576
+ return target;
2577
+ }
2578
+ return file;
2579
+ }
2580
+ function plusX(file) {
2581
+ const s = import_node_fs.default.statSync(file);
2582
+ const newMode = s.mode | 64 | 8 | 1;
2583
+ if (s.mode === newMode) {
2584
+ return;
2585
+ }
2586
+ const base8 = newMode.toString(8).slice(-3);
2587
+ import_node_fs.default.chmodSync(file, base8);
2588
+ }
backend/node_modules/@prisma/fetch-engine/dist/chunk-CCMBPDR2.js ADDED
@@ -0,0 +1,2588 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var chunk_CCMBPDR2_exports = {};
30
+ __export(chunk_CCMBPDR2_exports, {
31
+ download: () => download,
32
+ getBinaryName: () => getBinaryName,
33
+ getVersion: () => getVersion,
34
+ maybeCopyToTmp: () => maybeCopyToTmp,
35
+ plusX: () => plusX,
36
+ vercelPkgPathRegex: () => vercelPkgPathRegex
37
+ });
38
+ module.exports = __toCommonJS(chunk_CCMBPDR2_exports);
39
+ var import_chunk_MWVY55RY = require("./chunk-MWVY55RY.js");
40
+ var import_chunk_7JLQJWOR = require("./chunk-7JLQJWOR.js");
41
+ var import_chunk_3VVCXIQ5 = require("./chunk-3VVCXIQ5.js");
42
+ var import_chunk_CY52DY2B = require("./chunk-CY52DY2B.js");
43
+ var import_chunk_LONQL55G = require("./chunk-LONQL55G.js");
44
+ var import_chunk_QFA3XBMW = require("./chunk-QFA3XBMW.js");
45
+ var import_chunk_FKGWOTGU = require("./chunk-FKGWOTGU.js");
46
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
47
+ var import_node_fs = __toESM(require("node:fs"));
48
+ var import_node_path = __toESM(require("node:path"));
49
+ var import_node_util = require("node:util");
50
+ var import_debug = __toESM(require("@prisma/debug"));
51
+ var import_get_platform = require("@prisma/get-platform");
52
+ var import_node_buffer = require("node:buffer");
53
+ var import_node_path2 = __toESM(require("node:path"));
54
+ var import_node_child_process = __toESM(require("node:child_process"));
55
+ var import_node_process = __toESM(require("node:process"));
56
+ var import_node_process2 = __toESM(require("node:process"));
57
+ var import_node_path3 = __toESM(require("node:path"));
58
+ var import_node_url = require("node:url");
59
+ var import_node_process3 = __toESM(require("node:process"));
60
+ var import_node_os = require("node:os");
61
+ var import_node_os2 = require("node:os");
62
+ var import_node_os3 = __toESM(require("node:os"));
63
+ var import_node_fs2 = require("node:fs");
64
+ var import_node_child_process2 = require("node:child_process");
65
+ var import_node_fs3 = require("node:fs");
66
+ var import_promises = require("node:timers/promises");
67
+ var import_node_buffer2 = require("node:buffer");
68
+ var import_node_child_process3 = require("node:child_process");
69
+ var import_node_util2 = require("node:util");
70
+ var import_node_process4 = __toESM(require("node:process"));
71
+ var require_windows = (0, import_chunk_QGM4M3NI.__commonJS)({
72
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
73
+ "use strict";
74
+ module2.exports = isexe;
75
+ isexe.sync = sync;
76
+ var fs2 = (0, import_chunk_QGM4M3NI.__require)("fs");
77
+ function checkPathExt(path4, options) {
78
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
79
+ if (!pathext) {
80
+ return true;
81
+ }
82
+ pathext = pathext.split(";");
83
+ if (pathext.indexOf("") !== -1) {
84
+ return true;
85
+ }
86
+ for (var i = 0; i < pathext.length; i++) {
87
+ var p = pathext[i].toLowerCase();
88
+ if (p && path4.substr(-p.length).toLowerCase() === p) {
89
+ return true;
90
+ }
91
+ }
92
+ return false;
93
+ }
94
+ function checkStat(stat, path4, options) {
95
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
96
+ return false;
97
+ }
98
+ return checkPathExt(path4, options);
99
+ }
100
+ function isexe(path4, options, cb) {
101
+ fs2.stat(path4, function(er, stat) {
102
+ cb(er, er ? false : checkStat(stat, path4, options));
103
+ });
104
+ }
105
+ function sync(path4, options) {
106
+ return checkStat(fs2.statSync(path4), path4, options);
107
+ }
108
+ }
109
+ });
110
+ var require_mode = (0, import_chunk_QGM4M3NI.__commonJS)({
111
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
112
+ "use strict";
113
+ module2.exports = isexe;
114
+ isexe.sync = sync;
115
+ var fs2 = (0, import_chunk_QGM4M3NI.__require)("fs");
116
+ function isexe(path4, options, cb) {
117
+ fs2.stat(path4, function(er, stat) {
118
+ cb(er, er ? false : checkStat(stat, options));
119
+ });
120
+ }
121
+ function sync(path4, options) {
122
+ return checkStat(fs2.statSync(path4), options);
123
+ }
124
+ function checkStat(stat, options) {
125
+ return stat.isFile() && checkMode(stat, options);
126
+ }
127
+ function checkMode(stat, options) {
128
+ var mod = stat.mode;
129
+ var uid = stat.uid;
130
+ var gid = stat.gid;
131
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
132
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
133
+ var u = parseInt("100", 8);
134
+ var g = parseInt("010", 8);
135
+ var o = parseInt("001", 8);
136
+ var ug = u | g;
137
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
138
+ return ret;
139
+ }
140
+ }
141
+ });
142
+ var require_isexe = (0, import_chunk_QGM4M3NI.__commonJS)({
143
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
144
+ "use strict";
145
+ var fs2 = (0, import_chunk_QGM4M3NI.__require)("fs");
146
+ var core;
147
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
148
+ core = require_windows();
149
+ } else {
150
+ core = require_mode();
151
+ }
152
+ module2.exports = isexe;
153
+ isexe.sync = sync;
154
+ function isexe(path4, options, cb) {
155
+ if (typeof options === "function") {
156
+ cb = options;
157
+ options = {};
158
+ }
159
+ if (!cb) {
160
+ if (typeof Promise !== "function") {
161
+ throw new TypeError("callback not provided");
162
+ }
163
+ return new Promise(function(resolve, reject) {
164
+ isexe(path4, options || {}, function(er, is) {
165
+ if (er) {
166
+ reject(er);
167
+ } else {
168
+ resolve(is);
169
+ }
170
+ });
171
+ });
172
+ }
173
+ core(path4, options || {}, function(er, is) {
174
+ if (er) {
175
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
176
+ er = null;
177
+ is = false;
178
+ }
179
+ }
180
+ cb(er, is);
181
+ });
182
+ }
183
+ function sync(path4, options) {
184
+ try {
185
+ return core.sync(path4, options || {});
186
+ } catch (er) {
187
+ if (options && options.ignoreErrors || er.code === "EACCES") {
188
+ return false;
189
+ } else {
190
+ throw er;
191
+ }
192
+ }
193
+ }
194
+ }
195
+ });
196
+ var require_which = (0, import_chunk_QGM4M3NI.__commonJS)({
197
+ "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module2) {
198
+ "use strict";
199
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
200
+ var path4 = (0, import_chunk_QGM4M3NI.__require)("path");
201
+ var COLON = isWindows ? ";" : ":";
202
+ var isexe = require_isexe();
203
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
204
+ var getPathInfo = (cmd, opt) => {
205
+ const colon = opt.colon || COLON;
206
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
207
+ // windows always checks the cwd first
208
+ ...isWindows ? [process.cwd()] : [],
209
+ ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
210
+ "").split(colon)
211
+ ];
212
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
213
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
214
+ if (isWindows) {
215
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
216
+ pathExt.unshift("");
217
+ }
218
+ return {
219
+ pathEnv,
220
+ pathExt,
221
+ pathExtExe
222
+ };
223
+ };
224
+ var which = (cmd, opt, cb) => {
225
+ if (typeof opt === "function") {
226
+ cb = opt;
227
+ opt = {};
228
+ }
229
+ if (!opt)
230
+ opt = {};
231
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
232
+ const found = [];
233
+ const step = (i) => new Promise((resolve, reject) => {
234
+ if (i === pathEnv.length)
235
+ return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
236
+ const ppRaw = pathEnv[i];
237
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
238
+ const pCmd = path4.join(pathPart, cmd);
239
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
240
+ resolve(subStep(p, i, 0));
241
+ });
242
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
243
+ if (ii === pathExt.length)
244
+ return resolve(step(i + 1));
245
+ const ext = pathExt[ii];
246
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
247
+ if (!er && is) {
248
+ if (opt.all)
249
+ found.push(p + ext);
250
+ else
251
+ return resolve(p + ext);
252
+ }
253
+ return resolve(subStep(p, i, ii + 1));
254
+ });
255
+ });
256
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
257
+ };
258
+ var whichSync = (cmd, opt) => {
259
+ opt = opt || {};
260
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
261
+ const found = [];
262
+ for (let i = 0; i < pathEnv.length; i++) {
263
+ const ppRaw = pathEnv[i];
264
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
265
+ const pCmd = path4.join(pathPart, cmd);
266
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
267
+ for (let j = 0; j < pathExt.length; j++) {
268
+ const cur = p + pathExt[j];
269
+ try {
270
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
271
+ if (is) {
272
+ if (opt.all)
273
+ found.push(cur);
274
+ else
275
+ return cur;
276
+ }
277
+ } catch (ex) {
278
+ }
279
+ }
280
+ }
281
+ if (opt.all && found.length)
282
+ return found;
283
+ if (opt.nothrow)
284
+ return null;
285
+ throw getNotFoundError(cmd);
286
+ };
287
+ module2.exports = which;
288
+ which.sync = whichSync;
289
+ }
290
+ });
291
+ var require_path_key = (0, import_chunk_QGM4M3NI.__commonJS)({
292
+ "../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports, module2) {
293
+ "use strict";
294
+ var pathKey2 = (options = {}) => {
295
+ const environment = options.env || process.env;
296
+ const platform = options.platform || process.platform;
297
+ if (platform !== "win32") {
298
+ return "PATH";
299
+ }
300
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
301
+ };
302
+ module2.exports = pathKey2;
303
+ module2.exports.default = pathKey2;
304
+ }
305
+ });
306
+ var require_resolveCommand = (0, import_chunk_QGM4M3NI.__commonJS)({
307
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
308
+ "use strict";
309
+ var path4 = (0, import_chunk_QGM4M3NI.__require)("path");
310
+ var which = require_which();
311
+ var getPathKey = require_path_key();
312
+ function resolveCommandAttempt(parsed, withoutPathExt) {
313
+ const env = parsed.options.env || process.env;
314
+ const cwd = process.cwd();
315
+ const hasCustomCwd = parsed.options.cwd != null;
316
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
317
+ if (shouldSwitchCwd) {
318
+ try {
319
+ process.chdir(parsed.options.cwd);
320
+ } catch (err) {
321
+ }
322
+ }
323
+ let resolved;
324
+ try {
325
+ resolved = which.sync(parsed.command, {
326
+ path: env[getPathKey({ env })],
327
+ pathExt: withoutPathExt ? path4.delimiter : void 0
328
+ });
329
+ } catch (e) {
330
+ } finally {
331
+ if (shouldSwitchCwd) {
332
+ process.chdir(cwd);
333
+ }
334
+ }
335
+ if (resolved) {
336
+ resolved = path4.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
337
+ }
338
+ return resolved;
339
+ }
340
+ function resolveCommand(parsed) {
341
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
342
+ }
343
+ module2.exports = resolveCommand;
344
+ }
345
+ });
346
+ var require_escape = (0, import_chunk_QGM4M3NI.__commonJS)({
347
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports, module2) {
348
+ "use strict";
349
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
350
+ function escapeCommand(arg) {
351
+ arg = arg.replace(metaCharsRegExp, "^$1");
352
+ return arg;
353
+ }
354
+ function escapeArgument(arg, doubleEscapeMetaChars) {
355
+ arg = `${arg}`;
356
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
357
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
358
+ arg = `"${arg}"`;
359
+ arg = arg.replace(metaCharsRegExp, "^$1");
360
+ if (doubleEscapeMetaChars) {
361
+ arg = arg.replace(metaCharsRegExp, "^$1");
362
+ }
363
+ return arg;
364
+ }
365
+ module2.exports.command = escapeCommand;
366
+ module2.exports.argument = escapeArgument;
367
+ }
368
+ });
369
+ var require_shebang_regex = (0, import_chunk_QGM4M3NI.__commonJS)({
370
+ "../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports, module2) {
371
+ "use strict";
372
+ module2.exports = /^#!(.*)/;
373
+ }
374
+ });
375
+ var require_shebang_command = (0, import_chunk_QGM4M3NI.__commonJS)({
376
+ "../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports, module2) {
377
+ "use strict";
378
+ var shebangRegex = require_shebang_regex();
379
+ module2.exports = (string = "") => {
380
+ const match = string.match(shebangRegex);
381
+ if (!match) {
382
+ return null;
383
+ }
384
+ const [path4, argument] = match[0].replace(/#! ?/, "").split(" ");
385
+ const binary = path4.split("/").pop();
386
+ if (binary === "env") {
387
+ return argument;
388
+ }
389
+ return argument ? `${binary} ${argument}` : binary;
390
+ };
391
+ }
392
+ });
393
+ var require_readShebang = (0, import_chunk_QGM4M3NI.__commonJS)({
394
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
395
+ "use strict";
396
+ var fs2 = (0, import_chunk_QGM4M3NI.__require)("fs");
397
+ var shebangCommand = require_shebang_command();
398
+ function readShebang(command) {
399
+ const size = 150;
400
+ const buffer = Buffer.alloc(size);
401
+ let fd;
402
+ try {
403
+ fd = fs2.openSync(command, "r");
404
+ fs2.readSync(fd, buffer, 0, size, 0);
405
+ fs2.closeSync(fd);
406
+ } catch (e) {
407
+ }
408
+ return shebangCommand(buffer.toString());
409
+ }
410
+ module2.exports = readShebang;
411
+ }
412
+ });
413
+ var require_parse = (0, import_chunk_QGM4M3NI.__commonJS)({
414
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module2) {
415
+ "use strict";
416
+ var path4 = (0, import_chunk_QGM4M3NI.__require)("path");
417
+ var resolveCommand = require_resolveCommand();
418
+ var escape = require_escape();
419
+ var readShebang = require_readShebang();
420
+ var isWin = process.platform === "win32";
421
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
422
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
423
+ function detectShebang(parsed) {
424
+ parsed.file = resolveCommand(parsed);
425
+ const shebang = parsed.file && readShebang(parsed.file);
426
+ if (shebang) {
427
+ parsed.args.unshift(parsed.file);
428
+ parsed.command = shebang;
429
+ return resolveCommand(parsed);
430
+ }
431
+ return parsed.file;
432
+ }
433
+ function parseNonShell(parsed) {
434
+ if (!isWin) {
435
+ return parsed;
436
+ }
437
+ const commandFile = detectShebang(parsed);
438
+ const needsShell = !isExecutableRegExp.test(commandFile);
439
+ if (parsed.options.forceShell || needsShell) {
440
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
441
+ parsed.command = path4.normalize(parsed.command);
442
+ parsed.command = escape.command(parsed.command);
443
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
444
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
445
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
446
+ parsed.command = process.env.comspec || "cmd.exe";
447
+ parsed.options.windowsVerbatimArguments = true;
448
+ }
449
+ return parsed;
450
+ }
451
+ function parse(command, args, options) {
452
+ if (args && !Array.isArray(args)) {
453
+ options = args;
454
+ args = null;
455
+ }
456
+ args = args ? args.slice(0) : [];
457
+ options = Object.assign({}, options);
458
+ const parsed = {
459
+ command,
460
+ args,
461
+ options,
462
+ file: void 0,
463
+ original: {
464
+ command,
465
+ args
466
+ }
467
+ };
468
+ return options.shell ? parsed : parseNonShell(parsed);
469
+ }
470
+ module2.exports = parse;
471
+ }
472
+ });
473
+ var require_enoent = (0, import_chunk_QGM4M3NI.__commonJS)({
474
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports, module2) {
475
+ "use strict";
476
+ var isWin = process.platform === "win32";
477
+ function notFoundError(original, syscall) {
478
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
479
+ code: "ENOENT",
480
+ errno: "ENOENT",
481
+ syscall: `${syscall} ${original.command}`,
482
+ path: original.command,
483
+ spawnargs: original.args
484
+ });
485
+ }
486
+ function hookChildProcess(cp, parsed) {
487
+ if (!isWin) {
488
+ return;
489
+ }
490
+ const originalEmit = cp.emit;
491
+ cp.emit = function(name, arg1) {
492
+ if (name === "exit") {
493
+ const err = verifyENOENT(arg1, parsed);
494
+ if (err) {
495
+ return originalEmit.call(cp, "error", err);
496
+ }
497
+ }
498
+ return originalEmit.apply(cp, arguments);
499
+ };
500
+ }
501
+ function verifyENOENT(status, parsed) {
502
+ if (isWin && status === 1 && !parsed.file) {
503
+ return notFoundError(parsed.original, "spawn");
504
+ }
505
+ return null;
506
+ }
507
+ function verifyENOENTSync(status, parsed) {
508
+ if (isWin && status === 1 && !parsed.file) {
509
+ return notFoundError(parsed.original, "spawnSync");
510
+ }
511
+ return null;
512
+ }
513
+ module2.exports = {
514
+ hookChildProcess,
515
+ verifyENOENT,
516
+ verifyENOENTSync,
517
+ notFoundError
518
+ };
519
+ }
520
+ });
521
+ var require_cross_spawn = (0, import_chunk_QGM4M3NI.__commonJS)({
522
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports, module2) {
523
+ "use strict";
524
+ var cp = (0, import_chunk_QGM4M3NI.__require)("child_process");
525
+ var parse = require_parse();
526
+ var enoent = require_enoent();
527
+ function spawn(command, args, options) {
528
+ const parsed = parse(command, args, options);
529
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
530
+ enoent.hookChildProcess(spawned, parsed);
531
+ return spawned;
532
+ }
533
+ function spawnSync(command, args, options) {
534
+ const parsed = parse(command, args, options);
535
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
536
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
537
+ return result;
538
+ }
539
+ module2.exports = spawn;
540
+ module2.exports.spawn = spawn;
541
+ module2.exports.sync = spawnSync;
542
+ module2.exports._parse = parse;
543
+ module2.exports._enoent = enoent;
544
+ }
545
+ });
546
+ var require_merge_stream = (0, import_chunk_QGM4M3NI.__commonJS)({
547
+ "../../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js"(exports, module2) {
548
+ "use strict";
549
+ var { PassThrough } = (0, import_chunk_QGM4M3NI.__require)("stream");
550
+ module2.exports = function() {
551
+ var sources = [];
552
+ var output = new PassThrough({ objectMode: true });
553
+ output.setMaxListeners(0);
554
+ output.add = add;
555
+ output.isEmpty = isEmpty;
556
+ output.on("unpipe", remove);
557
+ Array.prototype.slice.call(arguments).forEach(add);
558
+ return output;
559
+ function add(source) {
560
+ if (Array.isArray(source)) {
561
+ source.forEach(add);
562
+ return this;
563
+ }
564
+ sources.push(source);
565
+ source.once("end", remove.bind(null, source));
566
+ source.once("error", output.emit.bind(output, "error"));
567
+ source.pipe(output, { end: false });
568
+ return this;
569
+ }
570
+ function isEmpty() {
571
+ return sources.length == 0;
572
+ }
573
+ function remove(source) {
574
+ sources = sources.filter(function(it) {
575
+ return it !== source;
576
+ });
577
+ if (!sources.length && output.readable) {
578
+ output.end();
579
+ }
580
+ }
581
+ };
582
+ }
583
+ });
584
+ var require_package = (0, import_chunk_QGM4M3NI.__commonJS)({
585
+ "package.json"(exports, module2) {
586
+ module2.exports = {
587
+ name: "@prisma/fetch-engine",
588
+ version: "6.19.3",
589
+ description: "This package is intended for Prisma's internal use",
590
+ main: "dist/index.js",
591
+ types: "dist/index.d.ts",
592
+ license: "Apache-2.0",
593
+ author: "Tim Suchanek <suchanek@prisma.io>",
594
+ homepage: "https://www.prisma.io",
595
+ repository: {
596
+ type: "git",
597
+ url: "https://github.com/prisma/prisma.git",
598
+ directory: "packages/fetch-engine"
599
+ },
600
+ bugs: "https://github.com/prisma/prisma/issues",
601
+ enginesOverride: {},
602
+ devDependencies: {
603
+ "@types/node": "18.19.76",
604
+ "@types/progress": "2.0.7",
605
+ del: "6.1.1",
606
+ execa: "8.0.1",
607
+ "find-cache-dir": "5.0.0",
608
+ "fs-extra": "11.3.0",
609
+ hasha: "5.2.2",
610
+ "http-proxy-agent": "7.0.2",
611
+ "https-proxy-agent": "7.0.6",
612
+ kleur: "4.1.5",
613
+ "node-fetch": "3.3.2",
614
+ "p-filter": "4.1.0",
615
+ "p-map": "4.0.0",
616
+ "p-retry": "4.6.2",
617
+ progress: "2.0.3",
618
+ "temp-dir": "2.0.0",
619
+ tempy: "1.0.1",
620
+ "timeout-signal": "2.0.0",
621
+ typescript: "5.4.5"
622
+ },
623
+ dependencies: {
624
+ "@prisma/debug": "workspace:*",
625
+ "@prisma/engines-version": "7.1.1-3.c2990dca591cba766e3b7ef5d9e8a84796e47ab7",
626
+ "@prisma/get-platform": "workspace:*"
627
+ },
628
+ scripts: {
629
+ dev: "DEV=true tsx helpers/build.ts",
630
+ build: "tsx helpers/build.ts",
631
+ test: "vitest run",
632
+ prepublishOnly: "pnpm run build"
633
+ },
634
+ files: [
635
+ "README.md",
636
+ "dist"
637
+ ],
638
+ sideEffects: false
639
+ };
640
+ }
641
+ });
642
+ var import_cross_spawn = (0, import_chunk_QGM4M3NI.__toESM)(require_cross_spawn(), 1);
643
+ function stripFinalNewline(input) {
644
+ const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
645
+ const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
646
+ if (input[input.length - 1] === LF) {
647
+ input = input.slice(0, -1);
648
+ }
649
+ if (input[input.length - 1] === CR) {
650
+ input = input.slice(0, -1);
651
+ }
652
+ return input;
653
+ }
654
+ function pathKey(options = {}) {
655
+ const {
656
+ env = process.env,
657
+ platform = process.platform
658
+ } = options;
659
+ if (platform !== "win32") {
660
+ return "PATH";
661
+ }
662
+ return Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
663
+ }
664
+ var npmRunPath = ({
665
+ cwd = import_node_process2.default.cwd(),
666
+ path: pathOption = import_node_process2.default.env[pathKey()],
667
+ preferLocal = true,
668
+ execPath = import_node_process2.default.execPath,
669
+ addExecPath = true
670
+ } = {}) => {
671
+ const cwdString = cwd instanceof URL ? (0, import_node_url.fileURLToPath)(cwd) : cwd;
672
+ const cwdPath = import_node_path3.default.resolve(cwdString);
673
+ const result = [];
674
+ if (preferLocal) {
675
+ applyPreferLocal(result, cwdPath);
676
+ }
677
+ if (addExecPath) {
678
+ applyExecPath(result, execPath, cwdPath);
679
+ }
680
+ return [...result, pathOption].join(import_node_path3.default.delimiter);
681
+ };
682
+ var applyPreferLocal = (result, cwdPath) => {
683
+ let previous;
684
+ while (previous !== cwdPath) {
685
+ result.push(import_node_path3.default.join(cwdPath, "node_modules/.bin"));
686
+ previous = cwdPath;
687
+ cwdPath = import_node_path3.default.resolve(cwdPath, "..");
688
+ }
689
+ };
690
+ var applyExecPath = (result, execPath, cwdPath) => {
691
+ const execPathString = execPath instanceof URL ? (0, import_node_url.fileURLToPath)(execPath) : execPath;
692
+ result.push(import_node_path3.default.resolve(cwdPath, execPathString, ".."));
693
+ };
694
+ var npmRunPathEnv = ({ env = import_node_process2.default.env, ...options } = {}) => {
695
+ env = { ...env };
696
+ const pathName = pathKey({ env });
697
+ options.path = env[pathName];
698
+ env[pathName] = npmRunPath(options);
699
+ return env;
700
+ };
701
+ var copyProperty = (to, from, property, ignoreNonConfigurable) => {
702
+ if (property === "length" || property === "prototype") {
703
+ return;
704
+ }
705
+ if (property === "arguments" || property === "caller") {
706
+ return;
707
+ }
708
+ const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
709
+ const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
710
+ if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
711
+ return;
712
+ }
713
+ Object.defineProperty(to, property, fromDescriptor);
714
+ };
715
+ var canCopyProperty = function(toDescriptor, fromDescriptor) {
716
+ return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
717
+ };
718
+ var changePrototype = (to, from) => {
719
+ const fromPrototype = Object.getPrototypeOf(from);
720
+ if (fromPrototype === Object.getPrototypeOf(to)) {
721
+ return;
722
+ }
723
+ Object.setPrototypeOf(to, fromPrototype);
724
+ };
725
+ var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
726
+ ${fromBody}`;
727
+ var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
728
+ var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
729
+ var changeToString = (to, from, name) => {
730
+ const withName = name === "" ? "" : `with ${name.trim()}() `;
731
+ const newToString = wrappedToString.bind(null, withName, from.toString());
732
+ Object.defineProperty(newToString, "name", toStringName);
733
+ Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
734
+ };
735
+ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
736
+ const { name } = to;
737
+ for (const property of Reflect.ownKeys(from)) {
738
+ copyProperty(to, from, property, ignoreNonConfigurable);
739
+ }
740
+ changePrototype(to, from);
741
+ changeToString(to, from, name);
742
+ return to;
743
+ }
744
+ var calledFunctions = /* @__PURE__ */ new WeakMap();
745
+ var onetime = (function_, options = {}) => {
746
+ if (typeof function_ !== "function") {
747
+ throw new TypeError("Expected a function");
748
+ }
749
+ let returnValue;
750
+ let callCount = 0;
751
+ const functionName = function_.displayName || function_.name || "<anonymous>";
752
+ const onetime2 = function(...arguments_) {
753
+ calledFunctions.set(onetime2, ++callCount);
754
+ if (callCount === 1) {
755
+ returnValue = function_.apply(this, arguments_);
756
+ function_ = null;
757
+ } else if (options.throw === true) {
758
+ throw new Error(`Function \`${functionName}\` can only be called once`);
759
+ }
760
+ return returnValue;
761
+ };
762
+ mimicFunction(onetime2, function_);
763
+ calledFunctions.set(onetime2, callCount);
764
+ return onetime2;
765
+ };
766
+ onetime.callCount = (function_) => {
767
+ if (!calledFunctions.has(function_)) {
768
+ throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
769
+ }
770
+ return calledFunctions.get(function_);
771
+ };
772
+ var onetime_default = onetime;
773
+ var getRealtimeSignals = () => {
774
+ const length = SIGRTMAX - SIGRTMIN + 1;
775
+ return Array.from({ length }, getRealtimeSignal);
776
+ };
777
+ var getRealtimeSignal = (value, index) => ({
778
+ name: `SIGRT${index + 1}`,
779
+ number: SIGRTMIN + index,
780
+ action: "terminate",
781
+ description: "Application-specific signal (realtime)",
782
+ standard: "posix"
783
+ });
784
+ var SIGRTMIN = 34;
785
+ var SIGRTMAX = 64;
786
+ var SIGNALS = [
787
+ {
788
+ name: "SIGHUP",
789
+ number: 1,
790
+ action: "terminate",
791
+ description: "Terminal closed",
792
+ standard: "posix"
793
+ },
794
+ {
795
+ name: "SIGINT",
796
+ number: 2,
797
+ action: "terminate",
798
+ description: "User interruption with CTRL-C",
799
+ standard: "ansi"
800
+ },
801
+ {
802
+ name: "SIGQUIT",
803
+ number: 3,
804
+ action: "core",
805
+ description: "User interruption with CTRL-\\",
806
+ standard: "posix"
807
+ },
808
+ {
809
+ name: "SIGILL",
810
+ number: 4,
811
+ action: "core",
812
+ description: "Invalid machine instruction",
813
+ standard: "ansi"
814
+ },
815
+ {
816
+ name: "SIGTRAP",
817
+ number: 5,
818
+ action: "core",
819
+ description: "Debugger breakpoint",
820
+ standard: "posix"
821
+ },
822
+ {
823
+ name: "SIGABRT",
824
+ number: 6,
825
+ action: "core",
826
+ description: "Aborted",
827
+ standard: "ansi"
828
+ },
829
+ {
830
+ name: "SIGIOT",
831
+ number: 6,
832
+ action: "core",
833
+ description: "Aborted",
834
+ standard: "bsd"
835
+ },
836
+ {
837
+ name: "SIGBUS",
838
+ number: 7,
839
+ action: "core",
840
+ description: "Bus error due to misaligned, non-existing address or paging error",
841
+ standard: "bsd"
842
+ },
843
+ {
844
+ name: "SIGEMT",
845
+ number: 7,
846
+ action: "terminate",
847
+ description: "Command should be emulated but is not implemented",
848
+ standard: "other"
849
+ },
850
+ {
851
+ name: "SIGFPE",
852
+ number: 8,
853
+ action: "core",
854
+ description: "Floating point arithmetic error",
855
+ standard: "ansi"
856
+ },
857
+ {
858
+ name: "SIGKILL",
859
+ number: 9,
860
+ action: "terminate",
861
+ description: "Forced termination",
862
+ standard: "posix",
863
+ forced: true
864
+ },
865
+ {
866
+ name: "SIGUSR1",
867
+ number: 10,
868
+ action: "terminate",
869
+ description: "Application-specific signal",
870
+ standard: "posix"
871
+ },
872
+ {
873
+ name: "SIGSEGV",
874
+ number: 11,
875
+ action: "core",
876
+ description: "Segmentation fault",
877
+ standard: "ansi"
878
+ },
879
+ {
880
+ name: "SIGUSR2",
881
+ number: 12,
882
+ action: "terminate",
883
+ description: "Application-specific signal",
884
+ standard: "posix"
885
+ },
886
+ {
887
+ name: "SIGPIPE",
888
+ number: 13,
889
+ action: "terminate",
890
+ description: "Broken pipe or socket",
891
+ standard: "posix"
892
+ },
893
+ {
894
+ name: "SIGALRM",
895
+ number: 14,
896
+ action: "terminate",
897
+ description: "Timeout or timer",
898
+ standard: "posix"
899
+ },
900
+ {
901
+ name: "SIGTERM",
902
+ number: 15,
903
+ action: "terminate",
904
+ description: "Termination",
905
+ standard: "ansi"
906
+ },
907
+ {
908
+ name: "SIGSTKFLT",
909
+ number: 16,
910
+ action: "terminate",
911
+ description: "Stack is empty or overflowed",
912
+ standard: "other"
913
+ },
914
+ {
915
+ name: "SIGCHLD",
916
+ number: 17,
917
+ action: "ignore",
918
+ description: "Child process terminated, paused or unpaused",
919
+ standard: "posix"
920
+ },
921
+ {
922
+ name: "SIGCLD",
923
+ number: 17,
924
+ action: "ignore",
925
+ description: "Child process terminated, paused or unpaused",
926
+ standard: "other"
927
+ },
928
+ {
929
+ name: "SIGCONT",
930
+ number: 18,
931
+ action: "unpause",
932
+ description: "Unpaused",
933
+ standard: "posix",
934
+ forced: true
935
+ },
936
+ {
937
+ name: "SIGSTOP",
938
+ number: 19,
939
+ action: "pause",
940
+ description: "Paused",
941
+ standard: "posix",
942
+ forced: true
943
+ },
944
+ {
945
+ name: "SIGTSTP",
946
+ number: 20,
947
+ action: "pause",
948
+ description: 'Paused using CTRL-Z or "suspend"',
949
+ standard: "posix"
950
+ },
951
+ {
952
+ name: "SIGTTIN",
953
+ number: 21,
954
+ action: "pause",
955
+ description: "Background process cannot read terminal input",
956
+ standard: "posix"
957
+ },
958
+ {
959
+ name: "SIGBREAK",
960
+ number: 21,
961
+ action: "terminate",
962
+ description: "User interruption with CTRL-BREAK",
963
+ standard: "other"
964
+ },
965
+ {
966
+ name: "SIGTTOU",
967
+ number: 22,
968
+ action: "pause",
969
+ description: "Background process cannot write to terminal output",
970
+ standard: "posix"
971
+ },
972
+ {
973
+ name: "SIGURG",
974
+ number: 23,
975
+ action: "ignore",
976
+ description: "Socket received out-of-band data",
977
+ standard: "bsd"
978
+ },
979
+ {
980
+ name: "SIGXCPU",
981
+ number: 24,
982
+ action: "core",
983
+ description: "Process timed out",
984
+ standard: "bsd"
985
+ },
986
+ {
987
+ name: "SIGXFSZ",
988
+ number: 25,
989
+ action: "core",
990
+ description: "File too big",
991
+ standard: "bsd"
992
+ },
993
+ {
994
+ name: "SIGVTALRM",
995
+ number: 26,
996
+ action: "terminate",
997
+ description: "Timeout or timer",
998
+ standard: "bsd"
999
+ },
1000
+ {
1001
+ name: "SIGPROF",
1002
+ number: 27,
1003
+ action: "terminate",
1004
+ description: "Timeout or timer",
1005
+ standard: "bsd"
1006
+ },
1007
+ {
1008
+ name: "SIGWINCH",
1009
+ number: 28,
1010
+ action: "ignore",
1011
+ description: "Terminal window size changed",
1012
+ standard: "bsd"
1013
+ },
1014
+ {
1015
+ name: "SIGIO",
1016
+ number: 29,
1017
+ action: "terminate",
1018
+ description: "I/O is available",
1019
+ standard: "other"
1020
+ },
1021
+ {
1022
+ name: "SIGPOLL",
1023
+ number: 29,
1024
+ action: "terminate",
1025
+ description: "Watched event",
1026
+ standard: "other"
1027
+ },
1028
+ {
1029
+ name: "SIGINFO",
1030
+ number: 29,
1031
+ action: "ignore",
1032
+ description: "Request for process information",
1033
+ standard: "other"
1034
+ },
1035
+ {
1036
+ name: "SIGPWR",
1037
+ number: 30,
1038
+ action: "terminate",
1039
+ description: "Device running out of power",
1040
+ standard: "systemv"
1041
+ },
1042
+ {
1043
+ name: "SIGSYS",
1044
+ number: 31,
1045
+ action: "core",
1046
+ description: "Invalid system call",
1047
+ standard: "other"
1048
+ },
1049
+ {
1050
+ name: "SIGUNUSED",
1051
+ number: 31,
1052
+ action: "terminate",
1053
+ description: "Invalid system call",
1054
+ standard: "other"
1055
+ }
1056
+ ];
1057
+ var getSignals = () => {
1058
+ const realtimeSignals = getRealtimeSignals();
1059
+ const signals2 = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
1060
+ return signals2;
1061
+ };
1062
+ var normalizeSignal = ({
1063
+ name,
1064
+ number: defaultNumber,
1065
+ description,
1066
+ action,
1067
+ forced = false,
1068
+ standard
1069
+ }) => {
1070
+ const {
1071
+ signals: { [name]: constantSignal }
1072
+ } = import_node_os2.constants;
1073
+ const supported = constantSignal !== void 0;
1074
+ const number = supported ? constantSignal : defaultNumber;
1075
+ return { name, number, description, supported, action, forced, standard };
1076
+ };
1077
+ var getSignalsByName = () => {
1078
+ const signals2 = getSignals();
1079
+ return Object.fromEntries(signals2.map(getSignalByName));
1080
+ };
1081
+ var getSignalByName = ({
1082
+ name,
1083
+ number,
1084
+ description,
1085
+ supported,
1086
+ action,
1087
+ forced,
1088
+ standard
1089
+ }) => [name, { name, number, description, supported, action, forced, standard }];
1090
+ var signalsByName = getSignalsByName();
1091
+ var getSignalsByNumber = () => {
1092
+ const signals2 = getSignals();
1093
+ const length = SIGRTMAX + 1;
1094
+ const signalsA = Array.from(
1095
+ { length },
1096
+ (value, number) => getSignalByNumber(number, signals2)
1097
+ );
1098
+ return Object.assign({}, ...signalsA);
1099
+ };
1100
+ var getSignalByNumber = (number, signals2) => {
1101
+ const signal = findSignalByNumber(number, signals2);
1102
+ if (signal === void 0) {
1103
+ return {};
1104
+ }
1105
+ const { name, description, supported, action, forced, standard } = signal;
1106
+ return {
1107
+ [number]: {
1108
+ name,
1109
+ number,
1110
+ description,
1111
+ supported,
1112
+ action,
1113
+ forced,
1114
+ standard
1115
+ }
1116
+ };
1117
+ };
1118
+ var findSignalByNumber = (number, signals2) => {
1119
+ const signal = signals2.find(({ name }) => import_node_os.constants.signals[name] === number);
1120
+ if (signal !== void 0) {
1121
+ return signal;
1122
+ }
1123
+ return signals2.find((signalA) => signalA.number === number);
1124
+ };
1125
+ var signalsByNumber = getSignalsByNumber();
1126
+ var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
1127
+ if (timedOut) {
1128
+ return `timed out after ${timeout} milliseconds`;
1129
+ }
1130
+ if (isCanceled) {
1131
+ return "was canceled";
1132
+ }
1133
+ if (errorCode !== void 0) {
1134
+ return `failed with ${errorCode}`;
1135
+ }
1136
+ if (signal !== void 0) {
1137
+ return `was killed with ${signal} (${signalDescription})`;
1138
+ }
1139
+ if (exitCode !== void 0) {
1140
+ return `failed with exit code ${exitCode}`;
1141
+ }
1142
+ return "failed";
1143
+ };
1144
+ var makeError = ({
1145
+ stdout,
1146
+ stderr,
1147
+ all,
1148
+ error,
1149
+ signal,
1150
+ exitCode,
1151
+ command,
1152
+ escapedCommand,
1153
+ timedOut,
1154
+ isCanceled,
1155
+ killed,
1156
+ parsed: { options: { timeout, cwd = import_node_process3.default.cwd() } }
1157
+ }) => {
1158
+ exitCode = exitCode === null ? void 0 : exitCode;
1159
+ signal = signal === null ? void 0 : signal;
1160
+ const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
1161
+ const errorCode = error && error.code;
1162
+ const prefix = getErrorPrefix({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
1163
+ const execaMessage = `Command ${prefix}: ${command}`;
1164
+ const isError = Object.prototype.toString.call(error) === "[object Error]";
1165
+ const shortMessage = isError ? `${execaMessage}
1166
+ ${error.message}` : execaMessage;
1167
+ const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
1168
+ if (isError) {
1169
+ error.originalMessage = error.message;
1170
+ error.message = message;
1171
+ } else {
1172
+ error = new Error(message);
1173
+ }
1174
+ error.shortMessage = shortMessage;
1175
+ error.command = command;
1176
+ error.escapedCommand = escapedCommand;
1177
+ error.exitCode = exitCode;
1178
+ error.signal = signal;
1179
+ error.signalDescription = signalDescription;
1180
+ error.stdout = stdout;
1181
+ error.stderr = stderr;
1182
+ error.cwd = cwd;
1183
+ if (all !== void 0) {
1184
+ error.all = all;
1185
+ }
1186
+ if ("bufferedData" in error) {
1187
+ delete error.bufferedData;
1188
+ }
1189
+ error.failed = true;
1190
+ error.timedOut = Boolean(timedOut);
1191
+ error.isCanceled = isCanceled;
1192
+ error.killed = killed && !timedOut;
1193
+ return error;
1194
+ };
1195
+ var aliases = ["stdin", "stdout", "stderr"];
1196
+ var hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
1197
+ var normalizeStdio = (options) => {
1198
+ if (!options) {
1199
+ return;
1200
+ }
1201
+ const { stdio } = options;
1202
+ if (stdio === void 0) {
1203
+ return aliases.map((alias) => options[alias]);
1204
+ }
1205
+ if (hasAlias(options)) {
1206
+ throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
1207
+ }
1208
+ if (typeof stdio === "string") {
1209
+ return stdio;
1210
+ }
1211
+ if (!Array.isArray(stdio)) {
1212
+ throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
1213
+ }
1214
+ const length = Math.max(stdio.length, aliases.length);
1215
+ return Array.from({ length }, (value, index) => stdio[index]);
1216
+ };
1217
+ var signals = [];
1218
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
1219
+ if (process.platform !== "win32") {
1220
+ signals.push(
1221
+ "SIGALRM",
1222
+ "SIGABRT",
1223
+ "SIGVTALRM",
1224
+ "SIGXCPU",
1225
+ "SIGXFSZ",
1226
+ "SIGUSR2",
1227
+ "SIGTRAP",
1228
+ "SIGSYS",
1229
+ "SIGQUIT",
1230
+ "SIGIOT"
1231
+ // should detect profiler and enable/disable accordingly.
1232
+ // see #21
1233
+ // 'SIGPROF'
1234
+ );
1235
+ }
1236
+ if (process.platform === "linux") {
1237
+ signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
1238
+ }
1239
+ var processOk = (process7) => !!process7 && typeof process7 === "object" && typeof process7.removeListener === "function" && typeof process7.emit === "function" && typeof process7.reallyExit === "function" && typeof process7.listeners === "function" && typeof process7.kill === "function" && typeof process7.pid === "number" && typeof process7.on === "function";
1240
+ var kExitEmitter = Symbol.for("signal-exit emitter");
1241
+ var global2 = globalThis;
1242
+ var ObjectDefineProperty = Object.defineProperty.bind(Object);
1243
+ var Emitter = class {
1244
+ emitted = {
1245
+ afterExit: false,
1246
+ exit: false
1247
+ };
1248
+ listeners = {
1249
+ afterExit: [],
1250
+ exit: []
1251
+ };
1252
+ count = 0;
1253
+ id = Math.random();
1254
+ constructor() {
1255
+ if (global2[kExitEmitter]) {
1256
+ return global2[kExitEmitter];
1257
+ }
1258
+ ObjectDefineProperty(global2, kExitEmitter, {
1259
+ value: this,
1260
+ writable: false,
1261
+ enumerable: false,
1262
+ configurable: false
1263
+ });
1264
+ }
1265
+ on(ev, fn) {
1266
+ this.listeners[ev].push(fn);
1267
+ }
1268
+ removeListener(ev, fn) {
1269
+ const list = this.listeners[ev];
1270
+ const i = list.indexOf(fn);
1271
+ if (i === -1) {
1272
+ return;
1273
+ }
1274
+ if (i === 0 && list.length === 1) {
1275
+ list.length = 0;
1276
+ } else {
1277
+ list.splice(i, 1);
1278
+ }
1279
+ }
1280
+ emit(ev, code, signal) {
1281
+ if (this.emitted[ev]) {
1282
+ return false;
1283
+ }
1284
+ this.emitted[ev] = true;
1285
+ let ret = false;
1286
+ for (const fn of this.listeners[ev]) {
1287
+ ret = fn(code, signal) === true || ret;
1288
+ }
1289
+ if (ev === "exit") {
1290
+ ret = this.emit("afterExit", code, signal) || ret;
1291
+ }
1292
+ return ret;
1293
+ }
1294
+ };
1295
+ var SignalExitBase = class {
1296
+ };
1297
+ var signalExitWrap = (handler) => {
1298
+ return {
1299
+ onExit(cb, opts) {
1300
+ return handler.onExit(cb, opts);
1301
+ },
1302
+ load() {
1303
+ return handler.load();
1304
+ },
1305
+ unload() {
1306
+ return handler.unload();
1307
+ }
1308
+ };
1309
+ };
1310
+ var SignalExitFallback = class extends SignalExitBase {
1311
+ onExit() {
1312
+ return () => {
1313
+ };
1314
+ }
1315
+ load() {
1316
+ }
1317
+ unload() {
1318
+ }
1319
+ };
1320
+ var SignalExit = class extends SignalExitBase {
1321
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
1322
+ // so use a supported signal instead
1323
+ /* c8 ignore start */
1324
+ #hupSig = process4.platform === "win32" ? "SIGINT" : "SIGHUP";
1325
+ /* c8 ignore stop */
1326
+ #emitter = new Emitter();
1327
+ #process;
1328
+ #originalProcessEmit;
1329
+ #originalProcessReallyExit;
1330
+ #sigListeners = {};
1331
+ #loaded = false;
1332
+ constructor(process7) {
1333
+ super();
1334
+ this.#process = process7;
1335
+ this.#sigListeners = {};
1336
+ for (const sig of signals) {
1337
+ this.#sigListeners[sig] = () => {
1338
+ const listeners = this.#process.listeners(sig);
1339
+ let { count } = this.#emitter;
1340
+ const p = process7;
1341
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
1342
+ count += p.__signal_exit_emitter__.count;
1343
+ }
1344
+ if (listeners.length === count) {
1345
+ this.unload();
1346
+ const ret = this.#emitter.emit("exit", null, sig);
1347
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
1348
+ if (!ret)
1349
+ process7.kill(process7.pid, s);
1350
+ }
1351
+ };
1352
+ }
1353
+ this.#originalProcessReallyExit = process7.reallyExit;
1354
+ this.#originalProcessEmit = process7.emit;
1355
+ }
1356
+ onExit(cb, opts) {
1357
+ if (!processOk(this.#process)) {
1358
+ return () => {
1359
+ };
1360
+ }
1361
+ if (this.#loaded === false) {
1362
+ this.load();
1363
+ }
1364
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
1365
+ this.#emitter.on(ev, cb);
1366
+ return () => {
1367
+ this.#emitter.removeListener(ev, cb);
1368
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
1369
+ this.unload();
1370
+ }
1371
+ };
1372
+ }
1373
+ load() {
1374
+ if (this.#loaded) {
1375
+ return;
1376
+ }
1377
+ this.#loaded = true;
1378
+ this.#emitter.count += 1;
1379
+ for (const sig of signals) {
1380
+ try {
1381
+ const fn = this.#sigListeners[sig];
1382
+ if (fn)
1383
+ this.#process.on(sig, fn);
1384
+ } catch (_) {
1385
+ }
1386
+ }
1387
+ this.#process.emit = (ev, ...a) => {
1388
+ return this.#processEmit(ev, ...a);
1389
+ };
1390
+ this.#process.reallyExit = (code) => {
1391
+ return this.#processReallyExit(code);
1392
+ };
1393
+ }
1394
+ unload() {
1395
+ if (!this.#loaded) {
1396
+ return;
1397
+ }
1398
+ this.#loaded = false;
1399
+ signals.forEach((sig) => {
1400
+ const listener = this.#sigListeners[sig];
1401
+ if (!listener) {
1402
+ throw new Error("Listener not defined for signal: " + sig);
1403
+ }
1404
+ try {
1405
+ this.#process.removeListener(sig, listener);
1406
+ } catch (_) {
1407
+ }
1408
+ });
1409
+ this.#process.emit = this.#originalProcessEmit;
1410
+ this.#process.reallyExit = this.#originalProcessReallyExit;
1411
+ this.#emitter.count -= 1;
1412
+ }
1413
+ #processReallyExit(code) {
1414
+ if (!processOk(this.#process)) {
1415
+ return 0;
1416
+ }
1417
+ this.#process.exitCode = code || 0;
1418
+ this.#emitter.emit("exit", this.#process.exitCode, null);
1419
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
1420
+ }
1421
+ #processEmit(ev, ...args) {
1422
+ const og = this.#originalProcessEmit;
1423
+ if (ev === "exit" && processOk(this.#process)) {
1424
+ if (typeof args[0] === "number") {
1425
+ this.#process.exitCode = args[0];
1426
+ }
1427
+ const ret = og.call(this.#process, ev, ...args);
1428
+ this.#emitter.emit("exit", this.#process.exitCode, null);
1429
+ return ret;
1430
+ } else {
1431
+ return og.call(this.#process, ev, ...args);
1432
+ }
1433
+ }
1434
+ };
1435
+ var process4 = globalThis.process;
1436
+ var {
1437
+ /**
1438
+ * Called when the process is exiting, whether via signal, explicit
1439
+ * exit, or running out of stuff to do.
1440
+ *
1441
+ * If the global process object is not suitable for instrumentation,
1442
+ * then this will be a no-op.
1443
+ *
1444
+ * Returns a function that may be used to unload signal-exit.
1445
+ */
1446
+ onExit,
1447
+ /**
1448
+ * Load the listeners. Likely you never need to call this, unless
1449
+ * doing a rather deep integration with signal-exit functionality.
1450
+ * Mostly exposed for the benefit of testing.
1451
+ *
1452
+ * @internal
1453
+ */
1454
+ load,
1455
+ /**
1456
+ * Unload the listeners. Likely you never need to call this, unless
1457
+ * doing a rather deep integration with signal-exit functionality.
1458
+ * Mostly exposed for the benefit of testing.
1459
+ *
1460
+ * @internal
1461
+ */
1462
+ unload
1463
+ } = signalExitWrap(processOk(process4) ? new SignalExit(process4) : new SignalExitFallback());
1464
+ var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
1465
+ var spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
1466
+ const killResult = kill(signal);
1467
+ setKillTimeout(kill, signal, options, killResult);
1468
+ return killResult;
1469
+ };
1470
+ var setKillTimeout = (kill, signal, options, killResult) => {
1471
+ if (!shouldForceKill(signal, options, killResult)) {
1472
+ return;
1473
+ }
1474
+ const timeout = getForceKillAfterTimeout(options);
1475
+ const t = setTimeout(() => {
1476
+ kill("SIGKILL");
1477
+ }, timeout);
1478
+ if (t.unref) {
1479
+ t.unref();
1480
+ }
1481
+ };
1482
+ var shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
1483
+ var isSigterm = (signal) => signal === import_node_os3.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
1484
+ var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
1485
+ if (forceKillAfterTimeout === true) {
1486
+ return DEFAULT_FORCE_KILL_TIMEOUT;
1487
+ }
1488
+ if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
1489
+ throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
1490
+ }
1491
+ return forceKillAfterTimeout;
1492
+ };
1493
+ var spawnedCancel = (spawned, context) => {
1494
+ const killResult = spawned.kill();
1495
+ if (killResult) {
1496
+ context.isCanceled = true;
1497
+ }
1498
+ };
1499
+ var timeoutKill = (spawned, signal, reject) => {
1500
+ spawned.kill(signal);
1501
+ reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
1502
+ };
1503
+ var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
1504
+ if (timeout === 0 || timeout === void 0) {
1505
+ return spawnedPromise;
1506
+ }
1507
+ let timeoutId;
1508
+ const timeoutPromise = new Promise((resolve, reject) => {
1509
+ timeoutId = setTimeout(() => {
1510
+ timeoutKill(spawned, killSignal, reject);
1511
+ }, timeout);
1512
+ });
1513
+ const safeSpawnedPromise = spawnedPromise.finally(() => {
1514
+ clearTimeout(timeoutId);
1515
+ });
1516
+ return Promise.race([timeoutPromise, safeSpawnedPromise]);
1517
+ };
1518
+ var validateTimeout = ({ timeout }) => {
1519
+ if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
1520
+ throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
1521
+ }
1522
+ };
1523
+ var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
1524
+ if (!cleanup || detached) {
1525
+ return timedPromise;
1526
+ }
1527
+ const removeExitHandler = onExit(() => {
1528
+ spawned.kill();
1529
+ });
1530
+ return timedPromise.finally(() => {
1531
+ removeExitHandler();
1532
+ });
1533
+ };
1534
+ function isStream(stream) {
1535
+ return stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
1536
+ }
1537
+ function isWritableStream(stream) {
1538
+ return isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
1539
+ }
1540
+ var isExecaChildProcess = (target) => target instanceof import_node_child_process2.ChildProcess && typeof target.then === "function";
1541
+ var pipeToTarget = (spawned, streamName, target) => {
1542
+ if (typeof target === "string") {
1543
+ spawned[streamName].pipe((0, import_node_fs2.createWriteStream)(target));
1544
+ return spawned;
1545
+ }
1546
+ if (isWritableStream(target)) {
1547
+ spawned[streamName].pipe(target);
1548
+ return spawned;
1549
+ }
1550
+ if (!isExecaChildProcess(target)) {
1551
+ throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
1552
+ }
1553
+ if (!isWritableStream(target.stdin)) {
1554
+ throw new TypeError("The target child process's stdin must be available.");
1555
+ }
1556
+ spawned[streamName].pipe(target.stdin);
1557
+ return target;
1558
+ };
1559
+ var addPipeMethods = (spawned) => {
1560
+ if (spawned.stdout !== null) {
1561
+ spawned.pipeStdout = pipeToTarget.bind(void 0, spawned, "stdout");
1562
+ }
1563
+ if (spawned.stderr !== null) {
1564
+ spawned.pipeStderr = pipeToTarget.bind(void 0, spawned, "stderr");
1565
+ }
1566
+ if (spawned.all !== void 0) {
1567
+ spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
1568
+ }
1569
+ };
1570
+ var getStreamContents = async (stream, { init, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
1571
+ if (!isAsyncIterable(stream)) {
1572
+ throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");
1573
+ }
1574
+ const state = init();
1575
+ state.length = 0;
1576
+ try {
1577
+ for await (const chunk of stream) {
1578
+ const chunkType = getChunkType(chunk);
1579
+ const convertedChunk = convertChunk[chunkType](chunk, state);
1580
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
1581
+ }
1582
+ appendFinalChunk({ state, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer });
1583
+ return finalize(state);
1584
+ } catch (error) {
1585
+ error.bufferedData = finalize(state);
1586
+ throw error;
1587
+ }
1588
+ };
1589
+ var appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
1590
+ const convertedChunk = getFinalChunk(state);
1591
+ if (convertedChunk !== void 0) {
1592
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
1593
+ }
1594
+ };
1595
+ var appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
1596
+ const chunkSize = getSize(convertedChunk);
1597
+ const newLength = state.length + chunkSize;
1598
+ if (newLength <= maxBuffer) {
1599
+ addNewChunk(convertedChunk, state, addChunk, newLength);
1600
+ return;
1601
+ }
1602
+ const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
1603
+ if (truncatedChunk !== void 0) {
1604
+ addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
1605
+ }
1606
+ throw new MaxBufferError();
1607
+ };
1608
+ var addNewChunk = (convertedChunk, state, addChunk, newLength) => {
1609
+ state.contents = addChunk(convertedChunk, state, newLength);
1610
+ state.length = newLength;
1611
+ };
1612
+ var isAsyncIterable = (stream) => typeof stream === "object" && stream !== null && typeof stream[Symbol.asyncIterator] === "function";
1613
+ var getChunkType = (chunk) => {
1614
+ const typeOfChunk = typeof chunk;
1615
+ if (typeOfChunk === "string") {
1616
+ return "string";
1617
+ }
1618
+ if (typeOfChunk !== "object" || chunk === null) {
1619
+ return "others";
1620
+ }
1621
+ if (globalThis.Buffer?.isBuffer(chunk)) {
1622
+ return "buffer";
1623
+ }
1624
+ const prototypeName = objectToString.call(chunk);
1625
+ if (prototypeName === "[object ArrayBuffer]") {
1626
+ return "arrayBuffer";
1627
+ }
1628
+ if (prototypeName === "[object DataView]") {
1629
+ return "dataView";
1630
+ }
1631
+ if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString.call(chunk.buffer) === "[object ArrayBuffer]") {
1632
+ return "typedArray";
1633
+ }
1634
+ return "others";
1635
+ };
1636
+ var { toString: objectToString } = Object.prototype;
1637
+ var MaxBufferError = class extends Error {
1638
+ name = "MaxBufferError";
1639
+ constructor() {
1640
+ super("maxBuffer exceeded");
1641
+ }
1642
+ };
1643
+ var identity = (value) => value;
1644
+ var noop = () => void 0;
1645
+ var getContentsProp = ({ contents }) => contents;
1646
+ var throwObjectStream = (chunk) => {
1647
+ throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
1648
+ };
1649
+ var getLengthProp = (convertedChunk) => convertedChunk.length;
1650
+ async function getStreamAsArrayBuffer(stream, options) {
1651
+ return getStreamContents(stream, arrayBufferMethods, options);
1652
+ }
1653
+ var initArrayBuffer = () => ({ contents: new ArrayBuffer(0) });
1654
+ var useTextEncoder = (chunk) => textEncoder.encode(chunk);
1655
+ var textEncoder = new TextEncoder();
1656
+ var useUint8Array = (chunk) => new Uint8Array(chunk);
1657
+ var useUint8ArrayWithOffset = (chunk) => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
1658
+ var truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
1659
+ var addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length) => {
1660
+ const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
1661
+ new Uint8Array(newContents).set(convertedChunk, previousLength);
1662
+ return newContents;
1663
+ };
1664
+ var resizeArrayBufferSlow = (contents, length) => {
1665
+ if (length <= contents.byteLength) {
1666
+ return contents;
1667
+ }
1668
+ const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
1669
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
1670
+ return arrayBuffer;
1671
+ };
1672
+ var resizeArrayBuffer = (contents, length) => {
1673
+ if (length <= contents.maxByteLength) {
1674
+ contents.resize(length);
1675
+ return contents;
1676
+ }
1677
+ const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
1678
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
1679
+ return arrayBuffer;
1680
+ };
1681
+ var getNewContentsLength = (length) => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
1682
+ var SCALE_FACTOR = 2;
1683
+ var finalizeArrayBuffer = ({ contents, length }) => hasArrayBufferResize() ? contents : contents.slice(0, length);
1684
+ var hasArrayBufferResize = () => "resize" in ArrayBuffer.prototype;
1685
+ var arrayBufferMethods = {
1686
+ init: initArrayBuffer,
1687
+ convertChunk: {
1688
+ string: useTextEncoder,
1689
+ buffer: useUint8Array,
1690
+ arrayBuffer: useUint8Array,
1691
+ dataView: useUint8ArrayWithOffset,
1692
+ typedArray: useUint8ArrayWithOffset,
1693
+ others: throwObjectStream
1694
+ },
1695
+ getSize: getLengthProp,
1696
+ truncateChunk: truncateArrayBufferChunk,
1697
+ addChunk: addArrayBufferChunk,
1698
+ getFinalChunk: noop,
1699
+ finalize: finalizeArrayBuffer
1700
+ };
1701
+ async function getStreamAsBuffer(stream, options) {
1702
+ if (!("Buffer" in globalThis)) {
1703
+ throw new Error("getStreamAsBuffer() is only supported in Node.js");
1704
+ }
1705
+ try {
1706
+ return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream, options));
1707
+ } catch (error) {
1708
+ if (error.bufferedData !== void 0) {
1709
+ error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
1710
+ }
1711
+ throw error;
1712
+ }
1713
+ }
1714
+ var arrayBufferToNodeBuffer = (arrayBuffer) => globalThis.Buffer.from(arrayBuffer);
1715
+ async function getStreamAsString(stream, options) {
1716
+ return getStreamContents(stream, stringMethods, options);
1717
+ }
1718
+ var initString = () => ({ contents: "", textDecoder: new TextDecoder() });
1719
+ var useTextDecoder = (chunk, { textDecoder }) => textDecoder.decode(chunk, { stream: true });
1720
+ var addStringChunk = (convertedChunk, { contents }) => contents + convertedChunk;
1721
+ var truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
1722
+ var getFinalStringChunk = ({ textDecoder }) => {
1723
+ const finalChunk = textDecoder.decode();
1724
+ return finalChunk === "" ? void 0 : finalChunk;
1725
+ };
1726
+ var stringMethods = {
1727
+ init: initString,
1728
+ convertChunk: {
1729
+ string: identity,
1730
+ buffer: useTextDecoder,
1731
+ arrayBuffer: useTextDecoder,
1732
+ dataView: useTextDecoder,
1733
+ typedArray: useTextDecoder,
1734
+ others: throwObjectStream
1735
+ },
1736
+ getSize: getLengthProp,
1737
+ truncateChunk: truncateStringChunk,
1738
+ addChunk: addStringChunk,
1739
+ getFinalChunk: getFinalStringChunk,
1740
+ finalize: getContentsProp
1741
+ };
1742
+ var import_merge_stream = (0, import_chunk_QGM4M3NI.__toESM)(require_merge_stream(), 1);
1743
+ var validateInputOptions = (input) => {
1744
+ if (input !== void 0) {
1745
+ throw new TypeError("The `input` and `inputFile` options cannot be both set.");
1746
+ }
1747
+ };
1748
+ var getInputSync = ({ input, inputFile }) => {
1749
+ if (typeof inputFile !== "string") {
1750
+ return input;
1751
+ }
1752
+ validateInputOptions(input);
1753
+ return (0, import_node_fs3.readFileSync)(inputFile);
1754
+ };
1755
+ var handleInputSync = (options) => {
1756
+ const input = getInputSync(options);
1757
+ if (isStream(input)) {
1758
+ throw new TypeError("The `input` option cannot be a stream in sync mode");
1759
+ }
1760
+ return input;
1761
+ };
1762
+ var getInput = ({ input, inputFile }) => {
1763
+ if (typeof inputFile !== "string") {
1764
+ return input;
1765
+ }
1766
+ validateInputOptions(input);
1767
+ return (0, import_node_fs3.createReadStream)(inputFile);
1768
+ };
1769
+ var handleInput = (spawned, options) => {
1770
+ const input = getInput(options);
1771
+ if (input === void 0) {
1772
+ return;
1773
+ }
1774
+ if (isStream(input)) {
1775
+ input.pipe(spawned.stdin);
1776
+ } else {
1777
+ spawned.stdin.end(input);
1778
+ }
1779
+ };
1780
+ var makeAllStream = (spawned, { all }) => {
1781
+ if (!all || !spawned.stdout && !spawned.stderr) {
1782
+ return;
1783
+ }
1784
+ const mixed = (0, import_merge_stream.default)();
1785
+ if (spawned.stdout) {
1786
+ mixed.add(spawned.stdout);
1787
+ }
1788
+ if (spawned.stderr) {
1789
+ mixed.add(spawned.stderr);
1790
+ }
1791
+ return mixed;
1792
+ };
1793
+ var getBufferedData = async (stream, streamPromise) => {
1794
+ if (!stream || streamPromise === void 0) {
1795
+ return;
1796
+ }
1797
+ await (0, import_promises.setTimeout)(0);
1798
+ stream.destroy();
1799
+ try {
1800
+ return await streamPromise;
1801
+ } catch (error) {
1802
+ return error.bufferedData;
1803
+ }
1804
+ };
1805
+ var getStreamPromise = (stream, { encoding, buffer, maxBuffer }) => {
1806
+ if (!stream || !buffer) {
1807
+ return;
1808
+ }
1809
+ if (encoding === "utf8" || encoding === "utf-8") {
1810
+ return getStreamAsString(stream, { maxBuffer });
1811
+ }
1812
+ if (encoding === null || encoding === "buffer") {
1813
+ return getStreamAsBuffer(stream, { maxBuffer });
1814
+ }
1815
+ return applyEncoding(stream, maxBuffer, encoding);
1816
+ };
1817
+ var applyEncoding = async (stream, maxBuffer, encoding) => {
1818
+ const buffer = await getStreamAsBuffer(stream, { maxBuffer });
1819
+ return buffer.toString(encoding);
1820
+ };
1821
+ var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
1822
+ const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
1823
+ const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
1824
+ const allPromise = getStreamPromise(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
1825
+ try {
1826
+ return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
1827
+ } catch (error) {
1828
+ return Promise.all([
1829
+ { error, signal: error.signal, timedOut: error.timedOut },
1830
+ getBufferedData(stdout, stdoutPromise),
1831
+ getBufferedData(stderr, stderrPromise),
1832
+ getBufferedData(all, allPromise)
1833
+ ]);
1834
+ }
1835
+ };
1836
+ var nativePromisePrototype = (async () => {
1837
+ })().constructor.prototype;
1838
+ var descriptors = ["then", "catch", "finally"].map((property) => [
1839
+ property,
1840
+ Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
1841
+ ]);
1842
+ var mergePromise = (spawned, promise) => {
1843
+ for (const [property, descriptor] of descriptors) {
1844
+ const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
1845
+ Reflect.defineProperty(spawned, property, { ...descriptor, value });
1846
+ }
1847
+ };
1848
+ var getSpawnedPromise = (spawned) => new Promise((resolve, reject) => {
1849
+ spawned.on("exit", (exitCode, signal) => {
1850
+ resolve({ exitCode, signal });
1851
+ });
1852
+ spawned.on("error", (error) => {
1853
+ reject(error);
1854
+ });
1855
+ if (spawned.stdin) {
1856
+ spawned.stdin.on("error", (error) => {
1857
+ reject(error);
1858
+ });
1859
+ }
1860
+ });
1861
+ var normalizeArgs = (file, args = []) => {
1862
+ if (!Array.isArray(args)) {
1863
+ return [file];
1864
+ }
1865
+ return [file, ...args];
1866
+ };
1867
+ var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
1868
+ var escapeArg = (arg) => {
1869
+ if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
1870
+ return arg;
1871
+ }
1872
+ return `"${arg.replaceAll('"', '\\"')}"`;
1873
+ };
1874
+ var joinCommand = (file, args) => normalizeArgs(file, args).join(" ");
1875
+ var getEscapedCommand = (file, args) => normalizeArgs(file, args).map((arg) => escapeArg(arg)).join(" ");
1876
+ var SPACES_REGEXP = / +/g;
1877
+ var parseExpression = (expression) => {
1878
+ const typeOfExpression = typeof expression;
1879
+ if (typeOfExpression === "string") {
1880
+ return expression;
1881
+ }
1882
+ if (typeOfExpression === "number") {
1883
+ return String(expression);
1884
+ }
1885
+ if (typeOfExpression === "object" && expression !== null && !(expression instanceof import_node_child_process3.ChildProcess) && "stdout" in expression) {
1886
+ const typeOfStdout = typeof expression.stdout;
1887
+ if (typeOfStdout === "string") {
1888
+ return expression.stdout;
1889
+ }
1890
+ if (import_node_buffer2.Buffer.isBuffer(expression.stdout)) {
1891
+ return expression.stdout.toString();
1892
+ }
1893
+ throw new TypeError(`Unexpected "${typeOfStdout}" stdout in template expression`);
1894
+ }
1895
+ throw new TypeError(`Unexpected "${typeOfExpression}" in template expression`);
1896
+ };
1897
+ var concatTokens = (tokens, nextTokens, isNew) => isNew || tokens.length === 0 || nextTokens.length === 0 ? [...tokens, ...nextTokens] : [
1898
+ ...tokens.slice(0, -1),
1899
+ `${tokens.at(-1)}${nextTokens[0]}`,
1900
+ ...nextTokens.slice(1)
1901
+ ];
1902
+ var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
1903
+ const templateString = template ?? templates.raw[index];
1904
+ const templateTokens = templateString.split(SPACES_REGEXP).filter(Boolean);
1905
+ const newTokens = concatTokens(
1906
+ tokens,
1907
+ templateTokens,
1908
+ templateString.startsWith(" ")
1909
+ );
1910
+ if (index === expressions.length) {
1911
+ return newTokens;
1912
+ }
1913
+ const expression = expressions[index];
1914
+ const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
1915
+ return concatTokens(
1916
+ newTokens,
1917
+ expressionTokens,
1918
+ templateString.endsWith(" ")
1919
+ );
1920
+ };
1921
+ var parseTemplates = (templates, expressions) => {
1922
+ let tokens = [];
1923
+ for (const [index, template] of templates.entries()) {
1924
+ tokens = parseTemplate({ templates, expressions, tokens, index, template });
1925
+ }
1926
+ return tokens;
1927
+ };
1928
+ var verboseDefault = (0, import_node_util2.debuglog)("execa").enabled;
1929
+ var padField = (field, padding) => String(field).padStart(padding, "0");
1930
+ var getTimestamp = () => {
1931
+ const date = /* @__PURE__ */ new Date();
1932
+ return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
1933
+ };
1934
+ var logCommand = (escapedCommand, { verbose }) => {
1935
+ if (!verbose) {
1936
+ return;
1937
+ }
1938
+ import_node_process4.default.stderr.write(`[${getTimestamp()}] ${escapedCommand}
1939
+ `);
1940
+ };
1941
+ var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
1942
+ var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
1943
+ const env = extendEnv ? { ...import_node_process.default.env, ...envOption } : envOption;
1944
+ if (preferLocal) {
1945
+ return npmRunPathEnv({ env, cwd: localDir, execPath });
1946
+ }
1947
+ return env;
1948
+ };
1949
+ var handleArguments = (file, args, options = {}) => {
1950
+ const parsed = import_cross_spawn.default._parse(file, args, options);
1951
+ file = parsed.command;
1952
+ args = parsed.args;
1953
+ options = parsed.options;
1954
+ options = {
1955
+ maxBuffer: DEFAULT_MAX_BUFFER,
1956
+ buffer: true,
1957
+ stripFinalNewline: true,
1958
+ extendEnv: true,
1959
+ preferLocal: false,
1960
+ localDir: options.cwd || import_node_process.default.cwd(),
1961
+ execPath: import_node_process.default.execPath,
1962
+ encoding: "utf8",
1963
+ reject: true,
1964
+ cleanup: true,
1965
+ all: false,
1966
+ windowsHide: true,
1967
+ verbose: verboseDefault,
1968
+ ...options
1969
+ };
1970
+ options.env = getEnv(options);
1971
+ options.stdio = normalizeStdio(options);
1972
+ if (import_node_process.default.platform === "win32" && import_node_path2.default.basename(file, ".exe") === "cmd") {
1973
+ args.unshift("/q");
1974
+ }
1975
+ return { file, args, options, parsed };
1976
+ };
1977
+ var handleOutput = (options, value, error) => {
1978
+ if (typeof value !== "string" && !import_node_buffer.Buffer.isBuffer(value)) {
1979
+ return error === void 0 ? void 0 : "";
1980
+ }
1981
+ if (options.stripFinalNewline) {
1982
+ return stripFinalNewline(value);
1983
+ }
1984
+ return value;
1985
+ };
1986
+ function execa(file, args, options) {
1987
+ const parsed = handleArguments(file, args, options);
1988
+ const command = joinCommand(file, args);
1989
+ const escapedCommand = getEscapedCommand(file, args);
1990
+ logCommand(escapedCommand, parsed.options);
1991
+ validateTimeout(parsed.options);
1992
+ let spawned;
1993
+ try {
1994
+ spawned = import_node_child_process.default.spawn(parsed.file, parsed.args, parsed.options);
1995
+ } catch (error) {
1996
+ const dummySpawned = new import_node_child_process.default.ChildProcess();
1997
+ const errorPromise = Promise.reject(makeError({
1998
+ error,
1999
+ stdout: "",
2000
+ stderr: "",
2001
+ all: "",
2002
+ command,
2003
+ escapedCommand,
2004
+ parsed,
2005
+ timedOut: false,
2006
+ isCanceled: false,
2007
+ killed: false
2008
+ }));
2009
+ mergePromise(dummySpawned, errorPromise);
2010
+ return dummySpawned;
2011
+ }
2012
+ const spawnedPromise = getSpawnedPromise(spawned);
2013
+ const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
2014
+ const processDone = setExitHandler(spawned, parsed.options, timedPromise);
2015
+ const context = { isCanceled: false };
2016
+ spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
2017
+ spawned.cancel = spawnedCancel.bind(null, spawned, context);
2018
+ const handlePromise = async () => {
2019
+ const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
2020
+ const stdout = handleOutput(parsed.options, stdoutResult);
2021
+ const stderr = handleOutput(parsed.options, stderrResult);
2022
+ const all = handleOutput(parsed.options, allResult);
2023
+ if (error || exitCode !== 0 || signal !== null) {
2024
+ const returnedError = makeError({
2025
+ error,
2026
+ exitCode,
2027
+ signal,
2028
+ stdout,
2029
+ stderr,
2030
+ all,
2031
+ command,
2032
+ escapedCommand,
2033
+ parsed,
2034
+ timedOut,
2035
+ isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
2036
+ killed: spawned.killed
2037
+ });
2038
+ if (!parsed.options.reject) {
2039
+ return returnedError;
2040
+ }
2041
+ throw returnedError;
2042
+ }
2043
+ return {
2044
+ command,
2045
+ escapedCommand,
2046
+ exitCode: 0,
2047
+ stdout,
2048
+ stderr,
2049
+ all,
2050
+ failed: false,
2051
+ timedOut: false,
2052
+ isCanceled: false,
2053
+ killed: false
2054
+ };
2055
+ };
2056
+ const handlePromiseOnce = onetime_default(handlePromise);
2057
+ handleInput(spawned, parsed.options);
2058
+ spawned.all = makeAllStream(spawned, parsed.options);
2059
+ addPipeMethods(spawned);
2060
+ mergePromise(spawned, handlePromiseOnce);
2061
+ return spawned;
2062
+ }
2063
+ function execaSync(file, args, options) {
2064
+ const parsed = handleArguments(file, args, options);
2065
+ const command = joinCommand(file, args);
2066
+ const escapedCommand = getEscapedCommand(file, args);
2067
+ logCommand(escapedCommand, parsed.options);
2068
+ const input = handleInputSync(parsed.options);
2069
+ let result;
2070
+ try {
2071
+ result = import_node_child_process.default.spawnSync(parsed.file, parsed.args, { ...parsed.options, input });
2072
+ } catch (error) {
2073
+ throw makeError({
2074
+ error,
2075
+ stdout: "",
2076
+ stderr: "",
2077
+ all: "",
2078
+ command,
2079
+ escapedCommand,
2080
+ parsed,
2081
+ timedOut: false,
2082
+ isCanceled: false,
2083
+ killed: false
2084
+ });
2085
+ }
2086
+ const stdout = handleOutput(parsed.options, result.stdout, result.error);
2087
+ const stderr = handleOutput(parsed.options, result.stderr, result.error);
2088
+ if (result.error || result.status !== 0 || result.signal !== null) {
2089
+ const error = makeError({
2090
+ stdout,
2091
+ stderr,
2092
+ error: result.error,
2093
+ signal: result.signal,
2094
+ exitCode: result.status,
2095
+ command,
2096
+ escapedCommand,
2097
+ parsed,
2098
+ timedOut: result.error && result.error.code === "ETIMEDOUT",
2099
+ isCanceled: false,
2100
+ killed: result.signal !== null
2101
+ });
2102
+ if (!parsed.options.reject) {
2103
+ return error;
2104
+ }
2105
+ throw error;
2106
+ }
2107
+ return {
2108
+ command,
2109
+ escapedCommand,
2110
+ exitCode: 0,
2111
+ stdout,
2112
+ stderr,
2113
+ failed: false,
2114
+ timedOut: false,
2115
+ isCanceled: false,
2116
+ killed: false
2117
+ };
2118
+ }
2119
+ var normalizeScriptStdin = ({ input, inputFile, stdio }) => input === void 0 && inputFile === void 0 && stdio === void 0 ? { stdin: "inherit" } : {};
2120
+ var normalizeScriptOptions = (options = {}) => ({
2121
+ preferLocal: true,
2122
+ ...normalizeScriptStdin(options),
2123
+ ...options
2124
+ });
2125
+ function create$(options) {
2126
+ function $2(templatesOrOptions, ...expressions) {
2127
+ if (!Array.isArray(templatesOrOptions)) {
2128
+ return create$({ ...options, ...templatesOrOptions });
2129
+ }
2130
+ const [file, ...args] = parseTemplates(templatesOrOptions, expressions);
2131
+ return execa(file, args, normalizeScriptOptions(options));
2132
+ }
2133
+ $2.sync = (templates, ...expressions) => {
2134
+ if (!Array.isArray(templates)) {
2135
+ throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");
2136
+ }
2137
+ const [file, ...args] = parseTemplates(templates, expressions);
2138
+ return execaSync(file, args, normalizeScriptOptions(options));
2139
+ };
2140
+ return $2;
2141
+ }
2142
+ var $ = create$();
2143
+ var import_fs_extra = (0, import_chunk_QGM4M3NI.__toESM)((0, import_chunk_LONQL55G.require_lib)());
2144
+ async function pMap(iterable, mapper, {
2145
+ concurrency = Number.POSITIVE_INFINITY,
2146
+ stopOnError = true,
2147
+ signal
2148
+ } = {}) {
2149
+ return new Promise((resolve_, reject_) => {
2150
+ if (iterable[Symbol.iterator] === void 0 && iterable[Symbol.asyncIterator] === void 0) {
2151
+ throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`);
2152
+ }
2153
+ if (typeof mapper !== "function") {
2154
+ throw new TypeError("Mapper function is required");
2155
+ }
2156
+ if (!(Number.isSafeInteger(concurrency) && concurrency >= 1 || concurrency === Number.POSITIVE_INFINITY)) {
2157
+ throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
2158
+ }
2159
+ const result = [];
2160
+ const errors = [];
2161
+ const skippedIndexesMap = /* @__PURE__ */ new Map();
2162
+ let isRejected = false;
2163
+ let isResolved = false;
2164
+ let isIterableDone = false;
2165
+ let resolvingCount = 0;
2166
+ let currentIndex = 0;
2167
+ const iterator = iterable[Symbol.iterator] === void 0 ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator]();
2168
+ const signalListener = () => {
2169
+ reject(signal.reason);
2170
+ };
2171
+ const cleanup = () => {
2172
+ signal?.removeEventListener("abort", signalListener);
2173
+ };
2174
+ const resolve = (value) => {
2175
+ resolve_(value);
2176
+ cleanup();
2177
+ };
2178
+ const reject = (reason) => {
2179
+ isRejected = true;
2180
+ isResolved = true;
2181
+ reject_(reason);
2182
+ cleanup();
2183
+ };
2184
+ if (signal) {
2185
+ if (signal.aborted) {
2186
+ reject(signal.reason);
2187
+ }
2188
+ signal.addEventListener("abort", signalListener, { once: true });
2189
+ }
2190
+ const next = async () => {
2191
+ if (isResolved) {
2192
+ return;
2193
+ }
2194
+ const nextItem = await iterator.next();
2195
+ const index = currentIndex;
2196
+ currentIndex++;
2197
+ if (nextItem.done) {
2198
+ isIterableDone = true;
2199
+ if (resolvingCount === 0 && !isResolved) {
2200
+ if (!stopOnError && errors.length > 0) {
2201
+ reject(new AggregateError(errors));
2202
+ return;
2203
+ }
2204
+ isResolved = true;
2205
+ if (skippedIndexesMap.size === 0) {
2206
+ resolve(result);
2207
+ return;
2208
+ }
2209
+ const pureResult = [];
2210
+ for (const [index2, value] of result.entries()) {
2211
+ if (skippedIndexesMap.get(index2) === pMapSkip) {
2212
+ continue;
2213
+ }
2214
+ pureResult.push(value);
2215
+ }
2216
+ resolve(pureResult);
2217
+ }
2218
+ return;
2219
+ }
2220
+ resolvingCount++;
2221
+ (async () => {
2222
+ try {
2223
+ const element = await nextItem.value;
2224
+ if (isResolved) {
2225
+ return;
2226
+ }
2227
+ const value = await mapper(element, index);
2228
+ if (value === pMapSkip) {
2229
+ skippedIndexesMap.set(index, value);
2230
+ }
2231
+ result[index] = value;
2232
+ resolvingCount--;
2233
+ await next();
2234
+ } catch (error) {
2235
+ if (stopOnError) {
2236
+ reject(error);
2237
+ } else {
2238
+ errors.push(error);
2239
+ resolvingCount--;
2240
+ try {
2241
+ await next();
2242
+ } catch (error2) {
2243
+ reject(error2);
2244
+ }
2245
+ }
2246
+ }
2247
+ })();
2248
+ };
2249
+ (async () => {
2250
+ for (let index = 0; index < concurrency; index++) {
2251
+ try {
2252
+ await next();
2253
+ } catch (error) {
2254
+ reject(error);
2255
+ break;
2256
+ }
2257
+ if (isIterableDone || isRejected) {
2258
+ break;
2259
+ }
2260
+ }
2261
+ })();
2262
+ });
2263
+ }
2264
+ var pMapSkip = Symbol("skip");
2265
+ async function pFilter(iterable, filterer, options) {
2266
+ const values = await pMap(
2267
+ iterable,
2268
+ (element, index) => Promise.all([filterer(element, index), element]),
2269
+ options
2270
+ );
2271
+ return values.filter((value) => Boolean(value[0])).map((value) => value[1]);
2272
+ }
2273
+ var import_temp_dir = (0, import_chunk_QGM4M3NI.__toESM)((0, import_chunk_CY52DY2B.require_temp_dir)());
2274
+ var { enginesOverride } = require_package();
2275
+ var debug = (0, import_debug.default)("prisma:fetch-engine:download");
2276
+ var exists = (0, import_node_util.promisify)(import_node_fs.default.exists);
2277
+ var channel = "master";
2278
+ var vercelPkgPathRegex = /^((\w:[\\\/])|\/)snapshot[\/\\]/;
2279
+ async function download(options) {
2280
+ if (!options.binaries || Object.values(options.binaries).length === 0) {
2281
+ return {};
2282
+ }
2283
+ if (enginesOverride?.["branch"] || enginesOverride?.["folder"]) {
2284
+ options.version = "_local_";
2285
+ options.skipCacheIntegrityCheck = true;
2286
+ }
2287
+ const { binaryTarget, ...os2 } = await (0, import_get_platform.getPlatformInfo)();
2288
+ if (os2.targetDistro && ["nixos"].includes(os2.targetDistro) && !(0, import_chunk_QFA3XBMW.allEngineEnvVarsSet)(Object.keys(options.binaries))) {
2289
+ console.error(
2290
+ `${(0, import_chunk_QFA3XBMW.yellow)("Warning")} Precompiled engine files are not available for ${os2.targetDistro}, please provide the paths via environment variables, see https://pris.ly/d/custom-engines`
2291
+ );
2292
+ } else if (["freebsd11", "freebsd12", "freebsd13", "freebsd14", "freebsd15", "openbsd", "netbsd"].includes(binaryTarget)) {
2293
+ console.error(
2294
+ `${(0, import_chunk_QFA3XBMW.yellow)(
2295
+ "Warning"
2296
+ )} Precompiled engine files are not available for ${binaryTarget}. Read more about building your own engines at https://pris.ly/d/build-engines`
2297
+ );
2298
+ } else if ("libquery-engine" in options.binaries) {
2299
+ (0, import_get_platform.assertNodeAPISupported)();
2300
+ }
2301
+ const opts = {
2302
+ ...options,
2303
+ binaryTargets: options.binaryTargets ?? [binaryTarget],
2304
+ version: options.version ?? "latest",
2305
+ binaries: options.binaries
2306
+ };
2307
+ const binaryJobs = Object.entries(opts.binaries).flatMap(
2308
+ ([binaryName, targetFolder]) => opts.binaryTargets.map((binaryTarget2) => {
2309
+ const fileName = getBinaryName(binaryName, binaryTarget2);
2310
+ const targetFilePath = import_node_path.default.join(targetFolder, fileName);
2311
+ return {
2312
+ binaryName,
2313
+ targetFolder,
2314
+ binaryTarget: binaryTarget2,
2315
+ fileName,
2316
+ targetFilePath,
2317
+ envVarPath: (0, import_chunk_QFA3XBMW.getBinaryEnvVarPath)(binaryName)?.path,
2318
+ skipCacheIntegrityCheck: !!opts.skipCacheIntegrityCheck
2319
+ };
2320
+ })
2321
+ );
2322
+ if (process.env.BINARY_DOWNLOAD_VERSION) {
2323
+ debug(`process.env.BINARY_DOWNLOAD_VERSION is set to "${process.env.BINARY_DOWNLOAD_VERSION}"`);
2324
+ opts.version = process.env.BINARY_DOWNLOAD_VERSION;
2325
+ }
2326
+ if (opts.printVersion) {
2327
+ console.log(`version: ${opts.version}`);
2328
+ }
2329
+ const binariesToDownload = await pFilter(binaryJobs, async (job) => {
2330
+ const needsToBeDownloaded = await binaryNeedsToBeDownloaded(job, binaryTarget, opts.version);
2331
+ const isSupported = import_get_platform.binaryTargets.includes(job.binaryTarget);
2332
+ const shouldDownload = isSupported && !job.envVarPath && // this is for custom binaries
2333
+ needsToBeDownloaded;
2334
+ if (needsToBeDownloaded && !isSupported) {
2335
+ throw new Error(`Unknown binaryTarget ${job.binaryTarget} and no custom engine files were provided`);
2336
+ }
2337
+ return shouldDownload;
2338
+ });
2339
+ if (binariesToDownload.length > 0) {
2340
+ const cleanupPromise = (0, import_chunk_3VVCXIQ5.cleanupCache)();
2341
+ let finishBar;
2342
+ let setProgress;
2343
+ if (opts.showProgress) {
2344
+ const collectiveBar = getCollectiveBar(opts);
2345
+ finishBar = collectiveBar.finishBar;
2346
+ setProgress = collectiveBar.setProgress;
2347
+ }
2348
+ const promises = binariesToDownload.map((job) => {
2349
+ const downloadUrl = (0, import_chunk_LONQL55G.getDownloadUrl)({
2350
+ channel: "all_commits",
2351
+ version: opts.version,
2352
+ binaryTarget: job.binaryTarget,
2353
+ binaryName: job.binaryName
2354
+ });
2355
+ debug(`${downloadUrl} will be downloaded to ${job.targetFilePath}`);
2356
+ return downloadBinary({
2357
+ ...job,
2358
+ downloadUrl,
2359
+ version: opts.version,
2360
+ failSilent: opts.failSilent,
2361
+ progressCb: setProgress ? setProgress(job.targetFilePath) : void 0
2362
+ });
2363
+ });
2364
+ await Promise.all(promises);
2365
+ await cleanupPromise;
2366
+ if (finishBar) {
2367
+ finishBar();
2368
+ }
2369
+ }
2370
+ const binaryPaths = binaryJobsToBinaryPaths(binaryJobs);
2371
+ if (__dirname.match(vercelPkgPathRegex)) {
2372
+ for (const engineType in binaryPaths) {
2373
+ const binaryTargets2 = binaryPaths[engineType];
2374
+ for (const binaryTarget2 in binaryTargets2) {
2375
+ const binaryPath = binaryTargets2[binaryTarget2];
2376
+ binaryTargets2[binaryTarget2] = await maybeCopyToTmp(binaryPath);
2377
+ }
2378
+ }
2379
+ }
2380
+ return binaryPaths;
2381
+ }
2382
+ function getCollectiveBar(options) {
2383
+ const hasNodeAPI = "libquery-engine" in options.binaries;
2384
+ const bar = (0, import_chunk_MWVY55RY.getBar)(
2385
+ `Downloading Prisma engines${hasNodeAPI ? " for Node-API" : ""} for ${options.binaryTargets?.map((p) => (0, import_chunk_QFA3XBMW.bold)(p)).join(" and ")}`
2386
+ );
2387
+ const progressMap = {};
2388
+ const numDownloads = Object.values(options.binaries).length * Object.values(options?.binaryTargets ?? []).length;
2389
+ const setProgress = (sourcePath) => (progress) => {
2390
+ progressMap[sourcePath] = progress;
2391
+ const progressValues = Object.values(progressMap);
2392
+ const totalProgress = progressValues.reduce((acc, curr) => {
2393
+ return acc + curr;
2394
+ }, 0) / numDownloads;
2395
+ if (options.progressCb) {
2396
+ options.progressCb(totalProgress);
2397
+ }
2398
+ if (bar) {
2399
+ bar.update(totalProgress);
2400
+ }
2401
+ };
2402
+ return {
2403
+ setProgress,
2404
+ finishBar: () => {
2405
+ bar.update(1);
2406
+ bar.terminate();
2407
+ }
2408
+ };
2409
+ }
2410
+ function binaryJobsToBinaryPaths(jobs) {
2411
+ return jobs.reduce((acc, job) => {
2412
+ if (!acc[job.binaryName]) {
2413
+ acc[job.binaryName] = {};
2414
+ }
2415
+ acc[job.binaryName][job.binaryTarget] = job.envVarPath || job.targetFilePath;
2416
+ return acc;
2417
+ }, {});
2418
+ }
2419
+ async function binaryNeedsToBeDownloaded(job, nativePlatform, version) {
2420
+ if (job.envVarPath && import_node_fs.default.existsSync(job.envVarPath)) {
2421
+ return false;
2422
+ }
2423
+ const targetExists = await exists(job.targetFilePath);
2424
+ const cachedFile = await getCachedBinaryPath({
2425
+ ...job,
2426
+ version
2427
+ });
2428
+ if (cachedFile) {
2429
+ if (job.skipCacheIntegrityCheck === true) {
2430
+ await (0, import_chunk_LONQL55G.overwriteFile)(cachedFile, job.targetFilePath);
2431
+ return false;
2432
+ }
2433
+ const sha256FilePath = cachedFile + ".sha256";
2434
+ if (await exists(sha256FilePath)) {
2435
+ const sha256File = await import_node_fs.default.promises.readFile(sha256FilePath, "utf-8");
2436
+ const sha256Cache = await (0, import_chunk_FKGWOTGU.getHash)(cachedFile);
2437
+ if (sha256File === sha256Cache) {
2438
+ if (!targetExists) {
2439
+ debug(`copying ${cachedFile} to ${job.targetFilePath}`);
2440
+ await import_node_fs.default.promises.utimes(cachedFile, /* @__PURE__ */ new Date(), /* @__PURE__ */ new Date());
2441
+ await (0, import_chunk_LONQL55G.overwriteFile)(cachedFile, job.targetFilePath);
2442
+ }
2443
+ const targetSha256 = await (0, import_chunk_FKGWOTGU.getHash)(job.targetFilePath);
2444
+ if (sha256File !== targetSha256) {
2445
+ debug(`overwriting ${job.targetFilePath} with ${cachedFile} as hashes do not match`);
2446
+ await (0, import_chunk_LONQL55G.overwriteFile)(cachedFile, job.targetFilePath);
2447
+ }
2448
+ return false;
2449
+ } else {
2450
+ return true;
2451
+ }
2452
+ } else if (process.env.PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING) {
2453
+ debug(
2454
+ `the checksum file ${sha256FilePath} is missing but this was ignored because the PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING environment variable is set`
2455
+ );
2456
+ if (targetExists) {
2457
+ return false;
2458
+ }
2459
+ if (cachedFile) {
2460
+ debug(`copying ${cachedFile} to ${job.targetFilePath}`);
2461
+ await (0, import_chunk_LONQL55G.overwriteFile)(cachedFile, job.targetFilePath);
2462
+ return false;
2463
+ }
2464
+ return true;
2465
+ } else {
2466
+ return true;
2467
+ }
2468
+ }
2469
+ if (!targetExists) {
2470
+ debug(`file ${job.targetFilePath} does not exist and must be downloaded`);
2471
+ return true;
2472
+ }
2473
+ if (job.binaryTarget === nativePlatform) {
2474
+ const currentVersion = await getVersion(job.targetFilePath, job.binaryName);
2475
+ if (currentVersion?.includes(version) !== true) {
2476
+ debug(`file ${job.targetFilePath} exists but its version is ${currentVersion} and we expect ${version}`);
2477
+ return true;
2478
+ }
2479
+ }
2480
+ return false;
2481
+ }
2482
+ async function getVersion(enginePath, binaryName) {
2483
+ try {
2484
+ if (binaryName === "libquery-engine") {
2485
+ (0, import_get_platform.assertNodeAPISupported)();
2486
+ const commitHash = (0, import_chunk_QGM4M3NI.__require)(enginePath).version().commit;
2487
+ return `${"libquery-engine"} ${commitHash}`;
2488
+ } else {
2489
+ const result = await execa(enginePath, ["--version"]);
2490
+ return result.stdout;
2491
+ }
2492
+ } catch {
2493
+ }
2494
+ return void 0;
2495
+ }
2496
+ function getBinaryName(binaryName, binaryTarget) {
2497
+ if (binaryName === "libquery-engine") {
2498
+ return `${(0, import_get_platform.getNodeAPIName)(binaryTarget, "fs")}`;
2499
+ }
2500
+ const extension = binaryTarget === "windows" ? ".exe" : "";
2501
+ return `${binaryName}-${binaryTarget}${extension}`;
2502
+ }
2503
+ async function getCachedBinaryPath({
2504
+ version,
2505
+ binaryTarget,
2506
+ binaryName
2507
+ }) {
2508
+ const cacheDir = await (0, import_chunk_LONQL55G.getCacheDir)(channel, version, binaryTarget);
2509
+ if (!cacheDir) {
2510
+ return null;
2511
+ }
2512
+ const cachedTargetPath = import_node_path.default.join(cacheDir, binaryName);
2513
+ if (!import_node_fs.default.existsSync(cachedTargetPath)) {
2514
+ return null;
2515
+ }
2516
+ if (version !== "latest") {
2517
+ return cachedTargetPath;
2518
+ }
2519
+ if (await exists(cachedTargetPath)) {
2520
+ return cachedTargetPath;
2521
+ }
2522
+ return null;
2523
+ }
2524
+ async function downloadBinary(options) {
2525
+ const { version, progressCb, targetFilePath, downloadUrl } = options;
2526
+ const targetDir = import_node_path.default.dirname(targetFilePath);
2527
+ try {
2528
+ import_node_fs.default.accessSync(targetDir, import_node_fs.default.constants.W_OK);
2529
+ await (0, import_fs_extra.ensureDir)(targetDir);
2530
+ } catch (e) {
2531
+ if (options.failSilent || e.code !== "EACCES") {
2532
+ return;
2533
+ } else {
2534
+ throw new Error(`Can't write to ${targetDir} please make sure you install "prisma" with the right permissions.`);
2535
+ }
2536
+ }
2537
+ debug(`Downloading ${downloadUrl} to ${targetFilePath} ...`);
2538
+ if (progressCb) {
2539
+ progressCb(0);
2540
+ }
2541
+ const { sha256, zippedSha256 } = await (0, import_chunk_CY52DY2B.downloadZip)(downloadUrl, targetFilePath, progressCb);
2542
+ if (progressCb) {
2543
+ progressCb(1);
2544
+ }
2545
+ (0, import_chunk_7JLQJWOR.chmodPlusX)(targetFilePath);
2546
+ await saveFileToCache(options, version, sha256, zippedSha256);
2547
+ }
2548
+ async function saveFileToCache(job, version, sha256, zippedSha256) {
2549
+ const cacheDir = await (0, import_chunk_LONQL55G.getCacheDir)(channel, version, job.binaryTarget);
2550
+ if (!cacheDir) {
2551
+ return;
2552
+ }
2553
+ const cachedTargetPath = import_node_path.default.join(cacheDir, job.binaryName);
2554
+ const cachedSha256Path = import_node_path.default.join(cacheDir, job.binaryName + ".sha256");
2555
+ const cachedSha256ZippedPath = import_node_path.default.join(cacheDir, job.binaryName + ".gz.sha256");
2556
+ try {
2557
+ await (0, import_chunk_LONQL55G.overwriteFile)(job.targetFilePath, cachedTargetPath);
2558
+ if (sha256 != null) {
2559
+ await import_node_fs.default.promises.writeFile(cachedSha256Path, sha256);
2560
+ }
2561
+ if (zippedSha256 != null) {
2562
+ await import_node_fs.default.promises.writeFile(cachedSha256ZippedPath, zippedSha256);
2563
+ }
2564
+ } catch (e) {
2565
+ debug(e);
2566
+ }
2567
+ }
2568
+ async function maybeCopyToTmp(file) {
2569
+ if (__dirname.match(vercelPkgPathRegex)) {
2570
+ const targetDir = import_node_path.default.join(import_temp_dir.default, "prisma-binaries");
2571
+ await (0, import_fs_extra.ensureDir)(targetDir);
2572
+ const target = import_node_path.default.join(targetDir, import_node_path.default.basename(file));
2573
+ const data = await import_node_fs.default.promises.readFile(file);
2574
+ await import_node_fs.default.promises.writeFile(target, data);
2575
+ plusX(target);
2576
+ return target;
2577
+ }
2578
+ return file;
2579
+ }
2580
+ function plusX(file) {
2581
+ const s = import_node_fs.default.statSync(file);
2582
+ const newMode = s.mode | 64 | 8 | 1;
2583
+ if (s.mode === newMode) {
2584
+ return;
2585
+ }
2586
+ const base8 = newMode.toString(8).slice(-3);
2587
+ import_node_fs.default.chmodSync(file, base8);
2588
+ }
backend/node_modules/@prisma/fetch-engine/dist/chunk-FKGWOTGU.js ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var chunk_FKGWOTGU_exports = {};
30
+ __export(chunk_FKGWOTGU_exports, {
31
+ getHash: () => getHash
32
+ });
33
+ module.exports = __toCommonJS(chunk_FKGWOTGU_exports);
34
+ var import_node_crypto = __toESM(require("node:crypto"));
35
+ var import_node_fs = __toESM(require("node:fs"));
36
+ function getHash(filePath) {
37
+ const hash = import_node_crypto.default.createHash("sha256");
38
+ const input = import_node_fs.default.createReadStream(filePath);
39
+ return new Promise((resolve) => {
40
+ input.on("readable", () => {
41
+ const data = input.read();
42
+ if (data) {
43
+ hash.update(data);
44
+ } else {
45
+ resolve(hash.digest("hex"));
46
+ }
47
+ });
48
+ });
49
+ }
backend/node_modules/@prisma/fetch-engine/dist/chunk-FSAAZH62.js ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var chunk_FSAAZH62_exports = {};
20
+ __export(chunk_FSAAZH62_exports, {
21
+ require_p_map: () => require_p_map
22
+ });
23
+ module.exports = __toCommonJS(chunk_FSAAZH62_exports);
24
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
25
+ var require_indent_string = (0, import_chunk_QGM4M3NI.__commonJS)({
26
+ "../../node_modules/.pnpm/indent-string@4.0.0/node_modules/indent-string/index.js"(exports, module2) {
27
+ "use strict";
28
+ module2.exports = (string, count = 1, options) => {
29
+ options = {
30
+ indent: " ",
31
+ includeEmptyLines: false,
32
+ ...options
33
+ };
34
+ if (typeof string !== "string") {
35
+ throw new TypeError(
36
+ `Expected \`input\` to be a \`string\`, got \`${typeof string}\``
37
+ );
38
+ }
39
+ if (typeof count !== "number") {
40
+ throw new TypeError(
41
+ `Expected \`count\` to be a \`number\`, got \`${typeof count}\``
42
+ );
43
+ }
44
+ if (typeof options.indent !== "string") {
45
+ throw new TypeError(
46
+ `Expected \`options.indent\` to be a \`string\`, got \`${typeof options.indent}\``
47
+ );
48
+ }
49
+ if (count === 0) {
50
+ return string;
51
+ }
52
+ const regex = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
53
+ return string.replace(regex, options.indent.repeat(count));
54
+ };
55
+ }
56
+ });
57
+ var require_clean_stack = (0, import_chunk_QGM4M3NI.__commonJS)({
58
+ "../../node_modules/.pnpm/clean-stack@2.2.0/node_modules/clean-stack/index.js"(exports, module2) {
59
+ "use strict";
60
+ var os = (0, import_chunk_QGM4M3NI.__require)("os");
61
+ var extractPathRegex = /\s+at.*(?:\(|\s)(.*)\)?/;
62
+ var pathRegex = /^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/;
63
+ var homeDir = typeof os.homedir === "undefined" ? "" : os.homedir();
64
+ module2.exports = (stack, options) => {
65
+ options = Object.assign({ pretty: false }, options);
66
+ return stack.replace(/\\/g, "/").split("\n").filter((line) => {
67
+ const pathMatches = line.match(extractPathRegex);
68
+ if (pathMatches === null || !pathMatches[1]) {
69
+ return true;
70
+ }
71
+ const match = pathMatches[1];
72
+ if (match.includes(".app/Contents/Resources/electron.asar") || match.includes(".app/Contents/Resources/default_app.asar")) {
73
+ return false;
74
+ }
75
+ return !pathRegex.test(match);
76
+ }).filter((line) => line.trim() !== "").map((line) => {
77
+ if (options.pretty) {
78
+ return line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, "~")));
79
+ }
80
+ return line;
81
+ }).join("\n");
82
+ };
83
+ }
84
+ });
85
+ var require_aggregate_error = (0, import_chunk_QGM4M3NI.__commonJS)({
86
+ "../../node_modules/.pnpm/aggregate-error@3.1.0/node_modules/aggregate-error/index.js"(exports, module2) {
87
+ "use strict";
88
+ var indentString = require_indent_string();
89
+ var cleanStack = require_clean_stack();
90
+ var cleanInternalStack = (stack) => stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, "");
91
+ var AggregateError = class extends Error {
92
+ constructor(errors) {
93
+ if (!Array.isArray(errors)) {
94
+ throw new TypeError(`Expected input to be an Array, got ${typeof errors}`);
95
+ }
96
+ errors = [...errors].map((error) => {
97
+ if (error instanceof Error) {
98
+ return error;
99
+ }
100
+ if (error !== null && typeof error === "object") {
101
+ return Object.assign(new Error(error.message), error);
102
+ }
103
+ return new Error(error);
104
+ });
105
+ let message = errors.map((error) => {
106
+ return typeof error.stack === "string" ? cleanInternalStack(cleanStack(error.stack)) : String(error);
107
+ }).join("\n");
108
+ message = "\n" + indentString(message, 4);
109
+ super(message);
110
+ this.name = "AggregateError";
111
+ Object.defineProperty(this, "_errors", { value: errors });
112
+ }
113
+ *[Symbol.iterator]() {
114
+ for (const error of this._errors) {
115
+ yield error;
116
+ }
117
+ }
118
+ };
119
+ module2.exports = AggregateError;
120
+ }
121
+ });
122
+ var require_p_map = (0, import_chunk_QGM4M3NI.__commonJS)({
123
+ "../../node_modules/.pnpm/p-map@4.0.0/node_modules/p-map/index.js"(exports, module2) {
124
+ "use strict";
125
+ var AggregateError = require_aggregate_error();
126
+ module2.exports = async (iterable, mapper, {
127
+ concurrency = Infinity,
128
+ stopOnError = true
129
+ } = {}) => {
130
+ return new Promise((resolve, reject) => {
131
+ if (typeof mapper !== "function") {
132
+ throw new TypeError("Mapper function is required");
133
+ }
134
+ if (!((Number.isSafeInteger(concurrency) || concurrency === Infinity) && concurrency >= 1)) {
135
+ throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
136
+ }
137
+ const result = [];
138
+ const errors = [];
139
+ const iterator = iterable[Symbol.iterator]();
140
+ let isRejected = false;
141
+ let isIterableDone = false;
142
+ let resolvingCount = 0;
143
+ let currentIndex = 0;
144
+ const next = () => {
145
+ if (isRejected) {
146
+ return;
147
+ }
148
+ const nextItem = iterator.next();
149
+ const index = currentIndex;
150
+ currentIndex++;
151
+ if (nextItem.done) {
152
+ isIterableDone = true;
153
+ if (resolvingCount === 0) {
154
+ if (!stopOnError && errors.length !== 0) {
155
+ reject(new AggregateError(errors));
156
+ } else {
157
+ resolve(result);
158
+ }
159
+ }
160
+ return;
161
+ }
162
+ resolvingCount++;
163
+ (async () => {
164
+ try {
165
+ const element = await nextItem.value;
166
+ result[index] = await mapper(element, index);
167
+ resolvingCount--;
168
+ next();
169
+ } catch (error) {
170
+ if (stopOnError) {
171
+ isRejected = true;
172
+ reject(error);
173
+ } else {
174
+ errors.push(error);
175
+ resolvingCount--;
176
+ next();
177
+ }
178
+ }
179
+ })();
180
+ };
181
+ for (let i = 0; i < concurrency; i++) {
182
+ next();
183
+ if (isIterableDone) {
184
+ break;
185
+ }
186
+ }
187
+ });
188
+ };
189
+ }
190
+ });
backend/node_modules/@prisma/fetch-engine/dist/chunk-LONQL55G.js ADDED
@@ -0,0 +1,2348 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var chunk_LONQL55G_exports = {};
30
+ __export(chunk_LONQL55G_exports, {
31
+ getCacheDir: () => getCacheDir,
32
+ getDownloadUrl: () => getDownloadUrl,
33
+ getRootCacheDir: () => getRootCacheDir,
34
+ overwriteFile: () => overwriteFile,
35
+ require_lib: () => require_lib
36
+ });
37
+ module.exports = __toCommonJS(chunk_LONQL55G_exports);
38
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
39
+ var import_node_fs = __toESM(require("node:fs"));
40
+ var import_node_os = __toESM(require("node:os"));
41
+ var import_node_path = __toESM(require("node:path"));
42
+ var import_debug = __toESM(require("@prisma/debug"));
43
+ var import_get_platform = require("@prisma/get-platform");
44
+ var import_node_process = __toESM(require("node:process"));
45
+ var import_node_path2 = __toESM(require("node:path"));
46
+ var import_node_fs2 = __toESM(require("node:fs"));
47
+ var import_node_path3 = __toESM(require("node:path"));
48
+ var import_node_path4 = __toESM(require("node:path"));
49
+ var import_node_url = require("node:url");
50
+ var import_node_process2 = __toESM(require("node:process"));
51
+ var import_node_path5 = __toESM(require("node:path"));
52
+ var import_node_fs3 = __toESM(require("node:fs"));
53
+ var import_node_url2 = require("node:url");
54
+ var require_common_path_prefix = (0, import_chunk_QGM4M3NI.__commonJS)({
55
+ "../../node_modules/.pnpm/common-path-prefix@3.0.0/node_modules/common-path-prefix/index.js"(exports, module2) {
56
+ "use strict";
57
+ var { sep: DEFAULT_SEPARATOR } = (0, import_chunk_QGM4M3NI.__require)("path");
58
+ var determineSeparator = (paths) => {
59
+ for (const path6 of paths) {
60
+ const match = /(\/|\\)/.exec(path6);
61
+ if (match !== null) return match[0];
62
+ }
63
+ return DEFAULT_SEPARATOR;
64
+ };
65
+ module2.exports = function commonPathPrefix2(paths, sep = determineSeparator(paths)) {
66
+ const [first = "", ...remaining] = paths;
67
+ if (first === "" || remaining.length === 0) return "";
68
+ const parts = first.split(sep);
69
+ let endOfPrefix = parts.length;
70
+ for (const path6 of remaining) {
71
+ const compare = path6.split(sep);
72
+ for (let i = 0; i < endOfPrefix; i++) {
73
+ if (compare[i] !== parts[i]) {
74
+ endOfPrefix = i;
75
+ }
76
+ }
77
+ if (endOfPrefix === 0) return "";
78
+ }
79
+ const prefix = parts.slice(0, endOfPrefix).join(sep);
80
+ return prefix.endsWith(sep) ? prefix : prefix + sep;
81
+ };
82
+ }
83
+ });
84
+ var require_universalify = (0, import_chunk_QGM4M3NI.__commonJS)({
85
+ "../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js"(exports) {
86
+ "use strict";
87
+ exports.fromCallback = function(fn) {
88
+ return Object.defineProperty(function(...args) {
89
+ if (typeof args[args.length - 1] === "function") fn.apply(this, args);
90
+ else {
91
+ return new Promise((resolve, reject) => {
92
+ args.push((err, res) => err != null ? reject(err) : resolve(res));
93
+ fn.apply(this, args);
94
+ });
95
+ }
96
+ }, "name", { value: fn.name });
97
+ };
98
+ exports.fromPromise = function(fn) {
99
+ return Object.defineProperty(function(...args) {
100
+ const cb = args[args.length - 1];
101
+ if (typeof cb !== "function") return fn.apply(this, args);
102
+ else {
103
+ args.pop();
104
+ fn.apply(this, args).then((r) => cb(null, r), cb);
105
+ }
106
+ }, "name", { value: fn.name });
107
+ };
108
+ }
109
+ });
110
+ var require_polyfills = (0, import_chunk_QGM4M3NI.__commonJS)({
111
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports, module2) {
112
+ "use strict";
113
+ var constants = (0, import_chunk_QGM4M3NI.__require)("constants");
114
+ var origCwd = process.cwd;
115
+ var cwd2 = null;
116
+ var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
117
+ process.cwd = function() {
118
+ if (!cwd2)
119
+ cwd2 = origCwd.call(process);
120
+ return cwd2;
121
+ };
122
+ try {
123
+ process.cwd();
124
+ } catch (er) {
125
+ }
126
+ if (typeof process.chdir === "function") {
127
+ chdir = process.chdir;
128
+ process.chdir = function(d) {
129
+ cwd2 = null;
130
+ chdir.call(process, d);
131
+ };
132
+ if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
133
+ }
134
+ var chdir;
135
+ module2.exports = patch;
136
+ function patch(fs4) {
137
+ if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
138
+ patchLchmod(fs4);
139
+ }
140
+ if (!fs4.lutimes) {
141
+ patchLutimes(fs4);
142
+ }
143
+ fs4.chown = chownFix(fs4.chown);
144
+ fs4.fchown = chownFix(fs4.fchown);
145
+ fs4.lchown = chownFix(fs4.lchown);
146
+ fs4.chmod = chmodFix(fs4.chmod);
147
+ fs4.fchmod = chmodFix(fs4.fchmod);
148
+ fs4.lchmod = chmodFix(fs4.lchmod);
149
+ fs4.chownSync = chownFixSync(fs4.chownSync);
150
+ fs4.fchownSync = chownFixSync(fs4.fchownSync);
151
+ fs4.lchownSync = chownFixSync(fs4.lchownSync);
152
+ fs4.chmodSync = chmodFixSync(fs4.chmodSync);
153
+ fs4.fchmodSync = chmodFixSync(fs4.fchmodSync);
154
+ fs4.lchmodSync = chmodFixSync(fs4.lchmodSync);
155
+ fs4.stat = statFix(fs4.stat);
156
+ fs4.fstat = statFix(fs4.fstat);
157
+ fs4.lstat = statFix(fs4.lstat);
158
+ fs4.statSync = statFixSync(fs4.statSync);
159
+ fs4.fstatSync = statFixSync(fs4.fstatSync);
160
+ fs4.lstatSync = statFixSync(fs4.lstatSync);
161
+ if (fs4.chmod && !fs4.lchmod) {
162
+ fs4.lchmod = function(path6, mode, cb) {
163
+ if (cb) process.nextTick(cb);
164
+ };
165
+ fs4.lchmodSync = function() {
166
+ };
167
+ }
168
+ if (fs4.chown && !fs4.lchown) {
169
+ fs4.lchown = function(path6, uid, gid, cb) {
170
+ if (cb) process.nextTick(cb);
171
+ };
172
+ fs4.lchownSync = function() {
173
+ };
174
+ }
175
+ if (platform === "win32") {
176
+ fs4.rename = typeof fs4.rename !== "function" ? fs4.rename : function(fs$rename) {
177
+ function rename(from, to, cb) {
178
+ var start = Date.now();
179
+ var backoff = 0;
180
+ fs$rename(from, to, function CB(er) {
181
+ if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
182
+ setTimeout(function() {
183
+ fs4.stat(to, function(stater, st) {
184
+ if (stater && stater.code === "ENOENT")
185
+ fs$rename(from, to, CB);
186
+ else
187
+ cb(er);
188
+ });
189
+ }, backoff);
190
+ if (backoff < 100)
191
+ backoff += 10;
192
+ return;
193
+ }
194
+ if (cb) cb(er);
195
+ });
196
+ }
197
+ if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
198
+ return rename;
199
+ }(fs4.rename);
200
+ }
201
+ fs4.read = typeof fs4.read !== "function" ? fs4.read : function(fs$read) {
202
+ function read(fd, buffer, offset, length, position, callback_) {
203
+ var callback;
204
+ if (callback_ && typeof callback_ === "function") {
205
+ var eagCounter = 0;
206
+ callback = function(er, _, __) {
207
+ if (er && er.code === "EAGAIN" && eagCounter < 10) {
208
+ eagCounter++;
209
+ return fs$read.call(fs4, fd, buffer, offset, length, position, callback);
210
+ }
211
+ callback_.apply(this, arguments);
212
+ };
213
+ }
214
+ return fs$read.call(fs4, fd, buffer, offset, length, position, callback);
215
+ }
216
+ if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
217
+ return read;
218
+ }(fs4.read);
219
+ fs4.readSync = typeof fs4.readSync !== "function" ? fs4.readSync : /* @__PURE__ */ function(fs$readSync) {
220
+ return function(fd, buffer, offset, length, position) {
221
+ var eagCounter = 0;
222
+ while (true) {
223
+ try {
224
+ return fs$readSync.call(fs4, fd, buffer, offset, length, position);
225
+ } catch (er) {
226
+ if (er.code === "EAGAIN" && eagCounter < 10) {
227
+ eagCounter++;
228
+ continue;
229
+ }
230
+ throw er;
231
+ }
232
+ }
233
+ };
234
+ }(fs4.readSync);
235
+ function patchLchmod(fs5) {
236
+ fs5.lchmod = function(path6, mode, callback) {
237
+ fs5.open(
238
+ path6,
239
+ constants.O_WRONLY | constants.O_SYMLINK,
240
+ mode,
241
+ function(err, fd) {
242
+ if (err) {
243
+ if (callback) callback(err);
244
+ return;
245
+ }
246
+ fs5.fchmod(fd, mode, function(err2) {
247
+ fs5.close(fd, function(err22) {
248
+ if (callback) callback(err2 || err22);
249
+ });
250
+ });
251
+ }
252
+ );
253
+ };
254
+ fs5.lchmodSync = function(path6, mode) {
255
+ var fd = fs5.openSync(path6, constants.O_WRONLY | constants.O_SYMLINK, mode);
256
+ var threw = true;
257
+ var ret;
258
+ try {
259
+ ret = fs5.fchmodSync(fd, mode);
260
+ threw = false;
261
+ } finally {
262
+ if (threw) {
263
+ try {
264
+ fs5.closeSync(fd);
265
+ } catch (er) {
266
+ }
267
+ } else {
268
+ fs5.closeSync(fd);
269
+ }
270
+ }
271
+ return ret;
272
+ };
273
+ }
274
+ function patchLutimes(fs5) {
275
+ if (constants.hasOwnProperty("O_SYMLINK") && fs5.futimes) {
276
+ fs5.lutimes = function(path6, at, mt, cb) {
277
+ fs5.open(path6, constants.O_SYMLINK, function(er, fd) {
278
+ if (er) {
279
+ if (cb) cb(er);
280
+ return;
281
+ }
282
+ fs5.futimes(fd, at, mt, function(er2) {
283
+ fs5.close(fd, function(er22) {
284
+ if (cb) cb(er2 || er22);
285
+ });
286
+ });
287
+ });
288
+ };
289
+ fs5.lutimesSync = function(path6, at, mt) {
290
+ var fd = fs5.openSync(path6, constants.O_SYMLINK);
291
+ var ret;
292
+ var threw = true;
293
+ try {
294
+ ret = fs5.futimesSync(fd, at, mt);
295
+ threw = false;
296
+ } finally {
297
+ if (threw) {
298
+ try {
299
+ fs5.closeSync(fd);
300
+ } catch (er) {
301
+ }
302
+ } else {
303
+ fs5.closeSync(fd);
304
+ }
305
+ }
306
+ return ret;
307
+ };
308
+ } else if (fs5.futimes) {
309
+ fs5.lutimes = function(_a, _b, _c, cb) {
310
+ if (cb) process.nextTick(cb);
311
+ };
312
+ fs5.lutimesSync = function() {
313
+ };
314
+ }
315
+ }
316
+ function chmodFix(orig) {
317
+ if (!orig) return orig;
318
+ return function(target, mode, cb) {
319
+ return orig.call(fs4, target, mode, function(er) {
320
+ if (chownErOk(er)) er = null;
321
+ if (cb) cb.apply(this, arguments);
322
+ });
323
+ };
324
+ }
325
+ function chmodFixSync(orig) {
326
+ if (!orig) return orig;
327
+ return function(target, mode) {
328
+ try {
329
+ return orig.call(fs4, target, mode);
330
+ } catch (er) {
331
+ if (!chownErOk(er)) throw er;
332
+ }
333
+ };
334
+ }
335
+ function chownFix(orig) {
336
+ if (!orig) return orig;
337
+ return function(target, uid, gid, cb) {
338
+ return orig.call(fs4, target, uid, gid, function(er) {
339
+ if (chownErOk(er)) er = null;
340
+ if (cb) cb.apply(this, arguments);
341
+ });
342
+ };
343
+ }
344
+ function chownFixSync(orig) {
345
+ if (!orig) return orig;
346
+ return function(target, uid, gid) {
347
+ try {
348
+ return orig.call(fs4, target, uid, gid);
349
+ } catch (er) {
350
+ if (!chownErOk(er)) throw er;
351
+ }
352
+ };
353
+ }
354
+ function statFix(orig) {
355
+ if (!orig) return orig;
356
+ return function(target, options, cb) {
357
+ if (typeof options === "function") {
358
+ cb = options;
359
+ options = null;
360
+ }
361
+ function callback(er, stats) {
362
+ if (stats) {
363
+ if (stats.uid < 0) stats.uid += 4294967296;
364
+ if (stats.gid < 0) stats.gid += 4294967296;
365
+ }
366
+ if (cb) cb.apply(this, arguments);
367
+ }
368
+ return options ? orig.call(fs4, target, options, callback) : orig.call(fs4, target, callback);
369
+ };
370
+ }
371
+ function statFixSync(orig) {
372
+ if (!orig) return orig;
373
+ return function(target, options) {
374
+ var stats = options ? orig.call(fs4, target, options) : orig.call(fs4, target);
375
+ if (stats) {
376
+ if (stats.uid < 0) stats.uid += 4294967296;
377
+ if (stats.gid < 0) stats.gid += 4294967296;
378
+ }
379
+ return stats;
380
+ };
381
+ }
382
+ function chownErOk(er) {
383
+ if (!er)
384
+ return true;
385
+ if (er.code === "ENOSYS")
386
+ return true;
387
+ var nonroot = !process.getuid || process.getuid() !== 0;
388
+ if (nonroot) {
389
+ if (er.code === "EINVAL" || er.code === "EPERM")
390
+ return true;
391
+ }
392
+ return false;
393
+ }
394
+ }
395
+ }
396
+ });
397
+ var require_legacy_streams = (0, import_chunk_QGM4M3NI.__commonJS)({
398
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports, module2) {
399
+ "use strict";
400
+ var Stream = (0, import_chunk_QGM4M3NI.__require)("stream").Stream;
401
+ module2.exports = legacy;
402
+ function legacy(fs4) {
403
+ return {
404
+ ReadStream,
405
+ WriteStream
406
+ };
407
+ function ReadStream(path6, options) {
408
+ if (!(this instanceof ReadStream)) return new ReadStream(path6, options);
409
+ Stream.call(this);
410
+ var self = this;
411
+ this.path = path6;
412
+ this.fd = null;
413
+ this.readable = true;
414
+ this.paused = false;
415
+ this.flags = "r";
416
+ this.mode = 438;
417
+ this.bufferSize = 64 * 1024;
418
+ options = options || {};
419
+ var keys = Object.keys(options);
420
+ for (var index = 0, length = keys.length; index < length; index++) {
421
+ var key = keys[index];
422
+ this[key] = options[key];
423
+ }
424
+ if (this.encoding) this.setEncoding(this.encoding);
425
+ if (this.start !== void 0) {
426
+ if ("number" !== typeof this.start) {
427
+ throw TypeError("start must be a Number");
428
+ }
429
+ if (this.end === void 0) {
430
+ this.end = Infinity;
431
+ } else if ("number" !== typeof this.end) {
432
+ throw TypeError("end must be a Number");
433
+ }
434
+ if (this.start > this.end) {
435
+ throw new Error("start must be <= end");
436
+ }
437
+ this.pos = this.start;
438
+ }
439
+ if (this.fd !== null) {
440
+ process.nextTick(function() {
441
+ self._read();
442
+ });
443
+ return;
444
+ }
445
+ fs4.open(this.path, this.flags, this.mode, function(err, fd) {
446
+ if (err) {
447
+ self.emit("error", err);
448
+ self.readable = false;
449
+ return;
450
+ }
451
+ self.fd = fd;
452
+ self.emit("open", fd);
453
+ self._read();
454
+ });
455
+ }
456
+ function WriteStream(path6, options) {
457
+ if (!(this instanceof WriteStream)) return new WriteStream(path6, options);
458
+ Stream.call(this);
459
+ this.path = path6;
460
+ this.fd = null;
461
+ this.writable = true;
462
+ this.flags = "w";
463
+ this.encoding = "binary";
464
+ this.mode = 438;
465
+ this.bytesWritten = 0;
466
+ options = options || {};
467
+ var keys = Object.keys(options);
468
+ for (var index = 0, length = keys.length; index < length; index++) {
469
+ var key = keys[index];
470
+ this[key] = options[key];
471
+ }
472
+ if (this.start !== void 0) {
473
+ if ("number" !== typeof this.start) {
474
+ throw TypeError("start must be a Number");
475
+ }
476
+ if (this.start < 0) {
477
+ throw new Error("start must be >= zero");
478
+ }
479
+ this.pos = this.start;
480
+ }
481
+ this.busy = false;
482
+ this._queue = [];
483
+ if (this.fd === null) {
484
+ this._open = fs4.open;
485
+ this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
486
+ this.flush();
487
+ }
488
+ }
489
+ }
490
+ }
491
+ });
492
+ var require_clone = (0, import_chunk_QGM4M3NI.__commonJS)({
493
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js"(exports, module2) {
494
+ "use strict";
495
+ module2.exports = clone;
496
+ var getPrototypeOf = Object.getPrototypeOf || function(obj) {
497
+ return obj.__proto__;
498
+ };
499
+ function clone(obj) {
500
+ if (obj === null || typeof obj !== "object")
501
+ return obj;
502
+ if (obj instanceof Object)
503
+ var copy = { __proto__: getPrototypeOf(obj) };
504
+ else
505
+ var copy = /* @__PURE__ */ Object.create(null);
506
+ Object.getOwnPropertyNames(obj).forEach(function(key) {
507
+ Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
508
+ });
509
+ return copy;
510
+ }
511
+ }
512
+ });
513
+ var require_graceful_fs = (0, import_chunk_QGM4M3NI.__commonJS)({
514
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports, module2) {
515
+ "use strict";
516
+ var fs4 = (0, import_chunk_QGM4M3NI.__require)("fs");
517
+ var polyfills = require_polyfills();
518
+ var legacy = require_legacy_streams();
519
+ var clone = require_clone();
520
+ var util = (0, import_chunk_QGM4M3NI.__require)("util");
521
+ var gracefulQueue;
522
+ var previousSymbol;
523
+ if (typeof Symbol === "function" && typeof Symbol.for === "function") {
524
+ gracefulQueue = Symbol.for("graceful-fs.queue");
525
+ previousSymbol = Symbol.for("graceful-fs.previous");
526
+ } else {
527
+ gracefulQueue = "___graceful-fs.queue";
528
+ previousSymbol = "___graceful-fs.previous";
529
+ }
530
+ function noop() {
531
+ }
532
+ function publishQueue(context, queue2) {
533
+ Object.defineProperty(context, gracefulQueue, {
534
+ get: function() {
535
+ return queue2;
536
+ }
537
+ });
538
+ }
539
+ var debug2 = noop;
540
+ if (util.debuglog)
541
+ debug2 = util.debuglog("gfs4");
542
+ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
543
+ debug2 = function() {
544
+ var m = util.format.apply(util, arguments);
545
+ m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
546
+ console.error(m);
547
+ };
548
+ if (!fs4[gracefulQueue]) {
549
+ queue = global[gracefulQueue] || [];
550
+ publishQueue(fs4, queue);
551
+ fs4.close = function(fs$close) {
552
+ function close(fd, cb) {
553
+ return fs$close.call(fs4, fd, function(err) {
554
+ if (!err) {
555
+ resetQueue();
556
+ }
557
+ if (typeof cb === "function")
558
+ cb.apply(this, arguments);
559
+ });
560
+ }
561
+ Object.defineProperty(close, previousSymbol, {
562
+ value: fs$close
563
+ });
564
+ return close;
565
+ }(fs4.close);
566
+ fs4.closeSync = function(fs$closeSync) {
567
+ function closeSync(fd) {
568
+ fs$closeSync.apply(fs4, arguments);
569
+ resetQueue();
570
+ }
571
+ Object.defineProperty(closeSync, previousSymbol, {
572
+ value: fs$closeSync
573
+ });
574
+ return closeSync;
575
+ }(fs4.closeSync);
576
+ if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
577
+ process.on("exit", function() {
578
+ debug2(fs4[gracefulQueue]);
579
+ (0, import_chunk_QGM4M3NI.__require)("assert").equal(fs4[gracefulQueue].length, 0);
580
+ });
581
+ }
582
+ }
583
+ var queue;
584
+ if (!global[gracefulQueue]) {
585
+ publishQueue(global, fs4[gracefulQueue]);
586
+ }
587
+ module2.exports = patch(clone(fs4));
588
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs4.__patched) {
589
+ module2.exports = patch(fs4);
590
+ fs4.__patched = true;
591
+ }
592
+ function patch(fs5) {
593
+ polyfills(fs5);
594
+ fs5.gracefulify = patch;
595
+ fs5.createReadStream = createReadStream;
596
+ fs5.createWriteStream = createWriteStream;
597
+ var fs$readFile = fs5.readFile;
598
+ fs5.readFile = readFile;
599
+ function readFile(path6, options, cb) {
600
+ if (typeof options === "function")
601
+ cb = options, options = null;
602
+ return go$readFile(path6, options, cb);
603
+ function go$readFile(path7, options2, cb2, startTime) {
604
+ return fs$readFile(path7, options2, function(err) {
605
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
606
+ enqueue([go$readFile, [path7, options2, cb2], err, startTime || Date.now(), Date.now()]);
607
+ else {
608
+ if (typeof cb2 === "function")
609
+ cb2.apply(this, arguments);
610
+ }
611
+ });
612
+ }
613
+ }
614
+ var fs$writeFile = fs5.writeFile;
615
+ fs5.writeFile = writeFile;
616
+ function writeFile(path6, data, options, cb) {
617
+ if (typeof options === "function")
618
+ cb = options, options = null;
619
+ return go$writeFile(path6, data, options, cb);
620
+ function go$writeFile(path7, data2, options2, cb2, startTime) {
621
+ return fs$writeFile(path7, data2, options2, function(err) {
622
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
623
+ enqueue([go$writeFile, [path7, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
624
+ else {
625
+ if (typeof cb2 === "function")
626
+ cb2.apply(this, arguments);
627
+ }
628
+ });
629
+ }
630
+ }
631
+ var fs$appendFile = fs5.appendFile;
632
+ if (fs$appendFile)
633
+ fs5.appendFile = appendFile;
634
+ function appendFile(path6, data, options, cb) {
635
+ if (typeof options === "function")
636
+ cb = options, options = null;
637
+ return go$appendFile(path6, data, options, cb);
638
+ function go$appendFile(path7, data2, options2, cb2, startTime) {
639
+ return fs$appendFile(path7, data2, options2, function(err) {
640
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
641
+ enqueue([go$appendFile, [path7, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
642
+ else {
643
+ if (typeof cb2 === "function")
644
+ cb2.apply(this, arguments);
645
+ }
646
+ });
647
+ }
648
+ }
649
+ var fs$copyFile = fs5.copyFile;
650
+ if (fs$copyFile)
651
+ fs5.copyFile = copyFile;
652
+ function copyFile(src, dest, flags, cb) {
653
+ if (typeof flags === "function") {
654
+ cb = flags;
655
+ flags = 0;
656
+ }
657
+ return go$copyFile(src, dest, flags, cb);
658
+ function go$copyFile(src2, dest2, flags2, cb2, startTime) {
659
+ return fs$copyFile(src2, dest2, flags2, function(err) {
660
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
661
+ enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
662
+ else {
663
+ if (typeof cb2 === "function")
664
+ cb2.apply(this, arguments);
665
+ }
666
+ });
667
+ }
668
+ }
669
+ var fs$readdir = fs5.readdir;
670
+ fs5.readdir = readdir;
671
+ var noReaddirOptionVersions = /^v[0-5]\./;
672
+ function readdir(path6, options, cb) {
673
+ if (typeof options === "function")
674
+ cb = options, options = null;
675
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path7, options2, cb2, startTime) {
676
+ return fs$readdir(path7, fs$readdirCallback(
677
+ path7,
678
+ options2,
679
+ cb2,
680
+ startTime
681
+ ));
682
+ } : function go$readdir2(path7, options2, cb2, startTime) {
683
+ return fs$readdir(path7, options2, fs$readdirCallback(
684
+ path7,
685
+ options2,
686
+ cb2,
687
+ startTime
688
+ ));
689
+ };
690
+ return go$readdir(path6, options, cb);
691
+ function fs$readdirCallback(path7, options2, cb2, startTime) {
692
+ return function(err, files) {
693
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
694
+ enqueue([
695
+ go$readdir,
696
+ [path7, options2, cb2],
697
+ err,
698
+ startTime || Date.now(),
699
+ Date.now()
700
+ ]);
701
+ else {
702
+ if (files && files.sort)
703
+ files.sort();
704
+ if (typeof cb2 === "function")
705
+ cb2.call(this, err, files);
706
+ }
707
+ };
708
+ }
709
+ }
710
+ if (process.version.substr(0, 4) === "v0.8") {
711
+ var legStreams = legacy(fs5);
712
+ ReadStream = legStreams.ReadStream;
713
+ WriteStream = legStreams.WriteStream;
714
+ }
715
+ var fs$ReadStream = fs5.ReadStream;
716
+ if (fs$ReadStream) {
717
+ ReadStream.prototype = Object.create(fs$ReadStream.prototype);
718
+ ReadStream.prototype.open = ReadStream$open;
719
+ }
720
+ var fs$WriteStream = fs5.WriteStream;
721
+ if (fs$WriteStream) {
722
+ WriteStream.prototype = Object.create(fs$WriteStream.prototype);
723
+ WriteStream.prototype.open = WriteStream$open;
724
+ }
725
+ Object.defineProperty(fs5, "ReadStream", {
726
+ get: function() {
727
+ return ReadStream;
728
+ },
729
+ set: function(val) {
730
+ ReadStream = val;
731
+ },
732
+ enumerable: true,
733
+ configurable: true
734
+ });
735
+ Object.defineProperty(fs5, "WriteStream", {
736
+ get: function() {
737
+ return WriteStream;
738
+ },
739
+ set: function(val) {
740
+ WriteStream = val;
741
+ },
742
+ enumerable: true,
743
+ configurable: true
744
+ });
745
+ var FileReadStream = ReadStream;
746
+ Object.defineProperty(fs5, "FileReadStream", {
747
+ get: function() {
748
+ return FileReadStream;
749
+ },
750
+ set: function(val) {
751
+ FileReadStream = val;
752
+ },
753
+ enumerable: true,
754
+ configurable: true
755
+ });
756
+ var FileWriteStream = WriteStream;
757
+ Object.defineProperty(fs5, "FileWriteStream", {
758
+ get: function() {
759
+ return FileWriteStream;
760
+ },
761
+ set: function(val) {
762
+ FileWriteStream = val;
763
+ },
764
+ enumerable: true,
765
+ configurable: true
766
+ });
767
+ function ReadStream(path6, options) {
768
+ if (this instanceof ReadStream)
769
+ return fs$ReadStream.apply(this, arguments), this;
770
+ else
771
+ return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
772
+ }
773
+ function ReadStream$open() {
774
+ var that = this;
775
+ open(that.path, that.flags, that.mode, function(err, fd) {
776
+ if (err) {
777
+ if (that.autoClose)
778
+ that.destroy();
779
+ that.emit("error", err);
780
+ } else {
781
+ that.fd = fd;
782
+ that.emit("open", fd);
783
+ that.read();
784
+ }
785
+ });
786
+ }
787
+ function WriteStream(path6, options) {
788
+ if (this instanceof WriteStream)
789
+ return fs$WriteStream.apply(this, arguments), this;
790
+ else
791
+ return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
792
+ }
793
+ function WriteStream$open() {
794
+ var that = this;
795
+ open(that.path, that.flags, that.mode, function(err, fd) {
796
+ if (err) {
797
+ that.destroy();
798
+ that.emit("error", err);
799
+ } else {
800
+ that.fd = fd;
801
+ that.emit("open", fd);
802
+ }
803
+ });
804
+ }
805
+ function createReadStream(path6, options) {
806
+ return new fs5.ReadStream(path6, options);
807
+ }
808
+ function createWriteStream(path6, options) {
809
+ return new fs5.WriteStream(path6, options);
810
+ }
811
+ var fs$open = fs5.open;
812
+ fs5.open = open;
813
+ function open(path6, flags, mode, cb) {
814
+ if (typeof mode === "function")
815
+ cb = mode, mode = null;
816
+ return go$open(path6, flags, mode, cb);
817
+ function go$open(path7, flags2, mode2, cb2, startTime) {
818
+ return fs$open(path7, flags2, mode2, function(err, fd) {
819
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
820
+ enqueue([go$open, [path7, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
821
+ else {
822
+ if (typeof cb2 === "function")
823
+ cb2.apply(this, arguments);
824
+ }
825
+ });
826
+ }
827
+ }
828
+ return fs5;
829
+ }
830
+ function enqueue(elem) {
831
+ debug2("ENQUEUE", elem[0].name, elem[1]);
832
+ fs4[gracefulQueue].push(elem);
833
+ retry();
834
+ }
835
+ var retryTimer;
836
+ function resetQueue() {
837
+ var now = Date.now();
838
+ for (var i = 0; i < fs4[gracefulQueue].length; ++i) {
839
+ if (fs4[gracefulQueue][i].length > 2) {
840
+ fs4[gracefulQueue][i][3] = now;
841
+ fs4[gracefulQueue][i][4] = now;
842
+ }
843
+ }
844
+ retry();
845
+ }
846
+ function retry() {
847
+ clearTimeout(retryTimer);
848
+ retryTimer = void 0;
849
+ if (fs4[gracefulQueue].length === 0)
850
+ return;
851
+ var elem = fs4[gracefulQueue].shift();
852
+ var fn = elem[0];
853
+ var args = elem[1];
854
+ var err = elem[2];
855
+ var startTime = elem[3];
856
+ var lastTime = elem[4];
857
+ if (startTime === void 0) {
858
+ debug2("RETRY", fn.name, args);
859
+ fn.apply(null, args);
860
+ } else if (Date.now() - startTime >= 6e4) {
861
+ debug2("TIMEOUT", fn.name, args);
862
+ var cb = args.pop();
863
+ if (typeof cb === "function")
864
+ cb.call(null, err);
865
+ } else {
866
+ var sinceAttempt = Date.now() - lastTime;
867
+ var sinceStart = Math.max(lastTime - startTime, 1);
868
+ var desiredDelay = Math.min(sinceStart * 1.2, 100);
869
+ if (sinceAttempt >= desiredDelay) {
870
+ debug2("RETRY", fn.name, args);
871
+ fn.apply(null, args.concat([startTime]));
872
+ } else {
873
+ fs4[gracefulQueue].push(elem);
874
+ }
875
+ }
876
+ if (retryTimer === void 0) {
877
+ retryTimer = setTimeout(retry, 0);
878
+ }
879
+ }
880
+ }
881
+ });
882
+ var require_fs = (0, import_chunk_QGM4M3NI.__commonJS)({
883
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/fs/index.js"(exports) {
884
+ "use strict";
885
+ var u = require_universalify().fromCallback;
886
+ var fs4 = require_graceful_fs();
887
+ var api = [
888
+ "access",
889
+ "appendFile",
890
+ "chmod",
891
+ "chown",
892
+ "close",
893
+ "copyFile",
894
+ "cp",
895
+ "fchmod",
896
+ "fchown",
897
+ "fdatasync",
898
+ "fstat",
899
+ "fsync",
900
+ "ftruncate",
901
+ "futimes",
902
+ "glob",
903
+ "lchmod",
904
+ "lchown",
905
+ "lutimes",
906
+ "link",
907
+ "lstat",
908
+ "mkdir",
909
+ "mkdtemp",
910
+ "open",
911
+ "opendir",
912
+ "readdir",
913
+ "readFile",
914
+ "readlink",
915
+ "realpath",
916
+ "rename",
917
+ "rm",
918
+ "rmdir",
919
+ "stat",
920
+ "statfs",
921
+ "symlink",
922
+ "truncate",
923
+ "unlink",
924
+ "utimes",
925
+ "writeFile"
926
+ ].filter((key) => {
927
+ return typeof fs4[key] === "function";
928
+ });
929
+ Object.assign(exports, fs4);
930
+ api.forEach((method) => {
931
+ exports[method] = u(fs4[method]);
932
+ });
933
+ exports.exists = function(filename, callback) {
934
+ if (typeof callback === "function") {
935
+ return fs4.exists(filename, callback);
936
+ }
937
+ return new Promise((resolve) => {
938
+ return fs4.exists(filename, resolve);
939
+ });
940
+ };
941
+ exports.read = function(fd, buffer, offset, length, position, callback) {
942
+ if (typeof callback === "function") {
943
+ return fs4.read(fd, buffer, offset, length, position, callback);
944
+ }
945
+ return new Promise((resolve, reject) => {
946
+ fs4.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
947
+ if (err) return reject(err);
948
+ resolve({ bytesRead, buffer: buffer2 });
949
+ });
950
+ });
951
+ };
952
+ exports.write = function(fd, buffer, ...args) {
953
+ if (typeof args[args.length - 1] === "function") {
954
+ return fs4.write(fd, buffer, ...args);
955
+ }
956
+ return new Promise((resolve, reject) => {
957
+ fs4.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
958
+ if (err) return reject(err);
959
+ resolve({ bytesWritten, buffer: buffer2 });
960
+ });
961
+ });
962
+ };
963
+ exports.readv = function(fd, buffers, ...args) {
964
+ if (typeof args[args.length - 1] === "function") {
965
+ return fs4.readv(fd, buffers, ...args);
966
+ }
967
+ return new Promise((resolve, reject) => {
968
+ fs4.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
969
+ if (err) return reject(err);
970
+ resolve({ bytesRead, buffers: buffers2 });
971
+ });
972
+ });
973
+ };
974
+ exports.writev = function(fd, buffers, ...args) {
975
+ if (typeof args[args.length - 1] === "function") {
976
+ return fs4.writev(fd, buffers, ...args);
977
+ }
978
+ return new Promise((resolve, reject) => {
979
+ fs4.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
980
+ if (err) return reject(err);
981
+ resolve({ bytesWritten, buffers: buffers2 });
982
+ });
983
+ });
984
+ };
985
+ if (typeof fs4.realpath.native === "function") {
986
+ exports.realpath.native = u(fs4.realpath.native);
987
+ } else {
988
+ process.emitWarning(
989
+ "fs.realpath.native is not a function. Is fs being monkey-patched?",
990
+ "Warning",
991
+ "fs-extra-WARN0003"
992
+ );
993
+ }
994
+ }
995
+ });
996
+ var require_utils = (0, import_chunk_QGM4M3NI.__commonJS)({
997
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/utils.js"(exports, module2) {
998
+ "use strict";
999
+ var path6 = (0, import_chunk_QGM4M3NI.__require)("path");
1000
+ module2.exports.checkPath = function checkPath(pth) {
1001
+ if (process.platform === "win32") {
1002
+ const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path6.parse(pth).root, ""));
1003
+ if (pathHasInvalidWinCharacters) {
1004
+ const error = new Error(`Path contains invalid characters: ${pth}`);
1005
+ error.code = "EINVAL";
1006
+ throw error;
1007
+ }
1008
+ }
1009
+ };
1010
+ }
1011
+ });
1012
+ var require_make_dir = (0, import_chunk_QGM4M3NI.__commonJS)({
1013
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports, module2) {
1014
+ "use strict";
1015
+ var fs4 = require_fs();
1016
+ var { checkPath } = require_utils();
1017
+ var getMode = (options) => {
1018
+ const defaults = { mode: 511 };
1019
+ if (typeof options === "number") return options;
1020
+ return { ...defaults, ...options }.mode;
1021
+ };
1022
+ module2.exports.makeDir = async (dir, options) => {
1023
+ checkPath(dir);
1024
+ return fs4.mkdir(dir, {
1025
+ mode: getMode(options),
1026
+ recursive: true
1027
+ });
1028
+ };
1029
+ module2.exports.makeDirSync = (dir, options) => {
1030
+ checkPath(dir);
1031
+ return fs4.mkdirSync(dir, {
1032
+ mode: getMode(options),
1033
+ recursive: true
1034
+ });
1035
+ };
1036
+ }
1037
+ });
1038
+ var require_mkdirs = (0, import_chunk_QGM4M3NI.__commonJS)({
1039
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/index.js"(exports, module2) {
1040
+ "use strict";
1041
+ var u = require_universalify().fromPromise;
1042
+ var { makeDir: _makeDir, makeDirSync } = require_make_dir();
1043
+ var makeDir = u(_makeDir);
1044
+ module2.exports = {
1045
+ mkdirs: makeDir,
1046
+ mkdirsSync: makeDirSync,
1047
+ // alias
1048
+ mkdirp: makeDir,
1049
+ mkdirpSync: makeDirSync,
1050
+ ensureDir: makeDir,
1051
+ ensureDirSync: makeDirSync
1052
+ };
1053
+ }
1054
+ });
1055
+ var require_path_exists = (0, import_chunk_QGM4M3NI.__commonJS)({
1056
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/path-exists/index.js"(exports, module2) {
1057
+ "use strict";
1058
+ var u = require_universalify().fromPromise;
1059
+ var fs4 = require_fs();
1060
+ function pathExists2(path6) {
1061
+ return fs4.access(path6).then(() => true).catch(() => false);
1062
+ }
1063
+ module2.exports = {
1064
+ pathExists: u(pathExists2),
1065
+ pathExistsSync: fs4.existsSync
1066
+ };
1067
+ }
1068
+ });
1069
+ var require_utimes = (0, import_chunk_QGM4M3NI.__commonJS)({
1070
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/util/utimes.js"(exports, module2) {
1071
+ "use strict";
1072
+ var fs4 = require_fs();
1073
+ var u = require_universalify().fromPromise;
1074
+ async function utimesMillis(path6, atime, mtime) {
1075
+ const fd = await fs4.open(path6, "r+");
1076
+ let closeErr = null;
1077
+ try {
1078
+ await fs4.futimes(fd, atime, mtime);
1079
+ } finally {
1080
+ try {
1081
+ await fs4.close(fd);
1082
+ } catch (e) {
1083
+ closeErr = e;
1084
+ }
1085
+ }
1086
+ if (closeErr) {
1087
+ throw closeErr;
1088
+ }
1089
+ }
1090
+ function utimesMillisSync(path6, atime, mtime) {
1091
+ const fd = fs4.openSync(path6, "r+");
1092
+ fs4.futimesSync(fd, atime, mtime);
1093
+ return fs4.closeSync(fd);
1094
+ }
1095
+ module2.exports = {
1096
+ utimesMillis: u(utimesMillis),
1097
+ utimesMillisSync
1098
+ };
1099
+ }
1100
+ });
1101
+ var require_stat = (0, import_chunk_QGM4M3NI.__commonJS)({
1102
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/util/stat.js"(exports, module2) {
1103
+ "use strict";
1104
+ var fs4 = require_fs();
1105
+ var path6 = (0, import_chunk_QGM4M3NI.__require)("path");
1106
+ var u = require_universalify().fromPromise;
1107
+ function getStats(src, dest, opts) {
1108
+ const statFunc = opts.dereference ? (file) => fs4.stat(file, { bigint: true }) : (file) => fs4.lstat(file, { bigint: true });
1109
+ return Promise.all([
1110
+ statFunc(src),
1111
+ statFunc(dest).catch((err) => {
1112
+ if (err.code === "ENOENT") return null;
1113
+ throw err;
1114
+ })
1115
+ ]).then(([srcStat, destStat]) => ({ srcStat, destStat }));
1116
+ }
1117
+ function getStatsSync(src, dest, opts) {
1118
+ let destStat;
1119
+ const statFunc = opts.dereference ? (file) => fs4.statSync(file, { bigint: true }) : (file) => fs4.lstatSync(file, { bigint: true });
1120
+ const srcStat = statFunc(src);
1121
+ try {
1122
+ destStat = statFunc(dest);
1123
+ } catch (err) {
1124
+ if (err.code === "ENOENT") return { srcStat, destStat: null };
1125
+ throw err;
1126
+ }
1127
+ return { srcStat, destStat };
1128
+ }
1129
+ async function checkPaths(src, dest, funcName, opts) {
1130
+ const { srcStat, destStat } = await getStats(src, dest, opts);
1131
+ if (destStat) {
1132
+ if (areIdentical(srcStat, destStat)) {
1133
+ const srcBaseName = path6.basename(src);
1134
+ const destBaseName = path6.basename(dest);
1135
+ if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1136
+ return { srcStat, destStat, isChangingCase: true };
1137
+ }
1138
+ throw new Error("Source and destination must not be the same.");
1139
+ }
1140
+ if (srcStat.isDirectory() && !destStat.isDirectory()) {
1141
+ throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
1142
+ }
1143
+ if (!srcStat.isDirectory() && destStat.isDirectory()) {
1144
+ throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
1145
+ }
1146
+ }
1147
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
1148
+ throw new Error(errMsg(src, dest, funcName));
1149
+ }
1150
+ return { srcStat, destStat };
1151
+ }
1152
+ function checkPathsSync(src, dest, funcName, opts) {
1153
+ const { srcStat, destStat } = getStatsSync(src, dest, opts);
1154
+ if (destStat) {
1155
+ if (areIdentical(srcStat, destStat)) {
1156
+ const srcBaseName = path6.basename(src);
1157
+ const destBaseName = path6.basename(dest);
1158
+ if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1159
+ return { srcStat, destStat, isChangingCase: true };
1160
+ }
1161
+ throw new Error("Source and destination must not be the same.");
1162
+ }
1163
+ if (srcStat.isDirectory() && !destStat.isDirectory()) {
1164
+ throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
1165
+ }
1166
+ if (!srcStat.isDirectory() && destStat.isDirectory()) {
1167
+ throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
1168
+ }
1169
+ }
1170
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
1171
+ throw new Error(errMsg(src, dest, funcName));
1172
+ }
1173
+ return { srcStat, destStat };
1174
+ }
1175
+ async function checkParentPaths(src, srcStat, dest, funcName) {
1176
+ const srcParent = path6.resolve(path6.dirname(src));
1177
+ const destParent = path6.resolve(path6.dirname(dest));
1178
+ if (destParent === srcParent || destParent === path6.parse(destParent).root) return;
1179
+ let destStat;
1180
+ try {
1181
+ destStat = await fs4.stat(destParent, { bigint: true });
1182
+ } catch (err) {
1183
+ if (err.code === "ENOENT") return;
1184
+ throw err;
1185
+ }
1186
+ if (areIdentical(srcStat, destStat)) {
1187
+ throw new Error(errMsg(src, dest, funcName));
1188
+ }
1189
+ return checkParentPaths(src, srcStat, destParent, funcName);
1190
+ }
1191
+ function checkParentPathsSync(src, srcStat, dest, funcName) {
1192
+ const srcParent = path6.resolve(path6.dirname(src));
1193
+ const destParent = path6.resolve(path6.dirname(dest));
1194
+ if (destParent === srcParent || destParent === path6.parse(destParent).root) return;
1195
+ let destStat;
1196
+ try {
1197
+ destStat = fs4.statSync(destParent, { bigint: true });
1198
+ } catch (err) {
1199
+ if (err.code === "ENOENT") return;
1200
+ throw err;
1201
+ }
1202
+ if (areIdentical(srcStat, destStat)) {
1203
+ throw new Error(errMsg(src, dest, funcName));
1204
+ }
1205
+ return checkParentPathsSync(src, srcStat, destParent, funcName);
1206
+ }
1207
+ function areIdentical(srcStat, destStat) {
1208
+ return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
1209
+ }
1210
+ function isSrcSubdir(src, dest) {
1211
+ const srcArr = path6.resolve(src).split(path6.sep).filter((i) => i);
1212
+ const destArr = path6.resolve(dest).split(path6.sep).filter((i) => i);
1213
+ return srcArr.every((cur, i) => destArr[i] === cur);
1214
+ }
1215
+ function errMsg(src, dest, funcName) {
1216
+ return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
1217
+ }
1218
+ module2.exports = {
1219
+ // checkPaths
1220
+ checkPaths: u(checkPaths),
1221
+ checkPathsSync,
1222
+ // checkParent
1223
+ checkParentPaths: u(checkParentPaths),
1224
+ checkParentPathsSync,
1225
+ // Misc
1226
+ isSrcSubdir,
1227
+ areIdentical
1228
+ };
1229
+ }
1230
+ });
1231
+ var require_copy = (0, import_chunk_QGM4M3NI.__commonJS)({
1232
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/copy.js"(exports, module2) {
1233
+ "use strict";
1234
+ var fs4 = require_fs();
1235
+ var path6 = (0, import_chunk_QGM4M3NI.__require)("path");
1236
+ var { mkdirs } = require_mkdirs();
1237
+ var { pathExists: pathExists2 } = require_path_exists();
1238
+ var { utimesMillis } = require_utimes();
1239
+ var stat = require_stat();
1240
+ async function copy(src, dest, opts = {}) {
1241
+ if (typeof opts === "function") {
1242
+ opts = { filter: opts };
1243
+ }
1244
+ opts.clobber = "clobber" in opts ? !!opts.clobber : true;
1245
+ opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
1246
+ if (opts.preserveTimestamps && process.arch === "ia32") {
1247
+ process.emitWarning(
1248
+ "Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
1249
+ "Warning",
1250
+ "fs-extra-WARN0001"
1251
+ );
1252
+ }
1253
+ const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts);
1254
+ await stat.checkParentPaths(src, srcStat, dest, "copy");
1255
+ const include = await runFilter(src, dest, opts);
1256
+ if (!include) return;
1257
+ const destParent = path6.dirname(dest);
1258
+ const dirExists = await pathExists2(destParent);
1259
+ if (!dirExists) {
1260
+ await mkdirs(destParent);
1261
+ }
1262
+ await getStatsAndPerformCopy(destStat, src, dest, opts);
1263
+ }
1264
+ async function runFilter(src, dest, opts) {
1265
+ if (!opts.filter) return true;
1266
+ return opts.filter(src, dest);
1267
+ }
1268
+ async function getStatsAndPerformCopy(destStat, src, dest, opts) {
1269
+ const statFn = opts.dereference ? fs4.stat : fs4.lstat;
1270
+ const srcStat = await statFn(src);
1271
+ if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
1272
+ if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
1273
+ if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
1274
+ if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
1275
+ if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
1276
+ throw new Error(`Unknown file: ${src}`);
1277
+ }
1278
+ async function onFile(srcStat, destStat, src, dest, opts) {
1279
+ if (!destStat) return copyFile(srcStat, src, dest, opts);
1280
+ if (opts.overwrite) {
1281
+ await fs4.unlink(dest);
1282
+ return copyFile(srcStat, src, dest, opts);
1283
+ }
1284
+ if (opts.errorOnExist) {
1285
+ throw new Error(`'${dest}' already exists`);
1286
+ }
1287
+ }
1288
+ async function copyFile(srcStat, src, dest, opts) {
1289
+ await fs4.copyFile(src, dest);
1290
+ if (opts.preserveTimestamps) {
1291
+ if (fileIsNotWritable(srcStat.mode)) {
1292
+ await makeFileWritable(dest, srcStat.mode);
1293
+ }
1294
+ const updatedSrcStat = await fs4.stat(src);
1295
+ await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
1296
+ }
1297
+ return fs4.chmod(dest, srcStat.mode);
1298
+ }
1299
+ function fileIsNotWritable(srcMode) {
1300
+ return (srcMode & 128) === 0;
1301
+ }
1302
+ function makeFileWritable(dest, srcMode) {
1303
+ return fs4.chmod(dest, srcMode | 128);
1304
+ }
1305
+ async function onDir(srcStat, destStat, src, dest, opts) {
1306
+ if (!destStat) {
1307
+ await fs4.mkdir(dest);
1308
+ }
1309
+ const promises = [];
1310
+ for await (const item of await fs4.opendir(src)) {
1311
+ const srcItem = path6.join(src, item.name);
1312
+ const destItem = path6.join(dest, item.name);
1313
+ promises.push(
1314
+ runFilter(srcItem, destItem, opts).then((include) => {
1315
+ if (include) {
1316
+ return stat.checkPaths(srcItem, destItem, "copy", opts).then(({ destStat: destStat2 }) => {
1317
+ return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts);
1318
+ });
1319
+ }
1320
+ })
1321
+ );
1322
+ }
1323
+ await Promise.all(promises);
1324
+ if (!destStat) {
1325
+ await fs4.chmod(dest, srcStat.mode);
1326
+ }
1327
+ }
1328
+ async function onLink(destStat, src, dest, opts) {
1329
+ let resolvedSrc = await fs4.readlink(src);
1330
+ if (opts.dereference) {
1331
+ resolvedSrc = path6.resolve(process.cwd(), resolvedSrc);
1332
+ }
1333
+ if (!destStat) {
1334
+ return fs4.symlink(resolvedSrc, dest);
1335
+ }
1336
+ let resolvedDest = null;
1337
+ try {
1338
+ resolvedDest = await fs4.readlink(dest);
1339
+ } catch (e) {
1340
+ if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs4.symlink(resolvedSrc, dest);
1341
+ throw e;
1342
+ }
1343
+ if (opts.dereference) {
1344
+ resolvedDest = path6.resolve(process.cwd(), resolvedDest);
1345
+ }
1346
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
1347
+ throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
1348
+ }
1349
+ if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
1350
+ throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
1351
+ }
1352
+ await fs4.unlink(dest);
1353
+ return fs4.symlink(resolvedSrc, dest);
1354
+ }
1355
+ module2.exports = copy;
1356
+ }
1357
+ });
1358
+ var require_copy_sync = (0, import_chunk_QGM4M3NI.__commonJS)({
1359
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/copy-sync.js"(exports, module2) {
1360
+ "use strict";
1361
+ var fs4 = require_graceful_fs();
1362
+ var path6 = (0, import_chunk_QGM4M3NI.__require)("path");
1363
+ var mkdirsSync = require_mkdirs().mkdirsSync;
1364
+ var utimesMillisSync = require_utimes().utimesMillisSync;
1365
+ var stat = require_stat();
1366
+ function copySync(src, dest, opts) {
1367
+ if (typeof opts === "function") {
1368
+ opts = { filter: opts };
1369
+ }
1370
+ opts = opts || {};
1371
+ opts.clobber = "clobber" in opts ? !!opts.clobber : true;
1372
+ opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
1373
+ if (opts.preserveTimestamps && process.arch === "ia32") {
1374
+ process.emitWarning(
1375
+ "Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
1376
+ "Warning",
1377
+ "fs-extra-WARN0002"
1378
+ );
1379
+ }
1380
+ const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
1381
+ stat.checkParentPathsSync(src, srcStat, dest, "copy");
1382
+ if (opts.filter && !opts.filter(src, dest)) return;
1383
+ const destParent = path6.dirname(dest);
1384
+ if (!fs4.existsSync(destParent)) mkdirsSync(destParent);
1385
+ return getStats(destStat, src, dest, opts);
1386
+ }
1387
+ function getStats(destStat, src, dest, opts) {
1388
+ const statSync = opts.dereference ? fs4.statSync : fs4.lstatSync;
1389
+ const srcStat = statSync(src);
1390
+ if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
1391
+ else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
1392
+ else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
1393
+ else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
1394
+ else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
1395
+ throw new Error(`Unknown file: ${src}`);
1396
+ }
1397
+ function onFile(srcStat, destStat, src, dest, opts) {
1398
+ if (!destStat) return copyFile(srcStat, src, dest, opts);
1399
+ return mayCopyFile(srcStat, src, dest, opts);
1400
+ }
1401
+ function mayCopyFile(srcStat, src, dest, opts) {
1402
+ if (opts.overwrite) {
1403
+ fs4.unlinkSync(dest);
1404
+ return copyFile(srcStat, src, dest, opts);
1405
+ } else if (opts.errorOnExist) {
1406
+ throw new Error(`'${dest}' already exists`);
1407
+ }
1408
+ }
1409
+ function copyFile(srcStat, src, dest, opts) {
1410
+ fs4.copyFileSync(src, dest);
1411
+ if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
1412
+ return setDestMode(dest, srcStat.mode);
1413
+ }
1414
+ function handleTimestamps(srcMode, src, dest) {
1415
+ if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode);
1416
+ return setDestTimestamps(src, dest);
1417
+ }
1418
+ function fileIsNotWritable(srcMode) {
1419
+ return (srcMode & 128) === 0;
1420
+ }
1421
+ function makeFileWritable(dest, srcMode) {
1422
+ return setDestMode(dest, srcMode | 128);
1423
+ }
1424
+ function setDestMode(dest, srcMode) {
1425
+ return fs4.chmodSync(dest, srcMode);
1426
+ }
1427
+ function setDestTimestamps(src, dest) {
1428
+ const updatedSrcStat = fs4.statSync(src);
1429
+ return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
1430
+ }
1431
+ function onDir(srcStat, destStat, src, dest, opts) {
1432
+ if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts);
1433
+ return copyDir(src, dest, opts);
1434
+ }
1435
+ function mkDirAndCopy(srcMode, src, dest, opts) {
1436
+ fs4.mkdirSync(dest);
1437
+ copyDir(src, dest, opts);
1438
+ return setDestMode(dest, srcMode);
1439
+ }
1440
+ function copyDir(src, dest, opts) {
1441
+ const dir = fs4.opendirSync(src);
1442
+ try {
1443
+ let dirent;
1444
+ while ((dirent = dir.readSync()) !== null) {
1445
+ copyDirItem(dirent.name, src, dest, opts);
1446
+ }
1447
+ } finally {
1448
+ dir.closeSync();
1449
+ }
1450
+ }
1451
+ function copyDirItem(item, src, dest, opts) {
1452
+ const srcItem = path6.join(src, item);
1453
+ const destItem = path6.join(dest, item);
1454
+ if (opts.filter && !opts.filter(srcItem, destItem)) return;
1455
+ const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
1456
+ return getStats(destStat, srcItem, destItem, opts);
1457
+ }
1458
+ function onLink(destStat, src, dest, opts) {
1459
+ let resolvedSrc = fs4.readlinkSync(src);
1460
+ if (opts.dereference) {
1461
+ resolvedSrc = path6.resolve(process.cwd(), resolvedSrc);
1462
+ }
1463
+ if (!destStat) {
1464
+ return fs4.symlinkSync(resolvedSrc, dest);
1465
+ } else {
1466
+ let resolvedDest;
1467
+ try {
1468
+ resolvedDest = fs4.readlinkSync(dest);
1469
+ } catch (err) {
1470
+ if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs4.symlinkSync(resolvedSrc, dest);
1471
+ throw err;
1472
+ }
1473
+ if (opts.dereference) {
1474
+ resolvedDest = path6.resolve(process.cwd(), resolvedDest);
1475
+ }
1476
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
1477
+ throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
1478
+ }
1479
+ if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
1480
+ throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
1481
+ }
1482
+ return copyLink(resolvedSrc, dest);
1483
+ }
1484
+ }
1485
+ function copyLink(resolvedSrc, dest) {
1486
+ fs4.unlinkSync(dest);
1487
+ return fs4.symlinkSync(resolvedSrc, dest);
1488
+ }
1489
+ module2.exports = copySync;
1490
+ }
1491
+ });
1492
+ var require_copy2 = (0, import_chunk_QGM4M3NI.__commonJS)({
1493
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/index.js"(exports, module2) {
1494
+ "use strict";
1495
+ var u = require_universalify().fromPromise;
1496
+ module2.exports = {
1497
+ copy: u(require_copy()),
1498
+ copySync: require_copy_sync()
1499
+ };
1500
+ }
1501
+ });
1502
+ var require_remove = (0, import_chunk_QGM4M3NI.__commonJS)({
1503
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/remove/index.js"(exports, module2) {
1504
+ "use strict";
1505
+ var fs4 = require_graceful_fs();
1506
+ var u = require_universalify().fromCallback;
1507
+ function remove(path6, callback) {
1508
+ fs4.rm(path6, { recursive: true, force: true }, callback);
1509
+ }
1510
+ function removeSync(path6) {
1511
+ fs4.rmSync(path6, { recursive: true, force: true });
1512
+ }
1513
+ module2.exports = {
1514
+ remove: u(remove),
1515
+ removeSync
1516
+ };
1517
+ }
1518
+ });
1519
+ var require_empty = (0, import_chunk_QGM4M3NI.__commonJS)({
1520
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/empty/index.js"(exports, module2) {
1521
+ "use strict";
1522
+ var u = require_universalify().fromPromise;
1523
+ var fs4 = require_fs();
1524
+ var path6 = (0, import_chunk_QGM4M3NI.__require)("path");
1525
+ var mkdir = require_mkdirs();
1526
+ var remove = require_remove();
1527
+ var emptyDir = u(async function emptyDir2(dir) {
1528
+ let items;
1529
+ try {
1530
+ items = await fs4.readdir(dir);
1531
+ } catch {
1532
+ return mkdir.mkdirs(dir);
1533
+ }
1534
+ return Promise.all(items.map((item) => remove.remove(path6.join(dir, item))));
1535
+ });
1536
+ function emptyDirSync(dir) {
1537
+ let items;
1538
+ try {
1539
+ items = fs4.readdirSync(dir);
1540
+ } catch {
1541
+ return mkdir.mkdirsSync(dir);
1542
+ }
1543
+ items.forEach((item) => {
1544
+ item = path6.join(dir, item);
1545
+ remove.removeSync(item);
1546
+ });
1547
+ }
1548
+ module2.exports = {
1549
+ emptyDirSync,
1550
+ emptydirSync: emptyDirSync,
1551
+ emptyDir,
1552
+ emptydir: emptyDir
1553
+ };
1554
+ }
1555
+ });
1556
+ var require_file = (0, import_chunk_QGM4M3NI.__commonJS)({
1557
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/file.js"(exports, module2) {
1558
+ "use strict";
1559
+ var u = require_universalify().fromPromise;
1560
+ var path6 = (0, import_chunk_QGM4M3NI.__require)("path");
1561
+ var fs4 = require_fs();
1562
+ var mkdir = require_mkdirs();
1563
+ async function createFile(file) {
1564
+ let stats;
1565
+ try {
1566
+ stats = await fs4.stat(file);
1567
+ } catch {
1568
+ }
1569
+ if (stats && stats.isFile()) return;
1570
+ const dir = path6.dirname(file);
1571
+ let dirStats = null;
1572
+ try {
1573
+ dirStats = await fs4.stat(dir);
1574
+ } catch (err) {
1575
+ if (err.code === "ENOENT") {
1576
+ await mkdir.mkdirs(dir);
1577
+ await fs4.writeFile(file, "");
1578
+ return;
1579
+ } else {
1580
+ throw err;
1581
+ }
1582
+ }
1583
+ if (dirStats.isDirectory()) {
1584
+ await fs4.writeFile(file, "");
1585
+ } else {
1586
+ await fs4.readdir(dir);
1587
+ }
1588
+ }
1589
+ function createFileSync(file) {
1590
+ let stats;
1591
+ try {
1592
+ stats = fs4.statSync(file);
1593
+ } catch {
1594
+ }
1595
+ if (stats && stats.isFile()) return;
1596
+ const dir = path6.dirname(file);
1597
+ try {
1598
+ if (!fs4.statSync(dir).isDirectory()) {
1599
+ fs4.readdirSync(dir);
1600
+ }
1601
+ } catch (err) {
1602
+ if (err && err.code === "ENOENT") mkdir.mkdirsSync(dir);
1603
+ else throw err;
1604
+ }
1605
+ fs4.writeFileSync(file, "");
1606
+ }
1607
+ module2.exports = {
1608
+ createFile: u(createFile),
1609
+ createFileSync
1610
+ };
1611
+ }
1612
+ });
1613
+ var require_link = (0, import_chunk_QGM4M3NI.__commonJS)({
1614
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/link.js"(exports, module2) {
1615
+ "use strict";
1616
+ var u = require_universalify().fromPromise;
1617
+ var path6 = (0, import_chunk_QGM4M3NI.__require)("path");
1618
+ var fs4 = require_fs();
1619
+ var mkdir = require_mkdirs();
1620
+ var { pathExists: pathExists2 } = require_path_exists();
1621
+ var { areIdentical } = require_stat();
1622
+ async function createLink(srcpath, dstpath) {
1623
+ let dstStat;
1624
+ try {
1625
+ dstStat = await fs4.lstat(dstpath);
1626
+ } catch {
1627
+ }
1628
+ let srcStat;
1629
+ try {
1630
+ srcStat = await fs4.lstat(srcpath);
1631
+ } catch (err) {
1632
+ err.message = err.message.replace("lstat", "ensureLink");
1633
+ throw err;
1634
+ }
1635
+ if (dstStat && areIdentical(srcStat, dstStat)) return;
1636
+ const dir = path6.dirname(dstpath);
1637
+ const dirExists = await pathExists2(dir);
1638
+ if (!dirExists) {
1639
+ await mkdir.mkdirs(dir);
1640
+ }
1641
+ await fs4.link(srcpath, dstpath);
1642
+ }
1643
+ function createLinkSync(srcpath, dstpath) {
1644
+ let dstStat;
1645
+ try {
1646
+ dstStat = fs4.lstatSync(dstpath);
1647
+ } catch {
1648
+ }
1649
+ try {
1650
+ const srcStat = fs4.lstatSync(srcpath);
1651
+ if (dstStat && areIdentical(srcStat, dstStat)) return;
1652
+ } catch (err) {
1653
+ err.message = err.message.replace("lstat", "ensureLink");
1654
+ throw err;
1655
+ }
1656
+ const dir = path6.dirname(dstpath);
1657
+ const dirExists = fs4.existsSync(dir);
1658
+ if (dirExists) return fs4.linkSync(srcpath, dstpath);
1659
+ mkdir.mkdirsSync(dir);
1660
+ return fs4.linkSync(srcpath, dstpath);
1661
+ }
1662
+ module2.exports = {
1663
+ createLink: u(createLink),
1664
+ createLinkSync
1665
+ };
1666
+ }
1667
+ });
1668
+ var require_symlink_paths = (0, import_chunk_QGM4M3NI.__commonJS)({
1669
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module2) {
1670
+ "use strict";
1671
+ var path6 = (0, import_chunk_QGM4M3NI.__require)("path");
1672
+ var fs4 = require_fs();
1673
+ var { pathExists: pathExists2 } = require_path_exists();
1674
+ var u = require_universalify().fromPromise;
1675
+ async function symlinkPaths(srcpath, dstpath) {
1676
+ if (path6.isAbsolute(srcpath)) {
1677
+ try {
1678
+ await fs4.lstat(srcpath);
1679
+ } catch (err) {
1680
+ err.message = err.message.replace("lstat", "ensureSymlink");
1681
+ throw err;
1682
+ }
1683
+ return {
1684
+ toCwd: srcpath,
1685
+ toDst: srcpath
1686
+ };
1687
+ }
1688
+ const dstdir = path6.dirname(dstpath);
1689
+ const relativeToDst = path6.join(dstdir, srcpath);
1690
+ const exists = await pathExists2(relativeToDst);
1691
+ if (exists) {
1692
+ return {
1693
+ toCwd: relativeToDst,
1694
+ toDst: srcpath
1695
+ };
1696
+ }
1697
+ try {
1698
+ await fs4.lstat(srcpath);
1699
+ } catch (err) {
1700
+ err.message = err.message.replace("lstat", "ensureSymlink");
1701
+ throw err;
1702
+ }
1703
+ return {
1704
+ toCwd: srcpath,
1705
+ toDst: path6.relative(dstdir, srcpath)
1706
+ };
1707
+ }
1708
+ function symlinkPathsSync(srcpath, dstpath) {
1709
+ if (path6.isAbsolute(srcpath)) {
1710
+ const exists2 = fs4.existsSync(srcpath);
1711
+ if (!exists2) throw new Error("absolute srcpath does not exist");
1712
+ return {
1713
+ toCwd: srcpath,
1714
+ toDst: srcpath
1715
+ };
1716
+ }
1717
+ const dstdir = path6.dirname(dstpath);
1718
+ const relativeToDst = path6.join(dstdir, srcpath);
1719
+ const exists = fs4.existsSync(relativeToDst);
1720
+ if (exists) {
1721
+ return {
1722
+ toCwd: relativeToDst,
1723
+ toDst: srcpath
1724
+ };
1725
+ }
1726
+ const srcExists = fs4.existsSync(srcpath);
1727
+ if (!srcExists) throw new Error("relative srcpath does not exist");
1728
+ return {
1729
+ toCwd: srcpath,
1730
+ toDst: path6.relative(dstdir, srcpath)
1731
+ };
1732
+ }
1733
+ module2.exports = {
1734
+ symlinkPaths: u(symlinkPaths),
1735
+ symlinkPathsSync
1736
+ };
1737
+ }
1738
+ });
1739
+ var require_symlink_type = (0, import_chunk_QGM4M3NI.__commonJS)({
1740
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports, module2) {
1741
+ "use strict";
1742
+ var fs4 = require_fs();
1743
+ var u = require_universalify().fromPromise;
1744
+ async function symlinkType(srcpath, type) {
1745
+ if (type) return type;
1746
+ let stats;
1747
+ try {
1748
+ stats = await fs4.lstat(srcpath);
1749
+ } catch {
1750
+ return "file";
1751
+ }
1752
+ return stats && stats.isDirectory() ? "dir" : "file";
1753
+ }
1754
+ function symlinkTypeSync(srcpath, type) {
1755
+ if (type) return type;
1756
+ let stats;
1757
+ try {
1758
+ stats = fs4.lstatSync(srcpath);
1759
+ } catch {
1760
+ return "file";
1761
+ }
1762
+ return stats && stats.isDirectory() ? "dir" : "file";
1763
+ }
1764
+ module2.exports = {
1765
+ symlinkType: u(symlinkType),
1766
+ symlinkTypeSync
1767
+ };
1768
+ }
1769
+ });
1770
+ var require_symlink = (0, import_chunk_QGM4M3NI.__commonJS)({
1771
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink.js"(exports, module2) {
1772
+ "use strict";
1773
+ var u = require_universalify().fromPromise;
1774
+ var path6 = (0, import_chunk_QGM4M3NI.__require)("path");
1775
+ var fs4 = require_fs();
1776
+ var { mkdirs, mkdirsSync } = require_mkdirs();
1777
+ var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
1778
+ var { symlinkType, symlinkTypeSync } = require_symlink_type();
1779
+ var { pathExists: pathExists2 } = require_path_exists();
1780
+ var { areIdentical } = require_stat();
1781
+ async function createSymlink(srcpath, dstpath, type) {
1782
+ let stats;
1783
+ try {
1784
+ stats = await fs4.lstat(dstpath);
1785
+ } catch {
1786
+ }
1787
+ if (stats && stats.isSymbolicLink()) {
1788
+ const [srcStat, dstStat] = await Promise.all([
1789
+ fs4.stat(srcpath),
1790
+ fs4.stat(dstpath)
1791
+ ]);
1792
+ if (areIdentical(srcStat, dstStat)) return;
1793
+ }
1794
+ const relative = await symlinkPaths(srcpath, dstpath);
1795
+ srcpath = relative.toDst;
1796
+ const toType = await symlinkType(relative.toCwd, type);
1797
+ const dir = path6.dirname(dstpath);
1798
+ if (!await pathExists2(dir)) {
1799
+ await mkdirs(dir);
1800
+ }
1801
+ return fs4.symlink(srcpath, dstpath, toType);
1802
+ }
1803
+ function createSymlinkSync(srcpath, dstpath, type) {
1804
+ let stats;
1805
+ try {
1806
+ stats = fs4.lstatSync(dstpath);
1807
+ } catch {
1808
+ }
1809
+ if (stats && stats.isSymbolicLink()) {
1810
+ const srcStat = fs4.statSync(srcpath);
1811
+ const dstStat = fs4.statSync(dstpath);
1812
+ if (areIdentical(srcStat, dstStat)) return;
1813
+ }
1814
+ const relative = symlinkPathsSync(srcpath, dstpath);
1815
+ srcpath = relative.toDst;
1816
+ type = symlinkTypeSync(relative.toCwd, type);
1817
+ const dir = path6.dirname(dstpath);
1818
+ const exists = fs4.existsSync(dir);
1819
+ if (exists) return fs4.symlinkSync(srcpath, dstpath, type);
1820
+ mkdirsSync(dir);
1821
+ return fs4.symlinkSync(srcpath, dstpath, type);
1822
+ }
1823
+ module2.exports = {
1824
+ createSymlink: u(createSymlink),
1825
+ createSymlinkSync
1826
+ };
1827
+ }
1828
+ });
1829
+ var require_ensure = (0, import_chunk_QGM4M3NI.__commonJS)({
1830
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/index.js"(exports, module2) {
1831
+ "use strict";
1832
+ var { createFile, createFileSync } = require_file();
1833
+ var { createLink, createLinkSync } = require_link();
1834
+ var { createSymlink, createSymlinkSync } = require_symlink();
1835
+ module2.exports = {
1836
+ // file
1837
+ createFile,
1838
+ createFileSync,
1839
+ ensureFile: createFile,
1840
+ ensureFileSync: createFileSync,
1841
+ // link
1842
+ createLink,
1843
+ createLinkSync,
1844
+ ensureLink: createLink,
1845
+ ensureLinkSync: createLinkSync,
1846
+ // symlink
1847
+ createSymlink,
1848
+ createSymlinkSync,
1849
+ ensureSymlink: createSymlink,
1850
+ ensureSymlinkSync: createSymlinkSync
1851
+ };
1852
+ }
1853
+ });
1854
+ var require_utils2 = (0, import_chunk_QGM4M3NI.__commonJS)({
1855
+ "../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js"(exports, module2) {
1856
+ "use strict";
1857
+ function stringify(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
1858
+ const EOF = finalEOL ? EOL : "";
1859
+ const str = JSON.stringify(obj, replacer, spaces);
1860
+ return str.replace(/\n/g, EOL) + EOF;
1861
+ }
1862
+ function stripBom(content) {
1863
+ if (Buffer.isBuffer(content)) content = content.toString("utf8");
1864
+ return content.replace(/^\uFEFF/, "");
1865
+ }
1866
+ module2.exports = { stringify, stripBom };
1867
+ }
1868
+ });
1869
+ var require_jsonfile = (0, import_chunk_QGM4M3NI.__commonJS)({
1870
+ "../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js"(exports, module2) {
1871
+ "use strict";
1872
+ var _fs;
1873
+ try {
1874
+ _fs = require_graceful_fs();
1875
+ } catch (_) {
1876
+ _fs = (0, import_chunk_QGM4M3NI.__require)("fs");
1877
+ }
1878
+ var universalify = require_universalify();
1879
+ var { stringify, stripBom } = require_utils2();
1880
+ async function _readFile(file, options = {}) {
1881
+ if (typeof options === "string") {
1882
+ options = { encoding: options };
1883
+ }
1884
+ const fs4 = options.fs || _fs;
1885
+ const shouldThrow = "throws" in options ? options.throws : true;
1886
+ let data = await universalify.fromCallback(fs4.readFile)(file, options);
1887
+ data = stripBom(data);
1888
+ let obj;
1889
+ try {
1890
+ obj = JSON.parse(data, options ? options.reviver : null);
1891
+ } catch (err) {
1892
+ if (shouldThrow) {
1893
+ err.message = `${file}: ${err.message}`;
1894
+ throw err;
1895
+ } else {
1896
+ return null;
1897
+ }
1898
+ }
1899
+ return obj;
1900
+ }
1901
+ var readFile = universalify.fromPromise(_readFile);
1902
+ function readFileSync(file, options = {}) {
1903
+ if (typeof options === "string") {
1904
+ options = { encoding: options };
1905
+ }
1906
+ const fs4 = options.fs || _fs;
1907
+ const shouldThrow = "throws" in options ? options.throws : true;
1908
+ try {
1909
+ let content = fs4.readFileSync(file, options);
1910
+ content = stripBom(content);
1911
+ return JSON.parse(content, options.reviver);
1912
+ } catch (err) {
1913
+ if (shouldThrow) {
1914
+ err.message = `${file}: ${err.message}`;
1915
+ throw err;
1916
+ } else {
1917
+ return null;
1918
+ }
1919
+ }
1920
+ }
1921
+ async function _writeFile(file, obj, options = {}) {
1922
+ const fs4 = options.fs || _fs;
1923
+ const str = stringify(obj, options);
1924
+ await universalify.fromCallback(fs4.writeFile)(file, str, options);
1925
+ }
1926
+ var writeFile = universalify.fromPromise(_writeFile);
1927
+ function writeFileSync(file, obj, options = {}) {
1928
+ const fs4 = options.fs || _fs;
1929
+ const str = stringify(obj, options);
1930
+ return fs4.writeFileSync(file, str, options);
1931
+ }
1932
+ var jsonfile = {
1933
+ readFile,
1934
+ readFileSync,
1935
+ writeFile,
1936
+ writeFileSync
1937
+ };
1938
+ module2.exports = jsonfile;
1939
+ }
1940
+ });
1941
+ var require_jsonfile2 = (0, import_chunk_QGM4M3NI.__commonJS)({
1942
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/jsonfile.js"(exports, module2) {
1943
+ "use strict";
1944
+ var jsonFile = require_jsonfile();
1945
+ module2.exports = {
1946
+ // jsonfile exports
1947
+ readJson: jsonFile.readFile,
1948
+ readJsonSync: jsonFile.readFileSync,
1949
+ writeJson: jsonFile.writeFile,
1950
+ writeJsonSync: jsonFile.writeFileSync
1951
+ };
1952
+ }
1953
+ });
1954
+ var require_output_file = (0, import_chunk_QGM4M3NI.__commonJS)({
1955
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/output-file/index.js"(exports, module2) {
1956
+ "use strict";
1957
+ var u = require_universalify().fromPromise;
1958
+ var fs4 = require_fs();
1959
+ var path6 = (0, import_chunk_QGM4M3NI.__require)("path");
1960
+ var mkdir = require_mkdirs();
1961
+ var pathExists2 = require_path_exists().pathExists;
1962
+ async function outputFile(file, data, encoding = "utf-8") {
1963
+ const dir = path6.dirname(file);
1964
+ if (!await pathExists2(dir)) {
1965
+ await mkdir.mkdirs(dir);
1966
+ }
1967
+ return fs4.writeFile(file, data, encoding);
1968
+ }
1969
+ function outputFileSync(file, ...args) {
1970
+ const dir = path6.dirname(file);
1971
+ if (!fs4.existsSync(dir)) {
1972
+ mkdir.mkdirsSync(dir);
1973
+ }
1974
+ fs4.writeFileSync(file, ...args);
1975
+ }
1976
+ module2.exports = {
1977
+ outputFile: u(outputFile),
1978
+ outputFileSync
1979
+ };
1980
+ }
1981
+ });
1982
+ var require_output_json = (0, import_chunk_QGM4M3NI.__commonJS)({
1983
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/output-json.js"(exports, module2) {
1984
+ "use strict";
1985
+ var { stringify } = require_utils2();
1986
+ var { outputFile } = require_output_file();
1987
+ async function outputJson(file, data, options = {}) {
1988
+ const str = stringify(data, options);
1989
+ await outputFile(file, str, options);
1990
+ }
1991
+ module2.exports = outputJson;
1992
+ }
1993
+ });
1994
+ var require_output_json_sync = (0, import_chunk_QGM4M3NI.__commonJS)({
1995
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/output-json-sync.js"(exports, module2) {
1996
+ "use strict";
1997
+ var { stringify } = require_utils2();
1998
+ var { outputFileSync } = require_output_file();
1999
+ function outputJsonSync(file, data, options) {
2000
+ const str = stringify(data, options);
2001
+ outputFileSync(file, str, options);
2002
+ }
2003
+ module2.exports = outputJsonSync;
2004
+ }
2005
+ });
2006
+ var require_json = (0, import_chunk_QGM4M3NI.__commonJS)({
2007
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/index.js"(exports, module2) {
2008
+ "use strict";
2009
+ var u = require_universalify().fromPromise;
2010
+ var jsonFile = require_jsonfile2();
2011
+ jsonFile.outputJson = u(require_output_json());
2012
+ jsonFile.outputJsonSync = require_output_json_sync();
2013
+ jsonFile.outputJSON = jsonFile.outputJson;
2014
+ jsonFile.outputJSONSync = jsonFile.outputJsonSync;
2015
+ jsonFile.writeJSON = jsonFile.writeJson;
2016
+ jsonFile.writeJSONSync = jsonFile.writeJsonSync;
2017
+ jsonFile.readJSON = jsonFile.readJson;
2018
+ jsonFile.readJSONSync = jsonFile.readJsonSync;
2019
+ module2.exports = jsonFile;
2020
+ }
2021
+ });
2022
+ var require_move = (0, import_chunk_QGM4M3NI.__commonJS)({
2023
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/move.js"(exports, module2) {
2024
+ "use strict";
2025
+ var fs4 = require_fs();
2026
+ var path6 = (0, import_chunk_QGM4M3NI.__require)("path");
2027
+ var { copy } = require_copy2();
2028
+ var { remove } = require_remove();
2029
+ var { mkdirp } = require_mkdirs();
2030
+ var { pathExists: pathExists2 } = require_path_exists();
2031
+ var stat = require_stat();
2032
+ async function move(src, dest, opts = {}) {
2033
+ const overwrite = opts.overwrite || opts.clobber || false;
2034
+ const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
2035
+ await stat.checkParentPaths(src, srcStat, dest, "move");
2036
+ const destParent = path6.dirname(dest);
2037
+ const parsedParentPath = path6.parse(destParent);
2038
+ if (parsedParentPath.root !== destParent) {
2039
+ await mkdirp(destParent);
2040
+ }
2041
+ return doRename(src, dest, overwrite, isChangingCase);
2042
+ }
2043
+ async function doRename(src, dest, overwrite, isChangingCase) {
2044
+ if (!isChangingCase) {
2045
+ if (overwrite) {
2046
+ await remove(dest);
2047
+ } else if (await pathExists2(dest)) {
2048
+ throw new Error("dest already exists.");
2049
+ }
2050
+ }
2051
+ try {
2052
+ await fs4.rename(src, dest);
2053
+ } catch (err) {
2054
+ if (err.code !== "EXDEV") {
2055
+ throw err;
2056
+ }
2057
+ await moveAcrossDevice(src, dest, overwrite);
2058
+ }
2059
+ }
2060
+ async function moveAcrossDevice(src, dest, overwrite) {
2061
+ const opts = {
2062
+ overwrite,
2063
+ errorOnExist: true,
2064
+ preserveTimestamps: true
2065
+ };
2066
+ await copy(src, dest, opts);
2067
+ return remove(src);
2068
+ }
2069
+ module2.exports = move;
2070
+ }
2071
+ });
2072
+ var require_move_sync = (0, import_chunk_QGM4M3NI.__commonJS)({
2073
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/move-sync.js"(exports, module2) {
2074
+ "use strict";
2075
+ var fs4 = require_graceful_fs();
2076
+ var path6 = (0, import_chunk_QGM4M3NI.__require)("path");
2077
+ var copySync = require_copy2().copySync;
2078
+ var removeSync = require_remove().removeSync;
2079
+ var mkdirpSync = require_mkdirs().mkdirpSync;
2080
+ var stat = require_stat();
2081
+ function moveSync(src, dest, opts) {
2082
+ opts = opts || {};
2083
+ const overwrite = opts.overwrite || opts.clobber || false;
2084
+ const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
2085
+ stat.checkParentPathsSync(src, srcStat, dest, "move");
2086
+ if (!isParentRoot(dest)) mkdirpSync(path6.dirname(dest));
2087
+ return doRename(src, dest, overwrite, isChangingCase);
2088
+ }
2089
+ function isParentRoot(dest) {
2090
+ const parent = path6.dirname(dest);
2091
+ const parsedPath = path6.parse(parent);
2092
+ return parsedPath.root === parent;
2093
+ }
2094
+ function doRename(src, dest, overwrite, isChangingCase) {
2095
+ if (isChangingCase) return rename(src, dest, overwrite);
2096
+ if (overwrite) {
2097
+ removeSync(dest);
2098
+ return rename(src, dest, overwrite);
2099
+ }
2100
+ if (fs4.existsSync(dest)) throw new Error("dest already exists.");
2101
+ return rename(src, dest, overwrite);
2102
+ }
2103
+ function rename(src, dest, overwrite) {
2104
+ try {
2105
+ fs4.renameSync(src, dest);
2106
+ } catch (err) {
2107
+ if (err.code !== "EXDEV") throw err;
2108
+ return moveAcrossDevice(src, dest, overwrite);
2109
+ }
2110
+ }
2111
+ function moveAcrossDevice(src, dest, overwrite) {
2112
+ const opts = {
2113
+ overwrite,
2114
+ errorOnExist: true,
2115
+ preserveTimestamps: true
2116
+ };
2117
+ copySync(src, dest, opts);
2118
+ return removeSync(src);
2119
+ }
2120
+ module2.exports = moveSync;
2121
+ }
2122
+ });
2123
+ var require_move2 = (0, import_chunk_QGM4M3NI.__commonJS)({
2124
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/index.js"(exports, module2) {
2125
+ "use strict";
2126
+ var u = require_universalify().fromPromise;
2127
+ module2.exports = {
2128
+ move: u(require_move()),
2129
+ moveSync: require_move_sync()
2130
+ };
2131
+ }
2132
+ });
2133
+ var require_lib = (0, import_chunk_QGM4M3NI.__commonJS)({
2134
+ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/index.js"(exports, module2) {
2135
+ "use strict";
2136
+ module2.exports = {
2137
+ // Export promiseified graceful-fs:
2138
+ ...require_fs(),
2139
+ // Export extra methods:
2140
+ ...require_copy2(),
2141
+ ...require_empty(),
2142
+ ...require_ensure(),
2143
+ ...require_json(),
2144
+ ...require_mkdirs(),
2145
+ ...require_move2(),
2146
+ ...require_output_file(),
2147
+ ...require_path_exists(),
2148
+ ...require_remove()
2149
+ };
2150
+ }
2151
+ });
2152
+ var import_common_path_prefix = (0, import_chunk_QGM4M3NI.__toESM)(require_common_path_prefix(), 1);
2153
+ var typeMappings = {
2154
+ directory: "isDirectory",
2155
+ file: "isFile"
2156
+ };
2157
+ function checkType(type) {
2158
+ if (Object.hasOwnProperty.call(typeMappings, type)) {
2159
+ return;
2160
+ }
2161
+ throw new Error(`Invalid type specified: ${type}`);
2162
+ }
2163
+ var matchType = (type, stat) => stat[typeMappings[type]]();
2164
+ var toPath = (urlOrPath) => urlOrPath instanceof URL ? (0, import_node_url2.fileURLToPath)(urlOrPath) : urlOrPath;
2165
+ function locatePathSync(paths, {
2166
+ cwd: cwd2 = import_node_process2.default.cwd(),
2167
+ type = "file",
2168
+ allowSymlinks = true
2169
+ } = {}) {
2170
+ checkType(type);
2171
+ cwd2 = toPath(cwd2);
2172
+ const statFunction = allowSymlinks ? import_node_fs3.default.statSync : import_node_fs3.default.lstatSync;
2173
+ for (const path_ of paths) {
2174
+ try {
2175
+ const stat = statFunction(import_node_path5.default.resolve(cwd2, path_), {
2176
+ throwIfNoEntry: false
2177
+ });
2178
+ if (!stat) {
2179
+ continue;
2180
+ }
2181
+ if (matchType(type, stat)) {
2182
+ return path_;
2183
+ }
2184
+ } catch {
2185
+ }
2186
+ }
2187
+ }
2188
+ var toPath2 = (urlOrPath) => urlOrPath instanceof URL ? (0, import_node_url.fileURLToPath)(urlOrPath) : urlOrPath;
2189
+ var findUpStop = Symbol("findUpStop");
2190
+ function findUpMultipleSync(name, options = {}) {
2191
+ let directory = import_node_path4.default.resolve(toPath2(options.cwd) || "");
2192
+ const { root } = import_node_path4.default.parse(directory);
2193
+ const stopAt = options.stopAt || root;
2194
+ const limit = options.limit || Number.POSITIVE_INFINITY;
2195
+ const paths = [name].flat();
2196
+ const runMatcher = (locateOptions) => {
2197
+ if (typeof name !== "function") {
2198
+ return locatePathSync(paths, locateOptions);
2199
+ }
2200
+ const foundPath = name(locateOptions.cwd);
2201
+ if (typeof foundPath === "string") {
2202
+ return locatePathSync([foundPath], locateOptions);
2203
+ }
2204
+ return foundPath;
2205
+ };
2206
+ const matches = [];
2207
+ while (true) {
2208
+ const foundPath = runMatcher({ ...options, cwd: directory });
2209
+ if (foundPath === findUpStop) {
2210
+ break;
2211
+ }
2212
+ if (foundPath) {
2213
+ matches.push(import_node_path4.default.resolve(directory, foundPath));
2214
+ }
2215
+ if (directory === stopAt || matches.length >= limit) {
2216
+ break;
2217
+ }
2218
+ directory = import_node_path4.default.dirname(directory);
2219
+ }
2220
+ return matches;
2221
+ }
2222
+ function findUpSync(name, options = {}) {
2223
+ const matches = findUpMultipleSync(name, { ...options, limit: 1 });
2224
+ return matches[0];
2225
+ }
2226
+ function packageDirectorySync({ cwd: cwd2 } = {}) {
2227
+ const filePath = findUpSync("package.json", { cwd: cwd2 });
2228
+ return filePath && import_node_path3.default.dirname(filePath);
2229
+ }
2230
+ var { env, cwd } = import_node_process.default;
2231
+ var isWritable = (path6) => {
2232
+ try {
2233
+ import_node_fs2.default.accessSync(path6, import_node_fs2.default.constants.W_OK);
2234
+ return true;
2235
+ } catch {
2236
+ return false;
2237
+ }
2238
+ };
2239
+ function useDirectory(directory, options) {
2240
+ if (options.create) {
2241
+ import_node_fs2.default.mkdirSync(directory, { recursive: true });
2242
+ }
2243
+ return directory;
2244
+ }
2245
+ function getNodeModuleDirectory(directory) {
2246
+ const nodeModules = import_node_path2.default.join(directory, "node_modules");
2247
+ if (!isWritable(nodeModules) && (import_node_fs2.default.existsSync(nodeModules) || !isWritable(import_node_path2.default.join(directory)))) {
2248
+ return;
2249
+ }
2250
+ return nodeModules;
2251
+ }
2252
+ function findCacheDirectory(options = {}) {
2253
+ if (env.CACHE_DIR && !["true", "false", "1", "0"].includes(env.CACHE_DIR)) {
2254
+ return useDirectory(import_node_path2.default.join(env.CACHE_DIR, options.name), options);
2255
+ }
2256
+ let { cwd: directory = cwd(), files } = options;
2257
+ if (files) {
2258
+ if (!Array.isArray(files)) {
2259
+ throw new TypeError(`Expected \`files\` option to be an array, got \`${typeof files}\`.`);
2260
+ }
2261
+ directory = (0, import_common_path_prefix.default)(files.map((file) => import_node_path2.default.resolve(directory, file)));
2262
+ }
2263
+ directory = packageDirectorySync({ cwd: directory });
2264
+ if (!directory) {
2265
+ return;
2266
+ }
2267
+ const nodeModules = getNodeModuleDirectory(directory);
2268
+ if (!nodeModules) {
2269
+ return;
2270
+ }
2271
+ return useDirectory(import_node_path2.default.join(directory, "node_modules", ".cache", options.name), options);
2272
+ }
2273
+ var import_fs_extra = (0, import_chunk_QGM4M3NI.__toESM)(require_lib());
2274
+ var debug = (0, import_debug.default)("prisma:fetch-engine:cache-dir");
2275
+ async function getRootCacheDir() {
2276
+ if (import_node_os.default.platform() === "win32") {
2277
+ const cacheDir = findCacheDirectory({ name: "prisma", create: true });
2278
+ if (cacheDir) {
2279
+ return cacheDir;
2280
+ }
2281
+ if (process.env.APPDATA) {
2282
+ return import_node_path.default.join(process.env.APPDATA, "Prisma");
2283
+ }
2284
+ }
2285
+ if (process.env.AWS_LAMBDA_FUNCTION_VERSION) {
2286
+ try {
2287
+ await (0, import_fs_extra.ensureDir)(`/tmp/prisma-download`);
2288
+ return `/tmp/prisma-download`;
2289
+ } catch (e) {
2290
+ return null;
2291
+ }
2292
+ }
2293
+ return process.env.XDG_CACHE_HOME ? import_node_path.default.join(process.env.XDG_CACHE_HOME, "prisma") : import_node_path.default.join(import_node_os.default.homedir(), ".cache/prisma");
2294
+ }
2295
+ async function getCacheDir(channel, version, binaryTarget) {
2296
+ const rootCacheDir = await getRootCacheDir();
2297
+ if (!rootCacheDir) {
2298
+ return null;
2299
+ }
2300
+ const cacheDir = import_node_path.default.join(rootCacheDir, channel, version, binaryTarget);
2301
+ try {
2302
+ if (!import_node_fs.default.existsSync(cacheDir)) {
2303
+ await (0, import_fs_extra.ensureDir)(cacheDir);
2304
+ }
2305
+ } catch (e) {
2306
+ debug("The following error is being caught and just there for debugging:");
2307
+ debug(e);
2308
+ return null;
2309
+ }
2310
+ return cacheDir;
2311
+ }
2312
+ function getDownloadUrl({
2313
+ channel,
2314
+ version,
2315
+ binaryTarget,
2316
+ binaryName,
2317
+ extension = ".gz"
2318
+ }) {
2319
+ const baseUrl = process.env.PRISMA_BINARIES_MIRROR || // TODO: remove this
2320
+ process.env.PRISMA_ENGINES_MIRROR || "https://binaries.prisma.sh";
2321
+ const finalExtension = (
2322
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
2323
+ binaryTarget === "windows" && "libquery-engine" !== binaryName ? `.exe${extension}` : extension
2324
+ );
2325
+ if (binaryName === "libquery-engine") {
2326
+ binaryName = (0, import_get_platform.getNodeAPIName)(binaryTarget, "url");
2327
+ }
2328
+ return `${baseUrl}/${channel}/${version}/${binaryTarget}/${binaryName}${finalExtension}`;
2329
+ }
2330
+ async function overwriteFile(sourcePath, targetPath) {
2331
+ if (import_node_os.default.platform() === "darwin") {
2332
+ await removeFileIfExists(targetPath);
2333
+ await import_node_fs.default.promises.copyFile(sourcePath, targetPath);
2334
+ } else {
2335
+ const tempPath = `${targetPath}.tmp${process.pid}`;
2336
+ await import_node_fs.default.promises.copyFile(sourcePath, tempPath);
2337
+ await import_node_fs.default.promises.rename(tempPath, targetPath);
2338
+ }
2339
+ }
2340
+ async function removeFileIfExists(filePath) {
2341
+ try {
2342
+ await import_node_fs.default.promises.unlink(filePath);
2343
+ } catch (e) {
2344
+ if (e.code !== "ENOENT") {
2345
+ throw e;
2346
+ }
2347
+ }
2348
+ }
backend/node_modules/@prisma/fetch-engine/dist/chunk-QFA3XBMW.js ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var chunk_QFA3XBMW_exports = {};
30
+ __export(chunk_QFA3XBMW_exports, {
31
+ allEngineEnvVarsSet: () => allEngineEnvVarsSet,
32
+ bold: () => bold,
33
+ deprecatedEnvVarMap: () => deprecatedEnvVarMap,
34
+ engineEnvVarMap: () => engineEnvVarMap,
35
+ getBinaryEnvVarPath: () => getBinaryEnvVarPath,
36
+ yellow: () => yellow
37
+ });
38
+ module.exports = __toCommonJS(chunk_QFA3XBMW_exports);
39
+ var import_node_fs = __toESM(require("node:fs"));
40
+ var import_node_path = __toESM(require("node:path"));
41
+ var import_debug = __toESM(require("@prisma/debug"));
42
+ var FORCE_COLOR;
43
+ var NODE_DISABLE_COLORS;
44
+ var NO_COLOR;
45
+ var TERM;
46
+ var isTTY = true;
47
+ if (typeof process !== "undefined") {
48
+ ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
49
+ isTTY = process.stdout && process.stdout.isTTY;
50
+ }
51
+ var $ = {
52
+ enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY)
53
+ };
54
+ function init(x, y) {
55
+ let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
56
+ let open = `\x1B[${x}m`, close = `\x1B[${y}m`;
57
+ return function(txt) {
58
+ if (!$.enabled || txt == null) return txt;
59
+ return open + (!!~("" + txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
60
+ };
61
+ }
62
+ var reset = init(0, 0);
63
+ var bold = init(1, 22);
64
+ var dim = init(2, 22);
65
+ var italic = init(3, 23);
66
+ var underline = init(4, 24);
67
+ var inverse = init(7, 27);
68
+ var hidden = init(8, 28);
69
+ var strikethrough = init(9, 29);
70
+ var black = init(30, 39);
71
+ var red = init(31, 39);
72
+ var green = init(32, 39);
73
+ var yellow = init(33, 39);
74
+ var blue = init(34, 39);
75
+ var magenta = init(35, 39);
76
+ var cyan = init(36, 39);
77
+ var white = init(37, 39);
78
+ var gray = init(90, 39);
79
+ var grey = init(90, 39);
80
+ var bgBlack = init(40, 49);
81
+ var bgRed = init(41, 49);
82
+ var bgGreen = init(42, 49);
83
+ var bgYellow = init(43, 49);
84
+ var bgBlue = init(44, 49);
85
+ var bgMagenta = init(45, 49);
86
+ var bgCyan = init(46, 49);
87
+ var bgWhite = init(47, 49);
88
+ var debug = (0, import_debug.default)("prisma:fetch-engine:env");
89
+ var engineEnvVarMap = {
90
+ [
91
+ "query-engine"
92
+ /* QueryEngineBinary */
93
+ ]: "PRISMA_QUERY_ENGINE_BINARY",
94
+ [
95
+ "libquery-engine"
96
+ /* QueryEngineLibrary */
97
+ ]: "PRISMA_QUERY_ENGINE_LIBRARY",
98
+ [
99
+ "schema-engine"
100
+ /* SchemaEngineBinary */
101
+ ]: "PRISMA_SCHEMA_ENGINE_BINARY"
102
+ };
103
+ var deprecatedEnvVarMap = {
104
+ [
105
+ "schema-engine"
106
+ /* SchemaEngineBinary */
107
+ ]: "PRISMA_MIGRATION_ENGINE_BINARY"
108
+ };
109
+ function getBinaryEnvVarPath(binaryName) {
110
+ const envVar = getEnvVarToUse(binaryName);
111
+ if (process.env[envVar]) {
112
+ const envVarPath = import_node_path.default.resolve(process.cwd(), process.env[envVar]);
113
+ if (!import_node_fs.default.existsSync(envVarPath)) {
114
+ throw new Error(
115
+ `Env var ${bold(envVar)} is provided but provided path ${underline(process.env[envVar])} can't be resolved.`
116
+ );
117
+ }
118
+ debug(
119
+ `Using env var ${bold(envVar)} for binary ${bold(binaryName)}, which points to ${underline(
120
+ process.env[envVar]
121
+ )}`
122
+ );
123
+ return {
124
+ path: envVarPath,
125
+ fromEnvVar: envVar
126
+ };
127
+ }
128
+ return null;
129
+ }
130
+ function getEnvVarToUse(binaryType) {
131
+ const envVar = engineEnvVarMap[binaryType];
132
+ const deprecatedEnvVar = deprecatedEnvVarMap[binaryType];
133
+ if (deprecatedEnvVar && process.env[deprecatedEnvVar]) {
134
+ if (process.env[envVar]) {
135
+ console.warn(
136
+ `${yellow("prisma:warn")} Both ${bold(envVar)} and ${bold(deprecatedEnvVar)} are specified, ${bold(
137
+ envVar
138
+ )} takes precedence. ${bold(deprecatedEnvVar)} is deprecated.`
139
+ );
140
+ return envVar;
141
+ } else {
142
+ console.warn(
143
+ `${yellow("prisma:warn")} ${bold(deprecatedEnvVar)} environment variable is deprecated, please use ${bold(
144
+ envVar
145
+ )} instead`
146
+ );
147
+ return deprecatedEnvVar;
148
+ }
149
+ }
150
+ return envVar;
151
+ }
152
+ function allEngineEnvVarsSet(binaries) {
153
+ for (const binaryType of binaries) {
154
+ if (!getBinaryEnvVarPath(binaryType)) {
155
+ return false;
156
+ }
157
+ }
158
+ return true;
159
+ }
backend/node_modules/@prisma/fetch-engine/dist/chunk-QGM4M3NI.js ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var chunk_QGM4M3NI_exports = {};
20
+ __export(chunk_QGM4M3NI_exports, {
21
+ __commonJS: () => __commonJS,
22
+ __require: () => __require,
23
+ __toESM: () => __toESM
24
+ });
25
+ module.exports = __toCommonJS(chunk_QGM4M3NI_exports);
26
+ var __create = Object.create;
27
+ var __defProp2 = Object.defineProperty;
28
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
29
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
30
+ var __getProtoOf = Object.getPrototypeOf;
31
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
32
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
33
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
34
+ }) : x)(function(x) {
35
+ if (typeof require !== "undefined") return require.apply(this, arguments);
36
+ throw Error('Dynamic require of "' + x + '" is not supported');
37
+ });
38
+ var __commonJS = (cb, mod) => function __require2() {
39
+ return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
40
+ };
41
+ var __copyProps2 = (to, from, except, desc) => {
42
+ if (from && typeof from === "object" || typeof from === "function") {
43
+ for (let key of __getOwnPropNames2(from))
44
+ if (!__hasOwnProp2.call(to, key) && key !== except)
45
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
46
+ }
47
+ return to;
48
+ };
49
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
50
+ // If the importer is in node compatibility mode or this is not an ESM
51
+ // file that has been converted to a CommonJS file using a Babel-
52
+ // compatible transform (i.e. "__esModule" has not been set), then set
53
+ // "default" to the CommonJS "module.exports" for node compatibility.
54
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
55
+ mod
56
+ ));
backend/node_modules/@prisma/fetch-engine/dist/chunk-VAPNG6TS.js ADDED
@@ -0,0 +1,1642 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var chunk_VAPNG6TS_exports = {};
30
+ __export(chunk_VAPNG6TS_exports, {
31
+ getProxyAgent: () => getProxyAgent
32
+ });
33
+ module.exports = __toCommonJS(chunk_VAPNG6TS_exports);
34
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
35
+ var import_debug = __toESM(require("@prisma/debug"));
36
+ var require_ms = (0, import_chunk_QGM4M3NI.__commonJS)({
37
+ "../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"(exports, module2) {
38
+ "use strict";
39
+ var s = 1e3;
40
+ var m = s * 60;
41
+ var h = m * 60;
42
+ var d = h * 24;
43
+ var w = d * 7;
44
+ var y = d * 365.25;
45
+ module2.exports = function(val, options) {
46
+ options = options || {};
47
+ var type = typeof val;
48
+ if (type === "string" && val.length > 0) {
49
+ return parse(val);
50
+ } else if (type === "number" && isFinite(val)) {
51
+ return options.long ? fmtLong(val) : fmtShort(val);
52
+ }
53
+ throw new Error(
54
+ "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
55
+ );
56
+ };
57
+ function parse(str) {
58
+ str = String(str);
59
+ if (str.length > 100) {
60
+ return;
61
+ }
62
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
63
+ str
64
+ );
65
+ if (!match) {
66
+ return;
67
+ }
68
+ var n = parseFloat(match[1]);
69
+ var type = (match[2] || "ms").toLowerCase();
70
+ switch (type) {
71
+ case "years":
72
+ case "year":
73
+ case "yrs":
74
+ case "yr":
75
+ case "y":
76
+ return n * y;
77
+ case "weeks":
78
+ case "week":
79
+ case "w":
80
+ return n * w;
81
+ case "days":
82
+ case "day":
83
+ case "d":
84
+ return n * d;
85
+ case "hours":
86
+ case "hour":
87
+ case "hrs":
88
+ case "hr":
89
+ case "h":
90
+ return n * h;
91
+ case "minutes":
92
+ case "minute":
93
+ case "mins":
94
+ case "min":
95
+ case "m":
96
+ return n * m;
97
+ case "seconds":
98
+ case "second":
99
+ case "secs":
100
+ case "sec":
101
+ case "s":
102
+ return n * s;
103
+ case "milliseconds":
104
+ case "millisecond":
105
+ case "msecs":
106
+ case "msec":
107
+ case "ms":
108
+ return n;
109
+ default:
110
+ return void 0;
111
+ }
112
+ }
113
+ function fmtShort(ms) {
114
+ var msAbs = Math.abs(ms);
115
+ if (msAbs >= d) {
116
+ return Math.round(ms / d) + "d";
117
+ }
118
+ if (msAbs >= h) {
119
+ return Math.round(ms / h) + "h";
120
+ }
121
+ if (msAbs >= m) {
122
+ return Math.round(ms / m) + "m";
123
+ }
124
+ if (msAbs >= s) {
125
+ return Math.round(ms / s) + "s";
126
+ }
127
+ return ms + "ms";
128
+ }
129
+ function fmtLong(ms) {
130
+ var msAbs = Math.abs(ms);
131
+ if (msAbs >= d) {
132
+ return plural(ms, msAbs, d, "day");
133
+ }
134
+ if (msAbs >= h) {
135
+ return plural(ms, msAbs, h, "hour");
136
+ }
137
+ if (msAbs >= m) {
138
+ return plural(ms, msAbs, m, "minute");
139
+ }
140
+ if (msAbs >= s) {
141
+ return plural(ms, msAbs, s, "second");
142
+ }
143
+ return ms + " ms";
144
+ }
145
+ function plural(ms, msAbs, n, name) {
146
+ var isPlural = msAbs >= n * 1.5;
147
+ return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
148
+ }
149
+ }
150
+ });
151
+ var require_common = (0, import_chunk_QGM4M3NI.__commonJS)({
152
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/common.js"(exports, module2) {
153
+ "use strict";
154
+ function setup(env) {
155
+ createDebug.debug = createDebug;
156
+ createDebug.default = createDebug;
157
+ createDebug.coerce = coerce;
158
+ createDebug.disable = disable;
159
+ createDebug.enable = enable;
160
+ createDebug.enabled = enabled;
161
+ createDebug.humanize = require_ms();
162
+ createDebug.destroy = destroy;
163
+ Object.keys(env).forEach((key) => {
164
+ createDebug[key] = env[key];
165
+ });
166
+ createDebug.names = [];
167
+ createDebug.skips = [];
168
+ createDebug.formatters = {};
169
+ function selectColor(namespace) {
170
+ let hash = 0;
171
+ for (let i = 0; i < namespace.length; i++) {
172
+ hash = (hash << 5) - hash + namespace.charCodeAt(i);
173
+ hash |= 0;
174
+ }
175
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
176
+ }
177
+ createDebug.selectColor = selectColor;
178
+ function createDebug(namespace) {
179
+ let prevTime;
180
+ let enableOverride = null;
181
+ let namespacesCache;
182
+ let enabledCache;
183
+ function debug2(...args) {
184
+ if (!debug2.enabled) {
185
+ return;
186
+ }
187
+ const self = debug2;
188
+ const curr = Number(/* @__PURE__ */ new Date());
189
+ const ms = curr - (prevTime || curr);
190
+ self.diff = ms;
191
+ self.prev = prevTime;
192
+ self.curr = curr;
193
+ prevTime = curr;
194
+ args[0] = createDebug.coerce(args[0]);
195
+ if (typeof args[0] !== "string") {
196
+ args.unshift("%O");
197
+ }
198
+ let index = 0;
199
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
200
+ if (match === "%%") {
201
+ return "%";
202
+ }
203
+ index++;
204
+ const formatter = createDebug.formatters[format];
205
+ if (typeof formatter === "function") {
206
+ const val = args[index];
207
+ match = formatter.call(self, val);
208
+ args.splice(index, 1);
209
+ index--;
210
+ }
211
+ return match;
212
+ });
213
+ createDebug.formatArgs.call(self, args);
214
+ const logFn = self.log || createDebug.log;
215
+ logFn.apply(self, args);
216
+ }
217
+ debug2.namespace = namespace;
218
+ debug2.useColors = createDebug.useColors();
219
+ debug2.color = createDebug.selectColor(namespace);
220
+ debug2.extend = extend;
221
+ debug2.destroy = createDebug.destroy;
222
+ Object.defineProperty(debug2, "enabled", {
223
+ enumerable: true,
224
+ configurable: false,
225
+ get: () => {
226
+ if (enableOverride !== null) {
227
+ return enableOverride;
228
+ }
229
+ if (namespacesCache !== createDebug.namespaces) {
230
+ namespacesCache = createDebug.namespaces;
231
+ enabledCache = createDebug.enabled(namespace);
232
+ }
233
+ return enabledCache;
234
+ },
235
+ set: (v) => {
236
+ enableOverride = v;
237
+ }
238
+ });
239
+ if (typeof createDebug.init === "function") {
240
+ createDebug.init(debug2);
241
+ }
242
+ return debug2;
243
+ }
244
+ function extend(namespace, delimiter) {
245
+ const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
246
+ newDebug.log = this.log;
247
+ return newDebug;
248
+ }
249
+ function enable(namespaces) {
250
+ createDebug.save(namespaces);
251
+ createDebug.namespaces = namespaces;
252
+ createDebug.names = [];
253
+ createDebug.skips = [];
254
+ const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(" ", ",").split(",").filter(Boolean);
255
+ for (const ns of split) {
256
+ if (ns[0] === "-") {
257
+ createDebug.skips.push(ns.slice(1));
258
+ } else {
259
+ createDebug.names.push(ns);
260
+ }
261
+ }
262
+ }
263
+ function matchesTemplate(search, template) {
264
+ let searchIndex = 0;
265
+ let templateIndex = 0;
266
+ let starIndex = -1;
267
+ let matchIndex = 0;
268
+ while (searchIndex < search.length) {
269
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
270
+ if (template[templateIndex] === "*") {
271
+ starIndex = templateIndex;
272
+ matchIndex = searchIndex;
273
+ templateIndex++;
274
+ } else {
275
+ searchIndex++;
276
+ templateIndex++;
277
+ }
278
+ } else if (starIndex !== -1) {
279
+ templateIndex = starIndex + 1;
280
+ matchIndex++;
281
+ searchIndex = matchIndex;
282
+ } else {
283
+ return false;
284
+ }
285
+ }
286
+ while (templateIndex < template.length && template[templateIndex] === "*") {
287
+ templateIndex++;
288
+ }
289
+ return templateIndex === template.length;
290
+ }
291
+ function disable() {
292
+ const namespaces = [
293
+ ...createDebug.names,
294
+ ...createDebug.skips.map((namespace) => "-" + namespace)
295
+ ].join(",");
296
+ createDebug.enable("");
297
+ return namespaces;
298
+ }
299
+ function enabled(name) {
300
+ for (const skip of createDebug.skips) {
301
+ if (matchesTemplate(name, skip)) {
302
+ return false;
303
+ }
304
+ }
305
+ for (const ns of createDebug.names) {
306
+ if (matchesTemplate(name, ns)) {
307
+ return true;
308
+ }
309
+ }
310
+ return false;
311
+ }
312
+ function coerce(val) {
313
+ if (val instanceof Error) {
314
+ return val.stack || val.message;
315
+ }
316
+ return val;
317
+ }
318
+ function destroy() {
319
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
320
+ }
321
+ createDebug.enable(createDebug.load());
322
+ return createDebug;
323
+ }
324
+ module2.exports = setup;
325
+ }
326
+ });
327
+ var require_browser = (0, import_chunk_QGM4M3NI.__commonJS)({
328
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/browser.js"(exports, module2) {
329
+ "use strict";
330
+ exports.formatArgs = formatArgs;
331
+ exports.save = save;
332
+ exports.load = load;
333
+ exports.useColors = useColors;
334
+ exports.storage = localstorage();
335
+ exports.destroy = /* @__PURE__ */ (() => {
336
+ let warned = false;
337
+ return () => {
338
+ if (!warned) {
339
+ warned = true;
340
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
341
+ }
342
+ };
343
+ })();
344
+ exports.colors = [
345
+ "#0000CC",
346
+ "#0000FF",
347
+ "#0033CC",
348
+ "#0033FF",
349
+ "#0066CC",
350
+ "#0066FF",
351
+ "#0099CC",
352
+ "#0099FF",
353
+ "#00CC00",
354
+ "#00CC33",
355
+ "#00CC66",
356
+ "#00CC99",
357
+ "#00CCCC",
358
+ "#00CCFF",
359
+ "#3300CC",
360
+ "#3300FF",
361
+ "#3333CC",
362
+ "#3333FF",
363
+ "#3366CC",
364
+ "#3366FF",
365
+ "#3399CC",
366
+ "#3399FF",
367
+ "#33CC00",
368
+ "#33CC33",
369
+ "#33CC66",
370
+ "#33CC99",
371
+ "#33CCCC",
372
+ "#33CCFF",
373
+ "#6600CC",
374
+ "#6600FF",
375
+ "#6633CC",
376
+ "#6633FF",
377
+ "#66CC00",
378
+ "#66CC33",
379
+ "#9900CC",
380
+ "#9900FF",
381
+ "#9933CC",
382
+ "#9933FF",
383
+ "#99CC00",
384
+ "#99CC33",
385
+ "#CC0000",
386
+ "#CC0033",
387
+ "#CC0066",
388
+ "#CC0099",
389
+ "#CC00CC",
390
+ "#CC00FF",
391
+ "#CC3300",
392
+ "#CC3333",
393
+ "#CC3366",
394
+ "#CC3399",
395
+ "#CC33CC",
396
+ "#CC33FF",
397
+ "#CC6600",
398
+ "#CC6633",
399
+ "#CC9900",
400
+ "#CC9933",
401
+ "#CCCC00",
402
+ "#CCCC33",
403
+ "#FF0000",
404
+ "#FF0033",
405
+ "#FF0066",
406
+ "#FF0099",
407
+ "#FF00CC",
408
+ "#FF00FF",
409
+ "#FF3300",
410
+ "#FF3333",
411
+ "#FF3366",
412
+ "#FF3399",
413
+ "#FF33CC",
414
+ "#FF33FF",
415
+ "#FF6600",
416
+ "#FF6633",
417
+ "#FF9900",
418
+ "#FF9933",
419
+ "#FFCC00",
420
+ "#FFCC33"
421
+ ];
422
+ function useColors() {
423
+ if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
424
+ return true;
425
+ }
426
+ if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
427
+ return false;
428
+ }
429
+ let m;
430
+ return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
431
+ typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
432
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
433
+ typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
434
+ typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
435
+ }
436
+ function formatArgs(args) {
437
+ args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module2.exports.humanize(this.diff);
438
+ if (!this.useColors) {
439
+ return;
440
+ }
441
+ const c = "color: " + this.color;
442
+ args.splice(1, 0, c, "color: inherit");
443
+ let index = 0;
444
+ let lastC = 0;
445
+ args[0].replace(/%[a-zA-Z%]/g, (match) => {
446
+ if (match === "%%") {
447
+ return;
448
+ }
449
+ index++;
450
+ if (match === "%c") {
451
+ lastC = index;
452
+ }
453
+ });
454
+ args.splice(lastC, 0, c);
455
+ }
456
+ exports.log = console.debug || console.log || (() => {
457
+ });
458
+ function save(namespaces) {
459
+ try {
460
+ if (namespaces) {
461
+ exports.storage.setItem("debug", namespaces);
462
+ } else {
463
+ exports.storage.removeItem("debug");
464
+ }
465
+ } catch (error) {
466
+ }
467
+ }
468
+ function load() {
469
+ let r;
470
+ try {
471
+ r = exports.storage.getItem("debug");
472
+ } catch (error) {
473
+ }
474
+ if (!r && typeof process !== "undefined" && "env" in process) {
475
+ r = process.env.DEBUG;
476
+ }
477
+ return r;
478
+ }
479
+ function localstorage() {
480
+ try {
481
+ return localStorage;
482
+ } catch (error) {
483
+ }
484
+ }
485
+ module2.exports = require_common()(exports);
486
+ var { formatters } = module2.exports;
487
+ formatters.j = function(v) {
488
+ try {
489
+ return JSON.stringify(v);
490
+ } catch (error) {
491
+ return "[UnexpectedJSONParseError]: " + error.message;
492
+ }
493
+ };
494
+ }
495
+ });
496
+ var require_has_flag = (0, import_chunk_QGM4M3NI.__commonJS)({
497
+ "../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, module2) {
498
+ "use strict";
499
+ module2.exports = (flag, argv = process.argv) => {
500
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
501
+ const position = argv.indexOf(prefix + flag);
502
+ const terminatorPosition = argv.indexOf("--");
503
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
504
+ };
505
+ }
506
+ });
507
+ var require_supports_color = (0, import_chunk_QGM4M3NI.__commonJS)({
508
+ "../../node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js"(exports, module2) {
509
+ "use strict";
510
+ var os = (0, import_chunk_QGM4M3NI.__require)("os");
511
+ var tty = (0, import_chunk_QGM4M3NI.__require)("tty");
512
+ var hasFlag = require_has_flag();
513
+ var { env } = process;
514
+ var flagForceColor;
515
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
516
+ flagForceColor = 0;
517
+ } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
518
+ flagForceColor = 1;
519
+ }
520
+ function envForceColor() {
521
+ if ("FORCE_COLOR" in env) {
522
+ if (env.FORCE_COLOR === "true") {
523
+ return 1;
524
+ }
525
+ if (env.FORCE_COLOR === "false") {
526
+ return 0;
527
+ }
528
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
529
+ }
530
+ }
531
+ function translateLevel(level) {
532
+ if (level === 0) {
533
+ return false;
534
+ }
535
+ return {
536
+ level,
537
+ hasBasic: true,
538
+ has256: level >= 2,
539
+ has16m: level >= 3
540
+ };
541
+ }
542
+ function supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
543
+ const noFlagForceColor = envForceColor();
544
+ if (noFlagForceColor !== void 0) {
545
+ flagForceColor = noFlagForceColor;
546
+ }
547
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
548
+ if (forceColor === 0) {
549
+ return 0;
550
+ }
551
+ if (sniffFlags) {
552
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
553
+ return 3;
554
+ }
555
+ if (hasFlag("color=256")) {
556
+ return 2;
557
+ }
558
+ }
559
+ if (haveStream && !streamIsTTY && forceColor === void 0) {
560
+ return 0;
561
+ }
562
+ const min = forceColor || 0;
563
+ if (env.TERM === "dumb") {
564
+ return min;
565
+ }
566
+ if (process.platform === "win32") {
567
+ const osRelease = os.release().split(".");
568
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
569
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
570
+ }
571
+ return 1;
572
+ }
573
+ if ("CI" in env) {
574
+ if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
575
+ return 1;
576
+ }
577
+ return min;
578
+ }
579
+ if ("TEAMCITY_VERSION" in env) {
580
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
581
+ }
582
+ if (env.COLORTERM === "truecolor") {
583
+ return 3;
584
+ }
585
+ if ("TERM_PROGRAM" in env) {
586
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
587
+ switch (env.TERM_PROGRAM) {
588
+ case "iTerm.app":
589
+ return version >= 3 ? 3 : 2;
590
+ case "Apple_Terminal":
591
+ return 2;
592
+ }
593
+ }
594
+ if (/-256(color)?$/i.test(env.TERM)) {
595
+ return 2;
596
+ }
597
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
598
+ return 1;
599
+ }
600
+ if ("COLORTERM" in env) {
601
+ return 1;
602
+ }
603
+ return min;
604
+ }
605
+ function getSupportLevel(stream, options = {}) {
606
+ const level = supportsColor(stream, {
607
+ streamIsTTY: stream && stream.isTTY,
608
+ ...options
609
+ });
610
+ return translateLevel(level);
611
+ }
612
+ module2.exports = {
613
+ supportsColor: getSupportLevel,
614
+ stdout: getSupportLevel({ isTTY: tty.isatty(1) }),
615
+ stderr: getSupportLevel({ isTTY: tty.isatty(2) })
616
+ };
617
+ }
618
+ });
619
+ var require_node = (0, import_chunk_QGM4M3NI.__commonJS)({
620
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/node.js"(exports, module2) {
621
+ "use strict";
622
+ var tty = (0, import_chunk_QGM4M3NI.__require)("tty");
623
+ var util = (0, import_chunk_QGM4M3NI.__require)("util");
624
+ exports.init = init;
625
+ exports.log = log;
626
+ exports.formatArgs = formatArgs;
627
+ exports.save = save;
628
+ exports.load = load;
629
+ exports.useColors = useColors;
630
+ exports.destroy = util.deprecate(
631
+ () => {
632
+ },
633
+ "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
634
+ );
635
+ exports.colors = [6, 2, 3, 4, 5, 1];
636
+ try {
637
+ const supportsColor = require_supports_color();
638
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
639
+ exports.colors = [
640
+ 20,
641
+ 21,
642
+ 26,
643
+ 27,
644
+ 32,
645
+ 33,
646
+ 38,
647
+ 39,
648
+ 40,
649
+ 41,
650
+ 42,
651
+ 43,
652
+ 44,
653
+ 45,
654
+ 56,
655
+ 57,
656
+ 62,
657
+ 63,
658
+ 68,
659
+ 69,
660
+ 74,
661
+ 75,
662
+ 76,
663
+ 77,
664
+ 78,
665
+ 79,
666
+ 80,
667
+ 81,
668
+ 92,
669
+ 93,
670
+ 98,
671
+ 99,
672
+ 112,
673
+ 113,
674
+ 128,
675
+ 129,
676
+ 134,
677
+ 135,
678
+ 148,
679
+ 149,
680
+ 160,
681
+ 161,
682
+ 162,
683
+ 163,
684
+ 164,
685
+ 165,
686
+ 166,
687
+ 167,
688
+ 168,
689
+ 169,
690
+ 170,
691
+ 171,
692
+ 172,
693
+ 173,
694
+ 178,
695
+ 179,
696
+ 184,
697
+ 185,
698
+ 196,
699
+ 197,
700
+ 198,
701
+ 199,
702
+ 200,
703
+ 201,
704
+ 202,
705
+ 203,
706
+ 204,
707
+ 205,
708
+ 206,
709
+ 207,
710
+ 208,
711
+ 209,
712
+ 214,
713
+ 215,
714
+ 220,
715
+ 221
716
+ ];
717
+ }
718
+ } catch (error) {
719
+ }
720
+ exports.inspectOpts = Object.keys(process.env).filter((key) => {
721
+ return /^debug_/i.test(key);
722
+ }).reduce((obj, key) => {
723
+ const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
724
+ return k.toUpperCase();
725
+ });
726
+ let val = process.env[key];
727
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
728
+ val = true;
729
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
730
+ val = false;
731
+ } else if (val === "null") {
732
+ val = null;
733
+ } else {
734
+ val = Number(val);
735
+ }
736
+ obj[prop] = val;
737
+ return obj;
738
+ }, {});
739
+ function useColors() {
740
+ return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
741
+ }
742
+ function formatArgs(args) {
743
+ const { namespace: name, useColors: useColors2 } = this;
744
+ if (useColors2) {
745
+ const c = this.color;
746
+ const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
747
+ const prefix = ` ${colorCode};1m${name} \x1B[0m`;
748
+ args[0] = prefix + args[0].split("\n").join("\n" + prefix);
749
+ args.push(colorCode + "m+" + module2.exports.humanize(this.diff) + "\x1B[0m");
750
+ } else {
751
+ args[0] = getDate() + name + " " + args[0];
752
+ }
753
+ }
754
+ function getDate() {
755
+ if (exports.inspectOpts.hideDate) {
756
+ return "";
757
+ }
758
+ return (/* @__PURE__ */ new Date()).toISOString() + " ";
759
+ }
760
+ function log(...args) {
761
+ return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
762
+ }
763
+ function save(namespaces) {
764
+ if (namespaces) {
765
+ process.env.DEBUG = namespaces;
766
+ } else {
767
+ delete process.env.DEBUG;
768
+ }
769
+ }
770
+ function load() {
771
+ return process.env.DEBUG;
772
+ }
773
+ function init(debug2) {
774
+ debug2.inspectOpts = {};
775
+ const keys = Object.keys(exports.inspectOpts);
776
+ for (let i = 0; i < keys.length; i++) {
777
+ debug2.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
778
+ }
779
+ }
780
+ module2.exports = require_common()(exports);
781
+ var { formatters } = module2.exports;
782
+ formatters.o = function(v) {
783
+ this.inspectOpts.colors = this.useColors;
784
+ return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
785
+ };
786
+ formatters.O = function(v) {
787
+ this.inspectOpts.colors = this.useColors;
788
+ return util.inspect(v, this.inspectOpts);
789
+ };
790
+ }
791
+ });
792
+ var require_src = (0, import_chunk_QGM4M3NI.__commonJS)({
793
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/index.js"(exports, module2) {
794
+ "use strict";
795
+ if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
796
+ module2.exports = require_browser();
797
+ } else {
798
+ module2.exports = require_node();
799
+ }
800
+ }
801
+ });
802
+ var require_helpers = (0, import_chunk_QGM4M3NI.__commonJS)({
803
+ "../../node_modules/.pnpm/agent-base@7.1.0/node_modules/agent-base/dist/helpers.js"(exports) {
804
+ "use strict";
805
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
806
+ if (k2 === void 0) k2 = k;
807
+ var desc = Object.getOwnPropertyDescriptor(m, k);
808
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
809
+ desc = { enumerable: true, get: function() {
810
+ return m[k];
811
+ } };
812
+ }
813
+ Object.defineProperty(o, k2, desc);
814
+ } : function(o, m, k, k2) {
815
+ if (k2 === void 0) k2 = k;
816
+ o[k2] = m[k];
817
+ });
818
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
819
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
820
+ } : function(o, v) {
821
+ o["default"] = v;
822
+ });
823
+ var __importStar = exports && exports.__importStar || function(mod) {
824
+ if (mod && mod.__esModule) return mod;
825
+ var result = {};
826
+ if (mod != null) {
827
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
828
+ }
829
+ __setModuleDefault(result, mod);
830
+ return result;
831
+ };
832
+ Object.defineProperty(exports, "__esModule", { value: true });
833
+ exports.req = exports.json = exports.toBuffer = void 0;
834
+ var http = __importStar((0, import_chunk_QGM4M3NI.__require)("http"));
835
+ var https = __importStar((0, import_chunk_QGM4M3NI.__require)("https"));
836
+ async function toBuffer(stream) {
837
+ let length = 0;
838
+ const chunks = [];
839
+ for await (const chunk of stream) {
840
+ length += chunk.length;
841
+ chunks.push(chunk);
842
+ }
843
+ return Buffer.concat(chunks, length);
844
+ }
845
+ exports.toBuffer = toBuffer;
846
+ async function json(stream) {
847
+ const buf = await toBuffer(stream);
848
+ const str = buf.toString("utf8");
849
+ try {
850
+ return JSON.parse(str);
851
+ } catch (_err) {
852
+ const err = _err;
853
+ err.message += ` (input: ${str})`;
854
+ throw err;
855
+ }
856
+ }
857
+ exports.json = json;
858
+ function req(url, opts = {}) {
859
+ const href = typeof url === "string" ? url : url.href;
860
+ const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
861
+ const promise = new Promise((resolve, reject) => {
862
+ req2.once("response", resolve).once("error", reject).end();
863
+ });
864
+ req2.then = promise.then.bind(promise);
865
+ return req2;
866
+ }
867
+ exports.req = req;
868
+ }
869
+ });
870
+ var require_dist = (0, import_chunk_QGM4M3NI.__commonJS)({
871
+ "../../node_modules/.pnpm/agent-base@7.1.0/node_modules/agent-base/dist/index.js"(exports) {
872
+ "use strict";
873
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
874
+ if (k2 === void 0) k2 = k;
875
+ var desc = Object.getOwnPropertyDescriptor(m, k);
876
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
877
+ desc = { enumerable: true, get: function() {
878
+ return m[k];
879
+ } };
880
+ }
881
+ Object.defineProperty(o, k2, desc);
882
+ } : function(o, m, k, k2) {
883
+ if (k2 === void 0) k2 = k;
884
+ o[k2] = m[k];
885
+ });
886
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
887
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
888
+ } : function(o, v) {
889
+ o["default"] = v;
890
+ });
891
+ var __importStar = exports && exports.__importStar || function(mod) {
892
+ if (mod && mod.__esModule) return mod;
893
+ var result = {};
894
+ if (mod != null) {
895
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
896
+ }
897
+ __setModuleDefault(result, mod);
898
+ return result;
899
+ };
900
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
901
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
902
+ };
903
+ Object.defineProperty(exports, "__esModule", { value: true });
904
+ exports.Agent = void 0;
905
+ var http = __importStar((0, import_chunk_QGM4M3NI.__require)("http"));
906
+ __exportStar(require_helpers(), exports);
907
+ var INTERNAL = Symbol("AgentBaseInternalState");
908
+ var Agent = class extends http.Agent {
909
+ constructor(opts) {
910
+ super(opts);
911
+ this[INTERNAL] = {};
912
+ }
913
+ /**
914
+ * Determine whether this is an `http` or `https` request.
915
+ */
916
+ isSecureEndpoint(options) {
917
+ if (options) {
918
+ if (typeof options.secureEndpoint === "boolean") {
919
+ return options.secureEndpoint;
920
+ }
921
+ if (typeof options.protocol === "string") {
922
+ return options.protocol === "https:";
923
+ }
924
+ }
925
+ const { stack } = new Error();
926
+ if (typeof stack !== "string")
927
+ return false;
928
+ return stack.split("\n").some((l) => l.indexOf("(https.js:") !== -1 || l.indexOf("node:https:") !== -1);
929
+ }
930
+ createSocket(req, options, cb) {
931
+ const connectOpts = {
932
+ ...options,
933
+ secureEndpoint: this.isSecureEndpoint(options)
934
+ };
935
+ Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
936
+ if (socket instanceof http.Agent) {
937
+ return socket.addRequest(req, connectOpts);
938
+ }
939
+ this[INTERNAL].currentSocket = socket;
940
+ super.createSocket(req, options, cb);
941
+ }, cb);
942
+ }
943
+ createConnection() {
944
+ const socket = this[INTERNAL].currentSocket;
945
+ this[INTERNAL].currentSocket = void 0;
946
+ if (!socket) {
947
+ throw new Error("No socket was returned in the `connect()` function");
948
+ }
949
+ return socket;
950
+ }
951
+ get defaultPort() {
952
+ return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80);
953
+ }
954
+ set defaultPort(v) {
955
+ if (this[INTERNAL]) {
956
+ this[INTERNAL].defaultPort = v;
957
+ }
958
+ }
959
+ get protocol() {
960
+ return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:");
961
+ }
962
+ set protocol(v) {
963
+ if (this[INTERNAL]) {
964
+ this[INTERNAL].protocol = v;
965
+ }
966
+ }
967
+ };
968
+ exports.Agent = Agent;
969
+ }
970
+ });
971
+ var require_dist2 = (0, import_chunk_QGM4M3NI.__commonJS)({
972
+ "../../node_modules/.pnpm/http-proxy-agent@7.0.2/node_modules/http-proxy-agent/dist/index.js"(exports) {
973
+ "use strict";
974
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
975
+ if (k2 === void 0) k2 = k;
976
+ var desc = Object.getOwnPropertyDescriptor(m, k);
977
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
978
+ desc = { enumerable: true, get: function() {
979
+ return m[k];
980
+ } };
981
+ }
982
+ Object.defineProperty(o, k2, desc);
983
+ } : function(o, m, k, k2) {
984
+ if (k2 === void 0) k2 = k;
985
+ o[k2] = m[k];
986
+ });
987
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
988
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
989
+ } : function(o, v) {
990
+ o["default"] = v;
991
+ });
992
+ var __importStar = exports && exports.__importStar || function(mod) {
993
+ if (mod && mod.__esModule) return mod;
994
+ var result = {};
995
+ if (mod != null) {
996
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
997
+ }
998
+ __setModuleDefault(result, mod);
999
+ return result;
1000
+ };
1001
+ var __importDefault = exports && exports.__importDefault || function(mod) {
1002
+ return mod && mod.__esModule ? mod : { "default": mod };
1003
+ };
1004
+ Object.defineProperty(exports, "__esModule", { value: true });
1005
+ exports.HttpProxyAgent = void 0;
1006
+ var net = __importStar((0, import_chunk_QGM4M3NI.__require)("net"));
1007
+ var tls = __importStar((0, import_chunk_QGM4M3NI.__require)("tls"));
1008
+ var debug_1 = __importDefault(require_src());
1009
+ var events_1 = (0, import_chunk_QGM4M3NI.__require)("events");
1010
+ var agent_base_1 = require_dist();
1011
+ var url_1 = (0, import_chunk_QGM4M3NI.__require)("url");
1012
+ var debug2 = (0, debug_1.default)("http-proxy-agent");
1013
+ var HttpProxyAgent2 = class extends agent_base_1.Agent {
1014
+ constructor(proxy, opts) {
1015
+ super(opts);
1016
+ this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
1017
+ this.proxyHeaders = opts?.headers ?? {};
1018
+ debug2("Creating new HttpProxyAgent instance: %o", this.proxy.href);
1019
+ const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
1020
+ const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
1021
+ this.connectOpts = {
1022
+ ...opts ? omit(opts, "headers") : null,
1023
+ host,
1024
+ port
1025
+ };
1026
+ }
1027
+ addRequest(req, opts) {
1028
+ req._header = null;
1029
+ this.setRequestProps(req, opts);
1030
+ super.addRequest(req, opts);
1031
+ }
1032
+ setRequestProps(req, opts) {
1033
+ const { proxy } = this;
1034
+ const protocol = opts.secureEndpoint ? "https:" : "http:";
1035
+ const hostname = req.getHeader("host") || "localhost";
1036
+ const base = `${protocol}//${hostname}`;
1037
+ const url = new url_1.URL(req.path, base);
1038
+ if (opts.port !== 80) {
1039
+ url.port = String(opts.port);
1040
+ }
1041
+ req.path = String(url);
1042
+ const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
1043
+ if (proxy.username || proxy.password) {
1044
+ const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
1045
+ headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
1046
+ }
1047
+ if (!headers["Proxy-Connection"]) {
1048
+ headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
1049
+ }
1050
+ for (const name of Object.keys(headers)) {
1051
+ const value = headers[name];
1052
+ if (value) {
1053
+ req.setHeader(name, value);
1054
+ }
1055
+ }
1056
+ }
1057
+ async connect(req, opts) {
1058
+ req._header = null;
1059
+ if (!req.path.includes("://")) {
1060
+ this.setRequestProps(req, opts);
1061
+ }
1062
+ let first;
1063
+ let endOfHeaders;
1064
+ debug2("Regenerating stored HTTP header string for request");
1065
+ req._implicitHeader();
1066
+ if (req.outputData && req.outputData.length > 0) {
1067
+ debug2("Patching connection write() output buffer with updated header");
1068
+ first = req.outputData[0].data;
1069
+ endOfHeaders = first.indexOf("\r\n\r\n") + 4;
1070
+ req.outputData[0].data = req._header + first.substring(endOfHeaders);
1071
+ debug2("Output buffer: %o", req.outputData[0].data);
1072
+ }
1073
+ let socket;
1074
+ if (this.proxy.protocol === "https:") {
1075
+ debug2("Creating `tls.Socket`: %o", this.connectOpts);
1076
+ socket = tls.connect(this.connectOpts);
1077
+ } else {
1078
+ debug2("Creating `net.Socket`: %o", this.connectOpts);
1079
+ socket = net.connect(this.connectOpts);
1080
+ }
1081
+ await (0, events_1.once)(socket, "connect");
1082
+ return socket;
1083
+ }
1084
+ };
1085
+ HttpProxyAgent2.protocols = ["http", "https"];
1086
+ exports.HttpProxyAgent = HttpProxyAgent2;
1087
+ function omit(obj, ...keys) {
1088
+ const ret = {};
1089
+ let key;
1090
+ for (key in obj) {
1091
+ if (!keys.includes(key)) {
1092
+ ret[key] = obj[key];
1093
+ }
1094
+ }
1095
+ return ret;
1096
+ }
1097
+ }
1098
+ });
1099
+ var require_helpers2 = (0, import_chunk_QGM4M3NI.__commonJS)({
1100
+ "../../node_modules/.pnpm/agent-base@7.1.3/node_modules/agent-base/dist/helpers.js"(exports) {
1101
+ "use strict";
1102
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
1103
+ if (k2 === void 0) k2 = k;
1104
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1105
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1106
+ desc = { enumerable: true, get: function() {
1107
+ return m[k];
1108
+ } };
1109
+ }
1110
+ Object.defineProperty(o, k2, desc);
1111
+ } : function(o, m, k, k2) {
1112
+ if (k2 === void 0) k2 = k;
1113
+ o[k2] = m[k];
1114
+ });
1115
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
1116
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
1117
+ } : function(o, v) {
1118
+ o["default"] = v;
1119
+ });
1120
+ var __importStar = exports && exports.__importStar || function(mod) {
1121
+ if (mod && mod.__esModule) return mod;
1122
+ var result = {};
1123
+ if (mod != null) {
1124
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1125
+ }
1126
+ __setModuleDefault(result, mod);
1127
+ return result;
1128
+ };
1129
+ Object.defineProperty(exports, "__esModule", { value: true });
1130
+ exports.req = exports.json = exports.toBuffer = void 0;
1131
+ var http = __importStar((0, import_chunk_QGM4M3NI.__require)("http"));
1132
+ var https = __importStar((0, import_chunk_QGM4M3NI.__require)("https"));
1133
+ async function toBuffer(stream) {
1134
+ let length = 0;
1135
+ const chunks = [];
1136
+ for await (const chunk of stream) {
1137
+ length += chunk.length;
1138
+ chunks.push(chunk);
1139
+ }
1140
+ return Buffer.concat(chunks, length);
1141
+ }
1142
+ exports.toBuffer = toBuffer;
1143
+ async function json(stream) {
1144
+ const buf = await toBuffer(stream);
1145
+ const str = buf.toString("utf8");
1146
+ try {
1147
+ return JSON.parse(str);
1148
+ } catch (_err) {
1149
+ const err = _err;
1150
+ err.message += ` (input: ${str})`;
1151
+ throw err;
1152
+ }
1153
+ }
1154
+ exports.json = json;
1155
+ function req(url, opts = {}) {
1156
+ const href = typeof url === "string" ? url : url.href;
1157
+ const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
1158
+ const promise = new Promise((resolve, reject) => {
1159
+ req2.once("response", resolve).once("error", reject).end();
1160
+ });
1161
+ req2.then = promise.then.bind(promise);
1162
+ return req2;
1163
+ }
1164
+ exports.req = req;
1165
+ }
1166
+ });
1167
+ var require_dist3 = (0, import_chunk_QGM4M3NI.__commonJS)({
1168
+ "../../node_modules/.pnpm/agent-base@7.1.3/node_modules/agent-base/dist/index.js"(exports) {
1169
+ "use strict";
1170
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
1171
+ if (k2 === void 0) k2 = k;
1172
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1173
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1174
+ desc = { enumerable: true, get: function() {
1175
+ return m[k];
1176
+ } };
1177
+ }
1178
+ Object.defineProperty(o, k2, desc);
1179
+ } : function(o, m, k, k2) {
1180
+ if (k2 === void 0) k2 = k;
1181
+ o[k2] = m[k];
1182
+ });
1183
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
1184
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
1185
+ } : function(o, v) {
1186
+ o["default"] = v;
1187
+ });
1188
+ var __importStar = exports && exports.__importStar || function(mod) {
1189
+ if (mod && mod.__esModule) return mod;
1190
+ var result = {};
1191
+ if (mod != null) {
1192
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1193
+ }
1194
+ __setModuleDefault(result, mod);
1195
+ return result;
1196
+ };
1197
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
1198
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
1199
+ };
1200
+ Object.defineProperty(exports, "__esModule", { value: true });
1201
+ exports.Agent = void 0;
1202
+ var net = __importStar((0, import_chunk_QGM4M3NI.__require)("net"));
1203
+ var http = __importStar((0, import_chunk_QGM4M3NI.__require)("http"));
1204
+ var https_1 = (0, import_chunk_QGM4M3NI.__require)("https");
1205
+ __exportStar(require_helpers2(), exports);
1206
+ var INTERNAL = Symbol("AgentBaseInternalState");
1207
+ var Agent = class extends http.Agent {
1208
+ constructor(opts) {
1209
+ super(opts);
1210
+ this[INTERNAL] = {};
1211
+ }
1212
+ /**
1213
+ * Determine whether this is an `http` or `https` request.
1214
+ */
1215
+ isSecureEndpoint(options) {
1216
+ if (options) {
1217
+ if (typeof options.secureEndpoint === "boolean") {
1218
+ return options.secureEndpoint;
1219
+ }
1220
+ if (typeof options.protocol === "string") {
1221
+ return options.protocol === "https:";
1222
+ }
1223
+ }
1224
+ const { stack } = new Error();
1225
+ if (typeof stack !== "string")
1226
+ return false;
1227
+ return stack.split("\n").some((l) => l.indexOf("(https.js:") !== -1 || l.indexOf("node:https:") !== -1);
1228
+ }
1229
+ // In order to support async signatures in `connect()` and Node's native
1230
+ // connection pooling in `http.Agent`, the array of sockets for each origin
1231
+ // has to be updated synchronously. This is so the length of the array is
1232
+ // accurate when `addRequest()` is next called. We achieve this by creating a
1233
+ // fake socket and adding it to `sockets[origin]` and incrementing
1234
+ // `totalSocketCount`.
1235
+ incrementSockets(name) {
1236
+ if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {
1237
+ return null;
1238
+ }
1239
+ if (!this.sockets[name]) {
1240
+ this.sockets[name] = [];
1241
+ }
1242
+ const fakeSocket = new net.Socket({ writable: false });
1243
+ this.sockets[name].push(fakeSocket);
1244
+ this.totalSocketCount++;
1245
+ return fakeSocket;
1246
+ }
1247
+ decrementSockets(name, socket) {
1248
+ if (!this.sockets[name] || socket === null) {
1249
+ return;
1250
+ }
1251
+ const sockets = this.sockets[name];
1252
+ const index = sockets.indexOf(socket);
1253
+ if (index !== -1) {
1254
+ sockets.splice(index, 1);
1255
+ this.totalSocketCount--;
1256
+ if (sockets.length === 0) {
1257
+ delete this.sockets[name];
1258
+ }
1259
+ }
1260
+ }
1261
+ // In order to properly update the socket pool, we need to call `getName()` on
1262
+ // the core `https.Agent` if it is a secureEndpoint.
1263
+ getName(options) {
1264
+ const secureEndpoint = typeof options.secureEndpoint === "boolean" ? options.secureEndpoint : this.isSecureEndpoint(options);
1265
+ if (secureEndpoint) {
1266
+ return https_1.Agent.prototype.getName.call(this, options);
1267
+ }
1268
+ return super.getName(options);
1269
+ }
1270
+ createSocket(req, options, cb) {
1271
+ const connectOpts = {
1272
+ ...options,
1273
+ secureEndpoint: this.isSecureEndpoint(options)
1274
+ };
1275
+ const name = this.getName(connectOpts);
1276
+ const fakeSocket = this.incrementSockets(name);
1277
+ Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
1278
+ this.decrementSockets(name, fakeSocket);
1279
+ if (socket instanceof http.Agent) {
1280
+ try {
1281
+ return socket.addRequest(req, connectOpts);
1282
+ } catch (err) {
1283
+ return cb(err);
1284
+ }
1285
+ }
1286
+ this[INTERNAL].currentSocket = socket;
1287
+ super.createSocket(req, options, cb);
1288
+ }, (err) => {
1289
+ this.decrementSockets(name, fakeSocket);
1290
+ cb(err);
1291
+ });
1292
+ }
1293
+ createConnection() {
1294
+ const socket = this[INTERNAL].currentSocket;
1295
+ this[INTERNAL].currentSocket = void 0;
1296
+ if (!socket) {
1297
+ throw new Error("No socket was returned in the `connect()` function");
1298
+ }
1299
+ return socket;
1300
+ }
1301
+ get defaultPort() {
1302
+ return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80);
1303
+ }
1304
+ set defaultPort(v) {
1305
+ if (this[INTERNAL]) {
1306
+ this[INTERNAL].defaultPort = v;
1307
+ }
1308
+ }
1309
+ get protocol() {
1310
+ return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:");
1311
+ }
1312
+ set protocol(v) {
1313
+ if (this[INTERNAL]) {
1314
+ this[INTERNAL].protocol = v;
1315
+ }
1316
+ }
1317
+ };
1318
+ exports.Agent = Agent;
1319
+ }
1320
+ });
1321
+ var require_parse_proxy_response = (0, import_chunk_QGM4M3NI.__commonJS)({
1322
+ "../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports) {
1323
+ "use strict";
1324
+ var __importDefault = exports && exports.__importDefault || function(mod) {
1325
+ return mod && mod.__esModule ? mod : { "default": mod };
1326
+ };
1327
+ Object.defineProperty(exports, "__esModule", { value: true });
1328
+ exports.parseProxyResponse = void 0;
1329
+ var debug_1 = __importDefault(require_src());
1330
+ var debug2 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
1331
+ function parseProxyResponse(socket) {
1332
+ return new Promise((resolve, reject) => {
1333
+ let buffersLength = 0;
1334
+ const buffers = [];
1335
+ function read() {
1336
+ const b = socket.read();
1337
+ if (b)
1338
+ ondata(b);
1339
+ else
1340
+ socket.once("readable", read);
1341
+ }
1342
+ function cleanup() {
1343
+ socket.removeListener("end", onend);
1344
+ socket.removeListener("error", onerror);
1345
+ socket.removeListener("readable", read);
1346
+ }
1347
+ function onend() {
1348
+ cleanup();
1349
+ debug2("onend");
1350
+ reject(new Error("Proxy connection ended before receiving CONNECT response"));
1351
+ }
1352
+ function onerror(err) {
1353
+ cleanup();
1354
+ debug2("onerror %o", err);
1355
+ reject(err);
1356
+ }
1357
+ function ondata(b) {
1358
+ buffers.push(b);
1359
+ buffersLength += b.length;
1360
+ const buffered = Buffer.concat(buffers, buffersLength);
1361
+ const endOfHeaders = buffered.indexOf("\r\n\r\n");
1362
+ if (endOfHeaders === -1) {
1363
+ debug2("have not received end of HTTP headers yet...");
1364
+ read();
1365
+ return;
1366
+ }
1367
+ const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n");
1368
+ const firstLine = headerParts.shift();
1369
+ if (!firstLine) {
1370
+ socket.destroy();
1371
+ return reject(new Error("No header received from proxy CONNECT response"));
1372
+ }
1373
+ const firstLineParts = firstLine.split(" ");
1374
+ const statusCode = +firstLineParts[1];
1375
+ const statusText = firstLineParts.slice(2).join(" ");
1376
+ const headers = {};
1377
+ for (const header of headerParts) {
1378
+ if (!header)
1379
+ continue;
1380
+ const firstColon = header.indexOf(":");
1381
+ if (firstColon === -1) {
1382
+ socket.destroy();
1383
+ return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
1384
+ }
1385
+ const key = header.slice(0, firstColon).toLowerCase();
1386
+ const value = header.slice(firstColon + 1).trimStart();
1387
+ const current = headers[key];
1388
+ if (typeof current === "string") {
1389
+ headers[key] = [current, value];
1390
+ } else if (Array.isArray(current)) {
1391
+ current.push(value);
1392
+ } else {
1393
+ headers[key] = value;
1394
+ }
1395
+ }
1396
+ debug2("got proxy server response: %o %o", firstLine, headers);
1397
+ cleanup();
1398
+ resolve({
1399
+ connect: {
1400
+ statusCode,
1401
+ statusText,
1402
+ headers
1403
+ },
1404
+ buffered
1405
+ });
1406
+ }
1407
+ socket.on("error", onerror);
1408
+ socket.on("end", onend);
1409
+ read();
1410
+ });
1411
+ }
1412
+ exports.parseProxyResponse = parseProxyResponse;
1413
+ }
1414
+ });
1415
+ var require_dist4 = (0, import_chunk_QGM4M3NI.__commonJS)({
1416
+ "../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js"(exports) {
1417
+ "use strict";
1418
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
1419
+ if (k2 === void 0) k2 = k;
1420
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1421
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1422
+ desc = { enumerable: true, get: function() {
1423
+ return m[k];
1424
+ } };
1425
+ }
1426
+ Object.defineProperty(o, k2, desc);
1427
+ } : function(o, m, k, k2) {
1428
+ if (k2 === void 0) k2 = k;
1429
+ o[k2] = m[k];
1430
+ });
1431
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
1432
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
1433
+ } : function(o, v) {
1434
+ o["default"] = v;
1435
+ });
1436
+ var __importStar = exports && exports.__importStar || function(mod) {
1437
+ if (mod && mod.__esModule) return mod;
1438
+ var result = {};
1439
+ if (mod != null) {
1440
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1441
+ }
1442
+ __setModuleDefault(result, mod);
1443
+ return result;
1444
+ };
1445
+ var __importDefault = exports && exports.__importDefault || function(mod) {
1446
+ return mod && mod.__esModule ? mod : { "default": mod };
1447
+ };
1448
+ Object.defineProperty(exports, "__esModule", { value: true });
1449
+ exports.HttpsProxyAgent = void 0;
1450
+ var net = __importStar((0, import_chunk_QGM4M3NI.__require)("net"));
1451
+ var tls = __importStar((0, import_chunk_QGM4M3NI.__require)("tls"));
1452
+ var assert_1 = __importDefault((0, import_chunk_QGM4M3NI.__require)("assert"));
1453
+ var debug_1 = __importDefault(require_src());
1454
+ var agent_base_1 = require_dist3();
1455
+ var url_1 = (0, import_chunk_QGM4M3NI.__require)("url");
1456
+ var parse_proxy_response_1 = require_parse_proxy_response();
1457
+ var debug2 = (0, debug_1.default)("https-proxy-agent");
1458
+ var setServernameFromNonIpHost = (options) => {
1459
+ if (options.servername === void 0 && options.host && !net.isIP(options.host)) {
1460
+ return {
1461
+ ...options,
1462
+ servername: options.host
1463
+ };
1464
+ }
1465
+ return options;
1466
+ };
1467
+ var HttpsProxyAgent2 = class extends agent_base_1.Agent {
1468
+ constructor(proxy, opts) {
1469
+ super(opts);
1470
+ this.options = { path: void 0 };
1471
+ this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
1472
+ this.proxyHeaders = opts?.headers ?? {};
1473
+ debug2("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
1474
+ const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
1475
+ const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
1476
+ this.connectOpts = {
1477
+ // Attempt to negotiate http/1.1 for proxy servers that support http/2
1478
+ ALPNProtocols: ["http/1.1"],
1479
+ ...opts ? omit(opts, "headers") : null,
1480
+ host,
1481
+ port
1482
+ };
1483
+ }
1484
+ /**
1485
+ * Called when the node-core HTTP client library is creating a
1486
+ * new HTTP request.
1487
+ */
1488
+ async connect(req, opts) {
1489
+ const { proxy } = this;
1490
+ if (!opts.host) {
1491
+ throw new TypeError('No "host" provided');
1492
+ }
1493
+ let socket;
1494
+ if (proxy.protocol === "https:") {
1495
+ debug2("Creating `tls.Socket`: %o", this.connectOpts);
1496
+ socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
1497
+ } else {
1498
+ debug2("Creating `net.Socket`: %o", this.connectOpts);
1499
+ socket = net.connect(this.connectOpts);
1500
+ }
1501
+ const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
1502
+ const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
1503
+ let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r
1504
+ `;
1505
+ if (proxy.username || proxy.password) {
1506
+ const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
1507
+ headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
1508
+ }
1509
+ headers.Host = `${host}:${opts.port}`;
1510
+ if (!headers["Proxy-Connection"]) {
1511
+ headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
1512
+ }
1513
+ for (const name of Object.keys(headers)) {
1514
+ payload += `${name}: ${headers[name]}\r
1515
+ `;
1516
+ }
1517
+ const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
1518
+ socket.write(`${payload}\r
1519
+ `);
1520
+ const { connect, buffered } = await proxyResponsePromise;
1521
+ req.emit("proxyConnect", connect);
1522
+ this.emit("proxyConnect", connect, req);
1523
+ if (connect.statusCode === 200) {
1524
+ req.once("socket", resume);
1525
+ if (opts.secureEndpoint) {
1526
+ debug2("Upgrading socket connection to TLS");
1527
+ return tls.connect({
1528
+ ...omit(setServernameFromNonIpHost(opts), "host", "path", "port"),
1529
+ socket
1530
+ });
1531
+ }
1532
+ return socket;
1533
+ }
1534
+ socket.destroy();
1535
+ const fakeSocket = new net.Socket({ writable: false });
1536
+ fakeSocket.readable = true;
1537
+ req.once("socket", (s) => {
1538
+ debug2("Replaying proxy buffer for failed request");
1539
+ (0, assert_1.default)(s.listenerCount("data") > 0);
1540
+ s.push(buffered);
1541
+ s.push(null);
1542
+ });
1543
+ return fakeSocket;
1544
+ }
1545
+ };
1546
+ HttpsProxyAgent2.protocols = ["http", "https"];
1547
+ exports.HttpsProxyAgent = HttpsProxyAgent2;
1548
+ function resume(socket) {
1549
+ socket.resume();
1550
+ }
1551
+ function omit(obj, ...keys) {
1552
+ const ret = {};
1553
+ let key;
1554
+ for (key in obj) {
1555
+ if (!keys.includes(key)) {
1556
+ ret[key] = obj[key];
1557
+ }
1558
+ }
1559
+ return ret;
1560
+ }
1561
+ }
1562
+ });
1563
+ var import_http_proxy_agent = (0, import_chunk_QGM4M3NI.__toESM)(require_dist2());
1564
+ var import_https_proxy_agent = (0, import_chunk_QGM4M3NI.__toESM)(require_dist4());
1565
+ var debug = (0, import_debug.default)("prisma:fetch-engine:getProxyAgent");
1566
+ function formatHostname(hostname) {
1567
+ return hostname.replace(/^\.*/, ".").toLowerCase();
1568
+ }
1569
+ function parseNoProxyZone(zone) {
1570
+ zone = zone.trim().toLowerCase();
1571
+ const zoneParts = zone.split(":", 2);
1572
+ const zoneHost = formatHostname(zoneParts[0]);
1573
+ const zonePort = zoneParts[1];
1574
+ const hasPort = zone.includes(":");
1575
+ return { hostname: zoneHost, port: zonePort, hasPort };
1576
+ }
1577
+ function uriInNoProxy(uri, noProxy) {
1578
+ const port = uri.port || (uri.protocol === "https:" ? "443" : "80");
1579
+ const hostname = formatHostname(uri.hostname);
1580
+ const noProxyList = noProxy.split(",");
1581
+ return noProxyList.map(parseNoProxyZone).some(function(noProxyZone) {
1582
+ const isMatchedAt = hostname.indexOf(noProxyZone.hostname);
1583
+ const hostnameMatched = isMatchedAt > -1 && isMatchedAt === hostname.length - noProxyZone.hostname.length;
1584
+ if (noProxyZone.hasPort) {
1585
+ return port === noProxyZone.port && hostnameMatched;
1586
+ }
1587
+ return hostnameMatched;
1588
+ });
1589
+ }
1590
+ function getProxyFromURI(uri) {
1591
+ const noProxy = process.env.NO_PROXY || process.env.no_proxy || "";
1592
+ if (noProxy) debug(`noProxy is set to "${noProxy}"`);
1593
+ if (noProxy === "*") {
1594
+ return null;
1595
+ }
1596
+ if (noProxy !== "" && uriInNoProxy(uri, noProxy)) {
1597
+ return null;
1598
+ }
1599
+ if (uri.protocol === "http:") {
1600
+ const httpProxy = process.env.HTTP_PROXY || process.env.http_proxy || null;
1601
+ if (httpProxy) debug(`uri.protocol is HTTP and the URL for the proxy is "${httpProxy}"`);
1602
+ return httpProxy;
1603
+ }
1604
+ if (uri.protocol === "https:") {
1605
+ const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy || null;
1606
+ if (httpsProxy) debug(`uri.protocol is HTTPS and the URL for the proxy is "${httpsProxy}"`);
1607
+ return httpsProxy;
1608
+ }
1609
+ return null;
1610
+ }
1611
+ function getProxyAgent(url) {
1612
+ try {
1613
+ const uri = new URL(url);
1614
+ const proxy = getProxyFromURI(uri);
1615
+ if (!proxy) {
1616
+ return void 0;
1617
+ } else if (uri.protocol === "http:") {
1618
+ try {
1619
+ return new import_http_proxy_agent.HttpProxyAgent(proxy);
1620
+ } catch (agentError) {
1621
+ throw new Error(
1622
+ `Error while instantiating HttpProxyAgent with URL: "${proxy}"
1623
+ ${agentError}
1624
+ Check the following env vars "http_proxy" or "HTTP_PROXY". The value should be a valid URL starting with "http://"`
1625
+ );
1626
+ }
1627
+ } else if (uri.protocol === "https:") {
1628
+ try {
1629
+ return new import_https_proxy_agent.HttpsProxyAgent(proxy);
1630
+ } catch (agentError) {
1631
+ throw new Error(
1632
+ `Error while instantiating HttpsProxyAgent with URL: "${proxy}"
1633
+ ${agentError}
1634
+ Check the following env vars "https_proxy" or "HTTPS_PROXY". The value should be a valid URL starting with "https://"`
1635
+ );
1636
+ }
1637
+ }
1638
+ } catch (e) {
1639
+ console.warn(`An error occurred in getProxyAgent(), no proxy agent will be used.`, e);
1640
+ }
1641
+ return void 0;
1642
+ }
backend/node_modules/@prisma/fetch-engine/dist/cleanupCache.d.ts ADDED
@@ -0,0 +1 @@
 
 
1
+ export declare function cleanupCache(n?: number): Promise<void>;
backend/node_modules/@prisma/fetch-engine/dist/cleanupCache.js ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var cleanupCache_exports = {};
20
+ __export(cleanupCache_exports, {
21
+ cleanupCache: () => import_chunk_3VVCXIQ5.cleanupCache
22
+ });
23
+ module.exports = __toCommonJS(cleanupCache_exports);
24
+ var import_chunk_3VVCXIQ5 = require("./chunk-3VVCXIQ5.js");
25
+ var import_chunk_FSAAZH62 = require("./chunk-FSAAZH62.js");
26
+ var import_chunk_LONQL55G = require("./chunk-LONQL55G.js");
27
+ var import_chunk_X37PZICB = require("./chunk-X37PZICB.js");
28
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
backend/node_modules/@prisma/fetch-engine/dist/download.d.ts ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { BinaryTarget } from '@prisma/get-platform';
2
+ import { BinaryType } from './BinaryType';
3
+ export declare const vercelPkgPathRegex: RegExp;
4
+ export type BinaryDownloadConfiguration = {
5
+ [binary in BinaryType]?: string;
6
+ };
7
+ export type BinaryPaths = {
8
+ [binary in BinaryType]?: {
9
+ [binaryTarget in BinaryTarget]: string;
10
+ };
11
+ };
12
+ export interface DownloadOptions {
13
+ binaries: BinaryDownloadConfiguration;
14
+ binaryTargets?: BinaryTarget[];
15
+ showProgress?: boolean;
16
+ progressCb?: (progress: number) => void;
17
+ version?: string;
18
+ skipDownload?: boolean;
19
+ failSilent?: boolean;
20
+ printVersion?: boolean;
21
+ skipCacheIntegrityCheck?: boolean;
22
+ }
23
+ export declare function download(options: DownloadOptions): Promise<BinaryPaths>;
24
+ export declare function getVersion(enginePath: string, binaryName: string): Promise<string | undefined>;
25
+ export declare function getBinaryName(binaryName: BinaryType, binaryTarget: BinaryTarget): string;
26
+ export declare function maybeCopyToTmp(file: string): Promise<string>;
27
+ export declare function plusX(file: any): void;
backend/node_modules/@prisma/fetch-engine/dist/env.d.ts ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { BinaryType } from './BinaryType';
2
+ export declare const engineEnvVarMap: {
3
+ "query-engine": string;
4
+ "libquery-engine": string;
5
+ "schema-engine": string;
6
+ };
7
+ export declare const deprecatedEnvVarMap: Partial<typeof engineEnvVarMap>;
8
+ type PathFromEnvValue = {
9
+ path: string;
10
+ fromEnvVar: string;
11
+ };
12
+ export declare function getBinaryEnvVarPath(binaryName: BinaryType): PathFromEnvValue | null;
13
+ export declare function allEngineEnvVarsSet(binaries: string[]): boolean;
14
+ export {};
backend/node_modules/@prisma/fetch-engine/dist/env.js ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var env_exports = {};
20
+ __export(env_exports, {
21
+ allEngineEnvVarsSet: () => import_chunk_QFA3XBMW.allEngineEnvVarsSet,
22
+ deprecatedEnvVarMap: () => import_chunk_QFA3XBMW.deprecatedEnvVarMap,
23
+ engineEnvVarMap: () => import_chunk_QFA3XBMW.engineEnvVarMap,
24
+ getBinaryEnvVarPath: () => import_chunk_QFA3XBMW.getBinaryEnvVarPath
25
+ });
26
+ module.exports = __toCommonJS(env_exports);
27
+ var import_chunk_QFA3XBMW = require("./chunk-QFA3XBMW.js");
28
+ var import_chunk_X37PZICB = require("./chunk-X37PZICB.js");
29
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
backend/node_modules/@prisma/fetch-engine/dist/getHash.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var getHash_exports = {};
20
+ __export(getHash_exports, {
21
+ getHash: () => import_chunk_FKGWOTGU.getHash
22
+ });
23
+ module.exports = __toCommonJS(getHash_exports);
24
+ var import_chunk_FKGWOTGU = require("./chunk-FKGWOTGU.js");
25
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
backend/node_modules/@prisma/fetch-engine/dist/getProxyAgent.d.ts ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ import { HttpProxyAgent } from 'http-proxy-agent';
2
+ import { HttpsProxyAgent } from 'https-proxy-agent';
3
+ export declare function getProxyAgent(url: string): HttpProxyAgent<string> | HttpsProxyAgent<string> | undefined;
backend/node_modules/@prisma/fetch-engine/dist/getProxyAgent.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var getProxyAgent_exports = {};
20
+ __export(getProxyAgent_exports, {
21
+ getProxyAgent: () => import_chunk_VAPNG6TS.getProxyAgent
22
+ });
23
+ module.exports = __toCommonJS(getProxyAgent_exports);
24
+ var import_chunk_VAPNG6TS = require("./chunk-VAPNG6TS.js");
25
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
backend/node_modules/@prisma/fetch-engine/dist/index.js ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var index_exports = {};
20
+ __export(index_exports, {
21
+ BinaryType: () => import_chunk_X37PZICB.BinaryType,
22
+ allEngineEnvVarsSet: () => import_chunk_QFA3XBMW.allEngineEnvVarsSet,
23
+ deprecatedEnvVarMap: () => import_chunk_QFA3XBMW.deprecatedEnvVarMap,
24
+ download: () => import_chunk_CCMBPDR2.download,
25
+ engineEnvVarMap: () => import_chunk_QFA3XBMW.engineEnvVarMap,
26
+ getBinaryEnvVarPath: () => import_chunk_QFA3XBMW.getBinaryEnvVarPath,
27
+ getBinaryName: () => import_chunk_CCMBPDR2.getBinaryName,
28
+ getCacheDir: () => import_chunk_LONQL55G.getCacheDir,
29
+ getProxyAgent: () => import_chunk_VAPNG6TS.getProxyAgent,
30
+ getVersion: () => import_chunk_CCMBPDR2.getVersion,
31
+ maybeCopyToTmp: () => import_chunk_CCMBPDR2.maybeCopyToTmp,
32
+ overwriteFile: () => import_chunk_LONQL55G.overwriteFile,
33
+ plusX: () => import_chunk_CCMBPDR2.plusX,
34
+ vercelPkgPathRegex: () => import_chunk_CCMBPDR2.vercelPkgPathRegex
35
+ });
36
+ module.exports = __toCommonJS(index_exports);
37
+ var import_chunk_CCMBPDR2 = require("./chunk-CCMBPDR2.js");
38
+ var import_chunk_MWVY55RY = require("./chunk-MWVY55RY.js");
39
+ var import_chunk_7JLQJWOR = require("./chunk-7JLQJWOR.js");
40
+ var import_chunk_3VVCXIQ5 = require("./chunk-3VVCXIQ5.js");
41
+ var import_chunk_CY52DY2B = require("./chunk-CY52DY2B.js");
42
+ var import_chunk_RXM4EBGR = require("./chunk-RXM4EBGR.js");
43
+ var import_chunk_FSAAZH62 = require("./chunk-FSAAZH62.js");
44
+ var import_chunk_LONQL55G = require("./chunk-LONQL55G.js");
45
+ var import_chunk_QFA3XBMW = require("./chunk-QFA3XBMW.js");
46
+ var import_chunk_X37PZICB = require("./chunk-X37PZICB.js");
47
+ var import_chunk_FKGWOTGU = require("./chunk-FKGWOTGU.js");
48
+ var import_chunk_VAPNG6TS = require("./chunk-VAPNG6TS.js");
49
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
backend/node_modules/@prisma/fetch-engine/dist/log.d.ts ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import Progress from 'progress';
2
+ export declare function getBar(text: any): Progress;
backend/node_modules/@prisma/fetch-engine/dist/log.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var log_exports = {};
20
+ __export(log_exports, {
21
+ getBar: () => import_chunk_MWVY55RY.getBar
22
+ });
23
+ module.exports = __toCommonJS(log_exports);
24
+ var import_chunk_MWVY55RY = require("./chunk-MWVY55RY.js");
25
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
backend/node_modules/@prisma/fetch-engine/dist/multipart-parser-ASKQAOL4.js ADDED
@@ -0,0 +1,374 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var multipart_parser_ASKQAOL4_exports = {};
20
+ __export(multipart_parser_ASKQAOL4_exports, {
21
+ toFormData: () => toFormData
22
+ });
23
+ module.exports = __toCommonJS(multipart_parser_ASKQAOL4_exports);
24
+ var import_chunk_RXM4EBGR = require("./chunk-RXM4EBGR.js");
25
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
26
+ var s = 0;
27
+ var S = {
28
+ START_BOUNDARY: s++,
29
+ HEADER_FIELD_START: s++,
30
+ HEADER_FIELD: s++,
31
+ HEADER_VALUE_START: s++,
32
+ HEADER_VALUE: s++,
33
+ HEADER_VALUE_ALMOST_DONE: s++,
34
+ HEADERS_ALMOST_DONE: s++,
35
+ PART_DATA_START: s++,
36
+ PART_DATA: s++,
37
+ END: s++
38
+ };
39
+ var f = 1;
40
+ var F = {
41
+ PART_BOUNDARY: f,
42
+ LAST_BOUNDARY: f *= 2
43
+ };
44
+ var LF = 10;
45
+ var CR = 13;
46
+ var SPACE = 32;
47
+ var HYPHEN = 45;
48
+ var COLON = 58;
49
+ var A = 97;
50
+ var Z = 122;
51
+ var lower = (c) => c | 32;
52
+ var noop = () => {
53
+ };
54
+ var MultipartParser = class {
55
+ /**
56
+ * @param {string} boundary
57
+ */
58
+ constructor(boundary) {
59
+ this.index = 0;
60
+ this.flags = 0;
61
+ this.onHeaderEnd = noop;
62
+ this.onHeaderField = noop;
63
+ this.onHeadersEnd = noop;
64
+ this.onHeaderValue = noop;
65
+ this.onPartBegin = noop;
66
+ this.onPartData = noop;
67
+ this.onPartEnd = noop;
68
+ this.boundaryChars = {};
69
+ boundary = "\r\n--" + boundary;
70
+ const ui8a = new Uint8Array(boundary.length);
71
+ for (let i = 0; i < boundary.length; i++) {
72
+ ui8a[i] = boundary.charCodeAt(i);
73
+ this.boundaryChars[ui8a[i]] = true;
74
+ }
75
+ this.boundary = ui8a;
76
+ this.lookbehind = new Uint8Array(this.boundary.length + 8);
77
+ this.state = S.START_BOUNDARY;
78
+ }
79
+ /**
80
+ * @param {Uint8Array} data
81
+ */
82
+ write(data) {
83
+ let i = 0;
84
+ const length_ = data.length;
85
+ let previousIndex = this.index;
86
+ let { lookbehind, boundary, boundaryChars, index, state, flags } = this;
87
+ const boundaryLength = this.boundary.length;
88
+ const boundaryEnd = boundaryLength - 1;
89
+ const bufferLength = data.length;
90
+ let c;
91
+ let cl;
92
+ const mark = (name) => {
93
+ this[name + "Mark"] = i;
94
+ };
95
+ const clear = (name) => {
96
+ delete this[name + "Mark"];
97
+ };
98
+ const callback = (callbackSymbol, start, end, ui8a) => {
99
+ if (start === void 0 || start !== end) {
100
+ this[callbackSymbol](ui8a && ui8a.subarray(start, end));
101
+ }
102
+ };
103
+ const dataCallback = (name, clear2) => {
104
+ const markSymbol = name + "Mark";
105
+ if (!(markSymbol in this)) {
106
+ return;
107
+ }
108
+ if (clear2) {
109
+ callback(name, this[markSymbol], i, data);
110
+ delete this[markSymbol];
111
+ } else {
112
+ callback(name, this[markSymbol], data.length, data);
113
+ this[markSymbol] = 0;
114
+ }
115
+ };
116
+ for (i = 0; i < length_; i++) {
117
+ c = data[i];
118
+ switch (state) {
119
+ case S.START_BOUNDARY:
120
+ if (index === boundary.length - 2) {
121
+ if (c === HYPHEN) {
122
+ flags |= F.LAST_BOUNDARY;
123
+ } else if (c !== CR) {
124
+ return;
125
+ }
126
+ index++;
127
+ break;
128
+ } else if (index - 1 === boundary.length - 2) {
129
+ if (flags & F.LAST_BOUNDARY && c === HYPHEN) {
130
+ state = S.END;
131
+ flags = 0;
132
+ } else if (!(flags & F.LAST_BOUNDARY) && c === LF) {
133
+ index = 0;
134
+ callback("onPartBegin");
135
+ state = S.HEADER_FIELD_START;
136
+ } else {
137
+ return;
138
+ }
139
+ break;
140
+ }
141
+ if (c !== boundary[index + 2]) {
142
+ index = -2;
143
+ }
144
+ if (c === boundary[index + 2]) {
145
+ index++;
146
+ }
147
+ break;
148
+ case S.HEADER_FIELD_START:
149
+ state = S.HEADER_FIELD;
150
+ mark("onHeaderField");
151
+ index = 0;
152
+ // falls through
153
+ case S.HEADER_FIELD:
154
+ if (c === CR) {
155
+ clear("onHeaderField");
156
+ state = S.HEADERS_ALMOST_DONE;
157
+ break;
158
+ }
159
+ index++;
160
+ if (c === HYPHEN) {
161
+ break;
162
+ }
163
+ if (c === COLON) {
164
+ if (index === 1) {
165
+ return;
166
+ }
167
+ dataCallback("onHeaderField", true);
168
+ state = S.HEADER_VALUE_START;
169
+ break;
170
+ }
171
+ cl = lower(c);
172
+ if (cl < A || cl > Z) {
173
+ return;
174
+ }
175
+ break;
176
+ case S.HEADER_VALUE_START:
177
+ if (c === SPACE) {
178
+ break;
179
+ }
180
+ mark("onHeaderValue");
181
+ state = S.HEADER_VALUE;
182
+ // falls through
183
+ case S.HEADER_VALUE:
184
+ if (c === CR) {
185
+ dataCallback("onHeaderValue", true);
186
+ callback("onHeaderEnd");
187
+ state = S.HEADER_VALUE_ALMOST_DONE;
188
+ }
189
+ break;
190
+ case S.HEADER_VALUE_ALMOST_DONE:
191
+ if (c !== LF) {
192
+ return;
193
+ }
194
+ state = S.HEADER_FIELD_START;
195
+ break;
196
+ case S.HEADERS_ALMOST_DONE:
197
+ if (c !== LF) {
198
+ return;
199
+ }
200
+ callback("onHeadersEnd");
201
+ state = S.PART_DATA_START;
202
+ break;
203
+ case S.PART_DATA_START:
204
+ state = S.PART_DATA;
205
+ mark("onPartData");
206
+ // falls through
207
+ case S.PART_DATA:
208
+ previousIndex = index;
209
+ if (index === 0) {
210
+ i += boundaryEnd;
211
+ while (i < bufferLength && !(data[i] in boundaryChars)) {
212
+ i += boundaryLength;
213
+ }
214
+ i -= boundaryEnd;
215
+ c = data[i];
216
+ }
217
+ if (index < boundary.length) {
218
+ if (boundary[index] === c) {
219
+ if (index === 0) {
220
+ dataCallback("onPartData", true);
221
+ }
222
+ index++;
223
+ } else {
224
+ index = 0;
225
+ }
226
+ } else if (index === boundary.length) {
227
+ index++;
228
+ if (c === CR) {
229
+ flags |= F.PART_BOUNDARY;
230
+ } else if (c === HYPHEN) {
231
+ flags |= F.LAST_BOUNDARY;
232
+ } else {
233
+ index = 0;
234
+ }
235
+ } else if (index - 1 === boundary.length) {
236
+ if (flags & F.PART_BOUNDARY) {
237
+ index = 0;
238
+ if (c === LF) {
239
+ flags &= ~F.PART_BOUNDARY;
240
+ callback("onPartEnd");
241
+ callback("onPartBegin");
242
+ state = S.HEADER_FIELD_START;
243
+ break;
244
+ }
245
+ } else if (flags & F.LAST_BOUNDARY) {
246
+ if (c === HYPHEN) {
247
+ callback("onPartEnd");
248
+ state = S.END;
249
+ flags = 0;
250
+ } else {
251
+ index = 0;
252
+ }
253
+ } else {
254
+ index = 0;
255
+ }
256
+ }
257
+ if (index > 0) {
258
+ lookbehind[index - 1] = c;
259
+ } else if (previousIndex > 0) {
260
+ const _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength);
261
+ callback("onPartData", 0, previousIndex, _lookbehind);
262
+ previousIndex = 0;
263
+ mark("onPartData");
264
+ i--;
265
+ }
266
+ break;
267
+ case S.END:
268
+ break;
269
+ default:
270
+ throw new Error(`Unexpected state entered: ${state}`);
271
+ }
272
+ }
273
+ dataCallback("onHeaderField");
274
+ dataCallback("onHeaderValue");
275
+ dataCallback("onPartData");
276
+ this.index = index;
277
+ this.state = state;
278
+ this.flags = flags;
279
+ }
280
+ end() {
281
+ if (this.state === S.HEADER_FIELD_START && this.index === 0 || this.state === S.PART_DATA && this.index === this.boundary.length) {
282
+ this.onPartEnd();
283
+ } else if (this.state !== S.END) {
284
+ throw new Error("MultipartParser.end(): stream ended unexpectedly");
285
+ }
286
+ }
287
+ };
288
+ function _fileName(headerValue) {
289
+ const m = headerValue.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
290
+ if (!m) {
291
+ return;
292
+ }
293
+ const match = m[2] || m[3] || "";
294
+ let filename = match.slice(match.lastIndexOf("\\") + 1);
295
+ filename = filename.replace(/%22/g, '"');
296
+ filename = filename.replace(/&#(\d{4});/g, (m2, code) => {
297
+ return String.fromCharCode(code);
298
+ });
299
+ return filename;
300
+ }
301
+ async function toFormData(Body, ct) {
302
+ if (!/multipart/i.test(ct)) {
303
+ throw new TypeError("Failed to fetch");
304
+ }
305
+ const m = ct.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
306
+ if (!m) {
307
+ throw new TypeError("no or bad content-type header, no multipart boundary");
308
+ }
309
+ const parser = new MultipartParser(m[1] || m[2]);
310
+ let headerField;
311
+ let headerValue;
312
+ let entryValue;
313
+ let entryName;
314
+ let contentType;
315
+ let filename;
316
+ const entryChunks = [];
317
+ const formData = new import_chunk_RXM4EBGR.FormData();
318
+ const onPartData = (ui8a) => {
319
+ entryValue += decoder.decode(ui8a, { stream: true });
320
+ };
321
+ const appendToFile = (ui8a) => {
322
+ entryChunks.push(ui8a);
323
+ };
324
+ const appendFileToFormData = () => {
325
+ const file = new import_chunk_RXM4EBGR.file_default(entryChunks, filename, { type: contentType });
326
+ formData.append(entryName, file);
327
+ };
328
+ const appendEntryToFormData = () => {
329
+ formData.append(entryName, entryValue);
330
+ };
331
+ const decoder = new TextDecoder("utf-8");
332
+ decoder.decode();
333
+ parser.onPartBegin = function() {
334
+ parser.onPartData = onPartData;
335
+ parser.onPartEnd = appendEntryToFormData;
336
+ headerField = "";
337
+ headerValue = "";
338
+ entryValue = "";
339
+ entryName = "";
340
+ contentType = "";
341
+ filename = null;
342
+ entryChunks.length = 0;
343
+ };
344
+ parser.onHeaderField = function(ui8a) {
345
+ headerField += decoder.decode(ui8a, { stream: true });
346
+ };
347
+ parser.onHeaderValue = function(ui8a) {
348
+ headerValue += decoder.decode(ui8a, { stream: true });
349
+ };
350
+ parser.onHeaderEnd = function() {
351
+ headerValue += decoder.decode();
352
+ headerField = headerField.toLowerCase();
353
+ if (headerField === "content-disposition") {
354
+ const m2 = headerValue.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
355
+ if (m2) {
356
+ entryName = m2[2] || m2[3] || "";
357
+ }
358
+ filename = _fileName(headerValue);
359
+ if (filename) {
360
+ parser.onPartData = appendToFile;
361
+ parser.onPartEnd = appendFileToFormData;
362
+ }
363
+ } else if (headerField === "content-type") {
364
+ contentType = headerValue;
365
+ }
366
+ headerValue = "";
367
+ headerField = "";
368
+ };
369
+ for await (const chunk of Body) {
370
+ parser.write(chunk);
371
+ }
372
+ parser.end();
373
+ return formData;
374
+ }
backend/node_modules/@prisma/fetch-engine/dist/utils.d.ts ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { BinaryTarget } from '@prisma/get-platform';
2
+ export declare function getRootCacheDir(): Promise<string | null>;
3
+ export declare function getCacheDir(channel: string, version: string, binaryTarget: string): Promise<string | null>;
4
+ export declare function getDownloadUrl({ channel, version, binaryTarget, binaryName, extension, }: {
5
+ channel: string;
6
+ version: string;
7
+ binaryTarget: BinaryTarget;
8
+ binaryName: string;
9
+ extension?: string;
10
+ }): string;
11
+ export declare function overwriteFile(sourcePath: string, targetPath: string): Promise<void>;
backend/node_modules/effect/.index/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/.index.js",
4
+ "module": "../dist/esm/.index.js",
5
+ "types": "../dist/dts/.index.d.ts"
6
+ }
backend/node_modules/effect/Arbitrary/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/Arbitrary.js",
4
+ "module": "../dist/esm/Arbitrary.js",
5
+ "types": "../dist/dts/Arbitrary.d.ts"
6
+ }
backend/node_modules/effect/Array/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/Array.js",
4
+ "module": "../dist/esm/Array.js",
5
+ "types": "../dist/dts/Array.d.ts"
6
+ }
backend/node_modules/effect/BigDecimal/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/BigDecimal.js",
4
+ "module": "../dist/esm/BigDecimal.js",
5
+ "types": "../dist/dts/BigDecimal.d.ts"
6
+ }
backend/node_modules/effect/Boolean/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/Boolean.js",
4
+ "module": "../dist/esm/Boolean.js",
5
+ "types": "../dist/dts/Boolean.d.ts"
6
+ }
backend/node_modules/effect/Brand/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/Brand.js",
4
+ "module": "../dist/esm/Brand.js",
5
+ "types": "../dist/dts/Brand.d.ts"
6
+ }
backend/node_modules/effect/Cache/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/Cache.js",
4
+ "module": "../dist/esm/Cache.js",
5
+ "types": "../dist/dts/Cache.d.ts"
6
+ }
backend/node_modules/effect/Cause/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/Cause.js",
4
+ "module": "../dist/esm/Cause.js",
5
+ "types": "../dist/dts/Cause.d.ts"
6
+ }
backend/node_modules/effect/Channel/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/Channel.js",
4
+ "module": "../dist/esm/Channel.js",
5
+ "types": "../dist/dts/Channel.d.ts"
6
+ }
backend/node_modules/effect/ChildExecutorDecision/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/ChildExecutorDecision.js",
4
+ "module": "../dist/esm/ChildExecutorDecision.js",
5
+ "types": "../dist/dts/ChildExecutorDecision.d.ts"
6
+ }
backend/node_modules/effect/Chunk/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/Chunk.js",
4
+ "module": "../dist/esm/Chunk.js",
5
+ "types": "../dist/dts/Chunk.d.ts"
6
+ }
backend/node_modules/effect/Config/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/Config.js",
4
+ "module": "../dist/esm/Config.js",
5
+ "types": "../dist/dts/Config.d.ts"
6
+ }
backend/node_modules/effect/ConfigError/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/ConfigError.js",
4
+ "module": "../dist/esm/ConfigError.js",
5
+ "types": "../dist/dts/ConfigError.d.ts"
6
+ }
backend/node_modules/effect/DateTime/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/DateTime.js",
4
+ "module": "../dist/esm/DateTime.js",
5
+ "types": "../dist/dts/DateTime.d.ts"
6
+ }
backend/node_modules/effect/DefaultServices/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/DefaultServices.js",
4
+ "module": "../dist/esm/DefaultServices.js",
5
+ "types": "../dist/dts/DefaultServices.d.ts"
6
+ }
backend/node_modules/effect/Deferred/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/Deferred.js",
4
+ "module": "../dist/esm/Deferred.js",
5
+ "types": "../dist/dts/Deferred.d.ts"
6
+ }
backend/node_modules/effect/Differ/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/Differ.js",
4
+ "module": "../dist/esm/Differ.js",
5
+ "types": "../dist/dts/Differ.d.ts"
6
+ }
backend/node_modules/effect/Effect/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/Effect.js",
4
+ "module": "../dist/esm/Effect.js",
5
+ "types": "../dist/dts/Effect.d.ts"
6
+ }
backend/node_modules/effect/Encoding/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/Encoding.js",
4
+ "module": "../dist/esm/Encoding.js",
5
+ "types": "../dist/dts/Encoding.d.ts"
6
+ }
backend/node_modules/effect/Equivalence/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/Equivalence.js",
4
+ "module": "../dist/esm/Equivalence.js",
5
+ "types": "../dist/dts/Equivalence.d.ts"
6
+ }
backend/node_modules/effect/ExecutionPlan/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/ExecutionPlan.js",
4
+ "module": "../dist/esm/ExecutionPlan.js",
5
+ "types": "../dist/dts/ExecutionPlan.d.ts"
6
+ }
backend/node_modules/effect/FastCheck/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/FastCheck.js",
4
+ "module": "../dist/esm/FastCheck.js",
5
+ "types": "../dist/dts/FastCheck.d.ts"
6
+ }
backend/node_modules/effect/FiberRef/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/FiberRef.js",
4
+ "module": "../dist/esm/FiberRef.js",
5
+ "types": "../dist/dts/FiberRef.d.ts"
6
+ }
backend/node_modules/effect/FiberRefs/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/FiberRefs.js",
4
+ "module": "../dist/esm/FiberRefs.js",
5
+ "types": "../dist/dts/FiberRefs.d.ts"
6
+ }
backend/node_modules/effect/FiberSet/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/cjs/FiberSet.js",
4
+ "module": "../dist/esm/FiberSet.js",
5
+ "types": "../dist/dts/FiberSet.d.ts"
6
+ }