@spacex110/core 0.1.11 → 0.1.13
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/index.d.ts +58 -0
- package/dist/index.js +1116 -1011
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/channel-manager.ts +151 -0
- package/src/strategies.ts +3 -1
package/dist/index.js
CHANGED
|
@@ -282,11 +282,11 @@ const na = {
|
|
|
282
282
|
function t0(p) {
|
|
283
283
|
return re[p];
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function or() {
|
|
286
286
|
return Object.values(re);
|
|
287
287
|
}
|
|
288
288
|
function _r(p) {
|
|
289
|
-
return
|
|
289
|
+
return or().filter((r) => r.apiFormat === p);
|
|
290
290
|
}
|
|
291
291
|
const wr = {
|
|
292
292
|
[H.OPENAI]: [
|
|
@@ -482,52 +482,57 @@ function kr(p) {
|
|
|
482
482
|
return /^o\d/.test(p) || /reasoner|thinking|o1|o3|o4/i.test(p);
|
|
483
483
|
}
|
|
484
484
|
function le(p) {
|
|
485
|
-
const
|
|
486
|
-
if (
|
|
487
|
-
return
|
|
485
|
+
const r = /* @__PURE__ */ new Set(), t = p.input_modalities || [];
|
|
486
|
+
if (t.length > 0)
|
|
487
|
+
return t.some((u) => /text/i.test(u)) && r.add("text"), t.some((u) => /image|vision/i.test(u)) && r.add("vision"), t.some((u) => /audio/i.test(u)) && r.add("audio"), t.some((u) => /video/i.test(u)) && r.add("video"), r.size === 0 && r.add("text"), Array.from(r);
|
|
488
488
|
const e = p.capabilities;
|
|
489
|
-
if (e && ((e.vision || e.image) && (
|
|
490
|
-
return Array.from(
|
|
491
|
-
const
|
|
492
|
-
return
|
|
489
|
+
if (e && ((e.vision || e.image) && (r.add("vision"), r.add("text")), e.audio && r.add("audio"), e.video && r.add("video"), e.embeddings && r.add("embedding"), r.size > 0))
|
|
490
|
+
return Array.from(r);
|
|
491
|
+
const o = (p.id || "").toLowerCase(), c = (p.name || "").toLowerCase(), b = `${o} ${c}`;
|
|
492
|
+
return r.add("text"), /vision|image|visual|multimodal|vl|pixtral|llava|bakllava/.test(b) && r.add("vision"), /audio|speech|whisper|tts|stt/.test(b) && r.add("audio"), /video/.test(b) && r.add("video"), /embedding|embed/.test(b) && r.add("embedding"), /reasoner|reasoning|thinking|qwq/.test(b) && r.add("reasoning"), Array.from(r);
|
|
493
493
|
}
|
|
494
|
-
const Sr = (p) => Array.isArray(p == null ? void 0 : p.data) ? p.data.filter((
|
|
495
|
-
const
|
|
494
|
+
const Sr = (p) => Array.isArray(p == null ? void 0 : p.data) ? p.data.filter((r) => r.id).map((r) => {
|
|
495
|
+
const t = r.name || r.display_name || (r.id.split("/").pop() ?? "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
496
496
|
return {
|
|
497
|
-
id:
|
|
498
|
-
name:
|
|
499
|
-
created:
|
|
500
|
-
contextLength:
|
|
501
|
-
capabilities: le(
|
|
497
|
+
id: r.id,
|
|
498
|
+
name: t,
|
|
499
|
+
created: r.created || 0,
|
|
500
|
+
contextLength: r.context_length || r.max_context || void 0,
|
|
501
|
+
capabilities: le(r)
|
|
502
502
|
};
|
|
503
|
-
}).sort((
|
|
504
|
-
const e = (
|
|
505
|
-
return e !== 0 ? e : (
|
|
503
|
+
}).sort((r, t) => {
|
|
504
|
+
const e = (t.created || 0) - (r.created || 0);
|
|
505
|
+
return e !== 0 ? e : (t.id || "").localeCompare(r.id || "");
|
|
506
506
|
}) : [], xr = {
|
|
507
507
|
format: "openai",
|
|
508
508
|
getModelsEndpoint: (p) => `${p}/models`,
|
|
509
509
|
getChatEndpoint: (p) => `${p}/chat/completions`,
|
|
510
510
|
buildHeaders: (p) => {
|
|
511
|
-
const
|
|
511
|
+
const r = {
|
|
512
512
|
"Content-Type": "application/json",
|
|
513
513
|
Authorization: `Bearer ${p}`
|
|
514
514
|
};
|
|
515
|
-
|
|
515
|
+
if (typeof window < "u" && window.location) {
|
|
516
|
+
r["HTTP-Referer"] = window.location.origin;
|
|
517
|
+
const t = document.title ? document.title.replace(/[^\x20-\x7E]/g, "").slice(0, 80) : "AI Selector";
|
|
518
|
+
r["X-Title"] = t || "AI Selector";
|
|
519
|
+
}
|
|
520
|
+
return r;
|
|
516
521
|
},
|
|
517
|
-
buildChatPayload: (p,
|
|
522
|
+
buildChatPayload: (p, r, t) => {
|
|
518
523
|
const e = {
|
|
519
524
|
model: p,
|
|
520
|
-
messages:
|
|
525
|
+
messages: r
|
|
521
526
|
};
|
|
522
|
-
return
|
|
527
|
+
return t && (e[kr(p) ? "max_completion_tokens" : "max_tokens"] = t), e;
|
|
523
528
|
},
|
|
524
529
|
parseChatResponse: (p) => {
|
|
525
|
-
var
|
|
526
|
-
return ((e = (
|
|
530
|
+
var r, t, e;
|
|
531
|
+
return ((e = (t = (r = p.choices) == null ? void 0 : r[0]) == null ? void 0 : t.message) == null ? void 0 : e.content) || "";
|
|
527
532
|
},
|
|
528
533
|
parseStreamChunk: (p) => {
|
|
529
|
-
var
|
|
530
|
-
return ((e = (
|
|
534
|
+
var r, t, e;
|
|
535
|
+
return ((e = (t = (r = p.choices) == null ? void 0 : r[0]) == null ? void 0 : t.delta) == null ? void 0 : e.content) || "";
|
|
531
536
|
}
|
|
532
537
|
}, Pr = {
|
|
533
538
|
format: "anthropic",
|
|
@@ -540,60 +545,60 @@ const Sr = (p) => Array.isArray(p == null ? void 0 : p.data) ? p.data.filter((t)
|
|
|
540
545
|
"anthropic-dangerous-direct-browser-access": "true"
|
|
541
546
|
// 启用浏览器直连 CORS
|
|
542
547
|
}),
|
|
543
|
-
buildChatPayload: (p,
|
|
548
|
+
buildChatPayload: (p, r, t) => ({
|
|
544
549
|
model: p,
|
|
545
|
-
messages:
|
|
546
|
-
max_tokens:
|
|
550
|
+
messages: r,
|
|
551
|
+
max_tokens: t || 1024
|
|
547
552
|
// Anthropic API 强制要求 max_tokens
|
|
548
553
|
}),
|
|
549
554
|
parseChatResponse: (p) => {
|
|
550
|
-
var
|
|
551
|
-
return ((
|
|
555
|
+
var r, t;
|
|
556
|
+
return ((t = (r = p.content) == null ? void 0 : r[0]) == null ? void 0 : t.text) || "";
|
|
552
557
|
},
|
|
553
558
|
parseStreamChunk: (p) => {
|
|
554
|
-
var
|
|
555
|
-
return p.type === "content_block_delta" && ((
|
|
559
|
+
var r;
|
|
560
|
+
return p.type === "content_block_delta" && ((r = p.delta) == null ? void 0 : r.text) || "";
|
|
556
561
|
},
|
|
557
562
|
// Anthropic 返回: { data: [{ id, display_name, created_at }] }
|
|
558
|
-
parseModelsResponse: (p) => Array.isArray(p.data) ? p.data.filter((
|
|
559
|
-
id:
|
|
560
|
-
name:
|
|
561
|
-
created:
|
|
562
|
-
capabilities: le(
|
|
563
|
-
})).sort((
|
|
563
|
+
parseModelsResponse: (p) => Array.isArray(p.data) ? p.data.filter((r) => r.id).map((r) => ({
|
|
564
|
+
id: r.id,
|
|
565
|
+
name: r.display_name || r.id,
|
|
566
|
+
created: r.created_at ? new Date(r.created_at).getTime() / 1e3 : 0,
|
|
567
|
+
capabilities: le(r)
|
|
568
|
+
})).sort((r, t) => (t.created || 0) - (r.created || 0)) : []
|
|
564
569
|
}, Ir = {
|
|
565
570
|
format: "gemini",
|
|
566
|
-
getModelsEndpoint: (p,
|
|
567
|
-
getChatEndpoint: (p,
|
|
571
|
+
getModelsEndpoint: (p, r) => `${p}/models?key=${r}`,
|
|
572
|
+
getChatEndpoint: (p, r, t) => `${p}/models/${t}:generateContent?key=${r}`,
|
|
568
573
|
buildHeaders: () => ({
|
|
569
574
|
"Content-Type": "application/json"
|
|
570
575
|
}),
|
|
571
|
-
buildChatPayload: (p,
|
|
572
|
-
const
|
|
573
|
-
role:
|
|
574
|
-
parts: [{ text:
|
|
576
|
+
buildChatPayload: (p, r, t) => {
|
|
577
|
+
const o = { contents: r.map((c) => ({
|
|
578
|
+
role: c.role === "assistant" ? "model" : "user",
|
|
579
|
+
parts: [{ text: c.content }]
|
|
575
580
|
})) };
|
|
576
|
-
return
|
|
581
|
+
return t && (o.generationConfig = { maxOutputTokens: t }), o;
|
|
577
582
|
},
|
|
578
583
|
parseChatResponse: (p) => {
|
|
579
|
-
var
|
|
580
|
-
return ((
|
|
584
|
+
var r, t, e, o, c;
|
|
585
|
+
return ((c = (o = (e = (t = (r = p.candidates) == null ? void 0 : r[0]) == null ? void 0 : t.content) == null ? void 0 : e.parts) == null ? void 0 : o[0]) == null ? void 0 : c.text) || "";
|
|
581
586
|
},
|
|
582
587
|
parseStreamChunk: (p) => {
|
|
583
|
-
var
|
|
584
|
-
return ((
|
|
588
|
+
var r, t, e, o, c;
|
|
589
|
+
return ((c = (o = (e = (t = (r = p.candidates) == null ? void 0 : r[0]) == null ? void 0 : t.content) == null ? void 0 : e.parts) == null ? void 0 : o[0]) == null ? void 0 : c.text) || "";
|
|
585
590
|
},
|
|
586
591
|
// Gemini 返回格式: { models: [{ name: "models/gemini-pro", ... }] }
|
|
587
|
-
parseModelsResponse: (p) => Array.isArray(p.models) ? p.models.filter((
|
|
588
|
-
var
|
|
589
|
-
return (
|
|
590
|
-
}).map((
|
|
591
|
-
id:
|
|
592
|
+
parseModelsResponse: (p) => Array.isArray(p.models) ? p.models.filter((r) => {
|
|
593
|
+
var t;
|
|
594
|
+
return (t = r.supportedGenerationMethods) == null ? void 0 : t.includes("generateContent");
|
|
595
|
+
}).map((r) => ({
|
|
596
|
+
id: r.name.replace("models/", ""),
|
|
592
597
|
// "models/gemini-pro" -> "gemini-pro"
|
|
593
|
-
name:
|
|
594
|
-
created:
|
|
595
|
-
capabilities: le(
|
|
596
|
-
})).sort((
|
|
598
|
+
name: r.displayName || r.name.replace("models/", ""),
|
|
599
|
+
created: r.created || 0,
|
|
600
|
+
capabilities: le(r)
|
|
601
|
+
})).sort((r, t) => (t.id || "").localeCompare(r.id || "")) : []
|
|
597
602
|
}, Rr = {
|
|
598
603
|
format: "cohere",
|
|
599
604
|
getModelsEndpoint: (p) => `${p}/models`,
|
|
@@ -602,20 +607,20 @@ const Sr = (p) => Array.isArray(p == null ? void 0 : p.data) ? p.data.filter((t)
|
|
|
602
607
|
"Content-Type": "application/json",
|
|
603
608
|
Authorization: `Bearer ${p}`
|
|
604
609
|
}),
|
|
605
|
-
buildChatPayload: (p,
|
|
610
|
+
buildChatPayload: (p, r, t) => {
|
|
606
611
|
const e = {
|
|
607
612
|
model: p,
|
|
608
|
-
messages:
|
|
613
|
+
messages: r
|
|
609
614
|
};
|
|
610
|
-
return
|
|
615
|
+
return t && (e.max_tokens = t), e;
|
|
611
616
|
},
|
|
612
617
|
parseChatResponse: (p) => {
|
|
613
|
-
var
|
|
614
|
-
return ((e = (
|
|
618
|
+
var r, t, e;
|
|
619
|
+
return ((e = (t = (r = p.message) == null ? void 0 : r.content) == null ? void 0 : t[0]) == null ? void 0 : e.text) || "";
|
|
615
620
|
},
|
|
616
621
|
parseStreamChunk: (p) => {
|
|
617
|
-
var
|
|
618
|
-
return p.type === "content-delta" && ((
|
|
622
|
+
var r, t, e, o;
|
|
623
|
+
return p.type === "content-delta" && ((o = (e = (t = (r = p.delta) == null ? void 0 : r.message) == null ? void 0 : t.content) == null ? void 0 : e[0]) == null ? void 0 : o.text) || "";
|
|
619
624
|
}
|
|
620
625
|
}, Hr = {
|
|
621
626
|
openai: xr,
|
|
@@ -628,40 +633,40 @@ function ae(p) {
|
|
|
628
633
|
}
|
|
629
634
|
async function cr(p) {
|
|
630
635
|
var i;
|
|
631
|
-
const { apiFormat:
|
|
636
|
+
const { apiFormat: r, baseUrl: t, apiKey: e, model: o, messages: c, maxTokens: b } = p, u = ae(r), f = u.getChatEndpoint(t, e, o), a = u.buildHeaders(e), n = u.buildChatPayload(o, c, b), B = performance.now();
|
|
632
637
|
try {
|
|
633
|
-
const
|
|
638
|
+
const l = await fetch(f, {
|
|
634
639
|
method: "POST",
|
|
635
640
|
headers: a,
|
|
636
641
|
body: JSON.stringify(n)
|
|
637
|
-
}),
|
|
638
|
-
if (!
|
|
642
|
+
}), d = Math.round(performance.now() - B);
|
|
643
|
+
if (!l.ok)
|
|
639
644
|
return {
|
|
640
645
|
success: !1,
|
|
641
|
-
message: ((i = (await
|
|
642
|
-
latencyMs:
|
|
646
|
+
message: ((i = (await l.json().catch(() => ({}))).error) == null ? void 0 : i.message) || `HTTP ${l.status}: ${l.statusText}`,
|
|
647
|
+
latencyMs: d
|
|
643
648
|
};
|
|
644
|
-
const C = await
|
|
649
|
+
const C = await l.json();
|
|
645
650
|
return {
|
|
646
651
|
success: !0,
|
|
647
652
|
content: u.parseChatResponse(C),
|
|
648
|
-
latencyMs:
|
|
653
|
+
latencyMs: d
|
|
649
654
|
};
|
|
650
|
-
} catch (
|
|
655
|
+
} catch (l) {
|
|
651
656
|
return {
|
|
652
657
|
success: !1,
|
|
653
|
-
message:
|
|
658
|
+
message: l instanceof Error ? l.message : "网络错误"
|
|
654
659
|
};
|
|
655
660
|
}
|
|
656
661
|
}
|
|
657
662
|
async function Mr(p) {
|
|
658
|
-
var
|
|
659
|
-
const { apiFormat:
|
|
660
|
-
let n = a.getChatEndpoint(
|
|
661
|
-
|
|
662
|
-
const B = a.buildHeaders(e), i = a.buildChatPayload(
|
|
663
|
+
var d;
|
|
664
|
+
const { apiFormat: r, baseUrl: t, apiKey: e, model: o, messages: c, maxTokens: b, onDelta: u, signal: f } = p, a = ae(r);
|
|
665
|
+
let n = a.getChatEndpoint(t, e, o);
|
|
666
|
+
r === "gemini" && (n = `${t}/models/${o}:streamGenerateContent?alt=sse&key=${encodeURIComponent(e)}`);
|
|
667
|
+
const B = a.buildHeaders(e), i = a.buildChatPayload(o, c, b);
|
|
663
668
|
i.stream = !0;
|
|
664
|
-
const
|
|
669
|
+
const l = performance.now();
|
|
665
670
|
try {
|
|
666
671
|
const C = await fetch(n, {
|
|
667
672
|
method: "POST",
|
|
@@ -674,21 +679,21 @@ async function Mr(p) {
|
|
|
674
679
|
let F = `HTTP ${C.status}`;
|
|
675
680
|
try {
|
|
676
681
|
const E = JSON.parse(v);
|
|
677
|
-
F = ((
|
|
682
|
+
F = ((d = E.error) == null ? void 0 : d.message) || E.error || E.message || F;
|
|
678
683
|
} catch {
|
|
679
684
|
v && (F = v.slice(0, 200));
|
|
680
685
|
}
|
|
681
|
-
return { success: !1, message: F, latencyMs: Math.round(performance.now() -
|
|
686
|
+
return { success: !1, message: F, latencyMs: Math.round(performance.now() - l) };
|
|
682
687
|
}
|
|
683
688
|
const h = C.body.getReader(), A = new TextDecoder();
|
|
684
|
-
let
|
|
689
|
+
let s = "", x = "";
|
|
685
690
|
for (; ; ) {
|
|
686
691
|
const { done: v, value: F } = await h.read();
|
|
687
692
|
if (v) break;
|
|
688
|
-
|
|
689
|
-
const E =
|
|
693
|
+
s += A.decode(F, { stream: !0 });
|
|
694
|
+
const E = s.split(`
|
|
690
695
|
`);
|
|
691
|
-
|
|
696
|
+
s = E.pop() || "";
|
|
692
697
|
for (const g of E) {
|
|
693
698
|
const y = g.trim();
|
|
694
699
|
if (!y.startsWith("data:") && !y.startsWith("event:") || y.startsWith("event:")) continue;
|
|
@@ -696,21 +701,21 @@ async function Mr(p) {
|
|
|
696
701
|
if (!(!R || R === "[DONE]"))
|
|
697
702
|
try {
|
|
698
703
|
const m = JSON.parse(R), D = a.parseStreamChunk ? a.parseStreamChunk(m) : "";
|
|
699
|
-
D && (
|
|
704
|
+
D && (x += D, u(x));
|
|
700
705
|
} catch {
|
|
701
706
|
}
|
|
702
707
|
}
|
|
703
708
|
}
|
|
704
|
-
return { success: !0, content:
|
|
709
|
+
return { success: !0, content: x, latencyMs: Math.round(performance.now() - l) };
|
|
705
710
|
} catch (C) {
|
|
706
|
-
return C instanceof Error && C.name === "AbortError" ? { success: !1, message: "请求已取消", latencyMs: Math.round(performance.now() -
|
|
711
|
+
return C instanceof Error && C.name === "AbortError" ? { success: !1, message: "请求已取消", latencyMs: Math.round(performance.now() - l) } : {
|
|
707
712
|
success: !1,
|
|
708
713
|
message: C instanceof Error ? C.message : "网络错误"
|
|
709
714
|
};
|
|
710
715
|
}
|
|
711
716
|
}
|
|
712
717
|
async function Or(p) {
|
|
713
|
-
const
|
|
718
|
+
const r = await cr({
|
|
714
719
|
apiFormat: p.apiFormat,
|
|
715
720
|
baseUrl: p.baseUrl,
|
|
716
721
|
apiKey: p.apiKey,
|
|
@@ -719,24 +724,24 @@ async function Or(p) {
|
|
|
719
724
|
// maxTokens: 5, // 不设置 maxTokens 以兼容 o1 等不支持该参数的模型
|
|
720
725
|
});
|
|
721
726
|
return {
|
|
722
|
-
success:
|
|
723
|
-
latencyMs:
|
|
724
|
-
message:
|
|
727
|
+
success: r.success,
|
|
728
|
+
latencyMs: r.latencyMs,
|
|
729
|
+
message: r.success ? void 0 : r.message
|
|
725
730
|
};
|
|
726
731
|
}
|
|
727
|
-
async function
|
|
728
|
-
const { provider:
|
|
732
|
+
async function sa(p) {
|
|
733
|
+
const { provider: r, apiKey: t, model: e, baseUrl: o, proxyUrl: c } = p, b = o || r.baseUrl, u = Date.now();
|
|
729
734
|
try {
|
|
730
|
-
if (
|
|
731
|
-
const h = await (await fetch(`${
|
|
735
|
+
if (c) {
|
|
736
|
+
const h = await (await fetch(`${c}/test`, {
|
|
732
737
|
method: "POST",
|
|
733
738
|
headers: { "Content-Type": "application/json" },
|
|
734
739
|
body: JSON.stringify({
|
|
735
|
-
provider_id:
|
|
736
|
-
api_key:
|
|
740
|
+
provider_id: r.id,
|
|
741
|
+
api_key: t,
|
|
737
742
|
model: e || "",
|
|
738
|
-
base_url:
|
|
739
|
-
api_format:
|
|
743
|
+
base_url: o || r.baseUrl,
|
|
744
|
+
api_format: r.apiFormat
|
|
740
745
|
})
|
|
741
746
|
})).json();
|
|
742
747
|
return {
|
|
@@ -745,26 +750,26 @@ async function oa(p) {
|
|
|
745
750
|
message: h.message
|
|
746
751
|
};
|
|
747
752
|
}
|
|
748
|
-
const f = ae(
|
|
753
|
+
const f = ae(r.apiFormat), a = e || "";
|
|
749
754
|
if (!a)
|
|
750
755
|
return {
|
|
751
756
|
success: !1,
|
|
752
757
|
latencyMs: 0,
|
|
753
758
|
message: "请先选择模型 (Please select a model)"
|
|
754
759
|
};
|
|
755
|
-
const n = f.buildHeaders(
|
|
760
|
+
const n = f.buildHeaders(t), B = f.buildChatPayload(a, [{ role: "user", content: "Hi" }]), i = f.getChatEndpoint(b, t, a), l = await fetch(i, {
|
|
756
761
|
method: "POST",
|
|
757
762
|
headers: n,
|
|
758
763
|
body: JSON.stringify(B)
|
|
759
|
-
}),
|
|
760
|
-
if (
|
|
761
|
-
return { success: !0, latencyMs:
|
|
764
|
+
}), d = Date.now() - u;
|
|
765
|
+
if (l.ok)
|
|
766
|
+
return { success: !0, latencyMs: d, message: "连接成功" };
|
|
762
767
|
{
|
|
763
|
-
const C = await
|
|
768
|
+
const C = await l.text();
|
|
764
769
|
return {
|
|
765
770
|
success: !1,
|
|
766
|
-
latencyMs:
|
|
767
|
-
message: `HTTP ${
|
|
771
|
+
latencyMs: d,
|
|
772
|
+
message: `HTTP ${l.status}: ${C.slice(0, 200)}`
|
|
768
773
|
};
|
|
769
774
|
}
|
|
770
775
|
} catch (f) {
|
|
@@ -777,28 +782,28 @@ async function oa(p) {
|
|
|
777
782
|
}
|
|
778
783
|
async function $r(p) {
|
|
779
784
|
var b, u;
|
|
780
|
-
const { provider:
|
|
781
|
-
if (
|
|
785
|
+
const { provider: r, apiKey: t, baseUrl: e, proxyUrl: o, fallbackToStatic: c = !0 } = p;
|
|
786
|
+
if (o)
|
|
782
787
|
try {
|
|
783
|
-
const a = await (await fetch(`${
|
|
788
|
+
const a = await (await fetch(`${o}/models`, {
|
|
784
789
|
method: "POST",
|
|
785
790
|
headers: { "Content-Type": "application/json" },
|
|
786
791
|
body: JSON.stringify({
|
|
787
|
-
provider_id:
|
|
788
|
-
api_key:
|
|
789
|
-
base_url: e ||
|
|
792
|
+
provider_id: r.id,
|
|
793
|
+
api_key: t || void 0,
|
|
794
|
+
base_url: e || r.baseUrl
|
|
790
795
|
})
|
|
791
796
|
})).json();
|
|
792
797
|
if (a.success && ((b = a.models) == null ? void 0 : b.length) > 0)
|
|
793
798
|
return a.models;
|
|
794
799
|
} catch (f) {
|
|
795
|
-
if (console.warn("Failed to fetch models via proxy:", f), !
|
|
800
|
+
if (console.warn("Failed to fetch models via proxy:", f), !c) throw f;
|
|
796
801
|
}
|
|
797
|
-
if (!
|
|
802
|
+
if (!o && r.supportsModelsApi)
|
|
798
803
|
try {
|
|
799
|
-
const f = ae(
|
|
804
|
+
const f = ae(r.apiFormat);
|
|
800
805
|
if (f.getModelsEndpoint) {
|
|
801
|
-
const a = f.getModelsEndpoint(e ||
|
|
806
|
+
const a = f.getModelsEndpoint(e || r.baseUrl, t || ""), n = f.buildHeaders(t || ""), B = await fetch(a, {
|
|
802
807
|
method: "GET",
|
|
803
808
|
headers: n
|
|
804
809
|
});
|
|
@@ -806,82 +811,82 @@ async function $r(p) {
|
|
|
806
811
|
const i = await B.json();
|
|
807
812
|
return (f.parseModelsResponse || Sr)(i);
|
|
808
813
|
} else {
|
|
809
|
-
const
|
|
810
|
-
if (console.warn("Model fetch failed:",
|
|
814
|
+
const l = ((u = (await B.json().catch(() => ({}))).error) == null ? void 0 : u.message) || `HTTP ${B.status}`;
|
|
815
|
+
if (console.warn("Model fetch failed:", l), !c) throw new Error(l);
|
|
811
816
|
}
|
|
812
817
|
}
|
|
813
818
|
} catch (f) {
|
|
814
|
-
if (console.warn("Failed to fetch models directly:", f), !
|
|
819
|
+
if (console.warn("Failed to fetch models directly:", f), !c) throw f;
|
|
815
820
|
}
|
|
816
|
-
if (!
|
|
821
|
+
if (!c && r.supportsModelsApi)
|
|
817
822
|
throw new Error("Failed to fetch models");
|
|
818
|
-
return te(
|
|
823
|
+
return te(r.id);
|
|
819
824
|
}
|
|
820
|
-
var
|
|
825
|
+
var oe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
821
826
|
function Tr(p) {
|
|
822
827
|
return p && p.__esModule && Object.prototype.hasOwnProperty.call(p, "default") ? p.default : p;
|
|
823
828
|
}
|
|
824
829
|
function Lr(p) {
|
|
825
830
|
if (Object.prototype.hasOwnProperty.call(p, "__esModule")) return p;
|
|
826
|
-
var
|
|
827
|
-
if (typeof
|
|
828
|
-
var
|
|
829
|
-
return this instanceof e ? Reflect.construct(
|
|
831
|
+
var r = p.default;
|
|
832
|
+
if (typeof r == "function") {
|
|
833
|
+
var t = function e() {
|
|
834
|
+
return this instanceof e ? Reflect.construct(r, arguments, this.constructor) : r.apply(this, arguments);
|
|
830
835
|
};
|
|
831
|
-
|
|
832
|
-
} else
|
|
833
|
-
return Object.defineProperty(
|
|
834
|
-
var
|
|
835
|
-
Object.defineProperty(
|
|
836
|
+
t.prototype = r.prototype;
|
|
837
|
+
} else t = {};
|
|
838
|
+
return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(p).forEach(function(e) {
|
|
839
|
+
var o = Object.getOwnPropertyDescriptor(p, e);
|
|
840
|
+
Object.defineProperty(t, e, o.get ? o : {
|
|
836
841
|
enumerable: !0,
|
|
837
842
|
get: function() {
|
|
838
843
|
return p[e];
|
|
839
844
|
}
|
|
840
845
|
});
|
|
841
|
-
}),
|
|
846
|
+
}), t;
|
|
842
847
|
}
|
|
843
848
|
var m0 = { exports: {} };
|
|
844
|
-
function
|
|
849
|
+
function Kr(p) {
|
|
845
850
|
throw new Error('Could not dynamically require "' + p + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
846
851
|
}
|
|
847
852
|
var A0 = { exports: {} };
|
|
848
|
-
const
|
|
853
|
+
const Ur = {}, qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
849
854
|
__proto__: null,
|
|
850
|
-
default:
|
|
851
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
855
|
+
default: Ur
|
|
856
|
+
}, Symbol.toStringTag, { value: "Module" })), zr = /* @__PURE__ */ Lr(qr);
|
|
852
857
|
var Nr = A0.exports, be;
|
|
853
858
|
function L() {
|
|
854
|
-
return be || (be = 1, (function(p,
|
|
855
|
-
(function(
|
|
859
|
+
return be || (be = 1, (function(p, r) {
|
|
860
|
+
(function(t, e) {
|
|
856
861
|
p.exports = e();
|
|
857
862
|
})(Nr, function() {
|
|
858
|
-
var
|
|
859
|
-
var
|
|
860
|
-
if (typeof window < "u" && window.crypto && (
|
|
863
|
+
var t = t || (function(e, o) {
|
|
864
|
+
var c;
|
|
865
|
+
if (typeof window < "u" && window.crypto && (c = window.crypto), typeof self < "u" && self.crypto && (c = self.crypto), typeof globalThis < "u" && globalThis.crypto && (c = globalThis.crypto), !c && typeof window < "u" && window.msCrypto && (c = window.msCrypto), !c && typeof oe < "u" && oe.crypto && (c = oe.crypto), !c && typeof Kr == "function")
|
|
861
866
|
try {
|
|
862
|
-
|
|
867
|
+
c = zr;
|
|
863
868
|
} catch {
|
|
864
869
|
}
|
|
865
870
|
var b = function() {
|
|
866
|
-
if (
|
|
867
|
-
if (typeof
|
|
871
|
+
if (c) {
|
|
872
|
+
if (typeof c.getRandomValues == "function")
|
|
868
873
|
try {
|
|
869
|
-
return
|
|
874
|
+
return c.getRandomValues(new Uint32Array(1))[0];
|
|
870
875
|
} catch {
|
|
871
876
|
}
|
|
872
|
-
if (typeof
|
|
877
|
+
if (typeof c.randomBytes == "function")
|
|
873
878
|
try {
|
|
874
|
-
return
|
|
879
|
+
return c.randomBytes(4).readInt32LE();
|
|
875
880
|
} catch {
|
|
876
881
|
}
|
|
877
882
|
}
|
|
878
883
|
throw new Error("Native crypto module could not be used to get secure random number.");
|
|
879
884
|
}, u = Object.create || /* @__PURE__ */ (function() {
|
|
880
|
-
function
|
|
885
|
+
function s() {
|
|
881
886
|
}
|
|
882
|
-
return function(
|
|
887
|
+
return function(x) {
|
|
883
888
|
var v;
|
|
884
|
-
return
|
|
889
|
+
return s.prototype = x, v = new s(), s.prototype = null, v;
|
|
885
890
|
};
|
|
886
891
|
})(), f = {}, a = f.lib = {}, n = a.Base = /* @__PURE__ */ (function() {
|
|
887
892
|
return {
|
|
@@ -903,11 +908,11 @@ function L() {
|
|
|
903
908
|
* }
|
|
904
909
|
* });
|
|
905
910
|
*/
|
|
906
|
-
extend: function(
|
|
907
|
-
var
|
|
908
|
-
return
|
|
909
|
-
|
|
910
|
-
}),
|
|
911
|
+
extend: function(s) {
|
|
912
|
+
var x = u(this);
|
|
913
|
+
return s && x.mixIn(s), (!x.hasOwnProperty("init") || this.init === x.init) && (x.init = function() {
|
|
914
|
+
x.$super.init.apply(this, arguments);
|
|
915
|
+
}), x.init.prototype = x, x.$super = this, x;
|
|
911
916
|
},
|
|
912
917
|
/**
|
|
913
918
|
* Extends this object and runs the init method.
|
|
@@ -922,8 +927,8 @@ function L() {
|
|
|
922
927
|
* var instance = MyType.create();
|
|
923
928
|
*/
|
|
924
929
|
create: function() {
|
|
925
|
-
var
|
|
926
|
-
return
|
|
930
|
+
var s = this.extend();
|
|
931
|
+
return s.init.apply(s, arguments), s;
|
|
927
932
|
},
|
|
928
933
|
/**
|
|
929
934
|
* Initializes a newly created object.
|
|
@@ -950,10 +955,10 @@ function L() {
|
|
|
950
955
|
* field: 'value'
|
|
951
956
|
* });
|
|
952
957
|
*/
|
|
953
|
-
mixIn: function(
|
|
954
|
-
for (var
|
|
955
|
-
|
|
956
|
-
|
|
958
|
+
mixIn: function(s) {
|
|
959
|
+
for (var x in s)
|
|
960
|
+
s.hasOwnProperty(x) && (this[x] = s[x]);
|
|
961
|
+
s.hasOwnProperty("toString") && (this.toString = s.toString);
|
|
957
962
|
},
|
|
958
963
|
/**
|
|
959
964
|
* Creates a copy of this object.
|
|
@@ -981,8 +986,8 @@ function L() {
|
|
|
981
986
|
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
|
|
982
987
|
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
|
|
983
988
|
*/
|
|
984
|
-
init: function(
|
|
985
|
-
|
|
989
|
+
init: function(s, x) {
|
|
990
|
+
s = this.words = s || [], x != o ? this.sigBytes = x : this.sigBytes = s.length * 4;
|
|
986
991
|
},
|
|
987
992
|
/**
|
|
988
993
|
* Converts this word array to a string.
|
|
@@ -997,8 +1002,8 @@ function L() {
|
|
|
997
1002
|
* var string = wordArray.toString();
|
|
998
1003
|
* var string = wordArray.toString(CryptoJS.enc.Utf8);
|
|
999
1004
|
*/
|
|
1000
|
-
toString: function(
|
|
1001
|
-
return (
|
|
1005
|
+
toString: function(s) {
|
|
1006
|
+
return (s || l).stringify(this);
|
|
1002
1007
|
},
|
|
1003
1008
|
/**
|
|
1004
1009
|
* Concatenates a word array to this word array.
|
|
@@ -1011,16 +1016,16 @@ function L() {
|
|
|
1011
1016
|
*
|
|
1012
1017
|
* wordArray1.concat(wordArray2);
|
|
1013
1018
|
*/
|
|
1014
|
-
concat: function(
|
|
1015
|
-
var
|
|
1019
|
+
concat: function(s) {
|
|
1020
|
+
var x = this.words, v = s.words, F = this.sigBytes, E = s.sigBytes;
|
|
1016
1021
|
if (this.clamp(), F % 4)
|
|
1017
1022
|
for (var g = 0; g < E; g++) {
|
|
1018
1023
|
var y = v[g >>> 2] >>> 24 - g % 4 * 8 & 255;
|
|
1019
|
-
|
|
1024
|
+
x[F + g >>> 2] |= y << 24 - (F + g) % 4 * 8;
|
|
1020
1025
|
}
|
|
1021
1026
|
else
|
|
1022
1027
|
for (var R = 0; R < E; R += 4)
|
|
1023
|
-
|
|
1028
|
+
x[F + R >>> 2] = v[R >>> 2];
|
|
1024
1029
|
return this.sigBytes += E, this;
|
|
1025
1030
|
},
|
|
1026
1031
|
/**
|
|
@@ -1031,8 +1036,8 @@ function L() {
|
|
|
1031
1036
|
* wordArray.clamp();
|
|
1032
1037
|
*/
|
|
1033
1038
|
clamp: function() {
|
|
1034
|
-
var
|
|
1035
|
-
|
|
1039
|
+
var s = this.words, x = this.sigBytes;
|
|
1040
|
+
s[x >>> 2] &= 4294967295 << 32 - x % 4 * 8, s.length = e.ceil(x / 4);
|
|
1036
1041
|
},
|
|
1037
1042
|
/**
|
|
1038
1043
|
* Creates a copy of this word array.
|
|
@@ -1044,8 +1049,8 @@ function L() {
|
|
|
1044
1049
|
* var clone = wordArray.clone();
|
|
1045
1050
|
*/
|
|
1046
1051
|
clone: function() {
|
|
1047
|
-
var
|
|
1048
|
-
return
|
|
1052
|
+
var s = n.clone.call(this);
|
|
1053
|
+
return s.words = this.words.slice(0), s;
|
|
1049
1054
|
},
|
|
1050
1055
|
/**
|
|
1051
1056
|
* Creates a word array filled with random bytes.
|
|
@@ -1060,12 +1065,12 @@ function L() {
|
|
|
1060
1065
|
*
|
|
1061
1066
|
* var wordArray = CryptoJS.lib.WordArray.random(16);
|
|
1062
1067
|
*/
|
|
1063
|
-
random: function(
|
|
1064
|
-
for (var
|
|
1065
|
-
|
|
1066
|
-
return new B.init(
|
|
1068
|
+
random: function(s) {
|
|
1069
|
+
for (var x = [], v = 0; v < s; v += 4)
|
|
1070
|
+
x.push(b());
|
|
1071
|
+
return new B.init(x, s);
|
|
1067
1072
|
}
|
|
1068
|
-
}), i = f.enc = {},
|
|
1073
|
+
}), i = f.enc = {}, l = i.Hex = {
|
|
1069
1074
|
/**
|
|
1070
1075
|
* Converts a word array to a hex string.
|
|
1071
1076
|
*
|
|
@@ -1079,9 +1084,9 @@ function L() {
|
|
|
1079
1084
|
*
|
|
1080
1085
|
* var hexString = CryptoJS.enc.Hex.stringify(wordArray);
|
|
1081
1086
|
*/
|
|
1082
|
-
stringify: function(
|
|
1083
|
-
for (var
|
|
1084
|
-
var g =
|
|
1087
|
+
stringify: function(s) {
|
|
1088
|
+
for (var x = s.words, v = s.sigBytes, F = [], E = 0; E < v; E++) {
|
|
1089
|
+
var g = x[E >>> 2] >>> 24 - E % 4 * 8 & 255;
|
|
1085
1090
|
F.push((g >>> 4).toString(16)), F.push((g & 15).toString(16));
|
|
1086
1091
|
}
|
|
1087
1092
|
return F.join("");
|
|
@@ -1099,12 +1104,12 @@ function L() {
|
|
|
1099
1104
|
*
|
|
1100
1105
|
* var wordArray = CryptoJS.enc.Hex.parse(hexString);
|
|
1101
1106
|
*/
|
|
1102
|
-
parse: function(
|
|
1103
|
-
for (var
|
|
1104
|
-
v[F >>> 3] |= parseInt(
|
|
1105
|
-
return new B.init(v,
|
|
1107
|
+
parse: function(s) {
|
|
1108
|
+
for (var x = s.length, v = [], F = 0; F < x; F += 2)
|
|
1109
|
+
v[F >>> 3] |= parseInt(s.substr(F, 2), 16) << 24 - F % 8 * 4;
|
|
1110
|
+
return new B.init(v, x / 2);
|
|
1106
1111
|
}
|
|
1107
|
-
},
|
|
1112
|
+
}, d = i.Latin1 = {
|
|
1108
1113
|
/**
|
|
1109
1114
|
* Converts a word array to a Latin1 string.
|
|
1110
1115
|
*
|
|
@@ -1118,9 +1123,9 @@ function L() {
|
|
|
1118
1123
|
*
|
|
1119
1124
|
* var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
|
|
1120
1125
|
*/
|
|
1121
|
-
stringify: function(
|
|
1122
|
-
for (var
|
|
1123
|
-
var g =
|
|
1126
|
+
stringify: function(s) {
|
|
1127
|
+
for (var x = s.words, v = s.sigBytes, F = [], E = 0; E < v; E++) {
|
|
1128
|
+
var g = x[E >>> 2] >>> 24 - E % 4 * 8 & 255;
|
|
1124
1129
|
F.push(String.fromCharCode(g));
|
|
1125
1130
|
}
|
|
1126
1131
|
return F.join("");
|
|
@@ -1138,10 +1143,10 @@ function L() {
|
|
|
1138
1143
|
*
|
|
1139
1144
|
* var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
|
|
1140
1145
|
*/
|
|
1141
|
-
parse: function(
|
|
1142
|
-
for (var
|
|
1143
|
-
v[F >>> 2] |= (
|
|
1144
|
-
return new B.init(v,
|
|
1146
|
+
parse: function(s) {
|
|
1147
|
+
for (var x = s.length, v = [], F = 0; F < x; F++)
|
|
1148
|
+
v[F >>> 2] |= (s.charCodeAt(F) & 255) << 24 - F % 4 * 8;
|
|
1149
|
+
return new B.init(v, x);
|
|
1145
1150
|
}
|
|
1146
1151
|
}, C = i.Utf8 = {
|
|
1147
1152
|
/**
|
|
@@ -1157,9 +1162,9 @@ function L() {
|
|
|
1157
1162
|
*
|
|
1158
1163
|
* var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
|
|
1159
1164
|
*/
|
|
1160
|
-
stringify: function(
|
|
1165
|
+
stringify: function(s) {
|
|
1161
1166
|
try {
|
|
1162
|
-
return decodeURIComponent(escape(
|
|
1167
|
+
return decodeURIComponent(escape(d.stringify(s)));
|
|
1163
1168
|
} catch {
|
|
1164
1169
|
throw new Error("Malformed UTF-8 data");
|
|
1165
1170
|
}
|
|
@@ -1177,8 +1182,8 @@ function L() {
|
|
|
1177
1182
|
*
|
|
1178
1183
|
* var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
|
|
1179
1184
|
*/
|
|
1180
|
-
parse: function(
|
|
1181
|
-
return
|
|
1185
|
+
parse: function(s) {
|
|
1186
|
+
return d.parse(unescape(encodeURIComponent(s)));
|
|
1182
1187
|
}
|
|
1183
1188
|
}, h = a.BufferedBlockAlgorithm = n.extend({
|
|
1184
1189
|
/**
|
|
@@ -1201,8 +1206,8 @@ function L() {
|
|
|
1201
1206
|
* bufferedBlockAlgorithm._append('data');
|
|
1202
1207
|
* bufferedBlockAlgorithm._append(wordArray);
|
|
1203
1208
|
*/
|
|
1204
|
-
_append: function(
|
|
1205
|
-
typeof
|
|
1209
|
+
_append: function(s) {
|
|
1210
|
+
typeof s == "string" && (s = C.parse(s)), this._data.concat(s), this._nDataBytes += s.sigBytes;
|
|
1206
1211
|
},
|
|
1207
1212
|
/**
|
|
1208
1213
|
* Processes available data blocks.
|
|
@@ -1218,16 +1223,16 @@ function L() {
|
|
|
1218
1223
|
* var processedData = bufferedBlockAlgorithm._process();
|
|
1219
1224
|
* var processedData = bufferedBlockAlgorithm._process(!!'flush');
|
|
1220
1225
|
*/
|
|
1221
|
-
_process: function(
|
|
1222
|
-
var
|
|
1223
|
-
|
|
1226
|
+
_process: function(s) {
|
|
1227
|
+
var x, v = this._data, F = v.words, E = v.sigBytes, g = this.blockSize, y = g * 4, R = E / y;
|
|
1228
|
+
s ? R = e.ceil(R) : R = e.max((R | 0) - this._minBufferSize, 0);
|
|
1224
1229
|
var m = R * g, D = e.min(m * 4, E);
|
|
1225
1230
|
if (m) {
|
|
1226
1231
|
for (var w = 0; w < m; w += g)
|
|
1227
1232
|
this._doProcessBlock(F, w);
|
|
1228
|
-
|
|
1233
|
+
x = F.splice(0, m), v.sigBytes -= D;
|
|
1229
1234
|
}
|
|
1230
|
-
return new B.init(
|
|
1235
|
+
return new B.init(x, D);
|
|
1231
1236
|
},
|
|
1232
1237
|
/**
|
|
1233
1238
|
* Creates a copy of this object.
|
|
@@ -1239,8 +1244,8 @@ function L() {
|
|
|
1239
1244
|
* var clone = bufferedBlockAlgorithm.clone();
|
|
1240
1245
|
*/
|
|
1241
1246
|
clone: function() {
|
|
1242
|
-
var
|
|
1243
|
-
return
|
|
1247
|
+
var s = n.clone.call(this);
|
|
1248
|
+
return s._data = this._data.clone(), s;
|
|
1244
1249
|
},
|
|
1245
1250
|
_minBufferSize: 0
|
|
1246
1251
|
});
|
|
@@ -1258,8 +1263,8 @@ function L() {
|
|
|
1258
1263
|
*
|
|
1259
1264
|
* var hasher = CryptoJS.algo.SHA256.create();
|
|
1260
1265
|
*/
|
|
1261
|
-
init: function(
|
|
1262
|
-
this.cfg = this.cfg.extend(
|
|
1266
|
+
init: function(s) {
|
|
1267
|
+
this.cfg = this.cfg.extend(s), this.reset();
|
|
1263
1268
|
},
|
|
1264
1269
|
/**
|
|
1265
1270
|
* Resets this hasher to its initial state.
|
|
@@ -1283,8 +1288,8 @@ function L() {
|
|
|
1283
1288
|
* hasher.update('message');
|
|
1284
1289
|
* hasher.update(wordArray);
|
|
1285
1290
|
*/
|
|
1286
|
-
update: function(
|
|
1287
|
-
return this._append(
|
|
1291
|
+
update: function(s) {
|
|
1292
|
+
return this._append(s), this._process(), this;
|
|
1288
1293
|
},
|
|
1289
1294
|
/**
|
|
1290
1295
|
* Finalizes the hash computation.
|
|
@@ -1300,10 +1305,10 @@ function L() {
|
|
|
1300
1305
|
* var hash = hasher.finalize('message');
|
|
1301
1306
|
* var hash = hasher.finalize(wordArray);
|
|
1302
1307
|
*/
|
|
1303
|
-
finalize: function(
|
|
1304
|
-
|
|
1305
|
-
var
|
|
1306
|
-
return
|
|
1308
|
+
finalize: function(s) {
|
|
1309
|
+
s && this._append(s);
|
|
1310
|
+
var x = this._doFinalize();
|
|
1311
|
+
return x;
|
|
1307
1312
|
},
|
|
1308
1313
|
blockSize: 16,
|
|
1309
1314
|
/**
|
|
@@ -1319,9 +1324,9 @@ function L() {
|
|
|
1319
1324
|
*
|
|
1320
1325
|
* var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
|
|
1321
1326
|
*/
|
|
1322
|
-
_createHelper: function(
|
|
1323
|
-
return function(
|
|
1324
|
-
return new
|
|
1327
|
+
_createHelper: function(s) {
|
|
1328
|
+
return function(x, v) {
|
|
1329
|
+
return new s.init(v).finalize(x);
|
|
1325
1330
|
};
|
|
1326
1331
|
},
|
|
1327
1332
|
/**
|
|
@@ -1337,27 +1342,27 @@ function L() {
|
|
|
1337
1342
|
*
|
|
1338
1343
|
* var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
|
|
1339
1344
|
*/
|
|
1340
|
-
_createHmacHelper: function(
|
|
1341
|
-
return function(
|
|
1342
|
-
return new A.HMAC.init(
|
|
1345
|
+
_createHmacHelper: function(s) {
|
|
1346
|
+
return function(x, v) {
|
|
1347
|
+
return new A.HMAC.init(s, v).finalize(x);
|
|
1343
1348
|
};
|
|
1344
1349
|
}
|
|
1345
1350
|
});
|
|
1346
1351
|
var A = f.algo = {};
|
|
1347
1352
|
return f;
|
|
1348
1353
|
})(Math);
|
|
1349
|
-
return
|
|
1354
|
+
return t;
|
|
1350
1355
|
});
|
|
1351
1356
|
})(A0)), A0.exports;
|
|
1352
1357
|
}
|
|
1353
1358
|
var E0 = { exports: {} }, Wr = E0.exports, ye;
|
|
1354
1359
|
function ne() {
|
|
1355
|
-
return ye || (ye = 1, (function(p,
|
|
1356
|
-
(function(
|
|
1360
|
+
return ye || (ye = 1, (function(p, r) {
|
|
1361
|
+
(function(t, e) {
|
|
1357
1362
|
p.exports = e(L());
|
|
1358
|
-
})(Wr, function(
|
|
1363
|
+
})(Wr, function(t) {
|
|
1359
1364
|
return (function(e) {
|
|
1360
|
-
var
|
|
1365
|
+
var o = t, c = o.lib, b = c.Base, u = c.WordArray, f = o.x64 = {};
|
|
1361
1366
|
f.Word = b.extend({
|
|
1362
1367
|
/**
|
|
1363
1368
|
* Initializes a newly created 64-bit word.
|
|
@@ -1556,8 +1561,8 @@ function ne() {
|
|
|
1556
1561
|
*/
|
|
1557
1562
|
toX32: function() {
|
|
1558
1563
|
for (var a = this.words, n = a.length, B = [], i = 0; i < n; i++) {
|
|
1559
|
-
var
|
|
1560
|
-
B.push(
|
|
1564
|
+
var l = a[i];
|
|
1565
|
+
B.push(l.high), B.push(l.low);
|
|
1561
1566
|
}
|
|
1562
1567
|
return u.create(B, this.sigBytes);
|
|
1563
1568
|
},
|
|
@@ -1576,19 +1581,19 @@ function ne() {
|
|
|
1576
1581
|
return a;
|
|
1577
1582
|
}
|
|
1578
1583
|
});
|
|
1579
|
-
})(),
|
|
1584
|
+
})(), t;
|
|
1580
1585
|
});
|
|
1581
1586
|
})(E0)), E0.exports;
|
|
1582
1587
|
}
|
|
1583
1588
|
var F0 = { exports: {} }, Gr = F0.exports, _e;
|
|
1584
1589
|
function Qr() {
|
|
1585
|
-
return _e || (_e = 1, (function(p,
|
|
1586
|
-
(function(
|
|
1590
|
+
return _e || (_e = 1, (function(p, r) {
|
|
1591
|
+
(function(t, e) {
|
|
1587
1592
|
p.exports = e(L());
|
|
1588
|
-
})(Gr, function(
|
|
1593
|
+
})(Gr, function(t) {
|
|
1589
1594
|
return (function() {
|
|
1590
1595
|
if (typeof ArrayBuffer == "function") {
|
|
1591
|
-
var e =
|
|
1596
|
+
var e = t, o = e.lib, c = o.WordArray, b = c.init, u = c.init = function(f) {
|
|
1592
1597
|
if (f instanceof ArrayBuffer && (f = new Uint8Array(f)), (f instanceof Int8Array || typeof Uint8ClampedArray < "u" && f instanceof Uint8ClampedArray || f instanceof Int16Array || f instanceof Uint16Array || f instanceof Int32Array || f instanceof Uint32Array || f instanceof Float32Array || f instanceof Float64Array) && (f = new Uint8Array(f.buffer, f.byteOffset, f.byteLength)), f instanceof Uint8Array) {
|
|
1593
1598
|
for (var a = f.byteLength, n = [], B = 0; B < a; B++)
|
|
1594
1599
|
n[B >>> 2] |= f[B] << 24 - B % 4 * 8;
|
|
@@ -1596,20 +1601,20 @@ function Qr() {
|
|
|
1596
1601
|
} else
|
|
1597
1602
|
b.apply(this, arguments);
|
|
1598
1603
|
};
|
|
1599
|
-
u.prototype =
|
|
1604
|
+
u.prototype = c;
|
|
1600
1605
|
}
|
|
1601
|
-
})(),
|
|
1606
|
+
})(), t.lib.WordArray;
|
|
1602
1607
|
});
|
|
1603
1608
|
})(F0)), F0.exports;
|
|
1604
1609
|
}
|
|
1605
1610
|
var D0 = { exports: {} }, Xr = D0.exports, we;
|
|
1606
1611
|
function Vr() {
|
|
1607
|
-
return we || (we = 1, (function(p,
|
|
1608
|
-
(function(
|
|
1612
|
+
return we || (we = 1, (function(p, r) {
|
|
1613
|
+
(function(t, e) {
|
|
1609
1614
|
p.exports = e(L());
|
|
1610
|
-
})(Xr, function(
|
|
1615
|
+
})(Xr, function(t) {
|
|
1611
1616
|
return (function() {
|
|
1612
|
-
var e =
|
|
1617
|
+
var e = t, o = e.lib, c = o.WordArray, b = e.enc;
|
|
1613
1618
|
b.Utf16 = b.Utf16BE = {
|
|
1614
1619
|
/**
|
|
1615
1620
|
* Converts a word array to a UTF-16 BE string.
|
|
@@ -1626,8 +1631,8 @@ function Vr() {
|
|
|
1626
1631
|
*/
|
|
1627
1632
|
stringify: function(f) {
|
|
1628
1633
|
for (var a = f.words, n = f.sigBytes, B = [], i = 0; i < n; i += 2) {
|
|
1629
|
-
var
|
|
1630
|
-
B.push(String.fromCharCode(
|
|
1634
|
+
var l = a[i >>> 2] >>> 16 - i % 4 * 8 & 65535;
|
|
1635
|
+
B.push(String.fromCharCode(l));
|
|
1631
1636
|
}
|
|
1632
1637
|
return B.join("");
|
|
1633
1638
|
},
|
|
@@ -1647,7 +1652,7 @@ function Vr() {
|
|
|
1647
1652
|
parse: function(f) {
|
|
1648
1653
|
for (var a = f.length, n = [], B = 0; B < a; B++)
|
|
1649
1654
|
n[B >>> 1] |= f.charCodeAt(B) << 16 - B % 2 * 16;
|
|
1650
|
-
return
|
|
1655
|
+
return c.create(n, a * 2);
|
|
1651
1656
|
}
|
|
1652
1657
|
}, b.Utf16LE = {
|
|
1653
1658
|
/**
|
|
@@ -1665,8 +1670,8 @@ function Vr() {
|
|
|
1665
1670
|
*/
|
|
1666
1671
|
stringify: function(f) {
|
|
1667
1672
|
for (var a = f.words, n = f.sigBytes, B = [], i = 0; i < n; i += 2) {
|
|
1668
|
-
var
|
|
1669
|
-
B.push(String.fromCharCode(
|
|
1673
|
+
var l = u(a[i >>> 2] >>> 16 - i % 4 * 8 & 65535);
|
|
1674
|
+
B.push(String.fromCharCode(l));
|
|
1670
1675
|
}
|
|
1671
1676
|
return B.join("");
|
|
1672
1677
|
},
|
|
@@ -1686,24 +1691,24 @@ function Vr() {
|
|
|
1686
1691
|
parse: function(f) {
|
|
1687
1692
|
for (var a = f.length, n = [], B = 0; B < a; B++)
|
|
1688
1693
|
n[B >>> 1] |= u(f.charCodeAt(B) << 16 - B % 2 * 16);
|
|
1689
|
-
return
|
|
1694
|
+
return c.create(n, a * 2);
|
|
1690
1695
|
}
|
|
1691
1696
|
};
|
|
1692
1697
|
function u(f) {
|
|
1693
1698
|
return f << 8 & 4278255360 | f >>> 8 & 16711935;
|
|
1694
1699
|
}
|
|
1695
|
-
})(),
|
|
1700
|
+
})(), t.enc.Utf16;
|
|
1696
1701
|
});
|
|
1697
1702
|
})(D0)), D0.exports;
|
|
1698
1703
|
}
|
|
1699
1704
|
var g0 = { exports: {} }, jr = g0.exports, ke;
|
|
1700
1705
|
function n0() {
|
|
1701
|
-
return ke || (ke = 1, (function(p,
|
|
1702
|
-
(function(
|
|
1706
|
+
return ke || (ke = 1, (function(p, r) {
|
|
1707
|
+
(function(t, e) {
|
|
1703
1708
|
p.exports = e(L());
|
|
1704
|
-
})(jr, function(
|
|
1709
|
+
})(jr, function(t) {
|
|
1705
1710
|
return (function() {
|
|
1706
|
-
var e =
|
|
1711
|
+
var e = t, o = e.lib, c = o.WordArray, b = e.enc;
|
|
1707
1712
|
b.Base64 = {
|
|
1708
1713
|
/**
|
|
1709
1714
|
* Converts a word array to a Base64 string.
|
|
@@ -1721,13 +1726,13 @@ function n0() {
|
|
|
1721
1726
|
stringify: function(f) {
|
|
1722
1727
|
var a = f.words, n = f.sigBytes, B = this._map;
|
|
1723
1728
|
f.clamp();
|
|
1724
|
-
for (var i = [],
|
|
1725
|
-
for (var
|
|
1726
|
-
i.push(B.charAt(A >>> 6 * (3 -
|
|
1727
|
-
var
|
|
1728
|
-
if (
|
|
1729
|
+
for (var i = [], l = 0; l < n; l += 3)
|
|
1730
|
+
for (var d = a[l >>> 2] >>> 24 - l % 4 * 8 & 255, C = a[l + 1 >>> 2] >>> 24 - (l + 1) % 4 * 8 & 255, h = a[l + 2 >>> 2] >>> 24 - (l + 2) % 4 * 8 & 255, A = d << 16 | C << 8 | h, s = 0; s < 4 && l + s * 0.75 < n; s++)
|
|
1731
|
+
i.push(B.charAt(A >>> 6 * (3 - s) & 63));
|
|
1732
|
+
var x = B.charAt(64);
|
|
1733
|
+
if (x)
|
|
1729
1734
|
for (; i.length % 4; )
|
|
1730
|
-
i.push(
|
|
1735
|
+
i.push(x);
|
|
1731
1736
|
return i.join("");
|
|
1732
1737
|
},
|
|
1733
1738
|
/**
|
|
@@ -1750,35 +1755,35 @@ function n0() {
|
|
|
1750
1755
|
for (var i = 0; i < n.length; i++)
|
|
1751
1756
|
B[n.charCodeAt(i)] = i;
|
|
1752
1757
|
}
|
|
1753
|
-
var
|
|
1754
|
-
if (
|
|
1755
|
-
var
|
|
1756
|
-
|
|
1758
|
+
var l = n.charAt(64);
|
|
1759
|
+
if (l) {
|
|
1760
|
+
var d = f.indexOf(l);
|
|
1761
|
+
d !== -1 && (a = d);
|
|
1757
1762
|
}
|
|
1758
1763
|
return u(f, a, B);
|
|
1759
1764
|
},
|
|
1760
1765
|
_map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
|
|
1761
1766
|
};
|
|
1762
1767
|
function u(f, a, n) {
|
|
1763
|
-
for (var B = [], i = 0,
|
|
1764
|
-
if (
|
|
1765
|
-
var
|
|
1768
|
+
for (var B = [], i = 0, l = 0; l < a; l++)
|
|
1769
|
+
if (l % 4) {
|
|
1770
|
+
var d = n[f.charCodeAt(l - 1)] << l % 4 * 2, C = n[f.charCodeAt(l)] >>> 6 - l % 4 * 2, h = d | C;
|
|
1766
1771
|
B[i >>> 2] |= h << 24 - i % 4 * 8, i++;
|
|
1767
1772
|
}
|
|
1768
|
-
return
|
|
1773
|
+
return c.create(B, i);
|
|
1769
1774
|
}
|
|
1770
|
-
})(),
|
|
1775
|
+
})(), t.enc.Base64;
|
|
1771
1776
|
});
|
|
1772
1777
|
})(g0)), g0.exports;
|
|
1773
1778
|
}
|
|
1774
1779
|
var b0 = { exports: {} }, Zr = b0.exports, Se;
|
|
1775
1780
|
function Yr() {
|
|
1776
|
-
return Se || (Se = 1, (function(p,
|
|
1777
|
-
(function(
|
|
1781
|
+
return Se || (Se = 1, (function(p, r) {
|
|
1782
|
+
(function(t, e) {
|
|
1778
1783
|
p.exports = e(L());
|
|
1779
|
-
})(Zr, function(
|
|
1784
|
+
})(Zr, function(t) {
|
|
1780
1785
|
return (function() {
|
|
1781
|
-
var e =
|
|
1786
|
+
var e = t, o = e.lib, c = o.WordArray, b = e.enc;
|
|
1782
1787
|
b.Base64url = {
|
|
1783
1788
|
/**
|
|
1784
1789
|
* Converts a word array to a Base64url string.
|
|
@@ -1799,14 +1804,14 @@ function Yr() {
|
|
|
1799
1804
|
a === void 0 && (a = !0);
|
|
1800
1805
|
var n = f.words, B = f.sigBytes, i = a ? this._safe_map : this._map;
|
|
1801
1806
|
f.clamp();
|
|
1802
|
-
for (var
|
|
1803
|
-
for (var C = n[
|
|
1804
|
-
|
|
1807
|
+
for (var l = [], d = 0; d < B; d += 3)
|
|
1808
|
+
for (var C = n[d >>> 2] >>> 24 - d % 4 * 8 & 255, h = n[d + 1 >>> 2] >>> 24 - (d + 1) % 4 * 8 & 255, A = n[d + 2 >>> 2] >>> 24 - (d + 2) % 4 * 8 & 255, s = C << 16 | h << 8 | A, x = 0; x < 4 && d + x * 0.75 < B; x++)
|
|
1809
|
+
l.push(i.charAt(s >>> 6 * (3 - x) & 63));
|
|
1805
1810
|
var v = i.charAt(64);
|
|
1806
1811
|
if (v)
|
|
1807
|
-
for (;
|
|
1808
|
-
|
|
1809
|
-
return
|
|
1812
|
+
for (; l.length % 4; )
|
|
1813
|
+
l.push(v);
|
|
1814
|
+
return l.join("");
|
|
1810
1815
|
},
|
|
1811
1816
|
/**
|
|
1812
1817
|
* Converts a Base64url string to a word array.
|
|
@@ -1828,12 +1833,12 @@ function Yr() {
|
|
|
1828
1833
|
var n = f.length, B = a ? this._safe_map : this._map, i = this._reverseMap;
|
|
1829
1834
|
if (!i) {
|
|
1830
1835
|
i = this._reverseMap = [];
|
|
1831
|
-
for (var
|
|
1832
|
-
i[B.charCodeAt(
|
|
1836
|
+
for (var l = 0; l < B.length; l++)
|
|
1837
|
+
i[B.charCodeAt(l)] = l;
|
|
1833
1838
|
}
|
|
1834
|
-
var
|
|
1835
|
-
if (
|
|
1836
|
-
var C = f.indexOf(
|
|
1839
|
+
var d = B.charAt(64);
|
|
1840
|
+
if (d) {
|
|
1841
|
+
var C = f.indexOf(d);
|
|
1837
1842
|
C !== -1 && (n = C);
|
|
1838
1843
|
}
|
|
1839
1844
|
return u(f, n, i);
|
|
@@ -1842,25 +1847,25 @@ function Yr() {
|
|
|
1842
1847
|
_safe_map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
|
|
1843
1848
|
};
|
|
1844
1849
|
function u(f, a, n) {
|
|
1845
|
-
for (var B = [], i = 0,
|
|
1846
|
-
if (
|
|
1847
|
-
var
|
|
1850
|
+
for (var B = [], i = 0, l = 0; l < a; l++)
|
|
1851
|
+
if (l % 4) {
|
|
1852
|
+
var d = n[f.charCodeAt(l - 1)] << l % 4 * 2, C = n[f.charCodeAt(l)] >>> 6 - l % 4 * 2, h = d | C;
|
|
1848
1853
|
B[i >>> 2] |= h << 24 - i % 4 * 8, i++;
|
|
1849
1854
|
}
|
|
1850
|
-
return
|
|
1855
|
+
return c.create(B, i);
|
|
1851
1856
|
}
|
|
1852
|
-
})(),
|
|
1857
|
+
})(), t.enc.Base64url;
|
|
1853
1858
|
});
|
|
1854
1859
|
})(b0)), b0.exports;
|
|
1855
1860
|
}
|
|
1856
1861
|
var y0 = { exports: {} }, Jr = y0.exports, Pe;
|
|
1857
1862
|
function i0() {
|
|
1858
|
-
return Pe || (Pe = 1, (function(p,
|
|
1859
|
-
(function(
|
|
1863
|
+
return Pe || (Pe = 1, (function(p, r) {
|
|
1864
|
+
(function(t, e) {
|
|
1860
1865
|
p.exports = e(L());
|
|
1861
|
-
})(Jr, function(
|
|
1866
|
+
})(Jr, function(t) {
|
|
1862
1867
|
return (function(e) {
|
|
1863
|
-
var
|
|
1868
|
+
var o = t, c = o.lib, b = c.WordArray, u = c.Hasher, f = o.algo, a = [];
|
|
1864
1869
|
(function() {
|
|
1865
1870
|
for (var C = 0; C < 64; C++)
|
|
1866
1871
|
a[C] = e.abs(e.sin(C + 1)) * 4294967296 | 0;
|
|
@@ -1876,17 +1881,17 @@ function i0() {
|
|
|
1876
1881
|
},
|
|
1877
1882
|
_doProcessBlock: function(C, h) {
|
|
1878
1883
|
for (var A = 0; A < 16; A++) {
|
|
1879
|
-
var
|
|
1880
|
-
C[
|
|
1884
|
+
var s = h + A, x = C[s];
|
|
1885
|
+
C[s] = (x << 8 | x >>> 24) & 16711935 | (x << 24 | x >>> 8) & 4278255360;
|
|
1881
1886
|
}
|
|
1882
|
-
var v = this._hash.words, F = C[h + 0], E = C[h + 1], g = C[h + 2], y = C[h + 3], R = C[h + 4], m = C[h + 5], D = C[h + 6], w = C[h + 7], k = C[h + 8], M = C[h + 9], O = C[h + 10], $ = C[h + 11], N = C[h + 12],
|
|
1883
|
-
_ = B(_, P, I, S, F, 7, a[0]), S = B(S, _, P, I, E, 12, a[1]), I = B(I, S, _, P, g, 17, a[2]), P = B(P, I, S, _, y, 22, a[3]), _ = B(_, P, I, S, R, 7, a[4]), S = B(S, _, P, I, m, 12, a[5]), I = B(I, S, _, P, D, 17, a[6]), P = B(P, I, S, _, w, 22, a[7]), _ = B(_, P, I, S, k, 7, a[8]), S = B(S, _, P, I, M, 12, a[9]), I = B(I, S, _, P, O, 17, a[10]), P = B(P, I, S, _, $, 22, a[11]), _ = B(_, P, I, S, N, 7, a[12]), S = B(S, _, P, I,
|
|
1887
|
+
var v = this._hash.words, F = C[h + 0], E = C[h + 1], g = C[h + 2], y = C[h + 3], R = C[h + 4], m = C[h + 5], D = C[h + 6], w = C[h + 7], k = C[h + 8], M = C[h + 9], O = C[h + 10], $ = C[h + 11], N = C[h + 12], K = C[h + 13], q = C[h + 14], U = C[h + 15], _ = v[0], P = v[1], I = v[2], S = v[3];
|
|
1888
|
+
_ = B(_, P, I, S, F, 7, a[0]), S = B(S, _, P, I, E, 12, a[1]), I = B(I, S, _, P, g, 17, a[2]), P = B(P, I, S, _, y, 22, a[3]), _ = B(_, P, I, S, R, 7, a[4]), S = B(S, _, P, I, m, 12, a[5]), I = B(I, S, _, P, D, 17, a[6]), P = B(P, I, S, _, w, 22, a[7]), _ = B(_, P, I, S, k, 7, a[8]), S = B(S, _, P, I, M, 12, a[9]), I = B(I, S, _, P, O, 17, a[10]), P = B(P, I, S, _, $, 22, a[11]), _ = B(_, P, I, S, N, 7, a[12]), S = B(S, _, P, I, K, 12, a[13]), I = B(I, S, _, P, q, 17, a[14]), P = B(P, I, S, _, U, 22, a[15]), _ = i(_, P, I, S, E, 5, a[16]), S = i(S, _, P, I, D, 9, a[17]), I = i(I, S, _, P, $, 14, a[18]), P = i(P, I, S, _, F, 20, a[19]), _ = i(_, P, I, S, m, 5, a[20]), S = i(S, _, P, I, O, 9, a[21]), I = i(I, S, _, P, U, 14, a[22]), P = i(P, I, S, _, R, 20, a[23]), _ = i(_, P, I, S, M, 5, a[24]), S = i(S, _, P, I, q, 9, a[25]), I = i(I, S, _, P, y, 14, a[26]), P = i(P, I, S, _, k, 20, a[27]), _ = i(_, P, I, S, K, 5, a[28]), S = i(S, _, P, I, g, 9, a[29]), I = i(I, S, _, P, w, 14, a[30]), P = i(P, I, S, _, N, 20, a[31]), _ = l(_, P, I, S, m, 4, a[32]), S = l(S, _, P, I, k, 11, a[33]), I = l(I, S, _, P, $, 16, a[34]), P = l(P, I, S, _, q, 23, a[35]), _ = l(_, P, I, S, E, 4, a[36]), S = l(S, _, P, I, R, 11, a[37]), I = l(I, S, _, P, w, 16, a[38]), P = l(P, I, S, _, O, 23, a[39]), _ = l(_, P, I, S, K, 4, a[40]), S = l(S, _, P, I, F, 11, a[41]), I = l(I, S, _, P, y, 16, a[42]), P = l(P, I, S, _, D, 23, a[43]), _ = l(_, P, I, S, M, 4, a[44]), S = l(S, _, P, I, N, 11, a[45]), I = l(I, S, _, P, U, 16, a[46]), P = l(P, I, S, _, g, 23, a[47]), _ = d(_, P, I, S, F, 6, a[48]), S = d(S, _, P, I, w, 10, a[49]), I = d(I, S, _, P, q, 15, a[50]), P = d(P, I, S, _, m, 21, a[51]), _ = d(_, P, I, S, N, 6, a[52]), S = d(S, _, P, I, y, 10, a[53]), I = d(I, S, _, P, O, 15, a[54]), P = d(P, I, S, _, E, 21, a[55]), _ = d(_, P, I, S, k, 6, a[56]), S = d(S, _, P, I, U, 10, a[57]), I = d(I, S, _, P, D, 15, a[58]), P = d(P, I, S, _, K, 21, a[59]), _ = d(_, P, I, S, R, 6, a[60]), S = d(S, _, P, I, $, 10, a[61]), I = d(I, S, _, P, g, 15, a[62]), P = d(P, I, S, _, M, 21, a[63]), v[0] = v[0] + _ | 0, v[1] = v[1] + P | 0, v[2] = v[2] + I | 0, v[3] = v[3] + S | 0;
|
|
1884
1889
|
},
|
|
1885
1890
|
_doFinalize: function() {
|
|
1886
|
-
var C = this._data, h = C.words, A = this._nDataBytes * 8,
|
|
1887
|
-
h[
|
|
1888
|
-
var
|
|
1889
|
-
h[(
|
|
1891
|
+
var C = this._data, h = C.words, A = this._nDataBytes * 8, s = C.sigBytes * 8;
|
|
1892
|
+
h[s >>> 5] |= 128 << 24 - s % 32;
|
|
1893
|
+
var x = e.floor(A / 4294967296), v = A;
|
|
1894
|
+
h[(s + 64 >>> 9 << 4) + 15] = (x << 8 | x >>> 24) & 16711935 | (x << 24 | x >>> 8) & 4278255360, h[(s + 64 >>> 9 << 4) + 14] = (v << 8 | v >>> 24) & 16711935 | (v << 24 | v >>> 8) & 4278255360, C.sigBytes = (h.length + 1) * 4, this._process();
|
|
1890
1895
|
for (var F = this._hash, E = F.words, g = 0; g < 4; g++) {
|
|
1891
1896
|
var y = E[g];
|
|
1892
1897
|
E[g] = (y << 8 | y >>> 24) & 16711935 | (y << 24 | y >>> 8) & 4278255360;
|
|
@@ -1898,37 +1903,37 @@ function i0() {
|
|
|
1898
1903
|
return C._hash = this._hash.clone(), C;
|
|
1899
1904
|
}
|
|
1900
1905
|
});
|
|
1901
|
-
function B(C, h, A,
|
|
1902
|
-
var E = C + (h & A | ~h &
|
|
1906
|
+
function B(C, h, A, s, x, v, F) {
|
|
1907
|
+
var E = C + (h & A | ~h & s) + x + F;
|
|
1903
1908
|
return (E << v | E >>> 32 - v) + h;
|
|
1904
1909
|
}
|
|
1905
|
-
function i(C, h, A,
|
|
1906
|
-
var E = C + (h &
|
|
1910
|
+
function i(C, h, A, s, x, v, F) {
|
|
1911
|
+
var E = C + (h & s | A & ~s) + x + F;
|
|
1907
1912
|
return (E << v | E >>> 32 - v) + h;
|
|
1908
1913
|
}
|
|
1909
|
-
function
|
|
1910
|
-
var E = C + (h ^ A ^
|
|
1914
|
+
function l(C, h, A, s, x, v, F) {
|
|
1915
|
+
var E = C + (h ^ A ^ s) + x + F;
|
|
1911
1916
|
return (E << v | E >>> 32 - v) + h;
|
|
1912
1917
|
}
|
|
1913
|
-
function
|
|
1914
|
-
var E = C + (A ^ (h | ~
|
|
1918
|
+
function d(C, h, A, s, x, v, F) {
|
|
1919
|
+
var E = C + (A ^ (h | ~s)) + x + F;
|
|
1915
1920
|
return (E << v | E >>> 32 - v) + h;
|
|
1916
1921
|
}
|
|
1917
|
-
|
|
1918
|
-
})(Math),
|
|
1922
|
+
o.MD5 = u._createHelper(n), o.HmacMD5 = u._createHmacHelper(n);
|
|
1923
|
+
})(Math), t.MD5;
|
|
1919
1924
|
});
|
|
1920
1925
|
})(y0)), y0.exports;
|
|
1921
1926
|
}
|
|
1922
1927
|
var _0 = { exports: {} }, et = _0.exports, Ie;
|
|
1923
1928
|
function lr() {
|
|
1924
|
-
return Ie || (Ie = 1, (function(p,
|
|
1925
|
-
(function(
|
|
1929
|
+
return Ie || (Ie = 1, (function(p, r) {
|
|
1930
|
+
(function(t, e) {
|
|
1926
1931
|
p.exports = e(L());
|
|
1927
|
-
})(et, function(
|
|
1932
|
+
})(et, function(t) {
|
|
1928
1933
|
return (function() {
|
|
1929
|
-
var e =
|
|
1934
|
+
var e = t, o = e.lib, c = o.WordArray, b = o.Hasher, u = e.algo, f = [], a = u.SHA1 = b.extend({
|
|
1930
1935
|
_doReset: function() {
|
|
1931
|
-
this._hash = new
|
|
1936
|
+
this._hash = new c.init([
|
|
1932
1937
|
1732584193,
|
|
1933
1938
|
4023233417,
|
|
1934
1939
|
2562383102,
|
|
@@ -1937,21 +1942,21 @@ function lr() {
|
|
|
1937
1942
|
]);
|
|
1938
1943
|
},
|
|
1939
1944
|
_doProcessBlock: function(n, B) {
|
|
1940
|
-
for (var i = this._hash.words,
|
|
1941
|
-
if (
|
|
1942
|
-
f[
|
|
1945
|
+
for (var i = this._hash.words, l = i[0], d = i[1], C = i[2], h = i[3], A = i[4], s = 0; s < 80; s++) {
|
|
1946
|
+
if (s < 16)
|
|
1947
|
+
f[s] = n[B + s] | 0;
|
|
1943
1948
|
else {
|
|
1944
|
-
var
|
|
1945
|
-
f[
|
|
1949
|
+
var x = f[s - 3] ^ f[s - 8] ^ f[s - 14] ^ f[s - 16];
|
|
1950
|
+
f[s] = x << 1 | x >>> 31;
|
|
1946
1951
|
}
|
|
1947
|
-
var v = (
|
|
1948
|
-
|
|
1952
|
+
var v = (l << 5 | l >>> 27) + A + f[s];
|
|
1953
|
+
s < 20 ? v += (d & C | ~d & h) + 1518500249 : s < 40 ? v += (d ^ C ^ h) + 1859775393 : s < 60 ? v += (d & C | d & h | C & h) - 1894007588 : v += (d ^ C ^ h) - 899497514, A = h, h = C, C = d << 30 | d >>> 2, d = l, l = v;
|
|
1949
1954
|
}
|
|
1950
|
-
i[0] = i[0] +
|
|
1955
|
+
i[0] = i[0] + l | 0, i[1] = i[1] + d | 0, i[2] = i[2] + C | 0, i[3] = i[3] + h | 0, i[4] = i[4] + A | 0;
|
|
1951
1956
|
},
|
|
1952
1957
|
_doFinalize: function() {
|
|
1953
|
-
var n = this._data, B = n.words, i = this._nDataBytes * 8,
|
|
1954
|
-
return B[
|
|
1958
|
+
var n = this._data, B = n.words, i = this._nDataBytes * 8, l = n.sigBytes * 8;
|
|
1959
|
+
return B[l >>> 5] |= 128 << 24 - l % 32, B[(l + 64 >>> 9 << 4) + 14] = Math.floor(i / 4294967296), B[(l + 64 >>> 9 << 4) + 15] = i, n.sigBytes = B.length * 4, this._process(), this._hash;
|
|
1955
1960
|
},
|
|
1956
1961
|
clone: function() {
|
|
1957
1962
|
var n = b.clone.call(this);
|
|
@@ -1959,72 +1964,72 @@ function lr() {
|
|
|
1959
1964
|
}
|
|
1960
1965
|
});
|
|
1961
1966
|
e.SHA1 = b._createHelper(a), e.HmacSHA1 = b._createHmacHelper(a);
|
|
1962
|
-
})(),
|
|
1967
|
+
})(), t.SHA1;
|
|
1963
1968
|
});
|
|
1964
1969
|
})(_0)), _0.exports;
|
|
1965
1970
|
}
|
|
1966
1971
|
var w0 = { exports: {} }, rt = w0.exports, Re;
|
|
1967
1972
|
function de() {
|
|
1968
|
-
return Re || (Re = 1, (function(p,
|
|
1969
|
-
(function(
|
|
1973
|
+
return Re || (Re = 1, (function(p, r) {
|
|
1974
|
+
(function(t, e) {
|
|
1970
1975
|
p.exports = e(L());
|
|
1971
|
-
})(rt, function(
|
|
1976
|
+
})(rt, function(t) {
|
|
1972
1977
|
return (function(e) {
|
|
1973
|
-
var
|
|
1978
|
+
var o = t, c = o.lib, b = c.WordArray, u = c.Hasher, f = o.algo, a = [], n = [];
|
|
1974
1979
|
(function() {
|
|
1975
|
-
function
|
|
1976
|
-
for (var
|
|
1977
|
-
if (!(A %
|
|
1980
|
+
function l(A) {
|
|
1981
|
+
for (var s = e.sqrt(A), x = 2; x <= s; x++)
|
|
1982
|
+
if (!(A % x))
|
|
1978
1983
|
return !1;
|
|
1979
1984
|
return !0;
|
|
1980
1985
|
}
|
|
1981
|
-
function
|
|
1986
|
+
function d(A) {
|
|
1982
1987
|
return (A - (A | 0)) * 4294967296 | 0;
|
|
1983
1988
|
}
|
|
1984
1989
|
for (var C = 2, h = 0; h < 64; )
|
|
1985
|
-
|
|
1990
|
+
l(C) && (h < 8 && (a[h] = d(e.pow(C, 1 / 2))), n[h] = d(e.pow(C, 1 / 3)), h++), C++;
|
|
1986
1991
|
})();
|
|
1987
1992
|
var B = [], i = f.SHA256 = u.extend({
|
|
1988
1993
|
_doReset: function() {
|
|
1989
1994
|
this._hash = new b.init(a.slice(0));
|
|
1990
1995
|
},
|
|
1991
|
-
_doProcessBlock: function(
|
|
1992
|
-
for (var C = this._hash.words, h = C[0], A = C[1],
|
|
1996
|
+
_doProcessBlock: function(l, d) {
|
|
1997
|
+
for (var C = this._hash.words, h = C[0], A = C[1], s = C[2], x = C[3], v = C[4], F = C[5], E = C[6], g = C[7], y = 0; y < 64; y++) {
|
|
1993
1998
|
if (y < 16)
|
|
1994
|
-
B[y] =
|
|
1999
|
+
B[y] = l[d + y] | 0;
|
|
1995
2000
|
else {
|
|
1996
2001
|
var R = B[y - 15], m = (R << 25 | R >>> 7) ^ (R << 14 | R >>> 18) ^ R >>> 3, D = B[y - 2], w = (D << 15 | D >>> 17) ^ (D << 13 | D >>> 19) ^ D >>> 10;
|
|
1997
2002
|
B[y] = m + B[y - 7] + w + B[y - 16];
|
|
1998
2003
|
}
|
|
1999
|
-
var k = v & F ^ ~v & E, M = h & A ^ h &
|
|
2000
|
-
g = E, E = F, F = v, v =
|
|
2004
|
+
var k = v & F ^ ~v & E, M = h & A ^ h & s ^ A & s, O = (h << 30 | h >>> 2) ^ (h << 19 | h >>> 13) ^ (h << 10 | h >>> 22), $ = (v << 26 | v >>> 6) ^ (v << 21 | v >>> 11) ^ (v << 7 | v >>> 25), N = g + $ + k + n[y] + B[y], K = O + M;
|
|
2005
|
+
g = E, E = F, F = v, v = x + N | 0, x = s, s = A, A = h, h = N + K | 0;
|
|
2001
2006
|
}
|
|
2002
|
-
C[0] = C[0] + h | 0, C[1] = C[1] + A | 0, C[2] = C[2] +
|
|
2007
|
+
C[0] = C[0] + h | 0, C[1] = C[1] + A | 0, C[2] = C[2] + s | 0, C[3] = C[3] + x | 0, C[4] = C[4] + v | 0, C[5] = C[5] + F | 0, C[6] = C[6] + E | 0, C[7] = C[7] + g | 0;
|
|
2003
2008
|
},
|
|
2004
2009
|
_doFinalize: function() {
|
|
2005
|
-
var
|
|
2006
|
-
return
|
|
2010
|
+
var l = this._data, d = l.words, C = this._nDataBytes * 8, h = l.sigBytes * 8;
|
|
2011
|
+
return d[h >>> 5] |= 128 << 24 - h % 32, d[(h + 64 >>> 9 << 4) + 14] = e.floor(C / 4294967296), d[(h + 64 >>> 9 << 4) + 15] = C, l.sigBytes = d.length * 4, this._process(), this._hash;
|
|
2007
2012
|
},
|
|
2008
2013
|
clone: function() {
|
|
2009
|
-
var
|
|
2010
|
-
return
|
|
2014
|
+
var l = u.clone.call(this);
|
|
2015
|
+
return l._hash = this._hash.clone(), l;
|
|
2011
2016
|
}
|
|
2012
2017
|
});
|
|
2013
|
-
|
|
2014
|
-
})(Math),
|
|
2018
|
+
o.SHA256 = u._createHelper(i), o.HmacSHA256 = u._createHmacHelper(i);
|
|
2019
|
+
})(Math), t.SHA256;
|
|
2015
2020
|
});
|
|
2016
2021
|
})(w0)), w0.exports;
|
|
2017
2022
|
}
|
|
2018
2023
|
var k0 = { exports: {} }, tt = k0.exports, He;
|
|
2019
2024
|
function at() {
|
|
2020
|
-
return He || (He = 1, (function(p,
|
|
2021
|
-
(function(
|
|
2025
|
+
return He || (He = 1, (function(p, r) {
|
|
2026
|
+
(function(t, e, o) {
|
|
2022
2027
|
p.exports = e(L(), de());
|
|
2023
|
-
})(tt, function(
|
|
2028
|
+
})(tt, function(t) {
|
|
2024
2029
|
return (function() {
|
|
2025
|
-
var e =
|
|
2030
|
+
var e = t, o = e.lib, c = o.WordArray, b = e.algo, u = b.SHA256, f = b.SHA224 = u.extend({
|
|
2026
2031
|
_doReset: function() {
|
|
2027
|
-
this._hash = new
|
|
2032
|
+
this._hash = new c.init([
|
|
2028
2033
|
3238371032,
|
|
2029
2034
|
914150663,
|
|
2030
2035
|
812702999,
|
|
@@ -2041,18 +2046,18 @@ function at() {
|
|
|
2041
2046
|
}
|
|
2042
2047
|
});
|
|
2043
2048
|
e.SHA224 = u._createHelper(f), e.HmacSHA224 = u._createHmacHelper(f);
|
|
2044
|
-
})(),
|
|
2049
|
+
})(), t.SHA224;
|
|
2045
2050
|
});
|
|
2046
2051
|
})(k0)), k0.exports;
|
|
2047
2052
|
}
|
|
2048
2053
|
var S0 = { exports: {} }, nt = S0.exports, Me;
|
|
2049
2054
|
function dr() {
|
|
2050
|
-
return Me || (Me = 1, (function(p,
|
|
2051
|
-
(function(
|
|
2055
|
+
return Me || (Me = 1, (function(p, r) {
|
|
2056
|
+
(function(t, e, o) {
|
|
2052
2057
|
p.exports = e(L(), ne());
|
|
2053
|
-
})(nt, function(
|
|
2058
|
+
})(nt, function(t) {
|
|
2054
2059
|
return (function() {
|
|
2055
|
-
var e =
|
|
2060
|
+
var e = t, o = e.lib, c = o.Hasher, b = e.x64, u = b.Word, f = b.WordArray, a = e.algo;
|
|
2056
2061
|
function n() {
|
|
2057
2062
|
return u.create.apply(u, arguments);
|
|
2058
2063
|
}
|
|
@@ -2139,10 +2144,10 @@ function dr() {
|
|
|
2139
2144
|
n(1816402316, 1246189591)
|
|
2140
2145
|
], i = [];
|
|
2141
2146
|
(function() {
|
|
2142
|
-
for (var
|
|
2143
|
-
i[
|
|
2147
|
+
for (var d = 0; d < 80; d++)
|
|
2148
|
+
i[d] = n();
|
|
2144
2149
|
})();
|
|
2145
|
-
var
|
|
2150
|
+
var l = a.SHA512 = c.extend({
|
|
2146
2151
|
_doReset: function() {
|
|
2147
2152
|
this._hash = new f.init([
|
|
2148
2153
|
new u.init(1779033703, 4089235720),
|
|
@@ -2155,55 +2160,55 @@ function dr() {
|
|
|
2155
2160
|
new u.init(1541459225, 327033209)
|
|
2156
2161
|
]);
|
|
2157
2162
|
},
|
|
2158
|
-
_doProcessBlock: function(
|
|
2159
|
-
for (var h = this._hash.words, A = h[0],
|
|
2163
|
+
_doProcessBlock: function(d, C) {
|
|
2164
|
+
for (var h = this._hash.words, A = h[0], s = h[1], x = h[2], v = h[3], F = h[4], E = h[5], g = h[6], y = h[7], R = A.high, m = A.low, D = s.high, w = s.low, k = x.high, M = x.low, O = v.high, $ = v.low, N = F.high, K = F.low, q = E.high, U = E.low, _ = g.high, P = g.low, I = y.high, S = y.low, W = R, z = m, X = D, T = w, c0 = k, s0 = M, ie = O, l0 = $, Y = N, V = K, p0 = q, d0 = U, C0 = _, f0 = P, se = I, u0 = S, J = 0; J < 80; J++) {
|
|
2160
2165
|
var Z, e0, B0 = i[J];
|
|
2161
2166
|
if (J < 16)
|
|
2162
|
-
e0 = B0.high =
|
|
2167
|
+
e0 = B0.high = d[C + J * 2] | 0, Z = B0.low = d[C + J * 2 + 1] | 0;
|
|
2163
2168
|
else {
|
|
2164
|
-
var ue = i[J - 15],
|
|
2169
|
+
var ue = i[J - 15], o0 = ue.high, h0 = ue.low, hr = (o0 >>> 1 | h0 << 31) ^ (o0 >>> 8 | h0 << 24) ^ o0 >>> 7, he = (h0 >>> 1 | o0 << 31) ^ (h0 >>> 8 | o0 << 24) ^ (h0 >>> 7 | o0 << 25), ve = i[J - 2], x0 = ve.high, v0 = ve.low, vr = (x0 >>> 19 | v0 << 13) ^ (x0 << 3 | v0 >>> 29) ^ x0 >>> 6, pe = (v0 >>> 19 | x0 << 13) ^ (v0 << 3 | x0 >>> 29) ^ (v0 >>> 6 | x0 << 26), Ce = i[J - 7], pr = Ce.high, Cr = Ce.low, Be = i[J - 16], Br = Be.high, me = Be.low;
|
|
2165
2170
|
Z = he + Cr, e0 = hr + pr + (Z >>> 0 < he >>> 0 ? 1 : 0), Z = Z + pe, e0 = e0 + vr + (Z >>> 0 < pe >>> 0 ? 1 : 0), Z = Z + me, e0 = e0 + Br + (Z >>> 0 < me >>> 0 ? 1 : 0), B0.high = e0, B0.low = Z;
|
|
2166
2171
|
}
|
|
2167
|
-
var mr = Y & p0 ^ ~Y & C0, Ae = V & d0 ^ ~V & f0, Ar = W & X ^ W & c0 ^ X & c0, Er =
|
|
2168
|
-
|
|
2172
|
+
var mr = Y & p0 ^ ~Y & C0, Ae = V & d0 ^ ~V & f0, Ar = W & X ^ W & c0 ^ X & c0, Er = z & T ^ z & s0 ^ T & s0, Fr = (W >>> 28 | z << 4) ^ (W << 30 | z >>> 2) ^ (W << 25 | z >>> 7), Ee = (z >>> 28 | W << 4) ^ (z << 30 | W >>> 2) ^ (z << 25 | W >>> 7), Dr = (Y >>> 14 | V << 18) ^ (Y >>> 18 | V << 14) ^ (Y << 23 | V >>> 9), gr = (V >>> 14 | Y << 18) ^ (V >>> 18 | Y << 14) ^ (V << 23 | Y >>> 9), Fe = B[J], br = Fe.high, De = Fe.low, j = u0 + gr, r0 = se + Dr + (j >>> 0 < u0 >>> 0 ? 1 : 0), j = j + Ae, r0 = r0 + mr + (j >>> 0 < Ae >>> 0 ? 1 : 0), j = j + De, r0 = r0 + br + (j >>> 0 < De >>> 0 ? 1 : 0), j = j + Z, r0 = r0 + e0 + (j >>> 0 < Z >>> 0 ? 1 : 0), ge = Ee + Er, yr = Fr + Ar + (ge >>> 0 < Ee >>> 0 ? 1 : 0);
|
|
2173
|
+
se = C0, u0 = f0, C0 = p0, f0 = d0, p0 = Y, d0 = V, V = l0 + j | 0, Y = ie + r0 + (V >>> 0 < l0 >>> 0 ? 1 : 0) | 0, ie = c0, l0 = s0, c0 = X, s0 = T, X = W, T = z, z = j + ge | 0, W = r0 + yr + (z >>> 0 < j >>> 0 ? 1 : 0) | 0;
|
|
2169
2174
|
}
|
|
2170
|
-
m = A.low = m +
|
|
2175
|
+
m = A.low = m + z, A.high = R + W + (m >>> 0 < z >>> 0 ? 1 : 0), w = s.low = w + T, s.high = D + X + (w >>> 0 < T >>> 0 ? 1 : 0), M = x.low = M + s0, x.high = k + c0 + (M >>> 0 < s0 >>> 0 ? 1 : 0), $ = v.low = $ + l0, v.high = O + ie + ($ >>> 0 < l0 >>> 0 ? 1 : 0), K = F.low = K + V, F.high = N + Y + (K >>> 0 < V >>> 0 ? 1 : 0), U = E.low = U + d0, E.high = q + p0 + (U >>> 0 < d0 >>> 0 ? 1 : 0), P = g.low = P + f0, g.high = _ + C0 + (P >>> 0 < f0 >>> 0 ? 1 : 0), S = y.low = S + u0, y.high = I + se + (S >>> 0 < u0 >>> 0 ? 1 : 0);
|
|
2171
2176
|
},
|
|
2172
2177
|
_doFinalize: function() {
|
|
2173
|
-
var
|
|
2174
|
-
C[A >>> 5] |= 128 << 24 - A % 32, C[(A + 128 >>> 10 << 5) + 30] = Math.floor(h / 4294967296), C[(A + 128 >>> 10 << 5) + 31] = h,
|
|
2175
|
-
var
|
|
2176
|
-
return
|
|
2178
|
+
var d = this._data, C = d.words, h = this._nDataBytes * 8, A = d.sigBytes * 8;
|
|
2179
|
+
C[A >>> 5] |= 128 << 24 - A % 32, C[(A + 128 >>> 10 << 5) + 30] = Math.floor(h / 4294967296), C[(A + 128 >>> 10 << 5) + 31] = h, d.sigBytes = C.length * 4, this._process();
|
|
2180
|
+
var s = this._hash.toX32();
|
|
2181
|
+
return s;
|
|
2177
2182
|
},
|
|
2178
2183
|
clone: function() {
|
|
2179
|
-
var
|
|
2180
|
-
return
|
|
2184
|
+
var d = c.clone.call(this);
|
|
2185
|
+
return d._hash = this._hash.clone(), d;
|
|
2181
2186
|
},
|
|
2182
2187
|
blockSize: 1024 / 32
|
|
2183
2188
|
});
|
|
2184
|
-
e.SHA512 =
|
|
2185
|
-
})(),
|
|
2189
|
+
e.SHA512 = c._createHelper(l), e.HmacSHA512 = c._createHmacHelper(l);
|
|
2190
|
+
})(), t.SHA512;
|
|
2186
2191
|
});
|
|
2187
2192
|
})(S0)), S0.exports;
|
|
2188
2193
|
}
|
|
2189
2194
|
var P0 = { exports: {} }, it = P0.exports, Oe;
|
|
2190
|
-
function
|
|
2191
|
-
return Oe || (Oe = 1, (function(p,
|
|
2192
|
-
(function(
|
|
2195
|
+
function st() {
|
|
2196
|
+
return Oe || (Oe = 1, (function(p, r) {
|
|
2197
|
+
(function(t, e, o) {
|
|
2193
2198
|
p.exports = e(L(), ne(), dr());
|
|
2194
|
-
})(it, function(
|
|
2199
|
+
})(it, function(t) {
|
|
2195
2200
|
return (function() {
|
|
2196
|
-
var e =
|
|
2201
|
+
var e = t, o = e.x64, c = o.Word, b = o.WordArray, u = e.algo, f = u.SHA512, a = u.SHA384 = f.extend({
|
|
2197
2202
|
_doReset: function() {
|
|
2198
2203
|
this._hash = new b.init([
|
|
2199
|
-
new
|
|
2200
|
-
new
|
|
2201
|
-
new
|
|
2202
|
-
new
|
|
2203
|
-
new
|
|
2204
|
-
new
|
|
2205
|
-
new
|
|
2206
|
-
new
|
|
2204
|
+
new c.init(3418070365, 3238371032),
|
|
2205
|
+
new c.init(1654270250, 914150663),
|
|
2206
|
+
new c.init(2438529370, 812702999),
|
|
2207
|
+
new c.init(355462360, 4144912697),
|
|
2208
|
+
new c.init(1731405415, 4290775857),
|
|
2209
|
+
new c.init(2394180231, 1750603025),
|
|
2210
|
+
new c.init(3675008525, 1694076839),
|
|
2211
|
+
new c.init(1203062813, 3204075428)
|
|
2207
2212
|
]);
|
|
2208
2213
|
},
|
|
2209
2214
|
_doFinalize: function() {
|
|
@@ -2212,23 +2217,23 @@ function ot() {
|
|
|
2212
2217
|
}
|
|
2213
2218
|
});
|
|
2214
2219
|
e.SHA384 = f._createHelper(a), e.HmacSHA384 = f._createHmacHelper(a);
|
|
2215
|
-
})(),
|
|
2220
|
+
})(), t.SHA384;
|
|
2216
2221
|
});
|
|
2217
2222
|
})(P0)), P0.exports;
|
|
2218
2223
|
}
|
|
2219
|
-
var I0 = { exports: {} },
|
|
2224
|
+
var I0 = { exports: {} }, ot = I0.exports, $e;
|
|
2220
2225
|
function xt() {
|
|
2221
|
-
return $e || ($e = 1, (function(p,
|
|
2222
|
-
(function(
|
|
2226
|
+
return $e || ($e = 1, (function(p, r) {
|
|
2227
|
+
(function(t, e, o) {
|
|
2223
2228
|
p.exports = e(L(), ne());
|
|
2224
|
-
})(
|
|
2229
|
+
})(ot, function(t) {
|
|
2225
2230
|
return (function(e) {
|
|
2226
|
-
var
|
|
2231
|
+
var o = t, c = o.lib, b = c.WordArray, u = c.Hasher, f = o.x64, a = f.Word, n = o.algo, B = [], i = [], l = [];
|
|
2227
2232
|
(function() {
|
|
2228
|
-
for (var h = 1, A = 0,
|
|
2229
|
-
B[h + 5 * A] = (
|
|
2230
|
-
var
|
|
2231
|
-
h =
|
|
2233
|
+
for (var h = 1, A = 0, s = 0; s < 24; s++) {
|
|
2234
|
+
B[h + 5 * A] = (s + 1) * (s + 2) / 2 % 64;
|
|
2235
|
+
var x = A % 5, v = (2 * h + 3 * A) % 5;
|
|
2236
|
+
h = x, A = v;
|
|
2232
2237
|
}
|
|
2233
2238
|
for (var h = 0; h < 5; h++)
|
|
2234
2239
|
for (var A = 0; A < 5; A++)
|
|
@@ -2241,13 +2246,13 @@ function xt() {
|
|
|
2241
2246
|
}
|
|
2242
2247
|
F & 128 ? F = F << 1 ^ 113 : F <<= 1;
|
|
2243
2248
|
}
|
|
2244
|
-
|
|
2249
|
+
l[E] = a.create(g, y);
|
|
2245
2250
|
}
|
|
2246
2251
|
})();
|
|
2247
|
-
var
|
|
2252
|
+
var d = [];
|
|
2248
2253
|
(function() {
|
|
2249
2254
|
for (var h = 0; h < 25; h++)
|
|
2250
|
-
|
|
2255
|
+
d[h] = a.create();
|
|
2251
2256
|
})();
|
|
2252
2257
|
var C = n.SHA3 = u.extend({
|
|
2253
2258
|
/**
|
|
@@ -2267,48 +2272,48 @@ function xt() {
|
|
|
2267
2272
|
this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
|
|
2268
2273
|
},
|
|
2269
2274
|
_doProcessBlock: function(h, A) {
|
|
2270
|
-
for (var
|
|
2275
|
+
for (var s = this._state, x = this.blockSize / 2, v = 0; v < x; v++) {
|
|
2271
2276
|
var F = h[A + 2 * v], E = h[A + 2 * v + 1];
|
|
2272
2277
|
F = (F << 8 | F >>> 24) & 16711935 | (F << 24 | F >>> 8) & 4278255360, E = (E << 8 | E >>> 24) & 16711935 | (E << 24 | E >>> 8) & 4278255360;
|
|
2273
|
-
var g =
|
|
2278
|
+
var g = s[v];
|
|
2274
2279
|
g.high ^= E, g.low ^= F;
|
|
2275
2280
|
}
|
|
2276
2281
|
for (var y = 0; y < 24; y++) {
|
|
2277
2282
|
for (var R = 0; R < 5; R++) {
|
|
2278
2283
|
for (var m = 0, D = 0, w = 0; w < 5; w++) {
|
|
2279
|
-
var g =
|
|
2284
|
+
var g = s[R + 5 * w];
|
|
2280
2285
|
m ^= g.high, D ^= g.low;
|
|
2281
2286
|
}
|
|
2282
|
-
var k =
|
|
2287
|
+
var k = d[R];
|
|
2283
2288
|
k.high = m, k.low = D;
|
|
2284
2289
|
}
|
|
2285
2290
|
for (var R = 0; R < 5; R++)
|
|
2286
|
-
for (var M =
|
|
2287
|
-
var g =
|
|
2291
|
+
for (var M = d[(R + 4) % 5], O = d[(R + 1) % 5], $ = O.high, N = O.low, m = M.high ^ ($ << 1 | N >>> 31), D = M.low ^ (N << 1 | $ >>> 31), w = 0; w < 5; w++) {
|
|
2292
|
+
var g = s[R + 5 * w];
|
|
2288
2293
|
g.high ^= m, g.low ^= D;
|
|
2289
2294
|
}
|
|
2290
|
-
for (var
|
|
2291
|
-
var m, D, g =
|
|
2292
|
-
_ < 32 ? (m =
|
|
2293
|
-
var P =
|
|
2295
|
+
for (var K = 1; K < 25; K++) {
|
|
2296
|
+
var m, D, g = s[K], q = g.high, U = g.low, _ = B[K];
|
|
2297
|
+
_ < 32 ? (m = q << _ | U >>> 32 - _, D = U << _ | q >>> 32 - _) : (m = U << _ - 32 | q >>> 64 - _, D = q << _ - 32 | U >>> 64 - _);
|
|
2298
|
+
var P = d[i[K]];
|
|
2294
2299
|
P.high = m, P.low = D;
|
|
2295
2300
|
}
|
|
2296
|
-
var I =
|
|
2301
|
+
var I = d[0], S = s[0];
|
|
2297
2302
|
I.high = S.high, I.low = S.low;
|
|
2298
2303
|
for (var R = 0; R < 5; R++)
|
|
2299
2304
|
for (var w = 0; w < 5; w++) {
|
|
2300
|
-
var
|
|
2301
|
-
g.high = W.high ^ ~
|
|
2305
|
+
var K = R + 5 * w, g = s[K], W = d[K], z = d[(R + 1) % 5 + 5 * w], X = d[(R + 2) % 5 + 5 * w];
|
|
2306
|
+
g.high = W.high ^ ~z.high & X.high, g.low = W.low ^ ~z.low & X.low;
|
|
2302
2307
|
}
|
|
2303
|
-
var g =
|
|
2308
|
+
var g = s[0], T = l[y];
|
|
2304
2309
|
g.high ^= T.high, g.low ^= T.low;
|
|
2305
2310
|
}
|
|
2306
2311
|
},
|
|
2307
2312
|
_doFinalize: function() {
|
|
2308
2313
|
var h = this._data, A = h.words;
|
|
2309
2314
|
this._nDataBytes * 8;
|
|
2310
|
-
var
|
|
2311
|
-
A[
|
|
2315
|
+
var s = h.sigBytes * 8, x = this.blockSize * 32;
|
|
2316
|
+
A[s >>> 5] |= 1 << 24 - s % 32, A[(e.ceil((s + 1) / x) * x >>> 5) - 1] |= 128, h.sigBytes = A.length * 4, this._process();
|
|
2312
2317
|
for (var v = this._state, F = this.cfg.outputLength / 8, E = F / 8, g = [], y = 0; y < E; y++) {
|
|
2313
2318
|
var R = v[y], m = R.high, D = R.low;
|
|
2314
2319
|
m = (m << 8 | m >>> 24) & 16711935 | (m << 24 | m >>> 8) & 4278255360, D = (D << 8 | D >>> 24) & 16711935 | (D << 24 | D >>> 8) & 4278255360, g.push(D), g.push(m);
|
|
@@ -2316,22 +2321,22 @@ function xt() {
|
|
|
2316
2321
|
return new b.init(g, F);
|
|
2317
2322
|
},
|
|
2318
2323
|
clone: function() {
|
|
2319
|
-
for (var h = u.clone.call(this), A = h._state = this._state.slice(0),
|
|
2320
|
-
A[
|
|
2324
|
+
for (var h = u.clone.call(this), A = h._state = this._state.slice(0), s = 0; s < 25; s++)
|
|
2325
|
+
A[s] = A[s].clone();
|
|
2321
2326
|
return h;
|
|
2322
2327
|
}
|
|
2323
2328
|
});
|
|
2324
|
-
|
|
2325
|
-
})(Math),
|
|
2329
|
+
o.SHA3 = u._createHelper(C), o.HmacSHA3 = u._createHmacHelper(C);
|
|
2330
|
+
})(Math), t.SHA3;
|
|
2326
2331
|
});
|
|
2327
2332
|
})(I0)), I0.exports;
|
|
2328
2333
|
}
|
|
2329
2334
|
var R0 = { exports: {} }, ct = R0.exports, Te;
|
|
2330
2335
|
function lt() {
|
|
2331
|
-
return Te || (Te = 1, (function(p,
|
|
2332
|
-
(function(
|
|
2336
|
+
return Te || (Te = 1, (function(p, r) {
|
|
2337
|
+
(function(t, e) {
|
|
2333
2338
|
p.exports = e(L());
|
|
2334
|
-
})(ct, function(
|
|
2339
|
+
})(ct, function(t) {
|
|
2335
2340
|
/** @preserve
|
|
2336
2341
|
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
2337
2342
|
|
|
@@ -2343,7 +2348,7 @@ function lt() {
|
|
|
2343
2348
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
2344
2349
|
*/
|
|
2345
2350
|
return (function(e) {
|
|
2346
|
-
var
|
|
2351
|
+
var o = t, c = o.lib, b = c.WordArray, u = c.Hasher, f = o.algo, a = b.create([
|
|
2347
2352
|
0,
|
|
2348
2353
|
1,
|
|
2349
2354
|
2,
|
|
@@ -2667,7 +2672,7 @@ function lt() {
|
|
|
2667
2672
|
13,
|
|
2668
2673
|
11,
|
|
2669
2674
|
11
|
|
2670
|
-
]),
|
|
2675
|
+
]), l = b.create([0, 1518500249, 1859775393, 2400959708, 2840853838]), d = b.create([1352829926, 1548603684, 1836072691, 2053994217, 0]), C = f.RIPEMD160 = u.extend({
|
|
2671
2676
|
_doReset: function() {
|
|
2672
2677
|
this._hash = b.create([1732584193, 4023233417, 2562383102, 271733878, 3285377520]);
|
|
2673
2678
|
},
|
|
@@ -2676,11 +2681,11 @@ function lt() {
|
|
|
2676
2681
|
var R = g + y, m = E[R];
|
|
2677
2682
|
E[R] = (m << 8 | m >>> 24) & 16711935 | (m << 24 | m >>> 8) & 4278255360;
|
|
2678
2683
|
}
|
|
2679
|
-
var D = this._hash.words, w =
|
|
2680
|
-
I =
|
|
2684
|
+
var D = this._hash.words, w = l.words, k = d.words, M = a.words, O = n.words, $ = B.words, N = i.words, K, q, U, _, P, I, S, W, z, X;
|
|
2685
|
+
I = K = D[0], S = q = D[1], W = U = D[2], z = _ = D[3], X = P = D[4];
|
|
2681
2686
|
for (var T, y = 0; y < 80; y += 1)
|
|
2682
|
-
T =
|
|
2683
|
-
T = D[1] +
|
|
2687
|
+
T = K + E[g + M[y]] | 0, y < 16 ? T += h(q, U, _) + w[0] : y < 32 ? T += A(q, U, _) + w[1] : y < 48 ? T += s(q, U, _) + w[2] : y < 64 ? T += x(q, U, _) + w[3] : T += v(q, U, _) + w[4], T = T | 0, T = F(T, $[y]), T = T + P | 0, K = P, P = _, _ = F(U, 10), U = q, q = T, T = I + E[g + O[y]] | 0, y < 16 ? T += v(S, W, z) + k[0] : y < 32 ? T += x(S, W, z) + k[1] : y < 48 ? T += s(S, W, z) + k[2] : y < 64 ? T += A(S, W, z) + k[3] : T += h(S, W, z) + k[4], T = T | 0, T = F(T, N[y]), T = T + X | 0, I = X, X = z, z = F(W, 10), W = S, S = T;
|
|
2688
|
+
T = D[1] + U + z | 0, D[1] = D[2] + _ + X | 0, D[2] = D[3] + P + I | 0, D[3] = D[4] + K + S | 0, D[4] = D[0] + q + W | 0, D[0] = T;
|
|
2684
2689
|
},
|
|
2685
2690
|
_doFinalize: function() {
|
|
2686
2691
|
var E = this._data, g = E.words, y = this._nDataBytes * 8, R = E.sigBytes * 8;
|
|
@@ -2702,10 +2707,10 @@ function lt() {
|
|
|
2702
2707
|
function A(E, g, y) {
|
|
2703
2708
|
return E & g | ~E & y;
|
|
2704
2709
|
}
|
|
2705
|
-
function
|
|
2710
|
+
function s(E, g, y) {
|
|
2706
2711
|
return (E | ~g) ^ y;
|
|
2707
2712
|
}
|
|
2708
|
-
function
|
|
2713
|
+
function x(E, g, y) {
|
|
2709
2714
|
return E & y | g & ~y;
|
|
2710
2715
|
}
|
|
2711
2716
|
function v(E, g, y) {
|
|
@@ -2714,20 +2719,20 @@ function lt() {
|
|
|
2714
2719
|
function F(E, g) {
|
|
2715
2720
|
return E << g | E >>> 32 - g;
|
|
2716
2721
|
}
|
|
2717
|
-
|
|
2718
|
-
})(),
|
|
2722
|
+
o.RIPEMD160 = u._createHelper(C), o.HmacRIPEMD160 = u._createHmacHelper(C);
|
|
2723
|
+
})(), t.RIPEMD160;
|
|
2719
2724
|
});
|
|
2720
2725
|
})(R0)), R0.exports;
|
|
2721
2726
|
}
|
|
2722
2727
|
var H0 = { exports: {} }, dt = H0.exports, Le;
|
|
2723
2728
|
function fe() {
|
|
2724
|
-
return Le || (Le = 1, (function(p,
|
|
2725
|
-
(function(
|
|
2729
|
+
return Le || (Le = 1, (function(p, r) {
|
|
2730
|
+
(function(t, e) {
|
|
2726
2731
|
p.exports = e(L());
|
|
2727
|
-
})(dt, function(
|
|
2732
|
+
})(dt, function(t) {
|
|
2728
2733
|
(function() {
|
|
2729
|
-
var e =
|
|
2730
|
-
f.HMAC =
|
|
2734
|
+
var e = t, o = e.lib, c = o.Base, b = e.enc, u = b.Utf8, f = e.algo;
|
|
2735
|
+
f.HMAC = c.extend({
|
|
2731
2736
|
/**
|
|
2732
2737
|
* Initializes a newly created HMAC.
|
|
2733
2738
|
*
|
|
@@ -2742,9 +2747,9 @@ function fe() {
|
|
|
2742
2747
|
a = this._hasher = new a.init(), typeof n == "string" && (n = u.parse(n));
|
|
2743
2748
|
var B = a.blockSize, i = B * 4;
|
|
2744
2749
|
n.sigBytes > i && (n = a.finalize(n)), n.clamp();
|
|
2745
|
-
for (var
|
|
2750
|
+
for (var l = this._oKey = n.clone(), d = this._iKey = n.clone(), C = l.words, h = d.words, A = 0; A < B; A++)
|
|
2746
2751
|
C[A] ^= 1549556828, h[A] ^= 909522486;
|
|
2747
|
-
|
|
2752
|
+
l.sigBytes = d.sigBytes = i, this.reset();
|
|
2748
2753
|
},
|
|
2749
2754
|
/**
|
|
2750
2755
|
* Resets this HMAC to its initial state.
|
|
@@ -2797,14 +2802,14 @@ function fe() {
|
|
|
2797
2802
|
});
|
|
2798
2803
|
})(H0)), H0.exports;
|
|
2799
2804
|
}
|
|
2800
|
-
var M0 = { exports: {} }, ft = M0.exports,
|
|
2805
|
+
var M0 = { exports: {} }, ft = M0.exports, Ke;
|
|
2801
2806
|
function ut() {
|
|
2802
|
-
return
|
|
2803
|
-
(function(
|
|
2807
|
+
return Ke || (Ke = 1, (function(p, r) {
|
|
2808
|
+
(function(t, e, o) {
|
|
2804
2809
|
p.exports = e(L(), de(), fe());
|
|
2805
|
-
})(ft, function(
|
|
2810
|
+
})(ft, function(t) {
|
|
2806
2811
|
return (function() {
|
|
2807
|
-
var e =
|
|
2812
|
+
var e = t, o = e.lib, c = o.Base, b = o.WordArray, u = e.algo, f = u.SHA256, a = u.HMAC, n = u.PBKDF2 = c.extend({
|
|
2808
2813
|
/**
|
|
2809
2814
|
* Configuration options.
|
|
2810
2815
|
*
|
|
@@ -2812,7 +2817,7 @@ function ut() {
|
|
|
2812
2817
|
* @property {Hasher} hasher The hasher to use. Default: SHA256
|
|
2813
2818
|
* @property {number} iterations The number of iterations to perform. Default: 250000
|
|
2814
2819
|
*/
|
|
2815
|
-
cfg:
|
|
2820
|
+
cfg: c.extend({
|
|
2816
2821
|
keySize: 128 / 32,
|
|
2817
2822
|
hasher: f,
|
|
2818
2823
|
iterations: 25e4
|
|
@@ -2844,34 +2849,34 @@ function ut() {
|
|
|
2844
2849
|
* var key = kdf.compute(password, salt);
|
|
2845
2850
|
*/
|
|
2846
2851
|
compute: function(B, i) {
|
|
2847
|
-
for (var
|
|
2848
|
-
var F =
|
|
2849
|
-
|
|
2852
|
+
for (var l = this.cfg, d = a.create(l.hasher, B), C = b.create(), h = b.create([1]), A = C.words, s = h.words, x = l.keySize, v = l.iterations; A.length < x; ) {
|
|
2853
|
+
var F = d.update(i).finalize(h);
|
|
2854
|
+
d.reset();
|
|
2850
2855
|
for (var E = F.words, g = E.length, y = F, R = 1; R < v; R++) {
|
|
2851
|
-
y =
|
|
2856
|
+
y = d.finalize(y), d.reset();
|
|
2852
2857
|
for (var m = y.words, D = 0; D < g; D++)
|
|
2853
2858
|
E[D] ^= m[D];
|
|
2854
2859
|
}
|
|
2855
|
-
C.concat(F),
|
|
2860
|
+
C.concat(F), s[0]++;
|
|
2856
2861
|
}
|
|
2857
|
-
return C.sigBytes =
|
|
2862
|
+
return C.sigBytes = x * 4, C;
|
|
2858
2863
|
}
|
|
2859
2864
|
});
|
|
2860
|
-
e.PBKDF2 = function(B, i,
|
|
2861
|
-
return n.create(
|
|
2865
|
+
e.PBKDF2 = function(B, i, l) {
|
|
2866
|
+
return n.create(l).compute(B, i);
|
|
2862
2867
|
};
|
|
2863
|
-
})(),
|
|
2868
|
+
})(), t.PBKDF2;
|
|
2864
2869
|
});
|
|
2865
2870
|
})(M0)), M0.exports;
|
|
2866
2871
|
}
|
|
2867
|
-
var O0 = { exports: {} }, ht = O0.exports,
|
|
2872
|
+
var O0 = { exports: {} }, ht = O0.exports, Ue;
|
|
2868
2873
|
function a0() {
|
|
2869
|
-
return
|
|
2870
|
-
(function(
|
|
2874
|
+
return Ue || (Ue = 1, (function(p, r) {
|
|
2875
|
+
(function(t, e, o) {
|
|
2871
2876
|
p.exports = e(L(), lr(), fe());
|
|
2872
|
-
})(ht, function(
|
|
2877
|
+
})(ht, function(t) {
|
|
2873
2878
|
return (function() {
|
|
2874
|
-
var e =
|
|
2879
|
+
var e = t, o = e.lib, c = o.Base, b = o.WordArray, u = e.algo, f = u.MD5, a = u.EvpKDF = c.extend({
|
|
2875
2880
|
/**
|
|
2876
2881
|
* Configuration options.
|
|
2877
2882
|
*
|
|
@@ -2879,7 +2884,7 @@ function a0() {
|
|
|
2879
2884
|
* @property {Hasher} hasher The hash algorithm to use. Default: MD5
|
|
2880
2885
|
* @property {number} iterations The number of iterations to perform. Default: 1
|
|
2881
2886
|
*/
|
|
2882
|
-
cfg:
|
|
2887
|
+
cfg: c.extend({
|
|
2883
2888
|
keySize: 128 / 32,
|
|
2884
2889
|
hasher: f,
|
|
2885
2890
|
iterations: 1
|
|
@@ -2911,10 +2916,10 @@ function a0() {
|
|
|
2911
2916
|
* var key = kdf.compute(password, salt);
|
|
2912
2917
|
*/
|
|
2913
2918
|
compute: function(n, B) {
|
|
2914
|
-
for (var i,
|
|
2915
|
-
i &&
|
|
2916
|
-
for (var
|
|
2917
|
-
i =
|
|
2919
|
+
for (var i, l = this.cfg, d = l.hasher.create(), C = b.create(), h = C.words, A = l.keySize, s = l.iterations; h.length < A; ) {
|
|
2920
|
+
i && d.update(i), i = d.update(n).finalize(B), d.reset();
|
|
2921
|
+
for (var x = 1; x < s; x++)
|
|
2922
|
+
i = d.finalize(i), d.reset();
|
|
2918
2923
|
C.concat(i);
|
|
2919
2924
|
}
|
|
2920
2925
|
return C.sigBytes = A * 4, C;
|
|
@@ -2923,20 +2928,20 @@ function a0() {
|
|
|
2923
2928
|
e.EvpKDF = function(n, B, i) {
|
|
2924
2929
|
return a.create(i).compute(n, B);
|
|
2925
2930
|
};
|
|
2926
|
-
})(),
|
|
2931
|
+
})(), t.EvpKDF;
|
|
2927
2932
|
});
|
|
2928
2933
|
})(O0)), O0.exports;
|
|
2929
2934
|
}
|
|
2930
|
-
var $0 = { exports: {} }, vt = $0.exports,
|
|
2935
|
+
var $0 = { exports: {} }, vt = $0.exports, qe;
|
|
2931
2936
|
function Q() {
|
|
2932
|
-
return
|
|
2933
|
-
(function(
|
|
2937
|
+
return qe || (qe = 1, (function(p, r) {
|
|
2938
|
+
(function(t, e, o) {
|
|
2934
2939
|
p.exports = e(L(), a0());
|
|
2935
|
-
})(vt, function(
|
|
2936
|
-
|
|
2937
|
-
var
|
|
2940
|
+
})(vt, function(t) {
|
|
2941
|
+
t.lib.Cipher || (function(e) {
|
|
2942
|
+
var o = t, c = o.lib, b = c.Base, u = c.WordArray, f = c.BufferedBlockAlgorithm, a = o.enc;
|
|
2938
2943
|
a.Utf8;
|
|
2939
|
-
var n = a.Base64, B =
|
|
2944
|
+
var n = a.Base64, B = o.algo, i = B.EvpKDF, l = c.Cipher = f.extend({
|
|
2940
2945
|
/**
|
|
2941
2946
|
* Configuration options.
|
|
2942
2947
|
*
|
|
@@ -3068,14 +3073,14 @@ function Q() {
|
|
|
3068
3073
|
};
|
|
3069
3074
|
})()
|
|
3070
3075
|
});
|
|
3071
|
-
|
|
3076
|
+
c.StreamCipher = l.extend({
|
|
3072
3077
|
_doFinalize: function() {
|
|
3073
3078
|
var m = this._process(!0);
|
|
3074
3079
|
return m;
|
|
3075
3080
|
},
|
|
3076
3081
|
blockSize: 1
|
|
3077
3082
|
});
|
|
3078
|
-
var
|
|
3083
|
+
var d = o.mode = {}, C = c.BlockCipherMode = b.extend({
|
|
3079
3084
|
/**
|
|
3080
3085
|
* Creates this mode for encryption.
|
|
3081
3086
|
*
|
|
@@ -3119,7 +3124,7 @@ function Q() {
|
|
|
3119
3124
|
init: function(m, D) {
|
|
3120
3125
|
this._cipher = m, this._iv = D;
|
|
3121
3126
|
}
|
|
3122
|
-
}), h =
|
|
3127
|
+
}), h = d.CBC = (function() {
|
|
3123
3128
|
var m = C.extend();
|
|
3124
3129
|
m.Encryptor = m.extend({
|
|
3125
3130
|
/**
|
|
@@ -3159,7 +3164,7 @@ function Q() {
|
|
|
3159
3164
|
w[k + N] ^= O[N];
|
|
3160
3165
|
}
|
|
3161
3166
|
return m;
|
|
3162
|
-
})(), A =
|
|
3167
|
+
})(), A = o.pad = {}, s = A.Pkcs7 = {
|
|
3163
3168
|
/**
|
|
3164
3169
|
* Pads data using the algorithm defined in PKCS #5/7.
|
|
3165
3170
|
*
|
|
@@ -3194,20 +3199,20 @@ function Q() {
|
|
|
3194
3199
|
m.sigBytes -= D;
|
|
3195
3200
|
}
|
|
3196
3201
|
};
|
|
3197
|
-
|
|
3202
|
+
c.BlockCipher = l.extend({
|
|
3198
3203
|
/**
|
|
3199
3204
|
* Configuration options.
|
|
3200
3205
|
*
|
|
3201
3206
|
* @property {Mode} mode The block mode to use. Default: CBC
|
|
3202
3207
|
* @property {Padding} padding The padding strategy to use. Default: Pkcs7
|
|
3203
3208
|
*/
|
|
3204
|
-
cfg:
|
|
3209
|
+
cfg: l.cfg.extend({
|
|
3205
3210
|
mode: h,
|
|
3206
|
-
padding:
|
|
3211
|
+
padding: s
|
|
3207
3212
|
}),
|
|
3208
3213
|
reset: function() {
|
|
3209
3214
|
var m;
|
|
3210
|
-
|
|
3215
|
+
l.reset.call(this);
|
|
3211
3216
|
var D = this.cfg, w = D.iv, k = D.mode;
|
|
3212
3217
|
this._xformMode == this._ENC_XFORM_MODE ? m = k.createEncryptor : (m = k.createDecryptor, this._minBufferSize = 1), this._mode && this._mode.__creator == m ? this._mode.init(this, w && w.words) : (this._mode = m.call(k, this, w && w.words), this._mode.__creator = m);
|
|
3213
3218
|
},
|
|
@@ -3220,7 +3225,7 @@ function Q() {
|
|
|
3220
3225
|
},
|
|
3221
3226
|
blockSize: 128 / 32
|
|
3222
3227
|
});
|
|
3223
|
-
var
|
|
3228
|
+
var x = c.CipherParams = b.extend({
|
|
3224
3229
|
/**
|
|
3225
3230
|
* Initializes a newly created cipher params object.
|
|
3226
3231
|
*
|
|
@@ -3261,7 +3266,7 @@ function Q() {
|
|
|
3261
3266
|
toString: function(m) {
|
|
3262
3267
|
return (m || this.formatter).stringify(this);
|
|
3263
3268
|
}
|
|
3264
|
-
}), v =
|
|
3269
|
+
}), v = o.format = {}, F = v.OpenSSL = {
|
|
3265
3270
|
/**
|
|
3266
3271
|
* Converts a cipher params object to an OpenSSL-compatible string.
|
|
3267
3272
|
*
|
|
@@ -3294,9 +3299,9 @@ function Q() {
|
|
|
3294
3299
|
*/
|
|
3295
3300
|
parse: function(m) {
|
|
3296
3301
|
var D, w = n.parse(m), k = w.words;
|
|
3297
|
-
return k[0] == 1398893684 && k[1] == 1701076831 && (D = u.create(k.slice(2, 4)), k.splice(0, 4), w.sigBytes -= 16),
|
|
3302
|
+
return k[0] == 1398893684 && k[1] == 1701076831 && (D = u.create(k.slice(2, 4)), k.splice(0, 4), w.sigBytes -= 16), x.create({ ciphertext: w, salt: D });
|
|
3298
3303
|
}
|
|
3299
|
-
}, E =
|
|
3304
|
+
}, E = c.SerializableCipher = b.extend({
|
|
3300
3305
|
/**
|
|
3301
3306
|
* Configuration options.
|
|
3302
3307
|
*
|
|
@@ -3326,7 +3331,7 @@ function Q() {
|
|
|
3326
3331
|
encrypt: function(m, D, w, k) {
|
|
3327
3332
|
k = this.cfg.extend(k);
|
|
3328
3333
|
var M = m.createEncryptor(w, k), O = M.finalize(D), $ = M.cfg;
|
|
3329
|
-
return
|
|
3334
|
+
return x.create({
|
|
3330
3335
|
ciphertext: O,
|
|
3331
3336
|
key: w,
|
|
3332
3337
|
iv: $.iv,
|
|
@@ -3377,7 +3382,7 @@ function Q() {
|
|
|
3377
3382
|
_parse: function(m, D) {
|
|
3378
3383
|
return typeof m == "string" ? D.parse(m, this) : m;
|
|
3379
3384
|
}
|
|
3380
|
-
}), g =
|
|
3385
|
+
}), g = o.kdf = {}, y = g.OpenSSL = {
|
|
3381
3386
|
/**
|
|
3382
3387
|
* Derives a key and IV from a password.
|
|
3383
3388
|
*
|
|
@@ -3401,9 +3406,9 @@ function Q() {
|
|
|
3401
3406
|
else
|
|
3402
3407
|
var O = i.create({ keySize: D + w }).compute(m, k);
|
|
3403
3408
|
var $ = u.create(O.words.slice(D), w * 4);
|
|
3404
|
-
return O.sigBytes = D * 4,
|
|
3409
|
+
return O.sigBytes = D * 4, x.create({ key: O, iv: $, salt: k });
|
|
3405
3410
|
}
|
|
3406
|
-
}, R =
|
|
3411
|
+
}, R = c.PasswordBasedCipher = E.extend({
|
|
3407
3412
|
/**
|
|
3408
3413
|
* Configuration options.
|
|
3409
3414
|
*
|
|
@@ -3465,72 +3470,72 @@ function Q() {
|
|
|
3465
3470
|
});
|
|
3466
3471
|
})($0)), $0.exports;
|
|
3467
3472
|
}
|
|
3468
|
-
var T0 = { exports: {} }, pt = T0.exports,
|
|
3473
|
+
var T0 = { exports: {} }, pt = T0.exports, ze;
|
|
3469
3474
|
function Ct() {
|
|
3470
|
-
return
|
|
3471
|
-
(function(
|
|
3475
|
+
return ze || (ze = 1, (function(p, r) {
|
|
3476
|
+
(function(t, e, o) {
|
|
3472
3477
|
p.exports = e(L(), Q());
|
|
3473
|
-
})(pt, function(
|
|
3474
|
-
return
|
|
3475
|
-
var e =
|
|
3478
|
+
})(pt, function(t) {
|
|
3479
|
+
return t.mode.CFB = (function() {
|
|
3480
|
+
var e = t.lib.BlockCipherMode.extend();
|
|
3476
3481
|
e.Encryptor = e.extend({
|
|
3477
|
-
processBlock: function(
|
|
3482
|
+
processBlock: function(c, b) {
|
|
3478
3483
|
var u = this._cipher, f = u.blockSize;
|
|
3479
|
-
|
|
3484
|
+
o.call(this, c, b, f, u), this._prevBlock = c.slice(b, b + f);
|
|
3480
3485
|
}
|
|
3481
3486
|
}), e.Decryptor = e.extend({
|
|
3482
|
-
processBlock: function(
|
|
3483
|
-
var u = this._cipher, f = u.blockSize, a =
|
|
3484
|
-
|
|
3487
|
+
processBlock: function(c, b) {
|
|
3488
|
+
var u = this._cipher, f = u.blockSize, a = c.slice(b, b + f);
|
|
3489
|
+
o.call(this, c, b, f, u), this._prevBlock = a;
|
|
3485
3490
|
}
|
|
3486
3491
|
});
|
|
3487
|
-
function
|
|
3492
|
+
function o(c, b, u, f) {
|
|
3488
3493
|
var a, n = this._iv;
|
|
3489
3494
|
n ? (a = n.slice(0), this._iv = void 0) : a = this._prevBlock, f.encryptBlock(a, 0);
|
|
3490
3495
|
for (var B = 0; B < u; B++)
|
|
3491
|
-
|
|
3496
|
+
c[b + B] ^= a[B];
|
|
3492
3497
|
}
|
|
3493
3498
|
return e;
|
|
3494
|
-
})(),
|
|
3499
|
+
})(), t.mode.CFB;
|
|
3495
3500
|
});
|
|
3496
3501
|
})(T0)), T0.exports;
|
|
3497
3502
|
}
|
|
3498
3503
|
var L0 = { exports: {} }, Bt = L0.exports, Ne;
|
|
3499
3504
|
function mt() {
|
|
3500
|
-
return Ne || (Ne = 1, (function(p,
|
|
3501
|
-
(function(
|
|
3505
|
+
return Ne || (Ne = 1, (function(p, r) {
|
|
3506
|
+
(function(t, e, o) {
|
|
3502
3507
|
p.exports = e(L(), Q());
|
|
3503
|
-
})(Bt, function(
|
|
3504
|
-
return
|
|
3505
|
-
var e =
|
|
3506
|
-
processBlock: function(
|
|
3508
|
+
})(Bt, function(t) {
|
|
3509
|
+
return t.mode.CTR = (function() {
|
|
3510
|
+
var e = t.lib.BlockCipherMode.extend(), o = e.Encryptor = e.extend({
|
|
3511
|
+
processBlock: function(c, b) {
|
|
3507
3512
|
var u = this._cipher, f = u.blockSize, a = this._iv, n = this._counter;
|
|
3508
3513
|
a && (n = this._counter = a.slice(0), this._iv = void 0);
|
|
3509
3514
|
var B = n.slice(0);
|
|
3510
3515
|
u.encryptBlock(B, 0), n[f - 1] = n[f - 1] + 1 | 0;
|
|
3511
3516
|
for (var i = 0; i < f; i++)
|
|
3512
|
-
|
|
3517
|
+
c[b + i] ^= B[i];
|
|
3513
3518
|
}
|
|
3514
3519
|
});
|
|
3515
|
-
return e.Decryptor =
|
|
3516
|
-
})(),
|
|
3520
|
+
return e.Decryptor = o, e;
|
|
3521
|
+
})(), t.mode.CTR;
|
|
3517
3522
|
});
|
|
3518
3523
|
})(L0)), L0.exports;
|
|
3519
3524
|
}
|
|
3520
|
-
var
|
|
3525
|
+
var K0 = { exports: {} }, At = K0.exports, We;
|
|
3521
3526
|
function Et() {
|
|
3522
|
-
return We || (We = 1, (function(p,
|
|
3523
|
-
(function(
|
|
3527
|
+
return We || (We = 1, (function(p, r) {
|
|
3528
|
+
(function(t, e, o) {
|
|
3524
3529
|
p.exports = e(L(), Q());
|
|
3525
|
-
})(At, function(
|
|
3530
|
+
})(At, function(t) {
|
|
3526
3531
|
/** @preserve
|
|
3527
3532
|
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
3528
3533
|
* derived from CryptoJS.mode.CTR
|
|
3529
3534
|
* Jan Hruby jhruby.web@gmail.com
|
|
3530
3535
|
*/
|
|
3531
|
-
return
|
|
3532
|
-
var e =
|
|
3533
|
-
function
|
|
3536
|
+
return t.mode.CTRGladman = (function() {
|
|
3537
|
+
var e = t.lib.BlockCipherMode.extend();
|
|
3538
|
+
function o(u) {
|
|
3534
3539
|
if ((u >> 24 & 255) === 255) {
|
|
3535
3540
|
var f = u >> 16 & 255, a = u >> 8 & 255, n = u & 255;
|
|
3536
3541
|
f === 255 ? (f = 0, a === 255 ? (a = 0, n === 255 ? n = 0 : ++n) : ++a) : ++f, u = 0, u += f << 16, u += a << 8, u += n;
|
|
@@ -3538,165 +3543,165 @@ function Et() {
|
|
|
3538
3543
|
u += 1 << 24;
|
|
3539
3544
|
return u;
|
|
3540
3545
|
}
|
|
3541
|
-
function
|
|
3542
|
-
return (u[0] =
|
|
3546
|
+
function c(u) {
|
|
3547
|
+
return (u[0] = o(u[0])) === 0 && (u[1] = o(u[1])), u;
|
|
3543
3548
|
}
|
|
3544
3549
|
var b = e.Encryptor = e.extend({
|
|
3545
3550
|
processBlock: function(u, f) {
|
|
3546
3551
|
var a = this._cipher, n = a.blockSize, B = this._iv, i = this._counter;
|
|
3547
|
-
B && (i = this._counter = B.slice(0), this._iv = void 0),
|
|
3548
|
-
var
|
|
3549
|
-
a.encryptBlock(
|
|
3550
|
-
for (var
|
|
3551
|
-
u[f +
|
|
3552
|
+
B && (i = this._counter = B.slice(0), this._iv = void 0), c(i);
|
|
3553
|
+
var l = i.slice(0);
|
|
3554
|
+
a.encryptBlock(l, 0);
|
|
3555
|
+
for (var d = 0; d < n; d++)
|
|
3556
|
+
u[f + d] ^= l[d];
|
|
3552
3557
|
}
|
|
3553
3558
|
});
|
|
3554
3559
|
return e.Decryptor = b, e;
|
|
3555
|
-
})(),
|
|
3560
|
+
})(), t.mode.CTRGladman;
|
|
3556
3561
|
});
|
|
3557
|
-
})(
|
|
3562
|
+
})(K0)), K0.exports;
|
|
3558
3563
|
}
|
|
3559
|
-
var
|
|
3564
|
+
var U0 = { exports: {} }, Ft = U0.exports, Ge;
|
|
3560
3565
|
function Dt() {
|
|
3561
|
-
return Ge || (Ge = 1, (function(p,
|
|
3562
|
-
(function(
|
|
3566
|
+
return Ge || (Ge = 1, (function(p, r) {
|
|
3567
|
+
(function(t, e, o) {
|
|
3563
3568
|
p.exports = e(L(), Q());
|
|
3564
|
-
})(Ft, function(
|
|
3565
|
-
return
|
|
3566
|
-
var e =
|
|
3567
|
-
processBlock: function(
|
|
3569
|
+
})(Ft, function(t) {
|
|
3570
|
+
return t.mode.OFB = (function() {
|
|
3571
|
+
var e = t.lib.BlockCipherMode.extend(), o = e.Encryptor = e.extend({
|
|
3572
|
+
processBlock: function(c, b) {
|
|
3568
3573
|
var u = this._cipher, f = u.blockSize, a = this._iv, n = this._keystream;
|
|
3569
3574
|
a && (n = this._keystream = a.slice(0), this._iv = void 0), u.encryptBlock(n, 0);
|
|
3570
3575
|
for (var B = 0; B < f; B++)
|
|
3571
|
-
|
|
3576
|
+
c[b + B] ^= n[B];
|
|
3572
3577
|
}
|
|
3573
3578
|
});
|
|
3574
|
-
return e.Decryptor =
|
|
3575
|
-
})(),
|
|
3579
|
+
return e.Decryptor = o, e;
|
|
3580
|
+
})(), t.mode.OFB;
|
|
3576
3581
|
});
|
|
3577
|
-
})(
|
|
3582
|
+
})(U0)), U0.exports;
|
|
3578
3583
|
}
|
|
3579
|
-
var
|
|
3584
|
+
var q0 = { exports: {} }, gt = q0.exports, Qe;
|
|
3580
3585
|
function bt() {
|
|
3581
|
-
return Qe || (Qe = 1, (function(p,
|
|
3582
|
-
(function(
|
|
3586
|
+
return Qe || (Qe = 1, (function(p, r) {
|
|
3587
|
+
(function(t, e, o) {
|
|
3583
3588
|
p.exports = e(L(), Q());
|
|
3584
|
-
})(gt, function(
|
|
3585
|
-
return
|
|
3586
|
-
var e =
|
|
3589
|
+
})(gt, function(t) {
|
|
3590
|
+
return t.mode.ECB = (function() {
|
|
3591
|
+
var e = t.lib.BlockCipherMode.extend();
|
|
3587
3592
|
return e.Encryptor = e.extend({
|
|
3588
|
-
processBlock: function(
|
|
3589
|
-
this._cipher.encryptBlock(
|
|
3593
|
+
processBlock: function(o, c) {
|
|
3594
|
+
this._cipher.encryptBlock(o, c);
|
|
3590
3595
|
}
|
|
3591
3596
|
}), e.Decryptor = e.extend({
|
|
3592
|
-
processBlock: function(
|
|
3593
|
-
this._cipher.decryptBlock(
|
|
3597
|
+
processBlock: function(o, c) {
|
|
3598
|
+
this._cipher.decryptBlock(o, c);
|
|
3594
3599
|
}
|
|
3595
3600
|
}), e;
|
|
3596
|
-
})(),
|
|
3601
|
+
})(), t.mode.ECB;
|
|
3597
3602
|
});
|
|
3598
|
-
})(
|
|
3603
|
+
})(q0)), q0.exports;
|
|
3599
3604
|
}
|
|
3600
|
-
var
|
|
3605
|
+
var z0 = { exports: {} }, yt = z0.exports, Xe;
|
|
3601
3606
|
function _t() {
|
|
3602
|
-
return Xe || (Xe = 1, (function(p,
|
|
3603
|
-
(function(
|
|
3607
|
+
return Xe || (Xe = 1, (function(p, r) {
|
|
3608
|
+
(function(t, e, o) {
|
|
3604
3609
|
p.exports = e(L(), Q());
|
|
3605
|
-
})(yt, function(
|
|
3606
|
-
return
|
|
3607
|
-
pad: function(e,
|
|
3608
|
-
var
|
|
3610
|
+
})(yt, function(t) {
|
|
3611
|
+
return t.pad.AnsiX923 = {
|
|
3612
|
+
pad: function(e, o) {
|
|
3613
|
+
var c = e.sigBytes, b = o * 4, u = b - c % b, f = c + u - 1;
|
|
3609
3614
|
e.clamp(), e.words[f >>> 2] |= u << 24 - f % 4 * 8, e.sigBytes += u;
|
|
3610
3615
|
},
|
|
3611
3616
|
unpad: function(e) {
|
|
3612
|
-
var
|
|
3613
|
-
e.sigBytes -=
|
|
3617
|
+
var o = e.words[e.sigBytes - 1 >>> 2] & 255;
|
|
3618
|
+
e.sigBytes -= o;
|
|
3614
3619
|
}
|
|
3615
|
-
},
|
|
3620
|
+
}, t.pad.Ansix923;
|
|
3616
3621
|
});
|
|
3617
|
-
})(
|
|
3622
|
+
})(z0)), z0.exports;
|
|
3618
3623
|
}
|
|
3619
3624
|
var N0 = { exports: {} }, wt = N0.exports, Ve;
|
|
3620
3625
|
function kt() {
|
|
3621
|
-
return Ve || (Ve = 1, (function(p,
|
|
3622
|
-
(function(
|
|
3626
|
+
return Ve || (Ve = 1, (function(p, r) {
|
|
3627
|
+
(function(t, e, o) {
|
|
3623
3628
|
p.exports = e(L(), Q());
|
|
3624
|
-
})(wt, function(
|
|
3625
|
-
return
|
|
3626
|
-
pad: function(e,
|
|
3627
|
-
var
|
|
3628
|
-
e.concat(
|
|
3629
|
+
})(wt, function(t) {
|
|
3630
|
+
return t.pad.Iso10126 = {
|
|
3631
|
+
pad: function(e, o) {
|
|
3632
|
+
var c = o * 4, b = c - e.sigBytes % c;
|
|
3633
|
+
e.concat(t.lib.WordArray.random(b - 1)).concat(t.lib.WordArray.create([b << 24], 1));
|
|
3629
3634
|
},
|
|
3630
3635
|
unpad: function(e) {
|
|
3631
|
-
var
|
|
3632
|
-
e.sigBytes -=
|
|
3636
|
+
var o = e.words[e.sigBytes - 1 >>> 2] & 255;
|
|
3637
|
+
e.sigBytes -= o;
|
|
3633
3638
|
}
|
|
3634
|
-
},
|
|
3639
|
+
}, t.pad.Iso10126;
|
|
3635
3640
|
});
|
|
3636
3641
|
})(N0)), N0.exports;
|
|
3637
3642
|
}
|
|
3638
3643
|
var W0 = { exports: {} }, St = W0.exports, je;
|
|
3639
3644
|
function Pt() {
|
|
3640
|
-
return je || (je = 1, (function(p,
|
|
3641
|
-
(function(
|
|
3645
|
+
return je || (je = 1, (function(p, r) {
|
|
3646
|
+
(function(t, e, o) {
|
|
3642
3647
|
p.exports = e(L(), Q());
|
|
3643
|
-
})(St, function(
|
|
3644
|
-
return
|
|
3645
|
-
pad: function(e,
|
|
3646
|
-
e.concat(
|
|
3648
|
+
})(St, function(t) {
|
|
3649
|
+
return t.pad.Iso97971 = {
|
|
3650
|
+
pad: function(e, o) {
|
|
3651
|
+
e.concat(t.lib.WordArray.create([2147483648], 1)), t.pad.ZeroPadding.pad(e, o);
|
|
3647
3652
|
},
|
|
3648
3653
|
unpad: function(e) {
|
|
3649
|
-
|
|
3654
|
+
t.pad.ZeroPadding.unpad(e), e.sigBytes--;
|
|
3650
3655
|
}
|
|
3651
|
-
},
|
|
3656
|
+
}, t.pad.Iso97971;
|
|
3652
3657
|
});
|
|
3653
3658
|
})(W0)), W0.exports;
|
|
3654
3659
|
}
|
|
3655
3660
|
var G0 = { exports: {} }, It = G0.exports, Ze;
|
|
3656
3661
|
function Rt() {
|
|
3657
|
-
return Ze || (Ze = 1, (function(p,
|
|
3658
|
-
(function(
|
|
3662
|
+
return Ze || (Ze = 1, (function(p, r) {
|
|
3663
|
+
(function(t, e, o) {
|
|
3659
3664
|
p.exports = e(L(), Q());
|
|
3660
|
-
})(It, function(
|
|
3661
|
-
return
|
|
3662
|
-
pad: function(e,
|
|
3663
|
-
var
|
|
3664
|
-
e.clamp(), e.sigBytes +=
|
|
3665
|
+
})(It, function(t) {
|
|
3666
|
+
return t.pad.ZeroPadding = {
|
|
3667
|
+
pad: function(e, o) {
|
|
3668
|
+
var c = o * 4;
|
|
3669
|
+
e.clamp(), e.sigBytes += c - (e.sigBytes % c || c);
|
|
3665
3670
|
},
|
|
3666
3671
|
unpad: function(e) {
|
|
3667
|
-
for (var
|
|
3668
|
-
if (
|
|
3669
|
-
e.sigBytes =
|
|
3672
|
+
for (var o = e.words, c = e.sigBytes - 1, c = e.sigBytes - 1; c >= 0; c--)
|
|
3673
|
+
if (o[c >>> 2] >>> 24 - c % 4 * 8 & 255) {
|
|
3674
|
+
e.sigBytes = c + 1;
|
|
3670
3675
|
break;
|
|
3671
3676
|
}
|
|
3672
3677
|
}
|
|
3673
|
-
},
|
|
3678
|
+
}, t.pad.ZeroPadding;
|
|
3674
3679
|
});
|
|
3675
3680
|
})(G0)), G0.exports;
|
|
3676
3681
|
}
|
|
3677
3682
|
var Q0 = { exports: {} }, Ht = Q0.exports, Ye;
|
|
3678
3683
|
function Mt() {
|
|
3679
|
-
return Ye || (Ye = 1, (function(p,
|
|
3680
|
-
(function(
|
|
3684
|
+
return Ye || (Ye = 1, (function(p, r) {
|
|
3685
|
+
(function(t, e, o) {
|
|
3681
3686
|
p.exports = e(L(), Q());
|
|
3682
|
-
})(Ht, function(
|
|
3683
|
-
return
|
|
3687
|
+
})(Ht, function(t) {
|
|
3688
|
+
return t.pad.NoPadding = {
|
|
3684
3689
|
pad: function() {
|
|
3685
3690
|
},
|
|
3686
3691
|
unpad: function() {
|
|
3687
3692
|
}
|
|
3688
|
-
},
|
|
3693
|
+
}, t.pad.NoPadding;
|
|
3689
3694
|
});
|
|
3690
3695
|
})(Q0)), Q0.exports;
|
|
3691
3696
|
}
|
|
3692
3697
|
var X0 = { exports: {} }, Ot = X0.exports, Je;
|
|
3693
3698
|
function $t() {
|
|
3694
|
-
return Je || (Je = 1, (function(p,
|
|
3695
|
-
(function(
|
|
3699
|
+
return Je || (Je = 1, (function(p, r) {
|
|
3700
|
+
(function(t, e, o) {
|
|
3696
3701
|
p.exports = e(L(), Q());
|
|
3697
|
-
})(Ot, function(
|
|
3702
|
+
})(Ot, function(t) {
|
|
3698
3703
|
return (function(e) {
|
|
3699
|
-
var
|
|
3704
|
+
var o = t, c = o.lib, b = c.CipherParams, u = o.enc, f = u.Hex, a = o.format;
|
|
3700
3705
|
a.Hex = {
|
|
3701
3706
|
/**
|
|
3702
3707
|
* Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
|
|
@@ -3732,78 +3737,78 @@ function $t() {
|
|
|
3732
3737
|
return b.create({ ciphertext: B });
|
|
3733
3738
|
}
|
|
3734
3739
|
};
|
|
3735
|
-
})(),
|
|
3740
|
+
})(), t.format.Hex;
|
|
3736
3741
|
});
|
|
3737
3742
|
})(X0)), X0.exports;
|
|
3738
3743
|
}
|
|
3739
3744
|
var V0 = { exports: {} }, Tt = V0.exports, er;
|
|
3740
3745
|
function Lt() {
|
|
3741
|
-
return er || (er = 1, (function(p,
|
|
3742
|
-
(function(
|
|
3746
|
+
return er || (er = 1, (function(p, r) {
|
|
3747
|
+
(function(t, e, o) {
|
|
3743
3748
|
p.exports = e(L(), n0(), i0(), a0(), Q());
|
|
3744
|
-
})(Tt, function(
|
|
3749
|
+
})(Tt, function(t) {
|
|
3745
3750
|
return (function() {
|
|
3746
|
-
var e =
|
|
3751
|
+
var e = t, o = e.lib, c = o.BlockCipher, b = e.algo, u = [], f = [], a = [], n = [], B = [], i = [], l = [], d = [], C = [], h = [];
|
|
3747
3752
|
(function() {
|
|
3748
|
-
for (var
|
|
3749
|
-
v < 128 ?
|
|
3753
|
+
for (var x = [], v = 0; v < 256; v++)
|
|
3754
|
+
v < 128 ? x[v] = v << 1 : x[v] = v << 1 ^ 283;
|
|
3750
3755
|
for (var F = 0, E = 0, v = 0; v < 256; v++) {
|
|
3751
3756
|
var g = E ^ E << 1 ^ E << 2 ^ E << 3 ^ E << 4;
|
|
3752
3757
|
g = g >>> 8 ^ g & 255 ^ 99, u[F] = g, f[g] = F;
|
|
3753
|
-
var y =
|
|
3758
|
+
var y = x[F], R = x[y], m = x[R], D = x[g] * 257 ^ g * 16843008;
|
|
3754
3759
|
a[F] = D << 24 | D >>> 8, n[F] = D << 16 | D >>> 16, B[F] = D << 8 | D >>> 24, i[F] = D;
|
|
3755
3760
|
var D = m * 16843009 ^ R * 65537 ^ y * 257 ^ F * 16843008;
|
|
3756
|
-
|
|
3761
|
+
l[g] = D << 24 | D >>> 8, d[g] = D << 16 | D >>> 16, C[g] = D << 8 | D >>> 24, h[g] = D, F ? (F = y ^ x[x[x[m ^ y]]], E ^= x[x[E]]) : F = E = 1;
|
|
3757
3762
|
}
|
|
3758
3763
|
})();
|
|
3759
|
-
var A = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54],
|
|
3764
|
+
var A = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], s = b.AES = c.extend({
|
|
3760
3765
|
_doReset: function() {
|
|
3761
|
-
var
|
|
3766
|
+
var x;
|
|
3762
3767
|
if (!(this._nRounds && this._keyPriorReset === this._key)) {
|
|
3763
3768
|
for (var v = this._keyPriorReset = this._key, F = v.words, E = v.sigBytes / 4, g = this._nRounds = E + 6, y = (g + 1) * 4, R = this._keySchedule = [], m = 0; m < y; m++)
|
|
3764
|
-
m < E ? R[m] = F[m] : (
|
|
3769
|
+
m < E ? R[m] = F[m] : (x = R[m - 1], m % E ? E > 6 && m % E == 4 && (x = u[x >>> 24] << 24 | u[x >>> 16 & 255] << 16 | u[x >>> 8 & 255] << 8 | u[x & 255]) : (x = x << 8 | x >>> 24, x = u[x >>> 24] << 24 | u[x >>> 16 & 255] << 16 | u[x >>> 8 & 255] << 8 | u[x & 255], x ^= A[m / E | 0] << 24), R[m] = R[m - E] ^ x);
|
|
3765
3770
|
for (var D = this._invKeySchedule = [], w = 0; w < y; w++) {
|
|
3766
3771
|
var m = y - w;
|
|
3767
3772
|
if (w % 4)
|
|
3768
|
-
var
|
|
3773
|
+
var x = R[m];
|
|
3769
3774
|
else
|
|
3770
|
-
var
|
|
3771
|
-
w < 4 || m <= 4 ? D[w] =
|
|
3775
|
+
var x = R[m - 4];
|
|
3776
|
+
w < 4 || m <= 4 ? D[w] = x : D[w] = l[u[x >>> 24]] ^ d[u[x >>> 16 & 255]] ^ C[u[x >>> 8 & 255]] ^ h[u[x & 255]];
|
|
3772
3777
|
}
|
|
3773
3778
|
}
|
|
3774
3779
|
},
|
|
3775
|
-
encryptBlock: function(
|
|
3776
|
-
this._doCryptBlock(
|
|
3780
|
+
encryptBlock: function(x, v) {
|
|
3781
|
+
this._doCryptBlock(x, v, this._keySchedule, a, n, B, i, u);
|
|
3777
3782
|
},
|
|
3778
|
-
decryptBlock: function(
|
|
3779
|
-
var F =
|
|
3780
|
-
|
|
3781
|
-
var F =
|
|
3782
|
-
|
|
3783
|
+
decryptBlock: function(x, v) {
|
|
3784
|
+
var F = x[v + 1];
|
|
3785
|
+
x[v + 1] = x[v + 3], x[v + 3] = F, this._doCryptBlock(x, v, this._invKeySchedule, l, d, C, h, f);
|
|
3786
|
+
var F = x[v + 1];
|
|
3787
|
+
x[v + 1] = x[v + 3], x[v + 3] = F;
|
|
3783
3788
|
},
|
|
3784
|
-
_doCryptBlock: function(
|
|
3785
|
-
for (var D = this._nRounds, w =
|
|
3786
|
-
var
|
|
3787
|
-
w =
|
|
3789
|
+
_doCryptBlock: function(x, v, F, E, g, y, R, m) {
|
|
3790
|
+
for (var D = this._nRounds, w = x[v] ^ F[0], k = x[v + 1] ^ F[1], M = x[v + 2] ^ F[2], O = x[v + 3] ^ F[3], $ = 4, N = 1; N < D; N++) {
|
|
3791
|
+
var K = E[w >>> 24] ^ g[k >>> 16 & 255] ^ y[M >>> 8 & 255] ^ R[O & 255] ^ F[$++], q = E[k >>> 24] ^ g[M >>> 16 & 255] ^ y[O >>> 8 & 255] ^ R[w & 255] ^ F[$++], U = E[M >>> 24] ^ g[O >>> 16 & 255] ^ y[w >>> 8 & 255] ^ R[k & 255] ^ F[$++], _ = E[O >>> 24] ^ g[w >>> 16 & 255] ^ y[k >>> 8 & 255] ^ R[M & 255] ^ F[$++];
|
|
3792
|
+
w = K, k = q, M = U, O = _;
|
|
3788
3793
|
}
|
|
3789
|
-
var
|
|
3790
|
-
|
|
3794
|
+
var K = (m[w >>> 24] << 24 | m[k >>> 16 & 255] << 16 | m[M >>> 8 & 255] << 8 | m[O & 255]) ^ F[$++], q = (m[k >>> 24] << 24 | m[M >>> 16 & 255] << 16 | m[O >>> 8 & 255] << 8 | m[w & 255]) ^ F[$++], U = (m[M >>> 24] << 24 | m[O >>> 16 & 255] << 16 | m[w >>> 8 & 255] << 8 | m[k & 255]) ^ F[$++], _ = (m[O >>> 24] << 24 | m[w >>> 16 & 255] << 16 | m[k >>> 8 & 255] << 8 | m[M & 255]) ^ F[$++];
|
|
3795
|
+
x[v] = K, x[v + 1] = q, x[v + 2] = U, x[v + 3] = _;
|
|
3791
3796
|
},
|
|
3792
3797
|
keySize: 256 / 32
|
|
3793
3798
|
});
|
|
3794
|
-
e.AES =
|
|
3795
|
-
})(),
|
|
3799
|
+
e.AES = c._createHelper(s);
|
|
3800
|
+
})(), t.AES;
|
|
3796
3801
|
});
|
|
3797
3802
|
})(V0)), V0.exports;
|
|
3798
3803
|
}
|
|
3799
|
-
var j0 = { exports: {} },
|
|
3800
|
-
function
|
|
3801
|
-
return rr || (rr = 1, (function(p,
|
|
3802
|
-
(function(
|
|
3804
|
+
var j0 = { exports: {} }, Kt = j0.exports, rr;
|
|
3805
|
+
function Ut() {
|
|
3806
|
+
return rr || (rr = 1, (function(p, r) {
|
|
3807
|
+
(function(t, e, o) {
|
|
3803
3808
|
p.exports = e(L(), n0(), i0(), a0(), Q());
|
|
3804
|
-
})(
|
|
3809
|
+
})(Kt, function(t) {
|
|
3805
3810
|
return (function() {
|
|
3806
|
-
var e =
|
|
3811
|
+
var e = t, o = e.lib, c = o.WordArray, b = o.BlockCipher, u = e.algo, f = [
|
|
3807
3812
|
57,
|
|
3808
3813
|
49,
|
|
3809
3814
|
41,
|
|
@@ -4447,15 +4452,15 @@ function Kt() {
|
|
|
4447
4452
|
8064,
|
|
4448
4453
|
504,
|
|
4449
4454
|
2147483679
|
|
4450
|
-
],
|
|
4455
|
+
], l = u.DES = b.extend({
|
|
4451
4456
|
_doReset: function() {
|
|
4452
|
-
for (var A = this._key,
|
|
4457
|
+
for (var A = this._key, s = A.words, x = [], v = 0; v < 56; v++) {
|
|
4453
4458
|
var F = f[v] - 1;
|
|
4454
|
-
|
|
4459
|
+
x[v] = s[F >>> 5] >>> 31 - F % 32 & 1;
|
|
4455
4460
|
}
|
|
4456
4461
|
for (var E = this._subKeys = [], g = 0; g < 16; g++) {
|
|
4457
4462
|
for (var y = E[g] = [], R = n[g], v = 0; v < 24; v++)
|
|
4458
|
-
y[v / 6 | 0] |=
|
|
4463
|
+
y[v / 6 | 0] |= x[(a[v] - 1 + R) % 28] << 31 - v % 6, y[4 + (v / 6 | 0)] |= x[28 + (a[v + 24] - 1 + R) % 28] << 31 - v % 6;
|
|
4459
4464
|
y[0] = y[0] << 1 | y[0] >>> 31;
|
|
4460
4465
|
for (var v = 1; v < 7; v++)
|
|
4461
4466
|
y[v] = y[v] >>> (v - 1) * 4 + 3;
|
|
@@ -4464,74 +4469,74 @@ function Kt() {
|
|
|
4464
4469
|
for (var m = this._invSubKeys = [], v = 0; v < 16; v++)
|
|
4465
4470
|
m[v] = E[15 - v];
|
|
4466
4471
|
},
|
|
4467
|
-
encryptBlock: function(A,
|
|
4468
|
-
this._doCryptBlock(A,
|
|
4472
|
+
encryptBlock: function(A, s) {
|
|
4473
|
+
this._doCryptBlock(A, s, this._subKeys);
|
|
4469
4474
|
},
|
|
4470
|
-
decryptBlock: function(A,
|
|
4471
|
-
this._doCryptBlock(A,
|
|
4475
|
+
decryptBlock: function(A, s) {
|
|
4476
|
+
this._doCryptBlock(A, s, this._invSubKeys);
|
|
4472
4477
|
},
|
|
4473
|
-
_doCryptBlock: function(A,
|
|
4474
|
-
this._lBlock = A[
|
|
4478
|
+
_doCryptBlock: function(A, s, x) {
|
|
4479
|
+
this._lBlock = A[s], this._rBlock = A[s + 1], d.call(this, 4, 252645135), d.call(this, 16, 65535), C.call(this, 2, 858993459), C.call(this, 8, 16711935), d.call(this, 1, 1431655765);
|
|
4475
4480
|
for (var v = 0; v < 16; v++) {
|
|
4476
|
-
for (var F =
|
|
4481
|
+
for (var F = x[v], E = this._lBlock, g = this._rBlock, y = 0, R = 0; R < 8; R++)
|
|
4477
4482
|
y |= B[R][((g ^ F[R]) & i[R]) >>> 0];
|
|
4478
4483
|
this._lBlock = g, this._rBlock = E ^ y;
|
|
4479
4484
|
}
|
|
4480
4485
|
var m = this._lBlock;
|
|
4481
|
-
this._lBlock = this._rBlock, this._rBlock = m,
|
|
4486
|
+
this._lBlock = this._rBlock, this._rBlock = m, d.call(this, 1, 1431655765), C.call(this, 8, 16711935), C.call(this, 2, 858993459), d.call(this, 16, 65535), d.call(this, 4, 252645135), A[s] = this._lBlock, A[s + 1] = this._rBlock;
|
|
4482
4487
|
},
|
|
4483
4488
|
keySize: 64 / 32,
|
|
4484
4489
|
ivSize: 64 / 32,
|
|
4485
4490
|
blockSize: 64 / 32
|
|
4486
4491
|
});
|
|
4487
|
-
function
|
|
4488
|
-
var
|
|
4489
|
-
this._rBlock ^=
|
|
4492
|
+
function d(A, s) {
|
|
4493
|
+
var x = (this._lBlock >>> A ^ this._rBlock) & s;
|
|
4494
|
+
this._rBlock ^= x, this._lBlock ^= x << A;
|
|
4490
4495
|
}
|
|
4491
|
-
function C(A,
|
|
4492
|
-
var
|
|
4493
|
-
this._lBlock ^=
|
|
4496
|
+
function C(A, s) {
|
|
4497
|
+
var x = (this._rBlock >>> A ^ this._lBlock) & s;
|
|
4498
|
+
this._lBlock ^= x, this._rBlock ^= x << A;
|
|
4494
4499
|
}
|
|
4495
|
-
e.DES = b._createHelper(
|
|
4500
|
+
e.DES = b._createHelper(l);
|
|
4496
4501
|
var h = u.TripleDES = b.extend({
|
|
4497
4502
|
_doReset: function() {
|
|
4498
|
-
var A = this._key,
|
|
4499
|
-
if (
|
|
4503
|
+
var A = this._key, s = A.words;
|
|
4504
|
+
if (s.length !== 2 && s.length !== 4 && s.length < 6)
|
|
4500
4505
|
throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");
|
|
4501
|
-
var
|
|
4502
|
-
this._des1 =
|
|
4506
|
+
var x = s.slice(0, 2), v = s.length < 4 ? s.slice(0, 2) : s.slice(2, 4), F = s.length < 6 ? s.slice(0, 2) : s.slice(4, 6);
|
|
4507
|
+
this._des1 = l.createEncryptor(c.create(x)), this._des2 = l.createEncryptor(c.create(v)), this._des3 = l.createEncryptor(c.create(F));
|
|
4503
4508
|
},
|
|
4504
|
-
encryptBlock: function(A,
|
|
4505
|
-
this._des1.encryptBlock(A,
|
|
4509
|
+
encryptBlock: function(A, s) {
|
|
4510
|
+
this._des1.encryptBlock(A, s), this._des2.decryptBlock(A, s), this._des3.encryptBlock(A, s);
|
|
4506
4511
|
},
|
|
4507
|
-
decryptBlock: function(A,
|
|
4508
|
-
this._des3.decryptBlock(A,
|
|
4512
|
+
decryptBlock: function(A, s) {
|
|
4513
|
+
this._des3.decryptBlock(A, s), this._des2.encryptBlock(A, s), this._des1.decryptBlock(A, s);
|
|
4509
4514
|
},
|
|
4510
4515
|
keySize: 192 / 32,
|
|
4511
4516
|
ivSize: 64 / 32,
|
|
4512
4517
|
blockSize: 64 / 32
|
|
4513
4518
|
});
|
|
4514
4519
|
e.TripleDES = b._createHelper(h);
|
|
4515
|
-
})(),
|
|
4520
|
+
})(), t.TripleDES;
|
|
4516
4521
|
});
|
|
4517
4522
|
})(j0)), j0.exports;
|
|
4518
4523
|
}
|
|
4519
|
-
var Z0 = { exports: {} },
|
|
4520
|
-
function
|
|
4521
|
-
return tr || (tr = 1, (function(p,
|
|
4522
|
-
(function(
|
|
4524
|
+
var Z0 = { exports: {} }, qt = Z0.exports, tr;
|
|
4525
|
+
function zt() {
|
|
4526
|
+
return tr || (tr = 1, (function(p, r) {
|
|
4527
|
+
(function(t, e, o) {
|
|
4523
4528
|
p.exports = e(L(), n0(), i0(), a0(), Q());
|
|
4524
|
-
})(
|
|
4529
|
+
})(qt, function(t) {
|
|
4525
4530
|
return (function() {
|
|
4526
|
-
var e =
|
|
4531
|
+
var e = t, o = e.lib, c = o.StreamCipher, b = e.algo, u = b.RC4 = c.extend({
|
|
4527
4532
|
_doReset: function() {
|
|
4528
|
-
for (var n = this._key, B = n.words, i = n.sigBytes,
|
|
4529
|
-
|
|
4530
|
-
for (var
|
|
4531
|
-
var h =
|
|
4532
|
-
C = (C +
|
|
4533
|
-
var
|
|
4534
|
-
|
|
4533
|
+
for (var n = this._key, B = n.words, i = n.sigBytes, l = this._S = [], d = 0; d < 256; d++)
|
|
4534
|
+
l[d] = d;
|
|
4535
|
+
for (var d = 0, C = 0; d < 256; d++) {
|
|
4536
|
+
var h = d % i, A = B[h >>> 2] >>> 24 - h % 4 * 8 & 255;
|
|
4537
|
+
C = (C + l[d] + A) % 256;
|
|
4538
|
+
var s = l[d];
|
|
4539
|
+
l[d] = l[C], l[C] = s;
|
|
4535
4540
|
}
|
|
4536
4541
|
this._i = this._j = 0;
|
|
4537
4542
|
},
|
|
@@ -4542,14 +4547,14 @@ function Ut() {
|
|
|
4542
4547
|
ivSize: 0
|
|
4543
4548
|
});
|
|
4544
4549
|
function f() {
|
|
4545
|
-
for (var n = this._S, B = this._i, i = this._j,
|
|
4550
|
+
for (var n = this._S, B = this._i, i = this._j, l = 0, d = 0; d < 4; d++) {
|
|
4546
4551
|
B = (B + 1) % 256, i = (i + n[B]) % 256;
|
|
4547
4552
|
var C = n[B];
|
|
4548
|
-
n[B] = n[i], n[i] = C,
|
|
4553
|
+
n[B] = n[i], n[i] = C, l |= n[(n[B] + n[i]) % 256] << 24 - d * 8;
|
|
4549
4554
|
}
|
|
4550
|
-
return this._i = B, this._j = i,
|
|
4555
|
+
return this._i = B, this._j = i, l;
|
|
4551
4556
|
}
|
|
4552
|
-
e.RC4 =
|
|
4557
|
+
e.RC4 = c._createHelper(u);
|
|
4553
4558
|
var a = b.RC4Drop = u.extend({
|
|
4554
4559
|
/**
|
|
4555
4560
|
* Configuration options.
|
|
@@ -4565,22 +4570,22 @@ function Ut() {
|
|
|
4565
4570
|
f.call(this);
|
|
4566
4571
|
}
|
|
4567
4572
|
});
|
|
4568
|
-
e.RC4Drop =
|
|
4569
|
-
})(),
|
|
4573
|
+
e.RC4Drop = c._createHelper(a);
|
|
4574
|
+
})(), t.RC4;
|
|
4570
4575
|
});
|
|
4571
4576
|
})(Z0)), Z0.exports;
|
|
4572
4577
|
}
|
|
4573
4578
|
var Y0 = { exports: {} }, Nt = Y0.exports, ar;
|
|
4574
4579
|
function Wt() {
|
|
4575
|
-
return ar || (ar = 1, (function(p,
|
|
4576
|
-
(function(
|
|
4580
|
+
return ar || (ar = 1, (function(p, r) {
|
|
4581
|
+
(function(t, e, o) {
|
|
4577
4582
|
p.exports = e(L(), n0(), i0(), a0(), Q());
|
|
4578
|
-
})(Nt, function(
|
|
4583
|
+
})(Nt, function(t) {
|
|
4579
4584
|
return (function() {
|
|
4580
|
-
var e =
|
|
4585
|
+
var e = t, o = e.lib, c = o.StreamCipher, b = e.algo, u = [], f = [], a = [], n = b.Rabbit = c.extend({
|
|
4581
4586
|
_doReset: function() {
|
|
4582
|
-
for (var i = this._key.words,
|
|
4583
|
-
i[
|
|
4587
|
+
for (var i = this._key.words, l = this.cfg.iv, d = 0; d < 4; d++)
|
|
4588
|
+
i[d] = (i[d] << 8 | i[d] >>> 24) & 16711935 | (i[d] << 24 | i[d] >>> 8) & 4278255360;
|
|
4584
4589
|
var C = this._X = [
|
|
4585
4590
|
i[0],
|
|
4586
4591
|
i[3] << 16 | i[2] >>> 16,
|
|
@@ -4601,51 +4606,51 @@ function Wt() {
|
|
|
4601
4606
|
i[3] & 4294901760 | i[0] & 65535
|
|
4602
4607
|
];
|
|
4603
4608
|
this._b = 0;
|
|
4604
|
-
for (var
|
|
4609
|
+
for (var d = 0; d < 4; d++)
|
|
4605
4610
|
B.call(this);
|
|
4606
|
-
for (var
|
|
4607
|
-
h[
|
|
4608
|
-
if (
|
|
4609
|
-
var A =
|
|
4611
|
+
for (var d = 0; d < 8; d++)
|
|
4612
|
+
h[d] ^= C[d + 4 & 7];
|
|
4613
|
+
if (l) {
|
|
4614
|
+
var A = l.words, s = A[0], x = A[1], v = (s << 8 | s >>> 24) & 16711935 | (s << 24 | s >>> 8) & 4278255360, F = (x << 8 | x >>> 24) & 16711935 | (x << 24 | x >>> 8) & 4278255360, E = v >>> 16 | F & 4294901760, g = F << 16 | v & 65535;
|
|
4610
4615
|
h[0] ^= v, h[1] ^= E, h[2] ^= F, h[3] ^= g, h[4] ^= v, h[5] ^= E, h[6] ^= F, h[7] ^= g;
|
|
4611
|
-
for (var
|
|
4616
|
+
for (var d = 0; d < 4; d++)
|
|
4612
4617
|
B.call(this);
|
|
4613
4618
|
}
|
|
4614
4619
|
},
|
|
4615
|
-
_doProcessBlock: function(i,
|
|
4616
|
-
var
|
|
4617
|
-
B.call(this), u[0] =
|
|
4620
|
+
_doProcessBlock: function(i, l) {
|
|
4621
|
+
var d = this._X;
|
|
4622
|
+
B.call(this), u[0] = d[0] ^ d[5] >>> 16 ^ d[3] << 16, u[1] = d[2] ^ d[7] >>> 16 ^ d[5] << 16, u[2] = d[4] ^ d[1] >>> 16 ^ d[7] << 16, u[3] = d[6] ^ d[3] >>> 16 ^ d[1] << 16;
|
|
4618
4623
|
for (var C = 0; C < 4; C++)
|
|
4619
|
-
u[C] = (u[C] << 8 | u[C] >>> 24) & 16711935 | (u[C] << 24 | u[C] >>> 8) & 4278255360, i[
|
|
4624
|
+
u[C] = (u[C] << 8 | u[C] >>> 24) & 16711935 | (u[C] << 24 | u[C] >>> 8) & 4278255360, i[l + C] ^= u[C];
|
|
4620
4625
|
},
|
|
4621
4626
|
blockSize: 128 / 32,
|
|
4622
4627
|
ivSize: 64 / 32
|
|
4623
4628
|
});
|
|
4624
4629
|
function B() {
|
|
4625
|
-
for (var i = this._X,
|
|
4626
|
-
f[
|
|
4627
|
-
|
|
4628
|
-
for (var
|
|
4629
|
-
var C = i[
|
|
4630
|
-
a[
|
|
4630
|
+
for (var i = this._X, l = this._C, d = 0; d < 8; d++)
|
|
4631
|
+
f[d] = l[d];
|
|
4632
|
+
l[0] = l[0] + 1295307597 + this._b | 0, l[1] = l[1] + 3545052371 + (l[0] >>> 0 < f[0] >>> 0 ? 1 : 0) | 0, l[2] = l[2] + 886263092 + (l[1] >>> 0 < f[1] >>> 0 ? 1 : 0) | 0, l[3] = l[3] + 1295307597 + (l[2] >>> 0 < f[2] >>> 0 ? 1 : 0) | 0, l[4] = l[4] + 3545052371 + (l[3] >>> 0 < f[3] >>> 0 ? 1 : 0) | 0, l[5] = l[5] + 886263092 + (l[4] >>> 0 < f[4] >>> 0 ? 1 : 0) | 0, l[6] = l[6] + 1295307597 + (l[5] >>> 0 < f[5] >>> 0 ? 1 : 0) | 0, l[7] = l[7] + 3545052371 + (l[6] >>> 0 < f[6] >>> 0 ? 1 : 0) | 0, this._b = l[7] >>> 0 < f[7] >>> 0 ? 1 : 0;
|
|
4633
|
+
for (var d = 0; d < 8; d++) {
|
|
4634
|
+
var C = i[d] + l[d], h = C & 65535, A = C >>> 16, s = ((h * h >>> 17) + h * A >>> 15) + A * A, x = ((C & 4294901760) * C | 0) + ((C & 65535) * C | 0);
|
|
4635
|
+
a[d] = s ^ x;
|
|
4631
4636
|
}
|
|
4632
4637
|
i[0] = a[0] + (a[7] << 16 | a[7] >>> 16) + (a[6] << 16 | a[6] >>> 16) | 0, i[1] = a[1] + (a[0] << 8 | a[0] >>> 24) + a[7] | 0, i[2] = a[2] + (a[1] << 16 | a[1] >>> 16) + (a[0] << 16 | a[0] >>> 16) | 0, i[3] = a[3] + (a[2] << 8 | a[2] >>> 24) + a[1] | 0, i[4] = a[4] + (a[3] << 16 | a[3] >>> 16) + (a[2] << 16 | a[2] >>> 16) | 0, i[5] = a[5] + (a[4] << 8 | a[4] >>> 24) + a[3] | 0, i[6] = a[6] + (a[5] << 16 | a[5] >>> 16) + (a[4] << 16 | a[4] >>> 16) | 0, i[7] = a[7] + (a[6] << 8 | a[6] >>> 24) + a[5] | 0;
|
|
4633
4638
|
}
|
|
4634
|
-
e.Rabbit =
|
|
4635
|
-
})(),
|
|
4639
|
+
e.Rabbit = c._createHelper(n);
|
|
4640
|
+
})(), t.Rabbit;
|
|
4636
4641
|
});
|
|
4637
4642
|
})(Y0)), Y0.exports;
|
|
4638
4643
|
}
|
|
4639
4644
|
var J0 = { exports: {} }, Gt = J0.exports, nr;
|
|
4640
4645
|
function Qt() {
|
|
4641
|
-
return nr || (nr = 1, (function(p,
|
|
4642
|
-
(function(
|
|
4646
|
+
return nr || (nr = 1, (function(p, r) {
|
|
4647
|
+
(function(t, e, o) {
|
|
4643
4648
|
p.exports = e(L(), n0(), i0(), a0(), Q());
|
|
4644
|
-
})(Gt, function(
|
|
4649
|
+
})(Gt, function(t) {
|
|
4645
4650
|
return (function() {
|
|
4646
|
-
var e =
|
|
4651
|
+
var e = t, o = e.lib, c = o.StreamCipher, b = e.algo, u = [], f = [], a = [], n = b.RabbitLegacy = c.extend({
|
|
4647
4652
|
_doReset: function() {
|
|
4648
|
-
var i = this._key.words,
|
|
4653
|
+
var i = this._key.words, l = this.cfg.iv, d = this._X = [
|
|
4649
4654
|
i[0],
|
|
4650
4655
|
i[3] << 16 | i[2] >>> 16,
|
|
4651
4656
|
i[1],
|
|
@@ -4668,46 +4673,46 @@ function Qt() {
|
|
|
4668
4673
|
for (var h = 0; h < 4; h++)
|
|
4669
4674
|
B.call(this);
|
|
4670
4675
|
for (var h = 0; h < 8; h++)
|
|
4671
|
-
C[h] ^=
|
|
4672
|
-
if (
|
|
4673
|
-
var A =
|
|
4676
|
+
C[h] ^= d[h + 4 & 7];
|
|
4677
|
+
if (l) {
|
|
4678
|
+
var A = l.words, s = A[0], x = A[1], v = (s << 8 | s >>> 24) & 16711935 | (s << 24 | s >>> 8) & 4278255360, F = (x << 8 | x >>> 24) & 16711935 | (x << 24 | x >>> 8) & 4278255360, E = v >>> 16 | F & 4294901760, g = F << 16 | v & 65535;
|
|
4674
4679
|
C[0] ^= v, C[1] ^= E, C[2] ^= F, C[3] ^= g, C[4] ^= v, C[5] ^= E, C[6] ^= F, C[7] ^= g;
|
|
4675
4680
|
for (var h = 0; h < 4; h++)
|
|
4676
4681
|
B.call(this);
|
|
4677
4682
|
}
|
|
4678
4683
|
},
|
|
4679
|
-
_doProcessBlock: function(i,
|
|
4680
|
-
var
|
|
4681
|
-
B.call(this), u[0] =
|
|
4684
|
+
_doProcessBlock: function(i, l) {
|
|
4685
|
+
var d = this._X;
|
|
4686
|
+
B.call(this), u[0] = d[0] ^ d[5] >>> 16 ^ d[3] << 16, u[1] = d[2] ^ d[7] >>> 16 ^ d[5] << 16, u[2] = d[4] ^ d[1] >>> 16 ^ d[7] << 16, u[3] = d[6] ^ d[3] >>> 16 ^ d[1] << 16;
|
|
4682
4687
|
for (var C = 0; C < 4; C++)
|
|
4683
|
-
u[C] = (u[C] << 8 | u[C] >>> 24) & 16711935 | (u[C] << 24 | u[C] >>> 8) & 4278255360, i[
|
|
4688
|
+
u[C] = (u[C] << 8 | u[C] >>> 24) & 16711935 | (u[C] << 24 | u[C] >>> 8) & 4278255360, i[l + C] ^= u[C];
|
|
4684
4689
|
},
|
|
4685
4690
|
blockSize: 128 / 32,
|
|
4686
4691
|
ivSize: 64 / 32
|
|
4687
4692
|
});
|
|
4688
4693
|
function B() {
|
|
4689
|
-
for (var i = this._X,
|
|
4690
|
-
f[
|
|
4691
|
-
|
|
4692
|
-
for (var
|
|
4693
|
-
var C = i[
|
|
4694
|
-
a[
|
|
4694
|
+
for (var i = this._X, l = this._C, d = 0; d < 8; d++)
|
|
4695
|
+
f[d] = l[d];
|
|
4696
|
+
l[0] = l[0] + 1295307597 + this._b | 0, l[1] = l[1] + 3545052371 + (l[0] >>> 0 < f[0] >>> 0 ? 1 : 0) | 0, l[2] = l[2] + 886263092 + (l[1] >>> 0 < f[1] >>> 0 ? 1 : 0) | 0, l[3] = l[3] + 1295307597 + (l[2] >>> 0 < f[2] >>> 0 ? 1 : 0) | 0, l[4] = l[4] + 3545052371 + (l[3] >>> 0 < f[3] >>> 0 ? 1 : 0) | 0, l[5] = l[5] + 886263092 + (l[4] >>> 0 < f[4] >>> 0 ? 1 : 0) | 0, l[6] = l[6] + 1295307597 + (l[5] >>> 0 < f[5] >>> 0 ? 1 : 0) | 0, l[7] = l[7] + 3545052371 + (l[6] >>> 0 < f[6] >>> 0 ? 1 : 0) | 0, this._b = l[7] >>> 0 < f[7] >>> 0 ? 1 : 0;
|
|
4697
|
+
for (var d = 0; d < 8; d++) {
|
|
4698
|
+
var C = i[d] + l[d], h = C & 65535, A = C >>> 16, s = ((h * h >>> 17) + h * A >>> 15) + A * A, x = ((C & 4294901760) * C | 0) + ((C & 65535) * C | 0);
|
|
4699
|
+
a[d] = s ^ x;
|
|
4695
4700
|
}
|
|
4696
4701
|
i[0] = a[0] + (a[7] << 16 | a[7] >>> 16) + (a[6] << 16 | a[6] >>> 16) | 0, i[1] = a[1] + (a[0] << 8 | a[0] >>> 24) + a[7] | 0, i[2] = a[2] + (a[1] << 16 | a[1] >>> 16) + (a[0] << 16 | a[0] >>> 16) | 0, i[3] = a[3] + (a[2] << 8 | a[2] >>> 24) + a[1] | 0, i[4] = a[4] + (a[3] << 16 | a[3] >>> 16) + (a[2] << 16 | a[2] >>> 16) | 0, i[5] = a[5] + (a[4] << 8 | a[4] >>> 24) + a[3] | 0, i[6] = a[6] + (a[5] << 16 | a[5] >>> 16) + (a[4] << 16 | a[4] >>> 16) | 0, i[7] = a[7] + (a[6] << 8 | a[6] >>> 24) + a[5] | 0;
|
|
4697
4702
|
}
|
|
4698
|
-
e.RabbitLegacy =
|
|
4699
|
-
})(),
|
|
4703
|
+
e.RabbitLegacy = c._createHelper(n);
|
|
4704
|
+
})(), t.RabbitLegacy;
|
|
4700
4705
|
});
|
|
4701
4706
|
})(J0)), J0.exports;
|
|
4702
4707
|
}
|
|
4703
4708
|
var ee = { exports: {} }, Xt = ee.exports, ir;
|
|
4704
4709
|
function Vt() {
|
|
4705
|
-
return ir || (ir = 1, (function(p,
|
|
4706
|
-
(function(
|
|
4710
|
+
return ir || (ir = 1, (function(p, r) {
|
|
4711
|
+
(function(t, e, o) {
|
|
4707
4712
|
p.exports = e(L(), n0(), i0(), a0(), Q());
|
|
4708
|
-
})(Xt, function(
|
|
4713
|
+
})(Xt, function(t) {
|
|
4709
4714
|
return (function() {
|
|
4710
|
-
var e =
|
|
4715
|
+
var e = t, o = e.lib, c = o.BlockCipher, b = e.algo;
|
|
4711
4716
|
const u = 16, f = [
|
|
4712
4717
|
608135816,
|
|
4713
4718
|
2242054355,
|
|
@@ -5766,30 +5771,30 @@ function Vt() {
|
|
|
5766
5771
|
sbox: []
|
|
5767
5772
|
};
|
|
5768
5773
|
function B(h, A) {
|
|
5769
|
-
let
|
|
5774
|
+
let s = A >> 24 & 255, x = A >> 16 & 255, v = A >> 8 & 255, F = A & 255, E = h.sbox[0][s] + h.sbox[1][x];
|
|
5770
5775
|
return E = E ^ h.sbox[2][v], E = E + h.sbox[3][F], E;
|
|
5771
5776
|
}
|
|
5772
|
-
function i(h, A,
|
|
5773
|
-
let
|
|
5777
|
+
function i(h, A, s) {
|
|
5778
|
+
let x = A, v = s, F;
|
|
5774
5779
|
for (let E = 0; E < u; ++E)
|
|
5775
|
-
|
|
5776
|
-
return F =
|
|
5780
|
+
x = x ^ h.pbox[E], v = B(h, x) ^ v, F = x, x = v, v = F;
|
|
5781
|
+
return F = x, x = v, v = F, v = v ^ h.pbox[u], x = x ^ h.pbox[u + 1], { left: x, right: v };
|
|
5777
5782
|
}
|
|
5778
|
-
function
|
|
5779
|
-
let
|
|
5783
|
+
function l(h, A, s) {
|
|
5784
|
+
let x = A, v = s, F;
|
|
5780
5785
|
for (let E = u + 1; E > 1; --E)
|
|
5781
|
-
|
|
5782
|
-
return F =
|
|
5786
|
+
x = x ^ h.pbox[E], v = B(h, x) ^ v, F = x, x = v, v = F;
|
|
5787
|
+
return F = x, x = v, v = F, v = v ^ h.pbox[1], x = x ^ h.pbox[0], { left: x, right: v };
|
|
5783
5788
|
}
|
|
5784
|
-
function
|
|
5789
|
+
function d(h, A, s) {
|
|
5785
5790
|
for (let g = 0; g < 4; g++) {
|
|
5786
5791
|
h.sbox[g] = [];
|
|
5787
5792
|
for (let y = 0; y < 256; y++)
|
|
5788
5793
|
h.sbox[g][y] = a[g][y];
|
|
5789
5794
|
}
|
|
5790
|
-
let
|
|
5795
|
+
let x = 0;
|
|
5791
5796
|
for (let g = 0; g < u + 2; g++)
|
|
5792
|
-
h.pbox[g] = f[g] ^ A[
|
|
5797
|
+
h.pbox[g] = f[g] ^ A[x], x++, x >= s && (x = 0);
|
|
5793
5798
|
let v = 0, F = 0, E = 0;
|
|
5794
5799
|
for (let g = 0; g < u + 2; g += 2)
|
|
5795
5800
|
E = i(h, v, F), v = E.left, F = E.right, h.pbox[g] = v, h.pbox[g + 1] = F;
|
|
@@ -5798,52 +5803,52 @@ function Vt() {
|
|
|
5798
5803
|
E = i(h, v, F), v = E.left, F = E.right, h.sbox[g][y] = v, h.sbox[g][y + 1] = F;
|
|
5799
5804
|
return !0;
|
|
5800
5805
|
}
|
|
5801
|
-
var C = b.Blowfish =
|
|
5806
|
+
var C = b.Blowfish = c.extend({
|
|
5802
5807
|
_doReset: function() {
|
|
5803
5808
|
if (this._keyPriorReset !== this._key) {
|
|
5804
|
-
var h = this._keyPriorReset = this._key, A = h.words,
|
|
5805
|
-
|
|
5809
|
+
var h = this._keyPriorReset = this._key, A = h.words, s = h.sigBytes / 4;
|
|
5810
|
+
d(n, A, s);
|
|
5806
5811
|
}
|
|
5807
5812
|
},
|
|
5808
5813
|
encryptBlock: function(h, A) {
|
|
5809
|
-
var
|
|
5810
|
-
h[A] =
|
|
5814
|
+
var s = i(n, h[A], h[A + 1]);
|
|
5815
|
+
h[A] = s.left, h[A + 1] = s.right;
|
|
5811
5816
|
},
|
|
5812
5817
|
decryptBlock: function(h, A) {
|
|
5813
|
-
var
|
|
5814
|
-
h[A] =
|
|
5818
|
+
var s = l(n, h[A], h[A + 1]);
|
|
5819
|
+
h[A] = s.left, h[A + 1] = s.right;
|
|
5815
5820
|
},
|
|
5816
5821
|
blockSize: 64 / 32,
|
|
5817
5822
|
keySize: 128 / 32,
|
|
5818
5823
|
ivSize: 64 / 32
|
|
5819
5824
|
});
|
|
5820
|
-
e.Blowfish =
|
|
5821
|
-
})(),
|
|
5825
|
+
e.Blowfish = c._createHelper(C);
|
|
5826
|
+
})(), t.Blowfish;
|
|
5822
5827
|
});
|
|
5823
5828
|
})(ee)), ee.exports;
|
|
5824
5829
|
}
|
|
5825
|
-
var jt = m0.exports,
|
|
5830
|
+
var jt = m0.exports, sr;
|
|
5826
5831
|
function Zt() {
|
|
5827
|
-
return
|
|
5828
|
-
(function(
|
|
5829
|
-
p.exports = e(L(), ne(), Qr(), Vr(), n0(), Yr(), i0(), lr(), de(), at(), dr(),
|
|
5830
|
-
})(jt, function(
|
|
5831
|
-
return
|
|
5832
|
+
return sr || (sr = 1, (function(p, r) {
|
|
5833
|
+
(function(t, e, o) {
|
|
5834
|
+
p.exports = e(L(), ne(), Qr(), Vr(), n0(), Yr(), i0(), lr(), de(), at(), dr(), st(), xt(), lt(), fe(), ut(), a0(), Q(), Ct(), mt(), Et(), Dt(), bt(), _t(), kt(), Pt(), Rt(), Mt(), $t(), Lt(), Ut(), zt(), Wt(), Qt(), Vt());
|
|
5835
|
+
})(jt, function(t) {
|
|
5836
|
+
return t;
|
|
5832
5837
|
});
|
|
5833
5838
|
})(m0)), m0.exports;
|
|
5834
5839
|
}
|
|
5835
5840
|
var Yt = Zt();
|
|
5836
5841
|
const ce = /* @__PURE__ */ Tr(Yt), xe = "ai_provider_config", fr = "aiselector";
|
|
5837
|
-
function Jt(p,
|
|
5842
|
+
function Jt(p, r = fr) {
|
|
5838
5843
|
try {
|
|
5839
|
-
return ce.AES.encrypt(p,
|
|
5844
|
+
return ce.AES.encrypt(p, r).toString();
|
|
5840
5845
|
} catch {
|
|
5841
5846
|
return p;
|
|
5842
5847
|
}
|
|
5843
5848
|
}
|
|
5844
|
-
function ea(p,
|
|
5849
|
+
function ea(p, r = fr) {
|
|
5845
5850
|
try {
|
|
5846
|
-
return ce.AES.decrypt(p,
|
|
5851
|
+
return ce.AES.decrypt(p, r).toString(ce.enc.Utf8);
|
|
5847
5852
|
} catch {
|
|
5848
5853
|
return p;
|
|
5849
5854
|
}
|
|
@@ -5852,16 +5857,16 @@ const ra = {
|
|
|
5852
5857
|
get: (p) => {
|
|
5853
5858
|
if (typeof window > "u") return null;
|
|
5854
5859
|
try {
|
|
5855
|
-
const
|
|
5856
|
-
return
|
|
5860
|
+
const r = localStorage.getItem(p);
|
|
5861
|
+
return r ? ea(r) : null;
|
|
5857
5862
|
} catch {
|
|
5858
5863
|
return null;
|
|
5859
5864
|
}
|
|
5860
5865
|
},
|
|
5861
|
-
set: (p,
|
|
5866
|
+
set: (p, r) => {
|
|
5862
5867
|
if (!(typeof window > "u"))
|
|
5863
5868
|
try {
|
|
5864
|
-
localStorage.setItem(p, Jt(
|
|
5869
|
+
localStorage.setItem(p, Jt(r));
|
|
5865
5870
|
} catch {
|
|
5866
5871
|
}
|
|
5867
5872
|
},
|
|
@@ -5870,37 +5875,37 @@ const ra = {
|
|
|
5870
5875
|
}
|
|
5871
5876
|
}, ta = {
|
|
5872
5877
|
get: (p) => typeof window > "u" ? null : localStorage.getItem(p),
|
|
5873
|
-
set: (p,
|
|
5874
|
-
typeof window > "u" || localStorage.setItem(p,
|
|
5878
|
+
set: (p, r) => {
|
|
5879
|
+
typeof window > "u" || localStorage.setItem(p, r);
|
|
5875
5880
|
},
|
|
5876
5881
|
remove: (p) => {
|
|
5877
5882
|
typeof window > "u" || localStorage.removeItem(p);
|
|
5878
5883
|
}
|
|
5879
|
-
},
|
|
5880
|
-
function xa(p = ur,
|
|
5881
|
-
const
|
|
5884
|
+
}, oa = ta, ur = ra;
|
|
5885
|
+
function xa(p = ur, r = {}) {
|
|
5886
|
+
const t = r.serialize || JSON.stringify, e = r.deserialize || JSON.parse;
|
|
5882
5887
|
return {
|
|
5883
5888
|
/**
|
|
5884
5889
|
* Save AI config
|
|
5885
5890
|
*/
|
|
5886
|
-
save(
|
|
5891
|
+
save(o) {
|
|
5887
5892
|
try {
|
|
5888
|
-
const
|
|
5889
|
-
p.set(xe,
|
|
5890
|
-
} catch (
|
|
5891
|
-
console.error("Failed to save config:",
|
|
5893
|
+
const c = t(o);
|
|
5894
|
+
p.set(xe, c);
|
|
5895
|
+
} catch (c) {
|
|
5896
|
+
console.error("Failed to save config:", c);
|
|
5892
5897
|
}
|
|
5893
5898
|
},
|
|
5894
5899
|
/**
|
|
5895
5900
|
* Load AI config
|
|
5896
5901
|
*/
|
|
5897
5902
|
load() {
|
|
5898
|
-
const
|
|
5899
|
-
if (!
|
|
5903
|
+
const o = p.get(xe);
|
|
5904
|
+
if (!o) return null;
|
|
5900
5905
|
try {
|
|
5901
|
-
return e(
|
|
5902
|
-
} catch (
|
|
5903
|
-
return console.error("Failed to load config:",
|
|
5906
|
+
return e(o);
|
|
5907
|
+
} catch (c) {
|
|
5908
|
+
return console.error("Failed to load config:", c), null;
|
|
5904
5909
|
}
|
|
5905
5910
|
},
|
|
5906
5911
|
/**
|
|
@@ -5917,15 +5922,15 @@ function aa(p) {
|
|
|
5917
5922
|
providers: Object.values(re),
|
|
5918
5923
|
getModels: (f) => te(f)
|
|
5919
5924
|
};
|
|
5920
|
-
const { mode:
|
|
5921
|
-
let
|
|
5922
|
-
if (
|
|
5925
|
+
const { mode: r, include: t, exclude: e, custom: o } = p;
|
|
5926
|
+
let c = [];
|
|
5927
|
+
if (r === "default") {
|
|
5923
5928
|
let f = Object.values(re);
|
|
5924
|
-
|
|
5929
|
+
t && t.length > 0 && (f = f.filter((a) => t.includes(a.id))), e && e.length > 0 && (f = f.filter((a) => !e.includes(a.id))), c = [...f];
|
|
5925
5930
|
}
|
|
5926
5931
|
const b = {};
|
|
5927
|
-
if (
|
|
5928
|
-
for (const [f, a] of Object.entries(
|
|
5932
|
+
if (o)
|
|
5933
|
+
for (const [f, a] of Object.entries(o)) {
|
|
5929
5934
|
const n = {
|
|
5930
5935
|
id: f,
|
|
5931
5936
|
name: a.name,
|
|
@@ -5934,108 +5939,135 @@ function aa(p) {
|
|
|
5934
5939
|
apiFormat: a.apiFormat,
|
|
5935
5940
|
supportsModelsApi: a.supportsModelsApi ?? !1,
|
|
5936
5941
|
icon: a.icon
|
|
5937
|
-
}, B =
|
|
5938
|
-
B >= 0 ?
|
|
5939
|
-
...
|
|
5942
|
+
}, B = c.findIndex((i) => i.id === f);
|
|
5943
|
+
B >= 0 ? c[B] = {
|
|
5944
|
+
...c[B],
|
|
5940
5945
|
...n,
|
|
5941
|
-
icon: n.icon ||
|
|
5942
|
-
} :
|
|
5946
|
+
icon: n.icon || c[B].icon
|
|
5947
|
+
} : c.push(n), a.models && a.models.length > 0 && (b[f] = a.models);
|
|
5943
5948
|
}
|
|
5944
|
-
return { providers:
|
|
5949
|
+
return { providers: c, getModels: (f) => b[f] ? b[f] : te(f) };
|
|
5945
5950
|
}
|
|
5946
|
-
function ca(p,
|
|
5947
|
-
const { providers:
|
|
5948
|
-
return
|
|
5951
|
+
function ca(p, r) {
|
|
5952
|
+
const { providers: t } = aa(r);
|
|
5953
|
+
return t.find((e) => e.id === p) || null;
|
|
5949
5954
|
}
|
|
5950
5955
|
class la {
|
|
5951
|
-
constructor(
|
|
5952
|
-
this.channels = [], this.activeChannelId = null, this.listeners = /* @__PURE__ */ new Map(), this.storagePrefix =
|
|
5956
|
+
constructor(r = {}) {
|
|
5957
|
+
this.channels = [], this.activeChannelId = null, this.capabilityDefaults = {}, this.listeners = /* @__PURE__ */ new Map(), this.storagePrefix = r.storagePrefix || "ai_channel", this.activeChannelKey = r.activeChannelKey || "ai_active_channel", this.capabilityDefaultsKey = r.capabilityDefaultsKey || "ai_capability_defaults", this.proxyUrl = r.proxyUrl, this.storageAdapter = r.storageAdapter || ur, this.loadChannels(), this.loadActiveChannel(), this.loadCapabilityDefaults();
|
|
5953
5958
|
}
|
|
5954
5959
|
// ==================== 事件系统 ====================
|
|
5955
5960
|
/** 监听事件 */
|
|
5956
|
-
on(
|
|
5957
|
-
return this.listeners.has(
|
|
5961
|
+
on(r, t) {
|
|
5962
|
+
return this.listeners.has(r) || this.listeners.set(r, /* @__PURE__ */ new Set()), this.listeners.get(r).add(t), () => this.off(r, t);
|
|
5958
5963
|
}
|
|
5959
5964
|
/** 取消监听 */
|
|
5960
|
-
off(
|
|
5965
|
+
off(r, t) {
|
|
5961
5966
|
var e;
|
|
5962
|
-
(e = this.listeners.get(
|
|
5967
|
+
(e = this.listeners.get(r)) == null || e.delete(t);
|
|
5963
5968
|
}
|
|
5964
|
-
emit(
|
|
5969
|
+
emit(r, t) {
|
|
5965
5970
|
var e;
|
|
5966
|
-
(e = this.listeners.get(
|
|
5971
|
+
(e = this.listeners.get(r)) == null || e.forEach((o) => o(t));
|
|
5967
5972
|
}
|
|
5968
5973
|
// ==================== 存储相关 ====================
|
|
5969
|
-
getStorageKey(
|
|
5970
|
-
return `${this.storagePrefix}_${
|
|
5974
|
+
getStorageKey(r) {
|
|
5975
|
+
return `${this.storagePrefix}_${r}`;
|
|
5971
5976
|
}
|
|
5972
5977
|
loadChannels() {
|
|
5973
5978
|
try {
|
|
5974
|
-
const
|
|
5975
|
-
(
|
|
5979
|
+
const r = Object.keys(localStorage || {}).filter(
|
|
5980
|
+
(t) => t.startsWith(this.storagePrefix)
|
|
5976
5981
|
);
|
|
5977
|
-
this.channels =
|
|
5978
|
-
const e = this.storageAdapter.get(
|
|
5982
|
+
this.channels = r.map((t) => {
|
|
5983
|
+
const e = this.storageAdapter.get(t);
|
|
5979
5984
|
return e ? JSON.parse(e) : null;
|
|
5980
|
-
}).filter((
|
|
5981
|
-
} catch (
|
|
5982
|
-
console.error("Failed to load channels:",
|
|
5985
|
+
}).filter((t) => t !== null);
|
|
5986
|
+
} catch (r) {
|
|
5987
|
+
console.error("Failed to load channels:", r), this.channels = [];
|
|
5983
5988
|
}
|
|
5984
5989
|
}
|
|
5985
5990
|
loadActiveChannel() {
|
|
5986
5991
|
try {
|
|
5987
|
-
const
|
|
5988
|
-
|
|
5992
|
+
const r = this.storageAdapter.get(this.activeChannelKey);
|
|
5993
|
+
r && (this.activeChannelId = r);
|
|
5994
|
+
} catch (r) {
|
|
5995
|
+
console.error("Failed to load active channel:", r);
|
|
5996
|
+
}
|
|
5997
|
+
}
|
|
5998
|
+
saveChannel(r) {
|
|
5999
|
+
try {
|
|
6000
|
+
this.storageAdapter.set(this.getStorageKey(r.id), JSON.stringify(r));
|
|
5989
6001
|
} catch (t) {
|
|
5990
|
-
console.error("Failed to
|
|
6002
|
+
console.error("Failed to save channel:", t);
|
|
5991
6003
|
}
|
|
5992
6004
|
}
|
|
5993
|
-
|
|
6005
|
+
deleteChannelFromStorage(r) {
|
|
5994
6006
|
try {
|
|
5995
|
-
this.storageAdapter.
|
|
6007
|
+
this.storageAdapter.remove(this.getStorageKey(r));
|
|
6008
|
+
} catch (t) {
|
|
6009
|
+
console.error("Failed to delete channel from storage:", t);
|
|
6010
|
+
}
|
|
6011
|
+
}
|
|
6012
|
+
saveActiveChannel() {
|
|
6013
|
+
try {
|
|
6014
|
+
this.activeChannelId ? this.storageAdapter.set(this.activeChannelKey, this.activeChannelId) : this.storageAdapter.remove(this.activeChannelKey);
|
|
5996
6015
|
} catch (r) {
|
|
5997
|
-
console.error("Failed to save channel:", r);
|
|
6016
|
+
console.error("Failed to save active channel:", r);
|
|
5998
6017
|
}
|
|
5999
6018
|
}
|
|
6000
|
-
|
|
6019
|
+
loadCapabilityDefaults() {
|
|
6001
6020
|
try {
|
|
6002
|
-
this.storageAdapter.
|
|
6021
|
+
const r = this.storageAdapter.get(this.capabilityDefaultsKey);
|
|
6022
|
+
if (r) {
|
|
6023
|
+
const t = JSON.parse(r);
|
|
6024
|
+
this.capabilityDefaults = t;
|
|
6025
|
+
}
|
|
6003
6026
|
} catch (r) {
|
|
6004
|
-
console.error("Failed to
|
|
6027
|
+
console.error("Failed to load capability defaults:", r);
|
|
6005
6028
|
}
|
|
6006
6029
|
}
|
|
6007
|
-
|
|
6030
|
+
saveCapabilityDefaults() {
|
|
6008
6031
|
try {
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6032
|
+
const r = Object.keys(this.capabilityDefaults).filter(
|
|
6033
|
+
(t) => this.capabilityDefaults[t]
|
|
6034
|
+
);
|
|
6035
|
+
if (r.length > 0) {
|
|
6036
|
+
const t = {};
|
|
6037
|
+
for (const e of r)
|
|
6038
|
+
t[e] = this.capabilityDefaults[e];
|
|
6039
|
+
this.storageAdapter.set(this.capabilityDefaultsKey, JSON.stringify(t));
|
|
6040
|
+
} else
|
|
6041
|
+
this.storageAdapter.remove(this.capabilityDefaultsKey);
|
|
6042
|
+
} catch (r) {
|
|
6043
|
+
console.error("Failed to save capability defaults:", r);
|
|
6012
6044
|
}
|
|
6013
6045
|
}
|
|
6014
6046
|
// ==================== 通道 CRUD ====================
|
|
6015
6047
|
/** 添加通道 */
|
|
6016
|
-
async addChannel(
|
|
6017
|
-
const e = t0(
|
|
6048
|
+
async addChannel(r, t) {
|
|
6049
|
+
const e = t0(r.providerId);
|
|
6018
6050
|
if (!e)
|
|
6019
|
-
throw new Error(`Provider not found: ${
|
|
6020
|
-
let
|
|
6051
|
+
throw new Error(`Provider not found: ${r.providerId}`);
|
|
6052
|
+
let o = r.modelName || r.model, c = [], b;
|
|
6021
6053
|
try {
|
|
6022
|
-
const n = (await this.getProviderModels(
|
|
6023
|
-
n && (
|
|
6054
|
+
const n = (await this.getProviderModels(r.providerId, r.apiKey, r.baseUrl)).find((B) => B.id === r.model);
|
|
6055
|
+
n && (o = n.name, c = n.capabilities || [], b = n.contextLength);
|
|
6024
6056
|
} catch (a) {
|
|
6025
6057
|
console.warn("Failed to fetch models, using static info:", a);
|
|
6026
6058
|
}
|
|
6027
6059
|
const u = {
|
|
6028
6060
|
id: Date.now().toString() + Math.random().toString(36).slice(2, 6),
|
|
6029
|
-
providerId:
|
|
6061
|
+
providerId: r.providerId,
|
|
6030
6062
|
providerName: e.name,
|
|
6031
|
-
model:
|
|
6032
|
-
modelName:
|
|
6033
|
-
apiKey:
|
|
6034
|
-
baseUrl:
|
|
6063
|
+
model: r.model,
|
|
6064
|
+
modelName: o,
|
|
6065
|
+
apiKey: r.apiKey,
|
|
6066
|
+
baseUrl: r.baseUrl,
|
|
6035
6067
|
apiFormat: e.apiFormat,
|
|
6036
|
-
capabilities:
|
|
6068
|
+
capabilities: c,
|
|
6037
6069
|
contextLength: b,
|
|
6038
|
-
name:
|
|
6070
|
+
name: t,
|
|
6039
6071
|
createdAt: Date.now(),
|
|
6040
6072
|
status: "untested"
|
|
6041
6073
|
}, f = this.channels.findIndex(
|
|
@@ -6044,30 +6076,30 @@ class la {
|
|
|
6044
6076
|
return f >= 0 ? (this.channels[f] = { ...u, id: this.channels[f].id }, this.saveChannel(this.channels[f]), this.emit("update", this.channels[f]), this.channels[f]) : (this.channels.unshift(u), this.saveChannel(u), this.emit("add", u), u);
|
|
6045
6077
|
}
|
|
6046
6078
|
/** 删除通道 */
|
|
6047
|
-
deleteChannel(
|
|
6048
|
-
const
|
|
6049
|
-
|
|
6079
|
+
deleteChannel(r) {
|
|
6080
|
+
const t = this.getChannel(r);
|
|
6081
|
+
t && (this.channels = this.channels.filter((e) => e.id !== r), this.deleteChannelFromStorage(r), this.activeChannelId === r && (this.activeChannelId = null, this.saveActiveChannel()), this.emit("delete", { id: r, channel: t }));
|
|
6050
6082
|
}
|
|
6051
6083
|
/** 更新通道 */
|
|
6052
|
-
async updateChannel(
|
|
6053
|
-
const
|
|
6054
|
-
if (!
|
|
6055
|
-
throw new Error(`Channel not found: ${
|
|
6056
|
-
const
|
|
6057
|
-
if (e !== void 0 && (
|
|
6058
|
-
const u = t0(
|
|
6084
|
+
async updateChannel(r, t, e) {
|
|
6085
|
+
const o = this.channels.find((u) => u.id === r);
|
|
6086
|
+
if (!o)
|
|
6087
|
+
throw new Error(`Channel not found: ${r}`);
|
|
6088
|
+
const c = { ...o, ...t };
|
|
6089
|
+
if (e !== void 0 && (c.name = e), t.providerId || t.model || t.baseUrl) {
|
|
6090
|
+
const u = t0(c.providerId);
|
|
6059
6091
|
if (u) {
|
|
6060
|
-
|
|
6092
|
+
c.providerName = u.name, c.apiFormat = u.apiFormat;
|
|
6061
6093
|
try {
|
|
6062
|
-
const a = (await this.getProviderModels(
|
|
6063
|
-
a && (
|
|
6094
|
+
const a = (await this.getProviderModels(c.providerId, c.apiKey, c.baseUrl)).find((n) => n.id === c.model);
|
|
6095
|
+
a && (c.modelName = a.name, c.capabilities = a.capabilities || [], c.contextLength = a.contextLength);
|
|
6064
6096
|
} catch (f) {
|
|
6065
6097
|
console.warn("Failed to fetch models:", f);
|
|
6066
6098
|
}
|
|
6067
6099
|
}
|
|
6068
6100
|
}
|
|
6069
|
-
const b = this.channels.findIndex((u) => u.id ===
|
|
6070
|
-
return this.channels[b] =
|
|
6101
|
+
const b = this.channels.findIndex((u) => u.id === r);
|
|
6102
|
+
return this.channels[b] = c, this.saveChannel(c), this.emit("update", c), c;
|
|
6071
6103
|
}
|
|
6072
6104
|
// ==================== 通道查询 ====================
|
|
6073
6105
|
/** 获取所有通道 */
|
|
@@ -6075,36 +6107,36 @@ class la {
|
|
|
6075
6107
|
return [...this.channels];
|
|
6076
6108
|
}
|
|
6077
6109
|
/** 根据 ID 获取通道 */
|
|
6078
|
-
getChannel(
|
|
6079
|
-
return this.channels.find((
|
|
6110
|
+
getChannel(r) {
|
|
6111
|
+
return this.channels.find((t) => t.id === r);
|
|
6080
6112
|
}
|
|
6081
6113
|
/** 按 Provider ID 过滤通道 */
|
|
6082
|
-
getChannelsByProvider(
|
|
6083
|
-
return this.channels.filter((
|
|
6114
|
+
getChannelsByProvider(r) {
|
|
6115
|
+
return this.channels.filter((t) => t.providerId === r);
|
|
6084
6116
|
}
|
|
6085
6117
|
/** 按模型能力过滤通道(如 vision, reasoning, audio) */
|
|
6086
|
-
getChannelsByCapability(
|
|
6087
|
-
return this.channels.filter((
|
|
6118
|
+
getChannelsByCapability(r) {
|
|
6119
|
+
return this.channels.filter((t) => {
|
|
6088
6120
|
var e;
|
|
6089
|
-
return (e =
|
|
6121
|
+
return (e = t.capabilities) == null ? void 0 : e.includes(r);
|
|
6090
6122
|
});
|
|
6091
6123
|
}
|
|
6092
6124
|
/** 按 API 格式过滤通道(如 openai, anthropic, gemini) */
|
|
6093
|
-
getChannelsByFormat(
|
|
6094
|
-
return this.channels.filter((
|
|
6125
|
+
getChannelsByFormat(r) {
|
|
6126
|
+
return this.channels.filter((t) => t.apiFormat === r);
|
|
6095
6127
|
}
|
|
6096
6128
|
/** 按连接状态过滤通道 */
|
|
6097
|
-
getChannelsByStatus(
|
|
6098
|
-
return this.channels.filter((
|
|
6129
|
+
getChannelsByStatus(r) {
|
|
6130
|
+
return this.channels.filter((t) => t.status === r);
|
|
6099
6131
|
}
|
|
6100
6132
|
/** 综合条件查询通道 */
|
|
6101
|
-
queryChannels(
|
|
6102
|
-
return this.channels.filter((
|
|
6133
|
+
queryChannels(r) {
|
|
6134
|
+
return this.channels.filter((t) => {
|
|
6103
6135
|
var e;
|
|
6104
|
-
if (
|
|
6105
|
-
if (
|
|
6106
|
-
const
|
|
6107
|
-
if (!`${
|
|
6136
|
+
if (r.providerId && t.providerId !== r.providerId || r.apiFormat && t.apiFormat !== r.apiFormat || r.capability && !((e = t.capabilities) != null && e.includes(r.capability)) || r.status && t.status !== r.status) return !1;
|
|
6137
|
+
if (r.keyword) {
|
|
6138
|
+
const o = r.keyword.toLowerCase();
|
|
6139
|
+
if (!`${t.name || ""} ${t.modelName} ${t.providerName} ${t.model}`.toLowerCase().includes(o)) return !1;
|
|
6108
6140
|
}
|
|
6109
6141
|
return !0;
|
|
6110
6142
|
});
|
|
@@ -6120,175 +6152,248 @@ class la {
|
|
|
6120
6152
|
return this.getChannel(this.activeChannelId);
|
|
6121
6153
|
}
|
|
6122
6154
|
/** 设置当前激活的通道 */
|
|
6123
|
-
setActiveChannel(
|
|
6124
|
-
const
|
|
6125
|
-
if (!
|
|
6126
|
-
throw new Error(`Channel not found: ${
|
|
6127
|
-
this.activeChannelId =
|
|
6128
|
-
const e = this.channels.findIndex((
|
|
6129
|
-
this.channels[e].lastUsedAt = Date.now(), this.saveChannel(this.channels[e]), this.emit("activate",
|
|
6155
|
+
setActiveChannel(r) {
|
|
6156
|
+
const t = this.getChannel(r);
|
|
6157
|
+
if (!t)
|
|
6158
|
+
throw new Error(`Channel not found: ${r}`);
|
|
6159
|
+
this.activeChannelId = r, this.saveActiveChannel();
|
|
6160
|
+
const e = this.channels.findIndex((o) => o.id === r);
|
|
6161
|
+
this.channels[e].lastUsedAt = Date.now(), this.saveChannel(this.channels[e]), this.emit("activate", t);
|
|
6130
6162
|
}
|
|
6131
6163
|
/** 清除当前激活的通道 */
|
|
6132
6164
|
clearActiveChannel() {
|
|
6133
6165
|
this.activeChannelId = null, this.saveActiveChannel();
|
|
6134
6166
|
}
|
|
6167
|
+
// ==================== 能力默认通道 ====================
|
|
6168
|
+
/**
|
|
6169
|
+
* 为指定能力类型设置默认通道
|
|
6170
|
+
* 当调用 getChannelForCapability 时,优先返回此通道
|
|
6171
|
+
*/
|
|
6172
|
+
setDefaultForCapability(r, t) {
|
|
6173
|
+
if (!this.getChannel(t))
|
|
6174
|
+
throw new Error(`Channel not found: ${t}`);
|
|
6175
|
+
this.capabilityDefaults[r] = t, this.saveCapabilityDefaults(), this.emit("update", { type: "capabilityDefault", capability: r, channelId: t });
|
|
6176
|
+
}
|
|
6177
|
+
/**
|
|
6178
|
+
* 获取指定能力类型的默认通道 ID
|
|
6179
|
+
* 返回 undefined 表示未设置
|
|
6180
|
+
*/
|
|
6181
|
+
getDefaultForCapability(r) {
|
|
6182
|
+
return this.capabilityDefaults[r] || void 0;
|
|
6183
|
+
}
|
|
6184
|
+
/**
|
|
6185
|
+
* 清除指定能力类型的默认通道
|
|
6186
|
+
*/
|
|
6187
|
+
clearDefaultForCapability(r) {
|
|
6188
|
+
delete this.capabilityDefaults[r], this.saveCapabilityDefaults();
|
|
6189
|
+
}
|
|
6190
|
+
/**
|
|
6191
|
+
* 获取所有能力类型的默认通道映射
|
|
6192
|
+
* 返回 { capability: channelId } 的对象
|
|
6193
|
+
*/
|
|
6194
|
+
getAllCapabilityDefaults() {
|
|
6195
|
+
return { ...this.capabilityDefaults };
|
|
6196
|
+
}
|
|
6197
|
+
/**
|
|
6198
|
+
* 根据能力类型获取最适合的通道(带降级链)
|
|
6199
|
+
*
|
|
6200
|
+
* 降级链:
|
|
6201
|
+
* 1. 该能力类型的显式默认通道
|
|
6202
|
+
* 2. 具有该能力且最后使用时间最新的通道
|
|
6203
|
+
* 3. 全局激活通道
|
|
6204
|
+
* 4. 第一个可用通道
|
|
6205
|
+
*/
|
|
6206
|
+
getChannelForCapability(r) {
|
|
6207
|
+
const t = this.capabilityDefaults[r];
|
|
6208
|
+
if (t) {
|
|
6209
|
+
const c = this.getChannel(t);
|
|
6210
|
+
if (c) return c;
|
|
6211
|
+
}
|
|
6212
|
+
const e = this.getChannelsByCapability(r).filter((c) => c.lastUsedAt).sort((c, b) => (b.lastUsedAt || 0) - (c.lastUsedAt || 0));
|
|
6213
|
+
if (e.length > 0) return e[0];
|
|
6214
|
+
const o = this.getActiveChannel();
|
|
6215
|
+
return o || this.channels[0];
|
|
6216
|
+
}
|
|
6217
|
+
/**
|
|
6218
|
+
* 使用指定能力类型的默认通道发送聊天请求
|
|
6219
|
+
* 自动选择合适的通道,无需手动指定 channelId
|
|
6220
|
+
*/
|
|
6221
|
+
async chatForCapability(r, t, e) {
|
|
6222
|
+
const o = this.getChannelForCapability(r);
|
|
6223
|
+
if (!o)
|
|
6224
|
+
throw new Error(`No available channel for capability: ${r}`);
|
|
6225
|
+
return this.chatWith(o.id, t, e);
|
|
6226
|
+
}
|
|
6227
|
+
/**
|
|
6228
|
+
* 使用指定能力类型的默认通道发送流式聊天请求
|
|
6229
|
+
*/
|
|
6230
|
+
async chatStreamForCapability(r, t, e) {
|
|
6231
|
+
const o = this.getChannelForCapability(r);
|
|
6232
|
+
if (!o)
|
|
6233
|
+
throw new Error(`No available channel for capability: ${r}`);
|
|
6234
|
+
return this.chatWithStream(o.id, t, {
|
|
6235
|
+
...e,
|
|
6236
|
+
onDelta: (e == null ? void 0 : e.onDelta) || ((c) => {
|
|
6237
|
+
})
|
|
6238
|
+
});
|
|
6239
|
+
}
|
|
6135
6240
|
// ==================== 模型查询 ====================
|
|
6136
6241
|
/** 获取 Provider 的可用模型列表(动态获取 + 静态兜底) */
|
|
6137
|
-
async getProviderModels(
|
|
6138
|
-
const
|
|
6139
|
-
if (!
|
|
6140
|
-
throw new Error(`Provider not found: ${
|
|
6242
|
+
async getProviderModels(r, t, e) {
|
|
6243
|
+
const o = t0(r);
|
|
6244
|
+
if (!o)
|
|
6245
|
+
throw new Error(`Provider not found: ${r}`);
|
|
6141
6246
|
return $r({
|
|
6142
|
-
provider:
|
|
6143
|
-
apiKey:
|
|
6247
|
+
provider: o,
|
|
6248
|
+
apiKey: t,
|
|
6144
6249
|
baseUrl: e,
|
|
6145
6250
|
proxyUrl: this.proxyUrl,
|
|
6146
6251
|
fallbackToStatic: !0
|
|
6147
6252
|
});
|
|
6148
6253
|
}
|
|
6149
6254
|
/** 获取通道对应的 Provider 的模型列表 */
|
|
6150
|
-
async getChannelModels(
|
|
6151
|
-
const
|
|
6152
|
-
if (!
|
|
6153
|
-
throw new Error(`Channel not found: ${
|
|
6154
|
-
return this.getProviderModels(
|
|
6255
|
+
async getChannelModels(r) {
|
|
6256
|
+
const t = this.getChannel(r);
|
|
6257
|
+
if (!t)
|
|
6258
|
+
throw new Error(`Channel not found: ${r}`);
|
|
6259
|
+
return this.getProviderModels(t.providerId, t.apiKey, t.baseUrl);
|
|
6155
6260
|
}
|
|
6156
6261
|
/** 获取 Provider 的静态模型列表(不发起网络请求) */
|
|
6157
|
-
getStaticModelList(
|
|
6158
|
-
return te(
|
|
6262
|
+
getStaticModelList(r) {
|
|
6263
|
+
return te(r);
|
|
6159
6264
|
}
|
|
6160
6265
|
/** 按能力过滤模型列表 */
|
|
6161
|
-
getModelsByCapability(
|
|
6162
|
-
return
|
|
6163
|
-
var
|
|
6164
|
-
return (
|
|
6266
|
+
getModelsByCapability(r, t) {
|
|
6267
|
+
return r.filter((e) => {
|
|
6268
|
+
var o;
|
|
6269
|
+
return (o = e.capabilities) == null ? void 0 : o.includes(t);
|
|
6165
6270
|
});
|
|
6166
6271
|
}
|
|
6167
6272
|
/** 获取所有已配置的模型摘要列表 */
|
|
6168
6273
|
getConfiguredModels() {
|
|
6169
|
-
return this.channels.map((
|
|
6170
|
-
channelId:
|
|
6171
|
-
providerId:
|
|
6172
|
-
providerName:
|
|
6173
|
-
model:
|
|
6174
|
-
modelName:
|
|
6175
|
-
apiFormat:
|
|
6176
|
-
capabilities:
|
|
6177
|
-
status:
|
|
6274
|
+
return this.channels.map((r) => ({
|
|
6275
|
+
channelId: r.id,
|
|
6276
|
+
providerId: r.providerId,
|
|
6277
|
+
providerName: r.providerName,
|
|
6278
|
+
model: r.model,
|
|
6279
|
+
modelName: r.modelName,
|
|
6280
|
+
apiFormat: r.apiFormat,
|
|
6281
|
+
capabilities: r.capabilities || [],
|
|
6282
|
+
status: r.status
|
|
6178
6283
|
}));
|
|
6179
6284
|
}
|
|
6180
6285
|
// ==================== API Key 管理 ====================
|
|
6181
6286
|
/** 更新通道的 API Key */
|
|
6182
|
-
async updateApiKey(
|
|
6183
|
-
return this.updateChannel(
|
|
6287
|
+
async updateApiKey(r, t) {
|
|
6288
|
+
return this.updateChannel(r, { apiKey: t });
|
|
6184
6289
|
}
|
|
6185
6290
|
/** 验证 API Key 格式(简单校验,非空且长度合理) */
|
|
6186
|
-
validateApiKey(
|
|
6187
|
-
const e = t0(
|
|
6188
|
-
return e ? e.needsApiKey ? !
|
|
6291
|
+
validateApiKey(r, t) {
|
|
6292
|
+
const e = t0(r);
|
|
6293
|
+
return e ? e.needsApiKey ? !t || t.trim().length === 0 ? { valid: !1, message: "API Key 不能为空" } : t.length < 10 ? { valid: !1, message: "API Key 长度过短" } : { valid: !0 } : { valid: !0, message: "此 Provider 不需要 API Key" } : { valid: !1, message: `Provider not found: ${r}` };
|
|
6189
6294
|
}
|
|
6190
6295
|
/** 脱敏显示 API Key(如 sk-••••••••J4xK) */
|
|
6191
|
-
maskApiKey(
|
|
6192
|
-
return !
|
|
6296
|
+
maskApiKey(r) {
|
|
6297
|
+
return !r || r.length <= 8 ? "••••••••" : `${r.slice(0, 4)}••••••••${r.slice(-4)}`;
|
|
6193
6298
|
}
|
|
6194
6299
|
/** 获取通道的脱敏 API Key */
|
|
6195
|
-
getMaskedApiKey(
|
|
6196
|
-
const
|
|
6197
|
-
return
|
|
6300
|
+
getMaskedApiKey(r) {
|
|
6301
|
+
const t = this.getChannel(r);
|
|
6302
|
+
return t ? this.maskApiKey(t.apiKey) : "";
|
|
6198
6303
|
}
|
|
6199
6304
|
// ==================== 聊天执行 ====================
|
|
6200
6305
|
/** 使用当前激活的通道发送聊天请求 */
|
|
6201
|
-
async chat(
|
|
6306
|
+
async chat(r, t) {
|
|
6202
6307
|
const e = this.getActiveChannel();
|
|
6203
6308
|
if (!e)
|
|
6204
6309
|
throw new Error("No active channel. Please set an active channel first.");
|
|
6205
|
-
return this.chatWith(e.id,
|
|
6310
|
+
return this.chatWith(e.id, r, t);
|
|
6206
6311
|
}
|
|
6207
6312
|
/** 使用指定通道发送聊天请求 */
|
|
6208
|
-
async chatWith(
|
|
6209
|
-
const
|
|
6210
|
-
if (!
|
|
6211
|
-
throw new Error(`Channel not found: ${
|
|
6212
|
-
const
|
|
6213
|
-
if (!
|
|
6214
|
-
throw new Error(`Provider not found: ${
|
|
6215
|
-
const b = (e == null ? void 0 : e.messages) || [{ role: "user", content:
|
|
6216
|
-
apiFormat:
|
|
6217
|
-
baseUrl:
|
|
6218
|
-
apiKey:
|
|
6219
|
-
model:
|
|
6313
|
+
async chatWith(r, t, e) {
|
|
6314
|
+
const o = this.getChannel(r);
|
|
6315
|
+
if (!o)
|
|
6316
|
+
throw new Error(`Channel not found: ${r}`);
|
|
6317
|
+
const c = t0(o.providerId);
|
|
6318
|
+
if (!c)
|
|
6319
|
+
throw new Error(`Provider not found: ${o.providerId}`);
|
|
6320
|
+
const b = (e == null ? void 0 : e.messages) || [{ role: "user", content: t }], u = await cr({
|
|
6321
|
+
apiFormat: o.apiFormat,
|
|
6322
|
+
baseUrl: o.baseUrl || c.baseUrl,
|
|
6323
|
+
apiKey: o.apiKey,
|
|
6324
|
+
model: o.model,
|
|
6220
6325
|
messages: b,
|
|
6221
6326
|
maxTokens: e == null ? void 0 : e.maxTokens
|
|
6222
6327
|
}), f = {
|
|
6223
6328
|
...u,
|
|
6224
|
-
channelId:
|
|
6225
|
-
model:
|
|
6329
|
+
channelId: o.id,
|
|
6330
|
+
model: o.model
|
|
6226
6331
|
};
|
|
6227
6332
|
if (u.success) {
|
|
6228
|
-
const a = this.channels.findIndex((n) => n.id ===
|
|
6333
|
+
const a = this.channels.findIndex((n) => n.id === o.id);
|
|
6229
6334
|
this.channels[a].lastUsedAt = Date.now(), this.channels[a].status = "connected", this.channels[a].lastError = void 0, this.saveChannel(this.channels[a]);
|
|
6230
6335
|
} else {
|
|
6231
|
-
const a = this.channels.findIndex((n) => n.id ===
|
|
6336
|
+
const a = this.channels.findIndex((n) => n.id === o.id);
|
|
6232
6337
|
this.channels[a].status = "error", this.channels[a].lastError = u.message, this.saveChannel(this.channels[a]);
|
|
6233
6338
|
}
|
|
6234
6339
|
return this.emit("chat", f), f;
|
|
6235
6340
|
}
|
|
6236
6341
|
/** 使用当前激活通道发送流式聊天。onDelta 每次收到「累计完整文本」。 */
|
|
6237
|
-
async chatStream(
|
|
6342
|
+
async chatStream(r, t) {
|
|
6238
6343
|
const e = this.getActiveChannel();
|
|
6239
6344
|
if (!e)
|
|
6240
6345
|
throw new Error("No active channel. Please set an active channel first.");
|
|
6241
|
-
return this.chatWithStream(e.id,
|
|
6346
|
+
return this.chatWithStream(e.id, r, t);
|
|
6242
6347
|
}
|
|
6243
6348
|
/** 使用指定通道发送流式聊天。onDelta 每次收到「累计完整文本」。 */
|
|
6244
|
-
async chatWithStream(
|
|
6245
|
-
const
|
|
6246
|
-
if (!
|
|
6247
|
-
throw new Error(`Channel not found: ${
|
|
6248
|
-
const
|
|
6249
|
-
if (!
|
|
6250
|
-
throw new Error(`Provider not found: ${
|
|
6251
|
-
const b = e.messages || [{ role: "user", content:
|
|
6252
|
-
apiFormat:
|
|
6253
|
-
baseUrl:
|
|
6254
|
-
apiKey:
|
|
6255
|
-
model:
|
|
6349
|
+
async chatWithStream(r, t, e) {
|
|
6350
|
+
const o = this.getChannel(r);
|
|
6351
|
+
if (!o)
|
|
6352
|
+
throw new Error(`Channel not found: ${r}`);
|
|
6353
|
+
const c = t0(o.providerId);
|
|
6354
|
+
if (!c)
|
|
6355
|
+
throw new Error(`Provider not found: ${o.providerId}`);
|
|
6356
|
+
const b = e.messages || [{ role: "user", content: t }], u = await Mr({
|
|
6357
|
+
apiFormat: o.apiFormat,
|
|
6358
|
+
baseUrl: o.baseUrl || c.baseUrl,
|
|
6359
|
+
apiKey: o.apiKey,
|
|
6360
|
+
model: o.model,
|
|
6256
6361
|
messages: b,
|
|
6257
6362
|
maxTokens: e.maxTokens,
|
|
6258
6363
|
onDelta: e.onDelta,
|
|
6259
6364
|
signal: e.signal
|
|
6260
6365
|
}), f = {
|
|
6261
6366
|
...u,
|
|
6262
|
-
channelId:
|
|
6263
|
-
model:
|
|
6264
|
-
}, a = this.channels.findIndex((n) => n.id ===
|
|
6367
|
+
channelId: o.id,
|
|
6368
|
+
model: o.model
|
|
6369
|
+
}, a = this.channels.findIndex((n) => n.id === o.id);
|
|
6265
6370
|
return u.success ? (this.channels[a].lastUsedAt = Date.now(), this.channels[a].status = "connected", this.channels[a].lastError = void 0) : (this.channels[a].status = "error", this.channels[a].lastError = u.message), this.saveChannel(this.channels[a]), this.emit("chat", f), f;
|
|
6266
6371
|
}
|
|
6267
6372
|
/** 测试指定通道的连接 */
|
|
6268
|
-
async testChannel(
|
|
6269
|
-
const
|
|
6270
|
-
if (!
|
|
6271
|
-
throw new Error(`Channel not found: ${
|
|
6272
|
-
const e = t0(
|
|
6373
|
+
async testChannel(r) {
|
|
6374
|
+
const t = this.getChannel(r);
|
|
6375
|
+
if (!t)
|
|
6376
|
+
throw new Error(`Channel not found: ${r}`);
|
|
6377
|
+
const e = t0(t.providerId);
|
|
6273
6378
|
if (!e)
|
|
6274
|
-
throw new Error(`Provider not found: ${
|
|
6275
|
-
const
|
|
6276
|
-
apiFormat:
|
|
6277
|
-
baseUrl:
|
|
6278
|
-
apiKey:
|
|
6279
|
-
model:
|
|
6280
|
-
}),
|
|
6281
|
-
return
|
|
6379
|
+
throw new Error(`Provider not found: ${t.providerId}`);
|
|
6380
|
+
const o = await Or({
|
|
6381
|
+
apiFormat: t.apiFormat,
|
|
6382
|
+
baseUrl: t.baseUrl || e.baseUrl,
|
|
6383
|
+
apiKey: t.apiKey,
|
|
6384
|
+
model: t.model
|
|
6385
|
+
}), c = this.channels.findIndex((b) => b.id === r);
|
|
6386
|
+
return o.success ? (this.channels[c].status = "connected", this.channels[c].lastError = void 0) : (this.channels[c].status = "error", this.channels[c].lastError = o.message), this.saveChannel(this.channels[c]), this.emit("test", { id: r, ...o }), o;
|
|
6282
6387
|
}
|
|
6283
6388
|
/** 测试所有通道连接 */
|
|
6284
6389
|
async testAllChannels() {
|
|
6285
6390
|
return await Promise.all(
|
|
6286
|
-
this.channels.map(async (
|
|
6391
|
+
this.channels.map(async (t) => {
|
|
6287
6392
|
try {
|
|
6288
|
-
const e = await this.testChannel(
|
|
6289
|
-
return { id:
|
|
6393
|
+
const e = await this.testChannel(t.id);
|
|
6394
|
+
return { id: t.id, channel: t, result: e };
|
|
6290
6395
|
} catch (e) {
|
|
6291
|
-
return { id:
|
|
6396
|
+
return { id: t.id, channel: t, result: { success: !1, message: e instanceof Error ? e.message : String(e) } };
|
|
6292
6397
|
}
|
|
6293
6398
|
})
|
|
6294
6399
|
);
|
|
@@ -6296,80 +6401,80 @@ class la {
|
|
|
6296
6401
|
// ==================== Provider 查询 ====================
|
|
6297
6402
|
/** 获取所有可用的 Provider */
|
|
6298
6403
|
getAvailableProviders() {
|
|
6299
|
-
return
|
|
6404
|
+
return or();
|
|
6300
6405
|
}
|
|
6301
6406
|
/** 获取单个 Provider 信息 */
|
|
6302
|
-
getProvider(
|
|
6303
|
-
return t0(
|
|
6407
|
+
getProvider(r) {
|
|
6408
|
+
return t0(r);
|
|
6304
6409
|
}
|
|
6305
6410
|
/** 按 API 格式获取 Provider 列表 */
|
|
6306
|
-
getProvidersByFormat(
|
|
6307
|
-
return _r(
|
|
6411
|
+
getProvidersByFormat(r) {
|
|
6412
|
+
return _r(r);
|
|
6308
6413
|
}
|
|
6309
6414
|
// ==================== 导入导出 ====================
|
|
6310
6415
|
/** 导出所有通道配置(不包含 API Key 明文) */
|
|
6311
|
-
exportChannels(
|
|
6312
|
-
const
|
|
6313
|
-
if (
|
|
6314
|
-
const { apiKey:
|
|
6315
|
-
return { ...
|
|
6416
|
+
exportChannels(r) {
|
|
6417
|
+
const t = this.channels.map((e) => {
|
|
6418
|
+
if (r) return e;
|
|
6419
|
+
const { apiKey: o, ...c } = e;
|
|
6420
|
+
return { ...c, apiKey: this.maskApiKey(o) };
|
|
6316
6421
|
});
|
|
6317
6422
|
return JSON.stringify({
|
|
6318
6423
|
version: 1,
|
|
6319
6424
|
exportedAt: Date.now(),
|
|
6320
|
-
channels:
|
|
6425
|
+
channels: t
|
|
6321
6426
|
}, null, 2);
|
|
6322
6427
|
}
|
|
6323
6428
|
/** 导入通道配置 */
|
|
6324
|
-
async importChannels(
|
|
6325
|
-
const e = JSON.parse(
|
|
6429
|
+
async importChannels(r, t = !0) {
|
|
6430
|
+
const e = JSON.parse(r);
|
|
6326
6431
|
if (!e.channels || !Array.isArray(e.channels))
|
|
6327
6432
|
throw new Error("Invalid import format: missing channels array");
|
|
6328
|
-
|
|
6329
|
-
const
|
|
6330
|
-
for (const
|
|
6331
|
-
if (
|
|
6332
|
-
console.warn(`Skipping channel ${
|
|
6433
|
+
t || this.clearAllChannels();
|
|
6434
|
+
const o = [];
|
|
6435
|
+
for (const c of e.channels) {
|
|
6436
|
+
if (c.apiKey && c.apiKey.includes("••••")) {
|
|
6437
|
+
console.warn(`Skipping channel ${c.modelName}: API Key is masked`);
|
|
6333
6438
|
continue;
|
|
6334
6439
|
}
|
|
6335
6440
|
const b = {
|
|
6336
|
-
providerId:
|
|
6337
|
-
apiKey:
|
|
6338
|
-
model:
|
|
6339
|
-
modelName:
|
|
6340
|
-
baseUrl:
|
|
6341
|
-
}, u = await this.addChannel(b,
|
|
6342
|
-
|
|
6441
|
+
providerId: c.providerId,
|
|
6442
|
+
apiKey: c.apiKey,
|
|
6443
|
+
model: c.model,
|
|
6444
|
+
modelName: c.modelName,
|
|
6445
|
+
baseUrl: c.baseUrl
|
|
6446
|
+
}, u = await this.addChannel(b, c.name);
|
|
6447
|
+
o.push(u);
|
|
6343
6448
|
}
|
|
6344
|
-
return
|
|
6449
|
+
return o;
|
|
6345
6450
|
}
|
|
6346
6451
|
// ==================== 批量操作 ====================
|
|
6347
6452
|
/** 清空所有通道 */
|
|
6348
6453
|
clearAllChannels() {
|
|
6349
|
-
this.channels.forEach((
|
|
6350
|
-
this.deleteChannelFromStorage(
|
|
6351
|
-
}), this.channels = [], this.activeChannelId = null, this.saveActiveChannel(), this.emit("clear", {});
|
|
6454
|
+
this.channels.forEach((r) => {
|
|
6455
|
+
this.deleteChannelFromStorage(r.id);
|
|
6456
|
+
}), this.channels = [], this.activeChannelId = null, this.saveActiveChannel(), this.capabilityDefaults = {}, this.saveCapabilityDefaults(), this.emit("clear", {});
|
|
6352
6457
|
}
|
|
6353
6458
|
/** 批量删除通道 */
|
|
6354
|
-
deleteChannels(
|
|
6355
|
-
|
|
6459
|
+
deleteChannels(r) {
|
|
6460
|
+
r.forEach((t) => this.deleteChannel(t));
|
|
6356
6461
|
}
|
|
6357
6462
|
/** 获取统计信息 */
|
|
6358
6463
|
getStats() {
|
|
6359
|
-
const
|
|
6464
|
+
const r = {
|
|
6360
6465
|
total: this.channels.length,
|
|
6361
6466
|
byStatus: {},
|
|
6362
6467
|
byFormat: {},
|
|
6363
6468
|
byProvider: {},
|
|
6364
6469
|
byCapability: {}
|
|
6365
6470
|
};
|
|
6366
|
-
for (const
|
|
6367
|
-
const e =
|
|
6368
|
-
|
|
6369
|
-
for (const
|
|
6370
|
-
|
|
6471
|
+
for (const t of this.channels) {
|
|
6472
|
+
const e = t.status || "untested";
|
|
6473
|
+
r.byStatus[e] = (r.byStatus[e] || 0) + 1, r.byFormat[t.apiFormat] = (r.byFormat[t.apiFormat] || 0) + 1, r.byProvider[t.providerId] = (r.byProvider[t.providerId] || 0) + 1;
|
|
6474
|
+
for (const o of t.capabilities || [])
|
|
6475
|
+
r.byCapability[o] = (r.byCapability[o] || 0) + 1;
|
|
6371
6476
|
}
|
|
6372
|
-
return
|
|
6477
|
+
return r;
|
|
6373
6478
|
}
|
|
6374
6479
|
}
|
|
6375
6480
|
export {
|
|
@@ -6383,19 +6488,19 @@ export {
|
|
|
6383
6488
|
ur as defaultStorageAdapter,
|
|
6384
6489
|
ra as encryptedStorageAdapter,
|
|
6385
6490
|
$r as fetchModels,
|
|
6386
|
-
|
|
6491
|
+
or as getAllProviders,
|
|
6387
6492
|
t0 as getProvider,
|
|
6388
6493
|
ca as getProviderFromConfig,
|
|
6389
6494
|
_r as getProvidersByFormat,
|
|
6390
6495
|
te as getStaticModels,
|
|
6391
6496
|
ae as getStrategy,
|
|
6392
|
-
|
|
6497
|
+
oa as localStorageAdapter,
|
|
6393
6498
|
ta as plainStorageAdapter,
|
|
6394
6499
|
aa as resolveProviderConfig,
|
|
6395
6500
|
cr as sendDirectChat,
|
|
6396
6501
|
Mr as sendDirectChatStream,
|
|
6397
6502
|
Hr as strategyRegistry,
|
|
6398
|
-
|
|
6503
|
+
sa as testConnection,
|
|
6399
6504
|
Or as testDirectConnection
|
|
6400
6505
|
};
|
|
6401
6506
|
//# sourceMappingURL=index.js.map
|