sa2kit 3.0.0 → 3.1.0
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/ai/llm/ui/miniapp/index.d.mts +2 -2
- package/dist/ai/llm/ui/miniapp/index.d.ts +2 -2
- package/dist/ai/llm/ui/rn/index.d.mts +2 -2
- package/dist/ai/llm/ui/rn/index.d.ts +2 -2
- package/dist/ai/llm/ui/web/index.d.mts +3 -3
- package/dist/ai/llm/ui/web/index.d.ts +3 -3
- package/dist/analytics/index.d.mts +1 -1
- package/dist/analytics/index.d.ts +1 -1
- package/dist/{chunk-QP5N3ER6.js → chunk-3CSCIRQY.js} +5 -6
- package/dist/chunk-3CSCIRQY.js.map +1 -0
- package/dist/{chunk-RJP2BRJD.mjs → chunk-4OOANEJV.mjs} +2 -2
- package/dist/{chunk-RJP2BRJD.mjs.map → chunk-4OOANEJV.mjs.map} +1 -1
- package/dist/chunk-5FUAQLGC.mjs +14 -0
- package/dist/chunk-5FUAQLGC.mjs.map +1 -0
- package/dist/{chunk-S732H246.js → chunk-6PMXAK7F.js} +2 -2
- package/dist/{chunk-S732H246.js.map → chunk-6PMXAK7F.js.map} +1 -1
- package/dist/chunk-6YLCRWKM.mjs +8 -0
- package/dist/chunk-6YLCRWKM.mjs.map +1 -0
- package/dist/{chunk-IBWDBBX5.mjs → chunk-7B5SI4OF.mjs} +3 -4
- package/dist/chunk-7B5SI4OF.mjs.map +1 -0
- package/dist/chunk-EQXPL7TN.mjs +78 -0
- package/dist/chunk-EQXPL7TN.mjs.map +1 -0
- package/dist/{chunk-GQZHGSRR.js → chunk-GSNGCENJ.js} +39 -2
- package/dist/chunk-GSNGCENJ.js.map +1 -0
- package/dist/chunk-HQLKOXG7.js +16 -0
- package/dist/chunk-HQLKOXG7.js.map +1 -0
- package/dist/{chunk-S3PUP7N4.js → chunk-PA4ELVGI.js} +2 -2
- package/dist/{chunk-S3PUP7N4.js.map → chunk-PA4ELVGI.js.map} +1 -1
- package/dist/{chunk-WZDTNDYR.js → chunk-QSKLQX6H.js} +11 -11
- package/dist/{chunk-WZDTNDYR.js.map → chunk-QSKLQX6H.js.map} +1 -1
- package/dist/{chunk-LHJKLUM7.mjs → chunk-TNJ6LYX7.mjs} +2 -2
- package/dist/{chunk-LHJKLUM7.mjs.map → chunk-TNJ6LYX7.mjs.map} +1 -1
- package/dist/{chunk-J77KR2EV.mjs → chunk-WJ7IMUEJ.mjs} +3 -3
- package/dist/{chunk-J77KR2EV.mjs.map → chunk-WJ7IMUEJ.mjs.map} +1 -1
- package/dist/chunk-YTGUIRRH.js +10 -0
- package/dist/chunk-YTGUIRRH.js.map +1 -0
- package/dist/common/auth/client/index.d.mts +1 -31
- package/dist/common/auth/client/index.d.ts +1 -31
- package/dist/common/auth/client/index.js +2 -15
- package/dist/common/auth/client/index.mjs +1 -2
- package/dist/common/auth/components/index.d.mts +14 -248
- package/dist/common/auth/components/index.d.ts +14 -248
- package/dist/common/auth/components/index.js +878 -49
- package/dist/common/auth/components/index.js.map +1 -1
- package/dist/common/auth/components/index.mjs +871 -5
- package/dist/common/auth/components/index.mjs.map +1 -1
- package/dist/common/auth/hooks/index.d.mts +2 -29
- package/dist/common/auth/hooks/index.d.ts +2 -29
- package/dist/common/auth/hooks/index.js +2 -11
- package/dist/common/auth/hooks/index.mjs +1 -2
- package/dist/common/auth/index.d.mts +5 -9
- package/dist/common/auth/index.d.ts +5 -9
- package/dist/common/auth/index.js +7 -28
- package/dist/common/auth/index.mjs +3 -4
- package/dist/common/auth/react/index.d.mts +3 -3
- package/dist/common/auth/react/index.d.ts +3 -3
- package/dist/common/auth/rn/index.d.mts +3 -19
- package/dist/common/auth/rn/index.d.ts +3 -19
- package/dist/common/auth/rn/index.js +0 -32
- package/dist/common/auth/rn/index.js.map +1 -1
- package/dist/common/auth/rn/index.mjs +1 -30
- package/dist/common/auth/rn/index.mjs.map +1 -1
- package/dist/common/auth/server/index.d.mts +81 -2
- package/dist/common/auth/server/index.d.ts +81 -2
- package/dist/common/auth/server/index.js +128 -37
- package/dist/common/auth/server/index.js.map +1 -1
- package/dist/common/auth/server/index.mjs +124 -1
- package/dist/common/auth/server/index.mjs.map +1 -1
- package/dist/common/auth/services/index.js +12 -9
- package/dist/common/auth/services/index.js.map +1 -1
- package/dist/common/auth/services/index.mjs +10 -1
- package/dist/common/auth/services/index.mjs.map +1 -1
- package/dist/common/file/server/index.js +32 -32
- package/dist/common/file/server/index.mjs +3 -3
- package/dist/common/index.d.mts +5 -8
- package/dist/common/index.d.ts +5 -8
- package/dist/common/index.js +12 -14
- package/dist/common/index.mjs +6 -8
- package/dist/common/request/index.js +4 -5
- package/dist/common/request/index.mjs +2 -3
- package/dist/i18n/index.d.mts +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/imageCrop/index.d.mts +3 -3
- package/dist/imageCrop/index.d.ts +3 -3
- package/dist/index-Bd7cKF1j.d.mts +50 -0
- package/dist/{index-CLB80GCP.d.ts → index-D0cqaQEH.d.mts} +5 -5
- package/dist/{index-CLB80GCP.d.mts → index-D0cqaQEH.d.ts} +5 -5
- package/dist/index-DRQxtCDw.d.ts +50 -0
- package/dist/{index-BxZauNN_.d.mts → index-DoUo8IrU.d.mts} +8 -8
- package/dist/{index-BxZauNN_.d.ts → index-DoUo8IrU.d.ts} +8 -8
- package/dist/index.d.mts +152 -131
- package/dist/index.d.ts +152 -131
- package/dist/index.js +105 -554
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +106 -555
- package/dist/index.mjs.map +1 -1
- package/dist/ossFile/server/index.js +32 -32
- package/dist/ossFile/server/index.mjs +3 -3
- package/dist/request/index.js +3 -4
- package/dist/request/index.mjs +1 -2
- package/dist/universalExport/index.d.mts +3 -3
- package/dist/universalExport/index.d.ts +3 -3
- package/dist/universalFile/index.d.mts +5 -5
- package/dist/universalFile/index.d.ts +5 -5
- package/dist/universalFile/server/index.js +62 -62
- package/dist/universalFile/server/index.mjs +2 -2
- package/package.json +1 -36
- package/dist/auth/client/index.d.mts +0 -13
- package/dist/auth/client/index.d.ts +0 -13
- package/dist/auth/client/index.js +0 -26
- package/dist/auth/client/index.js.map +0 -1
- package/dist/auth/client/index.mjs +0 -5
- package/dist/auth/client/index.mjs.map +0 -1
- package/dist/auth/components/index.d.mts +0 -10
- package/dist/auth/components/index.d.ts +0 -10
- package/dist/auth/components/index.js +0 -70
- package/dist/auth/components/index.js.map +0 -1
- package/dist/auth/components/index.mjs +0 -9
- package/dist/auth/components/index.mjs.map +0 -1
- package/dist/auth/hooks/index.d.mts +0 -13
- package/dist/auth/hooks/index.d.ts +0 -13
- package/dist/auth/hooks/index.js +0 -28
- package/dist/auth/hooks/index.js.map +0 -1
- package/dist/auth/hooks/index.mjs +0 -7
- package/dist/auth/hooks/index.mjs.map +0 -1
- package/dist/auth/index.d.mts +0 -21
- package/dist/auth/index.d.ts +0 -21
- package/dist/auth/index.js +0 -112
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/index.mjs +0 -11
- package/dist/auth/index.mjs.map +0 -1
- package/dist/auth/rn/index.d.mts +0 -3133
- package/dist/auth/rn/index.d.ts +0 -3133
- package/dist/auth/rn/index.js +0 -684
- package/dist/auth/rn/index.js.map +0 -1
- package/dist/auth/rn/index.mjs +0 -663
- package/dist/auth/rn/index.mjs.map +0 -1
- package/dist/auth/schema/index.d.mts +0 -4
- package/dist/auth/schema/index.d.ts +0 -4
- package/dist/auth/schema/index.js +0 -49
- package/dist/auth/schema/index.js.map +0 -1
- package/dist/auth/schema/index.mjs +0 -4
- package/dist/auth/schema/index.mjs.map +0 -1
- package/dist/auth/services/index.d.mts +0 -1
- package/dist/auth/services/index.d.ts +0 -1
- package/dist/auth/services/index.js +0 -17
- package/dist/auth/services/index.js.map +0 -1
- package/dist/auth/services/index.mjs +0 -4
- package/dist/auth/services/index.mjs.map +0 -1
- package/dist/base-api-client-BpmcQt4Q.d.ts +0 -103
- package/dist/base-api-client-CFIhZK4C.d.mts +0 -277
- package/dist/base-api-client-CFIhZK4C.d.ts +0 -277
- package/dist/base-api-client-DXLsq2yz.d.mts +0 -103
- package/dist/chunk-7E3J7VAD.mjs +0 -3
- package/dist/chunk-7E3J7VAD.mjs.map +0 -1
- package/dist/chunk-B3CZ3HXJ.mjs +0 -126
- package/dist/chunk-B3CZ3HXJ.mjs.map +0 -1
- package/dist/chunk-FOQEQWX5.js +0 -4
- package/dist/chunk-FOQEQWX5.js.map +0 -1
- package/dist/chunk-G4NFB2QA.mjs +0 -212
- package/dist/chunk-G4NFB2QA.mjs.map +0 -1
- package/dist/chunk-G5HJGXGC.mjs +0 -39
- package/dist/chunk-G5HJGXGC.mjs.map +0 -1
- package/dist/chunk-GQZHGSRR.js.map +0 -1
- package/dist/chunk-GS7XLKET.js +0 -41
- package/dist/chunk-GS7XLKET.js.map +0 -1
- package/dist/chunk-IBWDBBX5.mjs.map +0 -1
- package/dist/chunk-MWSAH7ZG.mjs +0 -42
- package/dist/chunk-MWSAH7ZG.mjs.map +0 -1
- package/dist/chunk-MZOGYD4N.mjs +0 -186
- package/dist/chunk-MZOGYD4N.mjs.map +0 -1
- package/dist/chunk-QDUBO567.js +0 -1148
- package/dist/chunk-QDUBO567.js.map +0 -1
- package/dist/chunk-QP5N3ER6.js.map +0 -1
- package/dist/chunk-RWCD2CAD.mjs +0 -1132
- package/dist/chunk-RWCD2CAD.mjs.map +0 -1
- package/dist/chunk-S37OK2QG.js +0 -216
- package/dist/chunk-S37OK2QG.js.map +0 -1
- package/dist/chunk-SFDJNKWC.js +0 -22
- package/dist/chunk-SFDJNKWC.js.map +0 -1
- package/dist/chunk-TXMX6PZR.js +0 -190
- package/dist/chunk-TXMX6PZR.js.map +0 -1
- package/dist/chunk-VHN7PF5I.js +0 -20
- package/dist/chunk-VHN7PF5I.js.map +0 -1
- package/dist/chunk-XBZIS3MV.mjs +0 -13
- package/dist/chunk-XBZIS3MV.mjs.map +0 -1
- package/dist/chunk-XFOZ56FB.mjs +0 -20
- package/dist/chunk-XFOZ56FB.mjs.map +0 -1
- package/dist/chunk-Z23HAXHL.js +0 -136
- package/dist/chunk-Z23HAXHL.js.map +0 -1
- package/dist/index-BcjDRcKp.d.mts +0 -40
- package/dist/index-BlpXrrTy.d.ts +0 -40
- package/dist/session-BCXvGCnm.d.mts +0 -81
- package/dist/session-BCXvGCnm.d.ts +0 -81
- package/dist/types-C_W_CoUD.d.ts +0 -99
- package/dist/types-DCRvasyH.d.mts +0 -99
- package/dist/types.legacy-J-j-_ig_.d.mts +0 -25
- package/dist/types.legacy-J-j-_ig_.d.ts +0 -25
package/dist/index.js
CHANGED
|
@@ -15,15 +15,12 @@ var Link = require('next/link');
|
|
|
15
15
|
var core = require('@dnd-kit/core');
|
|
16
16
|
var sortable = require('@dnd-kit/sortable');
|
|
17
17
|
var utilities = require('@dnd-kit/utilities');
|
|
18
|
-
|
|
19
|
-
var drizzleOrm = require('drizzle-orm');
|
|
20
|
-
require('better-auth');
|
|
21
|
-
require('@better-auth/drizzle-adapter');
|
|
22
|
-
require('better-auth/plugins');
|
|
23
|
-
require('better-auth/next-js');
|
|
18
|
+
require('better-auth/react');
|
|
24
19
|
var THREE2 = require('three');
|
|
25
20
|
var crypto = require('crypto');
|
|
26
21
|
var XLSX = require('xlsx');
|
|
22
|
+
var pgCore = require('drizzle-orm/pg-core');
|
|
23
|
+
var drizzleOrm = require('drizzle-orm');
|
|
27
24
|
var server = require('next/server');
|
|
28
25
|
|
|
29
26
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -90,10 +87,10 @@ var ConsoleLoggerAdapter = class {
|
|
|
90
87
|
};
|
|
91
88
|
}
|
|
92
89
|
log(entry) {
|
|
93
|
-
const { level, message, timestamp:
|
|
90
|
+
const { level, message, timestamp: timestamp2, data, context, error } = entry;
|
|
94
91
|
let logMessage = "";
|
|
95
|
-
if (
|
|
96
|
-
logMessage += "[" + this.formatTimestamp(
|
|
92
|
+
if (timestamp2) {
|
|
93
|
+
logMessage += "[" + this.formatTimestamp(timestamp2) + "] ";
|
|
97
94
|
}
|
|
98
95
|
const levelName = this.getLevelName(level);
|
|
99
96
|
logMessage += levelName + ": ";
|
|
@@ -586,7 +583,7 @@ var useSentimentAnalysis = (options = {}) => {
|
|
|
586
583
|
result: null
|
|
587
584
|
});
|
|
588
585
|
const pipelineRef = React45.useRef(null);
|
|
589
|
-
const analyze = React45.useCallback(async (
|
|
586
|
+
const analyze = React45.useCallback(async (text2) => {
|
|
590
587
|
setState((prev) => ({
|
|
591
588
|
...prev,
|
|
592
589
|
isProcessing: true,
|
|
@@ -633,12 +630,12 @@ var useSentimentAnalysis = (options = {}) => {
|
|
|
633
630
|
pipelineRef.current = await pipeline("sentiment-analysis", options.model || defaultModel);
|
|
634
631
|
}
|
|
635
632
|
setState((prev) => ({ ...prev, status: "analyzing" }));
|
|
636
|
-
const output = await pipelineRef.current(
|
|
633
|
+
const output = await pipelineRef.current(text2);
|
|
637
634
|
const resultData = output[0];
|
|
638
635
|
const label = resultData.label.toLowerCase();
|
|
639
636
|
let sentiment = "neutral";
|
|
640
637
|
const negativeKeywords = ["\u7D2F", "\u60E8", "\u7EDD\u671B", "\u96BE\u53D7", "\u4F24\u5FC3", "\u5DEE", "\u574F", "\u7CDF", "\u4E0D\u884C"];
|
|
641
|
-
const hasNegativeKeyword = negativeKeywords.some((k) =>
|
|
638
|
+
const hasNegativeKeyword = negativeKeywords.some((k) => text2.includes(k));
|
|
642
639
|
if (label.includes("positive") && !hasNegativeKeyword) {
|
|
643
640
|
sentiment = "positive";
|
|
644
641
|
} else if (label.includes("negative") || label.includes("0") || hasNegativeKeyword) {
|
|
@@ -670,12 +667,12 @@ var SentimentAnalyzer = ({
|
|
|
670
667
|
className = "",
|
|
671
668
|
placeholder = "\u8F93\u5165\u4E00\u6BB5\u4E2D\u6587\u6216\u82F1\u6587\uFF0C\u5206\u6790\u5176\u60C5\u611F\u503E\u5411..."
|
|
672
669
|
}) => {
|
|
673
|
-
const [
|
|
670
|
+
const [text2, setText] = React45.useState("");
|
|
674
671
|
const { analyze, isProcessing, status, result, error } = useSentimentAnalysis();
|
|
675
672
|
const handleAnalyze = async () => {
|
|
676
|
-
if (!
|
|
673
|
+
if (!text2.trim() || isProcessing) return;
|
|
677
674
|
try {
|
|
678
|
-
const res = await analyze(
|
|
675
|
+
const res = await analyze(text2);
|
|
679
676
|
onResult?.(res);
|
|
680
677
|
} catch (err) {
|
|
681
678
|
console.error("Sentiment Analysis Error:", err);
|
|
@@ -706,7 +703,7 @@ var SentimentAnalyzer = ({
|
|
|
706
703
|
return /* @__PURE__ */ React45__namespace.default.createElement("div", { className: clsx.clsx("p-6 border rounded-xl bg-white dark:bg-gray-800 shadow-sm", className) }, /* @__PURE__ */ React45__namespace.default.createElement("div", { className: "flex items-center gap-2 mb-4 text-gray-700 dark:text-gray-300 font-medium" }, /* @__PURE__ */ React45__namespace.default.createElement(lucideReact.MessageSquare, { size: 20 }), /* @__PURE__ */ React45__namespace.default.createElement("span", null, "\u6587\u672C\u60C5\u611F\u5206\u6790")), /* @__PURE__ */ React45__namespace.default.createElement("div", { className: "relative" }, /* @__PURE__ */ React45__namespace.default.createElement(
|
|
707
704
|
"textarea",
|
|
708
705
|
{
|
|
709
|
-
value:
|
|
706
|
+
value: text2,
|
|
710
707
|
onChange: (e) => setText(e.target.value),
|
|
711
708
|
placeholder,
|
|
712
709
|
className: "w-full h-32 p-4 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all outline-none resize-none text-gray-800 dark:text-gray-200",
|
|
@@ -716,7 +713,7 @@ var SentimentAnalyzer = ({
|
|
|
716
713
|
"button",
|
|
717
714
|
{
|
|
718
715
|
onClick: handleAnalyze,
|
|
719
|
-
disabled: !
|
|
716
|
+
disabled: !text2.trim() || isProcessing,
|
|
720
717
|
className: "absolute bottom-3 right-3 p-2 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-400 text-white rounded-md transition-colors shadow-sm"
|
|
721
718
|
},
|
|
722
719
|
isProcessing ? /* @__PURE__ */ React45__namespace.default.createElement(lucideReact.Loader2, { className: "animate-spin", size: 18 }) : /* @__PURE__ */ React45__namespace.default.createElement(lucideReact.Send, { size: 18 })
|
|
@@ -904,13 +901,13 @@ var requestJson = async (options) => {
|
|
|
904
901
|
body: body ? JSON.stringify(body) : void 0,
|
|
905
902
|
signal: controller?.signal
|
|
906
903
|
});
|
|
907
|
-
const
|
|
904
|
+
const text2 = await response.text();
|
|
908
905
|
let data = null;
|
|
909
|
-
if (
|
|
906
|
+
if (text2) {
|
|
910
907
|
try {
|
|
911
|
-
data = JSON.parse(
|
|
908
|
+
data = JSON.parse(text2);
|
|
912
909
|
} catch {
|
|
913
|
-
data =
|
|
910
|
+
data = text2;
|
|
914
911
|
}
|
|
915
912
|
}
|
|
916
913
|
if (!response.ok) {
|
|
@@ -1371,20 +1368,20 @@ var japaneseUtils = {
|
|
|
1371
1368
|
/**
|
|
1372
1369
|
* 提取文本中的汉字
|
|
1373
1370
|
*/
|
|
1374
|
-
extractKanji(
|
|
1375
|
-
return
|
|
1371
|
+
extractKanji(text2) {
|
|
1372
|
+
return text2.match(/[\u4E00-\u9FAF]/g) || [];
|
|
1376
1373
|
},
|
|
1377
1374
|
/**
|
|
1378
1375
|
* 提取文本中的假名
|
|
1379
1376
|
*/
|
|
1380
|
-
extractKana(
|
|
1381
|
-
return
|
|
1377
|
+
extractKana(text2) {
|
|
1378
|
+
return text2.match(/[\u3040-\u309F\u30A0-\u30FF]/g) || [];
|
|
1382
1379
|
},
|
|
1383
1380
|
/**
|
|
1384
1381
|
* 清理文本,移除特殊字符但保留日语字符
|
|
1385
1382
|
*/
|
|
1386
|
-
cleanText(
|
|
1387
|
-
return
|
|
1383
|
+
cleanText(text2) {
|
|
1384
|
+
return text2.replace(/[^\u3040-\u309F\u30A0-\u30FF\u4E00-\u9FAF\w\s]/g, "");
|
|
1388
1385
|
}
|
|
1389
1386
|
};
|
|
1390
1387
|
|
|
@@ -1473,11 +1470,11 @@ var fileUtils = {
|
|
|
1473
1470
|
* 生成唯一文件名
|
|
1474
1471
|
*/
|
|
1475
1472
|
generateUniqueFileName(originalName) {
|
|
1476
|
-
const
|
|
1473
|
+
const timestamp2 = Date.now();
|
|
1477
1474
|
const random = Math.random().toString(36).substring(2, 15);
|
|
1478
1475
|
const extension = this.getFileExtension(originalName);
|
|
1479
1476
|
const baseName = originalName.replace("." + extension, "");
|
|
1480
|
-
return extension ? baseName + "_" +
|
|
1477
|
+
return extension ? baseName + "_" + timestamp2 + "_" + random + "." + extension : baseName + "_" + timestamp2 + "_" + random;
|
|
1481
1478
|
},
|
|
1482
1479
|
/**
|
|
1483
1480
|
* 验证文件名是否有效
|
|
@@ -1547,28 +1544,28 @@ var stringUtils = {
|
|
|
1547
1544
|
/**
|
|
1548
1545
|
* 截断文本
|
|
1549
1546
|
*/
|
|
1550
|
-
truncate(
|
|
1551
|
-
if (
|
|
1552
|
-
return
|
|
1547
|
+
truncate(text2, length, suffix = "...") {
|
|
1548
|
+
if (text2.length <= length) return text2;
|
|
1549
|
+
return text2.substring(0, length - suffix.length) + suffix;
|
|
1553
1550
|
},
|
|
1554
1551
|
/**
|
|
1555
1552
|
* 首字母大写
|
|
1556
1553
|
*/
|
|
1557
|
-
capitalize(
|
|
1558
|
-
if (!
|
|
1559
|
-
return
|
|
1554
|
+
capitalize(text2) {
|
|
1555
|
+
if (!text2) return "";
|
|
1556
|
+
return text2.charAt(0).toUpperCase() + text2.slice(1).toLowerCase();
|
|
1560
1557
|
},
|
|
1561
1558
|
/**
|
|
1562
1559
|
* 驼峰转下划线
|
|
1563
1560
|
*/
|
|
1564
|
-
camelToSnake(
|
|
1565
|
-
return
|
|
1561
|
+
camelToSnake(text2) {
|
|
1562
|
+
return text2.replace(/[A-Z]/g, (letter) => "_" + letter.toLowerCase());
|
|
1566
1563
|
},
|
|
1567
1564
|
/**
|
|
1568
1565
|
* 下划线转驼峰
|
|
1569
1566
|
*/
|
|
1570
|
-
snakeToCamel(
|
|
1571
|
-
return
|
|
1567
|
+
snakeToCamel(text2) {
|
|
1568
|
+
return text2.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
1572
1569
|
},
|
|
1573
1570
|
/**
|
|
1574
1571
|
* 生成随机字符串
|
|
@@ -4293,14 +4290,14 @@ var BubbleShooterBoard = ({ config: inputConfig, className }) => {
|
|
|
4293
4290
|
if (status !== "shooting") {
|
|
4294
4291
|
return;
|
|
4295
4292
|
}
|
|
4296
|
-
const step = (
|
|
4293
|
+
const step = (timestamp2) => {
|
|
4297
4294
|
if (statusRef.current !== "shooting") {
|
|
4298
4295
|
lastTsRef.current = 0;
|
|
4299
4296
|
return;
|
|
4300
4297
|
}
|
|
4301
|
-
const previousTs = lastTsRef.current ||
|
|
4302
|
-
const deltaSec = Math.min((
|
|
4303
|
-
lastTsRef.current =
|
|
4298
|
+
const previousTs = lastTsRef.current || timestamp2;
|
|
4299
|
+
const deltaSec = Math.min((timestamp2 - previousTs) / 1e3, 0.05);
|
|
4300
|
+
lastTsRef.current = timestamp2;
|
|
4304
4301
|
let shouldContinue = true;
|
|
4305
4302
|
setProjectile((prev) => {
|
|
4306
4303
|
if (!prev || statusRef.current !== "shooting") {
|
|
@@ -5607,7 +5604,7 @@ function resolveUploadFolderPath(options) {
|
|
|
5607
5604
|
}
|
|
5608
5605
|
function buildModuleUploadPath(options) {
|
|
5609
5606
|
const extension = options.fileName.split(".").pop()?.toLowerCase() || "jpg";
|
|
5610
|
-
const
|
|
5607
|
+
const timestamp2 = Date.now();
|
|
5611
5608
|
const randomId2 = Math.random().toString(36).slice(2, 11);
|
|
5612
5609
|
const segments = [
|
|
5613
5610
|
options.moduleId,
|
|
@@ -5615,7 +5612,7 @@ function buildModuleUploadPath(options) {
|
|
|
5615
5612
|
options.subfolder
|
|
5616
5613
|
].filter(Boolean);
|
|
5617
5614
|
const base = segments.length > 0 ? segments.join("/") : options.moduleId;
|
|
5618
|
-
return `${base}/${
|
|
5615
|
+
return `${base}/${timestamp2}_${randomId2}.${extension}`;
|
|
5619
5616
|
}
|
|
5620
5617
|
|
|
5621
5618
|
// src/ossFile/shared/httpClient.ts
|
|
@@ -7141,12 +7138,7 @@ var UniversalExportButton = ({
|
|
|
7141
7138
|
// src/common/auth/index.ts
|
|
7142
7139
|
var auth_exports = {};
|
|
7143
7140
|
__export(auth_exports, {
|
|
7144
|
-
API_ROUTES: () => API_ROUTES,
|
|
7145
|
-
BaseApiClient: () => BaseApiClient,
|
|
7146
|
-
STORAGE_KEYS: () => STORAGE_KEYS,
|
|
7147
7141
|
createSa2kitAuthClient: () => createSa2kitAuthClient,
|
|
7148
|
-
useAuth: () => useAuth,
|
|
7149
|
-
useAuthForm: () => useAuthForm,
|
|
7150
7142
|
useSession: () => useSession
|
|
7151
7143
|
});
|
|
7152
7144
|
function buildSa2kitAuthClient(options) {
|
|
@@ -7160,395 +7152,10 @@ function createSa2kitAuthClient(options) {
|
|
|
7160
7152
|
return buildSa2kitAuthClient(options);
|
|
7161
7153
|
}
|
|
7162
7154
|
|
|
7163
|
-
// src/common/auth/client/types.ts
|
|
7164
|
-
var STORAGE_KEYS = {
|
|
7165
|
-
AUTH_TOKEN: "auth_token",
|
|
7166
|
-
USER_DATA: "user_data"
|
|
7167
|
-
};
|
|
7168
|
-
var API_ROUTES = {
|
|
7169
|
-
AUTH: {
|
|
7170
|
-
LOGIN: "/auth/login",
|
|
7171
|
-
REGISTER: "/auth/register",
|
|
7172
|
-
LOGOUT: "/auth/logout",
|
|
7173
|
-
ME: "/auth/me"
|
|
7174
|
-
}
|
|
7175
|
-
};
|
|
7176
|
-
|
|
7177
|
-
// src/common/auth/client/base-api-client.ts
|
|
7178
|
-
var BaseApiClient = class {
|
|
7179
|
-
constructor(storage, request, baseUrl) {
|
|
7180
|
-
this.storage = storage;
|
|
7181
|
-
this.request = request;
|
|
7182
|
-
this.baseUrl = baseUrl;
|
|
7183
|
-
this.token = null;
|
|
7184
|
-
this.user = null;
|
|
7185
|
-
}
|
|
7186
|
-
/**
|
|
7187
|
-
* 初始化 - 从存储中加载 token 和用户信息
|
|
7188
|
-
*/
|
|
7189
|
-
async init() {
|
|
7190
|
-
try {
|
|
7191
|
-
this.token = await this.storage.getItem(STORAGE_KEYS.AUTH_TOKEN);
|
|
7192
|
-
const userData = await this.storage.getItem(STORAGE_KEYS.USER_DATA);
|
|
7193
|
-
if (userData) {
|
|
7194
|
-
this.user = JSON.parse(userData);
|
|
7195
|
-
}
|
|
7196
|
-
} catch (error) {
|
|
7197
|
-
console.error("Failed to load auth data:", error);
|
|
7198
|
-
}
|
|
7199
|
-
}
|
|
7200
|
-
/**
|
|
7201
|
-
* 设置认证 token
|
|
7202
|
-
*/
|
|
7203
|
-
async setToken(token) {
|
|
7204
|
-
this.token = token;
|
|
7205
|
-
if (token) {
|
|
7206
|
-
await this.storage.setItem(STORAGE_KEYS.AUTH_TOKEN, token);
|
|
7207
|
-
} else {
|
|
7208
|
-
await this.storage.removeItem(STORAGE_KEYS.AUTH_TOKEN);
|
|
7209
|
-
}
|
|
7210
|
-
}
|
|
7211
|
-
/**
|
|
7212
|
-
* 设置用户信息
|
|
7213
|
-
*/
|
|
7214
|
-
async setUser(user2) {
|
|
7215
|
-
this.user = user2;
|
|
7216
|
-
if (user2) {
|
|
7217
|
-
await this.storage.setItem(STORAGE_KEYS.USER_DATA, JSON.stringify(user2));
|
|
7218
|
-
} else {
|
|
7219
|
-
await this.storage.removeItem(STORAGE_KEYS.USER_DATA);
|
|
7220
|
-
}
|
|
7221
|
-
}
|
|
7222
|
-
/**
|
|
7223
|
-
* 获取当前 token
|
|
7224
|
-
*/
|
|
7225
|
-
getToken() {
|
|
7226
|
-
return this.token;
|
|
7227
|
-
}
|
|
7228
|
-
/**
|
|
7229
|
-
* 获取当前用户
|
|
7230
|
-
*/
|
|
7231
|
-
getUser() {
|
|
7232
|
-
return this.user;
|
|
7233
|
-
}
|
|
7234
|
-
/**
|
|
7235
|
-
* 检查是否已登录
|
|
7236
|
-
*/
|
|
7237
|
-
async isAuthenticated() {
|
|
7238
|
-
return !!this.token;
|
|
7239
|
-
}
|
|
7240
|
-
/**
|
|
7241
|
-
* 清除用户数据
|
|
7242
|
-
*/
|
|
7243
|
-
async clearUserData() {
|
|
7244
|
-
await this.storage.removeItem(STORAGE_KEYS.AUTH_TOKEN);
|
|
7245
|
-
await this.storage.removeItem(STORAGE_KEYS.USER_DATA);
|
|
7246
|
-
this.token = null;
|
|
7247
|
-
this.user = null;
|
|
7248
|
-
}
|
|
7249
|
-
/**
|
|
7250
|
-
* 发送请求的通用方法
|
|
7251
|
-
*/
|
|
7252
|
-
async sendRequest(config) {
|
|
7253
|
-
try {
|
|
7254
|
-
const headers = {
|
|
7255
|
-
"Content-Type": "application/json",
|
|
7256
|
-
...config.headers || {}
|
|
7257
|
-
};
|
|
7258
|
-
if (this.token) {
|
|
7259
|
-
headers["Authorization"] = "Bearer " + this.token;
|
|
7260
|
-
}
|
|
7261
|
-
const response = await this.request.request({
|
|
7262
|
-
...config,
|
|
7263
|
-
url: this.baseUrl + config.url,
|
|
7264
|
-
headers
|
|
7265
|
-
});
|
|
7266
|
-
return response;
|
|
7267
|
-
} catch (error) {
|
|
7268
|
-
console.error("API request error:", error);
|
|
7269
|
-
return {
|
|
7270
|
-
success: false,
|
|
7271
|
-
error: error instanceof Error ? error.message : "\u7F51\u7EDC\u9519\u8BEF\uFF0C\u8BF7\u91CD\u8BD5"
|
|
7272
|
-
};
|
|
7273
|
-
}
|
|
7274
|
-
}
|
|
7275
|
-
// ==================== 认证相关 API ====================
|
|
7276
|
-
/**
|
|
7277
|
-
* 用户注册
|
|
7278
|
-
*/
|
|
7279
|
-
async register(email, password, username) {
|
|
7280
|
-
const response = await this.sendRequest({
|
|
7281
|
-
url: API_ROUTES.AUTH.REGISTER,
|
|
7282
|
-
method: "POST",
|
|
7283
|
-
body: { email, password, username }
|
|
7284
|
-
});
|
|
7285
|
-
if (response.success && response.data) {
|
|
7286
|
-
await this.setToken(response.data.token);
|
|
7287
|
-
await this.setUser(response.data.user);
|
|
7288
|
-
}
|
|
7289
|
-
return response;
|
|
7290
|
-
}
|
|
7291
|
-
/**
|
|
7292
|
-
* 用户登录
|
|
7293
|
-
*/
|
|
7294
|
-
async login(email, password) {
|
|
7295
|
-
const response = await this.sendRequest({
|
|
7296
|
-
url: API_ROUTES.AUTH.LOGIN,
|
|
7297
|
-
method: "POST",
|
|
7298
|
-
body: { email, password }
|
|
7299
|
-
});
|
|
7300
|
-
if (response.success && response.data) {
|
|
7301
|
-
await this.setToken(response.data.token);
|
|
7302
|
-
await this.setUser(response.data.user);
|
|
7303
|
-
if (typeof window !== "undefined") {
|
|
7304
|
-
window.dispatchEvent(
|
|
7305
|
-
new CustomEvent("user_login_success", {
|
|
7306
|
-
detail: {
|
|
7307
|
-
userId: response.data.user.id,
|
|
7308
|
-
email: response.data.user.email,
|
|
7309
|
-
role: response.data.user.role
|
|
7310
|
-
}
|
|
7311
|
-
})
|
|
7312
|
-
);
|
|
7313
|
-
}
|
|
7314
|
-
}
|
|
7315
|
-
return response;
|
|
7316
|
-
}
|
|
7317
|
-
/**
|
|
7318
|
-
* 用户退出登录
|
|
7319
|
-
*/
|
|
7320
|
-
async logout() {
|
|
7321
|
-
await this.sendRequest({
|
|
7322
|
-
url: API_ROUTES.AUTH.LOGOUT,
|
|
7323
|
-
method: "POST"
|
|
7324
|
-
});
|
|
7325
|
-
await this.clearUserData();
|
|
7326
|
-
}
|
|
7327
|
-
/**
|
|
7328
|
-
* 获取当前用户信息
|
|
7329
|
-
*/
|
|
7330
|
-
async getCurrentUser() {
|
|
7331
|
-
const response = await this.sendRequest({
|
|
7332
|
-
url: API_ROUTES.AUTH.ME,
|
|
7333
|
-
method: "GET"
|
|
7334
|
-
});
|
|
7335
|
-
if (response.success && response.data) {
|
|
7336
|
-
const userData = response.data.user || response.data;
|
|
7337
|
-
await this.setUser(userData);
|
|
7338
|
-
return {
|
|
7339
|
-
...response,
|
|
7340
|
-
data: userData
|
|
7341
|
-
};
|
|
7342
|
-
}
|
|
7343
|
-
return response;
|
|
7344
|
-
}
|
|
7345
|
-
// ==================== 通用方法 ====================
|
|
7346
|
-
/**
|
|
7347
|
-
* 发送 GET 请求
|
|
7348
|
-
*/
|
|
7349
|
-
async get(url, params) {
|
|
7350
|
-
return this.sendRequest({ url, method: "GET", params });
|
|
7351
|
-
}
|
|
7352
|
-
/**
|
|
7353
|
-
* 发送 POST 请求
|
|
7354
|
-
*/
|
|
7355
|
-
async post(url, body) {
|
|
7356
|
-
return this.sendRequest({ url, method: "POST", body });
|
|
7357
|
-
}
|
|
7358
|
-
/**
|
|
7359
|
-
* 发送 PUT 请求
|
|
7360
|
-
*/
|
|
7361
|
-
async put(url, body) {
|
|
7362
|
-
return this.sendRequest({ url, method: "PUT", body });
|
|
7363
|
-
}
|
|
7364
|
-
/**
|
|
7365
|
-
* 发送 DELETE 请求
|
|
7366
|
-
*/
|
|
7367
|
-
async delete(url) {
|
|
7368
|
-
return this.sendRequest({ url, method: "DELETE" });
|
|
7369
|
-
}
|
|
7370
|
-
};
|
|
7371
|
-
|
|
7372
7155
|
// src/common/auth/hooks/useSession.ts
|
|
7373
7156
|
function useSession(authClient) {
|
|
7374
7157
|
return authClient.useSession();
|
|
7375
7158
|
}
|
|
7376
|
-
function useAuth(apiClient) {
|
|
7377
|
-
const [user2, setUser] = React45.useState(null);
|
|
7378
|
-
const [isLoggedIn, setIsLoggedIn] = React45.useState(false);
|
|
7379
|
-
const [loading, setLoading] = React45.useState(false);
|
|
7380
|
-
const [checkingAuth, setCheckingAuth] = React45.useState(true);
|
|
7381
|
-
const [error, setError] = React45.useState(null);
|
|
7382
|
-
const checkAuthStatus = React45.useCallback(async () => {
|
|
7383
|
-
try {
|
|
7384
|
-
setCheckingAuth(true);
|
|
7385
|
-
setError(null);
|
|
7386
|
-
const isAuth = await apiClient.isAuthenticated();
|
|
7387
|
-
if (isAuth) {
|
|
7388
|
-
const response = await apiClient.getCurrentUser();
|
|
7389
|
-
if (response.success && response.data) {
|
|
7390
|
-
setUser(response.data);
|
|
7391
|
-
setIsLoggedIn(true);
|
|
7392
|
-
} else {
|
|
7393
|
-
await apiClient.clearUserData();
|
|
7394
|
-
setUser(null);
|
|
7395
|
-
setIsLoggedIn(false);
|
|
7396
|
-
}
|
|
7397
|
-
} else {
|
|
7398
|
-
setUser(null);
|
|
7399
|
-
setIsLoggedIn(false);
|
|
7400
|
-
}
|
|
7401
|
-
} catch (err) {
|
|
7402
|
-
console.error("\u68C0\u67E5\u767B\u5F55\u72B6\u6001\u5931\u8D25:", err);
|
|
7403
|
-
setError(err instanceof Error ? err.message : "\u68C0\u67E5\u767B\u5F55\u72B6\u6001\u5931\u8D25");
|
|
7404
|
-
setUser(null);
|
|
7405
|
-
setIsLoggedIn(false);
|
|
7406
|
-
} finally {
|
|
7407
|
-
setCheckingAuth(false);
|
|
7408
|
-
}
|
|
7409
|
-
}, [apiClient]);
|
|
7410
|
-
const login = React45.useCallback(
|
|
7411
|
-
async (email, password) => {
|
|
7412
|
-
setLoading(true);
|
|
7413
|
-
setError(null);
|
|
7414
|
-
try {
|
|
7415
|
-
const response = await apiClient.login(email, password);
|
|
7416
|
-
if (response.success && response.data) {
|
|
7417
|
-
setUser(response.data.user);
|
|
7418
|
-
setIsLoggedIn(true);
|
|
7419
|
-
return { success: true };
|
|
7420
|
-
} else {
|
|
7421
|
-
const errorMsg = response.error || "\u767B\u5F55\u5931\u8D25";
|
|
7422
|
-
setError(errorMsg);
|
|
7423
|
-
return { success: false, error: errorMsg };
|
|
7424
|
-
}
|
|
7425
|
-
} catch (err) {
|
|
7426
|
-
const errorMsg = err instanceof Error ? err.message : "\u767B\u5F55\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5";
|
|
7427
|
-
setError(errorMsg);
|
|
7428
|
-
return { success: false, error: errorMsg };
|
|
7429
|
-
} finally {
|
|
7430
|
-
setLoading(false);
|
|
7431
|
-
}
|
|
7432
|
-
},
|
|
7433
|
-
[apiClient]
|
|
7434
|
-
);
|
|
7435
|
-
const register = React45.useCallback(
|
|
7436
|
-
async (email, password, username) => {
|
|
7437
|
-
setLoading(true);
|
|
7438
|
-
setError(null);
|
|
7439
|
-
try {
|
|
7440
|
-
const response = await apiClient.register(email, password, username);
|
|
7441
|
-
if (response.success && response.data) {
|
|
7442
|
-
setUser(response.data.user);
|
|
7443
|
-
setIsLoggedIn(true);
|
|
7444
|
-
return { success: true };
|
|
7445
|
-
} else {
|
|
7446
|
-
const errorMsg = response.error || "\u6CE8\u518C\u5931\u8D25";
|
|
7447
|
-
setError(errorMsg);
|
|
7448
|
-
return { success: false, error: errorMsg };
|
|
7449
|
-
}
|
|
7450
|
-
} catch (err) {
|
|
7451
|
-
const errorMsg = err instanceof Error ? err.message : "\u6CE8\u518C\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5";
|
|
7452
|
-
setError(errorMsg);
|
|
7453
|
-
return { success: false, error: errorMsg };
|
|
7454
|
-
} finally {
|
|
7455
|
-
setLoading(false);
|
|
7456
|
-
}
|
|
7457
|
-
},
|
|
7458
|
-
[apiClient]
|
|
7459
|
-
);
|
|
7460
|
-
const logout = React45.useCallback(async () => {
|
|
7461
|
-
setLoading(true);
|
|
7462
|
-
setError(null);
|
|
7463
|
-
try {
|
|
7464
|
-
await apiClient.logout();
|
|
7465
|
-
setUser(null);
|
|
7466
|
-
setIsLoggedIn(false);
|
|
7467
|
-
} catch (err) {
|
|
7468
|
-
console.error("\u767B\u51FA\u5931\u8D25:", err);
|
|
7469
|
-
setError(err instanceof Error ? err.message : "\u767B\u51FA\u5931\u8D25");
|
|
7470
|
-
setUser(null);
|
|
7471
|
-
setIsLoggedIn(false);
|
|
7472
|
-
} finally {
|
|
7473
|
-
setLoading(false);
|
|
7474
|
-
}
|
|
7475
|
-
}, [apiClient]);
|
|
7476
|
-
const clearError = React45.useCallback(() => {
|
|
7477
|
-
setError(null);
|
|
7478
|
-
}, []);
|
|
7479
|
-
React45.useEffect(() => {
|
|
7480
|
-
checkAuthStatus();
|
|
7481
|
-
}, [checkAuthStatus]);
|
|
7482
|
-
return {
|
|
7483
|
-
// 状态
|
|
7484
|
-
user: user2,
|
|
7485
|
-
isLoggedIn,
|
|
7486
|
-
loading,
|
|
7487
|
-
checkingAuth,
|
|
7488
|
-
error,
|
|
7489
|
-
// 操作方法
|
|
7490
|
-
login,
|
|
7491
|
-
register,
|
|
7492
|
-
logout,
|
|
7493
|
-
refresh: checkAuthStatus,
|
|
7494
|
-
clearError
|
|
7495
|
-
};
|
|
7496
|
-
}
|
|
7497
|
-
function useAuthForm(initialValues) {
|
|
7498
|
-
const [values, setValues] = React45.useState(initialValues);
|
|
7499
|
-
const [errors, setErrors] = React45.useState({});
|
|
7500
|
-
const [touched, setTouched] = React45.useState({});
|
|
7501
|
-
const handleChange = React45.useCallback(
|
|
7502
|
-
(field, value) => {
|
|
7503
|
-
setValues((prev) => ({ ...prev, [field]: value }));
|
|
7504
|
-
if (errors[field]) {
|
|
7505
|
-
setErrors((prev) => {
|
|
7506
|
-
const newErrors = { ...prev };
|
|
7507
|
-
delete newErrors[field];
|
|
7508
|
-
return newErrors;
|
|
7509
|
-
});
|
|
7510
|
-
}
|
|
7511
|
-
},
|
|
7512
|
-
[errors]
|
|
7513
|
-
);
|
|
7514
|
-
const handleBlur = React45.useCallback((field) => {
|
|
7515
|
-
setTouched((prev) => ({ ...prev, [field]: true }));
|
|
7516
|
-
}, []);
|
|
7517
|
-
const validate = React45.useCallback(
|
|
7518
|
-
(validationRules) => {
|
|
7519
|
-
const newErrors = {};
|
|
7520
|
-
Object.keys(validationRules).forEach((key) => {
|
|
7521
|
-
const field = key;
|
|
7522
|
-
const rule = validationRules[field];
|
|
7523
|
-
if (rule) {
|
|
7524
|
-
const error = rule(values[field]);
|
|
7525
|
-
if (error) {
|
|
7526
|
-
newErrors[field] = error;
|
|
7527
|
-
}
|
|
7528
|
-
}
|
|
7529
|
-
});
|
|
7530
|
-
setErrors(newErrors);
|
|
7531
|
-
return Object.keys(newErrors).length === 0;
|
|
7532
|
-
},
|
|
7533
|
-
[values]
|
|
7534
|
-
);
|
|
7535
|
-
const reset = React45.useCallback(() => {
|
|
7536
|
-
setValues(initialValues);
|
|
7537
|
-
setErrors({});
|
|
7538
|
-
setTouched({});
|
|
7539
|
-
}, [initialValues]);
|
|
7540
|
-
return {
|
|
7541
|
-
values,
|
|
7542
|
-
errors,
|
|
7543
|
-
touched,
|
|
7544
|
-
handleChange,
|
|
7545
|
-
handleBlur,
|
|
7546
|
-
validate,
|
|
7547
|
-
reset,
|
|
7548
|
-
setValues,
|
|
7549
|
-
setErrors
|
|
7550
|
-
};
|
|
7551
|
-
}
|
|
7552
7159
|
|
|
7553
7160
|
// src/common/platform/index.ts
|
|
7554
7161
|
var platform_exports = {};
|
|
@@ -9337,9 +8944,9 @@ function mergeEventProperties(baseProperties, ...additionalProperties) {
|
|
|
9337
8944
|
return Object.assign({}, baseProperties, ...additionalProperties);
|
|
9338
8945
|
}
|
|
9339
8946
|
function generateUniqueId(prefix = "") {
|
|
9340
|
-
const
|
|
8947
|
+
const timestamp2 = Date.now();
|
|
9341
8948
|
const random = Math.random().toString(36).substring(2, 15);
|
|
9342
|
-
return prefix ? prefix + "_" +
|
|
8949
|
+
return prefix ? prefix + "_" + timestamp2 + "_" + random : timestamp2 + "_" + random;
|
|
9343
8950
|
}
|
|
9344
8951
|
function isMobile() {
|
|
9345
8952
|
if (typeof navigator === "undefined") return false;
|
|
@@ -9348,8 +8955,8 @@ function isMobile() {
|
|
|
9348
8955
|
function isDevelopment() {
|
|
9349
8956
|
return process.env.NODE_ENV === "development";
|
|
9350
8957
|
}
|
|
9351
|
-
function formatTimestamp(
|
|
9352
|
-
const date = new Date(
|
|
8958
|
+
function formatTimestamp(timestamp2, format = "datetime") {
|
|
8959
|
+
const date = new Date(timestamp2);
|
|
9353
8960
|
switch (format) {
|
|
9354
8961
|
case "date":
|
|
9355
8962
|
return date.toLocaleDateString();
|
|
@@ -9986,9 +9593,9 @@ var MobileDeviceAdapter = class {
|
|
|
9986
9593
|
}
|
|
9987
9594
|
}
|
|
9988
9595
|
async generateDeviceId() {
|
|
9989
|
-
const
|
|
9596
|
+
const timestamp2 = Date.now();
|
|
9990
9597
|
const random = Math.random().toString(36).substring(2, 15);
|
|
9991
|
-
return "mobile_" +
|
|
9598
|
+
return "mobile_" + timestamp2 + "_" + random;
|
|
9992
9599
|
}
|
|
9993
9600
|
getDefaultDeviceInfo() {
|
|
9994
9601
|
return {
|
|
@@ -10168,9 +9775,9 @@ var MiniappDeviceAdapter = class {
|
|
|
10168
9775
|
}
|
|
10169
9776
|
}
|
|
10170
9777
|
async generateDeviceId() {
|
|
10171
|
-
const
|
|
9778
|
+
const timestamp2 = Date.now();
|
|
10172
9779
|
const random = Math.random().toString(36).substring(2, 15);
|
|
10173
|
-
return "miniapp_" +
|
|
9780
|
+
return "miniapp_" + timestamp2 + "_" + random;
|
|
10174
9781
|
}
|
|
10175
9782
|
getDefaultDeviceInfo() {
|
|
10176
9783
|
return {
|
|
@@ -10402,8 +10009,8 @@ var EventList = ({
|
|
|
10402
10009
|
};
|
|
10403
10010
|
return colors[eventType] || "bg-gray-100 text-gray-800";
|
|
10404
10011
|
};
|
|
10405
|
-
const formatTimestamp2 = (
|
|
10406
|
-
const date = new Date(
|
|
10012
|
+
const formatTimestamp2 = (timestamp2) => {
|
|
10013
|
+
const date = new Date(timestamp2);
|
|
10407
10014
|
const now = /* @__PURE__ */ new Date();
|
|
10408
10015
|
const diff = now.getTime() - date.getTime();
|
|
10409
10016
|
const minutes = Math.floor(diff / 6e4);
|
|
@@ -11157,7 +10764,7 @@ function invalidateAllConfigs(apiBaseUrl = "") {
|
|
|
11157
10764
|
// src/api/index.ts
|
|
11158
10765
|
var api_exports = {};
|
|
11159
10766
|
__export(api_exports, {
|
|
11160
|
-
BaseApiClient: () =>
|
|
10767
|
+
BaseApiClient: () => BaseApiClient,
|
|
11161
10768
|
DEFAULT_API_ROUTES: () => DEFAULT_API_ROUTES,
|
|
11162
10769
|
DEFAULT_STORAGE_KEYS: () => DEFAULT_STORAGE_KEYS
|
|
11163
10770
|
});
|
|
@@ -11184,7 +10791,7 @@ var DEFAULT_API_ROUTES = {
|
|
|
11184
10791
|
};
|
|
11185
10792
|
|
|
11186
10793
|
// src/api/BaseApiClient.ts
|
|
11187
|
-
var
|
|
10794
|
+
var BaseApiClient = class {
|
|
11188
10795
|
constructor(config) {
|
|
11189
10796
|
this.token = null;
|
|
11190
10797
|
this.user = null;
|
|
@@ -11236,10 +10843,10 @@ var BaseApiClient2 = class {
|
|
|
11236
10843
|
/**
|
|
11237
10844
|
* 设置用户信息
|
|
11238
10845
|
*/
|
|
11239
|
-
async setUser(
|
|
11240
|
-
this.user =
|
|
11241
|
-
if (
|
|
11242
|
-
await this.storage.setItem(this.storageKeys.USER_DATA, JSON.stringify(
|
|
10846
|
+
async setUser(user) {
|
|
10847
|
+
this.user = user;
|
|
10848
|
+
if (user) {
|
|
10849
|
+
await this.storage.setItem(this.storageKeys.USER_DATA, JSON.stringify(user));
|
|
11243
10850
|
} else {
|
|
11244
10851
|
await this.storage.removeItem(this.storageKeys.USER_DATA);
|
|
11245
10852
|
}
|
|
@@ -12951,82 +12558,26 @@ var DraggableExperimentGrid = ({
|
|
|
12951
12558
|
)
|
|
12952
12559
|
));
|
|
12953
12560
|
};
|
|
12954
|
-
|
|
12955
|
-
|
|
12956
|
-
|
|
12957
|
-
|
|
12958
|
-
|
|
12959
|
-
|
|
12960
|
-
|
|
12961
|
-
|
|
12962
|
-
|
|
12963
|
-
|
|
12964
|
-
|
|
12965
|
-
|
|
12966
|
-
});
|
|
12967
|
-
var session = pgCore.pgTable("session", {
|
|
12968
|
-
id: pgCore.text("id").primaryKey().notNull(),
|
|
12969
|
-
userId: pgCore.text("userId").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
12970
|
-
token: pgCore.text("token").notNull(),
|
|
12971
|
-
expiresAt: pgCore.timestamp("expiresAt", { precision: 3, mode: "date" }).notNull(),
|
|
12972
|
-
ipAddress: pgCore.text("ipAddress"),
|
|
12973
|
-
userAgent: pgCore.text("userAgent"),
|
|
12974
|
-
createdAt: pgCore.timestamp("createdAt", { precision: 3, mode: "date" }).default(drizzleOrm.sql`CURRENT_TIMESTAMP`).notNull(),
|
|
12975
|
-
updatedAt: pgCore.timestamp("updatedAt", { precision: 3, mode: "date" }).default(drizzleOrm.sql`CURRENT_TIMESTAMP`).notNull()
|
|
12976
|
-
});
|
|
12977
|
-
var account = pgCore.pgTable("account", {
|
|
12978
|
-
id: pgCore.text("id").primaryKey().notNull(),
|
|
12979
|
-
accountId: pgCore.text("accountId").notNull(),
|
|
12980
|
-
providerId: pgCore.text("providerId").notNull(),
|
|
12981
|
-
userId: pgCore.text("userId").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
12982
|
-
accessToken: pgCore.text("accessToken"),
|
|
12983
|
-
refreshToken: pgCore.text("refreshToken"),
|
|
12984
|
-
idToken: pgCore.text("idToken"),
|
|
12985
|
-
accessTokenExpiresAt: pgCore.timestamp("accessTokenExpiresAt", { precision: 3, mode: "date" }),
|
|
12986
|
-
refreshTokenExpiresAt: pgCore.timestamp("refreshTokenExpiresAt", { precision: 3, mode: "date" }),
|
|
12987
|
-
scope: pgCore.text("scope"),
|
|
12988
|
-
password: pgCore.text("password"),
|
|
12989
|
-
createdAt: pgCore.timestamp("createdAt", { precision: 3, mode: "date" }).default(drizzleOrm.sql`CURRENT_TIMESTAMP`).notNull(),
|
|
12990
|
-
updatedAt: pgCore.timestamp("updatedAt", { precision: 3, mode: "date" }).default(drizzleOrm.sql`CURRENT_TIMESTAMP`).notNull()
|
|
12991
|
-
});
|
|
12992
|
-
pgCore.pgTable("verification", {
|
|
12993
|
-
id: pgCore.text("id").primaryKey().notNull(),
|
|
12994
|
-
identifier: pgCore.text("identifier").notNull(),
|
|
12995
|
-
value: pgCore.text("value").notNull(),
|
|
12996
|
-
expiresAt: pgCore.timestamp("expiresAt", { precision: 3, mode: "date" }).notNull(),
|
|
12997
|
-
createdAt: pgCore.timestamp("createdAt", { precision: 3, mode: "date" }).default(drizzleOrm.sql`CURRENT_TIMESTAMP`).notNull(),
|
|
12998
|
-
updatedAt: pgCore.timestamp("updatedAt", { precision: 3, mode: "date" }).default(drizzleOrm.sql`CURRENT_TIMESTAMP`).notNull()
|
|
12999
|
-
});
|
|
13000
|
-
drizzleOrm.relations(user, ({ many }) => ({
|
|
13001
|
-
sessions: many(session),
|
|
13002
|
-
accounts: many(account)
|
|
13003
|
-
}));
|
|
13004
|
-
drizzleOrm.relations(session, ({ one }) => ({
|
|
13005
|
-
user: one(user, {
|
|
13006
|
-
fields: [session.userId],
|
|
13007
|
-
references: [user.id]
|
|
13008
|
-
})
|
|
13009
|
-
}));
|
|
13010
|
-
drizzleOrm.relations(account, ({ one }) => ({
|
|
13011
|
-
user: one(user, {
|
|
13012
|
-
fields: [account.userId],
|
|
13013
|
-
references: [user.id]
|
|
13014
|
-
})
|
|
13015
|
-
}));
|
|
13016
|
-
var PermissionGuard = ({
|
|
13017
|
-
apiClient,
|
|
13018
|
-
children,
|
|
13019
|
-
fallback
|
|
13020
|
-
}) => {
|
|
13021
|
-
const { user: user2, isLoggedIn } = useAuth(apiClient);
|
|
12561
|
+
|
|
12562
|
+
// src/common/auth/context/AuthProvider.tsx
|
|
12563
|
+
var AuthContext = React45.createContext(null);
|
|
12564
|
+
function useAuthContext() {
|
|
12565
|
+
const ctx = React45.useContext(AuthContext);
|
|
12566
|
+
if (!ctx) {
|
|
12567
|
+
throw new Error("useAuthContext \u5FC5\u987B\u5728 AuthProvider \u5185\u4F7F\u7528");
|
|
12568
|
+
}
|
|
12569
|
+
return ctx;
|
|
12570
|
+
}
|
|
12571
|
+
var PermissionGuard = ({ children, fallback }) => {
|
|
12572
|
+
const { user, isAuthenticated } = useAuthContext();
|
|
13022
12573
|
const hasPermission = () => {
|
|
13023
|
-
if (!
|
|
12574
|
+
if (!isAuthenticated || !user) {
|
|
13024
12575
|
return false;
|
|
13025
12576
|
}
|
|
13026
12577
|
return true;
|
|
13027
12578
|
};
|
|
13028
12579
|
if (!hasPermission()) {
|
|
13029
|
-
return fallback
|
|
12580
|
+
return fallback ?? /* @__PURE__ */ React45__namespace.default.createElement("div", { className: "min-h-screen bg-gray-50 flex items-center justify-center" }, /* @__PURE__ */ React45__namespace.default.createElement("div", { className: "max-w-md w-full bg-white rounded-lg shadow-lg p-8 text-center" }, /* @__PURE__ */ React45__namespace.default.createElement("div", { className: "flex items-center justify-center mb-4" }, /* @__PURE__ */ React45__namespace.default.createElement(lucideReact.Shield, { className: "w-12 h-12 text-red-500" })), /* @__PURE__ */ React45__namespace.default.createElement("h2", { className: "text-xl font-semibold text-gray-900 mb-2" }, "\u9700\u8981\u767B\u5F55"), /* @__PURE__ */ React45__namespace.default.createElement("p", { className: "text-gray-600 mb-4" }, "\u8BF7\u5148\u767B\u5F55\u4EE5\u8BBF\u95EE\u5B9E\u9A8C\u7530\u529F\u80FD\u3002"), /* @__PURE__ */ React45__namespace.default.createElement("div", { className: "flex items-center justify-center text-sm text-gray-500 mb-4" }, /* @__PURE__ */ React45__namespace.default.createElement(lucideReact.AlertTriangle, { className: "w-4 h-4 mr-1" }), "\u5B9E\u9A8C\u7530\u5BF9\u6240\u6709\u6CE8\u518C\u7528\u6237\u5F00\u653E"), /* @__PURE__ */ React45__namespace.default.createElement(
|
|
13030
12581
|
"button",
|
|
13031
12582
|
{
|
|
13032
12583
|
onClick: () => window.history.back(),
|
|
@@ -13037,20 +12588,20 @@ var PermissionGuard = ({
|
|
|
13037
12588
|
}
|
|
13038
12589
|
return /* @__PURE__ */ React45__namespace.default.createElement(React45__namespace.default.Fragment, null, children);
|
|
13039
12590
|
};
|
|
13040
|
-
var UserInfoBar = (
|
|
13041
|
-
const { user
|
|
12591
|
+
var UserInfoBar = () => {
|
|
12592
|
+
const { user, signOut, isAuthenticated } = useAuthContext();
|
|
13042
12593
|
const handleLogout = async () => {
|
|
13043
12594
|
try {
|
|
13044
|
-
await
|
|
12595
|
+
await signOut();
|
|
13045
12596
|
window.location.href = "/";
|
|
13046
12597
|
} catch (error) {
|
|
13047
12598
|
console.error("\u767B\u51FA\u5931\u8D25:", error);
|
|
13048
12599
|
}
|
|
13049
12600
|
};
|
|
13050
|
-
if (!
|
|
12601
|
+
if (!isAuthenticated || !user) {
|
|
13051
12602
|
return null;
|
|
13052
12603
|
}
|
|
13053
|
-
return /* @__PURE__ */ React45__namespace.default.createElement("div", { className: "bg-white border-b border-gray-200 px-4 py-3" }, /* @__PURE__ */ React45__namespace.default.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React45__namespace.default.createElement("div", { className: "flex items-center space-x-3" }, /* @__PURE__ */ React45__namespace.default.createElement("div", { className: "flex items-center space-x-2" }, /* @__PURE__ */ React45__namespace.default.createElement(lucideReact.User, { className: "w-5 h-5 text-gray-600" }), /* @__PURE__ */ React45__namespace.default.createElement("span", { className: "text-sm font-medium text-gray-900" },
|
|
12604
|
+
return /* @__PURE__ */ React45__namespace.default.createElement("div", { className: "bg-white border-b border-gray-200 px-4 py-3" }, /* @__PURE__ */ React45__namespace.default.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React45__namespace.default.createElement("div", { className: "flex items-center space-x-3" }, /* @__PURE__ */ React45__namespace.default.createElement("div", { className: "flex items-center space-x-2" }, /* @__PURE__ */ React45__namespace.default.createElement(lucideReact.User, { className: "w-5 h-5 text-gray-600" }), /* @__PURE__ */ React45__namespace.default.createElement("span", { className: "text-sm font-medium text-gray-900" }, user.name || user.email || "\u7528\u6237"), user.role && /* @__PURE__ */ React45__namespace.default.createElement("span", { className: "inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800" }, user.role))), /* @__PURE__ */ React45__namespace.default.createElement("div", { className: "flex items-center space-x-2" }, /* @__PURE__ */ React45__namespace.default.createElement("div", { className: "flex items-center space-x-1 text-sm text-gray-500" }, /* @__PURE__ */ React45__namespace.default.createElement(lucideReact.FlaskConical, { className: "w-4 h-4" }), /* @__PURE__ */ React45__namespace.default.createElement("span", null, "\u5B9E\u9A8C\u7530")), /* @__PURE__ */ React45__namespace.default.createElement(
|
|
13054
12605
|
"button",
|
|
13055
12606
|
{
|
|
13056
12607
|
onClick: handleLogout,
|
|
@@ -13061,9 +12612,9 @@ var UserInfoBar = ({ apiClient }) => {
|
|
|
13061
12612
|
))));
|
|
13062
12613
|
};
|
|
13063
12614
|
function DanmakuPanel({ onSend }) {
|
|
13064
|
-
const [
|
|
12615
|
+
const [text2, setText] = React45.useState("");
|
|
13065
12616
|
const emit = () => {
|
|
13066
|
-
const value =
|
|
12617
|
+
const value = text2.trim();
|
|
13067
12618
|
if (!value) {
|
|
13068
12619
|
return;
|
|
13069
12620
|
}
|
|
@@ -13074,7 +12625,7 @@ function DanmakuPanel({ onSend }) {
|
|
|
13074
12625
|
"input",
|
|
13075
12626
|
{
|
|
13076
12627
|
type: "text",
|
|
13077
|
-
value:
|
|
12628
|
+
value: text2,
|
|
13078
12629
|
onChange: (event) => setText(event.target.value),
|
|
13079
12630
|
onKeyDown: (event) => {
|
|
13080
12631
|
if (event.key === "Enter") {
|
|
@@ -13190,8 +12741,8 @@ function useDanmakuController(options) {
|
|
|
13190
12741
|
cursorRef.current += 1;
|
|
13191
12742
|
}, []);
|
|
13192
12743
|
const send = React45.useCallback(
|
|
13193
|
-
(
|
|
13194
|
-
const trimmed =
|
|
12744
|
+
(text2, color, sendOptions) => {
|
|
12745
|
+
const trimmed = text2.trim();
|
|
13195
12746
|
if (!trimmed) {
|
|
13196
12747
|
return null;
|
|
13197
12748
|
}
|
|
@@ -13228,26 +12779,26 @@ function useDanmakuController(options) {
|
|
|
13228
12779
|
[addIncoming, items, removeItem, send]
|
|
13229
12780
|
);
|
|
13230
12781
|
}
|
|
13231
|
-
function parseCommand(
|
|
13232
|
-
if (
|
|
13233
|
-
return { launchKind: "miku", content:
|
|
12782
|
+
function parseCommand(text2) {
|
|
12783
|
+
if (text2.startsWith("/miku ")) {
|
|
12784
|
+
return { launchKind: "miku", content: text2.replace("/miku ", "").trim() };
|
|
13234
12785
|
}
|
|
13235
|
-
if (
|
|
12786
|
+
if (text2 === "/miku") {
|
|
13236
12787
|
return { launchKind: "miku", content: "MIKU!" };
|
|
13237
12788
|
}
|
|
13238
|
-
if (
|
|
13239
|
-
return { launchKind: "avatar", content:
|
|
12789
|
+
if (text2.startsWith("/avatar ")) {
|
|
12790
|
+
return { launchKind: "avatar", content: text2.replace("/avatar ", "").trim() };
|
|
13240
12791
|
}
|
|
13241
|
-
if (
|
|
12792
|
+
if (text2 === "/avatar") {
|
|
13242
12793
|
return { launchKind: "avatar", content: "Avatar Firework!" };
|
|
13243
12794
|
}
|
|
13244
|
-
if (
|
|
13245
|
-
return { launchKind: "normal", content:
|
|
12795
|
+
if (text2.startsWith("/normal ")) {
|
|
12796
|
+
return { launchKind: "normal", content: text2.replace("/normal ", "").trim() };
|
|
13246
12797
|
}
|
|
13247
|
-
if (
|
|
12798
|
+
if (text2 === "/normal") {
|
|
13248
12799
|
return { launchKind: "normal", content: "Fireworks!" };
|
|
13249
12800
|
}
|
|
13250
|
-
return { content:
|
|
12801
|
+
return { content: text2 };
|
|
13251
12802
|
}
|
|
13252
12803
|
function createCircularSpriteTexture() {
|
|
13253
12804
|
const size = 64;
|
|
@@ -13929,12 +13480,12 @@ var WebSocketTransport = class {
|
|
|
13929
13480
|
}
|
|
13930
13481
|
};
|
|
13931
13482
|
function parseServerMessage(raw) {
|
|
13932
|
-
const
|
|
13933
|
-
if (!
|
|
13483
|
+
const text2 = decodeMessage(raw);
|
|
13484
|
+
if (!text2) {
|
|
13934
13485
|
return null;
|
|
13935
13486
|
}
|
|
13936
13487
|
try {
|
|
13937
|
-
return JSON.parse(
|
|
13488
|
+
return JSON.parse(text2);
|
|
13938
13489
|
} catch {
|
|
13939
13490
|
return null;
|
|
13940
13491
|
}
|
|
@@ -14201,8 +13752,8 @@ function MikuFireworks3D({
|
|
|
14201
13752
|
}
|
|
14202
13753
|
launch(payload);
|
|
14203
13754
|
};
|
|
14204
|
-
const handleSendDanmaku = (
|
|
14205
|
-
const result = send(
|
|
13755
|
+
const handleSendDanmaku = (text2) => {
|
|
13756
|
+
const result = send(text2, void 0, {
|
|
14206
13757
|
optimistic: !realtimeEnabled
|
|
14207
13758
|
});
|
|
14208
13759
|
if (!result) {
|
|
@@ -14301,9 +13852,9 @@ function useScreenReceiver(options) {
|
|
|
14301
13852
|
const peerRef = React45.useRef({ pendingCandidates: [] });
|
|
14302
13853
|
const videoRef = React45.useRef(null);
|
|
14303
13854
|
const appendLog = React45.useCallback(
|
|
14304
|
-
(
|
|
13855
|
+
(text2) => {
|
|
14305
13856
|
logIdRef.current += 1;
|
|
14306
|
-
setLogs((prev) => [...prev, { id: logIdRef.current, text:
|
|
13857
|
+
setLogs((prev) => [...prev, { id: logIdRef.current, text: text2 }].slice(-maxLogs));
|
|
14307
13858
|
},
|
|
14308
13859
|
[maxLogs]
|
|
14309
13860
|
);
|
|
@@ -15029,8 +14580,8 @@ var withRoundedClip = (ctx, left, top, width, height, radius, draw) => {
|
|
|
15029
14580
|
draw();
|
|
15030
14581
|
ctx.restore();
|
|
15031
14582
|
};
|
|
15032
|
-
var drawMultilineText = (ctx,
|
|
15033
|
-
const paragraphs =
|
|
14583
|
+
var drawMultilineText = (ctx, text2, left, top, maxWidth, lineHeight) => {
|
|
14584
|
+
const paragraphs = text2.split("\n");
|
|
15034
14585
|
let currentY = top;
|
|
15035
14586
|
paragraphs.forEach((paragraph, index) => {
|
|
15036
14587
|
const words = paragraph.split("");
|
|
@@ -16249,11 +15800,11 @@ var validateByType = (type, input) => {
|
|
|
16249
15800
|
break;
|
|
16250
15801
|
}
|
|
16251
15802
|
case "text": {
|
|
16252
|
-
const
|
|
16253
|
-
if (!
|
|
15803
|
+
const text2 = content.textContent || "";
|
|
15804
|
+
if (!text2.trim()) {
|
|
16254
15805
|
errors.push("\u6587\u5B57\u7C7B\u4F5C\u54C1\u9700\u586B\u5199\u6B63\u6587");
|
|
16255
15806
|
}
|
|
16256
|
-
if (
|
|
15807
|
+
if (text2.length > TEXT_CONTENT_LIMIT) {
|
|
16257
15808
|
errors.push(`\u6587\u5B57\u6B63\u6587\u4E0D\u80FD\u8D85\u8FC7 ${TEXT_CONTENT_LIMIT} \u5B57`);
|
|
16258
15809
|
}
|
|
16259
15810
|
break;
|