@kevisual/cli 0.0.54 → 0.0.56
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/dist/assistant-server.js +14312 -382
- package/dist/assistant.js +1506 -185
- package/dist/envision.mjs +244 -173
- package/package.json +11 -10
package/dist/assistant.js
CHANGED
|
@@ -43121,7 +43121,7 @@ var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
|
43121
43121
|
var wss = new import_websocket_server.default({
|
|
43122
43122
|
noServer: true
|
|
43123
43123
|
});
|
|
43124
|
-
// node_modules/.pnpm/@kevisual+local-app-manager@0.1.
|
|
43124
|
+
// node_modules/.pnpm/@kevisual+local-app-manager@0.1.21_supports-color@10.0.0/node_modules/@kevisual/local-app-manager/dist/manager.mjs
|
|
43125
43125
|
var exports_manager = {};
|
|
43126
43126
|
__export(exports_manager, {
|
|
43127
43127
|
onAppShowInfo: () => onAppShowInfo,
|
|
@@ -43198,7 +43198,7 @@ var getConfigFile = (opts) => {
|
|
|
43198
43198
|
return "";
|
|
43199
43199
|
};
|
|
43200
43200
|
|
|
43201
|
-
// node_modules/.pnpm/@kevisual+local-app-manager@0.1.
|
|
43201
|
+
// node_modules/.pnpm/@kevisual+local-app-manager@0.1.21_supports-color@10.0.0/node_modules/@kevisual/local-app-manager/dist/manager.mjs
|
|
43202
43202
|
import path4 from "node:path";
|
|
43203
43203
|
import fs5 from "node:fs";
|
|
43204
43204
|
import { fork } from "node:child_process";
|
|
@@ -44171,8 +44171,6 @@ var existDenpend = [
|
|
|
44171
44171
|
"ioredis",
|
|
44172
44172
|
"socket.io",
|
|
44173
44173
|
"minio",
|
|
44174
|
-
"pino",
|
|
44175
|
-
"pino-pretty",
|
|
44176
44174
|
"@msgpack/msgpack"
|
|
44177
44175
|
];
|
|
44178
44176
|
var AppType = /* @__PURE__ */ ((AppType2) => {
|
|
@@ -44263,10 +44261,15 @@ class Manager {
|
|
|
44263
44261
|
pm2Connect: this.#pm2Connect
|
|
44264
44262
|
});
|
|
44265
44263
|
const pm2Options = app.pm2Options || {};
|
|
44264
|
+
if (app?.engine) {
|
|
44265
|
+
pm2Options.interpreter = pm2Options.interpreter || app?.engine;
|
|
44266
|
+
}
|
|
44266
44267
|
if (!pm2Options.cwd) {
|
|
44267
44268
|
pm2Options.cwd = path4.join(app.path, "../..");
|
|
44268
44269
|
}
|
|
44269
44270
|
await pm2Manager.start(pm2Options);
|
|
44271
|
+
} else {
|
|
44272
|
+
console.error("app type not support", app.type);
|
|
44270
44273
|
}
|
|
44271
44274
|
console.log(`load ${app.type} success`, app.key);
|
|
44272
44275
|
return true;
|
|
@@ -44555,7 +44558,7 @@ var clearMicroApp = (link) => {
|
|
|
44555
44558
|
console.error(`Failed to unload module ${link}:`, error);
|
|
44556
44559
|
}
|
|
44557
44560
|
};
|
|
44558
|
-
// node_modules/.pnpm/@kevisual+local-app-manager@0.1.
|
|
44561
|
+
// node_modules/.pnpm/@kevisual+local-app-manager@0.1.21_supports-color@10.0.0/node_modules/@kevisual/local-app-manager/dist/pm2.mjs
|
|
44559
44562
|
import pm22 from "pm2";
|
|
44560
44563
|
import { promisify as promisify2 } from "node:util";
|
|
44561
44564
|
var disconnect = promisify2(pm22.disconnect).bind(pm22);
|
|
@@ -61867,6 +61870,30 @@ class HttpsPem {
|
|
|
61867
61870
|
cert;
|
|
61868
61871
|
constructor(assistantConfig3) {
|
|
61869
61872
|
this.assistantConfig = assistantConfig3;
|
|
61873
|
+
this.#initKeyCert();
|
|
61874
|
+
}
|
|
61875
|
+
#initKeyCert() {
|
|
61876
|
+
this.assistantConfig.checkMounted();
|
|
61877
|
+
const config2 = this.assistantConfig.getConfig();
|
|
61878
|
+
if (config2.https) {
|
|
61879
|
+
const httpsType = config2.https?.type || "https";
|
|
61880
|
+
if (httpsType !== "https") {
|
|
61881
|
+
console.log(chalk2.yellow("当前配置文件 https.type 不是 https, 不使用证书"));
|
|
61882
|
+
return;
|
|
61883
|
+
}
|
|
61884
|
+
if (config2.https.keyPath) {
|
|
61885
|
+
const keyPath = config2.https.keyPath;
|
|
61886
|
+
const certPath = config2.https.certPath;
|
|
61887
|
+
if (checkFileExists(keyPath) && checkFileExists(certPath)) {
|
|
61888
|
+
this.key = fs8.readFileSync(keyPath, "utf-8");
|
|
61889
|
+
this.cert = fs8.readFileSync(certPath, "utf-8");
|
|
61890
|
+
console.log(chalk2.green("使用配置文件 https.keyPath 和 https.certPath 的证书"), keyPath, certPath);
|
|
61891
|
+
return;
|
|
61892
|
+
} else {
|
|
61893
|
+
console.log(chalk2.red("证书路径不存在,请检查配置文件 https.keyPath 和 https.certPath 是否正确"));
|
|
61894
|
+
}
|
|
61895
|
+
}
|
|
61896
|
+
}
|
|
61870
61897
|
const { key, cert } = this.getCert();
|
|
61871
61898
|
this.key = key;
|
|
61872
61899
|
this.cert = cert;
|
|
@@ -62105,20 +62132,27 @@ class AssistantInit extends AssistantConfig {
|
|
|
62105
62132
|
}
|
|
62106
62133
|
};
|
|
62107
62134
|
}
|
|
62135
|
+
getHttps() {
|
|
62136
|
+
const https = this.getConfig()?.https || {};
|
|
62137
|
+
return {
|
|
62138
|
+
https,
|
|
62139
|
+
protocol: https?.type === "http" ? "http" : "https"
|
|
62140
|
+
};
|
|
62141
|
+
}
|
|
62108
62142
|
}
|
|
62109
62143
|
|
|
62110
62144
|
// src/command/config-manager/index.ts
|
|
62111
62145
|
import path8 from "node:path";
|
|
62112
62146
|
import fs10 from "node:fs";
|
|
62113
62147
|
|
|
62114
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
62148
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/key.js
|
|
62115
62149
|
var isUpKey = (key) => key.name === "up" || key.name === "k" || key.ctrl && key.name === "p";
|
|
62116
62150
|
var isDownKey = (key) => key.name === "down" || key.name === "j" || key.ctrl && key.name === "n";
|
|
62117
62151
|
var isSpaceKey = (key) => key.name === "space";
|
|
62118
62152
|
var isBackspaceKey = (key) => key.name === "backspace";
|
|
62119
62153
|
var isNumberKey = (key) => "1234567890".includes(key.name);
|
|
62120
62154
|
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
62121
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
62155
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/errors.js
|
|
62122
62156
|
class AbortPromptError extends Error {
|
|
62123
62157
|
name = "AbortPromptError";
|
|
62124
62158
|
message = "Prompt was aborted";
|
|
@@ -62144,10 +62178,10 @@ class HookError extends Error {
|
|
|
62144
62178
|
class ValidationError extends Error {
|
|
62145
62179
|
name = "ValidationError";
|
|
62146
62180
|
}
|
|
62147
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
62181
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-state.js
|
|
62148
62182
|
import { AsyncResource as AsyncResource2 } from "node:async_hooks";
|
|
62149
62183
|
|
|
62150
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
62184
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/hook-engine.js
|
|
62151
62185
|
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
62152
62186
|
var hookStorage = new AsyncLocalStorage;
|
|
62153
62187
|
function createStore(rl) {
|
|
@@ -62252,25 +62286,25 @@ var effectScheduler = {
|
|
|
62252
62286
|
}
|
|
62253
62287
|
};
|
|
62254
62288
|
|
|
62255
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
62289
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-state.js
|
|
62256
62290
|
function useState(defaultValue) {
|
|
62257
62291
|
return withPointer((pointer) => {
|
|
62258
|
-
const
|
|
62292
|
+
const setState = AsyncResource2.bind(function setState(newValue) {
|
|
62259
62293
|
if (pointer.get() !== newValue) {
|
|
62260
62294
|
pointer.set(newValue);
|
|
62261
62295
|
handleChange();
|
|
62262
62296
|
}
|
|
62263
|
-
};
|
|
62297
|
+
});
|
|
62264
62298
|
if (pointer.initialized) {
|
|
62265
|
-
return [pointer.get(),
|
|
62299
|
+
return [pointer.get(), setState];
|
|
62266
62300
|
}
|
|
62267
62301
|
const value = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
62268
62302
|
pointer.set(value);
|
|
62269
|
-
return [value,
|
|
62303
|
+
return [value, setState];
|
|
62270
62304
|
});
|
|
62271
62305
|
}
|
|
62272
62306
|
|
|
62273
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
62307
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-effect.js
|
|
62274
62308
|
function useEffect(cb, depArray) {
|
|
62275
62309
|
withPointer((pointer) => {
|
|
62276
62310
|
const oldDeps = pointer.get();
|
|
@@ -62282,10 +62316,10 @@ function useEffect(cb, depArray) {
|
|
|
62282
62316
|
});
|
|
62283
62317
|
}
|
|
62284
62318
|
|
|
62285
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
62319
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/theme.js
|
|
62286
62320
|
var import_yoctocolors_cjs = __toESM(require_yoctocolors_cjs(), 1);
|
|
62287
62321
|
|
|
62288
|
-
// node_modules/.pnpm/@inquirer+figures@1.0.
|
|
62322
|
+
// node_modules/.pnpm/@inquirer+figures@1.0.12/node_modules/@inquirer/figures/dist/esm/index.js
|
|
62289
62323
|
import process5 from "node:process";
|
|
62290
62324
|
function isUnicodeSupported() {
|
|
62291
62325
|
if (process5.platform !== "win32") {
|
|
@@ -62571,7 +62605,7 @@ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
|
62571
62605
|
var esm_default = figures;
|
|
62572
62606
|
var replacements = Object.entries(specialMainSymbols);
|
|
62573
62607
|
|
|
62574
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
62608
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/theme.js
|
|
62575
62609
|
var defaultTheme = {
|
|
62576
62610
|
prefix: {
|
|
62577
62611
|
idle: import_yoctocolors_cjs.default.blue("?"),
|
|
@@ -62592,7 +62626,7 @@ var defaultTheme = {
|
|
|
62592
62626
|
}
|
|
62593
62627
|
};
|
|
62594
62628
|
|
|
62595
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
62629
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/make-theme.js
|
|
62596
62630
|
function isPlainObject2(value) {
|
|
62597
62631
|
if (typeof value !== "object" || value === null)
|
|
62598
62632
|
return false;
|
|
@@ -62620,7 +62654,7 @@ function makeTheme(...themes) {
|
|
|
62620
62654
|
return deepMerge(...themesToMerge);
|
|
62621
62655
|
}
|
|
62622
62656
|
|
|
62623
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
62657
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-prefix.js
|
|
62624
62658
|
function usePrefix({ status = "idle", theme }) {
|
|
62625
62659
|
const [showLoader, setShowLoader] = useState(false);
|
|
62626
62660
|
const [tick, setTick] = useState(0);
|
|
@@ -62629,13 +62663,13 @@ function usePrefix({ status = "idle", theme }) {
|
|
|
62629
62663
|
if (status === "loading") {
|
|
62630
62664
|
let tickInterval;
|
|
62631
62665
|
let inc = -1;
|
|
62632
|
-
const delayTimeout = setTimeout(
|
|
62666
|
+
const delayTimeout = setTimeout(() => {
|
|
62633
62667
|
setShowLoader(true);
|
|
62634
|
-
tickInterval = setInterval(
|
|
62668
|
+
tickInterval = setInterval(() => {
|
|
62635
62669
|
inc = inc + 1;
|
|
62636
62670
|
setTick(inc % spinner.frames.length);
|
|
62637
|
-
}
|
|
62638
|
-
}
|
|
62671
|
+
}, spinner.interval);
|
|
62672
|
+
}, 300);
|
|
62639
62673
|
return () => {
|
|
62640
62674
|
clearTimeout(delayTimeout);
|
|
62641
62675
|
clearInterval(tickInterval);
|
|
@@ -62650,7 +62684,7 @@ function usePrefix({ status = "idle", theme }) {
|
|
|
62650
62684
|
const iconName = status === "loading" ? "idle" : status;
|
|
62651
62685
|
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
62652
62686
|
}
|
|
62653
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
62687
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-memo.js
|
|
62654
62688
|
function useMemo(fn, dependencies) {
|
|
62655
62689
|
return withPointer((pointer) => {
|
|
62656
62690
|
const prev = pointer.get();
|
|
@@ -62662,11 +62696,11 @@ function useMemo(fn, dependencies) {
|
|
|
62662
62696
|
return prev.value;
|
|
62663
62697
|
});
|
|
62664
62698
|
}
|
|
62665
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
62699
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-ref.js
|
|
62666
62700
|
function useRef(val) {
|
|
62667
62701
|
return useState({ current: val })[0];
|
|
62668
62702
|
}
|
|
62669
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
62703
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-keypress.js
|
|
62670
62704
|
function useKeypress(userHandler) {
|
|
62671
62705
|
const signal = useRef(userHandler);
|
|
62672
62706
|
signal.current = userHandler;
|
|
@@ -62684,7 +62718,7 @@ function useKeypress(userHandler) {
|
|
|
62684
62718
|
};
|
|
62685
62719
|
}, []);
|
|
62686
62720
|
}
|
|
62687
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
62721
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/utils.js
|
|
62688
62722
|
var import_cli_width = __toESM(require_cli_width(), 1);
|
|
62689
62723
|
var import_wrap_ansi = __toESM(require_wrap_ansi(), 1);
|
|
62690
62724
|
function breakLines(content, width) {
|
|
@@ -62697,96 +62731,73 @@ function readlineWidth() {
|
|
|
62697
62731
|
return import_cli_width.default({ defaultWidth: 80, output: readline().output });
|
|
62698
62732
|
}
|
|
62699
62733
|
|
|
62700
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
62701
|
-
function
|
|
62702
|
-
|
|
62703
|
-
|
|
62704
|
-
|
|
62705
|
-
|
|
62706
|
-
const
|
|
62707
|
-
const offset = (count % max + max) % max;
|
|
62708
|
-
return [...items.slice(offset), ...items.slice(0, offset)];
|
|
62709
|
-
}
|
|
62710
|
-
function lines({ items, width, renderItem, active, position: requested, pageSize }) {
|
|
62711
|
-
const layouts = items.map((item, index) => ({
|
|
62712
|
-
item,
|
|
62713
|
-
index,
|
|
62714
|
-
isActive: index === active
|
|
62715
|
-
}));
|
|
62716
|
-
const layoutsInPage = rotate(active - requested, layouts).slice(0, pageSize);
|
|
62717
|
-
const renderItemAt = (index) => layoutsInPage[index] == null ? [] : split(renderItem(layoutsInPage[index]), width);
|
|
62718
|
-
const pageBuffer = Array.from({ length: pageSize });
|
|
62719
|
-
const activeItem = renderItemAt(requested).slice(0, pageSize);
|
|
62720
|
-
const position = requested + activeItem.length <= pageSize ? requested : pageSize - activeItem.length;
|
|
62721
|
-
pageBuffer.splice(position, activeItem.length, ...activeItem);
|
|
62722
|
-
let bufferPointer = position + activeItem.length;
|
|
62723
|
-
let layoutPointer = requested + 1;
|
|
62724
|
-
while (bufferPointer < pageSize && layoutPointer < layoutsInPage.length) {
|
|
62725
|
-
for (const line of renderItemAt(layoutPointer)) {
|
|
62726
|
-
pageBuffer[bufferPointer++] = line;
|
|
62727
|
-
if (bufferPointer >= pageSize)
|
|
62728
|
-
break;
|
|
62729
|
-
}
|
|
62730
|
-
layoutPointer++;
|
|
62731
|
-
}
|
|
62732
|
-
bufferPointer = position - 1;
|
|
62733
|
-
layoutPointer = requested - 1;
|
|
62734
|
-
while (bufferPointer >= 0 && layoutPointer >= 0) {
|
|
62735
|
-
for (const line of renderItemAt(layoutPointer).reverse()) {
|
|
62736
|
-
pageBuffer[bufferPointer--] = line;
|
|
62737
|
-
if (bufferPointer < 0)
|
|
62738
|
-
break;
|
|
62739
|
-
}
|
|
62740
|
-
layoutPointer--;
|
|
62741
|
-
}
|
|
62742
|
-
return pageBuffer.filter((line) => typeof line === "string");
|
|
62743
|
-
}
|
|
62744
|
-
|
|
62745
|
-
// node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.21/node_modules/@inquirer/core/dist/esm/lib/pagination/position.js
|
|
62746
|
-
function finite({ active, pageSize, total }) {
|
|
62734
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/pagination/use-pagination.js
|
|
62735
|
+
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
62736
|
+
const state = useRef({
|
|
62737
|
+
lastPointer: active,
|
|
62738
|
+
lastActive: undefined
|
|
62739
|
+
});
|
|
62740
|
+
const { lastPointer, lastActive } = state.current;
|
|
62747
62741
|
const middle = Math.floor(pageSize / 2);
|
|
62748
|
-
|
|
62749
|
-
|
|
62750
|
-
|
|
62751
|
-
|
|
62752
|
-
|
|
62753
|
-
|
|
62754
|
-
|
|
62755
|
-
|
|
62756
|
-
|
|
62757
|
-
|
|
62758
|
-
|
|
62742
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
62743
|
+
const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
|
|
62744
|
+
let pointer = defaultPointerPosition;
|
|
62745
|
+
if (renderedLength > pageSize) {
|
|
62746
|
+
if (loop) {
|
|
62747
|
+
pointer = lastPointer;
|
|
62748
|
+
if (lastActive != null && lastActive < active && active - lastActive < pageSize) {
|
|
62749
|
+
pointer = Math.min(middle, Math.abs(active - lastActive) === 1 ? Math.min(lastPointer + (renderedItems[lastActive]?.length ?? 0), Math.max(defaultPointerPosition, lastPointer)) : lastPointer + active - lastActive);
|
|
62750
|
+
}
|
|
62751
|
+
} else {
|
|
62752
|
+
const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
|
|
62753
|
+
pointer = spaceUnderActive < pageSize - middle ? pageSize - spaceUnderActive : Math.min(defaultPointerPosition, middle);
|
|
62754
|
+
}
|
|
62759
62755
|
}
|
|
62756
|
+
state.current.lastPointer = pointer;
|
|
62757
|
+
state.current.lastActive = active;
|
|
62760
62758
|
return pointer;
|
|
62761
62759
|
}
|
|
62762
|
-
|
|
62763
|
-
// node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.21/node_modules/@inquirer/core/dist/esm/lib/pagination/use-pagination.js
|
|
62764
62760
|
function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
62765
|
-
const
|
|
62766
|
-
const
|
|
62767
|
-
|
|
62768
|
-
|
|
62769
|
-
|
|
62770
|
-
|
|
62771
|
-
|
|
62772
|
-
}) : finite({
|
|
62773
|
-
active,
|
|
62774
|
-
total: items.length,
|
|
62775
|
-
pageSize
|
|
62761
|
+
const width = readlineWidth();
|
|
62762
|
+
const bound = (num) => (num % items.length + items.length) % items.length;
|
|
62763
|
+
const renderedItems = items.map((item, index) => {
|
|
62764
|
+
if (item == null)
|
|
62765
|
+
return [];
|
|
62766
|
+
return breakLines(renderItem({ item, index, isActive: index === active }), width).split(`
|
|
62767
|
+
`);
|
|
62776
62768
|
});
|
|
62777
|
-
|
|
62778
|
-
|
|
62779
|
-
|
|
62780
|
-
|
|
62781
|
-
|
|
62782
|
-
|
|
62783
|
-
|
|
62784
|
-
|
|
62785
|
-
|
|
62786
|
-
|
|
62769
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
62770
|
+
const renderItemAtIndex = (index) => renderedItems[index] ?? [];
|
|
62771
|
+
const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
|
|
62772
|
+
const activeItem = renderItemAtIndex(active).slice(0, pageSize);
|
|
62773
|
+
const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
|
|
62774
|
+
const pageBuffer = Array.from({ length: pageSize });
|
|
62775
|
+
pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
|
|
62776
|
+
const itemVisited = new Set([active]);
|
|
62777
|
+
let bufferPointer = activeItemPosition + activeItem.length;
|
|
62778
|
+
let itemPointer = bound(active + 1);
|
|
62779
|
+
while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
|
|
62780
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
62781
|
+
const linesToAdd = lines.slice(0, pageSize - bufferPointer);
|
|
62782
|
+
pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
|
|
62783
|
+
itemVisited.add(itemPointer);
|
|
62784
|
+
bufferPointer += linesToAdd.length;
|
|
62785
|
+
itemPointer = bound(itemPointer + 1);
|
|
62786
|
+
}
|
|
62787
|
+
bufferPointer = activeItemPosition - 1;
|
|
62788
|
+
itemPointer = bound(active - 1);
|
|
62789
|
+
while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
|
|
62790
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
62791
|
+
const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
|
|
62792
|
+
pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
|
|
62793
|
+
itemVisited.add(itemPointer);
|
|
62794
|
+
bufferPointer -= linesToAdd.length;
|
|
62795
|
+
itemPointer = bound(itemPointer - 1);
|
|
62796
|
+
}
|
|
62797
|
+
return pageBuffer.filter((line) => typeof line === "string").join(`
|
|
62787
62798
|
`);
|
|
62788
62799
|
}
|
|
62789
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
62800
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
|
|
62790
62801
|
var import_mute_stream = __toESM(require_lib(), 1);
|
|
62791
62802
|
import * as readline2 from "node:readline";
|
|
62792
62803
|
import { AsyncResource as AsyncResource3 } from "node:async_hooks";
|
|
@@ -62999,7 +63010,7 @@ var {
|
|
|
62999
63010
|
unload
|
|
63000
63011
|
} = signalExitWrap(processOk(process6) ? new SignalExit(process6) : new SignalExitFallback);
|
|
63001
63012
|
|
|
63002
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
63013
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/screen-manager.js
|
|
63003
63014
|
var import_ansi_escapes = __toESM(require_ansi_escapes(), 1);
|
|
63004
63015
|
import { stripVTControlCharacters } from "node:util";
|
|
63005
63016
|
var height = (content) => content.split(`
|
|
@@ -63069,7 +63080,7 @@ class ScreenManager {
|
|
|
63069
63080
|
}
|
|
63070
63081
|
}
|
|
63071
63082
|
|
|
63072
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
63083
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/promise-polyfill.js
|
|
63073
63084
|
class PromisePolyfill extends Promise {
|
|
63074
63085
|
static withResolver() {
|
|
63075
63086
|
let resolve;
|
|
@@ -63082,7 +63093,7 @@ class PromisePolyfill extends Promise {
|
|
|
63082
63093
|
}
|
|
63083
63094
|
}
|
|
63084
63095
|
|
|
63085
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
63096
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
|
|
63086
63097
|
function getCallSites() {
|
|
63087
63098
|
const _prepareStackTrace = Error.prepareStackTrace;
|
|
63088
63099
|
let result = [];
|
|
@@ -63168,7 +63179,7 @@ function createPrompt(view) {
|
|
|
63168
63179
|
};
|
|
63169
63180
|
return prompt;
|
|
63170
63181
|
}
|
|
63171
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
63182
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/Separator.js
|
|
63172
63183
|
var import_yoctocolors_cjs2 = __toESM(require_yoctocolors_cjs(), 1);
|
|
63173
63184
|
class Separator {
|
|
63174
63185
|
separator = import_yoctocolors_cjs2.default.dim(Array.from({ length: 15 }).join(esm_default.line));
|
|
@@ -63182,7 +63193,7 @@ class Separator {
|
|
|
63182
63193
|
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
|
63183
63194
|
}
|
|
63184
63195
|
}
|
|
63185
|
-
// node_modules/.pnpm/@inquirer+checkbox@4.1.
|
|
63196
|
+
// node_modules/.pnpm/@inquirer+checkbox@4.1.8_@types+node@22.15.29/node_modules/@inquirer/checkbox/dist/esm/index.js
|
|
63186
63197
|
var import_yoctocolors_cjs3 = __toESM(require_yoctocolors_cjs(), 1);
|
|
63187
63198
|
var import_ansi_escapes2 = __toESM(require_ansi_escapes(), 1);
|
|
63188
63199
|
var checkboxTheme = {
|
|
@@ -63356,9 +63367,8 @@ ${theme.style.error(errorMsg)}`;
|
|
|
63356
63367
|
return `${prefix} ${message}${helpTipTop}
|
|
63357
63368
|
${page}${helpTipBottom}${choiceDescription}${error}${import_ansi_escapes2.default.cursorHide}`;
|
|
63358
63369
|
});
|
|
63359
|
-
// node_modules/.pnpm/@inquirer+editor@4.2.
|
|
63370
|
+
// node_modules/.pnpm/@inquirer+editor@4.2.13_@types+node@22.15.29/node_modules/@inquirer/editor/dist/esm/index.js
|
|
63360
63371
|
var import_external_editor = __toESM(require_main2(), 1);
|
|
63361
|
-
import { AsyncResource as AsyncResource4 } from "node:async_hooks";
|
|
63362
63372
|
var editorTheme = {
|
|
63363
63373
|
validationFailureMode: "keep"
|
|
63364
63374
|
};
|
|
@@ -63371,7 +63381,7 @@ var esm_default3 = createPrompt((config2, done) => {
|
|
|
63371
63381
|
const prefix = usePrefix({ status, theme });
|
|
63372
63382
|
function startEditor(rl) {
|
|
63373
63383
|
rl.pause();
|
|
63374
|
-
const editCallback =
|
|
63384
|
+
const editCallback = async (error2, answer) => {
|
|
63375
63385
|
rl.resume();
|
|
63376
63386
|
if (error2) {
|
|
63377
63387
|
setError(error2.toString());
|
|
@@ -63392,7 +63402,7 @@ var esm_default3 = createPrompt((config2, done) => {
|
|
|
63392
63402
|
setStatus("idle");
|
|
63393
63403
|
}
|
|
63394
63404
|
}
|
|
63395
|
-
}
|
|
63405
|
+
};
|
|
63396
63406
|
import_external_editor.editAsync(value, (error2, answer) => void editCallback(error2, answer), {
|
|
63397
63407
|
postfix,
|
|
63398
63408
|
...fileProps
|
|
@@ -63425,7 +63435,7 @@ var esm_default3 = createPrompt((config2, done) => {
|
|
|
63425
63435
|
}
|
|
63426
63436
|
return [[prefix, message, helpTip].filter(Boolean).join(" "), error];
|
|
63427
63437
|
});
|
|
63428
|
-
// node_modules/.pnpm/@inquirer+confirm@5.1.
|
|
63438
|
+
// node_modules/.pnpm/@inquirer+confirm@5.1.12_@types+node@22.15.29/node_modules/@inquirer/confirm/dist/esm/index.js
|
|
63429
63439
|
function getBooleanValue(value, defaultValue) {
|
|
63430
63440
|
let answer = defaultValue !== false;
|
|
63431
63441
|
if (/^(y|yes)/i.test(value))
|
|
@@ -63468,7 +63478,7 @@ var esm_default4 = createPrompt((config2, done) => {
|
|
|
63468
63478
|
const message = theme.style.message(config2.message, status);
|
|
63469
63479
|
return `${prefix} ${message}${defaultValue} ${formattedValue}`;
|
|
63470
63480
|
});
|
|
63471
|
-
// node_modules/.pnpm/@inquirer+input@4.1.
|
|
63481
|
+
// node_modules/.pnpm/@inquirer+input@4.1.12_@types+node@22.15.29/node_modules/@inquirer/input/dist/esm/index.js
|
|
63472
63482
|
var inputTheme = {
|
|
63473
63483
|
validationFailureMode: "keep"
|
|
63474
63484
|
};
|
|
@@ -63533,7 +63543,7 @@ var esm_default5 = createPrompt((config2, done) => {
|
|
|
63533
63543
|
error
|
|
63534
63544
|
];
|
|
63535
63545
|
});
|
|
63536
|
-
// node_modules/.pnpm/@inquirer+number@3.0.
|
|
63546
|
+
// node_modules/.pnpm/@inquirer+number@3.0.15_@types+node@22.15.29/node_modules/@inquirer/number/dist/esm/index.js
|
|
63537
63547
|
function isStepOf(value, step, min) {
|
|
63538
63548
|
const valuePow = value * Math.pow(10, 6);
|
|
63539
63549
|
const stepPow = step * Math.pow(10, 6);
|
|
@@ -63613,7 +63623,7 @@ var esm_default6 = createPrompt((config2, done) => {
|
|
|
63613
63623
|
error
|
|
63614
63624
|
];
|
|
63615
63625
|
});
|
|
63616
|
-
// node_modules/.pnpm/@inquirer+expand@4.0.
|
|
63626
|
+
// node_modules/.pnpm/@inquirer+expand@4.0.15_@types+node@22.15.29/node_modules/@inquirer/expand/dist/esm/index.js
|
|
63617
63627
|
var import_yoctocolors_cjs4 = __toESM(require_yoctocolors_cjs(), 1);
|
|
63618
63628
|
function normalizeChoices2(choices) {
|
|
63619
63629
|
return choices.map((choice) => {
|
|
@@ -63710,7 +63720,7 @@ var esm_default7 = createPrompt((config2, done) => {
|
|
|
63710
63720
|
`)
|
|
63711
63721
|
];
|
|
63712
63722
|
});
|
|
63713
|
-
// node_modules/.pnpm/@inquirer+rawlist@4.1.
|
|
63723
|
+
// node_modules/.pnpm/@inquirer+rawlist@4.1.3_@types+node@22.15.29/node_modules/@inquirer/rawlist/dist/esm/index.js
|
|
63714
63724
|
var import_yoctocolors_cjs5 = __toESM(require_yoctocolors_cjs(), 1);
|
|
63715
63725
|
var numberRegex = /\d+/;
|
|
63716
63726
|
function isSelectableChoice(choice) {
|
|
@@ -63822,7 +63832,7 @@ var esm_default8 = createPrompt((config2, done) => {
|
|
|
63822
63832
|
`)
|
|
63823
63833
|
];
|
|
63824
63834
|
});
|
|
63825
|
-
// node_modules/.pnpm/@inquirer+password@4.0.
|
|
63835
|
+
// node_modules/.pnpm/@inquirer+password@4.0.15_@types+node@22.15.29/node_modules/@inquirer/password/dist/esm/index.js
|
|
63826
63836
|
var import_ansi_escapes3 = __toESM(require_ansi_escapes(), 1);
|
|
63827
63837
|
var esm_default9 = createPrompt((config2, done) => {
|
|
63828
63838
|
const { validate = () => true } = config2;
|
|
@@ -63871,7 +63881,7 @@ var esm_default9 = createPrompt((config2, done) => {
|
|
|
63871
63881
|
}
|
|
63872
63882
|
return [[prefix, message, config2.mask ? formattedValue : helpTip].join(" "), error];
|
|
63873
63883
|
});
|
|
63874
|
-
// node_modules/.pnpm/@inquirer+search@3.0.
|
|
63884
|
+
// node_modules/.pnpm/@inquirer+search@3.0.15_@types+node@22.15.29/node_modules/@inquirer/search/dist/esm/index.js
|
|
63875
63885
|
var import_yoctocolors_cjs6 = __toESM(require_yoctocolors_cjs(), 1);
|
|
63876
63886
|
var searchTheme = {
|
|
63877
63887
|
icon: { cursor: esm_default.pointer },
|
|
@@ -64036,7 +64046,7 @@ ${theme.style.description(selectedChoice.description)}` : ``;
|
|
|
64036
64046
|
`${error ?? page}${helpTip}${choiceDescription}`
|
|
64037
64047
|
];
|
|
64038
64048
|
});
|
|
64039
|
-
// node_modules/.pnpm/@inquirer+select@4.2.
|
|
64049
|
+
// node_modules/.pnpm/@inquirer+select@4.2.3_@types+node@22.15.29/node_modules/@inquirer/select/dist/esm/index.js
|
|
64040
64050
|
var import_yoctocolors_cjs7 = __toESM(require_yoctocolors_cjs(), 1);
|
|
64041
64051
|
var import_ansi_escapes4 = __toESM(require_ansi_escapes(), 1);
|
|
64042
64052
|
var selectTheme = {
|
|
@@ -64182,7 +64192,7 @@ ${theme.style.description(selectedChoice.description)}` : ``;
|
|
|
64182
64192
|
return `${[prefix, message, helpTipTop].filter(Boolean).join(" ")}
|
|
64183
64193
|
${page}${helpTipBottom}${choiceDescription}${import_ansi_escapes4.default.cursorHide}`;
|
|
64184
64194
|
});
|
|
64185
|
-
// node_modules/.pnpm/inquirer@12.6.
|
|
64195
|
+
// node_modules/.pnpm/inquirer@12.6.3_@types+node@22.15.29/node_modules/inquirer/dist/esm/ui/prompt.js
|
|
64186
64196
|
var import_rxjs = __toESM(require_cjs(), 1);
|
|
64187
64197
|
var import_run_async = __toESM(require_run_async(), 1);
|
|
64188
64198
|
var import_mute_stream2 = __toESM(require_lib(), 1);
|
|
@@ -64394,7 +64404,7 @@ class PromptsRunner {
|
|
|
64394
64404
|
};
|
|
64395
64405
|
}
|
|
64396
64406
|
|
|
64397
|
-
// node_modules/.pnpm/inquirer@12.6.
|
|
64407
|
+
// node_modules/.pnpm/inquirer@12.6.3_@types+node@22.15.29/node_modules/inquirer/dist/esm/index.js
|
|
64398
64408
|
var builtInPrompts = {
|
|
64399
64409
|
input: esm_default5,
|
|
64400
64410
|
select: esm_default11,
|
|
@@ -64727,33 +64737,39 @@ var command = new Command("server").description("启动服务").option("-d, --da
|
|
|
64727
64737
|
program.addCommand(command);
|
|
64728
64738
|
|
|
64729
64739
|
// src/command/app/index.ts
|
|
64730
|
-
var
|
|
64731
|
-
|
|
64732
|
-
|
|
64733
|
-
|
|
64734
|
-
|
|
64735
|
-
|
|
64736
|
-
|
|
64737
|
-
|
|
64738
|
-
|
|
64739
|
-
|
|
64740
|
-
|
|
64741
|
-
|
|
64742
|
-
|
|
64743
|
-
}
|
|
64744
|
-
|
|
64745
|
-
|
|
64746
|
-
|
|
64747
|
-
const
|
|
64748
|
-
|
|
64749
|
-
|
|
64750
|
-
|
|
64751
|
-
|
|
64752
|
-
|
|
64753
|
-
|
|
64740
|
+
var commdands = ["app", "page"];
|
|
64741
|
+
var addOneCommand = (name) => {
|
|
64742
|
+
const appManagerCommand2 = new Command(name).description(`本地的应用模块的安装和下载, 分为 app 和 web 两种类型. 默认类型为${name}`);
|
|
64743
|
+
program.addCommand(appManagerCommand2);
|
|
64744
|
+
const downloadCommand = new Command("download").description("下载应用").option("-i, --id <id>", "应用名称").option("-t, --type <type>", "应用类型", name).option("-r, --registry <registry>", "应用源 https://kevisual.cn").option("-f --force", "强制覆盖").option("-y --yes", "覆盖的时候不提示").action(async (options) => {
|
|
64745
|
+
const { id, type, force, yes } = options;
|
|
64746
|
+
assistantConfig2.checkMounted();
|
|
64747
|
+
const registry = options.registry || assistantConfig2.getRegistry();
|
|
64748
|
+
const app = new AppDownload(assistantConfig2);
|
|
64749
|
+
let info = "";
|
|
64750
|
+
if (id) {
|
|
64751
|
+
const msg = await app.downloadApp({ id, type, registry, force, yes });
|
|
64752
|
+
info = String(msg);
|
|
64753
|
+
}
|
|
64754
|
+
logger.debug(info);
|
|
64755
|
+
});
|
|
64756
|
+
appManagerCommand2.addCommand(downloadCommand);
|
|
64757
|
+
const deleteCommand = new Command("delete").description("删除应用").option("-i, --id <id>", "应用名称").option("-t, --type <type>", "应用类型", name).action(async (options) => {
|
|
64758
|
+
const { id, type } = options;
|
|
64759
|
+
const app = new AppDownload(assistantConfig2);
|
|
64760
|
+
let info = "";
|
|
64761
|
+
if (id) {
|
|
64762
|
+
const msg = await app.deleteApp({ id, type });
|
|
64763
|
+
info = String(msg);
|
|
64764
|
+
}
|
|
64765
|
+
logger.debug(info);
|
|
64766
|
+
});
|
|
64767
|
+
appManagerCommand2.addCommand(deleteCommand);
|
|
64768
|
+
const uploadCommand = new Command("upload").description("上传应用").option("-i, --id <id>", "应用名称 root/app-name 的格式,如果是后端,会自动解析为 app-name").option("-t, --type <type>", "应用类型", "app").action(async (options) => {});
|
|
64769
|
+
};
|
|
64770
|
+
commdands.forEach((name) => {
|
|
64771
|
+
addOneCommand(name);
|
|
64754
64772
|
});
|
|
64755
|
-
appManagerCommand2.addCommand(deleteCommand);
|
|
64756
|
-
var uploadCommand = new Command("upload").description("上传应用").option("-i, --id <id>", "应用名称 root/app-name 的格式,如果是后端,会自动解析为 app-name").option("-t, --type <type>", "应用类型", "web").action(async (options) => {});
|
|
64757
64773
|
|
|
64758
64774
|
// src/command/run-scripts/index.ts
|
|
64759
64775
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
@@ -64784,7 +64800,7 @@ var runScriptsCommand = new Command("run-scripts").alias("run").arguments("<cmd>
|
|
|
64784
64800
|
});
|
|
64785
64801
|
program.addCommand(runScriptsCommand);
|
|
64786
64802
|
|
|
64787
|
-
// node_modules/.pnpm/@kevisual+ai
|
|
64803
|
+
// node_modules/.pnpm/@kevisual+ai@0.0.5/node_modules/@kevisual/ai/dist/ai-provider.js
|
|
64788
64804
|
import { createRequire as createRequire2 } from "node:module";
|
|
64789
64805
|
import { statSync, createReadStream, promises as fs12 } from "fs";
|
|
64790
64806
|
import { basename } from "path";
|
|
@@ -71044,6 +71060,1205 @@ var init_fileFromPath = __esm2(() => {
|
|
|
71044
71060
|
}
|
|
71045
71061
|
};
|
|
71046
71062
|
});
|
|
71063
|
+
var require_core = __commonJS2((exports, module) => {
|
|
71064
|
+
(function(root2, factory) {
|
|
71065
|
+
if (typeof exports === "object") {
|
|
71066
|
+
module.exports = exports = factory();
|
|
71067
|
+
} else if (typeof define === "function" && define.amd) {
|
|
71068
|
+
define([], factory);
|
|
71069
|
+
} else {
|
|
71070
|
+
root2.CryptoJS = factory();
|
|
71071
|
+
}
|
|
71072
|
+
})(exports, function() {
|
|
71073
|
+
var CryptoJS = CryptoJS || function(Math2, undefined2) {
|
|
71074
|
+
var crypto;
|
|
71075
|
+
if (typeof window !== "undefined" && window.crypto) {
|
|
71076
|
+
crypto = window.crypto;
|
|
71077
|
+
}
|
|
71078
|
+
if (typeof self !== "undefined" && self.crypto) {
|
|
71079
|
+
crypto = self.crypto;
|
|
71080
|
+
}
|
|
71081
|
+
if (typeof globalThis !== "undefined" && globalThis.crypto) {
|
|
71082
|
+
crypto = globalThis.crypto;
|
|
71083
|
+
}
|
|
71084
|
+
if (!crypto && typeof window !== "undefined" && window.msCrypto) {
|
|
71085
|
+
crypto = window.msCrypto;
|
|
71086
|
+
}
|
|
71087
|
+
if (!crypto && typeof global !== "undefined" && global.crypto) {
|
|
71088
|
+
crypto = global.crypto;
|
|
71089
|
+
}
|
|
71090
|
+
if (!crypto && true) {
|
|
71091
|
+
try {
|
|
71092
|
+
crypto = __require2("crypto");
|
|
71093
|
+
} catch (err) {}
|
|
71094
|
+
}
|
|
71095
|
+
var cryptoSecureRandomInt = function() {
|
|
71096
|
+
if (crypto) {
|
|
71097
|
+
if (typeof crypto.getRandomValues === "function") {
|
|
71098
|
+
try {
|
|
71099
|
+
return crypto.getRandomValues(new Uint32Array(1))[0];
|
|
71100
|
+
} catch (err) {}
|
|
71101
|
+
}
|
|
71102
|
+
if (typeof crypto.randomBytes === "function") {
|
|
71103
|
+
try {
|
|
71104
|
+
return crypto.randomBytes(4).readInt32LE();
|
|
71105
|
+
} catch (err) {}
|
|
71106
|
+
}
|
|
71107
|
+
}
|
|
71108
|
+
throw new Error("Native crypto module could not be used to get secure random number.");
|
|
71109
|
+
};
|
|
71110
|
+
var create = Object.create || function() {
|
|
71111
|
+
function F2() {}
|
|
71112
|
+
return function(obj) {
|
|
71113
|
+
var subtype;
|
|
71114
|
+
F2.prototype = obj;
|
|
71115
|
+
subtype = new F2;
|
|
71116
|
+
F2.prototype = null;
|
|
71117
|
+
return subtype;
|
|
71118
|
+
};
|
|
71119
|
+
}();
|
|
71120
|
+
var C2 = {};
|
|
71121
|
+
var C_lib = C2.lib = {};
|
|
71122
|
+
var Base = C_lib.Base = function() {
|
|
71123
|
+
return {
|
|
71124
|
+
extend: function(overrides) {
|
|
71125
|
+
var subtype = create(this);
|
|
71126
|
+
if (overrides) {
|
|
71127
|
+
subtype.mixIn(overrides);
|
|
71128
|
+
}
|
|
71129
|
+
if (!subtype.hasOwnProperty("init") || this.init === subtype.init) {
|
|
71130
|
+
subtype.init = function() {
|
|
71131
|
+
subtype.$super.init.apply(this, arguments);
|
|
71132
|
+
};
|
|
71133
|
+
}
|
|
71134
|
+
subtype.init.prototype = subtype;
|
|
71135
|
+
subtype.$super = this;
|
|
71136
|
+
return subtype;
|
|
71137
|
+
},
|
|
71138
|
+
create: function() {
|
|
71139
|
+
var instance = this.extend();
|
|
71140
|
+
instance.init.apply(instance, arguments);
|
|
71141
|
+
return instance;
|
|
71142
|
+
},
|
|
71143
|
+
init: function() {},
|
|
71144
|
+
mixIn: function(properties) {
|
|
71145
|
+
for (var propertyName in properties) {
|
|
71146
|
+
if (properties.hasOwnProperty(propertyName)) {
|
|
71147
|
+
this[propertyName] = properties[propertyName];
|
|
71148
|
+
}
|
|
71149
|
+
}
|
|
71150
|
+
if (properties.hasOwnProperty("toString")) {
|
|
71151
|
+
this.toString = properties.toString;
|
|
71152
|
+
}
|
|
71153
|
+
},
|
|
71154
|
+
clone: function() {
|
|
71155
|
+
return this.init.prototype.extend(this);
|
|
71156
|
+
}
|
|
71157
|
+
};
|
|
71158
|
+
}();
|
|
71159
|
+
var WordArray = C_lib.WordArray = Base.extend({
|
|
71160
|
+
init: function(words, sigBytes) {
|
|
71161
|
+
words = this.words = words || [];
|
|
71162
|
+
if (sigBytes != undefined2) {
|
|
71163
|
+
this.sigBytes = sigBytes;
|
|
71164
|
+
} else {
|
|
71165
|
+
this.sigBytes = words.length * 4;
|
|
71166
|
+
}
|
|
71167
|
+
},
|
|
71168
|
+
toString: function(encoder) {
|
|
71169
|
+
return (encoder || Hex).stringify(this);
|
|
71170
|
+
},
|
|
71171
|
+
concat: function(wordArray) {
|
|
71172
|
+
var thisWords = this.words;
|
|
71173
|
+
var thatWords = wordArray.words;
|
|
71174
|
+
var thisSigBytes = this.sigBytes;
|
|
71175
|
+
var thatSigBytes = wordArray.sigBytes;
|
|
71176
|
+
this.clamp();
|
|
71177
|
+
if (thisSigBytes % 4) {
|
|
71178
|
+
for (var i2 = 0;i2 < thatSigBytes; i2++) {
|
|
71179
|
+
var thatByte = thatWords[i2 >>> 2] >>> 24 - i2 % 4 * 8 & 255;
|
|
71180
|
+
thisWords[thisSigBytes + i2 >>> 2] |= thatByte << 24 - (thisSigBytes + i2) % 4 * 8;
|
|
71181
|
+
}
|
|
71182
|
+
} else {
|
|
71183
|
+
for (var j2 = 0;j2 < thatSigBytes; j2 += 4) {
|
|
71184
|
+
thisWords[thisSigBytes + j2 >>> 2] = thatWords[j2 >>> 2];
|
|
71185
|
+
}
|
|
71186
|
+
}
|
|
71187
|
+
this.sigBytes += thatSigBytes;
|
|
71188
|
+
return this;
|
|
71189
|
+
},
|
|
71190
|
+
clamp: function() {
|
|
71191
|
+
var words = this.words;
|
|
71192
|
+
var sigBytes = this.sigBytes;
|
|
71193
|
+
words[sigBytes >>> 2] &= 4294967295 << 32 - sigBytes % 4 * 8;
|
|
71194
|
+
words.length = Math2.ceil(sigBytes / 4);
|
|
71195
|
+
},
|
|
71196
|
+
clone: function() {
|
|
71197
|
+
var clone = Base.clone.call(this);
|
|
71198
|
+
clone.words = this.words.slice(0);
|
|
71199
|
+
return clone;
|
|
71200
|
+
},
|
|
71201
|
+
random: function(nBytes) {
|
|
71202
|
+
var words = [];
|
|
71203
|
+
for (var i2 = 0;i2 < nBytes; i2 += 4) {
|
|
71204
|
+
words.push(cryptoSecureRandomInt());
|
|
71205
|
+
}
|
|
71206
|
+
return new WordArray.init(words, nBytes);
|
|
71207
|
+
}
|
|
71208
|
+
});
|
|
71209
|
+
var C_enc = C2.enc = {};
|
|
71210
|
+
var Hex = C_enc.Hex = {
|
|
71211
|
+
stringify: function(wordArray) {
|
|
71212
|
+
var words = wordArray.words;
|
|
71213
|
+
var sigBytes = wordArray.sigBytes;
|
|
71214
|
+
var hexChars = [];
|
|
71215
|
+
for (var i2 = 0;i2 < sigBytes; i2++) {
|
|
71216
|
+
var bite = words[i2 >>> 2] >>> 24 - i2 % 4 * 8 & 255;
|
|
71217
|
+
hexChars.push((bite >>> 4).toString(16));
|
|
71218
|
+
hexChars.push((bite & 15).toString(16));
|
|
71219
|
+
}
|
|
71220
|
+
return hexChars.join("");
|
|
71221
|
+
},
|
|
71222
|
+
parse: function(hexStr) {
|
|
71223
|
+
var hexStrLength = hexStr.length;
|
|
71224
|
+
var words = [];
|
|
71225
|
+
for (var i2 = 0;i2 < hexStrLength; i2 += 2) {
|
|
71226
|
+
words[i2 >>> 3] |= parseInt(hexStr.substr(i2, 2), 16) << 24 - i2 % 8 * 4;
|
|
71227
|
+
}
|
|
71228
|
+
return new WordArray.init(words, hexStrLength / 2);
|
|
71229
|
+
}
|
|
71230
|
+
};
|
|
71231
|
+
var Latin1 = C_enc.Latin1 = {
|
|
71232
|
+
stringify: function(wordArray) {
|
|
71233
|
+
var words = wordArray.words;
|
|
71234
|
+
var sigBytes = wordArray.sigBytes;
|
|
71235
|
+
var latin1Chars = [];
|
|
71236
|
+
for (var i2 = 0;i2 < sigBytes; i2++) {
|
|
71237
|
+
var bite = words[i2 >>> 2] >>> 24 - i2 % 4 * 8 & 255;
|
|
71238
|
+
latin1Chars.push(String.fromCharCode(bite));
|
|
71239
|
+
}
|
|
71240
|
+
return latin1Chars.join("");
|
|
71241
|
+
},
|
|
71242
|
+
parse: function(latin1Str) {
|
|
71243
|
+
var latin1StrLength = latin1Str.length;
|
|
71244
|
+
var words = [];
|
|
71245
|
+
for (var i2 = 0;i2 < latin1StrLength; i2++) {
|
|
71246
|
+
words[i2 >>> 2] |= (latin1Str.charCodeAt(i2) & 255) << 24 - i2 % 4 * 8;
|
|
71247
|
+
}
|
|
71248
|
+
return new WordArray.init(words, latin1StrLength);
|
|
71249
|
+
}
|
|
71250
|
+
};
|
|
71251
|
+
var Utf8 = C_enc.Utf8 = {
|
|
71252
|
+
stringify: function(wordArray) {
|
|
71253
|
+
try {
|
|
71254
|
+
return decodeURIComponent(escape(Latin1.stringify(wordArray)));
|
|
71255
|
+
} catch (e2) {
|
|
71256
|
+
throw new Error("Malformed UTF-8 data");
|
|
71257
|
+
}
|
|
71258
|
+
},
|
|
71259
|
+
parse: function(utf8Str) {
|
|
71260
|
+
return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
|
|
71261
|
+
}
|
|
71262
|
+
};
|
|
71263
|
+
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
|
|
71264
|
+
reset: function() {
|
|
71265
|
+
this._data = new WordArray.init;
|
|
71266
|
+
this._nDataBytes = 0;
|
|
71267
|
+
},
|
|
71268
|
+
_append: function(data) {
|
|
71269
|
+
if (typeof data == "string") {
|
|
71270
|
+
data = Utf8.parse(data);
|
|
71271
|
+
}
|
|
71272
|
+
this._data.concat(data);
|
|
71273
|
+
this._nDataBytes += data.sigBytes;
|
|
71274
|
+
},
|
|
71275
|
+
_process: function(doFlush) {
|
|
71276
|
+
var processedWords;
|
|
71277
|
+
var data = this._data;
|
|
71278
|
+
var dataWords = data.words;
|
|
71279
|
+
var dataSigBytes = data.sigBytes;
|
|
71280
|
+
var blockSize = this.blockSize;
|
|
71281
|
+
var blockSizeBytes = blockSize * 4;
|
|
71282
|
+
var nBlocksReady = dataSigBytes / blockSizeBytes;
|
|
71283
|
+
if (doFlush) {
|
|
71284
|
+
nBlocksReady = Math2.ceil(nBlocksReady);
|
|
71285
|
+
} else {
|
|
71286
|
+
nBlocksReady = Math2.max((nBlocksReady | 0) - this._minBufferSize, 0);
|
|
71287
|
+
}
|
|
71288
|
+
var nWordsReady = nBlocksReady * blockSize;
|
|
71289
|
+
var nBytesReady = Math2.min(nWordsReady * 4, dataSigBytes);
|
|
71290
|
+
if (nWordsReady) {
|
|
71291
|
+
for (var offset = 0;offset < nWordsReady; offset += blockSize) {
|
|
71292
|
+
this._doProcessBlock(dataWords, offset);
|
|
71293
|
+
}
|
|
71294
|
+
processedWords = dataWords.splice(0, nWordsReady);
|
|
71295
|
+
data.sigBytes -= nBytesReady;
|
|
71296
|
+
}
|
|
71297
|
+
return new WordArray.init(processedWords, nBytesReady);
|
|
71298
|
+
},
|
|
71299
|
+
clone: function() {
|
|
71300
|
+
var clone = Base.clone.call(this);
|
|
71301
|
+
clone._data = this._data.clone();
|
|
71302
|
+
return clone;
|
|
71303
|
+
},
|
|
71304
|
+
_minBufferSize: 0
|
|
71305
|
+
});
|
|
71306
|
+
var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
|
|
71307
|
+
cfg: Base.extend(),
|
|
71308
|
+
init: function(cfg) {
|
|
71309
|
+
this.cfg = this.cfg.extend(cfg);
|
|
71310
|
+
this.reset();
|
|
71311
|
+
},
|
|
71312
|
+
reset: function() {
|
|
71313
|
+
BufferedBlockAlgorithm.reset.call(this);
|
|
71314
|
+
this._doReset();
|
|
71315
|
+
},
|
|
71316
|
+
update: function(messageUpdate) {
|
|
71317
|
+
this._append(messageUpdate);
|
|
71318
|
+
this._process();
|
|
71319
|
+
return this;
|
|
71320
|
+
},
|
|
71321
|
+
finalize: function(messageUpdate) {
|
|
71322
|
+
if (messageUpdate) {
|
|
71323
|
+
this._append(messageUpdate);
|
|
71324
|
+
}
|
|
71325
|
+
var hash = this._doFinalize();
|
|
71326
|
+
return hash;
|
|
71327
|
+
},
|
|
71328
|
+
blockSize: 512 / 32,
|
|
71329
|
+
_createHelper: function(hasher) {
|
|
71330
|
+
return function(message, cfg) {
|
|
71331
|
+
return new hasher.init(cfg).finalize(message);
|
|
71332
|
+
};
|
|
71333
|
+
},
|
|
71334
|
+
_createHmacHelper: function(hasher) {
|
|
71335
|
+
return function(message, key2) {
|
|
71336
|
+
return new C_algo.HMAC.init(hasher, key2).finalize(message);
|
|
71337
|
+
};
|
|
71338
|
+
}
|
|
71339
|
+
});
|
|
71340
|
+
var C_algo = C2.algo = {};
|
|
71341
|
+
return C2;
|
|
71342
|
+
}(Math);
|
|
71343
|
+
return CryptoJS;
|
|
71344
|
+
});
|
|
71345
|
+
});
|
|
71346
|
+
var require_enc_base64 = __commonJS2((exports, module) => {
|
|
71347
|
+
(function(root2, factory) {
|
|
71348
|
+
if (typeof exports === "object") {
|
|
71349
|
+
module.exports = exports = factory(require_core());
|
|
71350
|
+
} else if (typeof define === "function" && define.amd) {
|
|
71351
|
+
define(["./core"], factory);
|
|
71352
|
+
} else {
|
|
71353
|
+
factory(root2.CryptoJS);
|
|
71354
|
+
}
|
|
71355
|
+
})(exports, function(CryptoJS) {
|
|
71356
|
+
(function() {
|
|
71357
|
+
var C2 = CryptoJS;
|
|
71358
|
+
var C_lib = C2.lib;
|
|
71359
|
+
var WordArray = C_lib.WordArray;
|
|
71360
|
+
var C_enc = C2.enc;
|
|
71361
|
+
var Base64 = C_enc.Base64 = {
|
|
71362
|
+
stringify: function(wordArray) {
|
|
71363
|
+
var words = wordArray.words;
|
|
71364
|
+
var sigBytes = wordArray.sigBytes;
|
|
71365
|
+
var map = this._map;
|
|
71366
|
+
wordArray.clamp();
|
|
71367
|
+
var base64Chars = [];
|
|
71368
|
+
for (var i2 = 0;i2 < sigBytes; i2 += 3) {
|
|
71369
|
+
var byte1 = words[i2 >>> 2] >>> 24 - i2 % 4 * 8 & 255;
|
|
71370
|
+
var byte2 = words[i2 + 1 >>> 2] >>> 24 - (i2 + 1) % 4 * 8 & 255;
|
|
71371
|
+
var byte3 = words[i2 + 2 >>> 2] >>> 24 - (i2 + 2) % 4 * 8 & 255;
|
|
71372
|
+
var triplet = byte1 << 16 | byte2 << 8 | byte3;
|
|
71373
|
+
for (var j2 = 0;j2 < 4 && i2 + j2 * 0.75 < sigBytes; j2++) {
|
|
71374
|
+
base64Chars.push(map.charAt(triplet >>> 6 * (3 - j2) & 63));
|
|
71375
|
+
}
|
|
71376
|
+
}
|
|
71377
|
+
var paddingChar = map.charAt(64);
|
|
71378
|
+
if (paddingChar) {
|
|
71379
|
+
while (base64Chars.length % 4) {
|
|
71380
|
+
base64Chars.push(paddingChar);
|
|
71381
|
+
}
|
|
71382
|
+
}
|
|
71383
|
+
return base64Chars.join("");
|
|
71384
|
+
},
|
|
71385
|
+
parse: function(base64Str) {
|
|
71386
|
+
var base64StrLength = base64Str.length;
|
|
71387
|
+
var map = this._map;
|
|
71388
|
+
var reverseMap = this._reverseMap;
|
|
71389
|
+
if (!reverseMap) {
|
|
71390
|
+
reverseMap = this._reverseMap = [];
|
|
71391
|
+
for (var j2 = 0;j2 < map.length; j2++) {
|
|
71392
|
+
reverseMap[map.charCodeAt(j2)] = j2;
|
|
71393
|
+
}
|
|
71394
|
+
}
|
|
71395
|
+
var paddingChar = map.charAt(64);
|
|
71396
|
+
if (paddingChar) {
|
|
71397
|
+
var paddingIndex = base64Str.indexOf(paddingChar);
|
|
71398
|
+
if (paddingIndex !== -1) {
|
|
71399
|
+
base64StrLength = paddingIndex;
|
|
71400
|
+
}
|
|
71401
|
+
}
|
|
71402
|
+
return parseLoop(base64Str, base64StrLength, reverseMap);
|
|
71403
|
+
},
|
|
71404
|
+
_map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
|
|
71405
|
+
};
|
|
71406
|
+
function parseLoop(base64Str, base64StrLength, reverseMap) {
|
|
71407
|
+
var words = [];
|
|
71408
|
+
var nBytes = 0;
|
|
71409
|
+
for (var i2 = 0;i2 < base64StrLength; i2++) {
|
|
71410
|
+
if (i2 % 4) {
|
|
71411
|
+
var bits1 = reverseMap[base64Str.charCodeAt(i2 - 1)] << i2 % 4 * 2;
|
|
71412
|
+
var bits2 = reverseMap[base64Str.charCodeAt(i2)] >>> 6 - i2 % 4 * 2;
|
|
71413
|
+
var bitsCombined = bits1 | bits2;
|
|
71414
|
+
words[nBytes >>> 2] |= bitsCombined << 24 - nBytes % 4 * 8;
|
|
71415
|
+
nBytes++;
|
|
71416
|
+
}
|
|
71417
|
+
}
|
|
71418
|
+
return WordArray.create(words, nBytes);
|
|
71419
|
+
}
|
|
71420
|
+
})();
|
|
71421
|
+
return CryptoJS.enc.Base64;
|
|
71422
|
+
});
|
|
71423
|
+
});
|
|
71424
|
+
var require_md5 = __commonJS2((exports, module) => {
|
|
71425
|
+
(function(root2, factory) {
|
|
71426
|
+
if (typeof exports === "object") {
|
|
71427
|
+
module.exports = exports = factory(require_core());
|
|
71428
|
+
} else if (typeof define === "function" && define.amd) {
|
|
71429
|
+
define(["./core"], factory);
|
|
71430
|
+
} else {
|
|
71431
|
+
factory(root2.CryptoJS);
|
|
71432
|
+
}
|
|
71433
|
+
})(exports, function(CryptoJS) {
|
|
71434
|
+
(function(Math2) {
|
|
71435
|
+
var C2 = CryptoJS;
|
|
71436
|
+
var C_lib = C2.lib;
|
|
71437
|
+
var WordArray = C_lib.WordArray;
|
|
71438
|
+
var Hasher = C_lib.Hasher;
|
|
71439
|
+
var C_algo = C2.algo;
|
|
71440
|
+
var T2 = [];
|
|
71441
|
+
(function() {
|
|
71442
|
+
for (var i2 = 0;i2 < 64; i2++) {
|
|
71443
|
+
T2[i2] = Math2.abs(Math2.sin(i2 + 1)) * 4294967296 | 0;
|
|
71444
|
+
}
|
|
71445
|
+
})();
|
|
71446
|
+
var MD5 = C_algo.MD5 = Hasher.extend({
|
|
71447
|
+
_doReset: function() {
|
|
71448
|
+
this._hash = new WordArray.init([
|
|
71449
|
+
1732584193,
|
|
71450
|
+
4023233417,
|
|
71451
|
+
2562383102,
|
|
71452
|
+
271733878
|
|
71453
|
+
]);
|
|
71454
|
+
},
|
|
71455
|
+
_doProcessBlock: function(M2, offset) {
|
|
71456
|
+
for (var i2 = 0;i2 < 16; i2++) {
|
|
71457
|
+
var offset_i = offset + i2;
|
|
71458
|
+
var M_offset_i = M2[offset_i];
|
|
71459
|
+
M2[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 16711935 | (M_offset_i << 24 | M_offset_i >>> 8) & 4278255360;
|
|
71460
|
+
}
|
|
71461
|
+
var H2 = this._hash.words;
|
|
71462
|
+
var M_offset_0 = M2[offset + 0];
|
|
71463
|
+
var M_offset_1 = M2[offset + 1];
|
|
71464
|
+
var M_offset_2 = M2[offset + 2];
|
|
71465
|
+
var M_offset_3 = M2[offset + 3];
|
|
71466
|
+
var M_offset_4 = M2[offset + 4];
|
|
71467
|
+
var M_offset_5 = M2[offset + 5];
|
|
71468
|
+
var M_offset_6 = M2[offset + 6];
|
|
71469
|
+
var M_offset_7 = M2[offset + 7];
|
|
71470
|
+
var M_offset_8 = M2[offset + 8];
|
|
71471
|
+
var M_offset_9 = M2[offset + 9];
|
|
71472
|
+
var M_offset_10 = M2[offset + 10];
|
|
71473
|
+
var M_offset_11 = M2[offset + 11];
|
|
71474
|
+
var M_offset_12 = M2[offset + 12];
|
|
71475
|
+
var M_offset_13 = M2[offset + 13];
|
|
71476
|
+
var M_offset_14 = M2[offset + 14];
|
|
71477
|
+
var M_offset_15 = M2[offset + 15];
|
|
71478
|
+
var a2 = H2[0];
|
|
71479
|
+
var b2 = H2[1];
|
|
71480
|
+
var c2 = H2[2];
|
|
71481
|
+
var d2 = H2[3];
|
|
71482
|
+
a2 = FF(a2, b2, c2, d2, M_offset_0, 7, T2[0]);
|
|
71483
|
+
d2 = FF(d2, a2, b2, c2, M_offset_1, 12, T2[1]);
|
|
71484
|
+
c2 = FF(c2, d2, a2, b2, M_offset_2, 17, T2[2]);
|
|
71485
|
+
b2 = FF(b2, c2, d2, a2, M_offset_3, 22, T2[3]);
|
|
71486
|
+
a2 = FF(a2, b2, c2, d2, M_offset_4, 7, T2[4]);
|
|
71487
|
+
d2 = FF(d2, a2, b2, c2, M_offset_5, 12, T2[5]);
|
|
71488
|
+
c2 = FF(c2, d2, a2, b2, M_offset_6, 17, T2[6]);
|
|
71489
|
+
b2 = FF(b2, c2, d2, a2, M_offset_7, 22, T2[7]);
|
|
71490
|
+
a2 = FF(a2, b2, c2, d2, M_offset_8, 7, T2[8]);
|
|
71491
|
+
d2 = FF(d2, a2, b2, c2, M_offset_9, 12, T2[9]);
|
|
71492
|
+
c2 = FF(c2, d2, a2, b2, M_offset_10, 17, T2[10]);
|
|
71493
|
+
b2 = FF(b2, c2, d2, a2, M_offset_11, 22, T2[11]);
|
|
71494
|
+
a2 = FF(a2, b2, c2, d2, M_offset_12, 7, T2[12]);
|
|
71495
|
+
d2 = FF(d2, a2, b2, c2, M_offset_13, 12, T2[13]);
|
|
71496
|
+
c2 = FF(c2, d2, a2, b2, M_offset_14, 17, T2[14]);
|
|
71497
|
+
b2 = FF(b2, c2, d2, a2, M_offset_15, 22, T2[15]);
|
|
71498
|
+
a2 = GG(a2, b2, c2, d2, M_offset_1, 5, T2[16]);
|
|
71499
|
+
d2 = GG(d2, a2, b2, c2, M_offset_6, 9, T2[17]);
|
|
71500
|
+
c2 = GG(c2, d2, a2, b2, M_offset_11, 14, T2[18]);
|
|
71501
|
+
b2 = GG(b2, c2, d2, a2, M_offset_0, 20, T2[19]);
|
|
71502
|
+
a2 = GG(a2, b2, c2, d2, M_offset_5, 5, T2[20]);
|
|
71503
|
+
d2 = GG(d2, a2, b2, c2, M_offset_10, 9, T2[21]);
|
|
71504
|
+
c2 = GG(c2, d2, a2, b2, M_offset_15, 14, T2[22]);
|
|
71505
|
+
b2 = GG(b2, c2, d2, a2, M_offset_4, 20, T2[23]);
|
|
71506
|
+
a2 = GG(a2, b2, c2, d2, M_offset_9, 5, T2[24]);
|
|
71507
|
+
d2 = GG(d2, a2, b2, c2, M_offset_14, 9, T2[25]);
|
|
71508
|
+
c2 = GG(c2, d2, a2, b2, M_offset_3, 14, T2[26]);
|
|
71509
|
+
b2 = GG(b2, c2, d2, a2, M_offset_8, 20, T2[27]);
|
|
71510
|
+
a2 = GG(a2, b2, c2, d2, M_offset_13, 5, T2[28]);
|
|
71511
|
+
d2 = GG(d2, a2, b2, c2, M_offset_2, 9, T2[29]);
|
|
71512
|
+
c2 = GG(c2, d2, a2, b2, M_offset_7, 14, T2[30]);
|
|
71513
|
+
b2 = GG(b2, c2, d2, a2, M_offset_12, 20, T2[31]);
|
|
71514
|
+
a2 = HH(a2, b2, c2, d2, M_offset_5, 4, T2[32]);
|
|
71515
|
+
d2 = HH(d2, a2, b2, c2, M_offset_8, 11, T2[33]);
|
|
71516
|
+
c2 = HH(c2, d2, a2, b2, M_offset_11, 16, T2[34]);
|
|
71517
|
+
b2 = HH(b2, c2, d2, a2, M_offset_14, 23, T2[35]);
|
|
71518
|
+
a2 = HH(a2, b2, c2, d2, M_offset_1, 4, T2[36]);
|
|
71519
|
+
d2 = HH(d2, a2, b2, c2, M_offset_4, 11, T2[37]);
|
|
71520
|
+
c2 = HH(c2, d2, a2, b2, M_offset_7, 16, T2[38]);
|
|
71521
|
+
b2 = HH(b2, c2, d2, a2, M_offset_10, 23, T2[39]);
|
|
71522
|
+
a2 = HH(a2, b2, c2, d2, M_offset_13, 4, T2[40]);
|
|
71523
|
+
d2 = HH(d2, a2, b2, c2, M_offset_0, 11, T2[41]);
|
|
71524
|
+
c2 = HH(c2, d2, a2, b2, M_offset_3, 16, T2[42]);
|
|
71525
|
+
b2 = HH(b2, c2, d2, a2, M_offset_6, 23, T2[43]);
|
|
71526
|
+
a2 = HH(a2, b2, c2, d2, M_offset_9, 4, T2[44]);
|
|
71527
|
+
d2 = HH(d2, a2, b2, c2, M_offset_12, 11, T2[45]);
|
|
71528
|
+
c2 = HH(c2, d2, a2, b2, M_offset_15, 16, T2[46]);
|
|
71529
|
+
b2 = HH(b2, c2, d2, a2, M_offset_2, 23, T2[47]);
|
|
71530
|
+
a2 = II(a2, b2, c2, d2, M_offset_0, 6, T2[48]);
|
|
71531
|
+
d2 = II(d2, a2, b2, c2, M_offset_7, 10, T2[49]);
|
|
71532
|
+
c2 = II(c2, d2, a2, b2, M_offset_14, 15, T2[50]);
|
|
71533
|
+
b2 = II(b2, c2, d2, a2, M_offset_5, 21, T2[51]);
|
|
71534
|
+
a2 = II(a2, b2, c2, d2, M_offset_12, 6, T2[52]);
|
|
71535
|
+
d2 = II(d2, a2, b2, c2, M_offset_3, 10, T2[53]);
|
|
71536
|
+
c2 = II(c2, d2, a2, b2, M_offset_10, 15, T2[54]);
|
|
71537
|
+
b2 = II(b2, c2, d2, a2, M_offset_1, 21, T2[55]);
|
|
71538
|
+
a2 = II(a2, b2, c2, d2, M_offset_8, 6, T2[56]);
|
|
71539
|
+
d2 = II(d2, a2, b2, c2, M_offset_15, 10, T2[57]);
|
|
71540
|
+
c2 = II(c2, d2, a2, b2, M_offset_6, 15, T2[58]);
|
|
71541
|
+
b2 = II(b2, c2, d2, a2, M_offset_13, 21, T2[59]);
|
|
71542
|
+
a2 = II(a2, b2, c2, d2, M_offset_4, 6, T2[60]);
|
|
71543
|
+
d2 = II(d2, a2, b2, c2, M_offset_11, 10, T2[61]);
|
|
71544
|
+
c2 = II(c2, d2, a2, b2, M_offset_2, 15, T2[62]);
|
|
71545
|
+
b2 = II(b2, c2, d2, a2, M_offset_9, 21, T2[63]);
|
|
71546
|
+
H2[0] = H2[0] + a2 | 0;
|
|
71547
|
+
H2[1] = H2[1] + b2 | 0;
|
|
71548
|
+
H2[2] = H2[2] + c2 | 0;
|
|
71549
|
+
H2[3] = H2[3] + d2 | 0;
|
|
71550
|
+
},
|
|
71551
|
+
_doFinalize: function() {
|
|
71552
|
+
var data = this._data;
|
|
71553
|
+
var dataWords = data.words;
|
|
71554
|
+
var nBitsTotal = this._nDataBytes * 8;
|
|
71555
|
+
var nBitsLeft = data.sigBytes * 8;
|
|
71556
|
+
dataWords[nBitsLeft >>> 5] |= 128 << 24 - nBitsLeft % 32;
|
|
71557
|
+
var nBitsTotalH = Math2.floor(nBitsTotal / 4294967296);
|
|
71558
|
+
var nBitsTotalL = nBitsTotal;
|
|
71559
|
+
dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 16711935 | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 4278255360;
|
|
71560
|
+
dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 16711935 | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 4278255360;
|
|
71561
|
+
data.sigBytes = (dataWords.length + 1) * 4;
|
|
71562
|
+
this._process();
|
|
71563
|
+
var hash = this._hash;
|
|
71564
|
+
var H2 = hash.words;
|
|
71565
|
+
for (var i2 = 0;i2 < 4; i2++) {
|
|
71566
|
+
var H_i = H2[i2];
|
|
71567
|
+
H2[i2] = (H_i << 8 | H_i >>> 24) & 16711935 | (H_i << 24 | H_i >>> 8) & 4278255360;
|
|
71568
|
+
}
|
|
71569
|
+
return hash;
|
|
71570
|
+
},
|
|
71571
|
+
clone: function() {
|
|
71572
|
+
var clone = Hasher.clone.call(this);
|
|
71573
|
+
clone._hash = this._hash.clone();
|
|
71574
|
+
return clone;
|
|
71575
|
+
}
|
|
71576
|
+
});
|
|
71577
|
+
function FF(a2, b2, c2, d2, x2, s2, t2) {
|
|
71578
|
+
var n2 = a2 + (b2 & c2 | ~b2 & d2) + x2 + t2;
|
|
71579
|
+
return (n2 << s2 | n2 >>> 32 - s2) + b2;
|
|
71580
|
+
}
|
|
71581
|
+
function GG(a2, b2, c2, d2, x2, s2, t2) {
|
|
71582
|
+
var n2 = a2 + (b2 & d2 | c2 & ~d2) + x2 + t2;
|
|
71583
|
+
return (n2 << s2 | n2 >>> 32 - s2) + b2;
|
|
71584
|
+
}
|
|
71585
|
+
function HH(a2, b2, c2, d2, x2, s2, t2) {
|
|
71586
|
+
var n2 = a2 + (b2 ^ c2 ^ d2) + x2 + t2;
|
|
71587
|
+
return (n2 << s2 | n2 >>> 32 - s2) + b2;
|
|
71588
|
+
}
|
|
71589
|
+
function II(a2, b2, c2, d2, x2, s2, t2) {
|
|
71590
|
+
var n2 = a2 + (c2 ^ (b2 | ~d2)) + x2 + t2;
|
|
71591
|
+
return (n2 << s2 | n2 >>> 32 - s2) + b2;
|
|
71592
|
+
}
|
|
71593
|
+
C2.MD5 = Hasher._createHelper(MD5);
|
|
71594
|
+
C2.HmacMD5 = Hasher._createHmacHelper(MD5);
|
|
71595
|
+
})(Math);
|
|
71596
|
+
return CryptoJS.MD5;
|
|
71597
|
+
});
|
|
71598
|
+
});
|
|
71599
|
+
var require_sha1 = __commonJS2((exports, module) => {
|
|
71600
|
+
(function(root2, factory) {
|
|
71601
|
+
if (typeof exports === "object") {
|
|
71602
|
+
module.exports = exports = factory(require_core());
|
|
71603
|
+
} else if (typeof define === "function" && define.amd) {
|
|
71604
|
+
define(["./core"], factory);
|
|
71605
|
+
} else {
|
|
71606
|
+
factory(root2.CryptoJS);
|
|
71607
|
+
}
|
|
71608
|
+
})(exports, function(CryptoJS) {
|
|
71609
|
+
(function() {
|
|
71610
|
+
var C2 = CryptoJS;
|
|
71611
|
+
var C_lib = C2.lib;
|
|
71612
|
+
var WordArray = C_lib.WordArray;
|
|
71613
|
+
var Hasher = C_lib.Hasher;
|
|
71614
|
+
var C_algo = C2.algo;
|
|
71615
|
+
var W2 = [];
|
|
71616
|
+
var SHA1 = C_algo.SHA1 = Hasher.extend({
|
|
71617
|
+
_doReset: function() {
|
|
71618
|
+
this._hash = new WordArray.init([
|
|
71619
|
+
1732584193,
|
|
71620
|
+
4023233417,
|
|
71621
|
+
2562383102,
|
|
71622
|
+
271733878,
|
|
71623
|
+
3285377520
|
|
71624
|
+
]);
|
|
71625
|
+
},
|
|
71626
|
+
_doProcessBlock: function(M2, offset) {
|
|
71627
|
+
var H2 = this._hash.words;
|
|
71628
|
+
var a2 = H2[0];
|
|
71629
|
+
var b2 = H2[1];
|
|
71630
|
+
var c2 = H2[2];
|
|
71631
|
+
var d2 = H2[3];
|
|
71632
|
+
var e2 = H2[4];
|
|
71633
|
+
for (var i2 = 0;i2 < 80; i2++) {
|
|
71634
|
+
if (i2 < 16) {
|
|
71635
|
+
W2[i2] = M2[offset + i2] | 0;
|
|
71636
|
+
} else {
|
|
71637
|
+
var n2 = W2[i2 - 3] ^ W2[i2 - 8] ^ W2[i2 - 14] ^ W2[i2 - 16];
|
|
71638
|
+
W2[i2] = n2 << 1 | n2 >>> 31;
|
|
71639
|
+
}
|
|
71640
|
+
var t2 = (a2 << 5 | a2 >>> 27) + e2 + W2[i2];
|
|
71641
|
+
if (i2 < 20) {
|
|
71642
|
+
t2 += (b2 & c2 | ~b2 & d2) + 1518500249;
|
|
71643
|
+
} else if (i2 < 40) {
|
|
71644
|
+
t2 += (b2 ^ c2 ^ d2) + 1859775393;
|
|
71645
|
+
} else if (i2 < 60) {
|
|
71646
|
+
t2 += (b2 & c2 | b2 & d2 | c2 & d2) - 1894007588;
|
|
71647
|
+
} else {
|
|
71648
|
+
t2 += (b2 ^ c2 ^ d2) - 899497514;
|
|
71649
|
+
}
|
|
71650
|
+
e2 = d2;
|
|
71651
|
+
d2 = c2;
|
|
71652
|
+
c2 = b2 << 30 | b2 >>> 2;
|
|
71653
|
+
b2 = a2;
|
|
71654
|
+
a2 = t2;
|
|
71655
|
+
}
|
|
71656
|
+
H2[0] = H2[0] + a2 | 0;
|
|
71657
|
+
H2[1] = H2[1] + b2 | 0;
|
|
71658
|
+
H2[2] = H2[2] + c2 | 0;
|
|
71659
|
+
H2[3] = H2[3] + d2 | 0;
|
|
71660
|
+
H2[4] = H2[4] + e2 | 0;
|
|
71661
|
+
},
|
|
71662
|
+
_doFinalize: function() {
|
|
71663
|
+
var data = this._data;
|
|
71664
|
+
var dataWords = data.words;
|
|
71665
|
+
var nBitsTotal = this._nDataBytes * 8;
|
|
71666
|
+
var nBitsLeft = data.sigBytes * 8;
|
|
71667
|
+
dataWords[nBitsLeft >>> 5] |= 128 << 24 - nBitsLeft % 32;
|
|
71668
|
+
dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 4294967296);
|
|
71669
|
+
dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal;
|
|
71670
|
+
data.sigBytes = dataWords.length * 4;
|
|
71671
|
+
this._process();
|
|
71672
|
+
return this._hash;
|
|
71673
|
+
},
|
|
71674
|
+
clone: function() {
|
|
71675
|
+
var clone = Hasher.clone.call(this);
|
|
71676
|
+
clone._hash = this._hash.clone();
|
|
71677
|
+
return clone;
|
|
71678
|
+
}
|
|
71679
|
+
});
|
|
71680
|
+
C2.SHA1 = Hasher._createHelper(SHA1);
|
|
71681
|
+
C2.HmacSHA1 = Hasher._createHmacHelper(SHA1);
|
|
71682
|
+
})();
|
|
71683
|
+
return CryptoJS.SHA1;
|
|
71684
|
+
});
|
|
71685
|
+
});
|
|
71686
|
+
var require_hmac = __commonJS2((exports, module) => {
|
|
71687
|
+
(function(root2, factory) {
|
|
71688
|
+
if (typeof exports === "object") {
|
|
71689
|
+
module.exports = exports = factory(require_core());
|
|
71690
|
+
} else if (typeof define === "function" && define.amd) {
|
|
71691
|
+
define(["./core"], factory);
|
|
71692
|
+
} else {
|
|
71693
|
+
factory(root2.CryptoJS);
|
|
71694
|
+
}
|
|
71695
|
+
})(exports, function(CryptoJS) {
|
|
71696
|
+
(function() {
|
|
71697
|
+
var C2 = CryptoJS;
|
|
71698
|
+
var C_lib = C2.lib;
|
|
71699
|
+
var Base = C_lib.Base;
|
|
71700
|
+
var C_enc = C2.enc;
|
|
71701
|
+
var Utf8 = C_enc.Utf8;
|
|
71702
|
+
var C_algo = C2.algo;
|
|
71703
|
+
var HMAC = C_algo.HMAC = Base.extend({
|
|
71704
|
+
init: function(hasher, key2) {
|
|
71705
|
+
hasher = this._hasher = new hasher.init;
|
|
71706
|
+
if (typeof key2 == "string") {
|
|
71707
|
+
key2 = Utf8.parse(key2);
|
|
71708
|
+
}
|
|
71709
|
+
var hasherBlockSize = hasher.blockSize;
|
|
71710
|
+
var hasherBlockSizeBytes = hasherBlockSize * 4;
|
|
71711
|
+
if (key2.sigBytes > hasherBlockSizeBytes) {
|
|
71712
|
+
key2 = hasher.finalize(key2);
|
|
71713
|
+
}
|
|
71714
|
+
key2.clamp();
|
|
71715
|
+
var oKey = this._oKey = key2.clone();
|
|
71716
|
+
var iKey = this._iKey = key2.clone();
|
|
71717
|
+
var oKeyWords = oKey.words;
|
|
71718
|
+
var iKeyWords = iKey.words;
|
|
71719
|
+
for (var i2 = 0;i2 < hasherBlockSize; i2++) {
|
|
71720
|
+
oKeyWords[i2] ^= 1549556828;
|
|
71721
|
+
iKeyWords[i2] ^= 909522486;
|
|
71722
|
+
}
|
|
71723
|
+
oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
|
|
71724
|
+
this.reset();
|
|
71725
|
+
},
|
|
71726
|
+
reset: function() {
|
|
71727
|
+
var hasher = this._hasher;
|
|
71728
|
+
hasher.reset();
|
|
71729
|
+
hasher.update(this._iKey);
|
|
71730
|
+
},
|
|
71731
|
+
update: function(messageUpdate) {
|
|
71732
|
+
this._hasher.update(messageUpdate);
|
|
71733
|
+
return this;
|
|
71734
|
+
},
|
|
71735
|
+
finalize: function(messageUpdate) {
|
|
71736
|
+
var hasher = this._hasher;
|
|
71737
|
+
var innerHash = hasher.finalize(messageUpdate);
|
|
71738
|
+
hasher.reset();
|
|
71739
|
+
var hmac2 = hasher.finalize(this._oKey.clone().concat(innerHash));
|
|
71740
|
+
return hmac2;
|
|
71741
|
+
}
|
|
71742
|
+
});
|
|
71743
|
+
})();
|
|
71744
|
+
});
|
|
71745
|
+
});
|
|
71746
|
+
var require_evpkdf = __commonJS2((exports, module) => {
|
|
71747
|
+
(function(root2, factory, undef) {
|
|
71748
|
+
if (typeof exports === "object") {
|
|
71749
|
+
module.exports = exports = factory(require_core(), require_sha1(), require_hmac());
|
|
71750
|
+
} else if (typeof define === "function" && define.amd) {
|
|
71751
|
+
define(["./core", "./sha1", "./hmac"], factory);
|
|
71752
|
+
} else {
|
|
71753
|
+
factory(root2.CryptoJS);
|
|
71754
|
+
}
|
|
71755
|
+
})(exports, function(CryptoJS) {
|
|
71756
|
+
(function() {
|
|
71757
|
+
var C2 = CryptoJS;
|
|
71758
|
+
var C_lib = C2.lib;
|
|
71759
|
+
var Base = C_lib.Base;
|
|
71760
|
+
var WordArray = C_lib.WordArray;
|
|
71761
|
+
var C_algo = C2.algo;
|
|
71762
|
+
var MD5 = C_algo.MD5;
|
|
71763
|
+
var EvpKDF = C_algo.EvpKDF = Base.extend({
|
|
71764
|
+
cfg: Base.extend({
|
|
71765
|
+
keySize: 128 / 32,
|
|
71766
|
+
hasher: MD5,
|
|
71767
|
+
iterations: 1
|
|
71768
|
+
}),
|
|
71769
|
+
init: function(cfg) {
|
|
71770
|
+
this.cfg = this.cfg.extend(cfg);
|
|
71771
|
+
},
|
|
71772
|
+
compute: function(password, salt) {
|
|
71773
|
+
var block;
|
|
71774
|
+
var cfg = this.cfg;
|
|
71775
|
+
var hasher = cfg.hasher.create();
|
|
71776
|
+
var derivedKey = WordArray.create();
|
|
71777
|
+
var derivedKeyWords = derivedKey.words;
|
|
71778
|
+
var keySize = cfg.keySize;
|
|
71779
|
+
var iterations = cfg.iterations;
|
|
71780
|
+
while (derivedKeyWords.length < keySize) {
|
|
71781
|
+
if (block) {
|
|
71782
|
+
hasher.update(block);
|
|
71783
|
+
}
|
|
71784
|
+
block = hasher.update(password).finalize(salt);
|
|
71785
|
+
hasher.reset();
|
|
71786
|
+
for (var i2 = 1;i2 < iterations; i2++) {
|
|
71787
|
+
block = hasher.finalize(block);
|
|
71788
|
+
hasher.reset();
|
|
71789
|
+
}
|
|
71790
|
+
derivedKey.concat(block);
|
|
71791
|
+
}
|
|
71792
|
+
derivedKey.sigBytes = keySize * 4;
|
|
71793
|
+
return derivedKey;
|
|
71794
|
+
}
|
|
71795
|
+
});
|
|
71796
|
+
C2.EvpKDF = function(password, salt, cfg) {
|
|
71797
|
+
return EvpKDF.create(cfg).compute(password, salt);
|
|
71798
|
+
};
|
|
71799
|
+
})();
|
|
71800
|
+
return CryptoJS.EvpKDF;
|
|
71801
|
+
});
|
|
71802
|
+
});
|
|
71803
|
+
var require_cipher_core = __commonJS2((exports, module) => {
|
|
71804
|
+
(function(root2, factory, undef) {
|
|
71805
|
+
if (typeof exports === "object") {
|
|
71806
|
+
module.exports = exports = factory(require_core(), require_evpkdf());
|
|
71807
|
+
} else if (typeof define === "function" && define.amd) {
|
|
71808
|
+
define(["./core", "./evpkdf"], factory);
|
|
71809
|
+
} else {
|
|
71810
|
+
factory(root2.CryptoJS);
|
|
71811
|
+
}
|
|
71812
|
+
})(exports, function(CryptoJS) {
|
|
71813
|
+
CryptoJS.lib.Cipher || function(undefined2) {
|
|
71814
|
+
var C2 = CryptoJS;
|
|
71815
|
+
var C_lib = C2.lib;
|
|
71816
|
+
var Base = C_lib.Base;
|
|
71817
|
+
var WordArray = C_lib.WordArray;
|
|
71818
|
+
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
|
|
71819
|
+
var C_enc = C2.enc;
|
|
71820
|
+
var Utf8 = C_enc.Utf8;
|
|
71821
|
+
var Base64 = C_enc.Base64;
|
|
71822
|
+
var C_algo = C2.algo;
|
|
71823
|
+
var EvpKDF = C_algo.EvpKDF;
|
|
71824
|
+
var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
|
|
71825
|
+
cfg: Base.extend(),
|
|
71826
|
+
createEncryptor: function(key2, cfg) {
|
|
71827
|
+
return this.create(this._ENC_XFORM_MODE, key2, cfg);
|
|
71828
|
+
},
|
|
71829
|
+
createDecryptor: function(key2, cfg) {
|
|
71830
|
+
return this.create(this._DEC_XFORM_MODE, key2, cfg);
|
|
71831
|
+
},
|
|
71832
|
+
init: function(xformMode, key2, cfg) {
|
|
71833
|
+
this.cfg = this.cfg.extend(cfg);
|
|
71834
|
+
this._xformMode = xformMode;
|
|
71835
|
+
this._key = key2;
|
|
71836
|
+
this.reset();
|
|
71837
|
+
},
|
|
71838
|
+
reset: function() {
|
|
71839
|
+
BufferedBlockAlgorithm.reset.call(this);
|
|
71840
|
+
this._doReset();
|
|
71841
|
+
},
|
|
71842
|
+
process: function(dataUpdate) {
|
|
71843
|
+
this._append(dataUpdate);
|
|
71844
|
+
return this._process();
|
|
71845
|
+
},
|
|
71846
|
+
finalize: function(dataUpdate) {
|
|
71847
|
+
if (dataUpdate) {
|
|
71848
|
+
this._append(dataUpdate);
|
|
71849
|
+
}
|
|
71850
|
+
var finalProcessedData = this._doFinalize();
|
|
71851
|
+
return finalProcessedData;
|
|
71852
|
+
},
|
|
71853
|
+
keySize: 128 / 32,
|
|
71854
|
+
ivSize: 128 / 32,
|
|
71855
|
+
_ENC_XFORM_MODE: 1,
|
|
71856
|
+
_DEC_XFORM_MODE: 2,
|
|
71857
|
+
_createHelper: function() {
|
|
71858
|
+
function selectCipherStrategy(key2) {
|
|
71859
|
+
if (typeof key2 == "string") {
|
|
71860
|
+
return PasswordBasedCipher;
|
|
71861
|
+
} else {
|
|
71862
|
+
return SerializableCipher;
|
|
71863
|
+
}
|
|
71864
|
+
}
|
|
71865
|
+
return function(cipher2) {
|
|
71866
|
+
return {
|
|
71867
|
+
encrypt: function(message, key2, cfg) {
|
|
71868
|
+
return selectCipherStrategy(key2).encrypt(cipher2, message, key2, cfg);
|
|
71869
|
+
},
|
|
71870
|
+
decrypt: function(ciphertext, key2, cfg) {
|
|
71871
|
+
return selectCipherStrategy(key2).decrypt(cipher2, ciphertext, key2, cfg);
|
|
71872
|
+
}
|
|
71873
|
+
};
|
|
71874
|
+
};
|
|
71875
|
+
}()
|
|
71876
|
+
});
|
|
71877
|
+
var StreamCipher = C_lib.StreamCipher = Cipher.extend({
|
|
71878
|
+
_doFinalize: function() {
|
|
71879
|
+
var finalProcessedBlocks = this._process(true);
|
|
71880
|
+
return finalProcessedBlocks;
|
|
71881
|
+
},
|
|
71882
|
+
blockSize: 1
|
|
71883
|
+
});
|
|
71884
|
+
var C_mode = C2.mode = {};
|
|
71885
|
+
var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
|
|
71886
|
+
createEncryptor: function(cipher2, iv) {
|
|
71887
|
+
return this.Encryptor.create(cipher2, iv);
|
|
71888
|
+
},
|
|
71889
|
+
createDecryptor: function(cipher2, iv) {
|
|
71890
|
+
return this.Decryptor.create(cipher2, iv);
|
|
71891
|
+
},
|
|
71892
|
+
init: function(cipher2, iv) {
|
|
71893
|
+
this._cipher = cipher2;
|
|
71894
|
+
this._iv = iv;
|
|
71895
|
+
}
|
|
71896
|
+
});
|
|
71897
|
+
var CBC = C_mode.CBC = function() {
|
|
71898
|
+
var CBC2 = BlockCipherMode.extend();
|
|
71899
|
+
CBC2.Encryptor = CBC2.extend({
|
|
71900
|
+
processBlock: function(words, offset) {
|
|
71901
|
+
var cipher2 = this._cipher;
|
|
71902
|
+
var blockSize = cipher2.blockSize;
|
|
71903
|
+
xorBlock.call(this, words, offset, blockSize);
|
|
71904
|
+
cipher2.encryptBlock(words, offset);
|
|
71905
|
+
this._prevBlock = words.slice(offset, offset + blockSize);
|
|
71906
|
+
}
|
|
71907
|
+
});
|
|
71908
|
+
CBC2.Decryptor = CBC2.extend({
|
|
71909
|
+
processBlock: function(words, offset) {
|
|
71910
|
+
var cipher2 = this._cipher;
|
|
71911
|
+
var blockSize = cipher2.blockSize;
|
|
71912
|
+
var thisBlock = words.slice(offset, offset + blockSize);
|
|
71913
|
+
cipher2.decryptBlock(words, offset);
|
|
71914
|
+
xorBlock.call(this, words, offset, blockSize);
|
|
71915
|
+
this._prevBlock = thisBlock;
|
|
71916
|
+
}
|
|
71917
|
+
});
|
|
71918
|
+
function xorBlock(words, offset, blockSize) {
|
|
71919
|
+
var block;
|
|
71920
|
+
var iv = this._iv;
|
|
71921
|
+
if (iv) {
|
|
71922
|
+
block = iv;
|
|
71923
|
+
this._iv = undefined2;
|
|
71924
|
+
} else {
|
|
71925
|
+
block = this._prevBlock;
|
|
71926
|
+
}
|
|
71927
|
+
for (var i2 = 0;i2 < blockSize; i2++) {
|
|
71928
|
+
words[offset + i2] ^= block[i2];
|
|
71929
|
+
}
|
|
71930
|
+
}
|
|
71931
|
+
return CBC2;
|
|
71932
|
+
}();
|
|
71933
|
+
var C_pad = C2.pad = {};
|
|
71934
|
+
var Pkcs7 = C_pad.Pkcs7 = {
|
|
71935
|
+
pad: function(data, blockSize) {
|
|
71936
|
+
var blockSizeBytes = blockSize * 4;
|
|
71937
|
+
var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
|
|
71938
|
+
var paddingWord = nPaddingBytes << 24 | nPaddingBytes << 16 | nPaddingBytes << 8 | nPaddingBytes;
|
|
71939
|
+
var paddingWords = [];
|
|
71940
|
+
for (var i2 = 0;i2 < nPaddingBytes; i2 += 4) {
|
|
71941
|
+
paddingWords.push(paddingWord);
|
|
71942
|
+
}
|
|
71943
|
+
var padding = WordArray.create(paddingWords, nPaddingBytes);
|
|
71944
|
+
data.concat(padding);
|
|
71945
|
+
},
|
|
71946
|
+
unpad: function(data) {
|
|
71947
|
+
var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 255;
|
|
71948
|
+
data.sigBytes -= nPaddingBytes;
|
|
71949
|
+
}
|
|
71950
|
+
};
|
|
71951
|
+
var BlockCipher = C_lib.BlockCipher = Cipher.extend({
|
|
71952
|
+
cfg: Cipher.cfg.extend({
|
|
71953
|
+
mode: CBC,
|
|
71954
|
+
padding: Pkcs7
|
|
71955
|
+
}),
|
|
71956
|
+
reset: function() {
|
|
71957
|
+
var modeCreator;
|
|
71958
|
+
Cipher.reset.call(this);
|
|
71959
|
+
var cfg = this.cfg;
|
|
71960
|
+
var iv = cfg.iv;
|
|
71961
|
+
var mode = cfg.mode;
|
|
71962
|
+
if (this._xformMode == this._ENC_XFORM_MODE) {
|
|
71963
|
+
modeCreator = mode.createEncryptor;
|
|
71964
|
+
} else {
|
|
71965
|
+
modeCreator = mode.createDecryptor;
|
|
71966
|
+
this._minBufferSize = 1;
|
|
71967
|
+
}
|
|
71968
|
+
if (this._mode && this._mode.__creator == modeCreator) {
|
|
71969
|
+
this._mode.init(this, iv && iv.words);
|
|
71970
|
+
} else {
|
|
71971
|
+
this._mode = modeCreator.call(mode, this, iv && iv.words);
|
|
71972
|
+
this._mode.__creator = modeCreator;
|
|
71973
|
+
}
|
|
71974
|
+
},
|
|
71975
|
+
_doProcessBlock: function(words, offset) {
|
|
71976
|
+
this._mode.processBlock(words, offset);
|
|
71977
|
+
},
|
|
71978
|
+
_doFinalize: function() {
|
|
71979
|
+
var finalProcessedBlocks;
|
|
71980
|
+
var padding = this.cfg.padding;
|
|
71981
|
+
if (this._xformMode == this._ENC_XFORM_MODE) {
|
|
71982
|
+
padding.pad(this._data, this.blockSize);
|
|
71983
|
+
finalProcessedBlocks = this._process(true);
|
|
71984
|
+
} else {
|
|
71985
|
+
finalProcessedBlocks = this._process(true);
|
|
71986
|
+
padding.unpad(finalProcessedBlocks);
|
|
71987
|
+
}
|
|
71988
|
+
return finalProcessedBlocks;
|
|
71989
|
+
},
|
|
71990
|
+
blockSize: 128 / 32
|
|
71991
|
+
});
|
|
71992
|
+
var CipherParams = C_lib.CipherParams = Base.extend({
|
|
71993
|
+
init: function(cipherParams) {
|
|
71994
|
+
this.mixIn(cipherParams);
|
|
71995
|
+
},
|
|
71996
|
+
toString: function(formatter) {
|
|
71997
|
+
return (formatter || this.formatter).stringify(this);
|
|
71998
|
+
}
|
|
71999
|
+
});
|
|
72000
|
+
var C_format = C2.format = {};
|
|
72001
|
+
var OpenSSLFormatter = C_format.OpenSSL = {
|
|
72002
|
+
stringify: function(cipherParams) {
|
|
72003
|
+
var wordArray;
|
|
72004
|
+
var ciphertext = cipherParams.ciphertext;
|
|
72005
|
+
var salt = cipherParams.salt;
|
|
72006
|
+
if (salt) {
|
|
72007
|
+
wordArray = WordArray.create([1398893684, 1701076831]).concat(salt).concat(ciphertext);
|
|
72008
|
+
} else {
|
|
72009
|
+
wordArray = ciphertext;
|
|
72010
|
+
}
|
|
72011
|
+
return wordArray.toString(Base64);
|
|
72012
|
+
},
|
|
72013
|
+
parse: function(openSSLStr) {
|
|
72014
|
+
var salt;
|
|
72015
|
+
var ciphertext = Base64.parse(openSSLStr);
|
|
72016
|
+
var ciphertextWords = ciphertext.words;
|
|
72017
|
+
if (ciphertextWords[0] == 1398893684 && ciphertextWords[1] == 1701076831) {
|
|
72018
|
+
salt = WordArray.create(ciphertextWords.slice(2, 4));
|
|
72019
|
+
ciphertextWords.splice(0, 4);
|
|
72020
|
+
ciphertext.sigBytes -= 16;
|
|
72021
|
+
}
|
|
72022
|
+
return CipherParams.create({ ciphertext, salt });
|
|
72023
|
+
}
|
|
72024
|
+
};
|
|
72025
|
+
var SerializableCipher = C_lib.SerializableCipher = Base.extend({
|
|
72026
|
+
cfg: Base.extend({
|
|
72027
|
+
format: OpenSSLFormatter
|
|
72028
|
+
}),
|
|
72029
|
+
encrypt: function(cipher2, message, key2, cfg) {
|
|
72030
|
+
cfg = this.cfg.extend(cfg);
|
|
72031
|
+
var encryptor = cipher2.createEncryptor(key2, cfg);
|
|
72032
|
+
var ciphertext = encryptor.finalize(message);
|
|
72033
|
+
var cipherCfg = encryptor.cfg;
|
|
72034
|
+
return CipherParams.create({
|
|
72035
|
+
ciphertext,
|
|
72036
|
+
key: key2,
|
|
72037
|
+
iv: cipherCfg.iv,
|
|
72038
|
+
algorithm: cipher2,
|
|
72039
|
+
mode: cipherCfg.mode,
|
|
72040
|
+
padding: cipherCfg.padding,
|
|
72041
|
+
blockSize: cipher2.blockSize,
|
|
72042
|
+
formatter: cfg.format
|
|
72043
|
+
});
|
|
72044
|
+
},
|
|
72045
|
+
decrypt: function(cipher2, ciphertext, key2, cfg) {
|
|
72046
|
+
cfg = this.cfg.extend(cfg);
|
|
72047
|
+
ciphertext = this._parse(ciphertext, cfg.format);
|
|
72048
|
+
var plaintext = cipher2.createDecryptor(key2, cfg).finalize(ciphertext.ciphertext);
|
|
72049
|
+
return plaintext;
|
|
72050
|
+
},
|
|
72051
|
+
_parse: function(ciphertext, format) {
|
|
72052
|
+
if (typeof ciphertext == "string") {
|
|
72053
|
+
return format.parse(ciphertext, this);
|
|
72054
|
+
} else {
|
|
72055
|
+
return ciphertext;
|
|
72056
|
+
}
|
|
72057
|
+
}
|
|
72058
|
+
});
|
|
72059
|
+
var C_kdf = C2.kdf = {};
|
|
72060
|
+
var OpenSSLKdf = C_kdf.OpenSSL = {
|
|
72061
|
+
execute: function(password, keySize, ivSize, salt, hasher) {
|
|
72062
|
+
if (!salt) {
|
|
72063
|
+
salt = WordArray.random(64 / 8);
|
|
72064
|
+
}
|
|
72065
|
+
if (!hasher) {
|
|
72066
|
+
var key2 = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
|
|
72067
|
+
} else {
|
|
72068
|
+
var key2 = EvpKDF.create({ keySize: keySize + ivSize, hasher }).compute(password, salt);
|
|
72069
|
+
}
|
|
72070
|
+
var iv = WordArray.create(key2.words.slice(keySize), ivSize * 4);
|
|
72071
|
+
key2.sigBytes = keySize * 4;
|
|
72072
|
+
return CipherParams.create({ key: key2, iv, salt });
|
|
72073
|
+
}
|
|
72074
|
+
};
|
|
72075
|
+
var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
|
|
72076
|
+
cfg: SerializableCipher.cfg.extend({
|
|
72077
|
+
kdf: OpenSSLKdf
|
|
72078
|
+
}),
|
|
72079
|
+
encrypt: function(cipher2, message, password, cfg) {
|
|
72080
|
+
cfg = this.cfg.extend(cfg);
|
|
72081
|
+
var derivedParams = cfg.kdf.execute(password, cipher2.keySize, cipher2.ivSize, cfg.salt, cfg.hasher);
|
|
72082
|
+
cfg.iv = derivedParams.iv;
|
|
72083
|
+
var ciphertext = SerializableCipher.encrypt.call(this, cipher2, message, derivedParams.key, cfg);
|
|
72084
|
+
ciphertext.mixIn(derivedParams);
|
|
72085
|
+
return ciphertext;
|
|
72086
|
+
},
|
|
72087
|
+
decrypt: function(cipher2, ciphertext, password, cfg) {
|
|
72088
|
+
cfg = this.cfg.extend(cfg);
|
|
72089
|
+
ciphertext = this._parse(ciphertext, cfg.format);
|
|
72090
|
+
var derivedParams = cfg.kdf.execute(password, cipher2.keySize, cipher2.ivSize, ciphertext.salt, cfg.hasher);
|
|
72091
|
+
cfg.iv = derivedParams.iv;
|
|
72092
|
+
var plaintext = SerializableCipher.decrypt.call(this, cipher2, ciphertext, derivedParams.key, cfg);
|
|
72093
|
+
return plaintext;
|
|
72094
|
+
}
|
|
72095
|
+
});
|
|
72096
|
+
}();
|
|
72097
|
+
});
|
|
72098
|
+
});
|
|
72099
|
+
var require_aes = __commonJS2((exports, module) => {
|
|
72100
|
+
(function(root2, factory, undef) {
|
|
72101
|
+
if (typeof exports === "object") {
|
|
72102
|
+
module.exports = exports = factory(require_core(), require_enc_base64(), require_md5(), require_evpkdf(), require_cipher_core());
|
|
72103
|
+
} else if (typeof define === "function" && define.amd) {
|
|
72104
|
+
define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
|
|
72105
|
+
} else {
|
|
72106
|
+
factory(root2.CryptoJS);
|
|
72107
|
+
}
|
|
72108
|
+
})(exports, function(CryptoJS) {
|
|
72109
|
+
(function() {
|
|
72110
|
+
var C2 = CryptoJS;
|
|
72111
|
+
var C_lib = C2.lib;
|
|
72112
|
+
var BlockCipher = C_lib.BlockCipher;
|
|
72113
|
+
var C_algo = C2.algo;
|
|
72114
|
+
var SBOX = [];
|
|
72115
|
+
var INV_SBOX = [];
|
|
72116
|
+
var SUB_MIX_0 = [];
|
|
72117
|
+
var SUB_MIX_1 = [];
|
|
72118
|
+
var SUB_MIX_2 = [];
|
|
72119
|
+
var SUB_MIX_3 = [];
|
|
72120
|
+
var INV_SUB_MIX_0 = [];
|
|
72121
|
+
var INV_SUB_MIX_1 = [];
|
|
72122
|
+
var INV_SUB_MIX_2 = [];
|
|
72123
|
+
var INV_SUB_MIX_3 = [];
|
|
72124
|
+
(function() {
|
|
72125
|
+
var d2 = [];
|
|
72126
|
+
for (var i2 = 0;i2 < 256; i2++) {
|
|
72127
|
+
if (i2 < 128) {
|
|
72128
|
+
d2[i2] = i2 << 1;
|
|
72129
|
+
} else {
|
|
72130
|
+
d2[i2] = i2 << 1 ^ 283;
|
|
72131
|
+
}
|
|
72132
|
+
}
|
|
72133
|
+
var x2 = 0;
|
|
72134
|
+
var xi = 0;
|
|
72135
|
+
for (var i2 = 0;i2 < 256; i2++) {
|
|
72136
|
+
var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4;
|
|
72137
|
+
sx = sx >>> 8 ^ sx & 255 ^ 99;
|
|
72138
|
+
SBOX[x2] = sx;
|
|
72139
|
+
INV_SBOX[sx] = x2;
|
|
72140
|
+
var x22 = d2[x2];
|
|
72141
|
+
var x4 = d2[x22];
|
|
72142
|
+
var x8 = d2[x4];
|
|
72143
|
+
var t2 = d2[sx] * 257 ^ sx * 16843008;
|
|
72144
|
+
SUB_MIX_0[x2] = t2 << 24 | t2 >>> 8;
|
|
72145
|
+
SUB_MIX_1[x2] = t2 << 16 | t2 >>> 16;
|
|
72146
|
+
SUB_MIX_2[x2] = t2 << 8 | t2 >>> 24;
|
|
72147
|
+
SUB_MIX_3[x2] = t2;
|
|
72148
|
+
var t2 = x8 * 16843009 ^ x4 * 65537 ^ x22 * 257 ^ x2 * 16843008;
|
|
72149
|
+
INV_SUB_MIX_0[sx] = t2 << 24 | t2 >>> 8;
|
|
72150
|
+
INV_SUB_MIX_1[sx] = t2 << 16 | t2 >>> 16;
|
|
72151
|
+
INV_SUB_MIX_2[sx] = t2 << 8 | t2 >>> 24;
|
|
72152
|
+
INV_SUB_MIX_3[sx] = t2;
|
|
72153
|
+
if (!x2) {
|
|
72154
|
+
x2 = xi = 1;
|
|
72155
|
+
} else {
|
|
72156
|
+
x2 = x22 ^ d2[d2[d2[x8 ^ x22]]];
|
|
72157
|
+
xi ^= d2[d2[xi]];
|
|
72158
|
+
}
|
|
72159
|
+
}
|
|
72160
|
+
})();
|
|
72161
|
+
var RCON = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54];
|
|
72162
|
+
var AES = C_algo.AES = BlockCipher.extend({
|
|
72163
|
+
_doReset: function() {
|
|
72164
|
+
var t2;
|
|
72165
|
+
if (this._nRounds && this._keyPriorReset === this._key) {
|
|
72166
|
+
return;
|
|
72167
|
+
}
|
|
72168
|
+
var key2 = this._keyPriorReset = this._key;
|
|
72169
|
+
var keyWords = key2.words;
|
|
72170
|
+
var keySize = key2.sigBytes / 4;
|
|
72171
|
+
var nRounds = this._nRounds = keySize + 6;
|
|
72172
|
+
var ksRows = (nRounds + 1) * 4;
|
|
72173
|
+
var keySchedule = this._keySchedule = [];
|
|
72174
|
+
for (var ksRow = 0;ksRow < ksRows; ksRow++) {
|
|
72175
|
+
if (ksRow < keySize) {
|
|
72176
|
+
keySchedule[ksRow] = keyWords[ksRow];
|
|
72177
|
+
} else {
|
|
72178
|
+
t2 = keySchedule[ksRow - 1];
|
|
72179
|
+
if (!(ksRow % keySize)) {
|
|
72180
|
+
t2 = t2 << 8 | t2 >>> 24;
|
|
72181
|
+
t2 = SBOX[t2 >>> 24] << 24 | SBOX[t2 >>> 16 & 255] << 16 | SBOX[t2 >>> 8 & 255] << 8 | SBOX[t2 & 255];
|
|
72182
|
+
t2 ^= RCON[ksRow / keySize | 0] << 24;
|
|
72183
|
+
} else if (keySize > 6 && ksRow % keySize == 4) {
|
|
72184
|
+
t2 = SBOX[t2 >>> 24] << 24 | SBOX[t2 >>> 16 & 255] << 16 | SBOX[t2 >>> 8 & 255] << 8 | SBOX[t2 & 255];
|
|
72185
|
+
}
|
|
72186
|
+
keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t2;
|
|
72187
|
+
}
|
|
72188
|
+
}
|
|
72189
|
+
var invKeySchedule = this._invKeySchedule = [];
|
|
72190
|
+
for (var invKsRow = 0;invKsRow < ksRows; invKsRow++) {
|
|
72191
|
+
var ksRow = ksRows - invKsRow;
|
|
72192
|
+
if (invKsRow % 4) {
|
|
72193
|
+
var t2 = keySchedule[ksRow];
|
|
72194
|
+
} else {
|
|
72195
|
+
var t2 = keySchedule[ksRow - 4];
|
|
72196
|
+
}
|
|
72197
|
+
if (invKsRow < 4 || ksRow <= 4) {
|
|
72198
|
+
invKeySchedule[invKsRow] = t2;
|
|
72199
|
+
} else {
|
|
72200
|
+
invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t2 >>> 24]] ^ INV_SUB_MIX_1[SBOX[t2 >>> 16 & 255]] ^ INV_SUB_MIX_2[SBOX[t2 >>> 8 & 255]] ^ INV_SUB_MIX_3[SBOX[t2 & 255]];
|
|
72201
|
+
}
|
|
72202
|
+
}
|
|
72203
|
+
},
|
|
72204
|
+
encryptBlock: function(M2, offset) {
|
|
72205
|
+
this._doCryptBlock(M2, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
|
|
72206
|
+
},
|
|
72207
|
+
decryptBlock: function(M2, offset) {
|
|
72208
|
+
var t2 = M2[offset + 1];
|
|
72209
|
+
M2[offset + 1] = M2[offset + 3];
|
|
72210
|
+
M2[offset + 3] = t2;
|
|
72211
|
+
this._doCryptBlock(M2, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
|
|
72212
|
+
var t2 = M2[offset + 1];
|
|
72213
|
+
M2[offset + 1] = M2[offset + 3];
|
|
72214
|
+
M2[offset + 3] = t2;
|
|
72215
|
+
},
|
|
72216
|
+
_doCryptBlock: function(M2, offset, keySchedule, SUB_MIX_02, SUB_MIX_12, SUB_MIX_22, SUB_MIX_32, SBOX2) {
|
|
72217
|
+
var nRounds = this._nRounds;
|
|
72218
|
+
var s0 = M2[offset] ^ keySchedule[0];
|
|
72219
|
+
var s1 = M2[offset + 1] ^ keySchedule[1];
|
|
72220
|
+
var s2 = M2[offset + 2] ^ keySchedule[2];
|
|
72221
|
+
var s3 = M2[offset + 3] ^ keySchedule[3];
|
|
72222
|
+
var ksRow = 4;
|
|
72223
|
+
for (var round = 1;round < nRounds; round++) {
|
|
72224
|
+
var t0 = SUB_MIX_02[s0 >>> 24] ^ SUB_MIX_12[s1 >>> 16 & 255] ^ SUB_MIX_22[s2 >>> 8 & 255] ^ SUB_MIX_32[s3 & 255] ^ keySchedule[ksRow++];
|
|
72225
|
+
var t1 = SUB_MIX_02[s1 >>> 24] ^ SUB_MIX_12[s2 >>> 16 & 255] ^ SUB_MIX_22[s3 >>> 8 & 255] ^ SUB_MIX_32[s0 & 255] ^ keySchedule[ksRow++];
|
|
72226
|
+
var t2 = SUB_MIX_02[s2 >>> 24] ^ SUB_MIX_12[s3 >>> 16 & 255] ^ SUB_MIX_22[s0 >>> 8 & 255] ^ SUB_MIX_32[s1 & 255] ^ keySchedule[ksRow++];
|
|
72227
|
+
var t3 = SUB_MIX_02[s3 >>> 24] ^ SUB_MIX_12[s0 >>> 16 & 255] ^ SUB_MIX_22[s1 >>> 8 & 255] ^ SUB_MIX_32[s2 & 255] ^ keySchedule[ksRow++];
|
|
72228
|
+
s0 = t0;
|
|
72229
|
+
s1 = t1;
|
|
72230
|
+
s2 = t2;
|
|
72231
|
+
s3 = t3;
|
|
72232
|
+
}
|
|
72233
|
+
var t0 = (SBOX2[s0 >>> 24] << 24 | SBOX2[s1 >>> 16 & 255] << 16 | SBOX2[s2 >>> 8 & 255] << 8 | SBOX2[s3 & 255]) ^ keySchedule[ksRow++];
|
|
72234
|
+
var t1 = (SBOX2[s1 >>> 24] << 24 | SBOX2[s2 >>> 16 & 255] << 16 | SBOX2[s3 >>> 8 & 255] << 8 | SBOX2[s0 & 255]) ^ keySchedule[ksRow++];
|
|
72235
|
+
var t2 = (SBOX2[s2 >>> 24] << 24 | SBOX2[s3 >>> 16 & 255] << 16 | SBOX2[s0 >>> 8 & 255] << 8 | SBOX2[s1 & 255]) ^ keySchedule[ksRow++];
|
|
72236
|
+
var t3 = (SBOX2[s3 >>> 24] << 24 | SBOX2[s0 >>> 16 & 255] << 16 | SBOX2[s1 >>> 8 & 255] << 8 | SBOX2[s2 & 255]) ^ keySchedule[ksRow++];
|
|
72237
|
+
M2[offset] = t0;
|
|
72238
|
+
M2[offset + 1] = t1;
|
|
72239
|
+
M2[offset + 2] = t2;
|
|
72240
|
+
M2[offset + 3] = t3;
|
|
72241
|
+
},
|
|
72242
|
+
keySize: 256 / 32
|
|
72243
|
+
});
|
|
72244
|
+
C2.AES = BlockCipher._createHelper(AES);
|
|
72245
|
+
})();
|
|
72246
|
+
return CryptoJS.AES;
|
|
72247
|
+
});
|
|
72248
|
+
});
|
|
72249
|
+
var require_enc_utf8 = __commonJS2((exports, module) => {
|
|
72250
|
+
(function(root2, factory) {
|
|
72251
|
+
if (typeof exports === "object") {
|
|
72252
|
+
module.exports = exports = factory(require_core());
|
|
72253
|
+
} else if (typeof define === "function" && define.amd) {
|
|
72254
|
+
define(["./core"], factory);
|
|
72255
|
+
} else {
|
|
72256
|
+
factory(root2.CryptoJS);
|
|
72257
|
+
}
|
|
72258
|
+
})(exports, function(CryptoJS) {
|
|
72259
|
+
return CryptoJS.enc.Utf8;
|
|
72260
|
+
});
|
|
72261
|
+
});
|
|
71047
72262
|
var default_format = "RFC3986";
|
|
71048
72263
|
var formatters = {
|
|
71049
72264
|
RFC1738: (v2) => String(v2).replace(/%20/g, "+"),
|
|
@@ -71349,7 +72564,7 @@ function stringify(object, opts = {}) {
|
|
|
71349
72564
|
}
|
|
71350
72565
|
return joined.length > 0 ? prefix + joined : "";
|
|
71351
72566
|
}
|
|
71352
|
-
var VERSION = "4.
|
|
72567
|
+
var VERSION = "4.103.0";
|
|
71353
72568
|
var auto = false;
|
|
71354
72569
|
var kind = undefined;
|
|
71355
72570
|
var fetch = undefined;
|
|
@@ -71888,7 +73103,7 @@ class LineDecoder {
|
|
|
71888
73103
|
newData.set(this.buffer);
|
|
71889
73104
|
newData.set(binaryChunk, this.buffer.length);
|
|
71890
73105
|
this.buffer = newData;
|
|
71891
|
-
const
|
|
73106
|
+
const lines = [];
|
|
71892
73107
|
let patternIndex;
|
|
71893
73108
|
while ((patternIndex = findNewlineIndex(this.buffer, __classPrivateFieldGet6(this, _LineDecoder_carriageReturnIndex, "f"))) != null) {
|
|
71894
73109
|
if (patternIndex.carriage && __classPrivateFieldGet6(this, _LineDecoder_carriageReturnIndex, "f") == null) {
|
|
@@ -71896,18 +73111,18 @@ class LineDecoder {
|
|
|
71896
73111
|
continue;
|
|
71897
73112
|
}
|
|
71898
73113
|
if (__classPrivateFieldGet6(this, _LineDecoder_carriageReturnIndex, "f") != null && (patternIndex.index !== __classPrivateFieldGet6(this, _LineDecoder_carriageReturnIndex, "f") + 1 || patternIndex.carriage)) {
|
|
71899
|
-
|
|
73114
|
+
lines.push(this.decodeText(this.buffer.slice(0, __classPrivateFieldGet6(this, _LineDecoder_carriageReturnIndex, "f") - 1)));
|
|
71900
73115
|
this.buffer = this.buffer.slice(__classPrivateFieldGet6(this, _LineDecoder_carriageReturnIndex, "f"));
|
|
71901
73116
|
__classPrivateFieldSet5(this, _LineDecoder_carriageReturnIndex, null, "f");
|
|
71902
73117
|
continue;
|
|
71903
73118
|
}
|
|
71904
73119
|
const endIndex = __classPrivateFieldGet6(this, _LineDecoder_carriageReturnIndex, "f") !== null ? patternIndex.preceding - 1 : patternIndex.preceding;
|
|
71905
73120
|
const line = this.decodeText(this.buffer.slice(0, endIndex));
|
|
71906
|
-
|
|
73121
|
+
lines.push(line);
|
|
71907
73122
|
this.buffer = this.buffer.slice(patternIndex.index);
|
|
71908
73123
|
__classPrivateFieldSet5(this, _LineDecoder_carriageReturnIndex, null, "f");
|
|
71909
73124
|
}
|
|
71910
|
-
return
|
|
73125
|
+
return lines;
|
|
71911
73126
|
}
|
|
71912
73127
|
decodeText(bytes) {
|
|
71913
73128
|
if (bytes == null)
|
|
@@ -75484,6 +76699,79 @@ class Completions3 extends APIResource {
|
|
|
75484
76699
|
}
|
|
75485
76700
|
}
|
|
75486
76701
|
|
|
76702
|
+
class Content extends APIResource {
|
|
76703
|
+
retrieve(containerId, fileId, options) {
|
|
76704
|
+
return this._client.get(`/containers/${containerId}/files/${fileId}/content`, {
|
|
76705
|
+
...options,
|
|
76706
|
+
headers: { Accept: "*/*", ...options?.headers }
|
|
76707
|
+
});
|
|
76708
|
+
}
|
|
76709
|
+
}
|
|
76710
|
+
|
|
76711
|
+
class Files extends APIResource {
|
|
76712
|
+
constructor() {
|
|
76713
|
+
super(...arguments);
|
|
76714
|
+
this.content = new Content(this._client);
|
|
76715
|
+
}
|
|
76716
|
+
create(containerId, body, options) {
|
|
76717
|
+
return this._client.post(`/containers/${containerId}/files`, multipartFormRequestOptions({ body, ...options }));
|
|
76718
|
+
}
|
|
76719
|
+
retrieve(containerId, fileId, options) {
|
|
76720
|
+
return this._client.get(`/containers/${containerId}/files/${fileId}`, options);
|
|
76721
|
+
}
|
|
76722
|
+
list(containerId, query = {}, options) {
|
|
76723
|
+
if (isRequestOptions(query)) {
|
|
76724
|
+
return this.list(containerId, {}, query);
|
|
76725
|
+
}
|
|
76726
|
+
return this._client.getAPIList(`/containers/${containerId}/files`, FileListResponsesPage, {
|
|
76727
|
+
query,
|
|
76728
|
+
...options
|
|
76729
|
+
});
|
|
76730
|
+
}
|
|
76731
|
+
del(containerId, fileId, options) {
|
|
76732
|
+
return this._client.delete(`/containers/${containerId}/files/${fileId}`, {
|
|
76733
|
+
...options,
|
|
76734
|
+
headers: { Accept: "*/*", ...options?.headers }
|
|
76735
|
+
});
|
|
76736
|
+
}
|
|
76737
|
+
}
|
|
76738
|
+
|
|
76739
|
+
class FileListResponsesPage extends CursorPage {
|
|
76740
|
+
}
|
|
76741
|
+
Files.FileListResponsesPage = FileListResponsesPage;
|
|
76742
|
+
Files.Content = Content;
|
|
76743
|
+
|
|
76744
|
+
class Containers extends APIResource {
|
|
76745
|
+
constructor() {
|
|
76746
|
+
super(...arguments);
|
|
76747
|
+
this.files = new Files(this._client);
|
|
76748
|
+
}
|
|
76749
|
+
create(body, options) {
|
|
76750
|
+
return this._client.post("/containers", { body, ...options });
|
|
76751
|
+
}
|
|
76752
|
+
retrieve(containerId, options) {
|
|
76753
|
+
return this._client.get(`/containers/${containerId}`, options);
|
|
76754
|
+
}
|
|
76755
|
+
list(query = {}, options) {
|
|
76756
|
+
if (isRequestOptions(query)) {
|
|
76757
|
+
return this.list({}, query);
|
|
76758
|
+
}
|
|
76759
|
+
return this._client.getAPIList("/containers", ContainerListResponsesPage, { query, ...options });
|
|
76760
|
+
}
|
|
76761
|
+
del(containerId, options) {
|
|
76762
|
+
return this._client.delete(`/containers/${containerId}`, {
|
|
76763
|
+
...options,
|
|
76764
|
+
headers: { Accept: "*/*", ...options?.headers }
|
|
76765
|
+
});
|
|
76766
|
+
}
|
|
76767
|
+
}
|
|
76768
|
+
|
|
76769
|
+
class ContainerListResponsesPage extends CursorPage {
|
|
76770
|
+
}
|
|
76771
|
+
Containers.ContainerListResponsesPage = ContainerListResponsesPage;
|
|
76772
|
+
Containers.Files = Files;
|
|
76773
|
+
Containers.FileListResponsesPage = FileListResponsesPage;
|
|
76774
|
+
|
|
75487
76775
|
class Embeddings extends APIResource {
|
|
75488
76776
|
create(body, options) {
|
|
75489
76777
|
const hasUserProvidedEncodingFormat = !!body.encoding_format;
|
|
@@ -75592,7 +76880,7 @@ Evals.EvalListResponsesPage = EvalListResponsesPage;
|
|
|
75592
76880
|
Evals.Runs = Runs2;
|
|
75593
76881
|
Evals.RunListResponsesPage = RunListResponsesPage;
|
|
75594
76882
|
|
|
75595
|
-
class
|
|
76883
|
+
class Files2 extends APIResource {
|
|
75596
76884
|
create(body, options) {
|
|
75597
76885
|
return this._client.post("/files", multipartFormRequestOptions({ body, ...options }));
|
|
75598
76886
|
}
|
|
@@ -75637,7 +76925,7 @@ class Files extends APIResource {
|
|
|
75637
76925
|
|
|
75638
76926
|
class FileObjectsPage extends CursorPage {
|
|
75639
76927
|
}
|
|
75640
|
-
|
|
76928
|
+
Files2.FileObjectsPage = FileObjectsPage;
|
|
75641
76929
|
|
|
75642
76930
|
class Methods extends APIResource {
|
|
75643
76931
|
}
|
|
@@ -75977,13 +77265,13 @@ class ResponseStream extends EventStream {
|
|
|
75977
77265
|
}
|
|
75978
77266
|
static createResponse(client, params, options) {
|
|
75979
77267
|
const runner = new ResponseStream(params);
|
|
75980
|
-
runner._run(() => runner.
|
|
77268
|
+
runner._run(() => runner._createOrRetrieveResponse(client, params, {
|
|
75981
77269
|
...options,
|
|
75982
77270
|
headers: { ...options?.headers, "X-Stainless-Helper-Method": "stream" }
|
|
75983
77271
|
}));
|
|
75984
77272
|
return runner;
|
|
75985
77273
|
}
|
|
75986
|
-
async
|
|
77274
|
+
async _createOrRetrieveResponse(client, params, options) {
|
|
75987
77275
|
const signal = options?.signal;
|
|
75988
77276
|
if (signal) {
|
|
75989
77277
|
if (signal.aborted)
|
|
@@ -75991,10 +77279,17 @@ class ResponseStream extends EventStream {
|
|
|
75991
77279
|
signal.addEventListener("abort", () => this.controller.abort());
|
|
75992
77280
|
}
|
|
75993
77281
|
__classPrivateFieldGet12(this, _ResponseStream_instances, "m", _ResponseStream_beginRequest).call(this);
|
|
75994
|
-
|
|
77282
|
+
let stream;
|
|
77283
|
+
let starting_after = null;
|
|
77284
|
+
if ("response_id" in params) {
|
|
77285
|
+
stream = await client.responses.retrieve(params.response_id, { stream: true }, { ...options, signal: this.controller.signal, stream: true });
|
|
77286
|
+
starting_after = params.starting_after ?? null;
|
|
77287
|
+
} else {
|
|
77288
|
+
stream = await client.responses.create({ ...params, stream: true }, { ...options, signal: this.controller.signal });
|
|
77289
|
+
}
|
|
75995
77290
|
this._connected();
|
|
75996
77291
|
for await (const event of stream) {
|
|
75997
|
-
__classPrivateFieldGet12(this, _ResponseStream_instances, "m", _ResponseStream_addEvent).call(this, event);
|
|
77292
|
+
__classPrivateFieldGet12(this, _ResponseStream_instances, "m", _ResponseStream_addEvent).call(this, event, starting_after);
|
|
75998
77293
|
}
|
|
75999
77294
|
if (stream.controller.signal?.aborted) {
|
|
76000
77295
|
throw new APIUserAbortError;
|
|
@@ -76005,11 +77300,16 @@ class ResponseStream extends EventStream {
|
|
|
76005
77300
|
if (this.ended)
|
|
76006
77301
|
return;
|
|
76007
77302
|
__classPrivateFieldSet10(this, _ResponseStream_currentResponseSnapshot, undefined, "f");
|
|
76008
|
-
}, _ResponseStream_addEvent = function _ResponseStream_addEvent(event) {
|
|
77303
|
+
}, _ResponseStream_addEvent = function _ResponseStream_addEvent(event, starting_after) {
|
|
76009
77304
|
if (this.ended)
|
|
76010
77305
|
return;
|
|
77306
|
+
const maybeEmit = (name, event2) => {
|
|
77307
|
+
if (starting_after == null || event2.sequence_number > starting_after) {
|
|
77308
|
+
this._emit(name, event2);
|
|
77309
|
+
}
|
|
77310
|
+
};
|
|
76011
77311
|
const response = __classPrivateFieldGet12(this, _ResponseStream_instances, "m", _ResponseStream_accumulateResponse).call(this, event);
|
|
76012
|
-
|
|
77312
|
+
maybeEmit("event", event);
|
|
76013
77313
|
switch (event.type) {
|
|
76014
77314
|
case "response.output_text.delta": {
|
|
76015
77315
|
const output = response.output[event.output_index];
|
|
@@ -76024,7 +77324,7 @@ class ResponseStream extends EventStream {
|
|
|
76024
77324
|
if (content.type !== "output_text") {
|
|
76025
77325
|
throw new OpenAIError(`expected content to be 'output_text', got ${content.type}`);
|
|
76026
77326
|
}
|
|
76027
|
-
|
|
77327
|
+
maybeEmit("response.output_text.delta", {
|
|
76028
77328
|
...event,
|
|
76029
77329
|
snapshot: content.text
|
|
76030
77330
|
});
|
|
@@ -76037,7 +77337,7 @@ class ResponseStream extends EventStream {
|
|
|
76037
77337
|
throw new OpenAIError(`missing output at index ${event.output_index}`);
|
|
76038
77338
|
}
|
|
76039
77339
|
if (output.type === "function_call") {
|
|
76040
|
-
|
|
77340
|
+
maybeEmit("response.function_call_arguments.delta", {
|
|
76041
77341
|
...event,
|
|
76042
77342
|
snapshot: output.arguments
|
|
76043
77343
|
});
|
|
@@ -76045,7 +77345,7 @@ class ResponseStream extends EventStream {
|
|
|
76045
77345
|
break;
|
|
76046
77346
|
}
|
|
76047
77347
|
default:
|
|
76048
|
-
|
|
77348
|
+
maybeEmit(event.type, event);
|
|
76049
77349
|
break;
|
|
76050
77350
|
}
|
|
76051
77351
|
}, _ResponseStream_endRequest = function _ResponseStream_endRequest() {
|
|
@@ -76193,10 +77493,19 @@ class Responses extends APIResource {
|
|
|
76193
77493
|
});
|
|
76194
77494
|
}
|
|
76195
77495
|
retrieve(responseId, query = {}, options) {
|
|
76196
|
-
if (isRequestOptions(query)) {
|
|
77496
|
+
if (isRequestOptions(query) && options === undefined) {
|
|
76197
77497
|
return this.retrieve(responseId, {}, query);
|
|
76198
77498
|
}
|
|
76199
|
-
return this._client.get(`/responses/${responseId}`, {
|
|
77499
|
+
return this._client.get(`/responses/${responseId}`, {
|
|
77500
|
+
query,
|
|
77501
|
+
...options,
|
|
77502
|
+
stream: query.stream ?? false
|
|
77503
|
+
})._thenUnwrap((rsp) => {
|
|
77504
|
+
if ("object" in rsp && rsp.object === "response") {
|
|
77505
|
+
addOutputText(rsp);
|
|
77506
|
+
}
|
|
77507
|
+
return rsp;
|
|
77508
|
+
});
|
|
76200
77509
|
}
|
|
76201
77510
|
del(responseId, options) {
|
|
76202
77511
|
return this._client.delete(`/responses/${responseId}`, {
|
|
@@ -76210,6 +77519,12 @@ class Responses extends APIResource {
|
|
|
76210
77519
|
stream(body, options) {
|
|
76211
77520
|
return ResponseStream.createResponse(this._client, body, options);
|
|
76212
77521
|
}
|
|
77522
|
+
cancel(responseId, options) {
|
|
77523
|
+
return this._client.post(`/responses/${responseId}/cancel`, {
|
|
77524
|
+
...options,
|
|
77525
|
+
headers: { Accept: "*/*", ...options?.headers }
|
|
77526
|
+
});
|
|
77527
|
+
}
|
|
76213
77528
|
}
|
|
76214
77529
|
|
|
76215
77530
|
class ResponseItemsPage extends CursorPage {
|
|
@@ -76256,7 +77571,7 @@ var allSettledWithThrow = async (promises) => {
|
|
|
76256
77571
|
return values;
|
|
76257
77572
|
};
|
|
76258
77573
|
|
|
76259
|
-
class
|
|
77574
|
+
class Files3 extends APIResource {
|
|
76260
77575
|
create(vectorStoreId, body, options) {
|
|
76261
77576
|
return this._client.post(`/vector_stores/${vectorStoreId}/files`, {
|
|
76262
77577
|
body,
|
|
@@ -76348,8 +77663,8 @@ class VectorStoreFilesPage extends CursorPage {
|
|
|
76348
77663
|
|
|
76349
77664
|
class FileContentResponsesPage extends Page {
|
|
76350
77665
|
}
|
|
76351
|
-
|
|
76352
|
-
|
|
77666
|
+
Files3.VectorStoreFilesPage = VectorStoreFilesPage;
|
|
77667
|
+
Files3.FileContentResponsesPage = FileContentResponsesPage;
|
|
76353
77668
|
|
|
76354
77669
|
class FileBatches extends APIResource {
|
|
76355
77670
|
create(vectorStoreId, body, options) {
|
|
@@ -76440,7 +77755,7 @@ class FileBatches extends APIResource {
|
|
|
76440
77755
|
class VectorStores extends APIResource {
|
|
76441
77756
|
constructor() {
|
|
76442
77757
|
super(...arguments);
|
|
76443
|
-
this.files = new
|
|
77758
|
+
this.files = new Files3(this._client);
|
|
76444
77759
|
this.fileBatches = new FileBatches(this._client);
|
|
76445
77760
|
}
|
|
76446
77761
|
create(body, options) {
|
|
@@ -76496,7 +77811,7 @@ class VectorStoreSearchResponsesPage extends Page {
|
|
|
76496
77811
|
}
|
|
76497
77812
|
VectorStores.VectorStoresPage = VectorStoresPage;
|
|
76498
77813
|
VectorStores.VectorStoreSearchResponsesPage = VectorStoreSearchResponsesPage;
|
|
76499
|
-
VectorStores.Files =
|
|
77814
|
+
VectorStores.Files = Files3;
|
|
76500
77815
|
VectorStores.VectorStoreFilesPage = VectorStoreFilesPage;
|
|
76501
77816
|
VectorStores.FileContentResponsesPage = FileContentResponsesPage;
|
|
76502
77817
|
VectorStores.FileBatches = FileBatches;
|
|
@@ -76536,7 +77851,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
76536
77851
|
this.completions = new Completions3(this);
|
|
76537
77852
|
this.chat = new Chat(this);
|
|
76538
77853
|
this.embeddings = new Embeddings(this);
|
|
76539
|
-
this.files = new
|
|
77854
|
+
this.files = new Files2(this);
|
|
76540
77855
|
this.images = new Images(this);
|
|
76541
77856
|
this.audio = new Audio(this);
|
|
76542
77857
|
this.moderations = new Moderations(this);
|
|
@@ -76549,6 +77864,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
76549
77864
|
this.uploads = new Uploads(this);
|
|
76550
77865
|
this.responses = new Responses(this);
|
|
76551
77866
|
this.evals = new Evals(this);
|
|
77867
|
+
this.containers = new Containers(this);
|
|
76552
77868
|
this._options = options;
|
|
76553
77869
|
this.apiKey = apiKey;
|
|
76554
77870
|
this.organization = organization;
|
|
@@ -76594,7 +77910,7 @@ OpenAI.Completions = Completions3;
|
|
|
76594
77910
|
OpenAI.Chat = Chat;
|
|
76595
77911
|
OpenAI.ChatCompletionsPage = ChatCompletionsPage;
|
|
76596
77912
|
OpenAI.Embeddings = Embeddings;
|
|
76597
|
-
OpenAI.Files =
|
|
77913
|
+
OpenAI.Files = Files2;
|
|
76598
77914
|
OpenAI.FileObjectsPage = FileObjectsPage;
|
|
76599
77915
|
OpenAI.Images = Images;
|
|
76600
77916
|
OpenAI.Audio = Audio;
|
|
@@ -76613,6 +77929,8 @@ OpenAI.Uploads = Uploads;
|
|
|
76613
77929
|
OpenAI.Responses = Responses;
|
|
76614
77930
|
OpenAI.Evals = Evals;
|
|
76615
77931
|
OpenAI.EvalListResponsesPage = EvalListResponsesPage;
|
|
77932
|
+
OpenAI.Containers = Containers;
|
|
77933
|
+
OpenAI.ContainerListResponsesPage = ContainerListResponsesPage;
|
|
76616
77934
|
var _deployments_endpoints = new Set([
|
|
76617
77935
|
"/completions",
|
|
76618
77936
|
"/chat/completions",
|
|
@@ -76773,7 +78091,7 @@ var CustomProvider = Custom;
|
|
|
76773
78091
|
var VolcesProvider = Volces;
|
|
76774
78092
|
var DeepSeekProvider = DeepSeek;
|
|
76775
78093
|
var ModelScopeProvider = ModelScope;
|
|
76776
|
-
var
|
|
78094
|
+
var ChatProviderMap = {
|
|
76777
78095
|
Ollama: OllamaProvider,
|
|
76778
78096
|
SiliconFlow: SiliconFlowProvider,
|
|
76779
78097
|
Custom: CustomProvider,
|
|
@@ -76787,7 +78105,7 @@ class ProviderManager {
|
|
|
76787
78105
|
provider;
|
|
76788
78106
|
constructor(config2) {
|
|
76789
78107
|
const { provider, model, apiKey, baseURL } = config2;
|
|
76790
|
-
const Provider =
|
|
78108
|
+
const Provider = ChatProviderMap[provider];
|
|
76791
78109
|
if (!Provider) {
|
|
76792
78110
|
throw new Error(`Provider ${provider} not found`);
|
|
76793
78111
|
}
|
|
@@ -76812,6 +78130,9 @@ class ProviderManager {
|
|
|
76812
78130
|
return this.provider.chat(messages);
|
|
76813
78131
|
}
|
|
76814
78132
|
}
|
|
78133
|
+
var import_aes = __toESM2(require_aes(), 1);
|
|
78134
|
+
var import_enc_utf8 = __toESM2(require_enc_utf8(), 1);
|
|
78135
|
+
var CryptoJS = { AES: import_aes.default, enc: { Utf8: import_enc_utf8.default } };
|
|
76815
78136
|
|
|
76816
78137
|
// src/command/ai/index.ts
|
|
76817
78138
|
var runAiCommand = new Command("ai").description("AI 对话助手").option("-t, --text <text>", "应用类型", "").action(async (options) => {
|
|
@@ -76826,9 +78147,9 @@ var runAiCommand = new Command("ai").description("AI 对话助手").option("-t,
|
|
|
76826
78147
|
logger.error("请输入要发送给 AI 的文本");
|
|
76827
78148
|
return;
|
|
76828
78149
|
}
|
|
76829
|
-
if (!
|
|
78150
|
+
if (!ChatProviderMap[ai.provider]) {
|
|
76830
78151
|
logger.error("不支持的 AI 提供商,请检查配置文件中的提供商名称");
|
|
76831
|
-
const supportedProviders = Object.keys(
|
|
78152
|
+
const supportedProviders = Object.keys(ChatProviderMap).join(", ");
|
|
76832
78153
|
logger.error(`支持的提供商有:${supportedProviders}`);
|
|
76833
78154
|
return;
|
|
76834
78155
|
}
|