dsh-auth-remote 0.1.8 → 0.1.10
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/CHANGELOG.md +19 -1
- package/CHANGELOG.zh-CN.md +19 -1
- package/CONTRIBUTING.md +1 -1
- package/CONTRIBUTING.zh-CN.md +1 -1
- package/README.md +35 -13
- package/README.zh-CN.md +35 -13
- package/cordis.patch.yml +2 -1
- package/dist/cli.js +125 -30
- package/dist/cli.js.map +2 -2
- package/dist/client.js +3196 -441
- package/dist/client.js.map +4 -4
- package/dist/index.js +472 -42
- package/dist/index.js.map +3 -3
- package/dist/login.css +2 -8
- package/dist/login.css.map +2 -2
- package/dist/login.js +114 -26
- package/dist/login.js.map +2 -2
- package/dist/types/adapters/dsh/account-callback.d.ts +15 -0
- package/dist/types/adapters/dsh/account-callback.d.ts.map +1 -0
- package/dist/types/adapters/dsh/browser-capability.d.ts +1 -1
- package/dist/types/adapters/dsh/browser-capability.d.ts.map +1 -1
- package/dist/types/adapters/dsh/hmr-context.d.ts +10 -0
- package/dist/types/adapters/dsh/hmr-context.d.ts.map +1 -0
- package/dist/types/adapters/dsh/webserver.d.ts +3 -0
- package/dist/types/adapters/dsh/webserver.d.ts.map +1 -1
- package/dist/types/auth/service.d.ts +2 -0
- package/dist/types/auth/service.d.ts.map +1 -1
- package/dist/types/auth/sessions.d.ts +2 -0
- package/dist/types/auth/sessions.d.ts.map +1 -1
- package/dist/types/config.d.ts +9 -3
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/http/account-login.d.ts +45 -0
- package/dist/types/http/account-login.d.ts.map +1 -0
- package/dist/types/http/routes.d.ts +16 -1
- package/dist/types/http/routes.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/shared/account-login.d.ts +22 -0
- package/dist/types/shared/account-login.d.ts.map +1 -0
- package/dist/types/shared/auth-contract.d.ts +2 -0
- package/dist/types/shared/auth-contract.d.ts.map +1 -1
- package/dist/types/shared/i18n.d.ts +112 -24
- package/dist/types/shared/i18n.d.ts.map +1 -1
- package/dist/types/shared/locales/en.d.ts +56 -12
- package/dist/types/shared/locales/en.d.ts.map +1 -1
- package/dist/types/shared/locales/zh.d.ts +56 -12
- package/dist/types/shared/locales/zh.d.ts.map +1 -1
- package/docs/deployment.md +24 -17
- package/docs/deployment.zh-CN.md +24 -17
- package/docs/development.md +29 -7
- package/docs/development.zh-CN.md +29 -7
- package/docs/legacy-compatibility.md +192 -117
- package/docs/legacy-compatibility.zh-CN.md +192 -0
- package/docs/releasing.md +6 -6
- package/docs/releasing.zh-CN.md +6 -6
- package/docs/reverse-proxy.md +2 -2
- package/docs/reverse-proxy.zh-CN.md +2 -2
- package/examples/web-profile-auth-remote.patch.yml +4 -2
- package/package.json +31 -13
package/dist/client.js
CHANGED
|
@@ -2140,6 +2140,1936 @@ var require_browser = __commonJS({
|
|
|
2140
2140
|
}
|
|
2141
2141
|
});
|
|
2142
2142
|
|
|
2143
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js
|
|
2144
|
+
var require_constants = __commonJS({
|
|
2145
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js"(exports, module2) {
|
|
2146
|
+
"use strict";
|
|
2147
|
+
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
2148
|
+
var MAX_LENGTH = 256;
|
|
2149
|
+
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
|
|
2150
|
+
9007199254740991;
|
|
2151
|
+
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
2152
|
+
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
2153
|
+
var RELEASE_TYPES = [
|
|
2154
|
+
"major",
|
|
2155
|
+
"premajor",
|
|
2156
|
+
"minor",
|
|
2157
|
+
"preminor",
|
|
2158
|
+
"patch",
|
|
2159
|
+
"prepatch",
|
|
2160
|
+
"prerelease"
|
|
2161
|
+
];
|
|
2162
|
+
module2.exports = {
|
|
2163
|
+
MAX_LENGTH,
|
|
2164
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
2165
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
2166
|
+
MAX_SAFE_INTEGER,
|
|
2167
|
+
RELEASE_TYPES,
|
|
2168
|
+
SEMVER_SPEC_VERSION,
|
|
2169
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
2170
|
+
FLAG_LOOSE: 2
|
|
2171
|
+
};
|
|
2172
|
+
}
|
|
2173
|
+
});
|
|
2174
|
+
|
|
2175
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.js
|
|
2176
|
+
var require_debug = __commonJS({
|
|
2177
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.js"(exports, module2) {
|
|
2178
|
+
"use strict";
|
|
2179
|
+
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
|
2180
|
+
};
|
|
2181
|
+
module2.exports = debug;
|
|
2182
|
+
}
|
|
2183
|
+
});
|
|
2184
|
+
|
|
2185
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.js
|
|
2186
|
+
var require_re = __commonJS({
|
|
2187
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.js"(exports, module2) {
|
|
2188
|
+
"use strict";
|
|
2189
|
+
var {
|
|
2190
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
2191
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
2192
|
+
MAX_LENGTH
|
|
2193
|
+
} = require_constants();
|
|
2194
|
+
var debug = require_debug();
|
|
2195
|
+
exports = module2.exports = {};
|
|
2196
|
+
var re = exports.re = [];
|
|
2197
|
+
var safeRe = exports.safeRe = [];
|
|
2198
|
+
var src = exports.src = [];
|
|
2199
|
+
var safeSrc = exports.safeSrc = [];
|
|
2200
|
+
var t = exports.t = {};
|
|
2201
|
+
var R = 0;
|
|
2202
|
+
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
2203
|
+
var safeRegexReplacements = [
|
|
2204
|
+
["\\s", 1],
|
|
2205
|
+
["\\d", MAX_LENGTH],
|
|
2206
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
2207
|
+
];
|
|
2208
|
+
var makeSafeRegex = (value) => {
|
|
2209
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
2210
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
2211
|
+
}
|
|
2212
|
+
return value;
|
|
2213
|
+
};
|
|
2214
|
+
var createToken = (name2, value, isGlobal) => {
|
|
2215
|
+
const safe = makeSafeRegex(value);
|
|
2216
|
+
const index = R++;
|
|
2217
|
+
debug(name2, index, value);
|
|
2218
|
+
t[name2] = index;
|
|
2219
|
+
src[index] = value;
|
|
2220
|
+
safeSrc[index] = safe;
|
|
2221
|
+
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
2222
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
2223
|
+
};
|
|
2224
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
2225
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
2226
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
2227
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
|
2228
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
2229
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
2230
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
2231
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
2232
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
2233
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
2234
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
2235
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
2236
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
2237
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
2238
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
2239
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
2240
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
2241
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
2242
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
|
2243
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
|
2244
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
2245
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
2246
|
+
createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
2247
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
2248
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
|
2249
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
2250
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
2251
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
2252
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
2253
|
+
exports.tildeTrimReplace = "$1~";
|
|
2254
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
2255
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
2256
|
+
createToken("LONECARET", "(?:\\^)");
|
|
2257
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
2258
|
+
exports.caretTrimReplace = "$1^";
|
|
2259
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
2260
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
2261
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
2262
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
2263
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
2264
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
2265
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
2266
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
2267
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
2268
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
2269
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
2270
|
+
}
|
|
2271
|
+
});
|
|
2272
|
+
|
|
2273
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/parse-options.js
|
|
2274
|
+
var require_parse_options = __commonJS({
|
|
2275
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/parse-options.js"(exports, module2) {
|
|
2276
|
+
"use strict";
|
|
2277
|
+
var looseOption = Object.freeze({ loose: true });
|
|
2278
|
+
var emptyOpts = Object.freeze({});
|
|
2279
|
+
var parseOptions = (options) => {
|
|
2280
|
+
if (!options) {
|
|
2281
|
+
return emptyOpts;
|
|
2282
|
+
}
|
|
2283
|
+
if (typeof options !== "object") {
|
|
2284
|
+
return looseOption;
|
|
2285
|
+
}
|
|
2286
|
+
return options;
|
|
2287
|
+
};
|
|
2288
|
+
module2.exports = parseOptions;
|
|
2289
|
+
}
|
|
2290
|
+
});
|
|
2291
|
+
|
|
2292
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/identifiers.js
|
|
2293
|
+
var require_identifiers = __commonJS({
|
|
2294
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/identifiers.js"(exports, module2) {
|
|
2295
|
+
"use strict";
|
|
2296
|
+
var numeric = /^[0-9]+$/;
|
|
2297
|
+
var compareIdentifiers = (a, b) => {
|
|
2298
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
2299
|
+
return a === b ? 0 : a < b ? -1 : 1;
|
|
2300
|
+
}
|
|
2301
|
+
const anum = numeric.test(a);
|
|
2302
|
+
const bnum = numeric.test(b);
|
|
2303
|
+
if (anum && bnum) {
|
|
2304
|
+
a = +a;
|
|
2305
|
+
b = +b;
|
|
2306
|
+
}
|
|
2307
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
2308
|
+
};
|
|
2309
|
+
var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
2310
|
+
module2.exports = {
|
|
2311
|
+
compareIdentifiers,
|
|
2312
|
+
rcompareIdentifiers
|
|
2313
|
+
};
|
|
2314
|
+
}
|
|
2315
|
+
});
|
|
2316
|
+
|
|
2317
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.js
|
|
2318
|
+
var require_semver = __commonJS({
|
|
2319
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.js"(exports, module2) {
|
|
2320
|
+
"use strict";
|
|
2321
|
+
var debug = require_debug();
|
|
2322
|
+
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
2323
|
+
var { safeRe: re, t } = require_re();
|
|
2324
|
+
var parseOptions = require_parse_options();
|
|
2325
|
+
var { compareIdentifiers } = require_identifiers();
|
|
2326
|
+
var SemVer = class _SemVer {
|
|
2327
|
+
constructor(version, options) {
|
|
2328
|
+
options = parseOptions(options);
|
|
2329
|
+
if (version instanceof _SemVer) {
|
|
2330
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
2331
|
+
return version;
|
|
2332
|
+
} else {
|
|
2333
|
+
version = version.version;
|
|
2334
|
+
}
|
|
2335
|
+
} else if (typeof version !== "string") {
|
|
2336
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
2337
|
+
}
|
|
2338
|
+
if (version.length > MAX_LENGTH) {
|
|
2339
|
+
throw new TypeError(
|
|
2340
|
+
`version is longer than ${MAX_LENGTH} characters`
|
|
2341
|
+
);
|
|
2342
|
+
}
|
|
2343
|
+
debug("SemVer", version, options);
|
|
2344
|
+
this.options = options;
|
|
2345
|
+
this.loose = !!options.loose;
|
|
2346
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
2347
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
2348
|
+
if (!m) {
|
|
2349
|
+
throw new TypeError(`Invalid Version: ${version}`);
|
|
2350
|
+
}
|
|
2351
|
+
this.raw = version;
|
|
2352
|
+
this.major = +m[1];
|
|
2353
|
+
this.minor = +m[2];
|
|
2354
|
+
this.patch = +m[3];
|
|
2355
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
2356
|
+
throw new TypeError("Invalid major version");
|
|
2357
|
+
}
|
|
2358
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
2359
|
+
throw new TypeError("Invalid minor version");
|
|
2360
|
+
}
|
|
2361
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
2362
|
+
throw new TypeError("Invalid patch version");
|
|
2363
|
+
}
|
|
2364
|
+
if (!m[4]) {
|
|
2365
|
+
this.prerelease = [];
|
|
2366
|
+
} else {
|
|
2367
|
+
this.prerelease = m[4].split(".").map((id) => {
|
|
2368
|
+
if (/^[0-9]+$/.test(id)) {
|
|
2369
|
+
const num = +id;
|
|
2370
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
2371
|
+
return num;
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
return id;
|
|
2375
|
+
});
|
|
2376
|
+
}
|
|
2377
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
2378
|
+
this.format();
|
|
2379
|
+
}
|
|
2380
|
+
format() {
|
|
2381
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
2382
|
+
if (this.prerelease.length) {
|
|
2383
|
+
this.version += `-${this.prerelease.join(".")}`;
|
|
2384
|
+
}
|
|
2385
|
+
return this.version;
|
|
2386
|
+
}
|
|
2387
|
+
toString() {
|
|
2388
|
+
return this.version;
|
|
2389
|
+
}
|
|
2390
|
+
compare(other) {
|
|
2391
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
2392
|
+
if (!(other instanceof _SemVer)) {
|
|
2393
|
+
if (typeof other === "string" && other === this.version) {
|
|
2394
|
+
return 0;
|
|
2395
|
+
}
|
|
2396
|
+
other = new _SemVer(other, this.options);
|
|
2397
|
+
}
|
|
2398
|
+
if (other.version === this.version) {
|
|
2399
|
+
return 0;
|
|
2400
|
+
}
|
|
2401
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
2402
|
+
}
|
|
2403
|
+
compareMain(other) {
|
|
2404
|
+
if (!(other instanceof _SemVer)) {
|
|
2405
|
+
other = new _SemVer(other, this.options);
|
|
2406
|
+
}
|
|
2407
|
+
if (this.major < other.major) {
|
|
2408
|
+
return -1;
|
|
2409
|
+
}
|
|
2410
|
+
if (this.major > other.major) {
|
|
2411
|
+
return 1;
|
|
2412
|
+
}
|
|
2413
|
+
if (this.minor < other.minor) {
|
|
2414
|
+
return -1;
|
|
2415
|
+
}
|
|
2416
|
+
if (this.minor > other.minor) {
|
|
2417
|
+
return 1;
|
|
2418
|
+
}
|
|
2419
|
+
if (this.patch < other.patch) {
|
|
2420
|
+
return -1;
|
|
2421
|
+
}
|
|
2422
|
+
if (this.patch > other.patch) {
|
|
2423
|
+
return 1;
|
|
2424
|
+
}
|
|
2425
|
+
return 0;
|
|
2426
|
+
}
|
|
2427
|
+
comparePre(other) {
|
|
2428
|
+
if (!(other instanceof _SemVer)) {
|
|
2429
|
+
other = new _SemVer(other, this.options);
|
|
2430
|
+
}
|
|
2431
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
2432
|
+
return -1;
|
|
2433
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
2434
|
+
return 1;
|
|
2435
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
2436
|
+
return 0;
|
|
2437
|
+
}
|
|
2438
|
+
let i = 0;
|
|
2439
|
+
do {
|
|
2440
|
+
const a = this.prerelease[i];
|
|
2441
|
+
const b = other.prerelease[i];
|
|
2442
|
+
debug("prerelease compare", i, a, b);
|
|
2443
|
+
if (a === void 0 && b === void 0) {
|
|
2444
|
+
return 0;
|
|
2445
|
+
} else if (b === void 0) {
|
|
2446
|
+
return 1;
|
|
2447
|
+
} else if (a === void 0) {
|
|
2448
|
+
return -1;
|
|
2449
|
+
} else if (a === b) {
|
|
2450
|
+
continue;
|
|
2451
|
+
} else {
|
|
2452
|
+
return compareIdentifiers(a, b);
|
|
2453
|
+
}
|
|
2454
|
+
} while (++i);
|
|
2455
|
+
}
|
|
2456
|
+
compareBuild(other) {
|
|
2457
|
+
if (!(other instanceof _SemVer)) {
|
|
2458
|
+
other = new _SemVer(other, this.options);
|
|
2459
|
+
}
|
|
2460
|
+
let i = 0;
|
|
2461
|
+
do {
|
|
2462
|
+
const a = this.build[i];
|
|
2463
|
+
const b = other.build[i];
|
|
2464
|
+
debug("build compare", i, a, b);
|
|
2465
|
+
if (a === void 0 && b === void 0) {
|
|
2466
|
+
return 0;
|
|
2467
|
+
} else if (b === void 0) {
|
|
2468
|
+
return 1;
|
|
2469
|
+
} else if (a === void 0) {
|
|
2470
|
+
return -1;
|
|
2471
|
+
} else if (a === b) {
|
|
2472
|
+
continue;
|
|
2473
|
+
} else {
|
|
2474
|
+
return compareIdentifiers(a, b);
|
|
2475
|
+
}
|
|
2476
|
+
} while (++i);
|
|
2477
|
+
}
|
|
2478
|
+
// preminor will bump the version up to the next minor release, and immediately
|
|
2479
|
+
// down to pre-release. premajor and prepatch work the same way.
|
|
2480
|
+
inc(release, identifier, identifierBase) {
|
|
2481
|
+
if (release.startsWith("pre")) {
|
|
2482
|
+
if (!identifier && identifierBase === false) {
|
|
2483
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
2484
|
+
}
|
|
2485
|
+
if (identifier) {
|
|
2486
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
2487
|
+
if (!match || match[1] !== identifier) {
|
|
2488
|
+
throw new Error(`invalid identifier: ${identifier}`);
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
switch (release) {
|
|
2493
|
+
case "premajor":
|
|
2494
|
+
this.prerelease.length = 0;
|
|
2495
|
+
this.patch = 0;
|
|
2496
|
+
this.minor = 0;
|
|
2497
|
+
this.major++;
|
|
2498
|
+
this.inc("pre", identifier, identifierBase);
|
|
2499
|
+
break;
|
|
2500
|
+
case "preminor":
|
|
2501
|
+
this.prerelease.length = 0;
|
|
2502
|
+
this.patch = 0;
|
|
2503
|
+
this.minor++;
|
|
2504
|
+
this.inc("pre", identifier, identifierBase);
|
|
2505
|
+
break;
|
|
2506
|
+
case "prepatch":
|
|
2507
|
+
this.prerelease.length = 0;
|
|
2508
|
+
this.inc("patch", identifier, identifierBase);
|
|
2509
|
+
this.inc("pre", identifier, identifierBase);
|
|
2510
|
+
break;
|
|
2511
|
+
// If the input is a non-prerelease version, this acts the same as
|
|
2512
|
+
// prepatch.
|
|
2513
|
+
case "prerelease":
|
|
2514
|
+
if (this.prerelease.length === 0) {
|
|
2515
|
+
this.inc("patch", identifier, identifierBase);
|
|
2516
|
+
}
|
|
2517
|
+
this.inc("pre", identifier, identifierBase);
|
|
2518
|
+
break;
|
|
2519
|
+
case "release":
|
|
2520
|
+
if (this.prerelease.length === 0) {
|
|
2521
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
2522
|
+
}
|
|
2523
|
+
this.prerelease.length = 0;
|
|
2524
|
+
break;
|
|
2525
|
+
case "major":
|
|
2526
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
2527
|
+
this.major++;
|
|
2528
|
+
}
|
|
2529
|
+
this.minor = 0;
|
|
2530
|
+
this.patch = 0;
|
|
2531
|
+
this.prerelease = [];
|
|
2532
|
+
break;
|
|
2533
|
+
case "minor":
|
|
2534
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
2535
|
+
this.minor++;
|
|
2536
|
+
}
|
|
2537
|
+
this.patch = 0;
|
|
2538
|
+
this.prerelease = [];
|
|
2539
|
+
break;
|
|
2540
|
+
case "patch":
|
|
2541
|
+
if (this.prerelease.length === 0) {
|
|
2542
|
+
this.patch++;
|
|
2543
|
+
}
|
|
2544
|
+
this.prerelease = [];
|
|
2545
|
+
break;
|
|
2546
|
+
// This probably shouldn't be used publicly.
|
|
2547
|
+
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
2548
|
+
case "pre": {
|
|
2549
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
2550
|
+
if (this.prerelease.length === 0) {
|
|
2551
|
+
this.prerelease = [base];
|
|
2552
|
+
} else {
|
|
2553
|
+
let i = this.prerelease.length;
|
|
2554
|
+
while (--i >= 0) {
|
|
2555
|
+
if (typeof this.prerelease[i] === "number") {
|
|
2556
|
+
this.prerelease[i]++;
|
|
2557
|
+
i = -2;
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
if (i === -1) {
|
|
2561
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
2562
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
2563
|
+
}
|
|
2564
|
+
this.prerelease.push(base);
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
if (identifier) {
|
|
2568
|
+
let prerelease = [identifier, base];
|
|
2569
|
+
if (identifierBase === false) {
|
|
2570
|
+
prerelease = [identifier];
|
|
2571
|
+
}
|
|
2572
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
2573
|
+
if (isNaN(this.prerelease[1])) {
|
|
2574
|
+
this.prerelease = prerelease;
|
|
2575
|
+
}
|
|
2576
|
+
} else {
|
|
2577
|
+
this.prerelease = prerelease;
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
break;
|
|
2581
|
+
}
|
|
2582
|
+
default:
|
|
2583
|
+
throw new Error(`invalid increment argument: ${release}`);
|
|
2584
|
+
}
|
|
2585
|
+
this.raw = this.format();
|
|
2586
|
+
if (this.build.length) {
|
|
2587
|
+
this.raw += `+${this.build.join(".")}`;
|
|
2588
|
+
}
|
|
2589
|
+
return this;
|
|
2590
|
+
}
|
|
2591
|
+
};
|
|
2592
|
+
module2.exports = SemVer;
|
|
2593
|
+
}
|
|
2594
|
+
});
|
|
2595
|
+
|
|
2596
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js
|
|
2597
|
+
var require_parse = __commonJS({
|
|
2598
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js"(exports, module2) {
|
|
2599
|
+
"use strict";
|
|
2600
|
+
var SemVer = require_semver();
|
|
2601
|
+
var parse = (version, options, throwErrors = false) => {
|
|
2602
|
+
if (version instanceof SemVer) {
|
|
2603
|
+
return version;
|
|
2604
|
+
}
|
|
2605
|
+
try {
|
|
2606
|
+
return new SemVer(version, options);
|
|
2607
|
+
} catch (er) {
|
|
2608
|
+
if (!throwErrors) {
|
|
2609
|
+
return null;
|
|
2610
|
+
}
|
|
2611
|
+
throw er;
|
|
2612
|
+
}
|
|
2613
|
+
};
|
|
2614
|
+
module2.exports = parse;
|
|
2615
|
+
}
|
|
2616
|
+
});
|
|
2617
|
+
|
|
2618
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js
|
|
2619
|
+
var require_valid = __commonJS({
|
|
2620
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js"(exports, module2) {
|
|
2621
|
+
"use strict";
|
|
2622
|
+
var parse = require_parse();
|
|
2623
|
+
var valid = (version, options) => {
|
|
2624
|
+
const v = parse(version, options);
|
|
2625
|
+
return v ? v.version : null;
|
|
2626
|
+
};
|
|
2627
|
+
module2.exports = valid;
|
|
2628
|
+
}
|
|
2629
|
+
});
|
|
2630
|
+
|
|
2631
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js
|
|
2632
|
+
var require_clean = __commonJS({
|
|
2633
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js"(exports, module2) {
|
|
2634
|
+
"use strict";
|
|
2635
|
+
var parse = require_parse();
|
|
2636
|
+
var clean = (version, options) => {
|
|
2637
|
+
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
2638
|
+
return s ? s.version : null;
|
|
2639
|
+
};
|
|
2640
|
+
module2.exports = clean;
|
|
2641
|
+
}
|
|
2642
|
+
});
|
|
2643
|
+
|
|
2644
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/inc.js
|
|
2645
|
+
var require_inc = __commonJS({
|
|
2646
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/inc.js"(exports, module2) {
|
|
2647
|
+
"use strict";
|
|
2648
|
+
var SemVer = require_semver();
|
|
2649
|
+
var inc = (version, release, options, identifier, identifierBase) => {
|
|
2650
|
+
if (typeof options === "string") {
|
|
2651
|
+
identifierBase = identifier;
|
|
2652
|
+
identifier = options;
|
|
2653
|
+
options = void 0;
|
|
2654
|
+
}
|
|
2655
|
+
try {
|
|
2656
|
+
return new SemVer(
|
|
2657
|
+
version instanceof SemVer ? version.version : version,
|
|
2658
|
+
options
|
|
2659
|
+
).inc(release, identifier, identifierBase).version;
|
|
2660
|
+
} catch (er) {
|
|
2661
|
+
return null;
|
|
2662
|
+
}
|
|
2663
|
+
};
|
|
2664
|
+
module2.exports = inc;
|
|
2665
|
+
}
|
|
2666
|
+
});
|
|
2667
|
+
|
|
2668
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.js
|
|
2669
|
+
var require_diff = __commonJS({
|
|
2670
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.js"(exports, module2) {
|
|
2671
|
+
"use strict";
|
|
2672
|
+
var parse = require_parse();
|
|
2673
|
+
var diff = (version1, version2) => {
|
|
2674
|
+
const v1 = parse(version1, null, true);
|
|
2675
|
+
const v2 = parse(version2, null, true);
|
|
2676
|
+
const comparison = v1.compare(v2);
|
|
2677
|
+
if (comparison === 0) {
|
|
2678
|
+
return null;
|
|
2679
|
+
}
|
|
2680
|
+
const v1Higher = comparison > 0;
|
|
2681
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
2682
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
2683
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
2684
|
+
const lowHasPre = !!lowVersion.prerelease.length;
|
|
2685
|
+
if (lowHasPre && !highHasPre) {
|
|
2686
|
+
if (!lowVersion.patch && !lowVersion.minor) {
|
|
2687
|
+
return "major";
|
|
2688
|
+
}
|
|
2689
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
2690
|
+
if (lowVersion.minor && !lowVersion.patch) {
|
|
2691
|
+
return "minor";
|
|
2692
|
+
}
|
|
2693
|
+
return "patch";
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
const prefix = highHasPre ? "pre" : "";
|
|
2697
|
+
if (v1.major !== v2.major) {
|
|
2698
|
+
return prefix + "major";
|
|
2699
|
+
}
|
|
2700
|
+
if (v1.minor !== v2.minor) {
|
|
2701
|
+
return prefix + "minor";
|
|
2702
|
+
}
|
|
2703
|
+
if (v1.patch !== v2.patch) {
|
|
2704
|
+
return prefix + "patch";
|
|
2705
|
+
}
|
|
2706
|
+
return "prerelease";
|
|
2707
|
+
};
|
|
2708
|
+
module2.exports = diff;
|
|
2709
|
+
}
|
|
2710
|
+
});
|
|
2711
|
+
|
|
2712
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/major.js
|
|
2713
|
+
var require_major = __commonJS({
|
|
2714
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/major.js"(exports, module2) {
|
|
2715
|
+
"use strict";
|
|
2716
|
+
var SemVer = require_semver();
|
|
2717
|
+
var major = (a, loose) => new SemVer(a, loose).major;
|
|
2718
|
+
module2.exports = major;
|
|
2719
|
+
}
|
|
2720
|
+
});
|
|
2721
|
+
|
|
2722
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/minor.js
|
|
2723
|
+
var require_minor = __commonJS({
|
|
2724
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/minor.js"(exports, module2) {
|
|
2725
|
+
"use strict";
|
|
2726
|
+
var SemVer = require_semver();
|
|
2727
|
+
var minor = (a, loose) => new SemVer(a, loose).minor;
|
|
2728
|
+
module2.exports = minor;
|
|
2729
|
+
}
|
|
2730
|
+
});
|
|
2731
|
+
|
|
2732
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/patch.js
|
|
2733
|
+
var require_patch = __commonJS({
|
|
2734
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/patch.js"(exports, module2) {
|
|
2735
|
+
"use strict";
|
|
2736
|
+
var SemVer = require_semver();
|
|
2737
|
+
var patch = (a, loose) => new SemVer(a, loose).patch;
|
|
2738
|
+
module2.exports = patch;
|
|
2739
|
+
}
|
|
2740
|
+
});
|
|
2741
|
+
|
|
2742
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js
|
|
2743
|
+
var require_prerelease = __commonJS({
|
|
2744
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js"(exports, module2) {
|
|
2745
|
+
"use strict";
|
|
2746
|
+
var parse = require_parse();
|
|
2747
|
+
var prerelease = (version, options) => {
|
|
2748
|
+
const parsed = parse(version, options);
|
|
2749
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
2750
|
+
};
|
|
2751
|
+
module2.exports = prerelease;
|
|
2752
|
+
}
|
|
2753
|
+
});
|
|
2754
|
+
|
|
2755
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare.js
|
|
2756
|
+
var require_compare = __commonJS({
|
|
2757
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare.js"(exports, module2) {
|
|
2758
|
+
"use strict";
|
|
2759
|
+
var SemVer = require_semver();
|
|
2760
|
+
var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
2761
|
+
module2.exports = compare;
|
|
2762
|
+
}
|
|
2763
|
+
});
|
|
2764
|
+
|
|
2765
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rcompare.js
|
|
2766
|
+
var require_rcompare = __commonJS({
|
|
2767
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rcompare.js"(exports, module2) {
|
|
2768
|
+
"use strict";
|
|
2769
|
+
var compare = require_compare();
|
|
2770
|
+
var rcompare = (a, b, loose) => compare(b, a, loose);
|
|
2771
|
+
module2.exports = rcompare;
|
|
2772
|
+
}
|
|
2773
|
+
});
|
|
2774
|
+
|
|
2775
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-loose.js
|
|
2776
|
+
var require_compare_loose = __commonJS({
|
|
2777
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-loose.js"(exports, module2) {
|
|
2778
|
+
"use strict";
|
|
2779
|
+
var compare = require_compare();
|
|
2780
|
+
var compareLoose = (a, b) => compare(a, b, true);
|
|
2781
|
+
module2.exports = compareLoose;
|
|
2782
|
+
}
|
|
2783
|
+
});
|
|
2784
|
+
|
|
2785
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-build.js
|
|
2786
|
+
var require_compare_build = __commonJS({
|
|
2787
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-build.js"(exports, module2) {
|
|
2788
|
+
"use strict";
|
|
2789
|
+
var SemVer = require_semver();
|
|
2790
|
+
var compareBuild = (a, b, loose) => {
|
|
2791
|
+
const versionA = new SemVer(a, loose);
|
|
2792
|
+
const versionB = new SemVer(b, loose);
|
|
2793
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
2794
|
+
};
|
|
2795
|
+
module2.exports = compareBuild;
|
|
2796
|
+
}
|
|
2797
|
+
});
|
|
2798
|
+
|
|
2799
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/sort.js
|
|
2800
|
+
var require_sort = __commonJS({
|
|
2801
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/sort.js"(exports, module2) {
|
|
2802
|
+
"use strict";
|
|
2803
|
+
var compareBuild = require_compare_build();
|
|
2804
|
+
var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
2805
|
+
module2.exports = sort;
|
|
2806
|
+
}
|
|
2807
|
+
});
|
|
2808
|
+
|
|
2809
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rsort.js
|
|
2810
|
+
var require_rsort = __commonJS({
|
|
2811
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rsort.js"(exports, module2) {
|
|
2812
|
+
"use strict";
|
|
2813
|
+
var compareBuild = require_compare_build();
|
|
2814
|
+
var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
2815
|
+
module2.exports = rsort;
|
|
2816
|
+
}
|
|
2817
|
+
});
|
|
2818
|
+
|
|
2819
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gt.js
|
|
2820
|
+
var require_gt = __commonJS({
|
|
2821
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gt.js"(exports, module2) {
|
|
2822
|
+
"use strict";
|
|
2823
|
+
var compare = require_compare();
|
|
2824
|
+
var gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
2825
|
+
module2.exports = gt;
|
|
2826
|
+
}
|
|
2827
|
+
});
|
|
2828
|
+
|
|
2829
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lt.js
|
|
2830
|
+
var require_lt = __commonJS({
|
|
2831
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lt.js"(exports, module2) {
|
|
2832
|
+
"use strict";
|
|
2833
|
+
var compare = require_compare();
|
|
2834
|
+
var lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
2835
|
+
module2.exports = lt;
|
|
2836
|
+
}
|
|
2837
|
+
});
|
|
2838
|
+
|
|
2839
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/eq.js
|
|
2840
|
+
var require_eq = __commonJS({
|
|
2841
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/eq.js"(exports, module2) {
|
|
2842
|
+
"use strict";
|
|
2843
|
+
var compare = require_compare();
|
|
2844
|
+
var eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
2845
|
+
module2.exports = eq;
|
|
2846
|
+
}
|
|
2847
|
+
});
|
|
2848
|
+
|
|
2849
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/neq.js
|
|
2850
|
+
var require_neq = __commonJS({
|
|
2851
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/neq.js"(exports, module2) {
|
|
2852
|
+
"use strict";
|
|
2853
|
+
var compare = require_compare();
|
|
2854
|
+
var neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
2855
|
+
module2.exports = neq;
|
|
2856
|
+
}
|
|
2857
|
+
});
|
|
2858
|
+
|
|
2859
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gte.js
|
|
2860
|
+
var require_gte = __commonJS({
|
|
2861
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gte.js"(exports, module2) {
|
|
2862
|
+
"use strict";
|
|
2863
|
+
var compare = require_compare();
|
|
2864
|
+
var gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
2865
|
+
module2.exports = gte;
|
|
2866
|
+
}
|
|
2867
|
+
});
|
|
2868
|
+
|
|
2869
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lte.js
|
|
2870
|
+
var require_lte = __commonJS({
|
|
2871
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lte.js"(exports, module2) {
|
|
2872
|
+
"use strict";
|
|
2873
|
+
var compare = require_compare();
|
|
2874
|
+
var lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
2875
|
+
module2.exports = lte;
|
|
2876
|
+
}
|
|
2877
|
+
});
|
|
2878
|
+
|
|
2879
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/cmp.js
|
|
2880
|
+
var require_cmp = __commonJS({
|
|
2881
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/cmp.js"(exports, module2) {
|
|
2882
|
+
"use strict";
|
|
2883
|
+
var eq = require_eq();
|
|
2884
|
+
var neq = require_neq();
|
|
2885
|
+
var gt = require_gt();
|
|
2886
|
+
var gte = require_gte();
|
|
2887
|
+
var lt = require_lt();
|
|
2888
|
+
var lte = require_lte();
|
|
2889
|
+
var cmp = (a, op, b, loose) => {
|
|
2890
|
+
switch (op) {
|
|
2891
|
+
case "===":
|
|
2892
|
+
if (typeof a === "object") {
|
|
2893
|
+
a = a.version;
|
|
2894
|
+
}
|
|
2895
|
+
if (typeof b === "object") {
|
|
2896
|
+
b = b.version;
|
|
2897
|
+
}
|
|
2898
|
+
return a === b;
|
|
2899
|
+
case "!==":
|
|
2900
|
+
if (typeof a === "object") {
|
|
2901
|
+
a = a.version;
|
|
2902
|
+
}
|
|
2903
|
+
if (typeof b === "object") {
|
|
2904
|
+
b = b.version;
|
|
2905
|
+
}
|
|
2906
|
+
return a !== b;
|
|
2907
|
+
case "":
|
|
2908
|
+
case "=":
|
|
2909
|
+
case "==":
|
|
2910
|
+
return eq(a, b, loose);
|
|
2911
|
+
case "!=":
|
|
2912
|
+
return neq(a, b, loose);
|
|
2913
|
+
case ">":
|
|
2914
|
+
return gt(a, b, loose);
|
|
2915
|
+
case ">=":
|
|
2916
|
+
return gte(a, b, loose);
|
|
2917
|
+
case "<":
|
|
2918
|
+
return lt(a, b, loose);
|
|
2919
|
+
case "<=":
|
|
2920
|
+
return lte(a, b, loose);
|
|
2921
|
+
default:
|
|
2922
|
+
throw new TypeError(`Invalid operator: ${op}`);
|
|
2923
|
+
}
|
|
2924
|
+
};
|
|
2925
|
+
module2.exports = cmp;
|
|
2926
|
+
}
|
|
2927
|
+
});
|
|
2928
|
+
|
|
2929
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.js
|
|
2930
|
+
var require_coerce = __commonJS({
|
|
2931
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.js"(exports, module2) {
|
|
2932
|
+
"use strict";
|
|
2933
|
+
var SemVer = require_semver();
|
|
2934
|
+
var parse = require_parse();
|
|
2935
|
+
var { safeRe: re, t } = require_re();
|
|
2936
|
+
var coerce = (version, options) => {
|
|
2937
|
+
if (version instanceof SemVer) {
|
|
2938
|
+
return version;
|
|
2939
|
+
}
|
|
2940
|
+
if (typeof version === "number") {
|
|
2941
|
+
version = String(version);
|
|
2942
|
+
}
|
|
2943
|
+
if (typeof version !== "string") {
|
|
2944
|
+
return null;
|
|
2945
|
+
}
|
|
2946
|
+
options = options || {};
|
|
2947
|
+
let match = null;
|
|
2948
|
+
if (!options.rtl) {
|
|
2949
|
+
match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
2950
|
+
} else {
|
|
2951
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
2952
|
+
let next;
|
|
2953
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
2954
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
2955
|
+
match = next;
|
|
2956
|
+
}
|
|
2957
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
2958
|
+
}
|
|
2959
|
+
coerceRtlRegex.lastIndex = -1;
|
|
2960
|
+
}
|
|
2961
|
+
if (match === null) {
|
|
2962
|
+
return null;
|
|
2963
|
+
}
|
|
2964
|
+
const major = match[2];
|
|
2965
|
+
const minor = match[3] || "0";
|
|
2966
|
+
const patch = match[4] || "0";
|
|
2967
|
+
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
2968
|
+
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
2969
|
+
return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
2970
|
+
};
|
|
2971
|
+
module2.exports = coerce;
|
|
2972
|
+
}
|
|
2973
|
+
});
|
|
2974
|
+
|
|
2975
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/lrucache.js
|
|
2976
|
+
var require_lrucache = __commonJS({
|
|
2977
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/lrucache.js"(exports, module2) {
|
|
2978
|
+
"use strict";
|
|
2979
|
+
var LRUCache = class {
|
|
2980
|
+
constructor() {
|
|
2981
|
+
this.max = 1e3;
|
|
2982
|
+
this.map = /* @__PURE__ */ new Map();
|
|
2983
|
+
}
|
|
2984
|
+
get(key) {
|
|
2985
|
+
const value = this.map.get(key);
|
|
2986
|
+
if (value === void 0) {
|
|
2987
|
+
return void 0;
|
|
2988
|
+
} else {
|
|
2989
|
+
this.map.delete(key);
|
|
2990
|
+
this.map.set(key, value);
|
|
2991
|
+
return value;
|
|
2992
|
+
}
|
|
2993
|
+
}
|
|
2994
|
+
delete(key) {
|
|
2995
|
+
return this.map.delete(key);
|
|
2996
|
+
}
|
|
2997
|
+
set(key, value) {
|
|
2998
|
+
const deleted = this.delete(key);
|
|
2999
|
+
if (!deleted && value !== void 0) {
|
|
3000
|
+
if (this.map.size >= this.max) {
|
|
3001
|
+
const firstKey = this.map.keys().next().value;
|
|
3002
|
+
this.delete(firstKey);
|
|
3003
|
+
}
|
|
3004
|
+
this.map.set(key, value);
|
|
3005
|
+
}
|
|
3006
|
+
return this;
|
|
3007
|
+
}
|
|
3008
|
+
};
|
|
3009
|
+
module2.exports = LRUCache;
|
|
3010
|
+
}
|
|
3011
|
+
});
|
|
3012
|
+
|
|
3013
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/range.js
|
|
3014
|
+
var require_range = __commonJS({
|
|
3015
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/range.js"(exports, module2) {
|
|
3016
|
+
"use strict";
|
|
3017
|
+
var SPACE_CHARACTERS = /\s+/g;
|
|
3018
|
+
var Range = class _Range {
|
|
3019
|
+
constructor(range, options) {
|
|
3020
|
+
options = parseOptions(options);
|
|
3021
|
+
if (range instanceof _Range) {
|
|
3022
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
3023
|
+
return range;
|
|
3024
|
+
} else {
|
|
3025
|
+
return new _Range(range.raw, options);
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
if (range instanceof Comparator) {
|
|
3029
|
+
this.raw = range.value;
|
|
3030
|
+
this.set = [[range]];
|
|
3031
|
+
this.formatted = void 0;
|
|
3032
|
+
return this;
|
|
3033
|
+
}
|
|
3034
|
+
this.options = options;
|
|
3035
|
+
this.loose = !!options.loose;
|
|
3036
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
3037
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
3038
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
3039
|
+
if (!this.set.length) {
|
|
3040
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
3041
|
+
}
|
|
3042
|
+
if (this.set.length > 1) {
|
|
3043
|
+
const first = this.set[0];
|
|
3044
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
3045
|
+
if (this.set.length === 0) {
|
|
3046
|
+
this.set = [first];
|
|
3047
|
+
} else if (this.set.length > 1) {
|
|
3048
|
+
for (const c of this.set) {
|
|
3049
|
+
if (c.length === 1 && isAny(c[0])) {
|
|
3050
|
+
this.set = [c];
|
|
3051
|
+
break;
|
|
3052
|
+
}
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
this.formatted = void 0;
|
|
3057
|
+
}
|
|
3058
|
+
get range() {
|
|
3059
|
+
if (this.formatted === void 0) {
|
|
3060
|
+
this.formatted = "";
|
|
3061
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
3062
|
+
if (i > 0) {
|
|
3063
|
+
this.formatted += "||";
|
|
3064
|
+
}
|
|
3065
|
+
const comps = this.set[i];
|
|
3066
|
+
for (let k = 0; k < comps.length; k++) {
|
|
3067
|
+
if (k > 0) {
|
|
3068
|
+
this.formatted += " ";
|
|
3069
|
+
}
|
|
3070
|
+
this.formatted += comps[k].toString().trim();
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
}
|
|
3074
|
+
return this.formatted;
|
|
3075
|
+
}
|
|
3076
|
+
format() {
|
|
3077
|
+
return this.range;
|
|
3078
|
+
}
|
|
3079
|
+
toString() {
|
|
3080
|
+
return this.range;
|
|
3081
|
+
}
|
|
3082
|
+
parseRange(range) {
|
|
3083
|
+
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
3084
|
+
const memoKey = memoOpts + ":" + range;
|
|
3085
|
+
const cached = cache.get(memoKey);
|
|
3086
|
+
if (cached) {
|
|
3087
|
+
return cached;
|
|
3088
|
+
}
|
|
3089
|
+
const loose = this.options.loose;
|
|
3090
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
3091
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
3092
|
+
debug("hyphen replace", range);
|
|
3093
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
3094
|
+
debug("comparator trim", range);
|
|
3095
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
3096
|
+
debug("tilde trim", range);
|
|
3097
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
3098
|
+
debug("caret trim", range);
|
|
3099
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
3100
|
+
if (loose) {
|
|
3101
|
+
rangeList = rangeList.filter((comp) => {
|
|
3102
|
+
debug("loose invalid filter", comp, this.options);
|
|
3103
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
3104
|
+
});
|
|
3105
|
+
}
|
|
3106
|
+
debug("range list", rangeList);
|
|
3107
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
3108
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
3109
|
+
for (const comp of comparators) {
|
|
3110
|
+
if (isNullSet(comp)) {
|
|
3111
|
+
return [comp];
|
|
3112
|
+
}
|
|
3113
|
+
rangeMap.set(comp.value, comp);
|
|
3114
|
+
}
|
|
3115
|
+
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
3116
|
+
rangeMap.delete("");
|
|
3117
|
+
}
|
|
3118
|
+
const result = [...rangeMap.values()];
|
|
3119
|
+
cache.set(memoKey, result);
|
|
3120
|
+
return result;
|
|
3121
|
+
}
|
|
3122
|
+
intersects(range, options) {
|
|
3123
|
+
if (!(range instanceof _Range)) {
|
|
3124
|
+
throw new TypeError("a Range is required");
|
|
3125
|
+
}
|
|
3126
|
+
return this.set.some((thisComparators) => {
|
|
3127
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
3128
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
3129
|
+
return rangeComparators.every((rangeComparator) => {
|
|
3130
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
3131
|
+
});
|
|
3132
|
+
});
|
|
3133
|
+
});
|
|
3134
|
+
});
|
|
3135
|
+
}
|
|
3136
|
+
// if ANY of the sets match ALL of its comparators, then pass
|
|
3137
|
+
test(version) {
|
|
3138
|
+
if (!version) {
|
|
3139
|
+
return false;
|
|
3140
|
+
}
|
|
3141
|
+
if (typeof version === "string") {
|
|
3142
|
+
try {
|
|
3143
|
+
version = new SemVer(version, this.options);
|
|
3144
|
+
} catch (er) {
|
|
3145
|
+
return false;
|
|
3146
|
+
}
|
|
3147
|
+
}
|
|
3148
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
3149
|
+
if (testSet(this.set[i], version, this.options)) {
|
|
3150
|
+
return true;
|
|
3151
|
+
}
|
|
3152
|
+
}
|
|
3153
|
+
return false;
|
|
3154
|
+
}
|
|
3155
|
+
};
|
|
3156
|
+
module2.exports = Range;
|
|
3157
|
+
var LRU = require_lrucache();
|
|
3158
|
+
var cache = new LRU();
|
|
3159
|
+
var parseOptions = require_parse_options();
|
|
3160
|
+
var Comparator = require_comparator();
|
|
3161
|
+
var debug = require_debug();
|
|
3162
|
+
var SemVer = require_semver();
|
|
3163
|
+
var {
|
|
3164
|
+
safeRe: re,
|
|
3165
|
+
t,
|
|
3166
|
+
comparatorTrimReplace,
|
|
3167
|
+
tildeTrimReplace,
|
|
3168
|
+
caretTrimReplace
|
|
3169
|
+
} = require_re();
|
|
3170
|
+
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
3171
|
+
var isNullSet = (c) => c.value === "<0.0.0-0";
|
|
3172
|
+
var isAny = (c) => c.value === "";
|
|
3173
|
+
var isSatisfiable = (comparators, options) => {
|
|
3174
|
+
let result = true;
|
|
3175
|
+
const remainingComparators = comparators.slice();
|
|
3176
|
+
let testComparator = remainingComparators.pop();
|
|
3177
|
+
while (result && remainingComparators.length) {
|
|
3178
|
+
result = remainingComparators.every((otherComparator) => {
|
|
3179
|
+
return testComparator.intersects(otherComparator, options);
|
|
3180
|
+
});
|
|
3181
|
+
testComparator = remainingComparators.pop();
|
|
3182
|
+
}
|
|
3183
|
+
return result;
|
|
3184
|
+
};
|
|
3185
|
+
var parseComparator = (comp, options) => {
|
|
3186
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
3187
|
+
debug("comp", comp, options);
|
|
3188
|
+
comp = replaceCarets(comp, options);
|
|
3189
|
+
debug("caret", comp);
|
|
3190
|
+
comp = replaceTildes(comp, options);
|
|
3191
|
+
debug("tildes", comp);
|
|
3192
|
+
comp = replaceXRanges(comp, options);
|
|
3193
|
+
debug("xrange", comp);
|
|
3194
|
+
comp = replaceStars(comp, options);
|
|
3195
|
+
debug("stars", comp);
|
|
3196
|
+
return comp;
|
|
3197
|
+
};
|
|
3198
|
+
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
3199
|
+
var replaceTildes = (comp, options) => {
|
|
3200
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
3201
|
+
};
|
|
3202
|
+
var replaceTilde = (comp, options) => {
|
|
3203
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
3204
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
3205
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
3206
|
+
let ret;
|
|
3207
|
+
if (isX(M)) {
|
|
3208
|
+
ret = "";
|
|
3209
|
+
} else if (isX(m)) {
|
|
3210
|
+
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
3211
|
+
} else if (isX(p)) {
|
|
3212
|
+
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
3213
|
+
} else if (pr) {
|
|
3214
|
+
debug("replaceTilde pr", pr);
|
|
3215
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
3216
|
+
} else {
|
|
3217
|
+
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
3218
|
+
}
|
|
3219
|
+
debug("tilde return", ret);
|
|
3220
|
+
return ret;
|
|
3221
|
+
});
|
|
3222
|
+
};
|
|
3223
|
+
var replaceCarets = (comp, options) => {
|
|
3224
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
3225
|
+
};
|
|
3226
|
+
var replaceCaret = (comp, options) => {
|
|
3227
|
+
debug("caret", comp, options);
|
|
3228
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
3229
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
3230
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
3231
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
3232
|
+
let ret;
|
|
3233
|
+
if (isX(M)) {
|
|
3234
|
+
ret = "";
|
|
3235
|
+
} else if (isX(m)) {
|
|
3236
|
+
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
3237
|
+
} else if (isX(p)) {
|
|
3238
|
+
if (M === "0") {
|
|
3239
|
+
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
3240
|
+
} else {
|
|
3241
|
+
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
3242
|
+
}
|
|
3243
|
+
} else if (pr) {
|
|
3244
|
+
debug("replaceCaret pr", pr);
|
|
3245
|
+
if (M === "0") {
|
|
3246
|
+
if (m === "0") {
|
|
3247
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
3248
|
+
} else {
|
|
3249
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
3250
|
+
}
|
|
3251
|
+
} else {
|
|
3252
|
+
ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
3253
|
+
}
|
|
3254
|
+
} else {
|
|
3255
|
+
debug("no pr");
|
|
3256
|
+
if (M === "0") {
|
|
3257
|
+
if (m === "0") {
|
|
3258
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
|
3259
|
+
} else {
|
|
3260
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
|
|
3261
|
+
}
|
|
3262
|
+
} else {
|
|
3263
|
+
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3266
|
+
debug("caret return", ret);
|
|
3267
|
+
return ret;
|
|
3268
|
+
});
|
|
3269
|
+
};
|
|
3270
|
+
var replaceXRanges = (comp, options) => {
|
|
3271
|
+
debug("replaceXRanges", comp, options);
|
|
3272
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
3273
|
+
};
|
|
3274
|
+
var replaceXRange = (comp, options) => {
|
|
3275
|
+
comp = comp.trim();
|
|
3276
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
3277
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
3278
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
3279
|
+
const xM = isX(M);
|
|
3280
|
+
const xm = xM || isX(m);
|
|
3281
|
+
const xp = xm || isX(p);
|
|
3282
|
+
const anyX = xp;
|
|
3283
|
+
if (gtlt === "=" && anyX) {
|
|
3284
|
+
gtlt = "";
|
|
3285
|
+
}
|
|
3286
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
3287
|
+
if (xM) {
|
|
3288
|
+
if (gtlt === ">" || gtlt === "<") {
|
|
3289
|
+
ret = "<0.0.0-0";
|
|
3290
|
+
} else {
|
|
3291
|
+
ret = "*";
|
|
3292
|
+
}
|
|
3293
|
+
} else if (gtlt && anyX) {
|
|
3294
|
+
if (xm) {
|
|
3295
|
+
m = 0;
|
|
3296
|
+
}
|
|
3297
|
+
p = 0;
|
|
3298
|
+
if (gtlt === ">") {
|
|
3299
|
+
gtlt = ">=";
|
|
3300
|
+
if (xm) {
|
|
3301
|
+
M = +M + 1;
|
|
3302
|
+
m = 0;
|
|
3303
|
+
p = 0;
|
|
3304
|
+
} else {
|
|
3305
|
+
m = +m + 1;
|
|
3306
|
+
p = 0;
|
|
3307
|
+
}
|
|
3308
|
+
} else if (gtlt === "<=") {
|
|
3309
|
+
gtlt = "<";
|
|
3310
|
+
if (xm) {
|
|
3311
|
+
M = +M + 1;
|
|
3312
|
+
} else {
|
|
3313
|
+
m = +m + 1;
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3316
|
+
if (gtlt === "<") {
|
|
3317
|
+
pr = "-0";
|
|
3318
|
+
}
|
|
3319
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
3320
|
+
} else if (xm) {
|
|
3321
|
+
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
3322
|
+
} else if (xp) {
|
|
3323
|
+
ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
3324
|
+
}
|
|
3325
|
+
debug("xRange return", ret);
|
|
3326
|
+
return ret;
|
|
3327
|
+
});
|
|
3328
|
+
};
|
|
3329
|
+
var replaceStars = (comp, options) => {
|
|
3330
|
+
debug("replaceStars", comp, options);
|
|
3331
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
3332
|
+
};
|
|
3333
|
+
var replaceGTE0 = (comp, options) => {
|
|
3334
|
+
debug("replaceGTE0", comp, options);
|
|
3335
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
3336
|
+
};
|
|
3337
|
+
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
3338
|
+
if (isX(fM)) {
|
|
3339
|
+
from = "";
|
|
3340
|
+
} else if (isX(fm)) {
|
|
3341
|
+
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
3342
|
+
} else if (isX(fp)) {
|
|
3343
|
+
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
3344
|
+
} else if (fpr) {
|
|
3345
|
+
from = `>=${from}`;
|
|
3346
|
+
} else {
|
|
3347
|
+
from = `>=${from}${incPr ? "-0" : ""}`;
|
|
3348
|
+
}
|
|
3349
|
+
if (isX(tM)) {
|
|
3350
|
+
to = "";
|
|
3351
|
+
} else if (isX(tm)) {
|
|
3352
|
+
to = `<${+tM + 1}.0.0-0`;
|
|
3353
|
+
} else if (isX(tp)) {
|
|
3354
|
+
to = `<${tM}.${+tm + 1}.0-0`;
|
|
3355
|
+
} else if (tpr) {
|
|
3356
|
+
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
3357
|
+
} else if (incPr) {
|
|
3358
|
+
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
3359
|
+
} else {
|
|
3360
|
+
to = `<=${to}`;
|
|
3361
|
+
}
|
|
3362
|
+
return `${from} ${to}`.trim();
|
|
3363
|
+
};
|
|
3364
|
+
var testSet = (set, version, options) => {
|
|
3365
|
+
for (let i = 0; i < set.length; i++) {
|
|
3366
|
+
if (!set[i].test(version)) {
|
|
3367
|
+
return false;
|
|
3368
|
+
}
|
|
3369
|
+
}
|
|
3370
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
3371
|
+
for (let i = 0; i < set.length; i++) {
|
|
3372
|
+
debug(set[i].semver);
|
|
3373
|
+
if (set[i].semver === Comparator.ANY) {
|
|
3374
|
+
continue;
|
|
3375
|
+
}
|
|
3376
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
3377
|
+
const allowed = set[i].semver;
|
|
3378
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
3379
|
+
return true;
|
|
3380
|
+
}
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
3383
|
+
return false;
|
|
3384
|
+
}
|
|
3385
|
+
return true;
|
|
3386
|
+
};
|
|
3387
|
+
}
|
|
3388
|
+
});
|
|
3389
|
+
|
|
3390
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/comparator.js
|
|
3391
|
+
var require_comparator = __commonJS({
|
|
3392
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/comparator.js"(exports, module2) {
|
|
3393
|
+
"use strict";
|
|
3394
|
+
var ANY = /* @__PURE__ */ Symbol("SemVer ANY");
|
|
3395
|
+
var Comparator = class _Comparator {
|
|
3396
|
+
static get ANY() {
|
|
3397
|
+
return ANY;
|
|
3398
|
+
}
|
|
3399
|
+
constructor(comp, options) {
|
|
3400
|
+
options = parseOptions(options);
|
|
3401
|
+
if (comp instanceof _Comparator) {
|
|
3402
|
+
if (comp.loose === !!options.loose) {
|
|
3403
|
+
return comp;
|
|
3404
|
+
} else {
|
|
3405
|
+
comp = comp.value;
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
3409
|
+
debug("comparator", comp, options);
|
|
3410
|
+
this.options = options;
|
|
3411
|
+
this.loose = !!options.loose;
|
|
3412
|
+
this.parse(comp);
|
|
3413
|
+
if (this.semver === ANY) {
|
|
3414
|
+
this.value = "";
|
|
3415
|
+
} else {
|
|
3416
|
+
this.value = this.operator + this.semver.version;
|
|
3417
|
+
}
|
|
3418
|
+
debug("comp", this);
|
|
3419
|
+
}
|
|
3420
|
+
parse(comp) {
|
|
3421
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
3422
|
+
const m = comp.match(r);
|
|
3423
|
+
if (!m) {
|
|
3424
|
+
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
3425
|
+
}
|
|
3426
|
+
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
3427
|
+
if (this.operator === "=") {
|
|
3428
|
+
this.operator = "";
|
|
3429
|
+
}
|
|
3430
|
+
if (!m[2]) {
|
|
3431
|
+
this.semver = ANY;
|
|
3432
|
+
} else {
|
|
3433
|
+
this.semver = new SemVer(m[2], this.options.loose);
|
|
3434
|
+
}
|
|
3435
|
+
}
|
|
3436
|
+
toString() {
|
|
3437
|
+
return this.value;
|
|
3438
|
+
}
|
|
3439
|
+
test(version) {
|
|
3440
|
+
debug("Comparator.test", version, this.options.loose);
|
|
3441
|
+
if (this.semver === ANY || version === ANY) {
|
|
3442
|
+
return true;
|
|
3443
|
+
}
|
|
3444
|
+
if (typeof version === "string") {
|
|
3445
|
+
try {
|
|
3446
|
+
version = new SemVer(version, this.options);
|
|
3447
|
+
} catch (er) {
|
|
3448
|
+
return false;
|
|
3449
|
+
}
|
|
3450
|
+
}
|
|
3451
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
3452
|
+
}
|
|
3453
|
+
intersects(comp, options) {
|
|
3454
|
+
if (!(comp instanceof _Comparator)) {
|
|
3455
|
+
throw new TypeError("a Comparator is required");
|
|
3456
|
+
}
|
|
3457
|
+
if (this.operator === "") {
|
|
3458
|
+
if (this.value === "") {
|
|
3459
|
+
return true;
|
|
3460
|
+
}
|
|
3461
|
+
return new Range(comp.value, options).test(this.value);
|
|
3462
|
+
} else if (comp.operator === "") {
|
|
3463
|
+
if (comp.value === "") {
|
|
3464
|
+
return true;
|
|
3465
|
+
}
|
|
3466
|
+
return new Range(this.value, options).test(comp.semver);
|
|
3467
|
+
}
|
|
3468
|
+
options = parseOptions(options);
|
|
3469
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
3470
|
+
return false;
|
|
3471
|
+
}
|
|
3472
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
3473
|
+
return false;
|
|
3474
|
+
}
|
|
3475
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
3476
|
+
return true;
|
|
3477
|
+
}
|
|
3478
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
|
|
3479
|
+
return true;
|
|
3480
|
+
}
|
|
3481
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
3482
|
+
return true;
|
|
3483
|
+
}
|
|
3484
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
3485
|
+
return true;
|
|
3486
|
+
}
|
|
3487
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
3488
|
+
return true;
|
|
3489
|
+
}
|
|
3490
|
+
return false;
|
|
3491
|
+
}
|
|
3492
|
+
};
|
|
3493
|
+
module2.exports = Comparator;
|
|
3494
|
+
var parseOptions = require_parse_options();
|
|
3495
|
+
var { safeRe: re, t } = require_re();
|
|
3496
|
+
var cmp = require_cmp();
|
|
3497
|
+
var debug = require_debug();
|
|
3498
|
+
var SemVer = require_semver();
|
|
3499
|
+
var Range = require_range();
|
|
3500
|
+
}
|
|
3501
|
+
});
|
|
3502
|
+
|
|
3503
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/satisfies.js
|
|
3504
|
+
var require_satisfies = __commonJS({
|
|
3505
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/satisfies.js"(exports, module2) {
|
|
3506
|
+
"use strict";
|
|
3507
|
+
var Range = require_range();
|
|
3508
|
+
var satisfies2 = (version, range, options) => {
|
|
3509
|
+
try {
|
|
3510
|
+
range = new Range(range, options);
|
|
3511
|
+
} catch (er) {
|
|
3512
|
+
return false;
|
|
3513
|
+
}
|
|
3514
|
+
return range.test(version);
|
|
3515
|
+
};
|
|
3516
|
+
module2.exports = satisfies2;
|
|
3517
|
+
}
|
|
3518
|
+
});
|
|
3519
|
+
|
|
3520
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/to-comparators.js
|
|
3521
|
+
var require_to_comparators = __commonJS({
|
|
3522
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/to-comparators.js"(exports, module2) {
|
|
3523
|
+
"use strict";
|
|
3524
|
+
var Range = require_range();
|
|
3525
|
+
var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
3526
|
+
module2.exports = toComparators;
|
|
3527
|
+
}
|
|
3528
|
+
});
|
|
3529
|
+
|
|
3530
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/max-satisfying.js
|
|
3531
|
+
var require_max_satisfying = __commonJS({
|
|
3532
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/max-satisfying.js"(exports, module2) {
|
|
3533
|
+
"use strict";
|
|
3534
|
+
var SemVer = require_semver();
|
|
3535
|
+
var Range = require_range();
|
|
3536
|
+
var maxSatisfying = (versions, range, options) => {
|
|
3537
|
+
let max = null;
|
|
3538
|
+
let maxSV = null;
|
|
3539
|
+
let rangeObj = null;
|
|
3540
|
+
try {
|
|
3541
|
+
rangeObj = new Range(range, options);
|
|
3542
|
+
} catch (er) {
|
|
3543
|
+
return null;
|
|
3544
|
+
}
|
|
3545
|
+
versions.forEach((v) => {
|
|
3546
|
+
if (rangeObj.test(v)) {
|
|
3547
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
3548
|
+
max = v;
|
|
3549
|
+
maxSV = new SemVer(max, options);
|
|
3550
|
+
}
|
|
3551
|
+
}
|
|
3552
|
+
});
|
|
3553
|
+
return max;
|
|
3554
|
+
};
|
|
3555
|
+
module2.exports = maxSatisfying;
|
|
3556
|
+
}
|
|
3557
|
+
});
|
|
3558
|
+
|
|
3559
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-satisfying.js
|
|
3560
|
+
var require_min_satisfying = __commonJS({
|
|
3561
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-satisfying.js"(exports, module2) {
|
|
3562
|
+
"use strict";
|
|
3563
|
+
var SemVer = require_semver();
|
|
3564
|
+
var Range = require_range();
|
|
3565
|
+
var minSatisfying = (versions, range, options) => {
|
|
3566
|
+
let min = null;
|
|
3567
|
+
let minSV = null;
|
|
3568
|
+
let rangeObj = null;
|
|
3569
|
+
try {
|
|
3570
|
+
rangeObj = new Range(range, options);
|
|
3571
|
+
} catch (er) {
|
|
3572
|
+
return null;
|
|
3573
|
+
}
|
|
3574
|
+
versions.forEach((v) => {
|
|
3575
|
+
if (rangeObj.test(v)) {
|
|
3576
|
+
if (!min || minSV.compare(v) === 1) {
|
|
3577
|
+
min = v;
|
|
3578
|
+
minSV = new SemVer(min, options);
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3581
|
+
});
|
|
3582
|
+
return min;
|
|
3583
|
+
};
|
|
3584
|
+
module2.exports = minSatisfying;
|
|
3585
|
+
}
|
|
3586
|
+
});
|
|
3587
|
+
|
|
3588
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-version.js
|
|
3589
|
+
var require_min_version = __commonJS({
|
|
3590
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-version.js"(exports, module2) {
|
|
3591
|
+
"use strict";
|
|
3592
|
+
var SemVer = require_semver();
|
|
3593
|
+
var Range = require_range();
|
|
3594
|
+
var gt = require_gt();
|
|
3595
|
+
var minVersion = (range, loose) => {
|
|
3596
|
+
range = new Range(range, loose);
|
|
3597
|
+
let minver = new SemVer("0.0.0");
|
|
3598
|
+
if (range.test(minver)) {
|
|
3599
|
+
return minver;
|
|
3600
|
+
}
|
|
3601
|
+
minver = new SemVer("0.0.0-0");
|
|
3602
|
+
if (range.test(minver)) {
|
|
3603
|
+
return minver;
|
|
3604
|
+
}
|
|
3605
|
+
minver = null;
|
|
3606
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
3607
|
+
const comparators = range.set[i];
|
|
3608
|
+
let setMin = null;
|
|
3609
|
+
comparators.forEach((comparator) => {
|
|
3610
|
+
const compver = new SemVer(comparator.semver.version);
|
|
3611
|
+
switch (comparator.operator) {
|
|
3612
|
+
case ">":
|
|
3613
|
+
if (compver.prerelease.length === 0) {
|
|
3614
|
+
compver.patch++;
|
|
3615
|
+
} else {
|
|
3616
|
+
compver.prerelease.push(0);
|
|
3617
|
+
}
|
|
3618
|
+
compver.raw = compver.format();
|
|
3619
|
+
/* fallthrough */
|
|
3620
|
+
case "":
|
|
3621
|
+
case ">=":
|
|
3622
|
+
if (!setMin || gt(compver, setMin)) {
|
|
3623
|
+
setMin = compver;
|
|
3624
|
+
}
|
|
3625
|
+
break;
|
|
3626
|
+
case "<":
|
|
3627
|
+
case "<=":
|
|
3628
|
+
break;
|
|
3629
|
+
/* istanbul ignore next */
|
|
3630
|
+
default:
|
|
3631
|
+
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
3632
|
+
}
|
|
3633
|
+
});
|
|
3634
|
+
if (setMin && (!minver || gt(minver, setMin))) {
|
|
3635
|
+
minver = setMin;
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3638
|
+
if (minver && range.test(minver)) {
|
|
3639
|
+
return minver;
|
|
3640
|
+
}
|
|
3641
|
+
return null;
|
|
3642
|
+
};
|
|
3643
|
+
module2.exports = minVersion;
|
|
3644
|
+
}
|
|
3645
|
+
});
|
|
3646
|
+
|
|
3647
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/valid.js
|
|
3648
|
+
var require_valid2 = __commonJS({
|
|
3649
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/valid.js"(exports, module2) {
|
|
3650
|
+
"use strict";
|
|
3651
|
+
var Range = require_range();
|
|
3652
|
+
var validRange = (range, options) => {
|
|
3653
|
+
try {
|
|
3654
|
+
return new Range(range, options).range || "*";
|
|
3655
|
+
} catch (er) {
|
|
3656
|
+
return null;
|
|
3657
|
+
}
|
|
3658
|
+
};
|
|
3659
|
+
module2.exports = validRange;
|
|
3660
|
+
}
|
|
3661
|
+
});
|
|
3662
|
+
|
|
3663
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/outside.js
|
|
3664
|
+
var require_outside = __commonJS({
|
|
3665
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/outside.js"(exports, module2) {
|
|
3666
|
+
"use strict";
|
|
3667
|
+
var SemVer = require_semver();
|
|
3668
|
+
var Comparator = require_comparator();
|
|
3669
|
+
var { ANY } = Comparator;
|
|
3670
|
+
var Range = require_range();
|
|
3671
|
+
var satisfies2 = require_satisfies();
|
|
3672
|
+
var gt = require_gt();
|
|
3673
|
+
var lt = require_lt();
|
|
3674
|
+
var lte = require_lte();
|
|
3675
|
+
var gte = require_gte();
|
|
3676
|
+
var outside = (version, range, hilo, options) => {
|
|
3677
|
+
version = new SemVer(version, options);
|
|
3678
|
+
range = new Range(range, options);
|
|
3679
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
3680
|
+
switch (hilo) {
|
|
3681
|
+
case ">":
|
|
3682
|
+
gtfn = gt;
|
|
3683
|
+
ltefn = lte;
|
|
3684
|
+
ltfn = lt;
|
|
3685
|
+
comp = ">";
|
|
3686
|
+
ecomp = ">=";
|
|
3687
|
+
break;
|
|
3688
|
+
case "<":
|
|
3689
|
+
gtfn = lt;
|
|
3690
|
+
ltefn = gte;
|
|
3691
|
+
ltfn = gt;
|
|
3692
|
+
comp = "<";
|
|
3693
|
+
ecomp = "<=";
|
|
3694
|
+
break;
|
|
3695
|
+
default:
|
|
3696
|
+
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
3697
|
+
}
|
|
3698
|
+
if (satisfies2(version, range, options)) {
|
|
3699
|
+
return false;
|
|
3700
|
+
}
|
|
3701
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
3702
|
+
const comparators = range.set[i];
|
|
3703
|
+
let high = null;
|
|
3704
|
+
let low = null;
|
|
3705
|
+
comparators.forEach((comparator) => {
|
|
3706
|
+
if (comparator.semver === ANY) {
|
|
3707
|
+
comparator = new Comparator(">=0.0.0");
|
|
3708
|
+
}
|
|
3709
|
+
high = high || comparator;
|
|
3710
|
+
low = low || comparator;
|
|
3711
|
+
if (gtfn(comparator.semver, high.semver, options)) {
|
|
3712
|
+
high = comparator;
|
|
3713
|
+
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
3714
|
+
low = comparator;
|
|
3715
|
+
}
|
|
3716
|
+
});
|
|
3717
|
+
if (high.operator === comp || high.operator === ecomp) {
|
|
3718
|
+
return false;
|
|
3719
|
+
}
|
|
3720
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
|
|
3721
|
+
return false;
|
|
3722
|
+
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
3723
|
+
return false;
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3726
|
+
return true;
|
|
3727
|
+
};
|
|
3728
|
+
module2.exports = outside;
|
|
3729
|
+
}
|
|
3730
|
+
});
|
|
3731
|
+
|
|
3732
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/gtr.js
|
|
3733
|
+
var require_gtr = __commonJS({
|
|
3734
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/gtr.js"(exports, module2) {
|
|
3735
|
+
"use strict";
|
|
3736
|
+
var outside = require_outside();
|
|
3737
|
+
var gtr = (version, range, options) => outside(version, range, ">", options);
|
|
3738
|
+
module2.exports = gtr;
|
|
3739
|
+
}
|
|
3740
|
+
});
|
|
3741
|
+
|
|
3742
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/ltr.js
|
|
3743
|
+
var require_ltr = __commonJS({
|
|
3744
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/ltr.js"(exports, module2) {
|
|
3745
|
+
"use strict";
|
|
3746
|
+
var outside = require_outside();
|
|
3747
|
+
var ltr = (version, range, options) => outside(version, range, "<", options);
|
|
3748
|
+
module2.exports = ltr;
|
|
3749
|
+
}
|
|
3750
|
+
});
|
|
3751
|
+
|
|
3752
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/intersects.js
|
|
3753
|
+
var require_intersects = __commonJS({
|
|
3754
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/intersects.js"(exports, module2) {
|
|
3755
|
+
"use strict";
|
|
3756
|
+
var Range = require_range();
|
|
3757
|
+
var intersects = (r1, r2, options) => {
|
|
3758
|
+
r1 = new Range(r1, options);
|
|
3759
|
+
r2 = new Range(r2, options);
|
|
3760
|
+
return r1.intersects(r2, options);
|
|
3761
|
+
};
|
|
3762
|
+
module2.exports = intersects;
|
|
3763
|
+
}
|
|
3764
|
+
});
|
|
3765
|
+
|
|
3766
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/simplify.js
|
|
3767
|
+
var require_simplify = __commonJS({
|
|
3768
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/simplify.js"(exports, module2) {
|
|
3769
|
+
"use strict";
|
|
3770
|
+
var satisfies2 = require_satisfies();
|
|
3771
|
+
var compare = require_compare();
|
|
3772
|
+
module2.exports = (versions, range, options) => {
|
|
3773
|
+
const set = [];
|
|
3774
|
+
let first = null;
|
|
3775
|
+
let prev = null;
|
|
3776
|
+
const v = versions.sort((a, b) => compare(a, b, options));
|
|
3777
|
+
for (const version of v) {
|
|
3778
|
+
const included = satisfies2(version, range, options);
|
|
3779
|
+
if (included) {
|
|
3780
|
+
prev = version;
|
|
3781
|
+
if (!first) {
|
|
3782
|
+
first = version;
|
|
3783
|
+
}
|
|
3784
|
+
} else {
|
|
3785
|
+
if (prev) {
|
|
3786
|
+
set.push([first, prev]);
|
|
3787
|
+
}
|
|
3788
|
+
prev = null;
|
|
3789
|
+
first = null;
|
|
3790
|
+
}
|
|
3791
|
+
}
|
|
3792
|
+
if (first) {
|
|
3793
|
+
set.push([first, null]);
|
|
3794
|
+
}
|
|
3795
|
+
const ranges = [];
|
|
3796
|
+
for (const [min, max] of set) {
|
|
3797
|
+
if (min === max) {
|
|
3798
|
+
ranges.push(min);
|
|
3799
|
+
} else if (!max && min === v[0]) {
|
|
3800
|
+
ranges.push("*");
|
|
3801
|
+
} else if (!max) {
|
|
3802
|
+
ranges.push(`>=${min}`);
|
|
3803
|
+
} else if (min === v[0]) {
|
|
3804
|
+
ranges.push(`<=${max}`);
|
|
3805
|
+
} else {
|
|
3806
|
+
ranges.push(`${min} - ${max}`);
|
|
3807
|
+
}
|
|
3808
|
+
}
|
|
3809
|
+
const simplified = ranges.join(" || ");
|
|
3810
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
3811
|
+
return simplified.length < original.length ? simplified : range;
|
|
3812
|
+
};
|
|
3813
|
+
}
|
|
3814
|
+
});
|
|
3815
|
+
|
|
3816
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/subset.js
|
|
3817
|
+
var require_subset = __commonJS({
|
|
3818
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/subset.js"(exports, module2) {
|
|
3819
|
+
"use strict";
|
|
3820
|
+
var Range = require_range();
|
|
3821
|
+
var Comparator = require_comparator();
|
|
3822
|
+
var { ANY } = Comparator;
|
|
3823
|
+
var satisfies2 = require_satisfies();
|
|
3824
|
+
var compare = require_compare();
|
|
3825
|
+
var subset = (sub, dom, options = {}) => {
|
|
3826
|
+
if (sub === dom) {
|
|
3827
|
+
return true;
|
|
3828
|
+
}
|
|
3829
|
+
sub = new Range(sub, options);
|
|
3830
|
+
dom = new Range(dom, options);
|
|
3831
|
+
let sawNonNull = false;
|
|
3832
|
+
OUTER: for (const simpleSub of sub.set) {
|
|
3833
|
+
for (const simpleDom of dom.set) {
|
|
3834
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
3835
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
3836
|
+
if (isSub) {
|
|
3837
|
+
continue OUTER;
|
|
3838
|
+
}
|
|
3839
|
+
}
|
|
3840
|
+
if (sawNonNull) {
|
|
3841
|
+
return false;
|
|
3842
|
+
}
|
|
3843
|
+
}
|
|
3844
|
+
return true;
|
|
3845
|
+
};
|
|
3846
|
+
var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
3847
|
+
var minimumVersion = [new Comparator(">=0.0.0")];
|
|
3848
|
+
var simpleSubset = (sub, dom, options) => {
|
|
3849
|
+
if (sub === dom) {
|
|
3850
|
+
return true;
|
|
3851
|
+
}
|
|
3852
|
+
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
3853
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
3854
|
+
return true;
|
|
3855
|
+
} else if (options.includePrerelease) {
|
|
3856
|
+
sub = minimumVersionWithPreRelease;
|
|
3857
|
+
} else {
|
|
3858
|
+
sub = minimumVersion;
|
|
3859
|
+
}
|
|
3860
|
+
}
|
|
3861
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
3862
|
+
if (options.includePrerelease) {
|
|
3863
|
+
return true;
|
|
3864
|
+
} else {
|
|
3865
|
+
dom = minimumVersion;
|
|
3866
|
+
}
|
|
3867
|
+
}
|
|
3868
|
+
const eqSet = /* @__PURE__ */ new Set();
|
|
3869
|
+
let gt, lt;
|
|
3870
|
+
for (const c of sub) {
|
|
3871
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
3872
|
+
gt = higherGT(gt, c, options);
|
|
3873
|
+
} else if (c.operator === "<" || c.operator === "<=") {
|
|
3874
|
+
lt = lowerLT(lt, c, options);
|
|
3875
|
+
} else {
|
|
3876
|
+
eqSet.add(c.semver);
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
if (eqSet.size > 1) {
|
|
3880
|
+
return null;
|
|
3881
|
+
}
|
|
3882
|
+
let gtltComp;
|
|
3883
|
+
if (gt && lt) {
|
|
3884
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
3885
|
+
if (gtltComp > 0) {
|
|
3886
|
+
return null;
|
|
3887
|
+
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
3888
|
+
return null;
|
|
3889
|
+
}
|
|
3890
|
+
}
|
|
3891
|
+
for (const eq of eqSet) {
|
|
3892
|
+
if (gt && !satisfies2(eq, String(gt), options)) {
|
|
3893
|
+
return null;
|
|
3894
|
+
}
|
|
3895
|
+
if (lt && !satisfies2(eq, String(lt), options)) {
|
|
3896
|
+
return null;
|
|
3897
|
+
}
|
|
3898
|
+
for (const c of dom) {
|
|
3899
|
+
if (!satisfies2(eq, String(c), options)) {
|
|
3900
|
+
return false;
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3903
|
+
return true;
|
|
3904
|
+
}
|
|
3905
|
+
let higher, lower;
|
|
3906
|
+
let hasDomLT, hasDomGT;
|
|
3907
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
3908
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
3909
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
3910
|
+
needDomLTPre = false;
|
|
3911
|
+
}
|
|
3912
|
+
for (const c of dom) {
|
|
3913
|
+
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
3914
|
+
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
3915
|
+
if (gt) {
|
|
3916
|
+
if (needDomGTPre) {
|
|
3917
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
|
|
3918
|
+
needDomGTPre = false;
|
|
3919
|
+
}
|
|
3920
|
+
}
|
|
3921
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
3922
|
+
higher = higherGT(gt, c, options);
|
|
3923
|
+
if (higher === c && higher !== gt) {
|
|
3924
|
+
return false;
|
|
3925
|
+
}
|
|
3926
|
+
} else if (gt.operator === ">=" && !satisfies2(gt.semver, String(c), options)) {
|
|
3927
|
+
return false;
|
|
3928
|
+
}
|
|
3929
|
+
}
|
|
3930
|
+
if (lt) {
|
|
3931
|
+
if (needDomLTPre) {
|
|
3932
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
|
|
3933
|
+
needDomLTPre = false;
|
|
3934
|
+
}
|
|
3935
|
+
}
|
|
3936
|
+
if (c.operator === "<" || c.operator === "<=") {
|
|
3937
|
+
lower = lowerLT(lt, c, options);
|
|
3938
|
+
if (lower === c && lower !== lt) {
|
|
3939
|
+
return false;
|
|
3940
|
+
}
|
|
3941
|
+
} else if (lt.operator === "<=" && !satisfies2(lt.semver, String(c), options)) {
|
|
3942
|
+
return false;
|
|
3943
|
+
}
|
|
3944
|
+
}
|
|
3945
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
|
3946
|
+
return false;
|
|
3947
|
+
}
|
|
3948
|
+
}
|
|
3949
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
3950
|
+
return false;
|
|
3951
|
+
}
|
|
3952
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
3953
|
+
return false;
|
|
3954
|
+
}
|
|
3955
|
+
if (needDomGTPre || needDomLTPre) {
|
|
3956
|
+
return false;
|
|
3957
|
+
}
|
|
3958
|
+
return true;
|
|
3959
|
+
};
|
|
3960
|
+
var higherGT = (a, b, options) => {
|
|
3961
|
+
if (!a) {
|
|
3962
|
+
return b;
|
|
3963
|
+
}
|
|
3964
|
+
const comp = compare(a.semver, b.semver, options);
|
|
3965
|
+
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
3966
|
+
};
|
|
3967
|
+
var lowerLT = (a, b, options) => {
|
|
3968
|
+
if (!a) {
|
|
3969
|
+
return b;
|
|
3970
|
+
}
|
|
3971
|
+
const comp = compare(a.semver, b.semver, options);
|
|
3972
|
+
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
3973
|
+
};
|
|
3974
|
+
module2.exports = subset;
|
|
3975
|
+
}
|
|
3976
|
+
});
|
|
3977
|
+
|
|
3978
|
+
// node_modules/.pnpm/semver@7.7.3/node_modules/semver/index.js
|
|
3979
|
+
var require_semver2 = __commonJS({
|
|
3980
|
+
"node_modules/.pnpm/semver@7.7.3/node_modules/semver/index.js"(exports, module2) {
|
|
3981
|
+
"use strict";
|
|
3982
|
+
var internalRe = require_re();
|
|
3983
|
+
var constants = require_constants();
|
|
3984
|
+
var SemVer = require_semver();
|
|
3985
|
+
var identifiers = require_identifiers();
|
|
3986
|
+
var parse = require_parse();
|
|
3987
|
+
var valid = require_valid();
|
|
3988
|
+
var clean = require_clean();
|
|
3989
|
+
var inc = require_inc();
|
|
3990
|
+
var diff = require_diff();
|
|
3991
|
+
var major = require_major();
|
|
3992
|
+
var minor = require_minor();
|
|
3993
|
+
var patch = require_patch();
|
|
3994
|
+
var prerelease = require_prerelease();
|
|
3995
|
+
var compare = require_compare();
|
|
3996
|
+
var rcompare = require_rcompare();
|
|
3997
|
+
var compareLoose = require_compare_loose();
|
|
3998
|
+
var compareBuild = require_compare_build();
|
|
3999
|
+
var sort = require_sort();
|
|
4000
|
+
var rsort = require_rsort();
|
|
4001
|
+
var gt = require_gt();
|
|
4002
|
+
var lt = require_lt();
|
|
4003
|
+
var eq = require_eq();
|
|
4004
|
+
var neq = require_neq();
|
|
4005
|
+
var gte = require_gte();
|
|
4006
|
+
var lte = require_lte();
|
|
4007
|
+
var cmp = require_cmp();
|
|
4008
|
+
var coerce = require_coerce();
|
|
4009
|
+
var Comparator = require_comparator();
|
|
4010
|
+
var Range = require_range();
|
|
4011
|
+
var satisfies2 = require_satisfies();
|
|
4012
|
+
var toComparators = require_to_comparators();
|
|
4013
|
+
var maxSatisfying = require_max_satisfying();
|
|
4014
|
+
var minSatisfying = require_min_satisfying();
|
|
4015
|
+
var minVersion = require_min_version();
|
|
4016
|
+
var validRange = require_valid2();
|
|
4017
|
+
var outside = require_outside();
|
|
4018
|
+
var gtr = require_gtr();
|
|
4019
|
+
var ltr = require_ltr();
|
|
4020
|
+
var intersects = require_intersects();
|
|
4021
|
+
var simplifyRange = require_simplify();
|
|
4022
|
+
var subset = require_subset();
|
|
4023
|
+
module2.exports = {
|
|
4024
|
+
parse,
|
|
4025
|
+
valid,
|
|
4026
|
+
clean,
|
|
4027
|
+
inc,
|
|
4028
|
+
diff,
|
|
4029
|
+
major,
|
|
4030
|
+
minor,
|
|
4031
|
+
patch,
|
|
4032
|
+
prerelease,
|
|
4033
|
+
compare,
|
|
4034
|
+
rcompare,
|
|
4035
|
+
compareLoose,
|
|
4036
|
+
compareBuild,
|
|
4037
|
+
sort,
|
|
4038
|
+
rsort,
|
|
4039
|
+
gt,
|
|
4040
|
+
lt,
|
|
4041
|
+
eq,
|
|
4042
|
+
neq,
|
|
4043
|
+
gte,
|
|
4044
|
+
lte,
|
|
4045
|
+
cmp,
|
|
4046
|
+
coerce,
|
|
4047
|
+
Comparator,
|
|
4048
|
+
Range,
|
|
4049
|
+
satisfies: satisfies2,
|
|
4050
|
+
toComparators,
|
|
4051
|
+
maxSatisfying,
|
|
4052
|
+
minSatisfying,
|
|
4053
|
+
minVersion,
|
|
4054
|
+
validRange,
|
|
4055
|
+
outside,
|
|
4056
|
+
gtr,
|
|
4057
|
+
ltr,
|
|
4058
|
+
intersects,
|
|
4059
|
+
simplifyRange,
|
|
4060
|
+
subset,
|
|
4061
|
+
SemVer,
|
|
4062
|
+
re: internalRe.re,
|
|
4063
|
+
src: internalRe.src,
|
|
4064
|
+
tokens: internalRe.t,
|
|
4065
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
4066
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
4067
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
4068
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
4069
|
+
};
|
|
4070
|
+
}
|
|
4071
|
+
});
|
|
4072
|
+
|
|
2143
4073
|
// src/client/index.ts
|
|
2144
4074
|
var index_exports = {};
|
|
2145
4075
|
__export(index_exports, {
|
|
@@ -2162,8 +4092,7 @@ function assertRemoteHostCapability(ctx) {
|
|
|
2162
4092
|
}
|
|
2163
4093
|
|
|
2164
4094
|
// src/client/settings/section.tsx
|
|
2165
|
-
var
|
|
2166
|
-
var import_qrcode = __toESM(require_browser(), 1);
|
|
4095
|
+
var import_react3 = require("react");
|
|
2167
4096
|
|
|
2168
4097
|
// src/client/settings/navigation.ts
|
|
2169
4098
|
var LoginNavigation = class {
|
|
@@ -2272,105 +4201,121 @@ function settingsError(error) {
|
|
|
2272
4201
|
function isUnauthorized(error) {
|
|
2273
4202
|
return error instanceof SettingsFailure && error.status === 401 && error.code === "unauthorized";
|
|
2274
4203
|
}
|
|
4204
|
+
async function accountOverview() {
|
|
4205
|
+
const value = await authRequest("/auth-remote/me");
|
|
4206
|
+
if (!value || typeof value.username !== "string" || typeof value.totpEnabled !== "boolean" || typeof value.requireTotp !== "boolean" || !Number.isSafeInteger(value.createdAt) || !Number.isSafeInteger(value.expiresAt) || !Number.isSafeInteger(value.activeSessions) || value.createdAt < 0 || value.expiresAt <= value.createdAt || value.activeSessions < 1)
|
|
4207
|
+
throw new SettingsFailure(503, "service_unavailable");
|
|
4208
|
+
return value;
|
|
4209
|
+
}
|
|
2275
4210
|
|
|
2276
|
-
// src/client/settings/
|
|
4211
|
+
// src/client/settings/dialog.tsx
|
|
4212
|
+
var import_react = require("react");
|
|
2277
4213
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
required: props.required ?? true,
|
|
2304
|
-
autoComplete: props.autoComplete
|
|
2305
|
-
}
|
|
2306
|
-
)
|
|
2307
|
-
] });
|
|
2308
|
-
}
|
|
2309
|
-
function SecretQr({ uri, t }) {
|
|
2310
|
-
const [dataUrl, setDataUrl] = (0, import_react.useState)("");
|
|
2311
|
-
const [failed, setFailed] = (0, import_react.useState)(false);
|
|
2312
|
-
(0, import_react.useEffect)(() => {
|
|
2313
|
-
let live = true;
|
|
2314
|
-
setFailed(false);
|
|
2315
|
-
setDataUrl("");
|
|
2316
|
-
void import_qrcode.default.toDataURL(uri, { width: 220, margin: 2, errorCorrectionLevel: "M" }).then(
|
|
2317
|
-
(value) => {
|
|
2318
|
-
if (live) setDataUrl(value);
|
|
2319
|
-
},
|
|
2320
|
-
() => {
|
|
2321
|
-
if (live) setFailed(true);
|
|
4214
|
+
function SecurityDialog({
|
|
4215
|
+
title,
|
|
4216
|
+
t,
|
|
4217
|
+
close,
|
|
4218
|
+
busy = false,
|
|
4219
|
+
locked = false,
|
|
4220
|
+
children
|
|
4221
|
+
}) {
|
|
4222
|
+
const ref = (0, import_react.useRef)(null);
|
|
4223
|
+
const current = (0, import_react.useRef)({ busy, locked, close });
|
|
4224
|
+
current.current = { busy, locked, close };
|
|
4225
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
4226
|
+
const node = ref.current;
|
|
4227
|
+
const previous = document.activeElement;
|
|
4228
|
+
const keyboard = (event) => {
|
|
4229
|
+
if (!node.open || event.ctrlKey || event.altKey || event.metaKey) return;
|
|
4230
|
+
const focusedDialog = document.activeElement?.closest("dialog[open]");
|
|
4231
|
+
if (focusedDialog && focusedDialog !== node) return;
|
|
4232
|
+
if (event.key !== "Tab" && event.key !== "Escape") return;
|
|
4233
|
+
event.preventDefault();
|
|
4234
|
+
event.stopImmediatePropagation();
|
|
4235
|
+
if (event.key === "Escape") {
|
|
4236
|
+
if (!event.isComposing && !event.repeat && !current.current.busy && !current.current.locked)
|
|
4237
|
+
current.current.close();
|
|
4238
|
+
return;
|
|
2322
4239
|
}
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
4240
|
+
const items = [
|
|
4241
|
+
...node.querySelectorAll(
|
|
4242
|
+
'button:not(:disabled), input:not(:disabled), textarea:not(:disabled), select:not(:disabled), a[href], [tabindex="0"]'
|
|
4243
|
+
)
|
|
4244
|
+
].filter((item) => item.getClientRects().length > 0 && !item.closest("[hidden], [inert]"));
|
|
4245
|
+
const index = items.indexOf(document.activeElement);
|
|
4246
|
+
const next = event.shiftKey ? index <= 0 ? items.length - 1 : index - 1 : (index + 1) % items.length;
|
|
4247
|
+
(items[next] ?? node).focus();
|
|
2326
4248
|
};
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
function SecuritySection({
|
|
2331
|
-
t
|
|
2332
|
-
}) {
|
|
2333
|
-
const sectionRef = (0, import_react.useRef)(null);
|
|
2334
|
-
const [me, setMe] = (0, import_react.useState)(null);
|
|
2335
|
-
const [panel, setPanel] = (0, import_react.useState)(draft.panel);
|
|
2336
|
-
const [binding, setBinding] = (0, import_react.useState)(draft.binding);
|
|
2337
|
-
const [backupCodes, setBackupCodes] = (0, import_react.useState)(draft.backupCodes);
|
|
2338
|
-
const [busy, setBusy] = (0, import_react.useState)(false);
|
|
2339
|
-
const [message, setMessage] = (0, import_react.useState)(draft.message);
|
|
2340
|
-
(0, import_react.useEffect)(() => {
|
|
2341
|
-
draft.panel = panel;
|
|
2342
|
-
draft.binding = binding;
|
|
2343
|
-
draft.backupCodes = backupCodes;
|
|
2344
|
-
draft.message = message;
|
|
2345
|
-
}, [panel, binding, backupCodes, message]);
|
|
2346
|
-
(0, import_react.useEffect)(() => {
|
|
2347
|
-
const dialog = sectionRef.current?.closest('[role="dialog"]');
|
|
4249
|
+
document.addEventListener("keydown", keyboard, true);
|
|
4250
|
+
node.showModal();
|
|
4251
|
+
node.querySelector("input, [data-autofocus]")?.focus();
|
|
2348
4252
|
return () => {
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
4253
|
+
document.removeEventListener("keydown", keyboard, true);
|
|
4254
|
+
node.close();
|
|
4255
|
+
if (previous instanceof HTMLElement && previous.isConnected) previous.focus();
|
|
2352
4256
|
};
|
|
2353
4257
|
}, []);
|
|
2354
|
-
(0, import_react.
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
(
|
|
2358
|
-
|
|
4258
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
4259
|
+
const node = ref.current;
|
|
4260
|
+
if (node?.open && !node.contains(document.activeElement))
|
|
4261
|
+
(node.querySelector(
|
|
4262
|
+
"input:not(:disabled), [data-autofocus], button:not(:disabled)"
|
|
4263
|
+
) ?? node).focus();
|
|
4264
|
+
}, [title, locked]);
|
|
4265
|
+
const dismiss = () => {
|
|
4266
|
+
if (!busy && !locked) close();
|
|
4267
|
+
};
|
|
4268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
4269
|
+
"dialog",
|
|
4270
|
+
{
|
|
4271
|
+
ref,
|
|
4272
|
+
role: "dialog",
|
|
4273
|
+
"aria-modal": "true",
|
|
4274
|
+
"aria-labelledby": "auth-remote-operation-title",
|
|
4275
|
+
className: "auth-remote-security auth-remote-operation-dialog",
|
|
4276
|
+
tabIndex: -1,
|
|
4277
|
+
onCancel: (event) => {
|
|
4278
|
+
event.preventDefault();
|
|
4279
|
+
event.stopPropagation();
|
|
4280
|
+
dismiss();
|
|
2359
4281
|
},
|
|
2360
|
-
(
|
|
2361
|
-
if (
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
4282
|
+
onClick: (event) => {
|
|
4283
|
+
if (event.target === event.currentTarget) {
|
|
4284
|
+
const box = event.currentTarget.getBoundingClientRect();
|
|
4285
|
+
if (event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom)
|
|
4286
|
+
dismiss();
|
|
4287
|
+
}
|
|
4288
|
+
},
|
|
4289
|
+
children: [
|
|
4290
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "auth-remote-dialog-header", children: [
|
|
4291
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { id: "auth-remote-operation-title", children: title }),
|
|
4292
|
+
!locked && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
4293
|
+
"button",
|
|
4294
|
+
{
|
|
4295
|
+
className: "auth-remote-button auth-remote-dialog-close",
|
|
4296
|
+
type: "button",
|
|
4297
|
+
disabled: busy,
|
|
4298
|
+
onClick: dismiss,
|
|
4299
|
+
"aria-label": t("settingsClose"),
|
|
4300
|
+
children: "\xD7"
|
|
4301
|
+
}
|
|
4302
|
+
)
|
|
4303
|
+
] }),
|
|
4304
|
+
children
|
|
4305
|
+
]
|
|
4306
|
+
}
|
|
4307
|
+
);
|
|
4308
|
+
}
|
|
4309
|
+
function useSecurityOperation() {
|
|
4310
|
+
const [busy, setBusy] = (0, import_react.useState)(false);
|
|
4311
|
+
const running = (0, import_react.useRef)(false);
|
|
4312
|
+
const [message, setMessage] = (0, import_react.useState)(null);
|
|
4313
|
+
async function run(operation, done) {
|
|
4314
|
+
if (running.current) return;
|
|
4315
|
+
running.current = true;
|
|
2372
4316
|
setBusy(true);
|
|
2373
4317
|
setMessage(null);
|
|
4318
|
+
const release = holdLoginRedirect(3e4);
|
|
2374
4319
|
try {
|
|
2375
4320
|
done(await operation());
|
|
2376
4321
|
} catch (error) {
|
|
@@ -2378,359 +4323,489 @@ function SecuritySection({
|
|
|
2378
4323
|
else setMessage(settingsError(error));
|
|
2379
4324
|
} finally {
|
|
2380
4325
|
release();
|
|
4326
|
+
running.current = false;
|
|
2381
4327
|
setBusy(false);
|
|
2382
4328
|
}
|
|
2383
4329
|
}
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
4330
|
+
return { busy, message, setMessage, run };
|
|
4331
|
+
}
|
|
4332
|
+
function OperationError({
|
|
4333
|
+
message,
|
|
4334
|
+
t
|
|
4335
|
+
}) {
|
|
4336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "auth-remote-error", role: "alert", children: message && t(message.key, message.params) });
|
|
4337
|
+
}
|
|
4338
|
+
function CredentialFields({
|
|
4339
|
+
t,
|
|
4340
|
+
totpEnabled,
|
|
4341
|
+
passwordName = "password",
|
|
4342
|
+
codeName = "currentCode"
|
|
4343
|
+
}) {
|
|
4344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
4345
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "auth-remote-field", children: [
|
|
4346
|
+
t("settingsCurrentPassword"),
|
|
4347
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "password", name: passwordName, autoComplete: "current-password", required: true })
|
|
4348
|
+
] }),
|
|
4349
|
+
totpEnabled && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "auth-remote-field", children: [
|
|
4350
|
+
t("settingsCurrentCode"),
|
|
4351
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { name: codeName, autoComplete: "one-time-code", required: true })
|
|
4352
|
+
] })
|
|
4353
|
+
] });
|
|
4354
|
+
}
|
|
4355
|
+
function CancelButton({
|
|
4356
|
+
t,
|
|
4357
|
+
close,
|
|
4358
|
+
busy
|
|
4359
|
+
}) {
|
|
4360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "auth-remote-button", type: "button", onClick: close, disabled: busy, children: t("settingsCancel") });
|
|
4361
|
+
}
|
|
4362
|
+
|
|
4363
|
+
// src/client/settings/password-dialog.tsx
|
|
4364
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
4365
|
+
function PasswordDialog({
|
|
4366
|
+
me,
|
|
4367
|
+
t,
|
|
4368
|
+
close
|
|
4369
|
+
}) {
|
|
4370
|
+
const { busy, message, setMessage, run } = useSecurityOperation();
|
|
4371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(SecurityDialog, { title: t("settingsChangePassword"), t, close, busy, children: [
|
|
4372
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: t("settingsPasswordDescription") }),
|
|
4373
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
4374
|
+
"form",
|
|
2391
4375
|
{
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
4376
|
+
onSubmit: (event) => {
|
|
4377
|
+
event.preventDefault();
|
|
4378
|
+
const data = new FormData(event.currentTarget);
|
|
4379
|
+
const next = String(data.get("newPassword") ?? "");
|
|
4380
|
+
if (next !== data.get("confirmPassword")) {
|
|
4381
|
+
setMessage({ key: "settingsPasswordMismatch" });
|
|
4382
|
+
return;
|
|
4383
|
+
}
|
|
4384
|
+
void run(
|
|
4385
|
+
() => authRequest("/auth-remote/password", {
|
|
4386
|
+
currentPassword: data.get("currentPassword"),
|
|
4387
|
+
...me.totpEnabled ? { currentCode: data.get("currentCode") } : {},
|
|
4388
|
+
newPassword: next
|
|
4389
|
+
}),
|
|
4390
|
+
() => goToLogin("updated")
|
|
4391
|
+
);
|
|
4392
|
+
},
|
|
2395
4393
|
children: [
|
|
2396
|
-
/* @__PURE__ */ (0,
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
4394
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("fieldset", { disabled: busy, children: [
|
|
4395
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CredentialFields, { t, totpEnabled: me.totpEnabled, passwordName: "currentPassword" }),
|
|
4396
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "auth-remote-field", children: [
|
|
4397
|
+
t("settingsNewPassword"),
|
|
4398
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { name: "newPassword", type: "password", autoComplete: "new-password", required: true })
|
|
4399
|
+
] }),
|
|
4400
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "auth-remote-field", children: [
|
|
4401
|
+
t("settingsConfirmPassword"),
|
|
4402
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { name: "confirmPassword", type: "password", autoComplete: "new-password", required: true })
|
|
4403
|
+
] })
|
|
4404
|
+
] }),
|
|
4405
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OperationError, { message, t }),
|
|
4406
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "auth-remote-dialog-actions", children: [
|
|
4407
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CancelButton, { t, close, busy }),
|
|
4408
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "auth-remote-button auth-remote-primary", disabled: busy, type: "submit", children: t("settingsSavePassword") })
|
|
4409
|
+
] })
|
|
4410
|
+
]
|
|
4411
|
+
}
|
|
4412
|
+
)
|
|
4413
|
+
] });
|
|
4414
|
+
}
|
|
4415
|
+
|
|
4416
|
+
// src/client/settings/credential-dialog.tsx
|
|
4417
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
4418
|
+
function CredentialDialog({
|
|
4419
|
+
action,
|
|
4420
|
+
me,
|
|
4421
|
+
t,
|
|
4422
|
+
close
|
|
4423
|
+
}) {
|
|
4424
|
+
const { busy, message, run } = useSecurityOperation();
|
|
4425
|
+
const label = t(action === "revoke" ? "settingsSignOutAll" : "settingsDisableTotp");
|
|
4426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(SecurityDialog, { title: label, t, close, busy, children: [
|
|
4427
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: t(action === "revoke" ? "settingsSignOutAllDescription" : "settingsDisableDescription") }),
|
|
4428
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4429
|
+
"form",
|
|
4430
|
+
{
|
|
4431
|
+
onSubmit: (event) => {
|
|
4432
|
+
event.preventDefault();
|
|
4433
|
+
const data = new FormData(event.currentTarget);
|
|
4434
|
+
void run(
|
|
4435
|
+
() => authRequest(
|
|
4436
|
+
action === "revoke" ? "/auth-remote/revoke-sessions" : "/auth-remote/totp/disable",
|
|
4437
|
+
{
|
|
4438
|
+
password: data.get("password"),
|
|
4439
|
+
...me.totpEnabled ? { currentCode: data.get("currentCode") } : {}
|
|
4440
|
+
}
|
|
4441
|
+
),
|
|
4442
|
+
() => goToLogin("updated")
|
|
4443
|
+
);
|
|
4444
|
+
},
|
|
4445
|
+
children: [
|
|
4446
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("fieldset", { disabled: busy, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CredentialFields, { t, totpEnabled: me.totpEnabled }) }),
|
|
4447
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(OperationError, { message, t }),
|
|
4448
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "auth-remote-dialog-actions", children: [
|
|
4449
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CancelButton, { t, close, busy }),
|
|
4450
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "auth-remote-button auth-remote-primary", disabled: busy, type: "submit", children: label })
|
|
4451
|
+
] })
|
|
2410
4452
|
]
|
|
2411
4453
|
}
|
|
4454
|
+
)
|
|
4455
|
+
] });
|
|
4456
|
+
}
|
|
4457
|
+
function CurrentSessionDialog({
|
|
4458
|
+
t,
|
|
4459
|
+
close
|
|
4460
|
+
}) {
|
|
4461
|
+
const { busy, message, run } = useSecurityOperation();
|
|
4462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(SecurityDialog, { title: t("settingsSignOutCurrent"), t, close, busy, children: [
|
|
4463
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: t("settingsSignOutCurrentDescription") }),
|
|
4464
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(OperationError, { message, t }),
|
|
4465
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "auth-remote-dialog-actions", children: [
|
|
4466
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CancelButton, { t, close, busy }),
|
|
4467
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4468
|
+
"button",
|
|
4469
|
+
{
|
|
4470
|
+
className: "auth-remote-button auth-remote-primary",
|
|
4471
|
+
"data-autofocus": true,
|
|
4472
|
+
disabled: busy,
|
|
4473
|
+
onClick: () => {
|
|
4474
|
+
void run(
|
|
4475
|
+
() => authRequest("/auth-remote/logout", {}),
|
|
4476
|
+
() => goToLogin("signed-out")
|
|
4477
|
+
);
|
|
4478
|
+
},
|
|
4479
|
+
children: t("settingsSignOutCurrent")
|
|
4480
|
+
}
|
|
4481
|
+
)
|
|
4482
|
+
] })
|
|
4483
|
+
] });
|
|
4484
|
+
}
|
|
4485
|
+
|
|
4486
|
+
// src/client/settings/totp-dialog.tsx
|
|
4487
|
+
var import_react2 = require("react");
|
|
4488
|
+
var import_qrcode = __toESM(require_browser(), 1);
|
|
4489
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
4490
|
+
function SecretQr({ uri, t }) {
|
|
4491
|
+
const [data, setData] = (0, import_react2.useState)("");
|
|
4492
|
+
const [failed, setFailed] = (0, import_react2.useState)(false);
|
|
4493
|
+
(0, import_react2.useEffect)(() => {
|
|
4494
|
+
let live = true;
|
|
4495
|
+
setData("");
|
|
4496
|
+
setFailed(false);
|
|
4497
|
+
void import_qrcode.default.toDataURL(uri, { width: 220, margin: 2, errorCorrectionLevel: "M" }).then(
|
|
4498
|
+
(value) => {
|
|
4499
|
+
if (live) setData(value);
|
|
4500
|
+
},
|
|
4501
|
+
() => {
|
|
4502
|
+
if (live) setFailed(true);
|
|
4503
|
+
}
|
|
2412
4504
|
);
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
4505
|
+
return () => {
|
|
4506
|
+
live = false;
|
|
4507
|
+
};
|
|
4508
|
+
}, [uri]);
|
|
4509
|
+
return data ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("img", { src: data, alt: t("settingsQrAlt"), width: 220, height: 220 }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: t(failed ? "settingsQrUnavailable" : "settingsQrLoading") });
|
|
4510
|
+
}
|
|
4511
|
+
function TotpDialog({
|
|
4512
|
+
me,
|
|
4513
|
+
t,
|
|
4514
|
+
close
|
|
4515
|
+
}) {
|
|
4516
|
+
const [binding, setBinding] = (0, import_react2.useState)(null);
|
|
4517
|
+
const [codes, setCodes] = (0, import_react2.useState)(null);
|
|
4518
|
+
const [copied, setCopied] = (0, import_react2.useState)(null);
|
|
4519
|
+
const releaseCodes = (0, import_react2.useRef)();
|
|
4520
|
+
const { busy, message, setMessage, run } = useSecurityOperation();
|
|
4521
|
+
(0, import_react2.useEffect)(() => () => releaseCodes.current?.(), []);
|
|
4522
|
+
const issuer = "DSH Auth Remote";
|
|
4523
|
+
const uri = binding ? `otpauth://totp/${encodeURIComponent(`${issuer}:${me.username}`)}?secret=${binding.secret}&issuer=${encodeURIComponent(issuer)}&algorithm=SHA1&digits=6&period=30` : "";
|
|
4524
|
+
const title = t(
|
|
4525
|
+
codes ? "settingsBackupTitle" : binding ? "settingsScanQr" : me.totpEnabled ? "settingsRebindTotp" : "settingsBindTotp"
|
|
4526
|
+
);
|
|
4527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SecurityDialog, { title, t, close, busy, locked: codes !== null, children: codes ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
4528
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: t("settingsBackupDescription") }),
|
|
4529
|
+
me.totpEnabled && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: t("settingsOldBackupInvalid") }),
|
|
4530
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ol", { className: "auth-remote-backup-codes", children: codes.map((code) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { children: code }, code)) }),
|
|
4531
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "status", children: copied && t(copied === "success" ? "settingsBackupCopied" : "settingsBackupCopyFailed") }),
|
|
4532
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "auth-remote-dialog-actions", children: [
|
|
4533
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4534
|
+
"button",
|
|
4535
|
+
{
|
|
4536
|
+
className: "auth-remote-button",
|
|
4537
|
+
onClick: () => {
|
|
4538
|
+
void (async () => {
|
|
4539
|
+
try {
|
|
4540
|
+
await navigator.clipboard.writeText(codes.join("\n"));
|
|
4541
|
+
setCopied("success");
|
|
4542
|
+
} catch {
|
|
4543
|
+
setCopied("failed");
|
|
4544
|
+
}
|
|
4545
|
+
})();
|
|
4546
|
+
},
|
|
4547
|
+
children: t("settingsCopyAll")
|
|
4548
|
+
}
|
|
4549
|
+
),
|
|
4550
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4551
|
+
"button",
|
|
4552
|
+
{
|
|
4553
|
+
className: "auth-remote-button auth-remote-primary",
|
|
4554
|
+
onClick: () => {
|
|
4555
|
+
goToLogin("updated");
|
|
4556
|
+
setCodes(null);
|
|
4557
|
+
setBinding(null);
|
|
4558
|
+
setCopied(null);
|
|
4559
|
+
releaseCodes.current?.();
|
|
4560
|
+
releaseCodes.current = void 0;
|
|
4561
|
+
},
|
|
4562
|
+
children: t("settingsBackupSaved")
|
|
4563
|
+
}
|
|
4564
|
+
)
|
|
4565
|
+
] })
|
|
4566
|
+
] }) : binding ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
4567
|
+
"form",
|
|
2416
4568
|
{
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
4569
|
+
onSubmit: (event) => {
|
|
4570
|
+
event.preventDefault();
|
|
4571
|
+
const data = new FormData(event.currentTarget);
|
|
4572
|
+
void run(
|
|
4573
|
+
() => authRequest("/auth-remote/totp/confirm", {
|
|
4574
|
+
challenge: binding.challenge,
|
|
4575
|
+
code: data.get("code")
|
|
4576
|
+
}),
|
|
4577
|
+
(result) => {
|
|
4578
|
+
releaseCodes.current ??= holdLoginRedirect();
|
|
4579
|
+
setCodes(result.backupCodes);
|
|
4580
|
+
setBinding(null);
|
|
4581
|
+
setCopied(null);
|
|
4582
|
+
}
|
|
4583
|
+
);
|
|
4584
|
+
},
|
|
2420
4585
|
children: [
|
|
2421
|
-
/* @__PURE__ */ (0,
|
|
2422
|
-
/* @__PURE__ */ (0,
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
setMessage(null);
|
|
2436
|
-
},
|
|
2437
|
-
children: t("settingsChangePassword")
|
|
2438
|
-
}
|
|
2439
|
-
),
|
|
2440
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
4586
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SecretQr, { uri, t }),
|
|
4587
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { children: [
|
|
4588
|
+
t("settingsManualSecret"),
|
|
4589
|
+
" ",
|
|
4590
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: binding.secret })
|
|
4591
|
+
] }),
|
|
4592
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("fieldset", { disabled: busy, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "auth-remote-field", children: [
|
|
4593
|
+
t("settingsNewCode"),
|
|
4594
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { name: "code", autoComplete: "one-time-code", required: true })
|
|
4595
|
+
] }) }),
|
|
4596
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(OperationError, { message, t }),
|
|
4597
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "auth-remote-dialog-actions", children: [
|
|
4598
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CancelButton, { t, close, busy }),
|
|
4599
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2441
4600
|
"button",
|
|
2442
4601
|
{
|
|
4602
|
+
type: "button",
|
|
2443
4603
|
className: "auth-remote-button",
|
|
2444
|
-
disabled:
|
|
2445
|
-
"aria-pressed": panel === "totp",
|
|
4604
|
+
disabled: busy,
|
|
2446
4605
|
onClick: () => {
|
|
2447
|
-
setPanel("totp");
|
|
2448
4606
|
setBinding(null);
|
|
2449
4607
|
setMessage(null);
|
|
2450
4608
|
},
|
|
2451
|
-
children: t(
|
|
4609
|
+
children: t("settingsRestartBinding")
|
|
2452
4610
|
}
|
|
2453
4611
|
),
|
|
2454
|
-
/* @__PURE__ */ (0,
|
|
4612
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2455
4613
|
"button",
|
|
2456
4614
|
{
|
|
2457
|
-
className: "auth-remote-button",
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
setPanel("sessions");
|
|
2462
|
-
setMessage(null);
|
|
2463
|
-
},
|
|
2464
|
-
children: t("settingsSessions")
|
|
4615
|
+
className: "auth-remote-button auth-remote-primary",
|
|
4616
|
+
type: "submit",
|
|
4617
|
+
disabled: busy,
|
|
4618
|
+
children: t("settingsConfirmBinding")
|
|
2465
4619
|
}
|
|
2466
4620
|
)
|
|
2467
|
-
] })
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
label: t("settingsCurrentPassword"),
|
|
2494
|
-
name: "currentPassword",
|
|
2495
|
-
type: "password",
|
|
2496
|
-
autoComplete: "current-password"
|
|
2497
|
-
}
|
|
2498
|
-
),
|
|
2499
|
-
me?.totpEnabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2500
|
-
TextField,
|
|
2501
|
-
{
|
|
2502
|
-
label: t("settingsCurrentCode"),
|
|
2503
|
-
name: "currentCode",
|
|
2504
|
-
autoComplete: "one-time-code"
|
|
2505
|
-
}
|
|
2506
|
-
),
|
|
2507
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2508
|
-
TextField,
|
|
2509
|
-
{
|
|
2510
|
-
label: t("settingsNewPassword"),
|
|
2511
|
-
name: "newPassword",
|
|
2512
|
-
type: "password",
|
|
2513
|
-
autoComplete: "new-password"
|
|
2514
|
-
}
|
|
2515
|
-
),
|
|
2516
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2517
|
-
TextField,
|
|
2518
|
-
{
|
|
2519
|
-
label: t("settingsConfirmPassword"),
|
|
2520
|
-
name: "confirmPassword",
|
|
2521
|
-
type: "password",
|
|
2522
|
-
autoComplete: "new-password"
|
|
2523
|
-
}
|
|
2524
|
-
),
|
|
2525
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "auth-remote-button auth-remote-primary", disabled: busy, type: "submit", children: t("settingsSavePassword") })
|
|
2526
|
-
]
|
|
2527
|
-
}
|
|
2528
|
-
),
|
|
2529
|
-
panel === "totp" && !binding && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
2530
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2531
|
-
"form",
|
|
4621
|
+
] })
|
|
4622
|
+
]
|
|
4623
|
+
},
|
|
4624
|
+
"confirm"
|
|
4625
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
4626
|
+
"form",
|
|
4627
|
+
{
|
|
4628
|
+
onSubmit: (event) => {
|
|
4629
|
+
event.preventDefault();
|
|
4630
|
+
const data = new FormData(event.currentTarget);
|
|
4631
|
+
void run(
|
|
4632
|
+
() => authRequest("/auth-remote/totp/start", {
|
|
4633
|
+
password: data.get("password"),
|
|
4634
|
+
...me.totpEnabled ? { currentCode: data.get("currentCode") } : {}
|
|
4635
|
+
}),
|
|
4636
|
+
setBinding
|
|
4637
|
+
);
|
|
4638
|
+
},
|
|
4639
|
+
children: [
|
|
4640
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: t("settingsBindDescription") }),
|
|
4641
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("fieldset", { disabled: busy, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CredentialFields, { t, totpEnabled: me.totpEnabled }) }),
|
|
4642
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(OperationError, { message, t }),
|
|
4643
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "auth-remote-dialog-actions", children: [
|
|
4644
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CancelButton, { t, close, busy }),
|
|
4645
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4646
|
+
"button",
|
|
2532
4647
|
{
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
password: data.get("password"),
|
|
2538
|
-
...me?.totpEnabled ? { currentCode: data.get("currentCode") } : {}
|
|
2539
|
-
}),
|
|
2540
|
-
(result) => {
|
|
2541
|
-
const issuer = "DSH Auth Remote";
|
|
2542
|
-
const label = `${issuer}:${me?.username ?? ""}`;
|
|
2543
|
-
setBinding({
|
|
2544
|
-
...result,
|
|
2545
|
-
uri: `otpauth://totp/${encodeURIComponent(label)}?secret=${result.secret}&issuer=${encodeURIComponent(issuer)}&algorithm=SHA1&digits=6&period=30`
|
|
2546
|
-
});
|
|
2547
|
-
}
|
|
2548
|
-
);
|
|
2549
|
-
},
|
|
2550
|
-
children: [
|
|
2551
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: t(me?.totpEnabled ? "settingsRebindTotp" : "settingsBindTotp") }),
|
|
2552
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("settingsBindDescription") }),
|
|
2553
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2554
|
-
TextField,
|
|
2555
|
-
{
|
|
2556
|
-
label: t("settingsCurrentPassword"),
|
|
2557
|
-
name: "password",
|
|
2558
|
-
type: "password",
|
|
2559
|
-
autoComplete: "current-password"
|
|
2560
|
-
}
|
|
2561
|
-
),
|
|
2562
|
-
me?.totpEnabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2563
|
-
TextField,
|
|
2564
|
-
{
|
|
2565
|
-
label: t("settingsCurrentCode"),
|
|
2566
|
-
name: "currentCode",
|
|
2567
|
-
autoComplete: "one-time-code"
|
|
2568
|
-
}
|
|
2569
|
-
),
|
|
2570
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2571
|
-
"button",
|
|
2572
|
-
{
|
|
2573
|
-
className: "auth-remote-button auth-remote-primary",
|
|
2574
|
-
disabled: busy,
|
|
2575
|
-
type: "submit",
|
|
2576
|
-
children: t("settingsStartBinding")
|
|
2577
|
-
}
|
|
2578
|
-
)
|
|
2579
|
-
]
|
|
4648
|
+
className: "auth-remote-button auth-remote-primary",
|
|
4649
|
+
type: "submit",
|
|
4650
|
+
disabled: busy,
|
|
4651
|
+
children: t("settingsStartBinding")
|
|
2580
4652
|
}
|
|
2581
|
-
)
|
|
2582
|
-
|
|
2583
|
-
|
|
4653
|
+
)
|
|
4654
|
+
] })
|
|
4655
|
+
]
|
|
4656
|
+
},
|
|
4657
|
+
"credentials"
|
|
4658
|
+
) });
|
|
4659
|
+
}
|
|
4660
|
+
|
|
4661
|
+
// src/client/settings/section.tsx
|
|
4662
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
4663
|
+
function SecuritySection({
|
|
4664
|
+
t,
|
|
4665
|
+
manualAccountSetting,
|
|
4666
|
+
locale
|
|
4667
|
+
}) {
|
|
4668
|
+
const [operation, setOperation] = (0, import_react3.useState)(null);
|
|
4669
|
+
const [loading, setLoading] = (0, import_react3.useState)(true);
|
|
4670
|
+
const [reload, setReload] = (0, import_react3.useState)(0);
|
|
4671
|
+
const [me, setMe] = (0, import_react3.useState)(null);
|
|
4672
|
+
const [message, setMessage] = (0, import_react3.useState)(null);
|
|
4673
|
+
(0, import_react3.useEffect)(() => {
|
|
4674
|
+
let live = true;
|
|
4675
|
+
setLoading(true);
|
|
4676
|
+
void accountOverview().then(
|
|
4677
|
+
(value) => {
|
|
4678
|
+
if (live) {
|
|
4679
|
+
setMe(value);
|
|
4680
|
+
setMessage(null);
|
|
4681
|
+
setLoading(false);
|
|
4682
|
+
}
|
|
4683
|
+
},
|
|
4684
|
+
(error) => {
|
|
4685
|
+
if (isUnauthorized(error)) goToLogin();
|
|
4686
|
+
else if (live) {
|
|
4687
|
+
setMe(null);
|
|
4688
|
+
setMessage(settingsError(error));
|
|
4689
|
+
setLoading(false);
|
|
4690
|
+
}
|
|
4691
|
+
}
|
|
4692
|
+
);
|
|
4693
|
+
return () => {
|
|
4694
|
+
live = false;
|
|
4695
|
+
};
|
|
4696
|
+
}, [reload]);
|
|
4697
|
+
const dismiss = () => {
|
|
4698
|
+
setOperation(null);
|
|
4699
|
+
setReload((value) => value + 1);
|
|
4700
|
+
};
|
|
4701
|
+
const placeholder = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "aria-hidden": "true", children: "\u2014" });
|
|
4702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { "aria-label": t("settingsSectionAria"), className: "auth-remote-security", children: [
|
|
4703
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { children: t("settingsTitle") }),
|
|
4704
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { children: t("settingsOverview") }),
|
|
4705
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "auth-remote-loading-status", role: "status", children: t("settingsLoading") }),
|
|
4706
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("dl", { className: "auth-remote-overview", "aria-busy": loading, children: [
|
|
4707
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
4708
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dt", { children: t("settingsUsername") }),
|
|
4709
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dd", { children: me ? me.username : placeholder })
|
|
4710
|
+
] }),
|
|
4711
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
4712
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dt", { children: "TOTP" }),
|
|
4713
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("dd", { className: "auth-remote-totp-status", children: [
|
|
4714
|
+
me ? t(me.totpEnabled ? "settingsTotpEnabled" : "settingsTotpNotBound") : placeholder,
|
|
4715
|
+
me?.requireTotp && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4716
|
+
"span",
|
|
2584
4717
|
{
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
},
|
|
2595
|
-
children: [
|
|
2596
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: t("settingsDisableTotp") }),
|
|
2597
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("settingsDisableDescription") }),
|
|
2598
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2599
|
-
TextField,
|
|
2600
|
-
{
|
|
2601
|
-
label: t("settingsCurrentPassword"),
|
|
2602
|
-
name: "disablePassword",
|
|
2603
|
-
type: "password",
|
|
2604
|
-
autoComplete: "current-password"
|
|
2605
|
-
}
|
|
2606
|
-
),
|
|
2607
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2608
|
-
TextField,
|
|
2609
|
-
{
|
|
2610
|
-
label: t("settingsCurrentCode"),
|
|
2611
|
-
name: "disableCode",
|
|
2612
|
-
autoComplete: "one-time-code"
|
|
2613
|
-
}
|
|
2614
|
-
),
|
|
2615
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2616
|
-
"button",
|
|
2617
|
-
{
|
|
2618
|
-
className: "auth-remote-button auth-remote-primary",
|
|
2619
|
-
disabled: busy,
|
|
2620
|
-
type: "submit",
|
|
2621
|
-
children: t("settingsDisableTotp")
|
|
2622
|
-
}
|
|
2623
|
-
)
|
|
2624
|
-
]
|
|
4718
|
+
className: "auth-remote-policy-hint",
|
|
4719
|
+
role: "img",
|
|
4720
|
+
tabIndex: 0,
|
|
4721
|
+
"aria-label": t("settingsTotpRequired"),
|
|
4722
|
+
title: t("settingsTotpRequired"),
|
|
4723
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
4724
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "8", cy: "8", r: "6", stroke: "currentColor" }),
|
|
4725
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M8 7v4M8 4.5v1", stroke: "currentColor", strokeLinecap: "round" })
|
|
4726
|
+
] })
|
|
2625
4727
|
}
|
|
2626
4728
|
)
|
|
2627
|
-
] })
|
|
2628
|
-
|
|
2629
|
-
|
|
4729
|
+
] })
|
|
4730
|
+
] }),
|
|
4731
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
4732
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dt", { children: t("settingsCreatedAt") }),
|
|
4733
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dd", { children: me ? new Intl.DateTimeFormat(locale || navigator.language, {
|
|
4734
|
+
dateStyle: "medium",
|
|
4735
|
+
timeStyle: "short"
|
|
4736
|
+
}).format(me.createdAt) : placeholder })
|
|
4737
|
+
] }),
|
|
4738
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
4739
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dt", { children: t("settingsExpiresAt") }),
|
|
4740
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dd", { children: me ? new Intl.DateTimeFormat(locale || navigator.language, {
|
|
4741
|
+
dateStyle: "medium",
|
|
4742
|
+
timeStyle: "short"
|
|
4743
|
+
}).format(me.expiresAt) : placeholder })
|
|
4744
|
+
] }),
|
|
4745
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
4746
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dt", { children: t("settingsActiveSessions") }),
|
|
4747
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dd", { children: me ? me.activeSessions : placeholder })
|
|
4748
|
+
] })
|
|
4749
|
+
] }),
|
|
4750
|
+
!loading && !me && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "auth-remote-button", onClick: () => setReload((value) => value + 1), children: t("settingsRetry") }),
|
|
4751
|
+
manualAccountSetting,
|
|
4752
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "auth-remote-operation-row", children: [
|
|
4753
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { children: t("settingsPasswordTitle") }),
|
|
4754
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4755
|
+
"button",
|
|
4756
|
+
{
|
|
4757
|
+
className: "auth-remote-button",
|
|
4758
|
+
disabled: !me,
|
|
4759
|
+
onClick: () => setOperation("password"),
|
|
4760
|
+
children: t("settingsChangePassword")
|
|
4761
|
+
}
|
|
4762
|
+
)
|
|
4763
|
+
] }),
|
|
4764
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "auth-remote-operation-row", children: [
|
|
4765
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { children: "TOTP" }),
|
|
4766
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "auth-remote-actions", children: [
|
|
4767
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4768
|
+
"button",
|
|
2630
4769
|
{
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
challenge: binding.challenge,
|
|
2636
|
-
code: data.get("code")
|
|
2637
|
-
}),
|
|
2638
|
-
(result) => {
|
|
2639
|
-
if (!sectionRef.current?.isConnected) {
|
|
2640
|
-
goToLogin("updated");
|
|
2641
|
-
return;
|
|
2642
|
-
}
|
|
2643
|
-
releaseBackupCodesRedirect ??= holdLoginRedirect();
|
|
2644
|
-
setBackupCodes(result.backupCodes);
|
|
2645
|
-
}
|
|
2646
|
-
);
|
|
2647
|
-
},
|
|
2648
|
-
children: [
|
|
2649
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: t("settingsScanQr") }),
|
|
2650
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SecretQr, { uri: binding.uri, t }),
|
|
2651
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
2652
|
-
t("settingsManualSecret"),
|
|
2653
|
-
" ",
|
|
2654
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: binding.secret })
|
|
2655
|
-
] }),
|
|
2656
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextField, { label: t("settingsNewCode"), name: "code", autoComplete: "one-time-code" }),
|
|
2657
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "auth-remote-button auth-remote-primary", disabled: busy, type: "submit", children: t("settingsConfirmBinding") }),
|
|
2658
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2659
|
-
"button",
|
|
2660
|
-
{
|
|
2661
|
-
className: "auth-remote-button auth-remote-restart",
|
|
2662
|
-
type: "button",
|
|
2663
|
-
onClick: () => setBinding(null),
|
|
2664
|
-
children: t("settingsRestartBinding")
|
|
2665
|
-
}
|
|
2666
|
-
)
|
|
2667
|
-
]
|
|
4770
|
+
className: "auth-remote-button",
|
|
4771
|
+
disabled: !me,
|
|
4772
|
+
onClick: () => setOperation("totp"),
|
|
4773
|
+
children: t(me?.totpEnabled ? "settingsRebindTotp" : "settingsBindTotp")
|
|
2668
4774
|
}
|
|
2669
4775
|
),
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
"button",
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
label: t("settingsCurrentPassword"),
|
|
2704
|
-
name: "password",
|
|
2705
|
-
type: "password",
|
|
2706
|
-
autoComplete: "current-password"
|
|
2707
|
-
}
|
|
2708
|
-
),
|
|
2709
|
-
me?.totpEnabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2710
|
-
TextField,
|
|
2711
|
-
{
|
|
2712
|
-
label: t("settingsCurrentCode"),
|
|
2713
|
-
name: "currentCode",
|
|
2714
|
-
autoComplete: "one-time-code"
|
|
2715
|
-
}
|
|
2716
|
-
),
|
|
2717
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2718
|
-
"button",
|
|
2719
|
-
{
|
|
2720
|
-
className: "auth-remote-button auth-remote-primary",
|
|
2721
|
-
disabled: busy,
|
|
2722
|
-
type: "submit",
|
|
2723
|
-
children: t("settingsSignOutAll")
|
|
2724
|
-
}
|
|
2725
|
-
)
|
|
2726
|
-
]
|
|
2727
|
-
}
|
|
2728
|
-
)
|
|
2729
|
-
] }),
|
|
2730
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "auth-remote-error", role: "alert", "aria-live": "assertive", children: message && t(message.key, message.params) })
|
|
2731
|
-
]
|
|
2732
|
-
}
|
|
2733
|
-
);
|
|
4776
|
+
me?.totpEnabled && !me.requireTotp && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4777
|
+
"button",
|
|
4778
|
+
{
|
|
4779
|
+
className: "auth-remote-button",
|
|
4780
|
+
disabled: !me,
|
|
4781
|
+
onClick: () => setOperation("disable"),
|
|
4782
|
+
children: t("settingsDisableTotp")
|
|
4783
|
+
}
|
|
4784
|
+
)
|
|
4785
|
+
] })
|
|
4786
|
+
] }),
|
|
4787
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "auth-remote-operation-row", children: [
|
|
4788
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { children: t("settingsSessions") }),
|
|
4789
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "auth-remote-actions", children: [
|
|
4790
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4791
|
+
"button",
|
|
4792
|
+
{
|
|
4793
|
+
className: "auth-remote-button",
|
|
4794
|
+
disabled: !me,
|
|
4795
|
+
onClick: () => setOperation("current"),
|
|
4796
|
+
children: t("settingsSignOutCurrent")
|
|
4797
|
+
}
|
|
4798
|
+
),
|
|
4799
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "auth-remote-button", disabled: !me, onClick: () => setOperation("all"), children: t("settingsSignOutAll") })
|
|
4800
|
+
] })
|
|
4801
|
+
] }),
|
|
4802
|
+
operation === "password" && me && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PasswordDialog, { me, t, close: dismiss }),
|
|
4803
|
+
operation === "current" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CurrentSessionDialog, { t, close: dismiss }),
|
|
4804
|
+
operation === "all" && me && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CredentialDialog, { action: "revoke", me, t, close: dismiss }),
|
|
4805
|
+
operation === "totp" && me && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TotpDialog, { me, t, close: dismiss }),
|
|
4806
|
+
operation === "disable" && me && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CredentialDialog, { action: "disable", me, t, close: dismiss }),
|
|
4807
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "auth-remote-error", role: "alert", children: message && t(message.key, message.params) })
|
|
4808
|
+
] });
|
|
2734
4809
|
}
|
|
2735
4810
|
|
|
2736
4811
|
// src/client/settings/monitor.ts
|
|
@@ -2774,13 +4849,44 @@ function monitorSession(ctx) {
|
|
|
2774
4849
|
|
|
2775
4850
|
// src/shared/locales/en.ts
|
|
2776
4851
|
var en = {
|
|
2777
|
-
brand: "DSH \xB7 Remote sign-in",
|
|
2778
4852
|
errorNetwork: "Connection failed. Check your network and try again.",
|
|
2779
4853
|
errorRateLimited: "Too many attempts. Try again in about {seconds} seconds.",
|
|
2780
4854
|
errorUnauthorized: "Your session has expired. Sign in again.",
|
|
2781
4855
|
errorServiceUnavailable: "The service is temporarily unavailable. Try again later.",
|
|
2782
4856
|
errorGeneric: "The operation could not be completed. Try again.",
|
|
2783
|
-
|
|
4857
|
+
accountLoginDisabled: "Manual account sign-in is disabled. Refresh this page to use the native sign-in entry.",
|
|
4858
|
+
settingsLoginConfiguration: "Sign-in preferences",
|
|
4859
|
+
settingsManualDescription: "Authorize in a new tab, then paste the callback address.",
|
|
4860
|
+
settingsManualAccountLogin: "Remote DeepSeek account sign-in",
|
|
4861
|
+
settingsManualConfigUnavailable: "Sign-in preferences are temporarily unavailable.",
|
|
4862
|
+
settingsManualUnavailable: "Manual account sign-in is unavailable in this DSH environment.",
|
|
4863
|
+
settingsManualSaveFailed: "Could not save this preference. Check the current value and try again.",
|
|
4864
|
+
settingsSaving: "Saving\u2026",
|
|
4865
|
+
settingsRetry: "Retry",
|
|
4866
|
+
accountLoginTitle: "Sign in to DeepSeek",
|
|
4867
|
+
accountLoginStepOpen: "Sign in to DeepSeek in a new tab.",
|
|
4868
|
+
accountLoginStepCopy: "Copy the full address after authorization and paste it here.",
|
|
4869
|
+
accountLoginCallbackLabel: "Full callback address",
|
|
4870
|
+
accountLoginCallbackHint: "A connection error or 404 after authorization is expected. Copy the full address.",
|
|
4871
|
+
accountLoginOpen: "Open sign-in page",
|
|
4872
|
+
accountLoginConfirm: "Confirm sign-in",
|
|
4873
|
+
accountLoginCancel: "Cancel",
|
|
4874
|
+
accountLoginUseApiKey: "Use API key",
|
|
4875
|
+
accountLoginClose: "Close",
|
|
4876
|
+
accountLoginRetry: "Start again",
|
|
4877
|
+
accountLoginReopen: "Reopen authorization page",
|
|
4878
|
+
accountLoginPopupBlocked: "The new tab was blocked.",
|
|
4879
|
+
accountLoginInitializing: "Preparing authorization\u2026",
|
|
4880
|
+
accountLoginWaiting: "Authorization lasts at most 10 minutes.",
|
|
4881
|
+
accountLoginExchanging: "Completing sign-in\u2026",
|
|
4882
|
+
accountLoginInvalidCallback: "This callback address does not match the current authorization. Copy the full address, including code and state, from the latest authorization tab.",
|
|
4883
|
+
accountLoginExpired: "This authorization has expired. Start again.",
|
|
4884
|
+
accountLoginMismatch: "This authorization is no longer available in this session. Close this dialog and start again.",
|
|
4885
|
+
accountLoginBusy: "Another authorization is in progress. Finish or cancel it before starting again.",
|
|
4886
|
+
accountLoginUnavailable: "This DSH version does not provide compatible account sign-in.",
|
|
4887
|
+
accountLoginFailed: "Authorization could not be completed. Start again and submit the address from the new tab.",
|
|
4888
|
+
accountLoginNoResponse: "The DeepSeek platform did not respond. Check the DSH server\u2019s network connection and start again.",
|
|
4889
|
+
loginInitialTitle: "Sign in",
|
|
2784
4890
|
loginInitialLoading: "Checking sign-in status\u2026",
|
|
2785
4891
|
loginLanguageLabel: "Language",
|
|
2786
4892
|
loginSetupTitle: "Set up your account first",
|
|
@@ -2790,8 +4896,7 @@ var en = {
|
|
|
2790
4896
|
loginSetupCopied: "Command copied.",
|
|
2791
4897
|
loginSetupCopyFallback: "Select and copy the command manually.",
|
|
2792
4898
|
loginSetupNotFound: "No account was found. Check that the command used this profile, then try again.",
|
|
2793
|
-
loginTitle: "Sign in
|
|
2794
|
-
loginDescription: "Enter the single-user account created in the server terminal.",
|
|
4899
|
+
loginTitle: "Sign in",
|
|
2795
4900
|
loginUsername: "Username",
|
|
2796
4901
|
loginPassword: "Password",
|
|
2797
4902
|
loginContinue: "Continue",
|
|
@@ -2824,7 +4929,7 @@ var en = {
|
|
|
2824
4929
|
loginOptionalSkipLater: "Connect later and enter DSH",
|
|
2825
4930
|
loginReasonExpired: "Your session has expired. Sign in again.",
|
|
2826
4931
|
loginReasonUpdated: "Security settings changed. Sign in again.",
|
|
2827
|
-
loginReasonSignedOut: "You signed out of this
|
|
4932
|
+
loginReasonSignedOut: "You signed out of this session.",
|
|
2828
4933
|
loginUnavailableTitle: "Sign-in is temporarily unavailable",
|
|
2829
4934
|
loginUnavailableDescription: "The service status is unavailable. Check the connection and retry.",
|
|
2830
4935
|
loginRetry: "Check again",
|
|
@@ -2832,15 +4937,25 @@ var en = {
|
|
|
2832
4937
|
loginErrorInvalidFactor: "The verification or backup code is incorrect. After five failed attempts, you must enter your password again.",
|
|
2833
4938
|
loginErrorChallenge: "This verification expired. Enter your username and password again.",
|
|
2834
4939
|
loginErrorUninitialized: "The account is not set up. Run the setup command in the server terminal.",
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
4940
|
+
settingsClose: "Close",
|
|
4941
|
+
settingsCancel: "Cancel",
|
|
4942
|
+
settingsOverview: "Account overview",
|
|
4943
|
+
settingsUsername: "DSH sign-in username",
|
|
4944
|
+
settingsCreatedAt: "Signed in at",
|
|
4945
|
+
settingsExpiresAt: "Session expires at",
|
|
4946
|
+
settingsActiveSessions: "Active sessions",
|
|
4947
|
+
settingsTotpRequired: "TOTP is required by configuration and cannot be turned off.",
|
|
4948
|
+
settingsPasswordTitle: "Password",
|
|
4949
|
+
settingsSignOutCurrentDescription: "Sign out this session? Other sessions will stay signed in.",
|
|
4950
|
+
settingsSectionLabel: "Security & sign-in",
|
|
4951
|
+
settingsSectionAria: "Security & sign-in settings",
|
|
4952
|
+
settingsTitle: "Security & sign-in",
|
|
2838
4953
|
settingsAccountSummary: "Account: {username} \xB7 TOTP: {totp}",
|
|
2839
4954
|
settingsTotpEnabled: "Enabled",
|
|
2840
4955
|
settingsTotpNotBound: "Not connected",
|
|
2841
4956
|
settingsLoading: "Loading account status\u2026",
|
|
2842
4957
|
settingsChangePassword: "Change password",
|
|
2843
|
-
settingsBindTotp: "
|
|
4958
|
+
settingsBindTotp: "Turn on TOTP",
|
|
2844
4959
|
settingsRebindTotp: "Reconnect TOTP",
|
|
2845
4960
|
settingsSessions: "Session management",
|
|
2846
4961
|
settingsPasswordMismatch: "The new passwords do not match.",
|
|
@@ -2862,9 +4977,13 @@ var en = {
|
|
|
2862
4977
|
settingsNewCode: "Six-digit code from the new authenticator",
|
|
2863
4978
|
settingsConfirmBinding: "Confirm setup",
|
|
2864
4979
|
settingsRestartBinding: "Start over",
|
|
2865
|
-
settingsSignOutCurrent: "Sign out this
|
|
2866
|
-
settingsSignOutAll: "Sign out
|
|
2867
|
-
settingsSignOutAllDescription: "Enter your current credentials. All
|
|
4980
|
+
settingsSignOutCurrent: "Sign out this session",
|
|
4981
|
+
settingsSignOutAll: "Sign out all sessions",
|
|
4982
|
+
settingsSignOutAllDescription: "Enter your current credentials. All sessions, including this one, and open connections will be revoked.",
|
|
4983
|
+
settingsOldBackupInvalid: "Your previous backup codes no longer work.",
|
|
4984
|
+
settingsCopyAll: "Copy all",
|
|
4985
|
+
settingsBackupCopied: "Backup codes copied.",
|
|
4986
|
+
settingsBackupCopyFailed: "Could not copy. Select the codes and copy them manually.",
|
|
2868
4987
|
settingsBackupTitle: "Save your backup codes",
|
|
2869
4988
|
settingsBackupDescription: "These codes are shown only once. Store them safely; each code can be used only once.",
|
|
2870
4989
|
settingsBackupSaved: "I saved them; sign in again",
|
|
@@ -2943,13 +5062,44 @@ The command uses the profile selected by dsh plugin exec and the caller's DSH_HO
|
|
|
2943
5062
|
|
|
2944
5063
|
// src/shared/locales/zh.ts
|
|
2945
5064
|
var zh = {
|
|
2946
|
-
brand: "DSH \xB7 \u8FDC\u7A0B\u767B\u5F55",
|
|
2947
5065
|
errorNetwork: "\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5\u3002",
|
|
2948
5066
|
errorRateLimited: "\u5C1D\u8BD5\u8FC7\u4E8E\u9891\u7E41\uFF0C\u8BF7\u7EA6 {seconds} \u79D2\u540E\u91CD\u8BD5\u3002",
|
|
2949
5067
|
errorUnauthorized: "\u4F1A\u8BDD\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u3002",
|
|
2950
5068
|
errorServiceUnavailable: "\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
|
|
2951
5069
|
errorGeneric: "\u64CD\u4F5C\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
2952
|
-
|
|
5070
|
+
accountLoginDisabled: "\u624B\u52A8\u8D26\u53F7\u767B\u5F55\u5DF2\u5173\u95ED\u3002\u8BF7\u5237\u65B0\u9875\u9762\uFF0C\u4F7F\u7528\u539F\u751F\u767B\u5F55\u5165\u53E3\u3002",
|
|
5071
|
+
settingsLoginConfiguration: "\u767B\u5F55\u914D\u7F6E",
|
|
5072
|
+
settingsManualDescription: "\u5728\u65B0\u6807\u7B7E\u9875\u6388\u6743\u540E\uFF0C\u7C98\u8D34\u56DE\u8C03\u5730\u5740\u767B\u5F55\u3002",
|
|
5073
|
+
settingsManualAccountLogin: "\u8FDC\u7A0B DeepSeek \u8D26\u53F7\u767B\u5F55",
|
|
5074
|
+
settingsManualConfigUnavailable: "\u767B\u5F55\u914D\u7F6E\u6682\u65F6\u4E0D\u53EF\u7528\u3002",
|
|
5075
|
+
settingsManualUnavailable: "\u5F53\u524D DSH \u73AF\u5883\u4E0D\u652F\u6301\u624B\u52A8\u8D26\u53F7\u767B\u5F55\u3002",
|
|
5076
|
+
settingsManualSaveFailed: "\u914D\u7F6E\u4FDD\u5B58\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u5F53\u524D\u503C\u540E\u91CD\u8BD5\u3002",
|
|
5077
|
+
settingsSaving: "\u6B63\u5728\u4FDD\u5B58\u2026",
|
|
5078
|
+
settingsRetry: "\u91CD\u8BD5",
|
|
5079
|
+
accountLoginTitle: "\u767B\u5F55 DeepSeek \u8D26\u53F7",
|
|
5080
|
+
accountLoginStepOpen: "\u5728\u65B0\u6807\u7B7E\u9875\u5B8C\u6210 DeepSeek \u767B\u5F55\u3002",
|
|
5081
|
+
accountLoginStepCopy: "\u590D\u5236\u6388\u6743\u540E\u5730\u5740\u680F\u7684\u5B8C\u6574\u5730\u5740\uFF0C\u8FD4\u56DE\u6B64\u5904\u7C98\u8D34\u3002",
|
|
5082
|
+
accountLoginCallbackLabel: "\u5B8C\u6574\u56DE\u8C03\u5730\u5740",
|
|
5083
|
+
accountLoginCallbackHint: "\u6388\u6743\u540E\u5373\u4F7F\u9875\u9762\u663E\u793A\u8FDE\u63A5\u5931\u8D25\u6216 404\uFF0C\u4E5F\u53EF\u4EE5\u590D\u5236\u5B8C\u6574\u5730\u5740\u3002",
|
|
5084
|
+
accountLoginOpen: "\u6253\u5F00\u767B\u5F55\u9875",
|
|
5085
|
+
accountLoginConfirm: "\u786E\u8BA4\u767B\u5F55",
|
|
5086
|
+
accountLoginCancel: "\u53D6\u6D88",
|
|
5087
|
+
accountLoginUseApiKey: "\u4F7F\u7528 API Key",
|
|
5088
|
+
accountLoginClose: "\u5173\u95ED",
|
|
5089
|
+
accountLoginRetry: "\u91CD\u65B0\u5F00\u59CB",
|
|
5090
|
+
accountLoginReopen: "\u91CD\u65B0\u6253\u5F00\u6388\u6743\u9875",
|
|
5091
|
+
accountLoginPopupBlocked: "\u65B0\u6807\u7B7E\u9875\u88AB\u6D4F\u89C8\u5668\u62E6\u622A\u3002",
|
|
5092
|
+
accountLoginInitializing: "\u6B63\u5728\u51C6\u5907\u6388\u6743\u2026",
|
|
5093
|
+
accountLoginWaiting: "\u6388\u6743\u6709\u6548\u671F\u6700\u957F 10 \u5206\u949F\u3002",
|
|
5094
|
+
accountLoginExchanging: "\u6B63\u5728\u5B8C\u6210\u767B\u5F55\u2026",
|
|
5095
|
+
accountLoginInvalidCallback: "\u56DE\u8C03\u5730\u5740\u4E0E\u5F53\u524D\u6388\u6743\u4E0D\u5339\u914D\uFF0C\u8BF7\u4ECE\u6700\u8FD1\u4E00\u6B21\u6388\u6743\u6807\u7B7E\u9875\u590D\u5236\u5305\u542B code \u548C state \u7684\u5B8C\u6574\u5730\u5740\u3002",
|
|
5096
|
+
accountLoginExpired: "\u672C\u6B21\u6388\u6743\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u5F00\u59CB\u3002",
|
|
5097
|
+
accountLoginMismatch: "\u5F53\u524D\u4F1A\u8BDD\u5DF2\u65E0\u6CD5\u7EE7\u7EED\u6B64\u6388\u6743\uFF0C\u8BF7\u5173\u95ED\u5F39\u7A97\u540E\u91CD\u65B0\u5F00\u59CB\u3002",
|
|
5098
|
+
accountLoginBusy: "\u5DF2\u6709\u6388\u6743\u6B63\u5728\u8FDB\u884C\uFF0C\u8BF7\u5148\u5B8C\u6210\u6216\u53D6\u6D88\u540E\u518D\u5F00\u59CB\u3002",
|
|
5099
|
+
accountLoginUnavailable: "\u5F53\u524D DSH \u7248\u672C\u672A\u63D0\u4F9B\u517C\u5BB9\u7684\u8D26\u53F7\u767B\u5F55\u529F\u80FD\u3002",
|
|
5100
|
+
accountLoginFailed: "\u672A\u80FD\u5B8C\u6210\u6388\u6743\uFF0C\u8BF7\u91CD\u65B0\u5F00\u59CB\uFF0C\u5E76\u63D0\u4EA4\u65B0\u6807\u7B7E\u9875\u4E2D\u7684\u56DE\u8C03\u5730\u5740\u3002",
|
|
5101
|
+
accountLoginNoResponse: "DeepSeek \u5E73\u53F0\u672A\u54CD\u5E94\uFF0C\u8BF7\u68C0\u67E5 DSH \u670D\u52A1\u5668\u7684\u7F51\u7EDC\u8FDE\u63A5\u540E\u91CD\u65B0\u5F00\u59CB\u3002",
|
|
5102
|
+
loginInitialTitle: "\u767B\u5F55",
|
|
2953
5103
|
loginInitialLoading: "\u6B63\u5728\u68C0\u67E5\u767B\u5F55\u72B6\u6001\u2026",
|
|
2954
5104
|
loginLanguageLabel: "\u8BED\u8A00",
|
|
2955
5105
|
loginSetupTitle: "\u5148\u521D\u59CB\u5316\u8D26\u53F7",
|
|
@@ -2959,8 +5109,7 @@ var zh = {
|
|
|
2959
5109
|
loginSetupCopied: "\u547D\u4EE4\u5DF2\u590D\u5236\u3002",
|
|
2960
5110
|
loginSetupCopyFallback: "\u8BF7\u624B\u52A8\u9009\u62E9\u5E76\u590D\u5236\u547D\u4EE4\u3002",
|
|
2961
5111
|
loginSetupNotFound: "\u5C1A\u672A\u68C0\u6D4B\u5230\u8D26\u53F7\u3002\u8BF7\u786E\u8BA4\u547D\u4EE4\u4F7F\u7528\u4E86\u5F53\u524D profile\uFF0C\u518D\u91CD\u65B0\u68C0\u67E5\u3002",
|
|
2962
|
-
loginTitle: "\u767B\u5F55
|
|
2963
|
-
loginDescription: "\u8F93\u5165\u670D\u52A1\u5668\u7EC8\u7AEF\u521B\u5EFA\u7684\u5355\u7528\u6237\u8D26\u53F7\u3002",
|
|
5112
|
+
loginTitle: "\u767B\u5F55",
|
|
2964
5113
|
loginUsername: "\u7528\u6237\u540D",
|
|
2965
5114
|
loginPassword: "\u5BC6\u7801",
|
|
2966
5115
|
loginContinue: "\u7EE7\u7EED",
|
|
@@ -2993,7 +5142,7 @@ var zh = {
|
|
|
2993
5142
|
loginOptionalSkipLater: "\u7A0D\u540E\u7ED1\u5B9A\uFF0C\u8FDB\u5165 DSH",
|
|
2994
5143
|
loginReasonExpired: "\u4F1A\u8BDD\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u3002",
|
|
2995
5144
|
loginReasonUpdated: "\u5B89\u5168\u8BBE\u7F6E\u5DF2\u66F4\u65B0\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u3002",
|
|
2996
|
-
loginReasonSignedOut: "\u5DF2\u9000\u51FA\u5F53\u524D\
|
|
5145
|
+
loginReasonSignedOut: "\u5DF2\u9000\u51FA\u5F53\u524D\u4F1A\u8BDD\u3002",
|
|
2997
5146
|
loginUnavailableTitle: "\u6682\u65F6\u65E0\u6CD5\u767B\u5F55",
|
|
2998
5147
|
loginUnavailableDescription: "\u670D\u52A1\u72B6\u6001\u6682\u65F6\u65E0\u6CD5\u53D6\u5F97\uFF0C\u8BF7\u68C0\u67E5\u8FDE\u63A5\u5E76\u91CD\u8BD5\u3002",
|
|
2999
5148
|
loginRetry: "\u91CD\u65B0\u68C0\u67E5",
|
|
@@ -3001,15 +5150,25 @@ var zh = {
|
|
|
3001
5150
|
loginErrorInvalidFactor: "\u9A8C\u8BC1\u7801\u6216\u5907\u7528\u7801\u4E0D\u6B63\u786E\uFF1B\u8FDE\u7EED\u5931\u8D25 5 \u6B21\u540E\u9700\u91CD\u65B0\u8F93\u5165\u5BC6\u7801\u3002",
|
|
3002
5151
|
loginErrorChallenge: "\u672C\u6B21\u9A8C\u8BC1\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\u7528\u6237\u540D\u548C\u5BC6\u7801\u3002",
|
|
3003
5152
|
loginErrorUninitialized: "\u8D26\u53F7\u5C1A\u672A\u521D\u59CB\u5316\uFF0C\u8BF7\u5148\u5728\u670D\u52A1\u5668\u7EC8\u7AEF\u8FD0\u884C\u521D\u59CB\u5316\u547D\u4EE4\u3002",
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
5153
|
+
settingsClose: "\u5173\u95ED",
|
|
5154
|
+
settingsCancel: "\u53D6\u6D88",
|
|
5155
|
+
settingsOverview: "\u8D26\u6237\u6982\u89C8",
|
|
5156
|
+
settingsUsername: "DSH \u767B\u5F55\u7528\u6237\u540D",
|
|
5157
|
+
settingsCreatedAt: "\u672C\u6B21\u767B\u5F55\u65F6\u95F4",
|
|
5158
|
+
settingsExpiresAt: "\u5F53\u524D\u4F1A\u8BDD\u5230\u671F\u65F6\u95F4",
|
|
5159
|
+
settingsActiveSessions: "\u6709\u6548\u4F1A\u8BDD\u6570\u91CF",
|
|
5160
|
+
settingsTotpRequired: "\u914D\u7F6E\u8981\u6C42\u5F00\u542F TOTP\uFF0C\u65E0\u6CD5\u5173\u95ED\u3002",
|
|
5161
|
+
settingsPasswordTitle: "\u5BC6\u7801",
|
|
5162
|
+
settingsSignOutCurrentDescription: "\u786E\u5B9A\u9000\u51FA\u5F53\u524D\u4F1A\u8BDD\uFF1F\u5176\u4ED6\u4F1A\u8BDD\u5C06\u7EE7\u7EED\u4FDD\u6301\u767B\u5F55\u3002",
|
|
5163
|
+
settingsSectionLabel: "\u5B89\u5168\u4E0E\u767B\u5F55",
|
|
5164
|
+
settingsSectionAria: "\u5B89\u5168\u4E0E\u767B\u5F55\u8BBE\u7F6E",
|
|
5165
|
+
settingsTitle: "\u5B89\u5168\u4E0E\u767B\u5F55",
|
|
3007
5166
|
settingsAccountSummary: "\u8D26\u53F7\uFF1A{username} \xB7 TOTP\uFF1A{totp}",
|
|
3008
5167
|
settingsTotpEnabled: "\u5DF2\u542F\u7528",
|
|
3009
5168
|
settingsTotpNotBound: "\u672A\u7ED1\u5B9A",
|
|
3010
5169
|
settingsLoading: "\u6B63\u5728\u8BFB\u53D6\u8D26\u53F7\u72B6\u6001\u2026",
|
|
3011
5170
|
settingsChangePassword: "\u4FEE\u6539\u5BC6\u7801",
|
|
3012
|
-
settingsBindTotp: "\
|
|
5171
|
+
settingsBindTotp: "\u5F00\u542F TOTP",
|
|
3013
5172
|
settingsRebindTotp: "\u91CD\u65B0\u7ED1\u5B9A TOTP",
|
|
3014
5173
|
settingsSessions: "\u4F1A\u8BDD\u7BA1\u7406",
|
|
3015
5174
|
settingsPasswordMismatch: "\u4E24\u6B21\u8F93\u5165\u7684\u65B0\u5BC6\u7801\u4E0D\u4E00\u81F4\u3002",
|
|
@@ -3031,9 +5190,13 @@ var zh = {
|
|
|
3031
5190
|
settingsNewCode: "\u65B0\u8EAB\u4EFD\u9A8C\u8BC1\u5668\u7684 6 \u4F4D\u9A8C\u8BC1\u7801",
|
|
3032
5191
|
settingsConfirmBinding: "\u786E\u8BA4\u7ED1\u5B9A",
|
|
3033
5192
|
settingsRestartBinding: "\u91CD\u65B0\u5F00\u59CB",
|
|
3034
|
-
settingsSignOutCurrent: "\u9000\u51FA\u5F53\u524D\
|
|
3035
|
-
settingsSignOutAll: "\u9000\u51FA\
|
|
3036
|
-
settingsSignOutAllDescription: "\u8BF7\u8F93\u5165\u5F53\u524D\u51ED\u8BC1\uFF1B\u63D0\u4EA4\u540E\
|
|
5193
|
+
settingsSignOutCurrent: "\u9000\u51FA\u5F53\u524D\u4F1A\u8BDD",
|
|
5194
|
+
settingsSignOutAll: "\u9000\u51FA\u6240\u6709\u4F1A\u8BDD",
|
|
5195
|
+
settingsSignOutAllDescription: "\u8BF7\u8F93\u5165\u5F53\u524D\u51ED\u8BC1\uFF1B\u63D0\u4EA4\u540E\u5305\u62EC\u5F53\u524D\u4F1A\u8BDD\u5728\u5185\u7684\u5168\u90E8\u4F1A\u8BDD\u548C\u957F\u8FDE\u63A5\u90FD\u4F1A\u5931\u6548\u3002",
|
|
5196
|
+
settingsOldBackupInvalid: "\u65E7\u5907\u7528\u7801\u5DF2\u5931\u6548\u3002",
|
|
5197
|
+
settingsCopyAll: "\u590D\u5236\u5168\u90E8",
|
|
5198
|
+
settingsBackupCopied: "\u5907\u7528\u7801\u5DF2\u590D\u5236\u3002",
|
|
5199
|
+
settingsBackupCopyFailed: "\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u9009\u4E2D\u5907\u7528\u7801\u624B\u52A8\u590D\u5236\u3002",
|
|
3037
5200
|
settingsBackupTitle: "\u4FDD\u5B58\u5907\u7528\u7801",
|
|
3038
5201
|
settingsBackupDescription: "\u8FD9\u4E9B\u5907\u7528\u7801\u53EA\u4F1A\u663E\u793A\u8FD9\u4E00\u6B21\u3002\u8BF7\u5B58\u653E\u5728\u5B89\u5168\u7684\u4F4D\u7F6E\uFF0C\u6BCF\u4E2A\u5907\u7528\u7801\u53EA\u80FD\u4F7F\u7528\u4E00\u6B21\u3002",
|
|
3039
5202
|
settingsBackupSaved: "\u6211\u5DF2\u4FDD\u5B58\uFF0C\u91CD\u65B0\u767B\u5F55",
|
|
@@ -3111,23 +5274,607 @@ var zh = {
|
|
|
3111
5274
|
};
|
|
3112
5275
|
|
|
3113
5276
|
// src/client/settings/style.css
|
|
3114
|
-
var style_default = "/* Inherit the host's live DSH theme. Scope every rule to this settings section.\n * Radius fallbacks match 0.1.7, before DSH published the shared radius tokens. */\n.auth-remote-security {\n min-width: 0;\n color: var(--dsw-alias-label-primary);\n font-family: var(--dsw-font-family);\n font-size: 14px;\n line-height: 22px;\n}\n\n.auth-remote-security h2 {\n margin: 0 0 8px;\n font-size: 16px;\n font-weight: 500;\n line-height: 24px;\n}\n\n.auth-remote-security h3 {\n margin: 0 0 8px;\n font-size: 14px;\n font-weight: 500;\n line-height: 22px;\n}\n\n.auth-remote-security p {\n margin: 0 0 16px;\n color: var(--dsw-alias-label-secondary);\n font-size: 13px;\n line-height: 20px;\n}\n\n.auth-remote-actions {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n padding: 4px 0 20px;\n}\n\n.auth-remote-security form {\n margin: 0;\n padding: 20px 0;\n border-top: 0.5px solid var(--dsw-alias-border-l2);\n}\n\n.auth-remote-field {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin-bottom: 16px;\n font-size: 13px;\n line-height: 20px;\n}\n\n.auth-remote-field input {\n box-sizing: border-box;\n width: 100%;\n max-width: 420px;\n min-width: 0;\n height: 32px;\n padding: 0 10px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-md, 8px);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 14px;\n line-height: 22px;\n}\n\n.auth-remote-field input:focus {\n outline: none;\n border-color: var(--dsw-alias-state-business-primary);\n}\n\n.auth-remote-button {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 36px;\n max-width: 100%;\n padding: 6px 14px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-md, 18px);\n background: transparent;\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 14px;\n line-height: 22px;\n cursor: pointer;\n}\n\n.auth-remote-button:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.auth-remote-button[aria-pressed='true'] {\n background: var(--dsw-alias-bg-module-platform);\n border-color: var(--dsw-static-neutral-bluish-400);\n}\n\n.auth-remote-primary {\n border-color: transparent;\n background: var(--dsw-alias-button-primary-fill);\n color: var(--dsw-alias-label-primary-foreground);\n}\n\n.auth-remote-primary:hover:not(:disabled) {\n background: var(--dsw-alias-button-primary-hover);\n}\n\n.auth-remote-button:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n.auth-remote-button:focus-visible {\n outline: 2px solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline-offset: 2px;\n}\n\n.auth-remote-restart {\n margin-left: 8px;\n}\n\n.auth-remote-security img {\n display: block;\n max-width: 100%;\n height: auto;\n margin: 16px 0;\n border-radius: var(--dsw-radius-md, 8px);\n}\n\n.auth-remote-security code,\n.auth-remote-backup-codes {\n font-family: var(--ds-font-family-code);\n overflow-wrap: anywhere;\n user-select: all;\n}\n\n.auth-remote-backup-codes {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 8px 24px;\n margin: 20px 0;\n padding: 16px 16px 16px 40px;\n border-radius: var(--dsw-radius-lg, 16px);\n background: var(--dsw-alias-bg-module-platform);\n}\n\n.auth-remote-security .auth-remote-error {\n margin: 12px 0 0;\n color: var(--dsw-alias-state-error-primary);\n}\n\n.auth-remote-error:empty {\n display: none;\n}\n";
|
|
5277
|
+
var style_default = "/* Inherit the host's live DSH theme. Scope every rule to this settings section.\n * Radius fallbacks match 0.1.7, before DSH published the shared radius tokens. */\n.auth-remote-security {\n min-width: 0;\n color: var(--dsw-alias-label-primary);\n font-family: var(--dsw-font-family);\n font-size: 14px;\n line-height: 22px;\n}\n\n.auth-remote-security h2 {\n margin: 0 0 8px;\n font-size: 16px;\n font-weight: 500;\n line-height: 24px;\n}\n\n.auth-remote-security h3 {\n margin: 0 0 8px;\n font-size: 14px;\n font-weight: 500;\n line-height: 22px;\n}\n\n.auth-remote-security p {\n margin: 0 0 16px;\n color: var(--dsw-alias-label-secondary);\n font-size: 13px;\n line-height: 20px;\n}\n\n.auth-remote-actions {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n padding: 4px 0 20px;\n}\n\n.auth-remote-security form {\n margin: 0;\n padding: 20px 0;\n border-top: 0.5px solid var(--dsw-alias-border-l2);\n}\n\n.auth-remote-field {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin-bottom: 16px;\n font-size: 13px;\n line-height: 20px;\n}\n\n.auth-remote-field input {\n box-sizing: border-box;\n width: 100%;\n max-width: 420px;\n min-width: 0;\n height: 32px;\n padding: 0 10px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-md, 8px);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 14px;\n line-height: 22px;\n}\n\n.auth-remote-field input:focus {\n outline: none;\n border-color: var(--dsw-alias-state-business-primary);\n}\n\n.auth-remote-button {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 36px;\n max-width: 100%;\n padding: 6px 14px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-md, 18px);\n background: transparent;\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 14px;\n line-height: 22px;\n cursor: pointer;\n}\n\n.auth-remote-button:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.auth-remote-button[aria-pressed='true'] {\n background: var(--dsw-alias-bg-module-platform);\n border-color: var(--dsw-static-neutral-bluish-400);\n}\n\n.auth-remote-primary {\n border-color: transparent;\n background: var(--dsw-alias-button-primary-fill);\n color: var(--dsw-alias-label-primary-foreground);\n}\n\n.auth-remote-primary:hover:not(:disabled) {\n background: var(--dsw-alias-button-primary-hover);\n}\n\n.auth-remote-button:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n.auth-remote-button:focus-visible {\n outline: 2px solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline-offset: 2px;\n}\n\n.auth-remote-restart {\n margin-left: 8px;\n}\n\n.auth-remote-security img {\n display: block;\n max-width: 100%;\n height: auto;\n margin: 16px 0;\n border-radius: var(--dsw-radius-md, 8px);\n}\n\n.auth-remote-security code,\n.auth-remote-backup-codes {\n font-family: var(--ds-font-family-code);\n overflow-wrap: anywhere;\n user-select: all;\n}\n\n.auth-remote-backup-codes {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 8px 24px;\n margin: 20px 0;\n padding: 16px 16px 16px 40px;\n border-radius: var(--dsw-radius-lg, 16px);\n background: var(--dsw-alias-bg-module-platform);\n}\n\n.auth-remote-security .auth-remote-error {\n margin: 12px 0 0;\n color: var(--dsw-alias-state-error-primary);\n}\n\n.auth-remote-error:empty {\n display: none;\n}\n\n.auth-remote-security .auth-remote-manual-setting {\n margin-block: 20px 16px;\n}\n.auth-remote-manual-row {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: 10px 16px;\n}\n.auth-remote-manual-copy {\n flex: 1 1 180px;\n min-width: 0;\n}\n.auth-remote-security .auth-remote-manual-copy p {\n margin: 4px 0 0;\n}\n.auth-remote-switch {\n box-sizing: border-box;\n flex: 0 0 auto;\n width: 36px;\n height: 20px;\n margin-left: auto;\n padding: 2px;\n border: 0;\n border-radius: 999px;\n corner-shape: round;\n background: var(--dsw-alias-border-l3);\n cursor: pointer;\n}\n.auth-remote-switch > span {\n display: block;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n corner-shape: round;\n background: var(--dsw-alias-switch-thumb, var(--dsw-alias-label-primary-foreground));\n transition: transform 120ms ease;\n}\n.auth-remote-switch[aria-checked='true'] {\n background: var(--dsw-alias-brand-primary);\n}\n.auth-remote-switch[aria-checked='true'] > span {\n transform: translateX(16px);\n background: var(--dsw-alias-label-primary-foreground);\n}\n.auth-remote-switch:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n.auth-remote-switch:focus-visible,\n.auth-remote-policy-hint:focus-visible {\n outline: 2px solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline-offset: 2px;\n}\n\n.auth-remote-overview {\n margin: 12px 0 20px;\n display: grid;\n gap: 8px;\n}\n.auth-remote-overview > div {\n display: grid;\n grid-template-columns: minmax(100px, 1fr) 2fr;\n gap: 16px;\n}\n.auth-remote-overview dt {\n min-height: 22px;\n color: var(--dsw-alias-label-secondary);\n}\n.auth-remote-overview dd {\n min-height: 22px;\n margin: 0;\n overflow-wrap: anywhere;\n}\n.auth-remote-loading-status {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n.auth-remote-totp-status {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.auth-remote-policy-hint {\n display: inline-flex;\n flex: none;\n align-items: center;\n color: var(--dsw-alias-label-secondary);\n border-radius: 50%;\n cursor: help;\n}\n.auth-remote-operation-row {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: 8px 12px;\n border-top: 0.5px solid var(--dsw-alias-border-l2);\n padding: 10px 0;\n}\n.auth-remote-security .auth-remote-operation-row h3 {\n margin: 0;\n}\n.auth-remote-operation-row .auth-remote-actions {\n padding: 0;\n justify-content: flex-end;\n}\n.auth-remote-operation-row .auth-remote-button {\n min-height: 32px;\n padding: 4px 10px;\n line-height: 22px;\n}\n.auth-remote-operation-dialog {\n box-sizing: border-box;\n width: min(480px, calc(100vw - 32px));\n max-height: calc(100dvh - 32px);\n margin: auto;\n padding: 20px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-lg, 16px);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n overflow: auto;\n}\n.auth-remote-operation-dialog::backdrop {\n background: rgba(0, 0, 0, 0.45);\n}\n.auth-remote-dialog-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 16px;\n margin-bottom: 16px;\n}\n.auth-remote-dialog-header h2 {\n margin: 0;\n}\n.auth-remote-dialog-close {\n flex: none;\n width: 28px;\n min-height: 28px;\n padding: 0;\n border: 0;\n font-size: 20px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n.auth-remote-dialog-actions {\n display: flex;\n justify-content: flex-end;\n flex-wrap: wrap;\n gap: 8px;\n margin-top: 20px;\n}\n.auth-remote-operation-dialog fieldset {\n border: 0;\n margin: 0;\n padding: 0;\n min-width: 0;\n}\n.auth-remote-operation-dialog form {\n border: 0;\n padding: 0;\n}\n@media (max-width: 600px) {\n .auth-remote-overview > div {\n grid-template-columns: 1fr;\n gap: 4px;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .auth-remote-switch > span {\n transition: none;\n }\n}\n";
|
|
5278
|
+
|
|
5279
|
+
// src/client/account/style.css
|
|
5280
|
+
var style_default2 = "/* Match DSH's account modal typography and shared control/surface tokens. */\n.auth-remote-account-dialog {\n box-sizing: border-box;\n width: min(480px, calc(100vw - 32px));\n max-height: calc(100dvh - 32px);\n margin: auto;\n padding: 0;\n overflow: hidden;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-lg, 16px);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n font-family: var(--dsw-font-family);\n font-size: 14px;\n line-height: 22px;\n}\n.auth-remote-account-dialog::backdrop {\n background: rgba(0, 0, 0, 0.45);\n}\n.auth-remote-account-dialog form {\n display: flex;\n flex-direction: column;\n max-height: inherit;\n margin: 0;\n}\n.auth-remote-account-header {\n display: flex;\n flex: none;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n padding: 20px 20px 16px;\n}\n.auth-remote-account-header h2 {\n margin: 0;\n font-size: 16px;\n font-weight: 500;\n line-height: 24px;\n}\n.auth-remote-account-dialog button {\n font: inherit;\n cursor: pointer;\n}\n.auth-remote-account-dialog .auth-remote-account-close {\n box-sizing: border-box;\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n border: 0;\n border-radius: var(--dsw-radius-md, 8px);\n background: transparent;\n color: var(--dsw-alias-label-secondary);\n font-size: 20px;\n line-height: 20px;\n}\n.auth-remote-account-close:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n.auth-remote-account-body {\n display: flex;\n flex-direction: column;\n gap: 12px;\n min-height: 0;\n padding: 0 20px;\n overflow-y: auto;\n}\n.auth-remote-account-steps,\n.auth-remote-account-hint,\n.auth-remote-account-reopen,\n.auth-remote-account-status,\n.auth-remote-account-error {\n margin: 0;\n font: inherit;\n}\n.auth-remote-account-hint,\n.auth-remote-account-status {\n color: var(--dsw-alias-label-secondary);\n}\n.auth-remote-account-steps {\n padding-left: 20px;\n}\n.auth-remote-account-steps li + li {\n margin-top: 4px;\n}\n.auth-remote-account-callback,\n.auth-remote-account-field {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n.auth-remote-account-field textarea {\n box-sizing: border-box;\n width: 100%;\n min-height: 72px;\n resize: vertical;\n padding: 8px 10px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-md, 8px);\n background: var(--dsw-alias-bg-layer-1);\n color: inherit;\n font: inherit;\n overflow-wrap: anywhere;\n}\n.auth-remote-account-field textarea::placeholder {\n color: var(--dsw-alias-label-secondary);\n opacity: 1;\n}\n.auth-remote-account-field textarea:focus {\n border-color: var(--dsw-alias-state-business-primary);\n}\n.auth-remote-account-hint {\n font-size: 13px;\n line-height: 20px;\n}\n.auth-remote-account-dialog a {\n color: var(--dsw-alias-link);\n font-weight: 500;\n text-decoration: none;\n}\n.auth-remote-account-dialog a:hover,\n.auth-remote-account-dialog a:focus-visible {\n text-decoration: underline dotted;\n text-underline-offset: 3px;\n}\n.auth-remote-account-error {\n color: var(--dsw-alias-state-error-primary);\n}\n.auth-remote-account-status:empty,\n.auth-remote-account-error:empty {\n display: none;\n}\n.auth-remote-account-actions {\n display: flex;\n flex: none;\n justify-content: flex-end;\n align-items: center;\n gap: 8px;\n padding: 16px 20px 20px;\n}\n.auth-remote-account-actions button {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 72px;\n height: 36px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-md, 18px);\n padding: 0 14px;\n background: transparent;\n color: inherit;\n}\n.auth-remote-account-actions button:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n.auth-remote-account-actions .auth-remote-account-primary {\n padding: 0 16px;\n background: var(--dsw-alias-button-primary-fill);\n border-color: transparent;\n color: var(--dsw-alias-label-primary-foreground);\n font-weight: 500;\n}\n.auth-remote-account-actions .auth-remote-account-primary:hover:not(:disabled) {\n background: var(--dsw-alias-button-primary-hover);\n}\n.auth-remote-account-dialog :disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n.auth-remote-account-dialog :focus-visible {\n outline: 2px solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline-offset: 2px;\n}\n@media (max-width: 480px) {\n .auth-remote-account-actions {\n flex-wrap: wrap;\n }\n .auth-remote-account-actions button {\n flex: 1;\n min-width: max-content;\n padding: 0 12px;\n white-space: nowrap;\n }\n}\n";
|
|
5281
|
+
|
|
5282
|
+
// src/shared/account-login.ts
|
|
5283
|
+
var import_semver = __toESM(require_semver2(), 1);
|
|
5284
|
+
var ACCOUNT_LOGIN_BASE = "/auth-remote/account";
|
|
5285
|
+
var ACCOUNT_LOGIN_CAPABILITY = "__DSH_AUTH_REMOTE_MANUAL_ACCOUNT_LOGIN__";
|
|
5286
|
+
function isActiveAccountLogin(phase) {
|
|
5287
|
+
return ["initializing", "waiting-browser", "exchanging", "committing"].includes(phase);
|
|
5288
|
+
}
|
|
5289
|
+
|
|
5290
|
+
// src/client/account/config.ts
|
|
5291
|
+
function manualAccountBinding(ctx) {
|
|
5292
|
+
const forms = ctx.get("configForms");
|
|
5293
|
+
const form = forms?.get("auth-remote");
|
|
5294
|
+
const mirror = forms?.describe();
|
|
5295
|
+
return {
|
|
5296
|
+
...form ? { form } : {},
|
|
5297
|
+
...mirror ? { mirror } : {},
|
|
5298
|
+
async refresh() {
|
|
5299
|
+
if (!mirror || !form) return false;
|
|
5300
|
+
if (!mirror.getSnapshot().view) {
|
|
5301
|
+
await mirror.ensure();
|
|
5302
|
+
return form.getSnapshot().status === "ready";
|
|
5303
|
+
}
|
|
5304
|
+
const remote = ctx.get("remote");
|
|
5305
|
+
const result = await remote?.settings?.describe();
|
|
5306
|
+
const view = result?.ok && result.value?.namespaces.find((view2) => view2.ns === "auth-remote");
|
|
5307
|
+
if (!view) return false;
|
|
5308
|
+
mirror.acceptView(view);
|
|
5309
|
+
return true;
|
|
5310
|
+
}
|
|
5311
|
+
};
|
|
5312
|
+
}
|
|
5313
|
+
function hasManualAccountRuntime() {
|
|
5314
|
+
return globalThis[ACCOUNT_LOGIN_CAPABILITY] === true;
|
|
5315
|
+
}
|
|
5316
|
+
|
|
5317
|
+
// src/client/settings/manual-account-setting.tsx
|
|
5318
|
+
var import_react4 = require("react");
|
|
5319
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5320
|
+
var unavailable = {
|
|
5321
|
+
status: "unavailable",
|
|
5322
|
+
value: void 0,
|
|
5323
|
+
base: void 0,
|
|
5324
|
+
user: void 0,
|
|
5325
|
+
revision: void 0,
|
|
5326
|
+
writable: false
|
|
5327
|
+
};
|
|
5328
|
+
function ManualAccountSetting({
|
|
5329
|
+
binding,
|
|
5330
|
+
t,
|
|
5331
|
+
clientAvailable
|
|
5332
|
+
}) {
|
|
5333
|
+
const form = binding.form;
|
|
5334
|
+
const snapshot = (0, import_react4.useSyncExternalStore)(
|
|
5335
|
+
(listener) => form?.subscribe(listener) ?? (() => {
|
|
5336
|
+
}),
|
|
5337
|
+
() => form?.getSnapshot() ?? unavailable
|
|
5338
|
+
);
|
|
5339
|
+
const mirrorError = (0, import_react4.useSyncExternalStore)(
|
|
5340
|
+
(listener) => binding.mirror?.subscribe(listener) ?? (() => {
|
|
5341
|
+
}),
|
|
5342
|
+
() => binding.mirror?.getSnapshot().error ?? null
|
|
5343
|
+
);
|
|
5344
|
+
const [supported, setSupported] = (0, import_react4.useState)(
|
|
5345
|
+
hasManualAccountRuntime() ? void 0 : false
|
|
5346
|
+
);
|
|
5347
|
+
const [pending, setPending] = (0, import_react4.useState)(null);
|
|
5348
|
+
const saving = (0, import_react4.useRef)(false);
|
|
5349
|
+
const [failed, setFailed] = (0, import_react4.useState)(false);
|
|
5350
|
+
const [known, setKnown] = (0, import_react4.useState)(true);
|
|
5351
|
+
(0, import_react4.useEffect)(() => {
|
|
5352
|
+
let live = true;
|
|
5353
|
+
void authRequest("/auth-remote/account/state").then(
|
|
5354
|
+
(value) => {
|
|
5355
|
+
if (live) setSupported(value.supported);
|
|
5356
|
+
},
|
|
5357
|
+
() => {
|
|
5358
|
+
if (live) setSupported(false);
|
|
5359
|
+
}
|
|
5360
|
+
);
|
|
5361
|
+
return () => {
|
|
5362
|
+
live = false;
|
|
5363
|
+
};
|
|
5364
|
+
}, []);
|
|
5365
|
+
const ready = known && snapshot.status === "ready" && typeof snapshot.value?.manualAccountLogin === "boolean";
|
|
5366
|
+
const available = supported === true && clientAvailable;
|
|
5367
|
+
async function save(value) {
|
|
5368
|
+
if (!form || !ready || saving.current) return;
|
|
5369
|
+
saving.current = true;
|
|
5370
|
+
setPending({ previous: snapshot.value.manualAccountLogin });
|
|
5371
|
+
setFailed(false);
|
|
5372
|
+
try {
|
|
5373
|
+
if (!await form.set("manualAccountLogin", value)) setFailed(true);
|
|
5374
|
+
} catch {
|
|
5375
|
+
setFailed(true);
|
|
5376
|
+
setKnown(false);
|
|
5377
|
+
try {
|
|
5378
|
+
setKnown(await binding.refresh());
|
|
5379
|
+
} catch {
|
|
5380
|
+
}
|
|
5381
|
+
} finally {
|
|
5382
|
+
saving.current = false;
|
|
5383
|
+
setPending(null);
|
|
5384
|
+
}
|
|
5385
|
+
}
|
|
5386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "auth-remote-manual-setting", children: [
|
|
5387
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { children: t("settingsLoginConfiguration") }),
|
|
5388
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "auth-remote-manual-row", children: [
|
|
5389
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "auth-remote-manual-copy", children: [
|
|
5390
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { id: "auth-remote-manual-label", children: t("settingsManualAccountLogin") }),
|
|
5391
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { id: "auth-remote-manual-description", children: t("settingsManualDescription") })
|
|
5392
|
+
] }),
|
|
5393
|
+
ready && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
5394
|
+
"button",
|
|
5395
|
+
{
|
|
5396
|
+
type: "button",
|
|
5397
|
+
role: "switch",
|
|
5398
|
+
className: "auth-remote-switch",
|
|
5399
|
+
"aria-labelledby": "auth-remote-manual-label",
|
|
5400
|
+
"aria-describedby": "auth-remote-manual-description",
|
|
5401
|
+
"aria-checked": pending?.previous ?? snapshot.value.manualAccountLogin,
|
|
5402
|
+
disabled: pending !== null || !snapshot.writable || !available,
|
|
5403
|
+
onClick: () => {
|
|
5404
|
+
void save(!snapshot.value.manualAccountLogin);
|
|
5405
|
+
},
|
|
5406
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-hidden": "true" })
|
|
5407
|
+
}
|
|
5408
|
+
)
|
|
5409
|
+
] }),
|
|
5410
|
+
!ready && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { role: "status", children: t(
|
|
5411
|
+
snapshot.status === "loading" && !mirrorError ? "settingsLoading" : "settingsManualConfigUnavailable"
|
|
5412
|
+
) }),
|
|
5413
|
+
(supported === false || !clientAvailable) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { role: "status", children: t("settingsManualUnavailable") }),
|
|
5414
|
+
pending && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { role: "status", children: t("settingsSaving") }),
|
|
5415
|
+
failed && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { role: "alert", children: t("settingsManualSaveFailed") }),
|
|
5416
|
+
(!known || !ready) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
5417
|
+
"button",
|
|
5418
|
+
{
|
|
5419
|
+
className: "auth-remote-button",
|
|
5420
|
+
onClick: () => {
|
|
5421
|
+
void binding.refresh().then(
|
|
5422
|
+
(value) => {
|
|
5423
|
+
setKnown(value);
|
|
5424
|
+
setFailed(!value);
|
|
5425
|
+
},
|
|
5426
|
+
() => setFailed(true)
|
|
5427
|
+
);
|
|
5428
|
+
},
|
|
5429
|
+
children: t("settingsRetry")
|
|
5430
|
+
}
|
|
5431
|
+
)
|
|
5432
|
+
] });
|
|
5433
|
+
}
|
|
5434
|
+
|
|
5435
|
+
// src/client/index.ts
|
|
5436
|
+
var import_react7 = require("react");
|
|
5437
|
+
|
|
5438
|
+
// src/client/account/index.tsx
|
|
5439
|
+
var import_react6 = require("react");
|
|
5440
|
+
|
|
5441
|
+
// src/client/account/dialog.tsx
|
|
5442
|
+
var import_react5 = require("react");
|
|
5443
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5444
|
+
function failureMessage(error) {
|
|
5445
|
+
if (!(error instanceof SettingsFailure)) return "errorNetwork";
|
|
5446
|
+
switch (error.code) {
|
|
5447
|
+
case "account_invalid_callback":
|
|
5448
|
+
return "accountLoginInvalidCallback";
|
|
5449
|
+
case "account_attempt_expired":
|
|
5450
|
+
return "accountLoginExpired";
|
|
5451
|
+
case "account_attempt_mismatch":
|
|
5452
|
+
return "accountLoginMismatch";
|
|
5453
|
+
case "account_busy":
|
|
5454
|
+
return "accountLoginBusy";
|
|
5455
|
+
case "account_disabled":
|
|
5456
|
+
return "accountLoginDisabled";
|
|
5457
|
+
case "account_unavailable":
|
|
5458
|
+
return "accountLoginUnavailable";
|
|
5459
|
+
case "account_exchange_failed":
|
|
5460
|
+
return "accountLoginFailed";
|
|
5461
|
+
default:
|
|
5462
|
+
return "errorServiceUnavailable";
|
|
5463
|
+
}
|
|
5464
|
+
}
|
|
5465
|
+
function ManualSignInDialog({
|
|
5466
|
+
t,
|
|
5467
|
+
locale,
|
|
5468
|
+
close,
|
|
5469
|
+
useApiKey
|
|
5470
|
+
}) {
|
|
5471
|
+
const dialog = (0, import_react5.useRef)(null);
|
|
5472
|
+
const popup = (0, import_react5.useRef)(null);
|
|
5473
|
+
const navigated = (0, import_react5.useRef)();
|
|
5474
|
+
const latest = (0, import_react5.useRef)();
|
|
5475
|
+
const live = (0, import_react5.useRef)(true);
|
|
5476
|
+
const revision = (0, import_react5.useRef)(0);
|
|
5477
|
+
const onClose = (0, import_react5.useRef)(close);
|
|
5478
|
+
onClose.current = close;
|
|
5479
|
+
const [state, setState] = (0, import_react5.useState)();
|
|
5480
|
+
const [callbackUrl, setCallbackUrl] = (0, import_react5.useState)("");
|
|
5481
|
+
const [busy, setBusy] = (0, import_react5.useState)(false);
|
|
5482
|
+
const [message, setMessage] = (0, import_react5.useState)();
|
|
5483
|
+
const [blocked, setBlocked] = (0, import_react5.useState)(false);
|
|
5484
|
+
const accept = (value) => {
|
|
5485
|
+
latest.current = value;
|
|
5486
|
+
if (!live.current) return;
|
|
5487
|
+
setState(value);
|
|
5488
|
+
if (value.status === "credential-stored") {
|
|
5489
|
+
setCallbackUrl("");
|
|
5490
|
+
onClose.current();
|
|
5491
|
+
return;
|
|
5492
|
+
}
|
|
5493
|
+
const attempt2 = value.attempt;
|
|
5494
|
+
if (attempt2?.authorizeUrl && navigated.current !== attempt2.id && popup.current && !popup.current.closed) {
|
|
5495
|
+
const target = new URL(attempt2.authorizeUrl);
|
|
5496
|
+
target.searchParams.set(
|
|
5497
|
+
"theme",
|
|
5498
|
+
document.body.hasAttribute("data-ds-dark-theme") ? "dark" : "light"
|
|
5499
|
+
);
|
|
5500
|
+
popup.current.location.replace(target.href);
|
|
5501
|
+
navigated.current = attempt2.id;
|
|
5502
|
+
}
|
|
5503
|
+
};
|
|
5504
|
+
(0, import_react5.useEffect)(() => {
|
|
5505
|
+
live.current = true;
|
|
5506
|
+
dialog.current?.showModal();
|
|
5507
|
+
let timer;
|
|
5508
|
+
const poll = async () => {
|
|
5509
|
+
const generation = revision.current;
|
|
5510
|
+
try {
|
|
5511
|
+
const value = await authRequest(`${ACCOUNT_LOGIN_BASE}/state`);
|
|
5512
|
+
if (generation === revision.current) accept(value);
|
|
5513
|
+
} catch (error) {
|
|
5514
|
+
if (isUnauthorized(error)) goToLogin();
|
|
5515
|
+
else if (live.current) setMessage(failureMessage(error));
|
|
5516
|
+
}
|
|
5517
|
+
if (live.current) timer = setTimeout(() => void poll(), 1e3);
|
|
5518
|
+
};
|
|
5519
|
+
void poll();
|
|
5520
|
+
return () => {
|
|
5521
|
+
live.current = false;
|
|
5522
|
+
clearTimeout(timer);
|
|
5523
|
+
popup.current?.close();
|
|
5524
|
+
const attempt2 = latest.current?.attempt;
|
|
5525
|
+
if (attempt2 && isActiveAccountLogin(attempt2.phase))
|
|
5526
|
+
void authRequest(`${ACCOUNT_LOGIN_BASE}/cancel`, { id: attempt2.id }).catch(() => {
|
|
5527
|
+
});
|
|
5528
|
+
};
|
|
5529
|
+
}, []);
|
|
5530
|
+
const attempt = state?.attempt;
|
|
5531
|
+
const phase = attempt?.phase;
|
|
5532
|
+
const waiting = phase === "waiting-browser";
|
|
5533
|
+
const pending = phase === "initializing" || phase === "exchanging" || phase === "committing";
|
|
5534
|
+
const active = attempt && isActiveAccountLogin(attempt.phase);
|
|
5535
|
+
const statusMessage = phase === "expired" ? "accountLoginExpired" : phase === "failed" ? attempt?.errorCode === "no-response" ? "accountLoginNoResponse" : "accountLoginFailed" : void 0;
|
|
5536
|
+
async function run(operation) {
|
|
5537
|
+
if (busy) return;
|
|
5538
|
+
setBusy(true);
|
|
5539
|
+
revision.current++;
|
|
5540
|
+
setMessage(void 0);
|
|
5541
|
+
try {
|
|
5542
|
+
await operation();
|
|
5543
|
+
} catch (error) {
|
|
5544
|
+
if (isUnauthorized(error)) goToLogin();
|
|
5545
|
+
else if (live.current) setMessage(failureMessage(error));
|
|
5546
|
+
} finally {
|
|
5547
|
+
if (live.current) setBusy(false);
|
|
5548
|
+
}
|
|
5549
|
+
}
|
|
5550
|
+
function start() {
|
|
5551
|
+
popup.current?.close();
|
|
5552
|
+
popup.current = window.open("about:blank", "_blank");
|
|
5553
|
+
if (popup.current) popup.current.opener = null;
|
|
5554
|
+
setBlocked(popup.current === null);
|
|
5555
|
+
navigated.current = void 0;
|
|
5556
|
+
setCallbackUrl("");
|
|
5557
|
+
void run(async () => {
|
|
5558
|
+
try {
|
|
5559
|
+
accept(
|
|
5560
|
+
await authRequest(`${ACCOUNT_LOGIN_BASE}/start`, {
|
|
5561
|
+
locale: locale(),
|
|
5562
|
+
timezoneOffsetSeconds: -(/* @__PURE__ */ new Date()).getTimezoneOffset() * 60
|
|
5563
|
+
})
|
|
5564
|
+
);
|
|
5565
|
+
} catch (error) {
|
|
5566
|
+
popup.current?.close();
|
|
5567
|
+
throw error;
|
|
5568
|
+
}
|
|
5569
|
+
});
|
|
5570
|
+
}
|
|
5571
|
+
function dismiss() {
|
|
5572
|
+
if (busy || phase === "committing") return;
|
|
5573
|
+
void run(async () => {
|
|
5574
|
+
if (active) await authRequest(`${ACCOUNT_LOGIN_BASE}/cancel`, { id: attempt.id });
|
|
5575
|
+
setCallbackUrl("");
|
|
5576
|
+
onClose.current();
|
|
5577
|
+
});
|
|
5578
|
+
}
|
|
5579
|
+
function submit(event) {
|
|
5580
|
+
event.preventDefault();
|
|
5581
|
+
if (!waiting || !attempt) return;
|
|
5582
|
+
void run(async () => {
|
|
5583
|
+
accept(
|
|
5584
|
+
await authRequest(`${ACCOUNT_LOGIN_BASE}/submit`, {
|
|
5585
|
+
id: attempt.id,
|
|
5586
|
+
callbackUrl
|
|
5587
|
+
})
|
|
5588
|
+
);
|
|
5589
|
+
});
|
|
5590
|
+
}
|
|
5591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5592
|
+
"dialog",
|
|
5593
|
+
{
|
|
5594
|
+
ref: dialog,
|
|
5595
|
+
className: "auth-remote-account-dialog",
|
|
5596
|
+
"aria-labelledby": "auth-remote-account-title",
|
|
5597
|
+
onCancel: (event) => {
|
|
5598
|
+
event.preventDefault();
|
|
5599
|
+
dismiss();
|
|
5600
|
+
},
|
|
5601
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("form", { onSubmit: submit, children: [
|
|
5602
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "auth-remote-account-header", children: [
|
|
5603
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { id: "auth-remote-account-title", children: t("accountLoginTitle") }),
|
|
5604
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5605
|
+
"button",
|
|
5606
|
+
{
|
|
5607
|
+
type: "button",
|
|
5608
|
+
className: "auth-remote-account-close",
|
|
5609
|
+
"aria-label": t("accountLoginClose"),
|
|
5610
|
+
disabled: busy || phase === "committing",
|
|
5611
|
+
onClick: dismiss,
|
|
5612
|
+
children: "\xD7"
|
|
5613
|
+
}
|
|
5614
|
+
)
|
|
5615
|
+
] }),
|
|
5616
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "auth-remote-account-body", children: [
|
|
5617
|
+
!active && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("ol", { className: "auth-remote-account-steps", children: [
|
|
5618
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("li", { children: t("accountLoginStepOpen") }),
|
|
5619
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("li", { children: t("accountLoginStepCopy") })
|
|
5620
|
+
] }),
|
|
5621
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "auth-remote-account-callback", children: [
|
|
5622
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "auth-remote-account-field", children: [
|
|
5623
|
+
t("accountLoginCallbackLabel"),
|
|
5624
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5625
|
+
"textarea",
|
|
5626
|
+
{
|
|
5627
|
+
rows: 3,
|
|
5628
|
+
value: callbackUrl,
|
|
5629
|
+
onChange: (event) => setCallbackUrl(event.currentTarget.value),
|
|
5630
|
+
placeholder: "http://127.0.0.1:49183/oauth/callback?code=\u2026&state=\u2026",
|
|
5631
|
+
autoComplete: "off",
|
|
5632
|
+
autoCapitalize: "none",
|
|
5633
|
+
spellCheck: false,
|
|
5634
|
+
maxLength: 8192,
|
|
5635
|
+
disabled: !waiting || busy,
|
|
5636
|
+
required: true,
|
|
5637
|
+
"aria-describedby": "auth-remote-account-hint"
|
|
5638
|
+
}
|
|
5639
|
+
)
|
|
5640
|
+
] }),
|
|
5641
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { id: "auth-remote-account-hint", className: "auth-remote-account-hint", children: t("accountLoginCallbackHint") })
|
|
5642
|
+
] }),
|
|
5643
|
+
attempt?.authorizeUrl && waiting && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { className: "auth-remote-account-reopen", children: [
|
|
5644
|
+
blocked && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
|
|
5645
|
+
t("accountLoginPopupBlocked"),
|
|
5646
|
+
" "
|
|
5647
|
+
] }),
|
|
5648
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("a", { href: attempt.authorizeUrl, target: "_blank", rel: "noopener noreferrer", children: t("accountLoginReopen") })
|
|
5649
|
+
] }),
|
|
5650
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "auth-remote-account-status", role: "status", "aria-live": "polite", children: pending ? t(phase === "initializing" ? "accountLoginInitializing" : "accountLoginExchanging") : waiting ? t("accountLoginWaiting") : "" }),
|
|
5651
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "auth-remote-account-error", role: "alert", children: state?.supported === false ? t("accountLoginUnavailable") : state?.enabled === false && !active ? t("accountLoginDisabled") : message || statusMessage ? t(message ?? statusMessage) : "" })
|
|
5652
|
+
] }),
|
|
5653
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "auth-remote-account-actions", children: [
|
|
5654
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5655
|
+
"button",
|
|
5656
|
+
{
|
|
5657
|
+
type: "button",
|
|
5658
|
+
disabled: busy || phase === "committing",
|
|
5659
|
+
onClick: active || !useApiKey ? dismiss : useApiKey,
|
|
5660
|
+
children: t(active || !useApiKey ? "accountLoginCancel" : "accountLoginUseApiKey")
|
|
5661
|
+
}
|
|
5662
|
+
),
|
|
5663
|
+
active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5664
|
+
"button",
|
|
5665
|
+
{
|
|
5666
|
+
type: "submit",
|
|
5667
|
+
className: "auth-remote-account-primary",
|
|
5668
|
+
disabled: busy || !waiting || !callbackUrl.trim(),
|
|
5669
|
+
children: t(
|
|
5670
|
+
busy || phase === "exchanging" || phase === "committing" ? "accountLoginExchanging" : "accountLoginConfirm"
|
|
5671
|
+
)
|
|
5672
|
+
}
|
|
5673
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5674
|
+
"button",
|
|
5675
|
+
{
|
|
5676
|
+
type: "button",
|
|
5677
|
+
className: "auth-remote-account-primary",
|
|
5678
|
+
onClick: start,
|
|
5679
|
+
disabled: busy || !state?.supported,
|
|
5680
|
+
children: t(attempt ? "accountLoginRetry" : "accountLoginOpen")
|
|
5681
|
+
}
|
|
5682
|
+
)
|
|
5683
|
+
] })
|
|
5684
|
+
] })
|
|
5685
|
+
}
|
|
5686
|
+
);
|
|
5687
|
+
}
|
|
5688
|
+
|
|
5689
|
+
// src/client/account/index.tsx
|
|
5690
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
5691
|
+
function hasManualAccountClient(ctx, requireEntry = true) {
|
|
5692
|
+
const slots = ctx.get("slots");
|
|
5693
|
+
return hasManualAccountRuntime() && !!slots && ["entries", "subscribe", "inject", "register"].every(
|
|
5694
|
+
(key) => typeof slots[key] === "function"
|
|
5695
|
+
) && (!requireEntry || slots.entries("settings.launcher").some((entry) => entry.locale === "settings.account" && typeof entry.inject === "function"));
|
|
5696
|
+
}
|
|
5697
|
+
function installManualAccountLogin(ctx) {
|
|
5698
|
+
if (!hasManualAccountClient(ctx, false)) return;
|
|
5699
|
+
const slots = ctx.get("slots");
|
|
5700
|
+
const t = ctx.locale.bind("auth-remote");
|
|
5701
|
+
const locale = () => ctx.locale.getSnapshot().active;
|
|
5702
|
+
let dialog;
|
|
5703
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
5704
|
+
const completions = /* @__PURE__ */ new Set();
|
|
5705
|
+
const notify = () => {
|
|
5706
|
+
for (const listener of listeners) listener();
|
|
5707
|
+
};
|
|
5708
|
+
const show = (owner = {}) => {
|
|
5709
|
+
if (owner.complete) completions.add(owner.complete);
|
|
5710
|
+
dialog = owner;
|
|
5711
|
+
notify();
|
|
5712
|
+
};
|
|
5713
|
+
const close = () => {
|
|
5714
|
+
dialog = void 0;
|
|
5715
|
+
const pending = [...completions];
|
|
5716
|
+
completions.clear();
|
|
5717
|
+
notify();
|
|
5718
|
+
for (const complete of pending) complete();
|
|
5719
|
+
};
|
|
5720
|
+
const useApiKey = () => {
|
|
5721
|
+
const action = dialog?.useApiKey;
|
|
5722
|
+
if (!action) return;
|
|
5723
|
+
dialog = void 0;
|
|
5724
|
+
completions.clear();
|
|
5725
|
+
notify();
|
|
5726
|
+
action();
|
|
5727
|
+
};
|
|
5728
|
+
const subscribe = (listener) => {
|
|
5729
|
+
listeners.add(listener);
|
|
5730
|
+
return () => {
|
|
5731
|
+
listeners.delete(listener);
|
|
5732
|
+
};
|
|
5733
|
+
};
|
|
5734
|
+
function AccountOverlay() {
|
|
5735
|
+
const owner = (0, import_react6.useSyncExternalStore)(subscribe, () => dialog);
|
|
5736
|
+
return owner ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5737
|
+
ManualSignInDialog,
|
|
5738
|
+
{
|
|
5739
|
+
t,
|
|
5740
|
+
locale,
|
|
5741
|
+
close,
|
|
5742
|
+
...owner.useApiKey ? { useApiKey } : {}
|
|
5743
|
+
}
|
|
5744
|
+
) : null;
|
|
5745
|
+
}
|
|
5746
|
+
slots.inject(
|
|
5747
|
+
"shell.overlay",
|
|
5748
|
+
() => slots.register(
|
|
5749
|
+
{
|
|
5750
|
+
name: "shell.overlay",
|
|
5751
|
+
id: "auth-remote.account-sign-in",
|
|
5752
|
+
locale: "auth-remote"
|
|
5753
|
+
},
|
|
5754
|
+
AccountOverlay
|
|
5755
|
+
)
|
|
5756
|
+
);
|
|
5757
|
+
ctx.inject(["configForms"], (configCtx) => {
|
|
5758
|
+
const { form: nativeForm, mirror } = manualAccountBinding(configCtx);
|
|
5759
|
+
const form = nativeForm;
|
|
5760
|
+
const subscribePreference = (listener) => {
|
|
5761
|
+
const stopForm = form.subscribe(listener);
|
|
5762
|
+
const stopMirror = mirror?.subscribe(listener);
|
|
5763
|
+
return () => {
|
|
5764
|
+
stopForm();
|
|
5765
|
+
stopMirror?.();
|
|
5766
|
+
};
|
|
5767
|
+
};
|
|
5768
|
+
const preference = () => {
|
|
5769
|
+
const snapshot = form.getSnapshot();
|
|
5770
|
+
return snapshot.status === "ready" ? snapshot.value?.manualAccountLogin === true : snapshot.status === "unavailable" || mirror?.getSnapshot().error ? false : void 0;
|
|
5771
|
+
};
|
|
5772
|
+
const wrappers = /* @__PURE__ */ new WeakSet();
|
|
5773
|
+
for (const name2 of ["settings.launcher", "settings.models.sign-in"]) {
|
|
5774
|
+
const activeSlots = configCtx.get("slots");
|
|
5775
|
+
activeSlots.inject(name2, () => {
|
|
5776
|
+
let current;
|
|
5777
|
+
let unregister;
|
|
5778
|
+
const update = () => {
|
|
5779
|
+
const native = slots.entries(name2).find(
|
|
5780
|
+
(entry) => entry.locale === "settings.account" && entry.inject !== void 0 && !wrappers.has(entry.component)
|
|
5781
|
+
);
|
|
5782
|
+
if (native === current) return;
|
|
5783
|
+
current = native;
|
|
5784
|
+
unregister?.();
|
|
5785
|
+
unregister = void 0;
|
|
5786
|
+
if (!native) return;
|
|
5787
|
+
const Native = native.component;
|
|
5788
|
+
function ManualAccountEntry(props) {
|
|
5789
|
+
const latest = (0, import_react6.useRef)(props);
|
|
5790
|
+
latest.current = props;
|
|
5791
|
+
const enabled = (0, import_react6.useSyncExternalStore)(subscribePreference, preference);
|
|
5792
|
+
const initialMode = (0, import_react6.useRef)();
|
|
5793
|
+
if (initialMode.current === void 0 && enabled !== void 0)
|
|
5794
|
+
initialMode.current = enabled;
|
|
5795
|
+
const manualOnboarding = initialMode.current;
|
|
5796
|
+
(0, import_react6.useEffect)(() => {
|
|
5797
|
+
if (name2 !== "settings.launcher" && manualOnboarding === true) {
|
|
5798
|
+
const complete = () => {
|
|
5799
|
+
latest.current.showLogin?.(false);
|
|
5800
|
+
latest.current.complete?.();
|
|
5801
|
+
};
|
|
5802
|
+
const owner = {
|
|
5803
|
+
complete,
|
|
5804
|
+
...latest.current.useApiKey ? {
|
|
5805
|
+
useApiKey: () => {
|
|
5806
|
+
latest.current.showLogin?.(false);
|
|
5807
|
+
latest.current.useApiKey?.();
|
|
5808
|
+
}
|
|
5809
|
+
} : {}
|
|
5810
|
+
};
|
|
5811
|
+
show(owner);
|
|
5812
|
+
return () => {
|
|
5813
|
+
completions.delete(complete);
|
|
5814
|
+
if (dialog === owner && owner.useApiKey) {
|
|
5815
|
+
dialog = {};
|
|
5816
|
+
notify();
|
|
5817
|
+
}
|
|
5818
|
+
};
|
|
5819
|
+
}
|
|
5820
|
+
}, [manualOnboarding]);
|
|
5821
|
+
return name2 === "settings.launcher" ? (0, import_react6.createElement)(Native, {
|
|
5822
|
+
...props,
|
|
5823
|
+
start: async () => {
|
|
5824
|
+
if (preference() === void 0) await mirror?.ensure();
|
|
5825
|
+
const manual = preference();
|
|
5826
|
+
if (manual === void 0) return;
|
|
5827
|
+
if (!manual) return latest.current.start?.();
|
|
5828
|
+
show(
|
|
5829
|
+
latest.current.openOnboarding ? {
|
|
5830
|
+
useApiKey: () => {
|
|
5831
|
+
latest.current.showLogin?.(false);
|
|
5832
|
+
latest.current.openOnboarding?.("deepseek-official");
|
|
5833
|
+
}
|
|
5834
|
+
} : {}
|
|
5835
|
+
);
|
|
5836
|
+
}
|
|
5837
|
+
}) : manualOnboarding === false ? (0, import_react6.createElement)(Native, props) : null;
|
|
5838
|
+
}
|
|
5839
|
+
wrappers.add(ManualAccountEntry);
|
|
5840
|
+
unregister = slots.register(
|
|
5841
|
+
{
|
|
5842
|
+
name: name2,
|
|
5843
|
+
priority: (native.options.priority ?? 0) - 100,
|
|
5844
|
+
// Framework still binds the native menu's translations and Hooks.
|
|
5845
|
+
...native.locale ? { locale: native.locale } : {},
|
|
5846
|
+
inject: native.inject
|
|
5847
|
+
},
|
|
5848
|
+
ManualAccountEntry
|
|
5849
|
+
);
|
|
5850
|
+
};
|
|
5851
|
+
const stop = slots.subscribe(name2, update);
|
|
5852
|
+
update();
|
|
5853
|
+
return () => {
|
|
5854
|
+
stop();
|
|
5855
|
+
unregister?.();
|
|
5856
|
+
};
|
|
5857
|
+
});
|
|
5858
|
+
}
|
|
5859
|
+
});
|
|
5860
|
+
}
|
|
3115
5861
|
|
|
3116
5862
|
// src/client/index.ts
|
|
3117
5863
|
var name = "auth-remote";
|
|
3118
|
-
var inject = ["connection", "slots", "locale"];
|
|
5864
|
+
var inject = ["connection", "slots", "locale", "remote.settings"];
|
|
3119
5865
|
function apply(ctx) {
|
|
3120
5866
|
assertRemoteHostCapability(ctx);
|
|
3121
5867
|
ctx.effect(() => {
|
|
3122
5868
|
const tag = document.createElement("style");
|
|
3123
5869
|
tag.dataset.plugin = "dsh-auth-remote";
|
|
3124
|
-
tag.textContent = style_default;
|
|
5870
|
+
tag.textContent = style_default + style_default2;
|
|
3125
5871
|
document.head.appendChild(tag);
|
|
3126
5872
|
return () => tag.remove();
|
|
3127
5873
|
}, "auth-remote: settings styles");
|
|
3128
5874
|
monitorSession(ctx);
|
|
3129
5875
|
ctx.effect(() => ctx.locale.register("auth-remote", { en, zh }), "auth-remote: dictionaries");
|
|
3130
5876
|
const t = ctx.locale.bind("auth-remote");
|
|
5877
|
+
installManualAccountLogin(ctx);
|
|
3131
5878
|
const slots = ctx.get("slots");
|
|
3132
5879
|
slots.inject(
|
|
3133
5880
|
"settings.section",
|
|
@@ -3139,7 +5886,15 @@ function apply(ctx) {
|
|
|
3139
5886
|
locale: "auth-remote",
|
|
3140
5887
|
label: () => t("settingsSectionLabel")
|
|
3141
5888
|
},
|
|
3142
|
-
SecuritySection
|
|
5889
|
+
(props) => (0, import_react7.createElement)(SecuritySection, {
|
|
5890
|
+
...props,
|
|
5891
|
+
locale: ctx.locale.getSnapshot().active,
|
|
5892
|
+
manualAccountSetting: (0, import_react7.createElement)(ManualAccountSetting, {
|
|
5893
|
+
binding: manualAccountBinding(ctx),
|
|
5894
|
+
t,
|
|
5895
|
+
clientAvailable: hasManualAccountClient(ctx)
|
|
5896
|
+
})
|
|
5897
|
+
})
|
|
3143
5898
|
)
|
|
3144
5899
|
);
|
|
3145
5900
|
}
|