@autoglm.js/cli 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +230 -0
- package/dist/Config-BFfUabcq.mjs +215 -0
- package/dist/Devices-Bcw7H-ua.mjs +235 -0
- package/dist/Help-BZfoJEGE.mjs +167 -0
- package/dist/InstallKeyboard-4dIO_YlT.mjs +71 -0
- package/dist/Tasks-2Hupx2WP.mjs +246 -0
- package/dist/Welcome-CxaX8LEp.mjs +55 -0
- package/dist/index.mjs +3334 -0
- package/package.json +74 -0
- package/schema/agent-config.schema.json +69 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,3334 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import process$1 from "node:process";
|
|
4
|
+
import { Box, Text, render, useInput } from "ink";
|
|
5
|
+
import { I18nextProvider, initReactI18next, useTranslation, useTranslation as useTranslation$1 } from "react-i18next";
|
|
6
|
+
import { MemoryRouter, Route, Routes, useNavigate } from "react-router";
|
|
7
|
+
import { Component, createContext, lazy, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import fs from "node:fs";
|
|
10
|
+
import { loadConfigSync } from "unconfig";
|
|
11
|
+
import { join } from "node:path";
|
|
12
|
+
import { AUTOGLM_FILEPATH, AutoGLM, ErrorCode, EventType } from "autoglm.js";
|
|
13
|
+
import i18next from "i18next";
|
|
14
|
+
import BigText from "ink-big-text";
|
|
15
|
+
import Gradient from "ink-gradient";
|
|
16
|
+
import { ScrollList } from "ink-scroll-list";
|
|
17
|
+
import { create } from "zustand";
|
|
18
|
+
import TextInput from "ink-text-input";
|
|
19
|
+
|
|
20
|
+
//#region rolldown:runtime
|
|
21
|
+
var __create = Object.create;
|
|
22
|
+
var __defProp = Object.defineProperty;
|
|
23
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
24
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
25
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
26
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
27
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
31
|
+
key = keys[i];
|
|
32
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
33
|
+
__defProp(to, key, {
|
|
34
|
+
get: ((k) => from[k]).bind(null, key),
|
|
35
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return to;
|
|
41
|
+
};
|
|
42
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
43
|
+
value: mod,
|
|
44
|
+
enumerable: true
|
|
45
|
+
}) : target, mod));
|
|
46
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region ../../node_modules/.pnpm/minimist@1.2.8/node_modules/minimist/index.js
|
|
50
|
+
var require_minimist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
51
|
+
function hasKey(obj, keys) {
|
|
52
|
+
var o = obj;
|
|
53
|
+
keys.slice(0, -1).forEach(function(key) {
|
|
54
|
+
o = o[key] || {};
|
|
55
|
+
});
|
|
56
|
+
return keys[keys.length - 1] in o;
|
|
57
|
+
}
|
|
58
|
+
function isNumber(x) {
|
|
59
|
+
if (typeof x === "number") return true;
|
|
60
|
+
if (/^0x[0-9a-f]+$/i.test(x)) return true;
|
|
61
|
+
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
|
|
62
|
+
}
|
|
63
|
+
function isConstructorOrProto(obj, key) {
|
|
64
|
+
return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
|
|
65
|
+
}
|
|
66
|
+
module.exports = function(args, opts) {
|
|
67
|
+
if (!opts) opts = {};
|
|
68
|
+
var flags = {
|
|
69
|
+
bools: {},
|
|
70
|
+
strings: {},
|
|
71
|
+
unknownFn: null
|
|
72
|
+
};
|
|
73
|
+
if (typeof opts.unknown === "function") flags.unknownFn = opts.unknown;
|
|
74
|
+
if (typeof opts.boolean === "boolean" && opts.boolean) flags.allBools = true;
|
|
75
|
+
else [].concat(opts.boolean).filter(Boolean).forEach(function(key$1) {
|
|
76
|
+
flags.bools[key$1] = true;
|
|
77
|
+
});
|
|
78
|
+
var aliases = {};
|
|
79
|
+
function aliasIsBoolean(key$1) {
|
|
80
|
+
return aliases[key$1].some(function(x) {
|
|
81
|
+
return flags.bools[x];
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
Object.keys(opts.alias || {}).forEach(function(key$1) {
|
|
85
|
+
aliases[key$1] = [].concat(opts.alias[key$1]);
|
|
86
|
+
aliases[key$1].forEach(function(x) {
|
|
87
|
+
aliases[x] = [key$1].concat(aliases[key$1].filter(function(y) {
|
|
88
|
+
return x !== y;
|
|
89
|
+
}));
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
[].concat(opts.string).filter(Boolean).forEach(function(key$1) {
|
|
93
|
+
flags.strings[key$1] = true;
|
|
94
|
+
if (aliases[key$1]) [].concat(aliases[key$1]).forEach(function(k) {
|
|
95
|
+
flags.strings[k] = true;
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
var defaults = opts.default || {};
|
|
99
|
+
var argv = { _: [] };
|
|
100
|
+
function argDefined(key$1, arg$1) {
|
|
101
|
+
return flags.allBools && /^--[^=]+$/.test(arg$1) || flags.strings[key$1] || flags.bools[key$1] || aliases[key$1];
|
|
102
|
+
}
|
|
103
|
+
function setKey(obj, keys, value$1) {
|
|
104
|
+
var o = obj;
|
|
105
|
+
for (var i$1 = 0; i$1 < keys.length - 1; i$1++) {
|
|
106
|
+
var key$1 = keys[i$1];
|
|
107
|
+
if (isConstructorOrProto(o, key$1)) return;
|
|
108
|
+
if (o[key$1] === void 0) o[key$1] = {};
|
|
109
|
+
if (o[key$1] === Object.prototype || o[key$1] === Number.prototype || o[key$1] === String.prototype) o[key$1] = {};
|
|
110
|
+
if (o[key$1] === Array.prototype) o[key$1] = [];
|
|
111
|
+
o = o[key$1];
|
|
112
|
+
}
|
|
113
|
+
var lastKey = keys[keys.length - 1];
|
|
114
|
+
if (isConstructorOrProto(o, lastKey)) return;
|
|
115
|
+
if (o === Object.prototype || o === Number.prototype || o === String.prototype) o = {};
|
|
116
|
+
if (o === Array.prototype) o = [];
|
|
117
|
+
if (o[lastKey] === void 0 || flags.bools[lastKey] || typeof o[lastKey] === "boolean") o[lastKey] = value$1;
|
|
118
|
+
else if (Array.isArray(o[lastKey])) o[lastKey].push(value$1);
|
|
119
|
+
else o[lastKey] = [o[lastKey], value$1];
|
|
120
|
+
}
|
|
121
|
+
function setArg(key$1, val, arg$1) {
|
|
122
|
+
if (arg$1 && flags.unknownFn && !argDefined(key$1, arg$1)) {
|
|
123
|
+
if (flags.unknownFn(arg$1) === false) return;
|
|
124
|
+
}
|
|
125
|
+
var value$1 = !flags.strings[key$1] && isNumber(val) ? Number(val) : val;
|
|
126
|
+
setKey(argv, key$1.split("."), value$1);
|
|
127
|
+
(aliases[key$1] || []).forEach(function(x) {
|
|
128
|
+
setKey(argv, x.split("."), value$1);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
Object.keys(flags.bools).forEach(function(key$1) {
|
|
132
|
+
setArg(key$1, defaults[key$1] === void 0 ? false : defaults[key$1]);
|
|
133
|
+
});
|
|
134
|
+
var notFlags = [];
|
|
135
|
+
if (args.indexOf("--") !== -1) {
|
|
136
|
+
notFlags = args.slice(args.indexOf("--") + 1);
|
|
137
|
+
args = args.slice(0, args.indexOf("--"));
|
|
138
|
+
}
|
|
139
|
+
for (var i = 0; i < args.length; i++) {
|
|
140
|
+
var arg = args[i];
|
|
141
|
+
var key;
|
|
142
|
+
var next;
|
|
143
|
+
if (/^--.+=/.test(arg)) {
|
|
144
|
+
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
|
|
145
|
+
key = m[1];
|
|
146
|
+
var value = m[2];
|
|
147
|
+
if (flags.bools[key]) value = value !== "false";
|
|
148
|
+
setArg(key, value, arg);
|
|
149
|
+
} else if (/^--no-.+/.test(arg)) {
|
|
150
|
+
key = arg.match(/^--no-(.+)/)[1];
|
|
151
|
+
setArg(key, false, arg);
|
|
152
|
+
} else if (/^--.+/.test(arg)) {
|
|
153
|
+
key = arg.match(/^--(.+)/)[1];
|
|
154
|
+
next = args[i + 1];
|
|
155
|
+
if (next !== void 0 && !/^(-|--)[^-]/.test(next) && !flags.bools[key] && !flags.allBools && (aliases[key] ? !aliasIsBoolean(key) : true)) {
|
|
156
|
+
setArg(key, next, arg);
|
|
157
|
+
i += 1;
|
|
158
|
+
} else if (/^(true|false)$/.test(next)) {
|
|
159
|
+
setArg(key, next === "true", arg);
|
|
160
|
+
i += 1;
|
|
161
|
+
} else setArg(key, flags.strings[key] ? "" : true, arg);
|
|
162
|
+
} else if (/^-[^-]+/.test(arg)) {
|
|
163
|
+
var letters = arg.slice(1, -1).split("");
|
|
164
|
+
var broken = false;
|
|
165
|
+
for (var j = 0; j < letters.length; j++) {
|
|
166
|
+
next = arg.slice(j + 2);
|
|
167
|
+
if (next === "-") {
|
|
168
|
+
setArg(letters[j], next, arg);
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
if (/[A-Za-z]/.test(letters[j]) && next[0] === "=") {
|
|
172
|
+
setArg(letters[j], next.slice(1), arg);
|
|
173
|
+
broken = true;
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
|
|
177
|
+
setArg(letters[j], next, arg);
|
|
178
|
+
broken = true;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
|
|
182
|
+
setArg(letters[j], arg.slice(j + 2), arg);
|
|
183
|
+
broken = true;
|
|
184
|
+
break;
|
|
185
|
+
} else setArg(letters[j], flags.strings[letters[j]] ? "" : true, arg);
|
|
186
|
+
}
|
|
187
|
+
key = arg.slice(-1)[0];
|
|
188
|
+
if (!broken && key !== "-") if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key] && (aliases[key] ? !aliasIsBoolean(key) : true)) {
|
|
189
|
+
setArg(key, args[i + 1], arg);
|
|
190
|
+
i += 1;
|
|
191
|
+
} else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) {
|
|
192
|
+
setArg(key, args[i + 1] === "true", arg);
|
|
193
|
+
i += 1;
|
|
194
|
+
} else setArg(key, flags.strings[key] ? "" : true, arg);
|
|
195
|
+
} else {
|
|
196
|
+
if (!flags.unknownFn || flags.unknownFn(arg) !== false) argv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg));
|
|
197
|
+
if (opts.stopEarly) {
|
|
198
|
+
argv._.push.apply(argv._, args.slice(i + 1));
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
Object.keys(defaults).forEach(function(k) {
|
|
204
|
+
if (!hasKey(argv, k.split("."))) {
|
|
205
|
+
setKey(argv, k.split("."), defaults[k]);
|
|
206
|
+
(aliases[k] || []).forEach(function(x) {
|
|
207
|
+
setKey(argv, x.split("."), defaults[k]);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
if (opts["--"]) argv["--"] = notFlags.slice();
|
|
212
|
+
else notFlags.forEach(function(k) {
|
|
213
|
+
argv._.push(k);
|
|
214
|
+
});
|
|
215
|
+
return argv;
|
|
216
|
+
};
|
|
217
|
+
}));
|
|
218
|
+
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/components/ErrorBoundary.tsx
|
|
221
|
+
var import_minimist = /* @__PURE__ */ __toESM(require_minimist());
|
|
222
|
+
var ErrorBoundary = class extends Component {
|
|
223
|
+
state = {
|
|
224
|
+
hasError: false,
|
|
225
|
+
error: null
|
|
226
|
+
};
|
|
227
|
+
static getDerivedStateFromError(error) {
|
|
228
|
+
return {
|
|
229
|
+
hasError: true,
|
|
230
|
+
error
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
componentDidCatch(error, errorInfo) {
|
|
234
|
+
console.error("Error caught by boundary:", error);
|
|
235
|
+
console.error("Component stack:", errorInfo.componentStack);
|
|
236
|
+
}
|
|
237
|
+
render() {
|
|
238
|
+
if (this.state.hasError && this.state.error) {
|
|
239
|
+
if (this.props.fallback) return /* @__PURE__ */ jsx(Fragment, { children: this.props.fallback(this.state.error) });
|
|
240
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
241
|
+
flexDirection: "column",
|
|
242
|
+
padding: 2,
|
|
243
|
+
children: [
|
|
244
|
+
/* @__PURE__ */ jsx(Box, {
|
|
245
|
+
marginBottom: 1,
|
|
246
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
247
|
+
color: "red",
|
|
248
|
+
bold: true,
|
|
249
|
+
children: "Application Error"
|
|
250
|
+
})
|
|
251
|
+
}),
|
|
252
|
+
/* @__PURE__ */ jsx(Box, {
|
|
253
|
+
marginBottom: 1,
|
|
254
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
255
|
+
color: "white",
|
|
256
|
+
children: this.state.error.message
|
|
257
|
+
})
|
|
258
|
+
}),
|
|
259
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, {
|
|
260
|
+
color: "gray",
|
|
261
|
+
dimColor: true,
|
|
262
|
+
children: "Press /exit to quit and try again"
|
|
263
|
+
}) })
|
|
264
|
+
]
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
return this.props.children;
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
//#endregion
|
|
272
|
+
//#region src/constants/index.ts
|
|
273
|
+
const EVENT_TYPE_LABELS = {
|
|
274
|
+
start: {
|
|
275
|
+
label: "START",
|
|
276
|
+
color: "cyan"
|
|
277
|
+
},
|
|
278
|
+
thinking: {
|
|
279
|
+
label: "THINKING",
|
|
280
|
+
color: "yellow"
|
|
281
|
+
},
|
|
282
|
+
action: {
|
|
283
|
+
label: "ACTION",
|
|
284
|
+
color: "blue"
|
|
285
|
+
},
|
|
286
|
+
task_complete: {
|
|
287
|
+
label: "COMPLETE",
|
|
288
|
+
color: "green"
|
|
289
|
+
},
|
|
290
|
+
error: {
|
|
291
|
+
label: "ERROR",
|
|
292
|
+
color: "red"
|
|
293
|
+
},
|
|
294
|
+
aborted: {
|
|
295
|
+
label: "ABORTED",
|
|
296
|
+
color: "magenta"
|
|
297
|
+
},
|
|
298
|
+
thinking_stream: {
|
|
299
|
+
label: "THINKING",
|
|
300
|
+
color: "yellow"
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
const DEFAULT_CONFIG = {
|
|
304
|
+
maxSteps: 100,
|
|
305
|
+
lang: "cn",
|
|
306
|
+
baseUrl: "https://open.bigmodel.cn/api/paas/v4/",
|
|
307
|
+
apiKey: "",
|
|
308
|
+
model: "autoglm-phone",
|
|
309
|
+
maxTokens: 2048,
|
|
310
|
+
temperature: .5,
|
|
311
|
+
topP: .5,
|
|
312
|
+
frequencyPenalty: .5,
|
|
313
|
+
screenshotQuality: 80
|
|
314
|
+
};
|
|
315
|
+
const AUTOGLM_CONFIG_FILEPATH = join(AUTOGLM_FILEPATH, "config.json");
|
|
316
|
+
|
|
317
|
+
//#endregion
|
|
318
|
+
//#region src/config/index.ts
|
|
319
|
+
function loadCliConfig(customConfigPath) {
|
|
320
|
+
const configPath = customConfigPath ?? AUTOGLM_CONFIG_FILEPATH;
|
|
321
|
+
if (!customConfigPath && !fs.existsSync(configPath)) return DEFAULT_CONFIG;
|
|
322
|
+
const { config: config$1 } = loadConfigSync({
|
|
323
|
+
sources: [{ files: configPath }],
|
|
324
|
+
defaults: DEFAULT_CONFIG,
|
|
325
|
+
merge: true
|
|
326
|
+
});
|
|
327
|
+
return config$1;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
//#endregion
|
|
331
|
+
//#region src/locales/en-US.ts
|
|
332
|
+
var en_US_default = {
|
|
333
|
+
welcome: {
|
|
334
|
+
enterTask: "Enter Your Task Below",
|
|
335
|
+
example: "Example: \"Open browser and search for AI news\"",
|
|
336
|
+
pressEnter: "to submit",
|
|
337
|
+
typeSlash: "for commands",
|
|
338
|
+
enter: "⏎ Enter",
|
|
339
|
+
slash: "/"
|
|
340
|
+
},
|
|
341
|
+
config: {
|
|
342
|
+
apiSettings: "API Settings",
|
|
343
|
+
generationParameters: "Generation Parameters",
|
|
344
|
+
systemSettings: "System Settings",
|
|
345
|
+
systemPrompt: "System Prompt",
|
|
346
|
+
baseUrl: "Base URL",
|
|
347
|
+
baseUrlDesc: "Base URL for API service",
|
|
348
|
+
apiKey: "API Key",
|
|
349
|
+
apiKeyDesc: "API key for authentication",
|
|
350
|
+
apiKeyMasked: (key) => `${key.slice(0, 10)}*****${key.slice(-10)}`,
|
|
351
|
+
model: "Model",
|
|
352
|
+
modelDesc: "AI model name to use",
|
|
353
|
+
maxTokens: "Max Tokens",
|
|
354
|
+
maxTokensDesc: "Maximum length of generated text",
|
|
355
|
+
temperature: "Temperature",
|
|
356
|
+
temperatureDesc: "Controls randomness of generated text (0-1)",
|
|
357
|
+
topP: "Top P",
|
|
358
|
+
topPDesc: "Nucleus sampling parameter for vocabulary selection",
|
|
359
|
+
frequencyPenalty: "Frequency Penalty",
|
|
360
|
+
frequencyPenaltyDesc: "Reduces repetition of words",
|
|
361
|
+
deviceId: "Device ID",
|
|
362
|
+
deviceIdDesc: "Unique device identifier",
|
|
363
|
+
maxSteps: "Max Steps",
|
|
364
|
+
maxStepsDesc: "Maximum execution steps",
|
|
365
|
+
lang: "Language",
|
|
366
|
+
langDesc: "Interface display language",
|
|
367
|
+
screenshotQuality: "Screenshot Quality",
|
|
368
|
+
screenshotQualityDesc: "Quality of screenshots (1-100)",
|
|
369
|
+
notSet: "Not Set",
|
|
370
|
+
na: "N/A"
|
|
371
|
+
},
|
|
372
|
+
devices: {
|
|
373
|
+
title: "Connected Devices",
|
|
374
|
+
noDevices: "No devices connected",
|
|
375
|
+
refreshHint: "Press Ctrl+R to refresh device list",
|
|
376
|
+
device: "Device",
|
|
377
|
+
status: "Status",
|
|
378
|
+
current: "Current",
|
|
379
|
+
online: "ONLINE",
|
|
380
|
+
unauthorized: "UNAUTHORIZED",
|
|
381
|
+
offline: "OFFLINE",
|
|
382
|
+
deviceId: "Device ID",
|
|
383
|
+
connection: "Connection",
|
|
384
|
+
brand: "Brand",
|
|
385
|
+
android: "Android",
|
|
386
|
+
api: "API",
|
|
387
|
+
navigateHint: "Use ↑↓ to navigate, Enter to select device, Ctrl+R to refresh",
|
|
388
|
+
refreshing: "Refreshing devices..."
|
|
389
|
+
},
|
|
390
|
+
tasks: {
|
|
391
|
+
running: "Running",
|
|
392
|
+
idle: "Idle",
|
|
393
|
+
currentTask: "Current Task",
|
|
394
|
+
noTask: "No active task",
|
|
395
|
+
device: "Device",
|
|
396
|
+
events: "Events"
|
|
397
|
+
},
|
|
398
|
+
installKeyboard: {
|
|
399
|
+
title: "Installing ADB Keyboard",
|
|
400
|
+
description: "ADB Keyboard is a key application for controlling phone input, used to automatically enter text on the device during task execution.",
|
|
401
|
+
confirmPrompt: "Please confirm the installation request on your phone",
|
|
402
|
+
confirmHint: "If you don't see the installation prompt, please check your phone screen",
|
|
403
|
+
manualInstall: {
|
|
404
|
+
hint: "Manual installation: You can download from",
|
|
405
|
+
link: "https://github.com/senzhk/ADBKeyBoard/blob/master/ADBKeyboard.apk",
|
|
406
|
+
instruction: "and install it manually"
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
help: {
|
|
410
|
+
title: "Help Center",
|
|
411
|
+
genericHelp: "General Help",
|
|
412
|
+
noErrorCode: "No error code provided: {{code}}",
|
|
413
|
+
adbDeviceUnconnected: {
|
|
414
|
+
title: "ADB Device Connection Error",
|
|
415
|
+
problemDescription: "Problem Description",
|
|
416
|
+
deviceUnconnected: "Cannot detect connected Android device",
|
|
417
|
+
checkSteps: "Please follow these steps to check device connection status",
|
|
418
|
+
solution: "Solution",
|
|
419
|
+
ensureConnected: "Ensure the device is connected to the computer via USB cable",
|
|
420
|
+
enableDeveloperOptions: "Enable Developer Options on the device:",
|
|
421
|
+
aboutPhone: " • Go to Settings > About Phone",
|
|
422
|
+
tapVersion: " • Tap \"Version number\" 7 times continuously",
|
|
423
|
+
enableUsbDebugging: "Enable USB Debugging:",
|
|
424
|
+
developerOptions: " • Go to Settings > Developer Options",
|
|
425
|
+
turnOnUsbDebugging: " • Turn on \"USB Debugging\" switch",
|
|
426
|
+
authorizeUsbDebugging: "Authorize USB Debugging:",
|
|
427
|
+
allowUsbDebugging: " • Tap \"Allow USB debugging\" on the device when connecting",
|
|
428
|
+
alwaysAllow: " • Check \"Always allow from this computer\" option",
|
|
429
|
+
checkConnection: "Check connection status:",
|
|
430
|
+
reconnectUsb: " • Reconnect the USB cable",
|
|
431
|
+
fileTransferMode: " • Select \"File Transfer\" mode on the device",
|
|
432
|
+
commonIssues: "Common Issues",
|
|
433
|
+
noUsbDebuggingOption: "• If \"USB Debugging\" option is not displayed, please confirm Developer Options is enabled",
|
|
434
|
+
secureSettings: "• Some devices require enabling \"USB Debugging (Security Settings)\" in Developer Options",
|
|
435
|
+
directConnection: "• If using a USB Hub, try connecting directly to the computer USB port",
|
|
436
|
+
dataCable: "• Check if the USB cable supports data transfer (some charging cables only support charging)",
|
|
437
|
+
footer: "After completing the above steps, please try connecting the device again"
|
|
438
|
+
},
|
|
439
|
+
contactSupport: "Or contact technical support for more help",
|
|
440
|
+
noSpecificHelp: "For help with specific errors, please jump to this page from the error page"
|
|
441
|
+
},
|
|
442
|
+
version: {
|
|
443
|
+
title: "Version Info",
|
|
444
|
+
cli: "CLI",
|
|
445
|
+
core: "Core",
|
|
446
|
+
builtWith: "Built with ❤ by FliPPeDround"
|
|
447
|
+
},
|
|
448
|
+
commands: {
|
|
449
|
+
exit: "Exit the application",
|
|
450
|
+
home: "Navigate to home page",
|
|
451
|
+
tasks: "Navigate to tasks page",
|
|
452
|
+
config: "View current configuration",
|
|
453
|
+
devices: "View and select connected devices",
|
|
454
|
+
abort: "Abort the current task"
|
|
455
|
+
},
|
|
456
|
+
configTip: {
|
|
457
|
+
title: "Configuration Tip",
|
|
458
|
+
createConfigFile: "Create a config file at"
|
|
459
|
+
},
|
|
460
|
+
systemPrompt: { description: "System prompt to guide AI behavior and response style" },
|
|
461
|
+
eventLog: {
|
|
462
|
+
activity: "ACTIVITY:",
|
|
463
|
+
scrollHint: "↑↓ Scroll | PgUp/PgDn Page"
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
//#endregion
|
|
468
|
+
//#region src/locales/zh-CN.ts
|
|
469
|
+
var zh_CN_default = {
|
|
470
|
+
welcome: {
|
|
471
|
+
enterTask: "输入您的任务",
|
|
472
|
+
example: "示例:\"打开浏览器并搜索AI新闻\"",
|
|
473
|
+
pressEnter: "提交",
|
|
474
|
+
typeSlash: "输入命令",
|
|
475
|
+
enter: "⏎ 回车",
|
|
476
|
+
slash: "/"
|
|
477
|
+
},
|
|
478
|
+
config: {
|
|
479
|
+
apiSettings: "API 设置",
|
|
480
|
+
generationParameters: "生成参数",
|
|
481
|
+
systemSettings: "系统设置",
|
|
482
|
+
systemPrompt: "系统提示词",
|
|
483
|
+
baseUrl: "基础URL",
|
|
484
|
+
baseUrlDesc: "API服务的基础URL",
|
|
485
|
+
apiKey: "API密钥",
|
|
486
|
+
apiKeyDesc: "用于认证的API密钥",
|
|
487
|
+
apiKeyMasked: (key) => `${key.slice(0, 10)}*****${key.slice(-10)}`,
|
|
488
|
+
model: "模型",
|
|
489
|
+
modelDesc: "使用的AI模型名称",
|
|
490
|
+
maxTokens: "最大Token数",
|
|
491
|
+
maxTokensDesc: "生成文本的最大长度",
|
|
492
|
+
temperature: "温度",
|
|
493
|
+
temperatureDesc: "控制生成文本的随机性 (0-1)",
|
|
494
|
+
topP: "Top P",
|
|
495
|
+
topPDesc: "用于词汇选择的核采样参数",
|
|
496
|
+
frequencyPenalty: "频率惩罚",
|
|
497
|
+
frequencyPenaltyDesc: "减少词语重复",
|
|
498
|
+
deviceId: "设备ID",
|
|
499
|
+
deviceIdDesc: "唯一设备标识符",
|
|
500
|
+
maxSteps: "最大步骤数",
|
|
501
|
+
maxStepsDesc: "最大执行步骤",
|
|
502
|
+
lang: "语言",
|
|
503
|
+
langDesc: "界面显示语言",
|
|
504
|
+
screenshotQuality: "截图质量",
|
|
505
|
+
screenshotQualityDesc: "截图质量 (1-100)",
|
|
506
|
+
notSet: "未设置",
|
|
507
|
+
na: "不可用"
|
|
508
|
+
},
|
|
509
|
+
devices: {
|
|
510
|
+
title: "已连接的设备",
|
|
511
|
+
noDevices: "未连接任何设备",
|
|
512
|
+
refreshHint: "按 Ctrl+R 刷新设备列表",
|
|
513
|
+
device: "设备",
|
|
514
|
+
status: "状态",
|
|
515
|
+
current: "当前",
|
|
516
|
+
online: "在线",
|
|
517
|
+
unauthorized: "未授权",
|
|
518
|
+
offline: "离线",
|
|
519
|
+
deviceId: "设备ID",
|
|
520
|
+
connection: "连接类型",
|
|
521
|
+
brand: "品牌",
|
|
522
|
+
android: "安卓版本",
|
|
523
|
+
api: "API",
|
|
524
|
+
navigateHint: "使用 ↑↓ 导航,Enter 选择设备,Ctrl+R 刷新",
|
|
525
|
+
refreshing: "正在刷新设备..."
|
|
526
|
+
},
|
|
527
|
+
tasks: {
|
|
528
|
+
running: "运行中",
|
|
529
|
+
idle: "空闲",
|
|
530
|
+
currentTask: "当前任务",
|
|
531
|
+
noTask: "无活动任务",
|
|
532
|
+
device: "设备",
|
|
533
|
+
events: "事件日志"
|
|
534
|
+
},
|
|
535
|
+
installKeyboard: {
|
|
536
|
+
title: "正在安装 ADB 键盘",
|
|
537
|
+
description: "ADB 键盘是控制手机输入的关键应用,用于自动执行任务时在设备上输入文本。",
|
|
538
|
+
confirmPrompt: "请在您的手机上确认安装请求",
|
|
539
|
+
confirmHint: "如果没有看到安装提示,请检查手机屏幕",
|
|
540
|
+
manualInstall: {
|
|
541
|
+
hint: "手动安装:可从",
|
|
542
|
+
link: "https://github.com/senzhk/ADBKeyBoard/blob/master/ADBKeyboard.apk",
|
|
543
|
+
instruction: "下载后手动安装"
|
|
544
|
+
}
|
|
545
|
+
},
|
|
546
|
+
help: {
|
|
547
|
+
title: "帮助中心",
|
|
548
|
+
genericHelp: "通用帮助",
|
|
549
|
+
noErrorCode: "未提供错误代码: {{code}}",
|
|
550
|
+
adbDeviceUnconnected: {
|
|
551
|
+
title: "ADB设备连接错误",
|
|
552
|
+
problemDescription: "问题描述",
|
|
553
|
+
deviceUnconnected: "无法检测到已连接的Android设备",
|
|
554
|
+
checkSteps: "请按照以下步骤检查设备连接状态",
|
|
555
|
+
solution: "解决方案",
|
|
556
|
+
ensureConnected: "确保设备已通过USB线连接到电脑",
|
|
557
|
+
enableDeveloperOptions: "在设备上启用开发者选项:",
|
|
558
|
+
aboutPhone: " • 进入 设置 > 关于手机",
|
|
559
|
+
tapVersion: " • 连续点击\"版本号\"7次",
|
|
560
|
+
enableUsbDebugging: "启用USB调试:",
|
|
561
|
+
developerOptions: " • 进入 设置 > 开发者选项",
|
|
562
|
+
turnOnUsbDebugging: " • 开启\"USB调试\"开关",
|
|
563
|
+
authorizeUsbDebugging: "授权USB调试:",
|
|
564
|
+
allowUsbDebugging: " • 连接设备时,在设备上点击\"允许USB调试\"",
|
|
565
|
+
alwaysAllow: " • 勾选\"始终允许此计算机\"选项",
|
|
566
|
+
checkConnection: "检查连接状态:",
|
|
567
|
+
reconnectUsb: " • 重新插拔USB线",
|
|
568
|
+
fileTransferMode: " • 在设备上选择\"文件传输\"模式",
|
|
569
|
+
commonIssues: "常见问题",
|
|
570
|
+
noUsbDebuggingOption: "• 如果设备未显示\"USB调试\"选项,请确认开发者选项已启用",
|
|
571
|
+
secureSettings: "• 某些设备需要在\"开发者选项\"中开启\"USB调试(安全设置)\"",
|
|
572
|
+
directConnection: "• 如果使用USB Hub,请尝试直接连接到电脑USB端口",
|
|
573
|
+
dataCable: "• 检查USB线是否支持数据传输(部分充电线仅支持充电)",
|
|
574
|
+
footer: "完成以上步骤后,请重新尝试连接设备"
|
|
575
|
+
},
|
|
576
|
+
contactSupport: "或联系技术支持获取更多帮助",
|
|
577
|
+
noSpecificHelp: "如需特定错误的帮助信息,请从错误页面跳转至此"
|
|
578
|
+
},
|
|
579
|
+
version: {
|
|
580
|
+
title: "版本信息",
|
|
581
|
+
cli: "命令行",
|
|
582
|
+
core: "核心库",
|
|
583
|
+
builtWith: "由 FliPPeDround ❤ 构建"
|
|
584
|
+
},
|
|
585
|
+
commands: {
|
|
586
|
+
exit: "退出应用程序",
|
|
587
|
+
home: "导航到主页",
|
|
588
|
+
tasks: "导航到任务页面",
|
|
589
|
+
config: "查看当前配置",
|
|
590
|
+
devices: "查看和选择已连接的设备",
|
|
591
|
+
abort: "中止当前任务"
|
|
592
|
+
},
|
|
593
|
+
configTip: {
|
|
594
|
+
title: "配置提示",
|
|
595
|
+
createConfigFile: "在以下位置创建配置文件"
|
|
596
|
+
},
|
|
597
|
+
systemPrompt: { description: "用于指导 AI 行为和响应风格的系统提示词" },
|
|
598
|
+
eventLog: {
|
|
599
|
+
activity: "活动日志:",
|
|
600
|
+
scrollHint: "↑↓ 滚动 | PgUp/PgDn 翻页"
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
//#endregion
|
|
605
|
+
//#region src/locales/index.ts
|
|
606
|
+
i18next.use(initReactI18next).init({
|
|
607
|
+
resources: {
|
|
608
|
+
en: { translation: en_US_default },
|
|
609
|
+
zh: { translation: zh_CN_default }
|
|
610
|
+
},
|
|
611
|
+
lng: "zh",
|
|
612
|
+
fallbackLng: "en",
|
|
613
|
+
interpolation: { escapeValue: false }
|
|
614
|
+
});
|
|
615
|
+
var locales_default = i18next;
|
|
616
|
+
|
|
617
|
+
//#endregion
|
|
618
|
+
//#region ../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js
|
|
619
|
+
var require_universalify = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
620
|
+
exports.fromCallback = function(fn) {
|
|
621
|
+
return Object.defineProperty(function(...args) {
|
|
622
|
+
if (typeof args[args.length - 1] === "function") fn.apply(this, args);
|
|
623
|
+
else return new Promise((resolve, reject) => {
|
|
624
|
+
args.push((err, res) => err != null ? reject(err) : resolve(res));
|
|
625
|
+
fn.apply(this, args);
|
|
626
|
+
});
|
|
627
|
+
}, "name", { value: fn.name });
|
|
628
|
+
};
|
|
629
|
+
exports.fromPromise = function(fn) {
|
|
630
|
+
return Object.defineProperty(function(...args) {
|
|
631
|
+
const cb = args[args.length - 1];
|
|
632
|
+
if (typeof cb !== "function") return fn.apply(this, args);
|
|
633
|
+
else {
|
|
634
|
+
args.pop();
|
|
635
|
+
fn.apply(this, args).then((r) => cb(null, r), cb);
|
|
636
|
+
}
|
|
637
|
+
}, "name", { value: fn.name });
|
|
638
|
+
};
|
|
639
|
+
}));
|
|
640
|
+
|
|
641
|
+
//#endregion
|
|
642
|
+
//#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
|
|
643
|
+
var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
644
|
+
var constants = __require("constants");
|
|
645
|
+
var origCwd = process.cwd;
|
|
646
|
+
var cwd = null;
|
|
647
|
+
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
648
|
+
process.cwd = function() {
|
|
649
|
+
if (!cwd) cwd = origCwd.call(process);
|
|
650
|
+
return cwd;
|
|
651
|
+
};
|
|
652
|
+
try {
|
|
653
|
+
process.cwd();
|
|
654
|
+
} catch (er) {}
|
|
655
|
+
if (typeof process.chdir === "function") {
|
|
656
|
+
var chdir = process.chdir;
|
|
657
|
+
process.chdir = function(d) {
|
|
658
|
+
cwd = null;
|
|
659
|
+
chdir.call(process, d);
|
|
660
|
+
};
|
|
661
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
|
|
662
|
+
}
|
|
663
|
+
module.exports = patch$1;
|
|
664
|
+
function patch$1(fs$21) {
|
|
665
|
+
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs$21);
|
|
666
|
+
if (!fs$21.lutimes) patchLutimes(fs$21);
|
|
667
|
+
fs$21.chown = chownFix(fs$21.chown);
|
|
668
|
+
fs$21.fchown = chownFix(fs$21.fchown);
|
|
669
|
+
fs$21.lchown = chownFix(fs$21.lchown);
|
|
670
|
+
fs$21.chmod = chmodFix(fs$21.chmod);
|
|
671
|
+
fs$21.fchmod = chmodFix(fs$21.fchmod);
|
|
672
|
+
fs$21.lchmod = chmodFix(fs$21.lchmod);
|
|
673
|
+
fs$21.chownSync = chownFixSync(fs$21.chownSync);
|
|
674
|
+
fs$21.fchownSync = chownFixSync(fs$21.fchownSync);
|
|
675
|
+
fs$21.lchownSync = chownFixSync(fs$21.lchownSync);
|
|
676
|
+
fs$21.chmodSync = chmodFixSync(fs$21.chmodSync);
|
|
677
|
+
fs$21.fchmodSync = chmodFixSync(fs$21.fchmodSync);
|
|
678
|
+
fs$21.lchmodSync = chmodFixSync(fs$21.lchmodSync);
|
|
679
|
+
fs$21.stat = statFix(fs$21.stat);
|
|
680
|
+
fs$21.fstat = statFix(fs$21.fstat);
|
|
681
|
+
fs$21.lstat = statFix(fs$21.lstat);
|
|
682
|
+
fs$21.statSync = statFixSync(fs$21.statSync);
|
|
683
|
+
fs$21.fstatSync = statFixSync(fs$21.fstatSync);
|
|
684
|
+
fs$21.lstatSync = statFixSync(fs$21.lstatSync);
|
|
685
|
+
if (fs$21.chmod && !fs$21.lchmod) {
|
|
686
|
+
fs$21.lchmod = function(path$12, mode, cb) {
|
|
687
|
+
if (cb) process.nextTick(cb);
|
|
688
|
+
};
|
|
689
|
+
fs$21.lchmodSync = function() {};
|
|
690
|
+
}
|
|
691
|
+
if (fs$21.chown && !fs$21.lchown) {
|
|
692
|
+
fs$21.lchown = function(path$12, uid, gid, cb) {
|
|
693
|
+
if (cb) process.nextTick(cb);
|
|
694
|
+
};
|
|
695
|
+
fs$21.lchownSync = function() {};
|
|
696
|
+
}
|
|
697
|
+
if (platform === "win32") fs$21.rename = typeof fs$21.rename !== "function" ? fs$21.rename : (function(fs$rename) {
|
|
698
|
+
function rename$1(from, to, cb) {
|
|
699
|
+
var start = Date.now();
|
|
700
|
+
var backoff = 0;
|
|
701
|
+
fs$rename(from, to, function CB(er) {
|
|
702
|
+
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
703
|
+
setTimeout(function() {
|
|
704
|
+
fs$21.stat(to, function(stater, st) {
|
|
705
|
+
if (stater && stater.code === "ENOENT") fs$rename(from, to, CB);
|
|
706
|
+
else cb(er);
|
|
707
|
+
});
|
|
708
|
+
}, backoff);
|
|
709
|
+
if (backoff < 100) backoff += 10;
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
if (cb) cb(er);
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(rename$1, fs$rename);
|
|
716
|
+
return rename$1;
|
|
717
|
+
})(fs$21.rename);
|
|
718
|
+
fs$21.read = typeof fs$21.read !== "function" ? fs$21.read : (function(fs$read) {
|
|
719
|
+
function read(fd, buffer, offset, length, position, callback_) {
|
|
720
|
+
var callback;
|
|
721
|
+
if (callback_ && typeof callback_ === "function") {
|
|
722
|
+
var eagCounter = 0;
|
|
723
|
+
callback = function(er, _, __) {
|
|
724
|
+
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
725
|
+
eagCounter++;
|
|
726
|
+
return fs$read.call(fs$21, fd, buffer, offset, length, position, callback);
|
|
727
|
+
}
|
|
728
|
+
callback_.apply(this, arguments);
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
return fs$read.call(fs$21, fd, buffer, offset, length, position, callback);
|
|
732
|
+
}
|
|
733
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
734
|
+
return read;
|
|
735
|
+
})(fs$21.read);
|
|
736
|
+
fs$21.readSync = typeof fs$21.readSync !== "function" ? fs$21.readSync : (function(fs$readSync) {
|
|
737
|
+
return function(fd, buffer, offset, length, position) {
|
|
738
|
+
var eagCounter = 0;
|
|
739
|
+
while (true) try {
|
|
740
|
+
return fs$readSync.call(fs$21, fd, buffer, offset, length, position);
|
|
741
|
+
} catch (er) {
|
|
742
|
+
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
743
|
+
eagCounter++;
|
|
744
|
+
continue;
|
|
745
|
+
}
|
|
746
|
+
throw er;
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
})(fs$21.readSync);
|
|
750
|
+
function patchLchmod(fs$22) {
|
|
751
|
+
fs$22.lchmod = function(path$12, mode, callback) {
|
|
752
|
+
fs$22.open(path$12, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
|
|
753
|
+
if (err) {
|
|
754
|
+
if (callback) callback(err);
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
fs$22.fchmod(fd, mode, function(err$1) {
|
|
758
|
+
fs$22.close(fd, function(err2) {
|
|
759
|
+
if (callback) callback(err$1 || err2);
|
|
760
|
+
});
|
|
761
|
+
});
|
|
762
|
+
});
|
|
763
|
+
};
|
|
764
|
+
fs$22.lchmodSync = function(path$12, mode) {
|
|
765
|
+
var fd = fs$22.openSync(path$12, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
766
|
+
var threw = true;
|
|
767
|
+
var ret;
|
|
768
|
+
try {
|
|
769
|
+
ret = fs$22.fchmodSync(fd, mode);
|
|
770
|
+
threw = false;
|
|
771
|
+
} finally {
|
|
772
|
+
if (threw) try {
|
|
773
|
+
fs$22.closeSync(fd);
|
|
774
|
+
} catch (er) {}
|
|
775
|
+
else fs$22.closeSync(fd);
|
|
776
|
+
}
|
|
777
|
+
return ret;
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
function patchLutimes(fs$22) {
|
|
781
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs$22.futimes) {
|
|
782
|
+
fs$22.lutimes = function(path$12, at, mt, cb) {
|
|
783
|
+
fs$22.open(path$12, constants.O_SYMLINK, function(er, fd) {
|
|
784
|
+
if (er) {
|
|
785
|
+
if (cb) cb(er);
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
fs$22.futimes(fd, at, mt, function(er$1) {
|
|
789
|
+
fs$22.close(fd, function(er2) {
|
|
790
|
+
if (cb) cb(er$1 || er2);
|
|
791
|
+
});
|
|
792
|
+
});
|
|
793
|
+
});
|
|
794
|
+
};
|
|
795
|
+
fs$22.lutimesSync = function(path$12, at, mt) {
|
|
796
|
+
var fd = fs$22.openSync(path$12, constants.O_SYMLINK);
|
|
797
|
+
var ret;
|
|
798
|
+
var threw = true;
|
|
799
|
+
try {
|
|
800
|
+
ret = fs$22.futimesSync(fd, at, mt);
|
|
801
|
+
threw = false;
|
|
802
|
+
} finally {
|
|
803
|
+
if (threw) try {
|
|
804
|
+
fs$22.closeSync(fd);
|
|
805
|
+
} catch (er) {}
|
|
806
|
+
else fs$22.closeSync(fd);
|
|
807
|
+
}
|
|
808
|
+
return ret;
|
|
809
|
+
};
|
|
810
|
+
} else if (fs$22.futimes) {
|
|
811
|
+
fs$22.lutimes = function(_a, _b, _c, cb) {
|
|
812
|
+
if (cb) process.nextTick(cb);
|
|
813
|
+
};
|
|
814
|
+
fs$22.lutimesSync = function() {};
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
function chmodFix(orig) {
|
|
818
|
+
if (!orig) return orig;
|
|
819
|
+
return function(target, mode, cb) {
|
|
820
|
+
return orig.call(fs$21, target, mode, function(er) {
|
|
821
|
+
if (chownErOk(er)) er = null;
|
|
822
|
+
if (cb) cb.apply(this, arguments);
|
|
823
|
+
});
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
function chmodFixSync(orig) {
|
|
827
|
+
if (!orig) return orig;
|
|
828
|
+
return function(target, mode) {
|
|
829
|
+
try {
|
|
830
|
+
return orig.call(fs$21, target, mode);
|
|
831
|
+
} catch (er) {
|
|
832
|
+
if (!chownErOk(er)) throw er;
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
function chownFix(orig) {
|
|
837
|
+
if (!orig) return orig;
|
|
838
|
+
return function(target, uid, gid, cb) {
|
|
839
|
+
return orig.call(fs$21, target, uid, gid, function(er) {
|
|
840
|
+
if (chownErOk(er)) er = null;
|
|
841
|
+
if (cb) cb.apply(this, arguments);
|
|
842
|
+
});
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
function chownFixSync(orig) {
|
|
846
|
+
if (!orig) return orig;
|
|
847
|
+
return function(target, uid, gid) {
|
|
848
|
+
try {
|
|
849
|
+
return orig.call(fs$21, target, uid, gid);
|
|
850
|
+
} catch (er) {
|
|
851
|
+
if (!chownErOk(er)) throw er;
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
function statFix(orig) {
|
|
856
|
+
if (!orig) return orig;
|
|
857
|
+
return function(target, options, cb) {
|
|
858
|
+
if (typeof options === "function") {
|
|
859
|
+
cb = options;
|
|
860
|
+
options = null;
|
|
861
|
+
}
|
|
862
|
+
function callback(er, stats) {
|
|
863
|
+
if (stats) {
|
|
864
|
+
if (stats.uid < 0) stats.uid += 4294967296;
|
|
865
|
+
if (stats.gid < 0) stats.gid += 4294967296;
|
|
866
|
+
}
|
|
867
|
+
if (cb) cb.apply(this, arguments);
|
|
868
|
+
}
|
|
869
|
+
return options ? orig.call(fs$21, target, options, callback) : orig.call(fs$21, target, callback);
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
function statFixSync(orig) {
|
|
873
|
+
if (!orig) return orig;
|
|
874
|
+
return function(target, options) {
|
|
875
|
+
var stats = options ? orig.call(fs$21, target, options) : orig.call(fs$21, target);
|
|
876
|
+
if (stats) {
|
|
877
|
+
if (stats.uid < 0) stats.uid += 4294967296;
|
|
878
|
+
if (stats.gid < 0) stats.gid += 4294967296;
|
|
879
|
+
}
|
|
880
|
+
return stats;
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
function chownErOk(er) {
|
|
884
|
+
if (!er) return true;
|
|
885
|
+
if (er.code === "ENOSYS") return true;
|
|
886
|
+
if (!process.getuid || process.getuid() !== 0) {
|
|
887
|
+
if (er.code === "EINVAL" || er.code === "EPERM") return true;
|
|
888
|
+
}
|
|
889
|
+
return false;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
}));
|
|
893
|
+
|
|
894
|
+
//#endregion
|
|
895
|
+
//#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
|
|
896
|
+
var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
897
|
+
var Stream = __require("stream").Stream;
|
|
898
|
+
module.exports = legacy$1;
|
|
899
|
+
function legacy$1(fs$21) {
|
|
900
|
+
return {
|
|
901
|
+
ReadStream,
|
|
902
|
+
WriteStream
|
|
903
|
+
};
|
|
904
|
+
function ReadStream(path$12, options) {
|
|
905
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path$12, options);
|
|
906
|
+
Stream.call(this);
|
|
907
|
+
var self = this;
|
|
908
|
+
this.path = path$12;
|
|
909
|
+
this.fd = null;
|
|
910
|
+
this.readable = true;
|
|
911
|
+
this.paused = false;
|
|
912
|
+
this.flags = "r";
|
|
913
|
+
this.mode = 438;
|
|
914
|
+
this.bufferSize = 64 * 1024;
|
|
915
|
+
options = options || {};
|
|
916
|
+
var keys = Object.keys(options);
|
|
917
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
918
|
+
var key = keys[index];
|
|
919
|
+
this[key] = options[key];
|
|
920
|
+
}
|
|
921
|
+
if (this.encoding) this.setEncoding(this.encoding);
|
|
922
|
+
if (this.start !== void 0) {
|
|
923
|
+
if ("number" !== typeof this.start) throw TypeError("start must be a Number");
|
|
924
|
+
if (this.end === void 0) this.end = Infinity;
|
|
925
|
+
else if ("number" !== typeof this.end) throw TypeError("end must be a Number");
|
|
926
|
+
if (this.start > this.end) throw new Error("start must be <= end");
|
|
927
|
+
this.pos = this.start;
|
|
928
|
+
}
|
|
929
|
+
if (this.fd !== null) {
|
|
930
|
+
process.nextTick(function() {
|
|
931
|
+
self._read();
|
|
932
|
+
});
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
fs$21.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
936
|
+
if (err) {
|
|
937
|
+
self.emit("error", err);
|
|
938
|
+
self.readable = false;
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
self.fd = fd;
|
|
942
|
+
self.emit("open", fd);
|
|
943
|
+
self._read();
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
function WriteStream(path$12, options) {
|
|
947
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path$12, options);
|
|
948
|
+
Stream.call(this);
|
|
949
|
+
this.path = path$12;
|
|
950
|
+
this.fd = null;
|
|
951
|
+
this.writable = true;
|
|
952
|
+
this.flags = "w";
|
|
953
|
+
this.encoding = "binary";
|
|
954
|
+
this.mode = 438;
|
|
955
|
+
this.bytesWritten = 0;
|
|
956
|
+
options = options || {};
|
|
957
|
+
var keys = Object.keys(options);
|
|
958
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
959
|
+
var key = keys[index];
|
|
960
|
+
this[key] = options[key];
|
|
961
|
+
}
|
|
962
|
+
if (this.start !== void 0) {
|
|
963
|
+
if ("number" !== typeof this.start) throw TypeError("start must be a Number");
|
|
964
|
+
if (this.start < 0) throw new Error("start must be >= zero");
|
|
965
|
+
this.pos = this.start;
|
|
966
|
+
}
|
|
967
|
+
this.busy = false;
|
|
968
|
+
this._queue = [];
|
|
969
|
+
if (this.fd === null) {
|
|
970
|
+
this._open = fs$21.open;
|
|
971
|
+
this._queue.push([
|
|
972
|
+
this._open,
|
|
973
|
+
this.path,
|
|
974
|
+
this.flags,
|
|
975
|
+
this.mode,
|
|
976
|
+
void 0
|
|
977
|
+
]);
|
|
978
|
+
this.flush();
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
}));
|
|
983
|
+
|
|
984
|
+
//#endregion
|
|
985
|
+
//#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
|
|
986
|
+
var require_clone = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
987
|
+
module.exports = clone$1;
|
|
988
|
+
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
|
|
989
|
+
return obj.__proto__;
|
|
990
|
+
};
|
|
991
|
+
function clone$1(obj) {
|
|
992
|
+
if (obj === null || typeof obj !== "object") return obj;
|
|
993
|
+
if (obj instanceof Object) var copy$2 = { __proto__: getPrototypeOf(obj) };
|
|
994
|
+
else var copy$2 = Object.create(null);
|
|
995
|
+
Object.getOwnPropertyNames(obj).forEach(function(key) {
|
|
996
|
+
Object.defineProperty(copy$2, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
997
|
+
});
|
|
998
|
+
return copy$2;
|
|
999
|
+
}
|
|
1000
|
+
}));
|
|
1001
|
+
|
|
1002
|
+
//#endregion
|
|
1003
|
+
//#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
|
|
1004
|
+
var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1005
|
+
var fs$20 = __require("fs");
|
|
1006
|
+
var polyfills = require_polyfills();
|
|
1007
|
+
var legacy = require_legacy_streams();
|
|
1008
|
+
var clone = require_clone();
|
|
1009
|
+
var util = __require("util");
|
|
1010
|
+
/* istanbul ignore next - node 0.x polyfill */
|
|
1011
|
+
var gracefulQueue;
|
|
1012
|
+
var previousSymbol;
|
|
1013
|
+
/* istanbul ignore else - node 0.x polyfill */
|
|
1014
|
+
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
|
|
1015
|
+
gracefulQueue = Symbol.for("graceful-fs.queue");
|
|
1016
|
+
previousSymbol = Symbol.for("graceful-fs.previous");
|
|
1017
|
+
} else {
|
|
1018
|
+
gracefulQueue = "___graceful-fs.queue";
|
|
1019
|
+
previousSymbol = "___graceful-fs.previous";
|
|
1020
|
+
}
|
|
1021
|
+
function noop() {}
|
|
1022
|
+
function publishQueue(context, queue) {
|
|
1023
|
+
Object.defineProperty(context, gracefulQueue, { get: function() {
|
|
1024
|
+
return queue;
|
|
1025
|
+
} });
|
|
1026
|
+
}
|
|
1027
|
+
var debug = noop;
|
|
1028
|
+
if (util.debuglog) debug = util.debuglog("gfs4");
|
|
1029
|
+
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) debug = function() {
|
|
1030
|
+
var m = util.format.apply(util, arguments);
|
|
1031
|
+
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
1032
|
+
console.error(m);
|
|
1033
|
+
};
|
|
1034
|
+
if (!fs$20[gracefulQueue]) {
|
|
1035
|
+
publishQueue(fs$20, global[gracefulQueue] || []);
|
|
1036
|
+
fs$20.close = (function(fs$close) {
|
|
1037
|
+
function close(fd, cb) {
|
|
1038
|
+
return fs$close.call(fs$20, fd, function(err) {
|
|
1039
|
+
if (!err) resetQueue();
|
|
1040
|
+
if (typeof cb === "function") cb.apply(this, arguments);
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
Object.defineProperty(close, previousSymbol, { value: fs$close });
|
|
1044
|
+
return close;
|
|
1045
|
+
})(fs$20.close);
|
|
1046
|
+
fs$20.closeSync = (function(fs$closeSync) {
|
|
1047
|
+
function closeSync(fd) {
|
|
1048
|
+
fs$closeSync.apply(fs$20, arguments);
|
|
1049
|
+
resetQueue();
|
|
1050
|
+
}
|
|
1051
|
+
Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
|
|
1052
|
+
return closeSync;
|
|
1053
|
+
})(fs$20.closeSync);
|
|
1054
|
+
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
|
|
1055
|
+
debug(fs$20[gracefulQueue]);
|
|
1056
|
+
__require("assert").equal(fs$20[gracefulQueue].length, 0);
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
if (!global[gracefulQueue]) publishQueue(global, fs$20[gracefulQueue]);
|
|
1060
|
+
module.exports = patch(clone(fs$20));
|
|
1061
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$20.__patched) {
|
|
1062
|
+
module.exports = patch(fs$20);
|
|
1063
|
+
fs$20.__patched = true;
|
|
1064
|
+
}
|
|
1065
|
+
function patch(fs$21) {
|
|
1066
|
+
polyfills(fs$21);
|
|
1067
|
+
fs$21.gracefulify = patch;
|
|
1068
|
+
fs$21.createReadStream = createReadStream;
|
|
1069
|
+
fs$21.createWriteStream = createWriteStream;
|
|
1070
|
+
var fs$readFile = fs$21.readFile;
|
|
1071
|
+
fs$21.readFile = readFile$1;
|
|
1072
|
+
function readFile$1(path$12, options, cb) {
|
|
1073
|
+
if (typeof options === "function") cb = options, options = null;
|
|
1074
|
+
return go$readFile(path$12, options, cb);
|
|
1075
|
+
function go$readFile(path$13, options$1, cb$1, startTime) {
|
|
1076
|
+
return fs$readFile(path$13, options$1, function(err) {
|
|
1077
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1078
|
+
go$readFile,
|
|
1079
|
+
[
|
|
1080
|
+
path$13,
|
|
1081
|
+
options$1,
|
|
1082
|
+
cb$1
|
|
1083
|
+
],
|
|
1084
|
+
err,
|
|
1085
|
+
startTime || Date.now(),
|
|
1086
|
+
Date.now()
|
|
1087
|
+
]);
|
|
1088
|
+
else if (typeof cb$1 === "function") cb$1.apply(this, arguments);
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
var fs$writeFile = fs$21.writeFile;
|
|
1093
|
+
fs$21.writeFile = writeFile$1;
|
|
1094
|
+
function writeFile$1(path$12, data, options, cb) {
|
|
1095
|
+
if (typeof options === "function") cb = options, options = null;
|
|
1096
|
+
return go$writeFile(path$12, data, options, cb);
|
|
1097
|
+
function go$writeFile(path$13, data$1, options$1, cb$1, startTime) {
|
|
1098
|
+
return fs$writeFile(path$13, data$1, options$1, function(err) {
|
|
1099
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1100
|
+
go$writeFile,
|
|
1101
|
+
[
|
|
1102
|
+
path$13,
|
|
1103
|
+
data$1,
|
|
1104
|
+
options$1,
|
|
1105
|
+
cb$1
|
|
1106
|
+
],
|
|
1107
|
+
err,
|
|
1108
|
+
startTime || Date.now(),
|
|
1109
|
+
Date.now()
|
|
1110
|
+
]);
|
|
1111
|
+
else if (typeof cb$1 === "function") cb$1.apply(this, arguments);
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
var fs$appendFile = fs$21.appendFile;
|
|
1116
|
+
if (fs$appendFile) fs$21.appendFile = appendFile;
|
|
1117
|
+
function appendFile(path$12, data, options, cb) {
|
|
1118
|
+
if (typeof options === "function") cb = options, options = null;
|
|
1119
|
+
return go$appendFile(path$12, data, options, cb);
|
|
1120
|
+
function go$appendFile(path$13, data$1, options$1, cb$1, startTime) {
|
|
1121
|
+
return fs$appendFile(path$13, data$1, options$1, function(err) {
|
|
1122
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1123
|
+
go$appendFile,
|
|
1124
|
+
[
|
|
1125
|
+
path$13,
|
|
1126
|
+
data$1,
|
|
1127
|
+
options$1,
|
|
1128
|
+
cb$1
|
|
1129
|
+
],
|
|
1130
|
+
err,
|
|
1131
|
+
startTime || Date.now(),
|
|
1132
|
+
Date.now()
|
|
1133
|
+
]);
|
|
1134
|
+
else if (typeof cb$1 === "function") cb$1.apply(this, arguments);
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
var fs$copyFile = fs$21.copyFile;
|
|
1139
|
+
if (fs$copyFile) fs$21.copyFile = copyFile$2;
|
|
1140
|
+
function copyFile$2(src, dest, flags, cb) {
|
|
1141
|
+
if (typeof flags === "function") {
|
|
1142
|
+
cb = flags;
|
|
1143
|
+
flags = 0;
|
|
1144
|
+
}
|
|
1145
|
+
return go$copyFile(src, dest, flags, cb);
|
|
1146
|
+
function go$copyFile(src$1, dest$1, flags$1, cb$1, startTime) {
|
|
1147
|
+
return fs$copyFile(src$1, dest$1, flags$1, function(err) {
|
|
1148
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1149
|
+
go$copyFile,
|
|
1150
|
+
[
|
|
1151
|
+
src$1,
|
|
1152
|
+
dest$1,
|
|
1153
|
+
flags$1,
|
|
1154
|
+
cb$1
|
|
1155
|
+
],
|
|
1156
|
+
err,
|
|
1157
|
+
startTime || Date.now(),
|
|
1158
|
+
Date.now()
|
|
1159
|
+
]);
|
|
1160
|
+
else if (typeof cb$1 === "function") cb$1.apply(this, arguments);
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
var fs$readdir = fs$21.readdir;
|
|
1165
|
+
fs$21.readdir = readdir;
|
|
1166
|
+
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
1167
|
+
function readdir(path$12, options, cb) {
|
|
1168
|
+
if (typeof options === "function") cb = options, options = null;
|
|
1169
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir$1(path$13, options$1, cb$1, startTime) {
|
|
1170
|
+
return fs$readdir(path$13, fs$readdirCallback(path$13, options$1, cb$1, startTime));
|
|
1171
|
+
} : function go$readdir$1(path$13, options$1, cb$1, startTime) {
|
|
1172
|
+
return fs$readdir(path$13, options$1, fs$readdirCallback(path$13, options$1, cb$1, startTime));
|
|
1173
|
+
};
|
|
1174
|
+
return go$readdir(path$12, options, cb);
|
|
1175
|
+
function fs$readdirCallback(path$13, options$1, cb$1, startTime) {
|
|
1176
|
+
return function(err, files) {
|
|
1177
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1178
|
+
go$readdir,
|
|
1179
|
+
[
|
|
1180
|
+
path$13,
|
|
1181
|
+
options$1,
|
|
1182
|
+
cb$1
|
|
1183
|
+
],
|
|
1184
|
+
err,
|
|
1185
|
+
startTime || Date.now(),
|
|
1186
|
+
Date.now()
|
|
1187
|
+
]);
|
|
1188
|
+
else {
|
|
1189
|
+
if (files && files.sort) files.sort();
|
|
1190
|
+
if (typeof cb$1 === "function") cb$1.call(this, err, files);
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
if (process.version.substr(0, 4) === "v0.8") {
|
|
1196
|
+
var legStreams = legacy(fs$21);
|
|
1197
|
+
ReadStream = legStreams.ReadStream;
|
|
1198
|
+
WriteStream = legStreams.WriteStream;
|
|
1199
|
+
}
|
|
1200
|
+
var fs$ReadStream = fs$21.ReadStream;
|
|
1201
|
+
if (fs$ReadStream) {
|
|
1202
|
+
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
1203
|
+
ReadStream.prototype.open = ReadStream$open;
|
|
1204
|
+
}
|
|
1205
|
+
var fs$WriteStream = fs$21.WriteStream;
|
|
1206
|
+
if (fs$WriteStream) {
|
|
1207
|
+
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
1208
|
+
WriteStream.prototype.open = WriteStream$open;
|
|
1209
|
+
}
|
|
1210
|
+
Object.defineProperty(fs$21, "ReadStream", {
|
|
1211
|
+
get: function() {
|
|
1212
|
+
return ReadStream;
|
|
1213
|
+
},
|
|
1214
|
+
set: function(val) {
|
|
1215
|
+
ReadStream = val;
|
|
1216
|
+
},
|
|
1217
|
+
enumerable: true,
|
|
1218
|
+
configurable: true
|
|
1219
|
+
});
|
|
1220
|
+
Object.defineProperty(fs$21, "WriteStream", {
|
|
1221
|
+
get: function() {
|
|
1222
|
+
return WriteStream;
|
|
1223
|
+
},
|
|
1224
|
+
set: function(val) {
|
|
1225
|
+
WriteStream = val;
|
|
1226
|
+
},
|
|
1227
|
+
enumerable: true,
|
|
1228
|
+
configurable: true
|
|
1229
|
+
});
|
|
1230
|
+
var FileReadStream = ReadStream;
|
|
1231
|
+
Object.defineProperty(fs$21, "FileReadStream", {
|
|
1232
|
+
get: function() {
|
|
1233
|
+
return FileReadStream;
|
|
1234
|
+
},
|
|
1235
|
+
set: function(val) {
|
|
1236
|
+
FileReadStream = val;
|
|
1237
|
+
},
|
|
1238
|
+
enumerable: true,
|
|
1239
|
+
configurable: true
|
|
1240
|
+
});
|
|
1241
|
+
var FileWriteStream = WriteStream;
|
|
1242
|
+
Object.defineProperty(fs$21, "FileWriteStream", {
|
|
1243
|
+
get: function() {
|
|
1244
|
+
return FileWriteStream;
|
|
1245
|
+
},
|
|
1246
|
+
set: function(val) {
|
|
1247
|
+
FileWriteStream = val;
|
|
1248
|
+
},
|
|
1249
|
+
enumerable: true,
|
|
1250
|
+
configurable: true
|
|
1251
|
+
});
|
|
1252
|
+
function ReadStream(path$12, options) {
|
|
1253
|
+
if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;
|
|
1254
|
+
else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
1255
|
+
}
|
|
1256
|
+
function ReadStream$open() {
|
|
1257
|
+
var that = this;
|
|
1258
|
+
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
1259
|
+
if (err) {
|
|
1260
|
+
if (that.autoClose) that.destroy();
|
|
1261
|
+
that.emit("error", err);
|
|
1262
|
+
} else {
|
|
1263
|
+
that.fd = fd;
|
|
1264
|
+
that.emit("open", fd);
|
|
1265
|
+
that.read();
|
|
1266
|
+
}
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1269
|
+
function WriteStream(path$12, options) {
|
|
1270
|
+
if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;
|
|
1271
|
+
else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
1272
|
+
}
|
|
1273
|
+
function WriteStream$open() {
|
|
1274
|
+
var that = this;
|
|
1275
|
+
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
1276
|
+
if (err) {
|
|
1277
|
+
that.destroy();
|
|
1278
|
+
that.emit("error", err);
|
|
1279
|
+
} else {
|
|
1280
|
+
that.fd = fd;
|
|
1281
|
+
that.emit("open", fd);
|
|
1282
|
+
}
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
function createReadStream(path$12, options) {
|
|
1286
|
+
return new fs$21.ReadStream(path$12, options);
|
|
1287
|
+
}
|
|
1288
|
+
function createWriteStream(path$12, options) {
|
|
1289
|
+
return new fs$21.WriteStream(path$12, options);
|
|
1290
|
+
}
|
|
1291
|
+
var fs$open = fs$21.open;
|
|
1292
|
+
fs$21.open = open;
|
|
1293
|
+
function open(path$12, flags, mode, cb) {
|
|
1294
|
+
if (typeof mode === "function") cb = mode, mode = null;
|
|
1295
|
+
return go$open(path$12, flags, mode, cb);
|
|
1296
|
+
function go$open(path$13, flags$1, mode$1, cb$1, startTime) {
|
|
1297
|
+
return fs$open(path$13, flags$1, mode$1, function(err, fd) {
|
|
1298
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
1299
|
+
go$open,
|
|
1300
|
+
[
|
|
1301
|
+
path$13,
|
|
1302
|
+
flags$1,
|
|
1303
|
+
mode$1,
|
|
1304
|
+
cb$1
|
|
1305
|
+
],
|
|
1306
|
+
err,
|
|
1307
|
+
startTime || Date.now(),
|
|
1308
|
+
Date.now()
|
|
1309
|
+
]);
|
|
1310
|
+
else if (typeof cb$1 === "function") cb$1.apply(this, arguments);
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
return fs$21;
|
|
1315
|
+
}
|
|
1316
|
+
function enqueue(elem) {
|
|
1317
|
+
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
1318
|
+
fs$20[gracefulQueue].push(elem);
|
|
1319
|
+
retry();
|
|
1320
|
+
}
|
|
1321
|
+
var retryTimer;
|
|
1322
|
+
function resetQueue() {
|
|
1323
|
+
var now = Date.now();
|
|
1324
|
+
for (var i = 0; i < fs$20[gracefulQueue].length; ++i) if (fs$20[gracefulQueue][i].length > 2) {
|
|
1325
|
+
fs$20[gracefulQueue][i][3] = now;
|
|
1326
|
+
fs$20[gracefulQueue][i][4] = now;
|
|
1327
|
+
}
|
|
1328
|
+
retry();
|
|
1329
|
+
}
|
|
1330
|
+
function retry() {
|
|
1331
|
+
clearTimeout(retryTimer);
|
|
1332
|
+
retryTimer = void 0;
|
|
1333
|
+
if (fs$20[gracefulQueue].length === 0) return;
|
|
1334
|
+
var elem = fs$20[gracefulQueue].shift();
|
|
1335
|
+
var fn = elem[0];
|
|
1336
|
+
var args = elem[1];
|
|
1337
|
+
var err = elem[2];
|
|
1338
|
+
var startTime = elem[3];
|
|
1339
|
+
var lastTime = elem[4];
|
|
1340
|
+
if (startTime === void 0) {
|
|
1341
|
+
debug("RETRY", fn.name, args);
|
|
1342
|
+
fn.apply(null, args);
|
|
1343
|
+
} else if (Date.now() - startTime >= 6e4) {
|
|
1344
|
+
debug("TIMEOUT", fn.name, args);
|
|
1345
|
+
var cb = args.pop();
|
|
1346
|
+
if (typeof cb === "function") cb.call(null, err);
|
|
1347
|
+
} else {
|
|
1348
|
+
var sinceAttempt = Date.now() - lastTime;
|
|
1349
|
+
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
1350
|
+
if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
|
|
1351
|
+
debug("RETRY", fn.name, args);
|
|
1352
|
+
fn.apply(null, args.concat([startTime]));
|
|
1353
|
+
} else fs$20[gracefulQueue].push(elem);
|
|
1354
|
+
}
|
|
1355
|
+
if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
|
|
1356
|
+
}
|
|
1357
|
+
}));
|
|
1358
|
+
|
|
1359
|
+
//#endregion
|
|
1360
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/fs/index.js
|
|
1361
|
+
var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1362
|
+
const u$15 = require_universalify().fromCallback;
|
|
1363
|
+
const fs$19 = require_graceful_fs();
|
|
1364
|
+
const api = [
|
|
1365
|
+
"access",
|
|
1366
|
+
"appendFile",
|
|
1367
|
+
"chmod",
|
|
1368
|
+
"chown",
|
|
1369
|
+
"close",
|
|
1370
|
+
"copyFile",
|
|
1371
|
+
"cp",
|
|
1372
|
+
"fchmod",
|
|
1373
|
+
"fchown",
|
|
1374
|
+
"fdatasync",
|
|
1375
|
+
"fstat",
|
|
1376
|
+
"fsync",
|
|
1377
|
+
"ftruncate",
|
|
1378
|
+
"futimes",
|
|
1379
|
+
"glob",
|
|
1380
|
+
"lchmod",
|
|
1381
|
+
"lchown",
|
|
1382
|
+
"lutimes",
|
|
1383
|
+
"link",
|
|
1384
|
+
"lstat",
|
|
1385
|
+
"mkdir",
|
|
1386
|
+
"mkdtemp",
|
|
1387
|
+
"open",
|
|
1388
|
+
"opendir",
|
|
1389
|
+
"readdir",
|
|
1390
|
+
"readFile",
|
|
1391
|
+
"readlink",
|
|
1392
|
+
"realpath",
|
|
1393
|
+
"rename",
|
|
1394
|
+
"rm",
|
|
1395
|
+
"rmdir",
|
|
1396
|
+
"stat",
|
|
1397
|
+
"statfs",
|
|
1398
|
+
"symlink",
|
|
1399
|
+
"truncate",
|
|
1400
|
+
"unlink",
|
|
1401
|
+
"utimes",
|
|
1402
|
+
"writeFile"
|
|
1403
|
+
].filter((key) => {
|
|
1404
|
+
return typeof fs$19[key] === "function";
|
|
1405
|
+
});
|
|
1406
|
+
Object.assign(exports, fs$19);
|
|
1407
|
+
api.forEach((method) => {
|
|
1408
|
+
exports[method] = u$15(fs$19[method]);
|
|
1409
|
+
});
|
|
1410
|
+
exports.exists = function(filename, callback) {
|
|
1411
|
+
if (typeof callback === "function") return fs$19.exists(filename, callback);
|
|
1412
|
+
return new Promise((resolve) => {
|
|
1413
|
+
return fs$19.exists(filename, resolve);
|
|
1414
|
+
});
|
|
1415
|
+
};
|
|
1416
|
+
exports.read = function(fd, buffer, offset, length, position, callback) {
|
|
1417
|
+
if (typeof callback === "function") return fs$19.read(fd, buffer, offset, length, position, callback);
|
|
1418
|
+
return new Promise((resolve, reject) => {
|
|
1419
|
+
fs$19.read(fd, buffer, offset, length, position, (err, bytesRead, buffer$1) => {
|
|
1420
|
+
if (err) return reject(err);
|
|
1421
|
+
resolve({
|
|
1422
|
+
bytesRead,
|
|
1423
|
+
buffer: buffer$1
|
|
1424
|
+
});
|
|
1425
|
+
});
|
|
1426
|
+
});
|
|
1427
|
+
};
|
|
1428
|
+
exports.write = function(fd, buffer, ...args) {
|
|
1429
|
+
if (typeof args[args.length - 1] === "function") return fs$19.write(fd, buffer, ...args);
|
|
1430
|
+
return new Promise((resolve, reject) => {
|
|
1431
|
+
fs$19.write(fd, buffer, ...args, (err, bytesWritten, buffer$1) => {
|
|
1432
|
+
if (err) return reject(err);
|
|
1433
|
+
resolve({
|
|
1434
|
+
bytesWritten,
|
|
1435
|
+
buffer: buffer$1
|
|
1436
|
+
});
|
|
1437
|
+
});
|
|
1438
|
+
});
|
|
1439
|
+
};
|
|
1440
|
+
exports.readv = function(fd, buffers, ...args) {
|
|
1441
|
+
if (typeof args[args.length - 1] === "function") return fs$19.readv(fd, buffers, ...args);
|
|
1442
|
+
return new Promise((resolve, reject) => {
|
|
1443
|
+
fs$19.readv(fd, buffers, ...args, (err, bytesRead, buffers$1) => {
|
|
1444
|
+
if (err) return reject(err);
|
|
1445
|
+
resolve({
|
|
1446
|
+
bytesRead,
|
|
1447
|
+
buffers: buffers$1
|
|
1448
|
+
});
|
|
1449
|
+
});
|
|
1450
|
+
});
|
|
1451
|
+
};
|
|
1452
|
+
exports.writev = function(fd, buffers, ...args) {
|
|
1453
|
+
if (typeof args[args.length - 1] === "function") return fs$19.writev(fd, buffers, ...args);
|
|
1454
|
+
return new Promise((resolve, reject) => {
|
|
1455
|
+
fs$19.writev(fd, buffers, ...args, (err, bytesWritten, buffers$1) => {
|
|
1456
|
+
if (err) return reject(err);
|
|
1457
|
+
resolve({
|
|
1458
|
+
bytesWritten,
|
|
1459
|
+
buffers: buffers$1
|
|
1460
|
+
});
|
|
1461
|
+
});
|
|
1462
|
+
});
|
|
1463
|
+
};
|
|
1464
|
+
if (typeof fs$19.realpath.native === "function") exports.realpath.native = u$15(fs$19.realpath.native);
|
|
1465
|
+
else process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?", "Warning", "fs-extra-WARN0003");
|
|
1466
|
+
}));
|
|
1467
|
+
|
|
1468
|
+
//#endregion
|
|
1469
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/mkdirs/utils.js
|
|
1470
|
+
var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1471
|
+
const path$11 = __require("path");
|
|
1472
|
+
module.exports.checkPath = function checkPath$1(pth) {
|
|
1473
|
+
if (process.platform === "win32") {
|
|
1474
|
+
if (/[<>:"|?*]/.test(pth.replace(path$11.parse(pth).root, ""))) {
|
|
1475
|
+
const error = /* @__PURE__ */ new Error(`Path contains invalid characters: ${pth}`);
|
|
1476
|
+
error.code = "EINVAL";
|
|
1477
|
+
throw error;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
};
|
|
1481
|
+
}));
|
|
1482
|
+
|
|
1483
|
+
//#endregion
|
|
1484
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/mkdirs/make-dir.js
|
|
1485
|
+
var require_make_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1486
|
+
const fs$18 = require_fs();
|
|
1487
|
+
const { checkPath } = require_utils$1();
|
|
1488
|
+
const getMode = (options) => {
|
|
1489
|
+
const defaults = { mode: 511 };
|
|
1490
|
+
if (typeof options === "number") return options;
|
|
1491
|
+
return {
|
|
1492
|
+
...defaults,
|
|
1493
|
+
...options
|
|
1494
|
+
}.mode;
|
|
1495
|
+
};
|
|
1496
|
+
module.exports.makeDir = async (dir, options) => {
|
|
1497
|
+
checkPath(dir);
|
|
1498
|
+
return fs$18.mkdir(dir, {
|
|
1499
|
+
mode: getMode(options),
|
|
1500
|
+
recursive: true
|
|
1501
|
+
});
|
|
1502
|
+
};
|
|
1503
|
+
module.exports.makeDirSync = (dir, options) => {
|
|
1504
|
+
checkPath(dir);
|
|
1505
|
+
return fs$18.mkdirSync(dir, {
|
|
1506
|
+
mode: getMode(options),
|
|
1507
|
+
recursive: true
|
|
1508
|
+
});
|
|
1509
|
+
};
|
|
1510
|
+
}));
|
|
1511
|
+
|
|
1512
|
+
//#endregion
|
|
1513
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/mkdirs/index.js
|
|
1514
|
+
var require_mkdirs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1515
|
+
const u$14 = require_universalify().fromPromise;
|
|
1516
|
+
const { makeDir: _makeDir, makeDirSync } = require_make_dir();
|
|
1517
|
+
const makeDir = u$14(_makeDir);
|
|
1518
|
+
module.exports = {
|
|
1519
|
+
mkdirs: makeDir,
|
|
1520
|
+
mkdirsSync: makeDirSync,
|
|
1521
|
+
mkdirp: makeDir,
|
|
1522
|
+
mkdirpSync: makeDirSync,
|
|
1523
|
+
ensureDir: makeDir,
|
|
1524
|
+
ensureDirSync: makeDirSync
|
|
1525
|
+
};
|
|
1526
|
+
}));
|
|
1527
|
+
|
|
1528
|
+
//#endregion
|
|
1529
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/path-exists/index.js
|
|
1530
|
+
var require_path_exists = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1531
|
+
const u$13 = require_universalify().fromPromise;
|
|
1532
|
+
const fs$17 = require_fs();
|
|
1533
|
+
function pathExists$6(path$12) {
|
|
1534
|
+
return fs$17.access(path$12).then(() => true).catch(() => false);
|
|
1535
|
+
}
|
|
1536
|
+
module.exports = {
|
|
1537
|
+
pathExists: u$13(pathExists$6),
|
|
1538
|
+
pathExistsSync: fs$17.existsSync
|
|
1539
|
+
};
|
|
1540
|
+
}));
|
|
1541
|
+
|
|
1542
|
+
//#endregion
|
|
1543
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/util/utimes.js
|
|
1544
|
+
var require_utimes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1545
|
+
const fs$16 = require_fs();
|
|
1546
|
+
const u$12 = require_universalify().fromPromise;
|
|
1547
|
+
async function utimesMillis$1(path$12, atime, mtime) {
|
|
1548
|
+
const fd = await fs$16.open(path$12, "r+");
|
|
1549
|
+
let closeErr = null;
|
|
1550
|
+
try {
|
|
1551
|
+
await fs$16.futimes(fd, atime, mtime);
|
|
1552
|
+
} finally {
|
|
1553
|
+
try {
|
|
1554
|
+
await fs$16.close(fd);
|
|
1555
|
+
} catch (e) {
|
|
1556
|
+
closeErr = e;
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
if (closeErr) throw closeErr;
|
|
1560
|
+
}
|
|
1561
|
+
function utimesMillisSync$1(path$12, atime, mtime) {
|
|
1562
|
+
const fd = fs$16.openSync(path$12, "r+");
|
|
1563
|
+
fs$16.futimesSync(fd, atime, mtime);
|
|
1564
|
+
return fs$16.closeSync(fd);
|
|
1565
|
+
}
|
|
1566
|
+
module.exports = {
|
|
1567
|
+
utimesMillis: u$12(utimesMillis$1),
|
|
1568
|
+
utimesMillisSync: utimesMillisSync$1
|
|
1569
|
+
};
|
|
1570
|
+
}));
|
|
1571
|
+
|
|
1572
|
+
//#endregion
|
|
1573
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/util/stat.js
|
|
1574
|
+
var require_stat = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1575
|
+
const fs$15 = require_fs();
|
|
1576
|
+
const path$10 = __require("path");
|
|
1577
|
+
const u$11 = require_universalify().fromPromise;
|
|
1578
|
+
function getStats$1(src, dest, opts) {
|
|
1579
|
+
const statFunc = opts.dereference ? (file) => fs$15.stat(file, { bigint: true }) : (file) => fs$15.lstat(file, { bigint: true });
|
|
1580
|
+
return Promise.all([statFunc(src), statFunc(dest).catch((err) => {
|
|
1581
|
+
if (err.code === "ENOENT") return null;
|
|
1582
|
+
throw err;
|
|
1583
|
+
})]).then(([srcStat, destStat]) => ({
|
|
1584
|
+
srcStat,
|
|
1585
|
+
destStat
|
|
1586
|
+
}));
|
|
1587
|
+
}
|
|
1588
|
+
function getStatsSync(src, dest, opts) {
|
|
1589
|
+
let destStat;
|
|
1590
|
+
const statFunc = opts.dereference ? (file) => fs$15.statSync(file, { bigint: true }) : (file) => fs$15.lstatSync(file, { bigint: true });
|
|
1591
|
+
const srcStat = statFunc(src);
|
|
1592
|
+
try {
|
|
1593
|
+
destStat = statFunc(dest);
|
|
1594
|
+
} catch (err) {
|
|
1595
|
+
if (err.code === "ENOENT") return {
|
|
1596
|
+
srcStat,
|
|
1597
|
+
destStat: null
|
|
1598
|
+
};
|
|
1599
|
+
throw err;
|
|
1600
|
+
}
|
|
1601
|
+
return {
|
|
1602
|
+
srcStat,
|
|
1603
|
+
destStat
|
|
1604
|
+
};
|
|
1605
|
+
}
|
|
1606
|
+
async function checkPaths(src, dest, funcName, opts) {
|
|
1607
|
+
const { srcStat, destStat } = await getStats$1(src, dest, opts);
|
|
1608
|
+
if (destStat) {
|
|
1609
|
+
if (areIdentical$2(srcStat, destStat)) {
|
|
1610
|
+
const srcBaseName = path$10.basename(src);
|
|
1611
|
+
const destBaseName = path$10.basename(dest);
|
|
1612
|
+
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) return {
|
|
1613
|
+
srcStat,
|
|
1614
|
+
destStat,
|
|
1615
|
+
isChangingCase: true
|
|
1616
|
+
};
|
|
1617
|
+
throw new Error("Source and destination must not be the same.");
|
|
1618
|
+
}
|
|
1619
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
1620
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
1621
|
+
}
|
|
1622
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) throw new Error(errMsg(src, dest, funcName));
|
|
1623
|
+
return {
|
|
1624
|
+
srcStat,
|
|
1625
|
+
destStat
|
|
1626
|
+
};
|
|
1627
|
+
}
|
|
1628
|
+
function checkPathsSync(src, dest, funcName, opts) {
|
|
1629
|
+
const { srcStat, destStat } = getStatsSync(src, dest, opts);
|
|
1630
|
+
if (destStat) {
|
|
1631
|
+
if (areIdentical$2(srcStat, destStat)) {
|
|
1632
|
+
const srcBaseName = path$10.basename(src);
|
|
1633
|
+
const destBaseName = path$10.basename(dest);
|
|
1634
|
+
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) return {
|
|
1635
|
+
srcStat,
|
|
1636
|
+
destStat,
|
|
1637
|
+
isChangingCase: true
|
|
1638
|
+
};
|
|
1639
|
+
throw new Error("Source and destination must not be the same.");
|
|
1640
|
+
}
|
|
1641
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
1642
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
1643
|
+
}
|
|
1644
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) throw new Error(errMsg(src, dest, funcName));
|
|
1645
|
+
return {
|
|
1646
|
+
srcStat,
|
|
1647
|
+
destStat
|
|
1648
|
+
};
|
|
1649
|
+
}
|
|
1650
|
+
async function checkParentPaths(src, srcStat, dest, funcName) {
|
|
1651
|
+
const srcParent = path$10.resolve(path$10.dirname(src));
|
|
1652
|
+
const destParent = path$10.resolve(path$10.dirname(dest));
|
|
1653
|
+
if (destParent === srcParent || destParent === path$10.parse(destParent).root) return;
|
|
1654
|
+
let destStat;
|
|
1655
|
+
try {
|
|
1656
|
+
destStat = await fs$15.stat(destParent, { bigint: true });
|
|
1657
|
+
} catch (err) {
|
|
1658
|
+
if (err.code === "ENOENT") return;
|
|
1659
|
+
throw err;
|
|
1660
|
+
}
|
|
1661
|
+
if (areIdentical$2(srcStat, destStat)) throw new Error(errMsg(src, dest, funcName));
|
|
1662
|
+
return checkParentPaths(src, srcStat, destParent, funcName);
|
|
1663
|
+
}
|
|
1664
|
+
function checkParentPathsSync(src, srcStat, dest, funcName) {
|
|
1665
|
+
const srcParent = path$10.resolve(path$10.dirname(src));
|
|
1666
|
+
const destParent = path$10.resolve(path$10.dirname(dest));
|
|
1667
|
+
if (destParent === srcParent || destParent === path$10.parse(destParent).root) return;
|
|
1668
|
+
let destStat;
|
|
1669
|
+
try {
|
|
1670
|
+
destStat = fs$15.statSync(destParent, { bigint: true });
|
|
1671
|
+
} catch (err) {
|
|
1672
|
+
if (err.code === "ENOENT") return;
|
|
1673
|
+
throw err;
|
|
1674
|
+
}
|
|
1675
|
+
if (areIdentical$2(srcStat, destStat)) throw new Error(errMsg(src, dest, funcName));
|
|
1676
|
+
return checkParentPathsSync(src, srcStat, destParent, funcName);
|
|
1677
|
+
}
|
|
1678
|
+
function areIdentical$2(srcStat, destStat) {
|
|
1679
|
+
return destStat.ino !== void 0 && destStat.dev !== void 0 && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
|
|
1680
|
+
}
|
|
1681
|
+
function isSrcSubdir(src, dest) {
|
|
1682
|
+
const srcArr = path$10.resolve(src).split(path$10.sep).filter((i) => i);
|
|
1683
|
+
const destArr = path$10.resolve(dest).split(path$10.sep).filter((i) => i);
|
|
1684
|
+
return srcArr.every((cur, i) => destArr[i] === cur);
|
|
1685
|
+
}
|
|
1686
|
+
function errMsg(src, dest, funcName) {
|
|
1687
|
+
return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
|
|
1688
|
+
}
|
|
1689
|
+
module.exports = {
|
|
1690
|
+
checkPaths: u$11(checkPaths),
|
|
1691
|
+
checkPathsSync,
|
|
1692
|
+
checkParentPaths: u$11(checkParentPaths),
|
|
1693
|
+
checkParentPathsSync,
|
|
1694
|
+
isSrcSubdir,
|
|
1695
|
+
areIdentical: areIdentical$2
|
|
1696
|
+
};
|
|
1697
|
+
}));
|
|
1698
|
+
|
|
1699
|
+
//#endregion
|
|
1700
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/util/async.js
|
|
1701
|
+
var require_async = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1702
|
+
async function asyncIteratorConcurrentProcess$1(iterator, fn) {
|
|
1703
|
+
const promises = [];
|
|
1704
|
+
for await (const item of iterator) promises.push(fn(item).then(() => null, (err) => err ?? /* @__PURE__ */ new Error("unknown error")));
|
|
1705
|
+
await Promise.all(promises.map((promise) => promise.then((possibleErr) => {
|
|
1706
|
+
if (possibleErr !== null) throw possibleErr;
|
|
1707
|
+
})));
|
|
1708
|
+
}
|
|
1709
|
+
module.exports = { asyncIteratorConcurrentProcess: asyncIteratorConcurrentProcess$1 };
|
|
1710
|
+
}));
|
|
1711
|
+
|
|
1712
|
+
//#endregion
|
|
1713
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/copy/copy.js
|
|
1714
|
+
var require_copy$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1715
|
+
const fs$14 = require_fs();
|
|
1716
|
+
const path$9 = __require("path");
|
|
1717
|
+
const { mkdirs: mkdirs$1 } = require_mkdirs();
|
|
1718
|
+
const { pathExists: pathExists$5 } = require_path_exists();
|
|
1719
|
+
const { utimesMillis } = require_utimes();
|
|
1720
|
+
const stat$3 = require_stat();
|
|
1721
|
+
const { asyncIteratorConcurrentProcess } = require_async();
|
|
1722
|
+
async function copy$1(src, dest, opts = {}) {
|
|
1723
|
+
if (typeof opts === "function") opts = { filter: opts };
|
|
1724
|
+
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
1725
|
+
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
1726
|
+
if (opts.preserveTimestamps && process.arch === "ia32") process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269", "Warning", "fs-extra-WARN0001");
|
|
1727
|
+
const { srcStat, destStat } = await stat$3.checkPaths(src, dest, "copy", opts);
|
|
1728
|
+
await stat$3.checkParentPaths(src, srcStat, dest, "copy");
|
|
1729
|
+
if (!await runFilter(src, dest, opts)) return;
|
|
1730
|
+
const destParent = path$9.dirname(dest);
|
|
1731
|
+
if (!await pathExists$5(destParent)) await mkdirs$1(destParent);
|
|
1732
|
+
await getStatsAndPerformCopy(destStat, src, dest, opts);
|
|
1733
|
+
}
|
|
1734
|
+
async function runFilter(src, dest, opts) {
|
|
1735
|
+
if (!opts.filter) return true;
|
|
1736
|
+
return opts.filter(src, dest);
|
|
1737
|
+
}
|
|
1738
|
+
async function getStatsAndPerformCopy(destStat, src, dest, opts) {
|
|
1739
|
+
const srcStat = await (opts.dereference ? fs$14.stat : fs$14.lstat)(src);
|
|
1740
|
+
if (srcStat.isDirectory()) return onDir$1(srcStat, destStat, src, dest, opts);
|
|
1741
|
+
if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile$1(srcStat, destStat, src, dest, opts);
|
|
1742
|
+
if (srcStat.isSymbolicLink()) return onLink$1(destStat, src, dest, opts);
|
|
1743
|
+
if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
|
|
1744
|
+
if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
1745
|
+
throw new Error(`Unknown file: ${src}`);
|
|
1746
|
+
}
|
|
1747
|
+
async function onFile$1(srcStat, destStat, src, dest, opts) {
|
|
1748
|
+
if (!destStat) return copyFile$1(srcStat, src, dest, opts);
|
|
1749
|
+
if (opts.overwrite) {
|
|
1750
|
+
await fs$14.unlink(dest);
|
|
1751
|
+
return copyFile$1(srcStat, src, dest, opts);
|
|
1752
|
+
}
|
|
1753
|
+
if (opts.errorOnExist) throw new Error(`'${dest}' already exists`);
|
|
1754
|
+
}
|
|
1755
|
+
async function copyFile$1(srcStat, src, dest, opts) {
|
|
1756
|
+
await fs$14.copyFile(src, dest);
|
|
1757
|
+
if (opts.preserveTimestamps) {
|
|
1758
|
+
if (fileIsNotWritable$1(srcStat.mode)) await makeFileWritable$1(dest, srcStat.mode);
|
|
1759
|
+
const updatedSrcStat = await fs$14.stat(src);
|
|
1760
|
+
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
1761
|
+
}
|
|
1762
|
+
return fs$14.chmod(dest, srcStat.mode);
|
|
1763
|
+
}
|
|
1764
|
+
function fileIsNotWritable$1(srcMode) {
|
|
1765
|
+
return (srcMode & 128) === 0;
|
|
1766
|
+
}
|
|
1767
|
+
function makeFileWritable$1(dest, srcMode) {
|
|
1768
|
+
return fs$14.chmod(dest, srcMode | 128);
|
|
1769
|
+
}
|
|
1770
|
+
async function onDir$1(srcStat, destStat, src, dest, opts) {
|
|
1771
|
+
if (!destStat) await fs$14.mkdir(dest);
|
|
1772
|
+
await asyncIteratorConcurrentProcess(await fs$14.opendir(src), async (item) => {
|
|
1773
|
+
const srcItem = path$9.join(src, item.name);
|
|
1774
|
+
const destItem = path$9.join(dest, item.name);
|
|
1775
|
+
if (await runFilter(srcItem, destItem, opts)) {
|
|
1776
|
+
const { destStat: destStat$1 } = await stat$3.checkPaths(srcItem, destItem, "copy", opts);
|
|
1777
|
+
await getStatsAndPerformCopy(destStat$1, srcItem, destItem, opts);
|
|
1778
|
+
}
|
|
1779
|
+
});
|
|
1780
|
+
if (!destStat) await fs$14.chmod(dest, srcStat.mode);
|
|
1781
|
+
}
|
|
1782
|
+
async function onLink$1(destStat, src, dest, opts) {
|
|
1783
|
+
let resolvedSrc = await fs$14.readlink(src);
|
|
1784
|
+
if (opts.dereference) resolvedSrc = path$9.resolve(process.cwd(), resolvedSrc);
|
|
1785
|
+
if (!destStat) return fs$14.symlink(resolvedSrc, dest);
|
|
1786
|
+
let resolvedDest = null;
|
|
1787
|
+
try {
|
|
1788
|
+
resolvedDest = await fs$14.readlink(dest);
|
|
1789
|
+
} catch (e) {
|
|
1790
|
+
if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs$14.symlink(resolvedSrc, dest);
|
|
1791
|
+
throw e;
|
|
1792
|
+
}
|
|
1793
|
+
if (opts.dereference) resolvedDest = path$9.resolve(process.cwd(), resolvedDest);
|
|
1794
|
+
if (resolvedSrc !== resolvedDest) {
|
|
1795
|
+
if (stat$3.isSrcSubdir(resolvedSrc, resolvedDest)) throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
1796
|
+
if (stat$3.isSrcSubdir(resolvedDest, resolvedSrc)) throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
1797
|
+
}
|
|
1798
|
+
await fs$14.unlink(dest);
|
|
1799
|
+
return fs$14.symlink(resolvedSrc, dest);
|
|
1800
|
+
}
|
|
1801
|
+
module.exports = copy$1;
|
|
1802
|
+
}));
|
|
1803
|
+
|
|
1804
|
+
//#endregion
|
|
1805
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/copy/copy-sync.js
|
|
1806
|
+
var require_copy_sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1807
|
+
const fs$13 = require_graceful_fs();
|
|
1808
|
+
const path$8 = __require("path");
|
|
1809
|
+
const mkdirsSync$1 = require_mkdirs().mkdirsSync;
|
|
1810
|
+
const utimesMillisSync = require_utimes().utimesMillisSync;
|
|
1811
|
+
const stat$2 = require_stat();
|
|
1812
|
+
function copySync$1(src, dest, opts) {
|
|
1813
|
+
if (typeof opts === "function") opts = { filter: opts };
|
|
1814
|
+
opts = opts || {};
|
|
1815
|
+
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
1816
|
+
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
1817
|
+
if (opts.preserveTimestamps && process.arch === "ia32") process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269", "Warning", "fs-extra-WARN0002");
|
|
1818
|
+
const { srcStat, destStat } = stat$2.checkPathsSync(src, dest, "copy", opts);
|
|
1819
|
+
stat$2.checkParentPathsSync(src, srcStat, dest, "copy");
|
|
1820
|
+
if (opts.filter && !opts.filter(src, dest)) return;
|
|
1821
|
+
const destParent = path$8.dirname(dest);
|
|
1822
|
+
if (!fs$13.existsSync(destParent)) mkdirsSync$1(destParent);
|
|
1823
|
+
return getStats(destStat, src, dest, opts);
|
|
1824
|
+
}
|
|
1825
|
+
function getStats(destStat, src, dest, opts) {
|
|
1826
|
+
const srcStat = (opts.dereference ? fs$13.statSync : fs$13.lstatSync)(src);
|
|
1827
|
+
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
|
|
1828
|
+
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
|
|
1829
|
+
else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
|
|
1830
|
+
else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
|
|
1831
|
+
else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
1832
|
+
throw new Error(`Unknown file: ${src}`);
|
|
1833
|
+
}
|
|
1834
|
+
function onFile(srcStat, destStat, src, dest, opts) {
|
|
1835
|
+
if (!destStat) return copyFile(srcStat, src, dest, opts);
|
|
1836
|
+
return mayCopyFile(srcStat, src, dest, opts);
|
|
1837
|
+
}
|
|
1838
|
+
function mayCopyFile(srcStat, src, dest, opts) {
|
|
1839
|
+
if (opts.overwrite) {
|
|
1840
|
+
fs$13.unlinkSync(dest);
|
|
1841
|
+
return copyFile(srcStat, src, dest, opts);
|
|
1842
|
+
} else if (opts.errorOnExist) throw new Error(`'${dest}' already exists`);
|
|
1843
|
+
}
|
|
1844
|
+
function copyFile(srcStat, src, dest, opts) {
|
|
1845
|
+
fs$13.copyFileSync(src, dest);
|
|
1846
|
+
if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
|
|
1847
|
+
return setDestMode(dest, srcStat.mode);
|
|
1848
|
+
}
|
|
1849
|
+
function handleTimestamps(srcMode, src, dest) {
|
|
1850
|
+
if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode);
|
|
1851
|
+
return setDestTimestamps(src, dest);
|
|
1852
|
+
}
|
|
1853
|
+
function fileIsNotWritable(srcMode) {
|
|
1854
|
+
return (srcMode & 128) === 0;
|
|
1855
|
+
}
|
|
1856
|
+
function makeFileWritable(dest, srcMode) {
|
|
1857
|
+
return setDestMode(dest, srcMode | 128);
|
|
1858
|
+
}
|
|
1859
|
+
function setDestMode(dest, srcMode) {
|
|
1860
|
+
return fs$13.chmodSync(dest, srcMode);
|
|
1861
|
+
}
|
|
1862
|
+
function setDestTimestamps(src, dest) {
|
|
1863
|
+
const updatedSrcStat = fs$13.statSync(src);
|
|
1864
|
+
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
1865
|
+
}
|
|
1866
|
+
function onDir(srcStat, destStat, src, dest, opts) {
|
|
1867
|
+
if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts);
|
|
1868
|
+
return copyDir(src, dest, opts);
|
|
1869
|
+
}
|
|
1870
|
+
function mkDirAndCopy(srcMode, src, dest, opts) {
|
|
1871
|
+
fs$13.mkdirSync(dest);
|
|
1872
|
+
copyDir(src, dest, opts);
|
|
1873
|
+
return setDestMode(dest, srcMode);
|
|
1874
|
+
}
|
|
1875
|
+
function copyDir(src, dest, opts) {
|
|
1876
|
+
const dir = fs$13.opendirSync(src);
|
|
1877
|
+
try {
|
|
1878
|
+
let dirent;
|
|
1879
|
+
while ((dirent = dir.readSync()) !== null) copyDirItem(dirent.name, src, dest, opts);
|
|
1880
|
+
} finally {
|
|
1881
|
+
dir.closeSync();
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
function copyDirItem(item, src, dest, opts) {
|
|
1885
|
+
const srcItem = path$8.join(src, item);
|
|
1886
|
+
const destItem = path$8.join(dest, item);
|
|
1887
|
+
if (opts.filter && !opts.filter(srcItem, destItem)) return;
|
|
1888
|
+
const { destStat } = stat$2.checkPathsSync(srcItem, destItem, "copy", opts);
|
|
1889
|
+
return getStats(destStat, srcItem, destItem, opts);
|
|
1890
|
+
}
|
|
1891
|
+
function onLink(destStat, src, dest, opts) {
|
|
1892
|
+
let resolvedSrc = fs$13.readlinkSync(src);
|
|
1893
|
+
if (opts.dereference) resolvedSrc = path$8.resolve(process.cwd(), resolvedSrc);
|
|
1894
|
+
if (!destStat) return fs$13.symlinkSync(resolvedSrc, dest);
|
|
1895
|
+
else {
|
|
1896
|
+
let resolvedDest;
|
|
1897
|
+
try {
|
|
1898
|
+
resolvedDest = fs$13.readlinkSync(dest);
|
|
1899
|
+
} catch (err) {
|
|
1900
|
+
if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs$13.symlinkSync(resolvedSrc, dest);
|
|
1901
|
+
throw err;
|
|
1902
|
+
}
|
|
1903
|
+
if (opts.dereference) resolvedDest = path$8.resolve(process.cwd(), resolvedDest);
|
|
1904
|
+
if (resolvedSrc !== resolvedDest) {
|
|
1905
|
+
if (stat$2.isSrcSubdir(resolvedSrc, resolvedDest)) throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
1906
|
+
if (stat$2.isSrcSubdir(resolvedDest, resolvedSrc)) throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
1907
|
+
}
|
|
1908
|
+
return copyLink(resolvedSrc, dest);
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
function copyLink(resolvedSrc, dest) {
|
|
1912
|
+
fs$13.unlinkSync(dest);
|
|
1913
|
+
return fs$13.symlinkSync(resolvedSrc, dest);
|
|
1914
|
+
}
|
|
1915
|
+
module.exports = copySync$1;
|
|
1916
|
+
}));
|
|
1917
|
+
|
|
1918
|
+
//#endregion
|
|
1919
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/copy/index.js
|
|
1920
|
+
var require_copy = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1921
|
+
const u$10 = require_universalify().fromPromise;
|
|
1922
|
+
module.exports = {
|
|
1923
|
+
copy: u$10(require_copy$1()),
|
|
1924
|
+
copySync: require_copy_sync()
|
|
1925
|
+
};
|
|
1926
|
+
}));
|
|
1927
|
+
|
|
1928
|
+
//#endregion
|
|
1929
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/remove/index.js
|
|
1930
|
+
var require_remove = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1931
|
+
const fs$12 = require_graceful_fs();
|
|
1932
|
+
const u$9 = require_universalify().fromCallback;
|
|
1933
|
+
function remove$2(path$12, callback) {
|
|
1934
|
+
fs$12.rm(path$12, {
|
|
1935
|
+
recursive: true,
|
|
1936
|
+
force: true
|
|
1937
|
+
}, callback);
|
|
1938
|
+
}
|
|
1939
|
+
function removeSync$1(path$12) {
|
|
1940
|
+
fs$12.rmSync(path$12, {
|
|
1941
|
+
recursive: true,
|
|
1942
|
+
force: true
|
|
1943
|
+
});
|
|
1944
|
+
}
|
|
1945
|
+
module.exports = {
|
|
1946
|
+
remove: u$9(remove$2),
|
|
1947
|
+
removeSync: removeSync$1
|
|
1948
|
+
};
|
|
1949
|
+
}));
|
|
1950
|
+
|
|
1951
|
+
//#endregion
|
|
1952
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/empty/index.js
|
|
1953
|
+
var require_empty = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1954
|
+
const u$8 = require_universalify().fromPromise;
|
|
1955
|
+
const fs$11 = require_fs();
|
|
1956
|
+
const path$7 = __require("path");
|
|
1957
|
+
const mkdir$3 = require_mkdirs();
|
|
1958
|
+
const remove$1 = require_remove();
|
|
1959
|
+
const emptyDir = u$8(async function emptyDir$1(dir) {
|
|
1960
|
+
let items;
|
|
1961
|
+
try {
|
|
1962
|
+
items = await fs$11.readdir(dir);
|
|
1963
|
+
} catch {
|
|
1964
|
+
return mkdir$3.mkdirs(dir);
|
|
1965
|
+
}
|
|
1966
|
+
return Promise.all(items.map((item) => remove$1.remove(path$7.join(dir, item))));
|
|
1967
|
+
});
|
|
1968
|
+
function emptyDirSync(dir) {
|
|
1969
|
+
let items;
|
|
1970
|
+
try {
|
|
1971
|
+
items = fs$11.readdirSync(dir);
|
|
1972
|
+
} catch {
|
|
1973
|
+
return mkdir$3.mkdirsSync(dir);
|
|
1974
|
+
}
|
|
1975
|
+
items.forEach((item) => {
|
|
1976
|
+
item = path$7.join(dir, item);
|
|
1977
|
+
remove$1.removeSync(item);
|
|
1978
|
+
});
|
|
1979
|
+
}
|
|
1980
|
+
module.exports = {
|
|
1981
|
+
emptyDirSync,
|
|
1982
|
+
emptydirSync: emptyDirSync,
|
|
1983
|
+
emptyDir,
|
|
1984
|
+
emptydir: emptyDir
|
|
1985
|
+
};
|
|
1986
|
+
}));
|
|
1987
|
+
|
|
1988
|
+
//#endregion
|
|
1989
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/ensure/file.js
|
|
1990
|
+
var require_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1991
|
+
const u$7 = require_universalify().fromPromise;
|
|
1992
|
+
const path$6 = __require("path");
|
|
1993
|
+
const fs$10 = require_fs();
|
|
1994
|
+
const mkdir$2 = require_mkdirs();
|
|
1995
|
+
async function createFile$1(file) {
|
|
1996
|
+
let stats;
|
|
1997
|
+
try {
|
|
1998
|
+
stats = await fs$10.stat(file);
|
|
1999
|
+
} catch {}
|
|
2000
|
+
if (stats && stats.isFile()) return;
|
|
2001
|
+
const dir = path$6.dirname(file);
|
|
2002
|
+
let dirStats = null;
|
|
2003
|
+
try {
|
|
2004
|
+
dirStats = await fs$10.stat(dir);
|
|
2005
|
+
} catch (err) {
|
|
2006
|
+
if (err.code === "ENOENT") {
|
|
2007
|
+
await mkdir$2.mkdirs(dir);
|
|
2008
|
+
await fs$10.writeFile(file, "");
|
|
2009
|
+
return;
|
|
2010
|
+
} else throw err;
|
|
2011
|
+
}
|
|
2012
|
+
if (dirStats.isDirectory()) await fs$10.writeFile(file, "");
|
|
2013
|
+
else await fs$10.readdir(dir);
|
|
2014
|
+
}
|
|
2015
|
+
function createFileSync$1(file) {
|
|
2016
|
+
let stats;
|
|
2017
|
+
try {
|
|
2018
|
+
stats = fs$10.statSync(file);
|
|
2019
|
+
} catch {}
|
|
2020
|
+
if (stats && stats.isFile()) return;
|
|
2021
|
+
const dir = path$6.dirname(file);
|
|
2022
|
+
try {
|
|
2023
|
+
if (!fs$10.statSync(dir).isDirectory()) fs$10.readdirSync(dir);
|
|
2024
|
+
} catch (err) {
|
|
2025
|
+
if (err && err.code === "ENOENT") mkdir$2.mkdirsSync(dir);
|
|
2026
|
+
else throw err;
|
|
2027
|
+
}
|
|
2028
|
+
fs$10.writeFileSync(file, "");
|
|
2029
|
+
}
|
|
2030
|
+
module.exports = {
|
|
2031
|
+
createFile: u$7(createFile$1),
|
|
2032
|
+
createFileSync: createFileSync$1
|
|
2033
|
+
};
|
|
2034
|
+
}));
|
|
2035
|
+
|
|
2036
|
+
//#endregion
|
|
2037
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/ensure/link.js
|
|
2038
|
+
var require_link = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2039
|
+
const u$6 = require_universalify().fromPromise;
|
|
2040
|
+
const path$5 = __require("path");
|
|
2041
|
+
const fs$9 = require_fs();
|
|
2042
|
+
const mkdir$1 = require_mkdirs();
|
|
2043
|
+
const { pathExists: pathExists$4 } = require_path_exists();
|
|
2044
|
+
const { areIdentical: areIdentical$1 } = require_stat();
|
|
2045
|
+
async function createLink$1(srcpath, dstpath) {
|
|
2046
|
+
let dstStat;
|
|
2047
|
+
try {
|
|
2048
|
+
dstStat = await fs$9.lstat(dstpath);
|
|
2049
|
+
} catch {}
|
|
2050
|
+
let srcStat;
|
|
2051
|
+
try {
|
|
2052
|
+
srcStat = await fs$9.lstat(srcpath);
|
|
2053
|
+
} catch (err) {
|
|
2054
|
+
err.message = err.message.replace("lstat", "ensureLink");
|
|
2055
|
+
throw err;
|
|
2056
|
+
}
|
|
2057
|
+
if (dstStat && areIdentical$1(srcStat, dstStat)) return;
|
|
2058
|
+
const dir = path$5.dirname(dstpath);
|
|
2059
|
+
if (!await pathExists$4(dir)) await mkdir$1.mkdirs(dir);
|
|
2060
|
+
await fs$9.link(srcpath, dstpath);
|
|
2061
|
+
}
|
|
2062
|
+
function createLinkSync$1(srcpath, dstpath) {
|
|
2063
|
+
let dstStat;
|
|
2064
|
+
try {
|
|
2065
|
+
dstStat = fs$9.lstatSync(dstpath);
|
|
2066
|
+
} catch {}
|
|
2067
|
+
try {
|
|
2068
|
+
const srcStat = fs$9.lstatSync(srcpath);
|
|
2069
|
+
if (dstStat && areIdentical$1(srcStat, dstStat)) return;
|
|
2070
|
+
} catch (err) {
|
|
2071
|
+
err.message = err.message.replace("lstat", "ensureLink");
|
|
2072
|
+
throw err;
|
|
2073
|
+
}
|
|
2074
|
+
const dir = path$5.dirname(dstpath);
|
|
2075
|
+
if (fs$9.existsSync(dir)) return fs$9.linkSync(srcpath, dstpath);
|
|
2076
|
+
mkdir$1.mkdirsSync(dir);
|
|
2077
|
+
return fs$9.linkSync(srcpath, dstpath);
|
|
2078
|
+
}
|
|
2079
|
+
module.exports = {
|
|
2080
|
+
createLink: u$6(createLink$1),
|
|
2081
|
+
createLinkSync: createLinkSync$1
|
|
2082
|
+
};
|
|
2083
|
+
}));
|
|
2084
|
+
|
|
2085
|
+
//#endregion
|
|
2086
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/ensure/symlink-paths.js
|
|
2087
|
+
var require_symlink_paths = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2088
|
+
const path$4 = __require("path");
|
|
2089
|
+
const fs$8 = require_fs();
|
|
2090
|
+
const { pathExists: pathExists$3 } = require_path_exists();
|
|
2091
|
+
const u$5 = require_universalify().fromPromise;
|
|
2092
|
+
/**
|
|
2093
|
+
* Function that returns two types of paths, one relative to symlink, and one
|
|
2094
|
+
* relative to the current working directory. Checks if path is absolute or
|
|
2095
|
+
* relative. If the path is relative, this function checks if the path is
|
|
2096
|
+
* relative to symlink or relative to current working directory. This is an
|
|
2097
|
+
* initiative to find a smarter `srcpath` to supply when building symlinks.
|
|
2098
|
+
* This allows you to determine which path to use out of one of three possible
|
|
2099
|
+
* types of source paths. The first is an absolute path. This is detected by
|
|
2100
|
+
* `path.isAbsolute()`. When an absolute path is provided, it is checked to
|
|
2101
|
+
* see if it exists. If it does it's used, if not an error is returned
|
|
2102
|
+
* (callback)/ thrown (sync). The other two options for `srcpath` are a
|
|
2103
|
+
* relative url. By default Node's `fs.symlink` works by creating a symlink
|
|
2104
|
+
* using `dstpath` and expects the `srcpath` to be relative to the newly
|
|
2105
|
+
* created symlink. If you provide a `srcpath` that does not exist on the file
|
|
2106
|
+
* system it results in a broken symlink. To minimize this, the function
|
|
2107
|
+
* checks to see if the 'relative to symlink' source file exists, and if it
|
|
2108
|
+
* does it will use it. If it does not, it checks if there's a file that
|
|
2109
|
+
* exists that is relative to the current working directory, if does its used.
|
|
2110
|
+
* This preserves the expectations of the original fs.symlink spec and adds
|
|
2111
|
+
* the ability to pass in `relative to current working direcotry` paths.
|
|
2112
|
+
*/
|
|
2113
|
+
async function symlinkPaths$1(srcpath, dstpath) {
|
|
2114
|
+
if (path$4.isAbsolute(srcpath)) {
|
|
2115
|
+
try {
|
|
2116
|
+
await fs$8.lstat(srcpath);
|
|
2117
|
+
} catch (err) {
|
|
2118
|
+
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
2119
|
+
throw err;
|
|
2120
|
+
}
|
|
2121
|
+
return {
|
|
2122
|
+
toCwd: srcpath,
|
|
2123
|
+
toDst: srcpath
|
|
2124
|
+
};
|
|
2125
|
+
}
|
|
2126
|
+
const dstdir = path$4.dirname(dstpath);
|
|
2127
|
+
const relativeToDst = path$4.join(dstdir, srcpath);
|
|
2128
|
+
if (await pathExists$3(relativeToDst)) return {
|
|
2129
|
+
toCwd: relativeToDst,
|
|
2130
|
+
toDst: srcpath
|
|
2131
|
+
};
|
|
2132
|
+
try {
|
|
2133
|
+
await fs$8.lstat(srcpath);
|
|
2134
|
+
} catch (err) {
|
|
2135
|
+
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
2136
|
+
throw err;
|
|
2137
|
+
}
|
|
2138
|
+
return {
|
|
2139
|
+
toCwd: srcpath,
|
|
2140
|
+
toDst: path$4.relative(dstdir, srcpath)
|
|
2141
|
+
};
|
|
2142
|
+
}
|
|
2143
|
+
function symlinkPathsSync$1(srcpath, dstpath) {
|
|
2144
|
+
if (path$4.isAbsolute(srcpath)) {
|
|
2145
|
+
if (!fs$8.existsSync(srcpath)) throw new Error("absolute srcpath does not exist");
|
|
2146
|
+
return {
|
|
2147
|
+
toCwd: srcpath,
|
|
2148
|
+
toDst: srcpath
|
|
2149
|
+
};
|
|
2150
|
+
}
|
|
2151
|
+
const dstdir = path$4.dirname(dstpath);
|
|
2152
|
+
const relativeToDst = path$4.join(dstdir, srcpath);
|
|
2153
|
+
if (fs$8.existsSync(relativeToDst)) return {
|
|
2154
|
+
toCwd: relativeToDst,
|
|
2155
|
+
toDst: srcpath
|
|
2156
|
+
};
|
|
2157
|
+
if (!fs$8.existsSync(srcpath)) throw new Error("relative srcpath does not exist");
|
|
2158
|
+
return {
|
|
2159
|
+
toCwd: srcpath,
|
|
2160
|
+
toDst: path$4.relative(dstdir, srcpath)
|
|
2161
|
+
};
|
|
2162
|
+
}
|
|
2163
|
+
module.exports = {
|
|
2164
|
+
symlinkPaths: u$5(symlinkPaths$1),
|
|
2165
|
+
symlinkPathsSync: symlinkPathsSync$1
|
|
2166
|
+
};
|
|
2167
|
+
}));
|
|
2168
|
+
|
|
2169
|
+
//#endregion
|
|
2170
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/ensure/symlink-type.js
|
|
2171
|
+
var require_symlink_type = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2172
|
+
const fs$7 = require_fs();
|
|
2173
|
+
const u$4 = require_universalify().fromPromise;
|
|
2174
|
+
async function symlinkType$1(srcpath, type) {
|
|
2175
|
+
if (type) return type;
|
|
2176
|
+
let stats;
|
|
2177
|
+
try {
|
|
2178
|
+
stats = await fs$7.lstat(srcpath);
|
|
2179
|
+
} catch {
|
|
2180
|
+
return "file";
|
|
2181
|
+
}
|
|
2182
|
+
return stats && stats.isDirectory() ? "dir" : "file";
|
|
2183
|
+
}
|
|
2184
|
+
function symlinkTypeSync$1(srcpath, type) {
|
|
2185
|
+
if (type) return type;
|
|
2186
|
+
let stats;
|
|
2187
|
+
try {
|
|
2188
|
+
stats = fs$7.lstatSync(srcpath);
|
|
2189
|
+
} catch {
|
|
2190
|
+
return "file";
|
|
2191
|
+
}
|
|
2192
|
+
return stats && stats.isDirectory() ? "dir" : "file";
|
|
2193
|
+
}
|
|
2194
|
+
module.exports = {
|
|
2195
|
+
symlinkType: u$4(symlinkType$1),
|
|
2196
|
+
symlinkTypeSync: symlinkTypeSync$1
|
|
2197
|
+
};
|
|
2198
|
+
}));
|
|
2199
|
+
|
|
2200
|
+
//#endregion
|
|
2201
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/ensure/symlink.js
|
|
2202
|
+
var require_symlink = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2203
|
+
const u$3 = require_universalify().fromPromise;
|
|
2204
|
+
const path$3 = __require("path");
|
|
2205
|
+
const fs$6 = require_fs();
|
|
2206
|
+
const { mkdirs, mkdirsSync } = require_mkdirs();
|
|
2207
|
+
const { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
|
|
2208
|
+
const { symlinkType, symlinkTypeSync } = require_symlink_type();
|
|
2209
|
+
const { pathExists: pathExists$2 } = require_path_exists();
|
|
2210
|
+
const { areIdentical } = require_stat();
|
|
2211
|
+
async function createSymlink$1(srcpath, dstpath, type) {
|
|
2212
|
+
let stats;
|
|
2213
|
+
try {
|
|
2214
|
+
stats = await fs$6.lstat(dstpath);
|
|
2215
|
+
} catch {}
|
|
2216
|
+
if (stats && stats.isSymbolicLink()) {
|
|
2217
|
+
const [srcStat, dstStat] = await Promise.all([fs$6.stat(srcpath), fs$6.stat(dstpath)]);
|
|
2218
|
+
if (areIdentical(srcStat, dstStat)) return;
|
|
2219
|
+
}
|
|
2220
|
+
const relative = await symlinkPaths(srcpath, dstpath);
|
|
2221
|
+
srcpath = relative.toDst;
|
|
2222
|
+
const toType = await symlinkType(relative.toCwd, type);
|
|
2223
|
+
const dir = path$3.dirname(dstpath);
|
|
2224
|
+
if (!await pathExists$2(dir)) await mkdirs(dir);
|
|
2225
|
+
return fs$6.symlink(srcpath, dstpath, toType);
|
|
2226
|
+
}
|
|
2227
|
+
function createSymlinkSync$1(srcpath, dstpath, type) {
|
|
2228
|
+
let stats;
|
|
2229
|
+
try {
|
|
2230
|
+
stats = fs$6.lstatSync(dstpath);
|
|
2231
|
+
} catch {}
|
|
2232
|
+
if (stats && stats.isSymbolicLink()) {
|
|
2233
|
+
if (areIdentical(fs$6.statSync(srcpath), fs$6.statSync(dstpath))) return;
|
|
2234
|
+
}
|
|
2235
|
+
const relative = symlinkPathsSync(srcpath, dstpath);
|
|
2236
|
+
srcpath = relative.toDst;
|
|
2237
|
+
type = symlinkTypeSync(relative.toCwd, type);
|
|
2238
|
+
const dir = path$3.dirname(dstpath);
|
|
2239
|
+
if (fs$6.existsSync(dir)) return fs$6.symlinkSync(srcpath, dstpath, type);
|
|
2240
|
+
mkdirsSync(dir);
|
|
2241
|
+
return fs$6.symlinkSync(srcpath, dstpath, type);
|
|
2242
|
+
}
|
|
2243
|
+
module.exports = {
|
|
2244
|
+
createSymlink: u$3(createSymlink$1),
|
|
2245
|
+
createSymlinkSync: createSymlinkSync$1
|
|
2246
|
+
};
|
|
2247
|
+
}));
|
|
2248
|
+
|
|
2249
|
+
//#endregion
|
|
2250
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/ensure/index.js
|
|
2251
|
+
var require_ensure = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2252
|
+
const { createFile, createFileSync } = require_file();
|
|
2253
|
+
const { createLink, createLinkSync } = require_link();
|
|
2254
|
+
const { createSymlink, createSymlinkSync } = require_symlink();
|
|
2255
|
+
module.exports = {
|
|
2256
|
+
createFile,
|
|
2257
|
+
createFileSync,
|
|
2258
|
+
ensureFile: createFile,
|
|
2259
|
+
ensureFileSync: createFileSync,
|
|
2260
|
+
createLink,
|
|
2261
|
+
createLinkSync,
|
|
2262
|
+
ensureLink: createLink,
|
|
2263
|
+
ensureLinkSync: createLinkSync,
|
|
2264
|
+
createSymlink,
|
|
2265
|
+
createSymlinkSync,
|
|
2266
|
+
ensureSymlink: createSymlink,
|
|
2267
|
+
ensureSymlinkSync: createSymlinkSync
|
|
2268
|
+
};
|
|
2269
|
+
}));
|
|
2270
|
+
|
|
2271
|
+
//#endregion
|
|
2272
|
+
//#region ../../node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/utils.js
|
|
2273
|
+
var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2274
|
+
function stringify$3(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
|
|
2275
|
+
const EOF = finalEOL ? EOL : "";
|
|
2276
|
+
return JSON.stringify(obj, replacer, spaces).replace(/\n/g, EOL) + EOF;
|
|
2277
|
+
}
|
|
2278
|
+
function stripBom$1(content) {
|
|
2279
|
+
if (Buffer.isBuffer(content)) content = content.toString("utf8");
|
|
2280
|
+
return content.replace(/^\uFEFF/, "");
|
|
2281
|
+
}
|
|
2282
|
+
module.exports = {
|
|
2283
|
+
stringify: stringify$3,
|
|
2284
|
+
stripBom: stripBom$1
|
|
2285
|
+
};
|
|
2286
|
+
}));
|
|
2287
|
+
|
|
2288
|
+
//#endregion
|
|
2289
|
+
//#region ../../node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/index.js
|
|
2290
|
+
var require_jsonfile$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2291
|
+
let _fs;
|
|
2292
|
+
try {
|
|
2293
|
+
_fs = require_graceful_fs();
|
|
2294
|
+
} catch (_) {
|
|
2295
|
+
_fs = __require("fs");
|
|
2296
|
+
}
|
|
2297
|
+
const universalify = require_universalify();
|
|
2298
|
+
const { stringify: stringify$2, stripBom } = require_utils();
|
|
2299
|
+
async function _readFile(file, options = {}) {
|
|
2300
|
+
if (typeof options === "string") options = { encoding: options };
|
|
2301
|
+
const fs$21 = options.fs || _fs;
|
|
2302
|
+
const shouldThrow = "throws" in options ? options.throws : true;
|
|
2303
|
+
let data = await universalify.fromCallback(fs$21.readFile)(file, options);
|
|
2304
|
+
data = stripBom(data);
|
|
2305
|
+
let obj;
|
|
2306
|
+
try {
|
|
2307
|
+
obj = JSON.parse(data, options ? options.reviver : null);
|
|
2308
|
+
} catch (err) {
|
|
2309
|
+
if (shouldThrow) {
|
|
2310
|
+
err.message = `${file}: ${err.message}`;
|
|
2311
|
+
throw err;
|
|
2312
|
+
} else return null;
|
|
2313
|
+
}
|
|
2314
|
+
return obj;
|
|
2315
|
+
}
|
|
2316
|
+
const readFile = universalify.fromPromise(_readFile);
|
|
2317
|
+
function readFileSync(file, options = {}) {
|
|
2318
|
+
if (typeof options === "string") options = { encoding: options };
|
|
2319
|
+
const fs$21 = options.fs || _fs;
|
|
2320
|
+
const shouldThrow = "throws" in options ? options.throws : true;
|
|
2321
|
+
try {
|
|
2322
|
+
let content = fs$21.readFileSync(file, options);
|
|
2323
|
+
content = stripBom(content);
|
|
2324
|
+
return JSON.parse(content, options.reviver);
|
|
2325
|
+
} catch (err) {
|
|
2326
|
+
if (shouldThrow) {
|
|
2327
|
+
err.message = `${file}: ${err.message}`;
|
|
2328
|
+
throw err;
|
|
2329
|
+
} else return null;
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
async function _writeFile(file, obj, options = {}) {
|
|
2333
|
+
const fs$21 = options.fs || _fs;
|
|
2334
|
+
const str = stringify$2(obj, options);
|
|
2335
|
+
await universalify.fromCallback(fs$21.writeFile)(file, str, options);
|
|
2336
|
+
}
|
|
2337
|
+
const writeFile = universalify.fromPromise(_writeFile);
|
|
2338
|
+
function writeFileSync(file, obj, options = {}) {
|
|
2339
|
+
const fs$21 = options.fs || _fs;
|
|
2340
|
+
const str = stringify$2(obj, options);
|
|
2341
|
+
return fs$21.writeFileSync(file, str, options);
|
|
2342
|
+
}
|
|
2343
|
+
module.exports = {
|
|
2344
|
+
readFile,
|
|
2345
|
+
readFileSync,
|
|
2346
|
+
writeFile,
|
|
2347
|
+
writeFileSync
|
|
2348
|
+
};
|
|
2349
|
+
}));
|
|
2350
|
+
|
|
2351
|
+
//#endregion
|
|
2352
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/json/jsonfile.js
|
|
2353
|
+
var require_jsonfile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2354
|
+
const jsonFile$1 = require_jsonfile$1();
|
|
2355
|
+
module.exports = {
|
|
2356
|
+
readJson: jsonFile$1.readFile,
|
|
2357
|
+
readJsonSync: jsonFile$1.readFileSync,
|
|
2358
|
+
writeJson: jsonFile$1.writeFile,
|
|
2359
|
+
writeJsonSync: jsonFile$1.writeFileSync
|
|
2360
|
+
};
|
|
2361
|
+
}));
|
|
2362
|
+
|
|
2363
|
+
//#endregion
|
|
2364
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/output-file/index.js
|
|
2365
|
+
var require_output_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2366
|
+
const u$2 = require_universalify().fromPromise;
|
|
2367
|
+
const fs$5 = require_fs();
|
|
2368
|
+
const path$2 = __require("path");
|
|
2369
|
+
const mkdir = require_mkdirs();
|
|
2370
|
+
const pathExists$1 = require_path_exists().pathExists;
|
|
2371
|
+
async function outputFile$1(file, data, encoding = "utf-8") {
|
|
2372
|
+
const dir = path$2.dirname(file);
|
|
2373
|
+
if (!await pathExists$1(dir)) await mkdir.mkdirs(dir);
|
|
2374
|
+
return fs$5.writeFile(file, data, encoding);
|
|
2375
|
+
}
|
|
2376
|
+
function outputFileSync$1(file, ...args) {
|
|
2377
|
+
const dir = path$2.dirname(file);
|
|
2378
|
+
if (!fs$5.existsSync(dir)) mkdir.mkdirsSync(dir);
|
|
2379
|
+
fs$5.writeFileSync(file, ...args);
|
|
2380
|
+
}
|
|
2381
|
+
module.exports = {
|
|
2382
|
+
outputFile: u$2(outputFile$1),
|
|
2383
|
+
outputFileSync: outputFileSync$1
|
|
2384
|
+
};
|
|
2385
|
+
}));
|
|
2386
|
+
|
|
2387
|
+
//#endregion
|
|
2388
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/json/output-json.js
|
|
2389
|
+
var require_output_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2390
|
+
const { stringify: stringify$1 } = require_utils();
|
|
2391
|
+
const { outputFile } = require_output_file();
|
|
2392
|
+
async function outputJson(file, data, options = {}) {
|
|
2393
|
+
await outputFile(file, stringify$1(data, options), options);
|
|
2394
|
+
}
|
|
2395
|
+
module.exports = outputJson;
|
|
2396
|
+
}));
|
|
2397
|
+
|
|
2398
|
+
//#endregion
|
|
2399
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/json/output-json-sync.js
|
|
2400
|
+
var require_output_json_sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2401
|
+
const { stringify } = require_utils();
|
|
2402
|
+
const { outputFileSync } = require_output_file();
|
|
2403
|
+
function outputJsonSync(file, data, options) {
|
|
2404
|
+
outputFileSync(file, stringify(data, options), options);
|
|
2405
|
+
}
|
|
2406
|
+
module.exports = outputJsonSync;
|
|
2407
|
+
}));
|
|
2408
|
+
|
|
2409
|
+
//#endregion
|
|
2410
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/json/index.js
|
|
2411
|
+
var require_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2412
|
+
const u$1 = require_universalify().fromPromise;
|
|
2413
|
+
const jsonFile = require_jsonfile();
|
|
2414
|
+
jsonFile.outputJson = u$1(require_output_json());
|
|
2415
|
+
jsonFile.outputJsonSync = require_output_json_sync();
|
|
2416
|
+
jsonFile.outputJSON = jsonFile.outputJson;
|
|
2417
|
+
jsonFile.outputJSONSync = jsonFile.outputJsonSync;
|
|
2418
|
+
jsonFile.writeJSON = jsonFile.writeJson;
|
|
2419
|
+
jsonFile.writeJSONSync = jsonFile.writeJsonSync;
|
|
2420
|
+
jsonFile.readJSON = jsonFile.readJson;
|
|
2421
|
+
jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
2422
|
+
module.exports = jsonFile;
|
|
2423
|
+
}));
|
|
2424
|
+
|
|
2425
|
+
//#endregion
|
|
2426
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/move/move.js
|
|
2427
|
+
var require_move$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2428
|
+
const fs$4 = require_fs();
|
|
2429
|
+
const path$1 = __require("path");
|
|
2430
|
+
const { copy } = require_copy();
|
|
2431
|
+
const { remove } = require_remove();
|
|
2432
|
+
const { mkdirp } = require_mkdirs();
|
|
2433
|
+
const { pathExists } = require_path_exists();
|
|
2434
|
+
const stat$1 = require_stat();
|
|
2435
|
+
async function move(src, dest, opts = {}) {
|
|
2436
|
+
const overwrite = opts.overwrite || opts.clobber || false;
|
|
2437
|
+
const { srcStat, isChangingCase = false } = await stat$1.checkPaths(src, dest, "move", opts);
|
|
2438
|
+
await stat$1.checkParentPaths(src, srcStat, dest, "move");
|
|
2439
|
+
const destParent = path$1.dirname(dest);
|
|
2440
|
+
if (path$1.parse(destParent).root !== destParent) await mkdirp(destParent);
|
|
2441
|
+
return doRename$1(src, dest, overwrite, isChangingCase);
|
|
2442
|
+
}
|
|
2443
|
+
async function doRename$1(src, dest, overwrite, isChangingCase) {
|
|
2444
|
+
if (!isChangingCase) {
|
|
2445
|
+
if (overwrite) await remove(dest);
|
|
2446
|
+
else if (await pathExists(dest)) throw new Error("dest already exists.");
|
|
2447
|
+
}
|
|
2448
|
+
try {
|
|
2449
|
+
await fs$4.rename(src, dest);
|
|
2450
|
+
} catch (err) {
|
|
2451
|
+
if (err.code !== "EXDEV") throw err;
|
|
2452
|
+
await moveAcrossDevice$1(src, dest, overwrite);
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
async function moveAcrossDevice$1(src, dest, overwrite) {
|
|
2456
|
+
await copy(src, dest, {
|
|
2457
|
+
overwrite,
|
|
2458
|
+
errorOnExist: true,
|
|
2459
|
+
preserveTimestamps: true
|
|
2460
|
+
});
|
|
2461
|
+
return remove(src);
|
|
2462
|
+
}
|
|
2463
|
+
module.exports = move;
|
|
2464
|
+
}));
|
|
2465
|
+
|
|
2466
|
+
//#endregion
|
|
2467
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/move/move-sync.js
|
|
2468
|
+
var require_move_sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2469
|
+
const fs$3 = require_graceful_fs();
|
|
2470
|
+
const path = __require("path");
|
|
2471
|
+
const copySync = require_copy().copySync;
|
|
2472
|
+
const removeSync = require_remove().removeSync;
|
|
2473
|
+
const mkdirpSync = require_mkdirs().mkdirpSync;
|
|
2474
|
+
const stat = require_stat();
|
|
2475
|
+
function moveSync(src, dest, opts) {
|
|
2476
|
+
opts = opts || {};
|
|
2477
|
+
const overwrite = opts.overwrite || opts.clobber || false;
|
|
2478
|
+
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
|
|
2479
|
+
stat.checkParentPathsSync(src, srcStat, dest, "move");
|
|
2480
|
+
if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest));
|
|
2481
|
+
return doRename(src, dest, overwrite, isChangingCase);
|
|
2482
|
+
}
|
|
2483
|
+
function isParentRoot(dest) {
|
|
2484
|
+
const parent = path.dirname(dest);
|
|
2485
|
+
return path.parse(parent).root === parent;
|
|
2486
|
+
}
|
|
2487
|
+
function doRename(src, dest, overwrite, isChangingCase) {
|
|
2488
|
+
if (isChangingCase) return rename(src, dest, overwrite);
|
|
2489
|
+
if (overwrite) {
|
|
2490
|
+
removeSync(dest);
|
|
2491
|
+
return rename(src, dest, overwrite);
|
|
2492
|
+
}
|
|
2493
|
+
if (fs$3.existsSync(dest)) throw new Error("dest already exists.");
|
|
2494
|
+
return rename(src, dest, overwrite);
|
|
2495
|
+
}
|
|
2496
|
+
function rename(src, dest, overwrite) {
|
|
2497
|
+
try {
|
|
2498
|
+
fs$3.renameSync(src, dest);
|
|
2499
|
+
} catch (err) {
|
|
2500
|
+
if (err.code !== "EXDEV") throw err;
|
|
2501
|
+
return moveAcrossDevice(src, dest, overwrite);
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
function moveAcrossDevice(src, dest, overwrite) {
|
|
2505
|
+
copySync(src, dest, {
|
|
2506
|
+
overwrite,
|
|
2507
|
+
errorOnExist: true,
|
|
2508
|
+
preserveTimestamps: true
|
|
2509
|
+
});
|
|
2510
|
+
return removeSync(src);
|
|
2511
|
+
}
|
|
2512
|
+
module.exports = moveSync;
|
|
2513
|
+
}));
|
|
2514
|
+
|
|
2515
|
+
//#endregion
|
|
2516
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/move/index.js
|
|
2517
|
+
var require_move = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2518
|
+
const u = require_universalify().fromPromise;
|
|
2519
|
+
module.exports = {
|
|
2520
|
+
move: u(require_move$1()),
|
|
2521
|
+
moveSync: require_move_sync()
|
|
2522
|
+
};
|
|
2523
|
+
}));
|
|
2524
|
+
|
|
2525
|
+
//#endregion
|
|
2526
|
+
//#region ../../node_modules/.pnpm/fs-extra@11.3.3/node_modules/fs-extra/lib/index.js
|
|
2527
|
+
var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2528
|
+
module.exports = {
|
|
2529
|
+
...require_fs(),
|
|
2530
|
+
...require_copy(),
|
|
2531
|
+
...require_empty(),
|
|
2532
|
+
...require_ensure(),
|
|
2533
|
+
...require_json(),
|
|
2534
|
+
...require_mkdirs(),
|
|
2535
|
+
...require_move(),
|
|
2536
|
+
...require_output_file(),
|
|
2537
|
+
...require_path_exists(),
|
|
2538
|
+
...require_remove()
|
|
2539
|
+
};
|
|
2540
|
+
}));
|
|
2541
|
+
|
|
2542
|
+
//#endregion
|
|
2543
|
+
//#region src/utils/index.ts
|
|
2544
|
+
var import_lib$1 = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
2545
|
+
async function updateJSON(path$12, data) {
|
|
2546
|
+
const config$1 = await import_lib$1.default.readJson(path$12);
|
|
2547
|
+
Object.assign(config$1, data);
|
|
2548
|
+
await import_lib$1.default.outputJson(path$12, config$1, { spaces: 2 });
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
//#endregion
|
|
2552
|
+
//#region src/context/agentInitializer.ts
|
|
2553
|
+
var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
2554
|
+
async function initializeAgent(options) {
|
|
2555
|
+
const { agent, navigate, config: config$1, setVersion, setDevices, setSystemCheck, setApiCheck, setCurrentDeviceId } = options;
|
|
2556
|
+
await ensureConfigFileExists(AUTOGLM_CONFIG_FILEPATH, config$1);
|
|
2557
|
+
setVersion(await fetchVersionInfo(agent));
|
|
2558
|
+
const { deviceId } = await fetchDevices(agent, config$1, setDevices);
|
|
2559
|
+
if (deviceId !== void 0) setCurrentDeviceId(deviceId);
|
|
2560
|
+
await ensureADBAble(agent, navigate);
|
|
2561
|
+
setSystemCheck(true);
|
|
2562
|
+
setApiCheck(await checkModelApi(agent));
|
|
2563
|
+
}
|
|
2564
|
+
var SystemStatus$1 = /* @__PURE__ */ function(SystemStatus$2) {
|
|
2565
|
+
SystemStatus$2[SystemStatus$2["CHECKING"] = 0] = "CHECKING";
|
|
2566
|
+
SystemStatus$2[SystemStatus$2["NEED_INSTALL"] = 1] = "NEED_INSTALL";
|
|
2567
|
+
SystemStatus$2[SystemStatus$2["NEED_DEVICE"] = 2] = "NEED_DEVICE";
|
|
2568
|
+
SystemStatus$2[SystemStatus$2["NEED_INSTALL_KEYBOARD"] = 3] = "NEED_INSTALL_KEYBOARD";
|
|
2569
|
+
SystemStatus$2[SystemStatus$2["READY"] = 4] = "READY";
|
|
2570
|
+
return SystemStatus$2;
|
|
2571
|
+
}(SystemStatus$1 || {});
|
|
2572
|
+
async function ensureADBAble(agent, navigate) {
|
|
2573
|
+
let status = SystemStatus$1.CHECKING;
|
|
2574
|
+
while (status !== SystemStatus$1.READY) switch (status) {
|
|
2575
|
+
case SystemStatus$1.CHECKING: {
|
|
2576
|
+
const result = await agent.checkSystemRequirements();
|
|
2577
|
+
if (result.success) status = SystemStatus$1.READY;
|
|
2578
|
+
else if (result.code === ErrorCode.ADB_NOT_INSTALLED) status = SystemStatus$1.NEED_INSTALL;
|
|
2579
|
+
else if (result.code === ErrorCode.ADB_DEVICE_UNCONNECTED) status = SystemStatus$1.NEED_DEVICE;
|
|
2580
|
+
else if (result.code === ErrorCode.ADB_KEYBOARD_UNINSTALLED) status = SystemStatus$1.NEED_INSTALL_KEYBOARD;
|
|
2581
|
+
break;
|
|
2582
|
+
}
|
|
2583
|
+
case SystemStatus$1.NEED_INSTALL:
|
|
2584
|
+
await agent.adb.install();
|
|
2585
|
+
status = SystemStatus$1.CHECKING;
|
|
2586
|
+
break;
|
|
2587
|
+
case SystemStatus$1.NEED_INSTALL_KEYBOARD: {
|
|
2588
|
+
navigate("/install-keyboard");
|
|
2589
|
+
const res = await agent.adb.installKeyboard();
|
|
2590
|
+
if (res.success) {
|
|
2591
|
+
navigate("/");
|
|
2592
|
+
status = SystemStatus$1.CHECKING;
|
|
2593
|
+
} else throw new Error(res.message);
|
|
2594
|
+
break;
|
|
2595
|
+
}
|
|
2596
|
+
case SystemStatus$1.NEED_DEVICE:
|
|
2597
|
+
navigate("/help", { state: { code: ErrorCode.ADB_DEVICE_UNCONNECTED } });
|
|
2598
|
+
status = SystemStatus$1.CHECKING;
|
|
2599
|
+
break;
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
async function ensureConfigFileExists(configPath, defaultConfig) {
|
|
2603
|
+
if (!import_lib.default.existsSync(configPath)) await import_lib.default.outputJson(configPath, defaultConfig, { spaces: 2 });
|
|
2604
|
+
}
|
|
2605
|
+
async function checkModelApi(agent) {
|
|
2606
|
+
try {
|
|
2607
|
+
return (await agent.checkModelApi()).success;
|
|
2608
|
+
} catch {
|
|
2609
|
+
return false;
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
async function fetchVersionInfo(agent) {
|
|
2613
|
+
try {
|
|
2614
|
+
const versionInfo = await agent.adb.getVersion();
|
|
2615
|
+
return versionInfo.success ? `v${versionInfo.version || "Not Installed"}` : "Not Installed";
|
|
2616
|
+
} catch {
|
|
2617
|
+
return "Error";
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
async function fetchDevices(agent, config$1, setDevices) {
|
|
2621
|
+
try {
|
|
2622
|
+
const deviceList = await agent.adb.getConnectedDevices();
|
|
2623
|
+
setDevices(deviceList);
|
|
2624
|
+
let deviceId;
|
|
2625
|
+
if (deviceList.length > 0) {
|
|
2626
|
+
const deviceExists = config$1.deviceId && deviceList.some((device) => device.deviceId === config$1.deviceId);
|
|
2627
|
+
if (!config$1.deviceId || !deviceExists) {
|
|
2628
|
+
deviceId = deviceList[0].deviceId;
|
|
2629
|
+
agent.updateConfig({ deviceId });
|
|
2630
|
+
} else deviceId = config$1.deviceId;
|
|
2631
|
+
}
|
|
2632
|
+
return {
|
|
2633
|
+
devices: deviceList,
|
|
2634
|
+
deviceId
|
|
2635
|
+
};
|
|
2636
|
+
} catch {
|
|
2637
|
+
setDevices([]);
|
|
2638
|
+
return { devices: [] };
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
//#endregion
|
|
2643
|
+
//#region src/context/AgentContext.tsx
|
|
2644
|
+
const AgentContext = createContext(null);
|
|
2645
|
+
function useAgentContext() {
|
|
2646
|
+
const context = useContext(AgentContext);
|
|
2647
|
+
if (!context) throw new Error("useAgentContext must be used within an AgentProvider");
|
|
2648
|
+
return context;
|
|
2649
|
+
}
|
|
2650
|
+
function AgentProvider({ children, config: config$1 }) {
|
|
2651
|
+
const navigate = useNavigate();
|
|
2652
|
+
const [isRunning, setIsRunning] = useState(false);
|
|
2653
|
+
const [currentTask, setCurrentTask] = useState(null);
|
|
2654
|
+
const [events, setEvents] = useState([]);
|
|
2655
|
+
const [version$3, setVersion] = useState("Loading...");
|
|
2656
|
+
const [devices, setDevices] = useState([]);
|
|
2657
|
+
const [systemCheck, setSystemCheck] = useState(null);
|
|
2658
|
+
const [apiCheck, setApiCheck] = useState(null);
|
|
2659
|
+
const [currentDeviceId, setCurrentDeviceId] = useState(config$1.deviceId);
|
|
2660
|
+
const agentRef = useRef(null);
|
|
2661
|
+
const cleanupRef = useRef([]);
|
|
2662
|
+
useEffect(() => {
|
|
2663
|
+
const agent = new AutoGLM(config$1);
|
|
2664
|
+
agentRef.current = agent;
|
|
2665
|
+
const handleAllEvents = (type, data) => {
|
|
2666
|
+
if (type === EventType.START) {
|
|
2667
|
+
const message = data.message;
|
|
2668
|
+
setCurrentTask(String(message));
|
|
2669
|
+
setIsRunning(true);
|
|
2670
|
+
}
|
|
2671
|
+
if (type === EventType.TASK_COMPLETE || type === EventType.ERROR || type === EventType.ABORTED) setIsRunning(false);
|
|
2672
|
+
if (type !== EventType.THINKING) setEvents((prev) => [...prev, {
|
|
2673
|
+
type,
|
|
2674
|
+
data: data.message ?? data,
|
|
2675
|
+
time: data.time,
|
|
2676
|
+
deviceId: agentRef.current?.config.deviceId
|
|
2677
|
+
}]);
|
|
2678
|
+
};
|
|
2679
|
+
agent.on("*", handleAllEvents);
|
|
2680
|
+
cleanupRef.current.push(() => {
|
|
2681
|
+
agent.off("*", handleAllEvents);
|
|
2682
|
+
});
|
|
2683
|
+
initializeAgent({
|
|
2684
|
+
agent,
|
|
2685
|
+
config: config$1,
|
|
2686
|
+
navigate,
|
|
2687
|
+
setVersion,
|
|
2688
|
+
setDevices,
|
|
2689
|
+
setSystemCheck,
|
|
2690
|
+
setApiCheck,
|
|
2691
|
+
setCurrentDeviceId
|
|
2692
|
+
});
|
|
2693
|
+
return () => {
|
|
2694
|
+
cleanupRef.current.forEach((cleanup) => cleanup());
|
|
2695
|
+
cleanupRef.current = [];
|
|
2696
|
+
};
|
|
2697
|
+
}, [config$1]);
|
|
2698
|
+
useEffect(() => {
|
|
2699
|
+
const lang = config$1.lang === "cn" ? "zh" : "en";
|
|
2700
|
+
if (locales_default.language !== lang) locales_default.changeLanguage(lang);
|
|
2701
|
+
}, [config$1.lang]);
|
|
2702
|
+
const run = useCallback(async (query) => {
|
|
2703
|
+
const agent = agentRef.current;
|
|
2704
|
+
if (!agent) throw new Error("Agent not initialized");
|
|
2705
|
+
setEvents([]);
|
|
2706
|
+
await agent.run(query);
|
|
2707
|
+
}, []);
|
|
2708
|
+
const abort = useCallback((reason) => {
|
|
2709
|
+
const agent = agentRef.current;
|
|
2710
|
+
if (agent) agent.abort(reason);
|
|
2711
|
+
}, []);
|
|
2712
|
+
const stop = useCallback(() => {
|
|
2713
|
+
setIsRunning(false);
|
|
2714
|
+
setCurrentTask(null);
|
|
2715
|
+
}, []);
|
|
2716
|
+
const clearEvents = useCallback(() => {
|
|
2717
|
+
setEvents([]);
|
|
2718
|
+
}, []);
|
|
2719
|
+
const refreshDevices = useCallback(async () => {
|
|
2720
|
+
const agent = agentRef.current;
|
|
2721
|
+
if (!agent) return;
|
|
2722
|
+
try {
|
|
2723
|
+
setDevices(await agent.adb.getConnectedDevices());
|
|
2724
|
+
} catch {
|
|
2725
|
+
setDevices([]);
|
|
2726
|
+
}
|
|
2727
|
+
}, []);
|
|
2728
|
+
const checkSystem = useCallback(async () => {
|
|
2729
|
+
const agent = agentRef.current;
|
|
2730
|
+
if (!agent) {
|
|
2731
|
+
setSystemCheck(false);
|
|
2732
|
+
return;
|
|
2733
|
+
}
|
|
2734
|
+
try {
|
|
2735
|
+
setSystemCheck((await agent.checkSystemRequirements()).success);
|
|
2736
|
+
} catch {
|
|
2737
|
+
setSystemCheck(false);
|
|
2738
|
+
}
|
|
2739
|
+
}, []);
|
|
2740
|
+
const value = {
|
|
2741
|
+
events,
|
|
2742
|
+
version: version$3,
|
|
2743
|
+
devices,
|
|
2744
|
+
apiCheck,
|
|
2745
|
+
isRunning,
|
|
2746
|
+
currentTask,
|
|
2747
|
+
systemCheck,
|
|
2748
|
+
currentDeviceId,
|
|
2749
|
+
abort,
|
|
2750
|
+
run,
|
|
2751
|
+
stop,
|
|
2752
|
+
checkApi: useCallback(async () => {
|
|
2753
|
+
const agent = agentRef.current;
|
|
2754
|
+
if (!agent) {
|
|
2755
|
+
setApiCheck(false);
|
|
2756
|
+
return;
|
|
2757
|
+
}
|
|
2758
|
+
try {
|
|
2759
|
+
setApiCheck((await agent.checkModelApi()).success);
|
|
2760
|
+
} catch {
|
|
2761
|
+
setApiCheck(false);
|
|
2762
|
+
}
|
|
2763
|
+
}, []),
|
|
2764
|
+
navigate,
|
|
2765
|
+
getConfig: useCallback(() => {
|
|
2766
|
+
return agentRef.current?.config || config$1;
|
|
2767
|
+
}, []),
|
|
2768
|
+
clearEvents,
|
|
2769
|
+
checkSystem,
|
|
2770
|
+
updateConfig: useCallback((newConfig) => {
|
|
2771
|
+
const update = async () => {
|
|
2772
|
+
const agent = agentRef.current;
|
|
2773
|
+
if (agent) {
|
|
2774
|
+
agent.updateConfig(newConfig);
|
|
2775
|
+
await updateJSON(AUTOGLM_CONFIG_FILEPATH, newConfig);
|
|
2776
|
+
if (newConfig.deviceId !== void 0) setCurrentDeviceId(newConfig.deviceId);
|
|
2777
|
+
}
|
|
2778
|
+
};
|
|
2779
|
+
return update();
|
|
2780
|
+
}, []),
|
|
2781
|
+
refreshDevices
|
|
2782
|
+
};
|
|
2783
|
+
return /* @__PURE__ */ jsx(AgentContext.Provider, {
|
|
2784
|
+
value,
|
|
2785
|
+
children
|
|
2786
|
+
});
|
|
2787
|
+
}
|
|
2788
|
+
|
|
2789
|
+
//#endregion
|
|
2790
|
+
//#region src/components/Banner.tsx
|
|
2791
|
+
function Banner() {
|
|
2792
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
2793
|
+
flexDirection: "column",
|
|
2794
|
+
marginBottom: 1,
|
|
2795
|
+
alignItems: "center",
|
|
2796
|
+
children: /* @__PURE__ */ jsx(Gradient, {
|
|
2797
|
+
name: "cristal",
|
|
2798
|
+
children: /* @__PURE__ */ jsx(BigText, { text: "AutoGLM.js" })
|
|
2799
|
+
})
|
|
2800
|
+
});
|
|
2801
|
+
}
|
|
2802
|
+
|
|
2803
|
+
//#endregion
|
|
2804
|
+
//#region src/commands/config.ts
|
|
2805
|
+
const commands = [
|
|
2806
|
+
{
|
|
2807
|
+
name: "exit",
|
|
2808
|
+
description: "commands.exit",
|
|
2809
|
+
execute: () => {
|
|
2810
|
+
process$1.exit(0);
|
|
2811
|
+
}
|
|
2812
|
+
},
|
|
2813
|
+
{
|
|
2814
|
+
name: "home",
|
|
2815
|
+
description: "commands.home",
|
|
2816
|
+
execute: (context) => {
|
|
2817
|
+
context.navigate("/");
|
|
2818
|
+
}
|
|
2819
|
+
},
|
|
2820
|
+
{
|
|
2821
|
+
name: "tasks",
|
|
2822
|
+
description: "commands.tasks",
|
|
2823
|
+
execute: (context) => {
|
|
2824
|
+
context.navigate("/tasks");
|
|
2825
|
+
}
|
|
2826
|
+
},
|
|
2827
|
+
{
|
|
2828
|
+
name: "config",
|
|
2829
|
+
description: "commands.config",
|
|
2830
|
+
execute: (context) => {
|
|
2831
|
+
context.navigate("/config");
|
|
2832
|
+
}
|
|
2833
|
+
},
|
|
2834
|
+
{
|
|
2835
|
+
name: "devices",
|
|
2836
|
+
description: "commands.devices",
|
|
2837
|
+
execute: (context) => {
|
|
2838
|
+
context.navigate("/devices");
|
|
2839
|
+
}
|
|
2840
|
+
},
|
|
2841
|
+
{
|
|
2842
|
+
name: "abort",
|
|
2843
|
+
description: "commands.abort",
|
|
2844
|
+
execute: (context) => {
|
|
2845
|
+
context.abort("User aborted the task");
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
];
|
|
2849
|
+
|
|
2850
|
+
//#endregion
|
|
2851
|
+
//#region src/commands/commands.ts
|
|
2852
|
+
function executeCommand(name, context) {
|
|
2853
|
+
const command = commands.find((cmd) => cmd.name === name);
|
|
2854
|
+
if (command) {
|
|
2855
|
+
command.execute(context);
|
|
2856
|
+
return true;
|
|
2857
|
+
}
|
|
2858
|
+
console.log(`Unknown command: /${name}`);
|
|
2859
|
+
return false;
|
|
2860
|
+
}
|
|
2861
|
+
function getAllCommands() {
|
|
2862
|
+
return commands;
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
//#endregion
|
|
2866
|
+
//#region ../shared/src/utils.ts
|
|
2867
|
+
function sleep(ms) {
|
|
2868
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2869
|
+
}
|
|
2870
|
+
|
|
2871
|
+
//#endregion
|
|
2872
|
+
//#region src/store/userInputStore.ts
|
|
2873
|
+
function isCommandQuery(query) {
|
|
2874
|
+
return query.startsWith("/");
|
|
2875
|
+
}
|
|
2876
|
+
const useUserInputStore = create((set) => {
|
|
2877
|
+
return {
|
|
2878
|
+
query: "",
|
|
2879
|
+
isCommand: false,
|
|
2880
|
+
setQuery: (query) => {
|
|
2881
|
+
set({
|
|
2882
|
+
query,
|
|
2883
|
+
isCommand: isCommandQuery(query)
|
|
2884
|
+
});
|
|
2885
|
+
},
|
|
2886
|
+
handleSubmit: async (value, context, navigate) => {
|
|
2887
|
+
set({ query: "" });
|
|
2888
|
+
if (isCommandQuery(value)) return;
|
|
2889
|
+
if (value.trim() === "") return;
|
|
2890
|
+
if (context.isRunning) {
|
|
2891
|
+
context.abort();
|
|
2892
|
+
await sleep(500);
|
|
2893
|
+
}
|
|
2894
|
+
context.run(value);
|
|
2895
|
+
navigate("/tasks");
|
|
2896
|
+
},
|
|
2897
|
+
handleCommandSelect: (command, context) => {
|
|
2898
|
+
set({
|
|
2899
|
+
query: "",
|
|
2900
|
+
isCommand: false
|
|
2901
|
+
});
|
|
2902
|
+
executeCommand(command, context);
|
|
2903
|
+
}
|
|
2904
|
+
};
|
|
2905
|
+
});
|
|
2906
|
+
|
|
2907
|
+
//#endregion
|
|
2908
|
+
//#region src/components/CommandMenu.tsx
|
|
2909
|
+
function CommandMenu({ query, commands: commands$1, onCommandSelect }) {
|
|
2910
|
+
const { t } = useTranslation$1();
|
|
2911
|
+
const listRef = useRef(null);
|
|
2912
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
2913
|
+
const filteredCommands = useMemo(() => {
|
|
2914
|
+
const searchTerm = query.slice(1).toLowerCase();
|
|
2915
|
+
return commands$1.filter((cmd) => cmd.name.toLowerCase().includes(searchTerm)).sort((a, b) => a.name.localeCompare(b.name));
|
|
2916
|
+
}, [query, commands$1]);
|
|
2917
|
+
useInput((_input, key) => {
|
|
2918
|
+
if (key.upArrow) setSelectedIndex(listRef.current?.selectPrevious() ?? 0);
|
|
2919
|
+
if (key.downArrow) setSelectedIndex(listRef.current?.selectNext() ?? 0);
|
|
2920
|
+
if (key.return) {
|
|
2921
|
+
const selectedCommand = filteredCommands[selectedIndex]?.name;
|
|
2922
|
+
if (selectedCommand) onCommandSelect(selectedCommand);
|
|
2923
|
+
}
|
|
2924
|
+
});
|
|
2925
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
2926
|
+
height: 10,
|
|
2927
|
+
children: /* @__PURE__ */ jsx(ScrollList, {
|
|
2928
|
+
ref: listRef,
|
|
2929
|
+
selectedIndex,
|
|
2930
|
+
onSelectionChange: setSelectedIndex,
|
|
2931
|
+
children: filteredCommands.map((cmd, i) => /* @__PURE__ */ jsxs(Box, {
|
|
2932
|
+
flexDirection: "row",
|
|
2933
|
+
children: [/* @__PURE__ */ jsx(Box, {
|
|
2934
|
+
width: 20,
|
|
2935
|
+
children: /* @__PURE__ */ jsxs(Text, {
|
|
2936
|
+
color: i === selectedIndex ? "cyan" : "gray",
|
|
2937
|
+
children: [i === selectedIndex ? "> " : " ", `/${cmd.name}`]
|
|
2938
|
+
})
|
|
2939
|
+
}), /* @__PURE__ */ jsx(Box, {
|
|
2940
|
+
flexGrow: 1,
|
|
2941
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
2942
|
+
color: i === selectedIndex ? "cyan" : "gray",
|
|
2943
|
+
children: t(cmd.description)
|
|
2944
|
+
})
|
|
2945
|
+
})]
|
|
2946
|
+
}, cmd.name))
|
|
2947
|
+
})
|
|
2948
|
+
});
|
|
2949
|
+
}
|
|
2950
|
+
function CommandMenuContainer() {
|
|
2951
|
+
const context = useAgentContext();
|
|
2952
|
+
const { query, handleCommandSelect, isCommand } = useUserInputStore();
|
|
2953
|
+
if (!isCommand) return null;
|
|
2954
|
+
return /* @__PURE__ */ jsx(CommandMenu, {
|
|
2955
|
+
commands: getAllCommands(),
|
|
2956
|
+
query,
|
|
2957
|
+
onCommandSelect: (command) => handleCommandSelect(command, context)
|
|
2958
|
+
});
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
//#endregion
|
|
2962
|
+
//#region src/hooks/useAutoGLM.ts
|
|
2963
|
+
function useDeviceInfo() {
|
|
2964
|
+
const { devices, version: version$3, refreshDevices, currentDeviceId } = useAgentContext();
|
|
2965
|
+
const [isRefreshing, setIsRefreshing] = useState(false);
|
|
2966
|
+
const refresh = useCallback(async () => {
|
|
2967
|
+
setIsRefreshing(true);
|
|
2968
|
+
try {
|
|
2969
|
+
await refreshDevices();
|
|
2970
|
+
} finally {
|
|
2971
|
+
setIsRefreshing(false);
|
|
2972
|
+
}
|
|
2973
|
+
}, [refreshDevices]);
|
|
2974
|
+
const currentDevice = devices.find((device) => device.deviceId === currentDeviceId) ?? null;
|
|
2975
|
+
return {
|
|
2976
|
+
devices,
|
|
2977
|
+
version: version$3,
|
|
2978
|
+
isRefreshing,
|
|
2979
|
+
refresh,
|
|
2980
|
+
hasDevices: devices.length > 0,
|
|
2981
|
+
currentDevice
|
|
2982
|
+
};
|
|
2983
|
+
}
|
|
2984
|
+
function useSystemCheck() {
|
|
2985
|
+
const { systemCheck, apiCheck, checkSystem, checkApi } = useAgentContext();
|
|
2986
|
+
const [isChecking, setIsChecking] = useState(false);
|
|
2987
|
+
return {
|
|
2988
|
+
systemCheck,
|
|
2989
|
+
apiCheck,
|
|
2990
|
+
isChecking,
|
|
2991
|
+
runChecks: useCallback(async () => {
|
|
2992
|
+
setIsChecking(true);
|
|
2993
|
+
try {
|
|
2994
|
+
await Promise.all([checkSystem(), checkApi()]);
|
|
2995
|
+
} finally {
|
|
2996
|
+
setIsChecking(false);
|
|
2997
|
+
}
|
|
2998
|
+
}, [checkSystem, checkApi]),
|
|
2999
|
+
isSystemReady: systemCheck === true,
|
|
3000
|
+
isApiReady: apiCheck === true
|
|
3001
|
+
};
|
|
3002
|
+
}
|
|
3003
|
+
|
|
3004
|
+
//#endregion
|
|
3005
|
+
//#region src/components/SystemStatus.tsx
|
|
3006
|
+
function SystemStatus() {
|
|
3007
|
+
const { systemCheck, apiCheck, isChecking } = useSystemCheck();
|
|
3008
|
+
const getStatusColor = (status) => {
|
|
3009
|
+
if (status === null) return "yellow";
|
|
3010
|
+
return status ? "green" : "red";
|
|
3011
|
+
};
|
|
3012
|
+
const getStatusText = (status) => {
|
|
3013
|
+
if (status === null) return isChecking ? "Checking..." : "Unknown";
|
|
3014
|
+
return status ? "OK" : "Failed";
|
|
3015
|
+
};
|
|
3016
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
3017
|
+
marginBottom: 1,
|
|
3018
|
+
gap: 4,
|
|
3019
|
+
children: [/* @__PURE__ */ jsxs(Box, {
|
|
3020
|
+
gap: 1,
|
|
3021
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
3022
|
+
color: "gray",
|
|
3023
|
+
children: "SYSTEM:"
|
|
3024
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
3025
|
+
color: getStatusColor(systemCheck),
|
|
3026
|
+
bold: true,
|
|
3027
|
+
children: getStatusText(systemCheck)
|
|
3028
|
+
})]
|
|
3029
|
+
}), /* @__PURE__ */ jsxs(Box, {
|
|
3030
|
+
gap: 1,
|
|
3031
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
3032
|
+
color: "gray",
|
|
3033
|
+
children: "API:"
|
|
3034
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
3035
|
+
color: getStatusColor(apiCheck),
|
|
3036
|
+
bold: true,
|
|
3037
|
+
children: getStatusText(apiCheck)
|
|
3038
|
+
})]
|
|
3039
|
+
})]
|
|
3040
|
+
});
|
|
3041
|
+
}
|
|
3042
|
+
|
|
3043
|
+
//#endregion
|
|
3044
|
+
//#region src/components/Info.tsx
|
|
3045
|
+
function Info() {
|
|
3046
|
+
const { version: version$3, hasDevices, currentDevice } = useDeviceInfo();
|
|
3047
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
3048
|
+
justifyContent: "space-between",
|
|
3049
|
+
children: [/* @__PURE__ */ jsxs(Box, {
|
|
3050
|
+
gap: 2,
|
|
3051
|
+
children: [hasDevices && currentDevice && /* @__PURE__ */ jsxs(Box, {
|
|
3052
|
+
gap: 2,
|
|
3053
|
+
children: [
|
|
3054
|
+
/* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Text, {
|
|
3055
|
+
color: "gray",
|
|
3056
|
+
children: "DEVICE:"
|
|
3057
|
+
}), /* @__PURE__ */ jsxs(Text, {
|
|
3058
|
+
color: "white",
|
|
3059
|
+
bold: true,
|
|
3060
|
+
children: [" ", currentDevice.model]
|
|
3061
|
+
})] }),
|
|
3062
|
+
/* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Text, {
|
|
3063
|
+
color: "gray",
|
|
3064
|
+
children: "TYPE:"
|
|
3065
|
+
}), /* @__PURE__ */ jsxs(Text, {
|
|
3066
|
+
color: "white",
|
|
3067
|
+
bold: true,
|
|
3068
|
+
children: [" ", currentDevice.connectionType.toLocaleUpperCase()]
|
|
3069
|
+
})] }),
|
|
3070
|
+
/* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Text, {
|
|
3071
|
+
color: "gray",
|
|
3072
|
+
children: "deviceID:"
|
|
3073
|
+
}), /* @__PURE__ */ jsxs(Text, {
|
|
3074
|
+
color: "white",
|
|
3075
|
+
bold: true,
|
|
3076
|
+
children: [" ", currentDevice.deviceId]
|
|
3077
|
+
})] })
|
|
3078
|
+
]
|
|
3079
|
+
}), /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Text, {
|
|
3080
|
+
color: "gray",
|
|
3081
|
+
children: "ADB:"
|
|
3082
|
+
}), /* @__PURE__ */ jsxs(Text, {
|
|
3083
|
+
color: "white",
|
|
3084
|
+
bold: true,
|
|
3085
|
+
children: [" ", version$3]
|
|
3086
|
+
})] })]
|
|
3087
|
+
}), /* @__PURE__ */ jsx(SystemStatus, {})]
|
|
3088
|
+
});
|
|
3089
|
+
}
|
|
3090
|
+
|
|
3091
|
+
//#endregion
|
|
3092
|
+
//#region src/components/UserInput.tsx
|
|
3093
|
+
function UserInput() {
|
|
3094
|
+
const navigate = useNavigate();
|
|
3095
|
+
const context = useAgentContext();
|
|
3096
|
+
const { query, setQuery, handleSubmit } = useUserInputStore();
|
|
3097
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Box, {
|
|
3098
|
+
borderStyle: "round",
|
|
3099
|
+
children: /* @__PURE__ */ jsx(TextInput, {
|
|
3100
|
+
value: query,
|
|
3101
|
+
onChange: setQuery,
|
|
3102
|
+
onSubmit: (value) => handleSubmit(value, context, navigate),
|
|
3103
|
+
placeholder: " Please Input Your Task"
|
|
3104
|
+
})
|
|
3105
|
+
}) });
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3108
|
+
//#endregion
|
|
3109
|
+
//#region src/layouts/MainLayout.tsx
|
|
3110
|
+
function MainLayout({ children }) {
|
|
3111
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
3112
|
+
marginRight: 2,
|
|
3113
|
+
marginLeft: 2,
|
|
3114
|
+
flexDirection: "column",
|
|
3115
|
+
children: [
|
|
3116
|
+
/* @__PURE__ */ jsx(Banner, {}),
|
|
3117
|
+
children,
|
|
3118
|
+
/* @__PURE__ */ jsx(UserInput, {}),
|
|
3119
|
+
/* @__PURE__ */ jsx(Info, {}),
|
|
3120
|
+
/* @__PURE__ */ jsx(CommandMenuContainer, {})
|
|
3121
|
+
]
|
|
3122
|
+
});
|
|
3123
|
+
}
|
|
3124
|
+
|
|
3125
|
+
//#endregion
|
|
3126
|
+
//#region src/router/routes.ts
|
|
3127
|
+
const routes = [
|
|
3128
|
+
{
|
|
3129
|
+
path: "/",
|
|
3130
|
+
component: lazy(() => import("./Welcome-CxaX8LEp.mjs")),
|
|
3131
|
+
label: "Welcome"
|
|
3132
|
+
},
|
|
3133
|
+
{
|
|
3134
|
+
path: "/tasks",
|
|
3135
|
+
component: lazy(() => import("./Tasks-2Hupx2WP.mjs")),
|
|
3136
|
+
label: "Tasks"
|
|
3137
|
+
},
|
|
3138
|
+
{
|
|
3139
|
+
path: "/config",
|
|
3140
|
+
component: lazy(() => import("./Config-BFfUabcq.mjs")),
|
|
3141
|
+
label: "Config"
|
|
3142
|
+
},
|
|
3143
|
+
{
|
|
3144
|
+
path: "/devices",
|
|
3145
|
+
component: lazy(() => import("./Devices-Bcw7H-ua.mjs")),
|
|
3146
|
+
label: "Devices"
|
|
3147
|
+
},
|
|
3148
|
+
{
|
|
3149
|
+
path: "/help",
|
|
3150
|
+
component: lazy(() => import("./Help-BZfoJEGE.mjs")),
|
|
3151
|
+
label: "Help"
|
|
3152
|
+
},
|
|
3153
|
+
{
|
|
3154
|
+
path: "/install-keyboard",
|
|
3155
|
+
component: lazy(() => import("./InstallKeyboard-4dIO_YlT.mjs")),
|
|
3156
|
+
label: "InstallKeyboard"
|
|
3157
|
+
}
|
|
3158
|
+
];
|
|
3159
|
+
|
|
3160
|
+
//#endregion
|
|
3161
|
+
//#region src/router/index.tsx
|
|
3162
|
+
function AppRouter() {
|
|
3163
|
+
return /* @__PURE__ */ jsx(MainLayout, { children: /* @__PURE__ */ jsx(Routes, { children: routes.map(({ path: path$12, component: Component$1 }) => /* @__PURE__ */ jsx(Route, {
|
|
3164
|
+
path: path$12,
|
|
3165
|
+
element: /* @__PURE__ */ jsx(Component$1, {})
|
|
3166
|
+
}, path$12)) }) });
|
|
3167
|
+
}
|
|
3168
|
+
|
|
3169
|
+
//#endregion
|
|
3170
|
+
//#region src/App.tsx
|
|
3171
|
+
const config = loadCliConfig();
|
|
3172
|
+
function App() {
|
|
3173
|
+
return /* @__PURE__ */ jsx(I18nextProvider, {
|
|
3174
|
+
i18n: locales_default,
|
|
3175
|
+
children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(MemoryRouter, { children: /* @__PURE__ */ jsx(AgentProvider, {
|
|
3176
|
+
config,
|
|
3177
|
+
children: /* @__PURE__ */ jsx(AppRouter, {})
|
|
3178
|
+
}) }) })
|
|
3179
|
+
});
|
|
3180
|
+
}
|
|
3181
|
+
var App_default = App;
|
|
3182
|
+
|
|
3183
|
+
//#endregion
|
|
3184
|
+
//#region ../core/package.json
|
|
3185
|
+
var version$1 = "0.0.7-beta.4";
|
|
3186
|
+
|
|
3187
|
+
//#endregion
|
|
3188
|
+
//#region package.json
|
|
3189
|
+
var version$2 = "0.0.1";
|
|
3190
|
+
|
|
3191
|
+
//#endregion
|
|
3192
|
+
//#region src/pages/Version.tsx
|
|
3193
|
+
const EMOJI_SEQUENCE = [
|
|
3194
|
+
"🚀",
|
|
3195
|
+
"✨",
|
|
3196
|
+
"🌟",
|
|
3197
|
+
"💫",
|
|
3198
|
+
"⭐",
|
|
3199
|
+
"🌈",
|
|
3200
|
+
"🎉",
|
|
3201
|
+
"🎊",
|
|
3202
|
+
"🎯",
|
|
3203
|
+
"🔮"
|
|
3204
|
+
];
|
|
3205
|
+
const GRADIENT_NAMES = [
|
|
3206
|
+
"pastel",
|
|
3207
|
+
"morning",
|
|
3208
|
+
"summer",
|
|
3209
|
+
"cristal",
|
|
3210
|
+
"mind",
|
|
3211
|
+
"atlas"
|
|
3212
|
+
];
|
|
3213
|
+
function VersionPage({ onExit }) {
|
|
3214
|
+
const { t } = useTranslation();
|
|
3215
|
+
const [currentEmoji, setCurrentEmoji] = useState(0);
|
|
3216
|
+
const [gradientIndex, setGradientIndex] = useState(0);
|
|
3217
|
+
useInput(() => {
|
|
3218
|
+
onExit();
|
|
3219
|
+
});
|
|
3220
|
+
useEffect(() => {
|
|
3221
|
+
const emojiTimer = setInterval(() => {
|
|
3222
|
+
setCurrentEmoji((e) => (e + 1) % EMOJI_SEQUENCE.length);
|
|
3223
|
+
}, 200);
|
|
3224
|
+
const gradientTimer = setInterval(() => {
|
|
3225
|
+
setGradientIndex((g) => (g + 1) % GRADIENT_NAMES.length);
|
|
3226
|
+
}, 1500);
|
|
3227
|
+
return () => {
|
|
3228
|
+
clearInterval(emojiTimer);
|
|
3229
|
+
clearInterval(gradientTimer);
|
|
3230
|
+
};
|
|
3231
|
+
}, []);
|
|
3232
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
3233
|
+
flexDirection: "column",
|
|
3234
|
+
alignItems: "center",
|
|
3235
|
+
paddingTop: 2,
|
|
3236
|
+
children: [
|
|
3237
|
+
/* @__PURE__ */ jsx(Box, {
|
|
3238
|
+
marginBottom: 2,
|
|
3239
|
+
children: /* @__PURE__ */ jsx(Gradient, {
|
|
3240
|
+
name: GRADIENT_NAMES[gradientIndex],
|
|
3241
|
+
children: /* @__PURE__ */ jsx(BigText, { text: "AutoGLM.js" })
|
|
3242
|
+
})
|
|
3243
|
+
}),
|
|
3244
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
3245
|
+
marginBottom: 3,
|
|
3246
|
+
borderStyle: "round",
|
|
3247
|
+
borderColor: GRADIENT_NAMES[gradientIndex] === "pastel" ? "cyan" : "blue",
|
|
3248
|
+
paddingX: 4,
|
|
3249
|
+
paddingY: 2,
|
|
3250
|
+
flexDirection: "column",
|
|
3251
|
+
alignItems: "center",
|
|
3252
|
+
borderLeft: false,
|
|
3253
|
+
borderRight: false,
|
|
3254
|
+
children: [/* @__PURE__ */ jsx(Box, {
|
|
3255
|
+
marginBottom: 1,
|
|
3256
|
+
children: /* @__PURE__ */ jsx(Gradient, {
|
|
3257
|
+
name: GRADIENT_NAMES[gradientIndex],
|
|
3258
|
+
children: /* @__PURE__ */ jsxs(Text, {
|
|
3259
|
+
bold: true,
|
|
3260
|
+
children: [
|
|
3261
|
+
EMOJI_SEQUENCE[currentEmoji],
|
|
3262
|
+
" ",
|
|
3263
|
+
t("version.title"),
|
|
3264
|
+
" ",
|
|
3265
|
+
EMOJI_SEQUENCE[currentEmoji]
|
|
3266
|
+
]
|
|
3267
|
+
})
|
|
3268
|
+
})
|
|
3269
|
+
}), /* @__PURE__ */ jsx(Box, {
|
|
3270
|
+
flexDirection: "column",
|
|
3271
|
+
alignItems: "center",
|
|
3272
|
+
gap: 1,
|
|
3273
|
+
children: /* @__PURE__ */ jsxs(Box, { children: [
|
|
3274
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
3275
|
+
color: "cyan",
|
|
3276
|
+
bold: true,
|
|
3277
|
+
children: ["CLI Version:", " "]
|
|
3278
|
+
}),
|
|
3279
|
+
/* @__PURE__ */ jsx(Gradient, {
|
|
3280
|
+
name: "teen",
|
|
3281
|
+
children: /* @__PURE__ */ jsxs(Text, {
|
|
3282
|
+
bold: true,
|
|
3283
|
+
children: ["v", version$2]
|
|
3284
|
+
})
|
|
3285
|
+
}),
|
|
3286
|
+
/* @__PURE__ */ jsx(Text, {
|
|
3287
|
+
color: "gray",
|
|
3288
|
+
children: " | "
|
|
3289
|
+
}),
|
|
3290
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
3291
|
+
color: "blue",
|
|
3292
|
+
bold: true,
|
|
3293
|
+
children: ["Core Version:", " "]
|
|
3294
|
+
}),
|
|
3295
|
+
/* @__PURE__ */ jsx(Gradient, {
|
|
3296
|
+
name: "pastel",
|
|
3297
|
+
children: /* @__PURE__ */ jsxs(Text, {
|
|
3298
|
+
bold: true,
|
|
3299
|
+
children: ["v", version$1]
|
|
3300
|
+
})
|
|
3301
|
+
})
|
|
3302
|
+
] })
|
|
3303
|
+
})]
|
|
3304
|
+
}),
|
|
3305
|
+
/* @__PURE__ */ jsx(Box, {
|
|
3306
|
+
flexDirection: "column",
|
|
3307
|
+
alignItems: "center",
|
|
3308
|
+
gap: 1,
|
|
3309
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
3310
|
+
color: "gray",
|
|
3311
|
+
dimColor: true,
|
|
3312
|
+
children: t("version.builtWith")
|
|
3313
|
+
})
|
|
3314
|
+
}),
|
|
3315
|
+
/* @__PURE__ */ jsx(Box, {
|
|
3316
|
+
marginTop: 1,
|
|
3317
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
3318
|
+
color: "gray",
|
|
3319
|
+
dimColor: true,
|
|
3320
|
+
children: "v"
|
|
3321
|
+
})
|
|
3322
|
+
})
|
|
3323
|
+
]
|
|
3324
|
+
});
|
|
3325
|
+
}
|
|
3326
|
+
|
|
3327
|
+
//#endregion
|
|
3328
|
+
//#region src/index.tsx
|
|
3329
|
+
const { version } = (0, import_minimist.default)(process$1.argv.slice(2), { alias: { version: ["v", "V"] } });
|
|
3330
|
+
if (version) render(/* @__PURE__ */ jsx(VersionPage, { onExit: () => process$1.exit(0) }));
|
|
3331
|
+
else render(/* @__PURE__ */ jsx(App_default, {}));
|
|
3332
|
+
|
|
3333
|
+
//#endregion
|
|
3334
|
+
export { EVENT_TYPE_LABELS as i, useUserInputStore as n, useAgentContext as r, useDeviceInfo as t };
|