sa2kit 1.2.1 → 1.4.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.
Files changed (53) hide show
  1. package/dist/{UniversalFileService-C1rUWWU-.d.ts → UniversalFileService-BuHN-jrR.d.ts} +46 -2
  2. package/dist/{UniversalFileService-DrCK0-NL.d.mts → UniversalFileService-CGGzYeeF.d.mts} +46 -2
  3. package/dist/{chunk-3XG5OHFD.mjs → chunk-CIVO4R6N.mjs} +2 -2
  4. package/dist/{chunk-3XG5OHFD.mjs.map → chunk-CIVO4R6N.mjs.map} +1 -1
  5. package/dist/chunk-EV6BCVOQ.mjs +204 -0
  6. package/dist/chunk-EV6BCVOQ.mjs.map +1 -0
  7. package/dist/chunk-W35VTQAW.js +211 -0
  8. package/dist/chunk-W35VTQAW.js.map +1 -0
  9. package/dist/{chunk-HWJ34NL6.js → chunk-ZRAW3HXA.js} +2 -2
  10. package/dist/{chunk-HWJ34NL6.js.map → chunk-ZRAW3HXA.js.map} +1 -1
  11. package/dist/drizzle-schema-BNhqj2AZ.d.mts +1114 -0
  12. package/dist/drizzle-schema-BNhqj2AZ.d.ts +1114 -0
  13. package/dist/mmd/admin/index.d.mts +8 -1115
  14. package/dist/mmd/admin/index.d.ts +8 -1115
  15. package/dist/mmd/admin/index.js +98 -248
  16. package/dist/mmd/admin/index.js.map +1 -1
  17. package/dist/mmd/admin/index.mjs +75 -244
  18. package/dist/mmd/admin/index.mjs.map +1 -1
  19. package/dist/mmd/index.d.mts +265 -3
  20. package/dist/mmd/index.d.ts +265 -3
  21. package/dist/mmd/index.js +1266 -15
  22. package/dist/mmd/index.js.map +1 -1
  23. package/dist/mmd/index.mjs +1261 -16
  24. package/dist/mmd/index.mjs.map +1 -1
  25. package/dist/mmd/server/index.d.mts +138 -0
  26. package/dist/mmd/server/index.d.ts +138 -0
  27. package/dist/mmd/server/index.js +245 -0
  28. package/dist/mmd/server/index.js.map +1 -0
  29. package/dist/mmd/server/index.mjs +207 -0
  30. package/dist/mmd/server/index.mjs.map +1 -0
  31. package/dist/testYourself/index.d.mts +145 -0
  32. package/dist/testYourself/index.d.ts +145 -0
  33. package/dist/testYourself/index.js +1004 -0
  34. package/dist/testYourself/index.js.map +1 -0
  35. package/dist/testYourself/index.mjs +993 -0
  36. package/dist/testYourself/index.mjs.map +1 -0
  37. package/dist/{types-C2ale3d9.d.mts → types-Bc_p-zAR.d.mts} +1 -1
  38. package/dist/{types-C2ale3d9.d.ts → types-Bc_p-zAR.d.ts} +1 -1
  39. package/dist/{types-Dg-U_chI.d.mts → types-CK4We_aI.d.mts} +13 -1
  40. package/dist/{types-Dg-U_chI.d.ts → types-CK4We_aI.d.ts} +13 -1
  41. package/dist/universalFile/index.d.mts +3 -3
  42. package/dist/universalFile/index.d.ts +3 -3
  43. package/dist/universalFile/index.js +48 -10
  44. package/dist/universalFile/index.js.map +1 -1
  45. package/dist/universalFile/index.mjs +43 -5
  46. package/dist/universalFile/index.mjs.map +1 -1
  47. package/dist/universalFile/server/index.d.mts +3 -3
  48. package/dist/universalFile/server/index.d.ts +3 -3
  49. package/dist/universalFile/server/index.js +239 -7
  50. package/dist/universalFile/server/index.js.map +1 -1
  51. package/dist/universalFile/server/index.mjs +234 -2
  52. package/dist/universalFile/server/index.mjs.map +1 -1
  53. package/package.json +19 -1
@@ -0,0 +1,993 @@
1
+ import '../chunk-BJTO5JO5.mjs';
2
+ import React, { useState, useRef, useEffect } from 'react';
3
+
4
+ // src/testYourself/utils/fingerprint.ts
5
+ function getCanvasFingerprint() {
6
+ try {
7
+ const canvas = document.createElement("canvas");
8
+ const ctx = canvas.getContext("2d");
9
+ if (!ctx) return "no-canvas";
10
+ canvas.width = 200;
11
+ canvas.height = 50;
12
+ ctx.textBaseline = "top";
13
+ ctx.font = "14px Arial";
14
+ ctx.fillStyle = "#f60";
15
+ ctx.fillRect(0, 0, 200, 50);
16
+ ctx.fillStyle = "#069";
17
+ ctx.fillText("Canvas Fingerprint \u{1F3A8}", 2, 15);
18
+ return canvas.toDataURL();
19
+ } catch (error) {
20
+ return "canvas-error";
21
+ }
22
+ }
23
+ function getWebGLFingerprint() {
24
+ try {
25
+ const canvas = document.createElement("canvas");
26
+ const gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
27
+ if (!gl) return "no-webgl";
28
+ const glContext = gl;
29
+ const debugInfo = glContext.getExtension("WEBGL_debug_renderer_info");
30
+ if (debugInfo) {
31
+ const vendor = glContext.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);
32
+ const renderer = glContext.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
33
+ return `${vendor}~${renderer}`;
34
+ }
35
+ return "webgl-no-debug";
36
+ } catch (error) {
37
+ return "webgl-error";
38
+ }
39
+ }
40
+ function getAvailableFonts() {
41
+ const testFonts = [
42
+ "Arial",
43
+ "Verdana",
44
+ "Courier New",
45
+ "Georgia",
46
+ "Times New Roman",
47
+ "Comic Sans MS",
48
+ "Trebuchet MS",
49
+ "Arial Black",
50
+ "Impact",
51
+ "Courier",
52
+ "Helvetica",
53
+ "Monaco",
54
+ "Consolas",
55
+ "Menlo"
56
+ ];
57
+ const availableFonts = [];
58
+ const canvas = document.createElement("canvas");
59
+ const ctx = canvas.getContext("2d");
60
+ if (!ctx) return "no-fonts";
61
+ const baseFonts = ["monospace", "sans-serif", "serif"];
62
+ const testString = "mmmmmmmmmmlli";
63
+ const baseWidths = {};
64
+ baseFonts.forEach((font) => {
65
+ ctx.font = `72px ${font}`;
66
+ baseWidths[font] = ctx.measureText(testString).width;
67
+ });
68
+ testFonts.forEach((font) => {
69
+ let detected = false;
70
+ baseFonts.forEach((baseFont) => {
71
+ ctx.font = `72px ${font}, ${baseFont}`;
72
+ const width = ctx.measureText(testString).width;
73
+ if (width !== baseWidths[baseFont]) {
74
+ detected = true;
75
+ }
76
+ });
77
+ if (detected) {
78
+ availableFonts.push(font);
79
+ }
80
+ });
81
+ return availableFonts.join(",") || "no-custom-fonts";
82
+ }
83
+ function getDeviceFingerprint() {
84
+ const fingerprint = {
85
+ // 基础信息
86
+ userAgent: navigator.userAgent,
87
+ screenResolution: `${window.screen.width}x${window.screen.height}`,
88
+ timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
89
+ language: navigator.language,
90
+ platform: navigator.platform,
91
+ // 显示信息
92
+ colorDepth: window.screen.colorDepth,
93
+ devicePixelRatio: window.devicePixelRatio,
94
+ // 硬件信息
95
+ hardwareConcurrency: navigator.hardwareConcurrency || 0,
96
+ maxTouchPoints: navigator.maxTouchPoints || 0,
97
+ // Canvas和WebGL指纹
98
+ canvasFingerprint: getCanvasFingerprint(),
99
+ webglFingerprint: getWebGLFingerprint(),
100
+ // 字体检测
101
+ fonts: getAvailableFonts(),
102
+ // 浏览器能力
103
+ cookieEnabled: navigator.cookieEnabled,
104
+ localStorageEnabled: (() => {
105
+ try {
106
+ return typeof localStorage !== "undefined";
107
+ } catch {
108
+ return false;
109
+ }
110
+ })(),
111
+ sessionStorageEnabled: (() => {
112
+ try {
113
+ return typeof sessionStorage !== "undefined";
114
+ } catch {
115
+ return false;
116
+ }
117
+ })(),
118
+ indexedDBEnabled: (() => {
119
+ try {
120
+ return typeof indexedDB !== "undefined";
121
+ } catch {
122
+ return false;
123
+ }
124
+ })()
125
+ };
126
+ return fingerprint;
127
+ }
128
+ async function tryGetIPAddress() {
129
+ try {
130
+ const response = await fetch("https://api.ipify.org?format=json", {
131
+ method: "GET",
132
+ mode: "cors"
133
+ });
134
+ if (response.ok) {
135
+ const data = await response.json();
136
+ return data.ip || null;
137
+ }
138
+ } catch (error) {
139
+ console.warn("\u65E0\u6CD5\u83B7\u53D6IP\u5730\u5740:", error);
140
+ }
141
+ return null;
142
+ }
143
+ function simpleHash(str) {
144
+ let hash = 5381;
145
+ for (let i = 0; i < str.length; i++) {
146
+ hash = (hash << 5) + hash + str.charCodeAt(i);
147
+ }
148
+ return Math.abs(hash);
149
+ }
150
+ function generateDeviceHash(fingerprint, salt = "test-yourself-salt-2024") {
151
+ const components = [
152
+ // 基础信息
153
+ fingerprint.userAgent,
154
+ fingerprint.ip || "no-ip",
155
+ fingerprint.screenResolution,
156
+ fingerprint.timezone,
157
+ fingerprint.language,
158
+ fingerprint.platform,
159
+ // 显示信息
160
+ fingerprint.colorDepth?.toString() || "0",
161
+ fingerprint.devicePixelRatio?.toString() || "0",
162
+ // 硬件信息
163
+ fingerprint.hardwareConcurrency?.toString() || "0",
164
+ fingerprint.maxTouchPoints?.toString() || "0",
165
+ // Canvas和WebGL指纹(这些是最独特的)
166
+ fingerprint.canvasFingerprint || "no-canvas",
167
+ fingerprint.webglFingerprint || "no-webgl",
168
+ // 字体(不同设备安装的字体不同)
169
+ fingerprint.fonts || "no-fonts",
170
+ // 浏览器能力
171
+ fingerprint.cookieEnabled ? "1" : "0",
172
+ fingerprint.localStorageEnabled ? "1" : "0",
173
+ fingerprint.sessionStorageEnabled ? "1" : "0",
174
+ fingerprint.indexedDBEnabled ? "1" : "0",
175
+ // 盐值
176
+ salt
177
+ ];
178
+ const combined = components.join("|");
179
+ const hash = simpleHash(combined);
180
+ return hash.toString(36);
181
+ }
182
+ function selectResultIndex(hash, totalResults) {
183
+ const numHash = parseInt(hash, 36);
184
+ return numHash % totalResults;
185
+ }
186
+
187
+ // src/testYourself/data/defaultResults.ts
188
+ var DEFAULT_RESULTS = [
189
+ // 动物系列 (1-15)
190
+ {
191
+ id: "animal-cat",
192
+ title: "\u6175\u61D2\u7684\u732B\u54AA \u{1F431}",
193
+ description: "\u4F60\u5C31\u50CF\u4E00\u53EA\u4F18\u96C5\u7684\u732B\uFF0C\u72EC\u7ACB\u81EA\u4E3B\uFF0C\u559C\u6B22\u6309\u7167\u81EA\u5DF1\u7684\u8282\u594F\u751F\u6D3B\u3002\u6709\u65F6\u9AD8\u51B7\uFF0C\u6709\u65F6\u7C98\u4EBA\uFF0C\u5145\u6EE1\u795E\u79D8\u9B45\u529B\u3002",
194
+ image: "\u{1F431}",
195
+ imageType: "emoji"
196
+ },
197
+ {
198
+ id: "animal-dog",
199
+ title: "\u5FE0\u8BDA\u7684\u72D7\u72D7 \u{1F415}",
200
+ description: "\u4F60\u50CF\u4E00\u53EA\u70ED\u60C5\u7684\u72D7\u72D7\uFF0C\u5BF9\u670B\u53CB\u5FE0\u8BDA\uFF0C\u5145\u6EE1\u6D3B\u529B\u3002\u603B\u662F\u80FD\u7ED9\u5468\u56F4\u7684\u4EBA\u5E26\u6765\u6B22\u4E50\u548C\u6E29\u6696\u3002",
201
+ image: "\u{1F415}",
202
+ imageType: "emoji"
203
+ },
204
+ {
205
+ id: "animal-panda",
206
+ title: "\u53EF\u7231\u7684\u718A\u732B \u{1F43C}",
207
+ description: "\u4F60\u5C31\u50CF\u56FD\u5B9D\u718A\u732B\u4E00\u6837\uFF0C\u5446\u840C\u53EF\u7231\uFF0C\u4EBA\u89C1\u4EBA\u7231\u3002\u6162\u8282\u594F\u7684\u751F\u6D3B\u65B9\u5F0F\u8BA9\u4F60\u5145\u6EE1\u6CBB\u6108\u529B\u3002",
208
+ image: "\u{1F43C}",
209
+ imageType: "emoji"
210
+ },
211
+ {
212
+ id: "animal-fox",
213
+ title: "\u673A\u667A\u7684\u72D0\u72F8 \u{1F98A}",
214
+ description: "\u806A\u660E\u4F36\u4FD0\uFF0C\u53CD\u5E94\u654F\u6377\u3002\u4F60\u603B\u80FD\u7528\u667A\u6167\u89E3\u51B3\u95EE\u9898\uFF0C\u662F\u56E2\u961F\u4E2D\u7684\u667A\u56CA\u62C5\u5F53\u3002",
215
+ image: "\u{1F98A}",
216
+ imageType: "emoji"
217
+ },
218
+ {
219
+ id: "animal-owl",
220
+ title: "\u777F\u667A\u7684\u732B\u5934\u9E70 \u{1F989}",
221
+ description: "\u4F60\u50CF\u732B\u5934\u9E70\u4E00\u6837\u5145\u6EE1\u667A\u6167\uFF0C\u559C\u6B22\u5728\u591C\u6DF1\u4EBA\u9759\u65F6\u601D\u8003\u3002\u7406\u6027\u3001\u6C89\u7A33\u662F\u4F60\u7684\u6807\u7B7E\u3002",
222
+ image: "\u{1F989}",
223
+ imageType: "emoji"
224
+ },
225
+ {
226
+ id: "animal-dolphin",
227
+ title: "\u5FEB\u4E50\u7684\u6D77\u8C5A \u{1F42C}",
228
+ description: "\u6D3B\u6CFC\u5F00\u6717\uFF0C\u793E\u4EA4\u8FBE\u4EBA\u3002\u4F60\u7684\u7B11\u5BB9\u80FD\u591F\u611F\u67D3\u8EAB\u8FB9\u7684\u6BCF\u4E00\u4E2A\u4EBA\u3002",
229
+ image: "\u{1F42C}",
230
+ imageType: "emoji"
231
+ },
232
+ {
233
+ id: "animal-butterfly",
234
+ title: "\u81EA\u7531\u7684\u8774\u8776 \u{1F98B}",
235
+ description: "\u8FFD\u6C42\u81EA\u7531\uFF0C\u70ED\u7231\u7F8E\u597D\u4E8B\u7269\u3002\u4F60\u7684\u4EBA\u751F\u5145\u6EE1\u8272\u5F69\uFF0C\u4ECE\u4E0D\u88AB\u675F\u7F1A\u3002",
236
+ image: "\u{1F98B}",
237
+ imageType: "emoji"
238
+ },
239
+ {
240
+ id: "animal-lion",
241
+ title: "\u52C7\u6562\u7684\u72EE\u5B50 \u{1F981}",
242
+ description: "\u5929\u751F\u7684\u9886\u5BFC\u8005\uFF0C\u52C7\u6562\u679C\u65AD\u3002\u4F60\u7684\u6C14\u573A\u5F3A\u5927\uFF0C\u603B\u80FD\u6FC0\u52B1\u4ED6\u4EBA\u3002",
243
+ image: "\u{1F981}",
244
+ imageType: "emoji"
245
+ },
246
+ {
247
+ id: "animal-rabbit",
248
+ title: "\u6E29\u67D4\u7684\u5154\u5B50 \u{1F430}",
249
+ description: "\u5FC3\u5730\u5584\u826F\uFF0C\u6E29\u67D4\u4F53\u8D34\u3002\u4F60\u7684\u5B58\u5728\u5C31\u50CF\u6625\u5929\u7684\u5FAE\u98CE\uFF0C\u8BA9\u4EBA\u611F\u5230\u6E29\u6696\u3002",
250
+ image: "\u{1F430}",
251
+ imageType: "emoji"
252
+ },
253
+ {
254
+ id: "animal-penguin",
255
+ title: "\u5446\u840C\u7684\u4F01\u9E45 \u{1F427}",
256
+ description: "\u61A8\u6001\u53EF\u63AC\uFF0C\u8BA4\u771F\u6267\u7740\u3002\u867D\u7136\u770B\u8D77\u6765\u7B28\u62D9\uFF0C\u4F46\u505A\u4E8B\u4E00\u4E1D\u4E0D\u82DF\u3002",
257
+ image: "\u{1F427}",
258
+ imageType: "emoji"
259
+ },
260
+ {
261
+ id: "animal-eagle",
262
+ title: "\u7FF1\u7FD4\u7684\u96C4\u9E70 \u{1F985}",
263
+ description: "\u76EE\u5149\u8FDC\u5927\uFF0C\u5FD7\u5411\u9AD8\u8FDC\u3002\u4F60\u603B\u662F\u80FD\u770B\u5230\u522B\u4EBA\u770B\u4E0D\u5230\u7684\u673A\u4F1A\u3002",
264
+ image: "\u{1F985}",
265
+ imageType: "emoji"
266
+ },
267
+ {
268
+ id: "animal-koala",
269
+ title: "\u6175\u61D2\u7684\u8003\u62C9 \u{1F428}",
270
+ description: "\u4F5B\u7CFB\u751F\u6D3B\uFF0C\u77E5\u8DB3\u5E38\u4E50\u3002\u4F60\u61C2\u5F97\u4EAB\u53D7\u5F53\u4E0B\uFF0C\u6D3B\u5728\u81EA\u5DF1\u7684\u8282\u594F\u91CC\u3002",
271
+ image: "\u{1F428}",
272
+ imageType: "emoji"
273
+ },
274
+ {
275
+ id: "animal-sloth",
276
+ title: "\u60A0\u95F2\u7684\u6811\u61D2 \u{1F9A5}",
277
+ description: "\u6162\u6162\u6765\uFF0C\u6BD4\u8F83\u5FEB\u3002\u4F60\u76F8\u4FE1\u6025\u4E0D\u6765\u7684\u4E8B\u5C31\u4E0D\u8981\u6025\uFF0C\u4FDD\u6301\u81EA\u5DF1\u7684pace\u3002",
278
+ image: "\u{1F9A5}",
279
+ imageType: "emoji"
280
+ },
281
+ {
282
+ id: "animal-unicorn",
283
+ title: "\u68A6\u5E7B\u7684\u72EC\u89D2\u517D \u{1F984}",
284
+ description: "\u5145\u6EE1\u5E7B\u60F3\uFF0C\u8FFD\u6C42\u5B8C\u7F8E\u3002\u4F60\u7684\u4E16\u754C\u4E94\u5F69\u6591\u6593\uFF0C\u603B\u6709\u72EC\u7279\u7684\u60F3\u6CD5\u3002",
285
+ image: "\u{1F984}",
286
+ imageType: "emoji"
287
+ },
288
+ {
289
+ id: "animal-dragon",
290
+ title: "\u795E\u79D8\u7684\u9F99 \u{1F409}",
291
+ description: "\u5F3A\u5927\u800C\u795E\u79D8\uFF0C\u5145\u6EE1\u9B45\u529B\u3002\u4F60\u662F\u4F20\u8BF4\u4E2D\u7684\u5B58\u5728\uFF0C\u4EE4\u4EBA\u5411\u5F80\u3002",
292
+ image: "\u{1F409}",
293
+ imageType: "emoji"
294
+ },
295
+ // 星球系列 (16-25)
296
+ {
297
+ id: "planet-sun",
298
+ title: "\u6E29\u6696\u7684\u592A\u9633 \u2600\uFE0F",
299
+ description: "\u4F60\u5C31\u50CF\u592A\u9633\u4E00\u6837\uFF0C\u662F\u56E2\u961F\u7684\u80FD\u91CF\u6765\u6E90\uFF0C\u6E29\u6696\u7740\u5468\u56F4\u7684\u6BCF\u4E2A\u4EBA\u3002",
300
+ image: "\u2600\uFE0F",
301
+ imageType: "emoji"
302
+ },
303
+ {
304
+ id: "planet-moon",
305
+ title: "\u6E29\u67D4\u7684\u6708\u4EAE \u{1F319}",
306
+ description: "\u5B89\u9759\u800C\u6E29\u67D4\uFF0C\u5728\u9ED1\u6697\u4E2D\u7ED9\u4EBA\u5149\u660E\u3002\u4F60\u662F\u591C\u665A\u6700\u7F8E\u7684\u966A\u4F34\u3002",
307
+ image: "\u{1F319}",
308
+ imageType: "emoji"
309
+ },
310
+ {
311
+ id: "planet-star",
312
+ title: "\u95EA\u8000\u7684\u661F\u661F \u2B50",
313
+ description: "\u867D\u7136\u6E3A\u5C0F\uFF0C\u4F46\u59CB\u7EC8\u95EA\u8000\u3002\u4F60\u7528\u81EA\u5DF1\u7684\u65B9\u5F0F\u53D1\u5149\u53D1\u70ED\u3002",
314
+ image: "\u2B50",
315
+ imageType: "emoji"
316
+ },
317
+ {
318
+ id: "planet-earth",
319
+ title: "\u5305\u5BB9\u7684\u5730\u7403 \u{1F30D}",
320
+ description: "\u5305\u5BB9\u4E07\u7269\uFF0C\u751F\u673A\u52C3\u52C3\u3002\u4F60\u6709\u7740\u5BBD\u5E7F\u7684\u80F8\u6000\u548C\u65E0\u9650\u7684\u53EF\u80FD\u3002",
321
+ image: "\u{1F30D}",
322
+ imageType: "emoji"
323
+ },
324
+ {
325
+ id: "planet-saturn",
326
+ title: "\u72EC\u7279\u7684\u571F\u661F \u{1FA90}",
327
+ description: "\u4E0E\u4F17\u4E0D\u540C\uFF0C\u81EA\u6210\u4E00\u683C\u3002\u4F60\u7684\u4E2A\u6027\u5C31\u50CF\u571F\u661F\u73AF\u4E00\u6837\u4EE4\u4EBA\u7740\u8FF7\u3002",
328
+ image: "\u{1FA90}",
329
+ imageType: "emoji"
330
+ },
331
+ {
332
+ id: "weather-rainbow",
333
+ title: "\u7EDA\u4E3D\u7684\u5F69\u8679 \u{1F308}",
334
+ description: "\u98CE\u96E8\u8FC7\u540E\u89C1\u5F69\u8679\uFF0C\u4F60\u603B\u80FD\u5728\u56F0\u96BE\u540E\u770B\u5230\u5E0C\u671B\u548C\u7F8E\u597D\u3002",
335
+ image: "\u{1F308}",
336
+ imageType: "emoji"
337
+ },
338
+ {
339
+ id: "weather-cloud",
340
+ title: "\u98D8\u9038\u7684\u4E91\u6735 \u2601\uFE0F",
341
+ description: "\u81EA\u7531\u81EA\u5728\uFF0C\u968F\u98CE\u98D8\u8361\u3002\u4F60\u4E0D\u88AB\u5B9A\u4E49\uFF0C\u6C38\u8FDC\u5145\u6EE1\u53EF\u80FD\u3002",
342
+ image: "\u2601\uFE0F",
343
+ imageType: "emoji"
344
+ },
345
+ {
346
+ id: "weather-lightning",
347
+ title: "\u95EA\u7535 \u26A1",
348
+ description: "\u7206\u53D1\u529B\u5F3A\uFF0C\u884C\u52A8\u8FC5\u901F\u3002\u4F60\u7684\u80FD\u91CF\u5C31\u50CF\u95EA\u7535\u4E00\u6837\u4EE4\u4EBA\u9707\u64BC\u3002",
349
+ image: "\u26A1",
350
+ imageType: "emoji"
351
+ },
352
+ {
353
+ id: "weather-snowflake",
354
+ title: "\u72EC\u7279\u7684\u96EA\u82B1 \u2744\uFE0F",
355
+ description: "\u4E16\u754C\u4E0A\u6CA1\u6709\u4E24\u7247\u76F8\u540C\u7684\u96EA\u82B1\uFF0C\u4F60\u4E5F\u662F\u72EC\u4E00\u65E0\u4E8C\u7684\u5B58\u5728\u3002",
356
+ image: "\u2744\uFE0F",
357
+ imageType: "emoji"
358
+ },
359
+ {
360
+ id: "weather-fire",
361
+ title: "\u70ED\u60C5\u7684\u706B\u7130 \u{1F525}",
362
+ description: "\u70ED\u60C5\u4F3C\u706B\uFF0C\u5145\u6EE1\u6FC0\u60C5\u3002\u4F60\u7684\u5B58\u5728\u80FD\u70B9\u71C3\u5468\u56F4\u7684\u6C14\u6C1B\u3002",
363
+ image: "\u{1F525}",
364
+ imageType: "emoji"
365
+ },
366
+ // 植物系列 (26-35)
367
+ {
368
+ id: "plant-tree",
369
+ title: "\u575A\u97E7\u7684\u5927\u6811 \u{1F333}",
370
+ description: "\u7A33\u91CD\u53EF\u9760\uFF0C\u6839\u57FA\u6DF1\u539A\u3002\u4F60\u662F\u5927\u5BB6\u53EF\u4EE5\u4F9D\u9760\u7684\u5B58\u5728\u3002",
371
+ image: "\u{1F333}",
372
+ imageType: "emoji"
373
+ },
374
+ {
375
+ id: "plant-flower",
376
+ title: "\u7F8E\u4E3D\u7684\u82B1\u6735 \u{1F338}",
377
+ description: "\u7EFD\u653E\u81EA\u6211\uFF0C\u7F8E\u4E3D\u52A8\u4EBA\u3002\u4F60\u7684\u5B58\u5728\u5C31\u662F\u4E00\u9053\u9753\u4E3D\u7684\u98CE\u666F\u3002",
378
+ image: "\u{1F338}",
379
+ imageType: "emoji"
380
+ },
381
+ {
382
+ id: "plant-sunflower",
383
+ title: "\u5411\u9633\u7684\u5411\u65E5\u8475 \u{1F33B}",
384
+ description: "\u6C38\u8FDC\u5411\u7740\u9633\u5149\uFF0C\u79EF\u6781\u5411\u4E0A\u3002\u4F60\u7684\u4E50\u89C2\u611F\u67D3\u7740\u6BCF\u4E2A\u4EBA\u3002",
385
+ image: "\u{1F33B}",
386
+ imageType: "emoji"
387
+ },
388
+ {
389
+ id: "plant-rose",
390
+ title: "\u4F18\u96C5\u7684\u73AB\u7470 \u{1F339}",
391
+ description: "\u9AD8\u8D35\u4F18\u96C5\uFF0C\u5145\u6EE1\u9B45\u529B\u3002\u867D\u6709\u523A\u4F46\u66F4\u6709\u7F8E\u4E3D\u3002",
392
+ image: "\u{1F339}",
393
+ imageType: "emoji"
394
+ },
395
+ {
396
+ id: "plant-cactus",
397
+ title: "\u575A\u5F3A\u7684\u4ED9\u4EBA\u638C \u{1F335}",
398
+ description: "\u5728\u8270\u96BE\u73AF\u5883\u4E2D\u4F9D\u7136\u575A\u5F3A\u3002\u4F60\u7684\u97E7\u6027\u4EE4\u4EBA\u656C\u4F69\u3002",
399
+ image: "\u{1F335}",
400
+ imageType: "emoji"
401
+ },
402
+ {
403
+ id: "plant-clover",
404
+ title: "\u5E78\u8FD0\u7684\u56DB\u53F6\u8349 \u{1F340}",
405
+ description: "\u5E78\u8FD0\u7684\u8C61\u5F81\uFF0C\u603B\u80FD\u7ED9\u4EBA\u5E26\u6765\u597D\u8FD0\u548C\u5E0C\u671B\u3002",
406
+ image: "\u{1F340}",
407
+ imageType: "emoji"
408
+ },
409
+ {
410
+ id: "plant-maple",
411
+ title: "\u6D6A\u6F2B\u7684\u67AB\u53F6 \u{1F341}",
412
+ description: "\u6D6A\u6F2B\u800C\u8BD7\u610F\uFF0C\u4F60\u7684\u4E16\u754C\u5145\u6EE1\u827A\u672F\u6C14\u606F\u3002",
413
+ image: "\u{1F341}",
414
+ imageType: "emoji"
415
+ },
416
+ {
417
+ id: "plant-mushroom",
418
+ title: "\u795E\u79D8\u7684\u8611\u83C7 \u{1F344}",
419
+ description: "\u4F4E\u8C03\u795E\u79D8\uFF0C\u603B\u6709\u610F\u60F3\u4E0D\u5230\u7684\u60CA\u559C\u3002",
420
+ image: "\u{1F344}",
421
+ imageType: "emoji"
422
+ },
423
+ {
424
+ id: "plant-cherry",
425
+ title: "\u6D6A\u6F2B\u7684\u6A31\u82B1 \u{1F338}",
426
+ description: "\u77ED\u6682\u800C\u7F8E\u597D\uFF0C\u4F60\u73CD\u60DC\u6BCF\u4E00\u4E2A\u77AC\u95F4\u7684\u7F8E\u4E3D\u3002",
427
+ image: "\u{1F338}",
428
+ imageType: "emoji"
429
+ },
430
+ {
431
+ id: "plant-bamboo",
432
+ title: "\u575A\u97E7\u7684\u7AF9\u5B50 \u{1F38B}",
433
+ description: "\u865A\u5FC3\u6709\u8282\uFF0C\u6108\u632B\u6108\u52C7\u3002\u4F60\u7684\u7CBE\u795E\u503C\u5F97\u5B66\u4E60\u3002",
434
+ image: "\u{1F38B}",
435
+ imageType: "emoji"
436
+ },
437
+ // 食物系列 (36-45)
438
+ {
439
+ id: "food-coffee",
440
+ title: "\u63D0\u795E\u7684\u5496\u5561 \u2615",
441
+ description: "\u4F60\u5C31\u50CF\u5496\u5561\uFF0C\u662F\u5927\u5BB6\u7684\u80FD\u91CF\u6765\u6E90\uFF0C\u5E2E\u52A9\u4ED6\u4EBA\u4FDD\u6301\u6D3B\u529B\u3002",
442
+ image: "\u2615",
443
+ imageType: "emoji"
444
+ },
445
+ {
446
+ id: "food-pizza",
447
+ title: "\u5FEB\u4E50\u7684\u62AB\u8428 \u{1F355}",
448
+ description: "\u4EBA\u89C1\u4EBA\u7231\uFF0C\u603B\u80FD\u5E26\u6765\u5FEB\u4E50\u3002\u4F60\u662F\u805A\u4F1A\u7684\u7075\u9B42\u3002",
449
+ image: "\u{1F355}",
450
+ imageType: "emoji"
451
+ },
452
+ {
453
+ id: "food-cookie",
454
+ title: "\u751C\u871C\u7684\u997C\u5E72 \u{1F36A}",
455
+ description: "\u6E29\u6696\u751C\u871C\uFF0C\u7ED9\u4EBAcomfort\u3002\u4F60\u662F\u6700\u597D\u7684\u6CBB\u6108\u7CFB\u5B58\u5728\u3002",
456
+ image: "\u{1F36A}",
457
+ imageType: "emoji"
458
+ },
459
+ {
460
+ id: "food-icecream",
461
+ title: "\u6E05\u51C9\u7684\u51B0\u6DC7\u6DCB \u{1F366}",
462
+ description: "\u751C\u7F8E\u53EF\u7231\uFF0C\u5728\u708E\u70ED\u65F6\u7ED9\u4EBA\u6E05\u51C9\u3002\u4F60\u603B\u80FD\u5728\u5173\u952E\u65F6\u523B\u51FA\u73B0\u3002",
463
+ image: "\u{1F366}",
464
+ imageType: "emoji"
465
+ },
466
+ {
467
+ id: "food-honey",
468
+ title: "\u751C\u871C\u7684\u8702\u871C \u{1F36F}",
469
+ description: "\u5929\u7136\u751C\u7F8E\uFF0C\u7EAF\u7CB9\u53EF\u7231\u3002\u4F60\u7684\u5B58\u5728\u5C31\u662F\u5E78\u798F\u7684\u5473\u9053\u3002",
470
+ image: "\u{1F36F}",
471
+ imageType: "emoji"
472
+ },
473
+ {
474
+ id: "food-sushi",
475
+ title: "\u7CBE\u81F4\u7684\u5BFF\u53F8 \u{1F363}",
476
+ description: "\u7CBE\u81F4\u4F18\u96C5\uFF0C\u6CE8\u91CD\u7EC6\u8282\u3002\u4F60\u5BF9\u751F\u6D3B\u6709\u7740\u72EC\u7279\u7684\u54C1\u5473\u3002",
477
+ image: "\u{1F363}",
478
+ imageType: "emoji"
479
+ },
480
+ {
481
+ id: "food-cake",
482
+ title: "\u751C\u7F8E\u7684\u86CB\u7CD5 \u{1F382}",
483
+ description: "\u751C\u871C\u7F8E\u597D\uFF0C\u662F\u5E86\u795D\u7684\u8C61\u5F81\u3002\u4F60\u603B\u80FD\u7ED9\u4EBA\u5E26\u6765\u60CA\u559C\u3002",
484
+ image: "\u{1F382}",
485
+ imageType: "emoji"
486
+ },
487
+ {
488
+ id: "food-donut",
489
+ title: "\u53EF\u7231\u7684\u751C\u751C\u5708 \u{1F369}",
490
+ description: "\u5706\u5706\u6EE1\u6EE1\uFF0C\u751C\u871C\u53EF\u7231\u3002\u4F60\u7684\u5B58\u5728\u8BA9\u751F\u6D3B\u66F4\u7F8E\u597D\u3002",
491
+ image: "\u{1F369}",
492
+ imageType: "emoji"
493
+ },
494
+ {
495
+ id: "food-lollipop",
496
+ title: "\u7AE5\u771F\u7684\u68D2\u68D2\u7CD6 \u{1F36D}",
497
+ description: "\u4FDD\u6301\u7AE5\u5FC3\uFF0C\u6C38\u8FDC\u5E74\u8F7B\u3002\u4F60\u7684\u7EAF\u771F\u4EE4\u4EBA\u7FA1\u6155\u3002",
498
+ image: "\u{1F36D}",
499
+ imageType: "emoji"
500
+ },
501
+ {
502
+ id: "food-watermelon",
503
+ title: "\u6E05\u723D\u7684\u897F\u74DC \u{1F349}",
504
+ description: "\u6E05\u723D\u89E3\u6E34\uFF0C\u590F\u65E5\u5FC5\u5907\u3002\u4F60\u603B\u80FD\u5E26\u6765\u6E05\u65B0\u7684\u611F\u89C9\u3002",
505
+ image: "\u{1F349}",
506
+ imageType: "emoji"
507
+ }
508
+ ];
509
+ if (DEFAULT_RESULTS.length !== 45) {
510
+ console.warn(`\u7ED3\u679C\u6570\u636E\u96C6\u5E94\u5305\u542B45\u9879\uFF0C\u5F53\u524D: ${DEFAULT_RESULTS.length}`);
511
+ }
512
+
513
+ // src/testYourself/components/TestYourself.tsx
514
+ var STORAGE_KEY = "test-yourself-result";
515
+ var TestYourself = ({
516
+ config,
517
+ onResult,
518
+ className = ""
519
+ }) => {
520
+ const {
521
+ gameTitle,
522
+ gameDescription,
523
+ buttonText = "\u957F\u6309\u5F00\u59CB\u6D4B\u8BD5",
524
+ longPressDuration = 2e3,
525
+ results = DEFAULT_RESULTS,
526
+ enableIPFetch = false,
527
+ customSalt,
528
+ resultStyle = "card"
529
+ } = config;
530
+ const [status, setStatus] = useState("idle");
531
+ const [result, setResult] = useState(null);
532
+ const [pressProgress, setPressProgress] = useState(0);
533
+ const [ipWarning, setIpWarning] = useState(null);
534
+ const [isLoading, setIsLoading] = useState(true);
535
+ const pressTimerRef = useRef(null);
536
+ const progressIntervalRef = useRef(null);
537
+ const startTimeRef = useRef(0);
538
+ useEffect(() => {
539
+ const initializeTest = async () => {
540
+ const savedResult = localStorage.getItem(STORAGE_KEY);
541
+ if (savedResult) {
542
+ try {
543
+ const parsed = JSON.parse(savedResult);
544
+ setResult(parsed);
545
+ setStatus("completed");
546
+ setIsLoading(false);
547
+ return;
548
+ } catch (error) {
549
+ console.error("\u89E3\u6790\u4FDD\u5B58\u7684\u7ED3\u679C\u5931\u8D25:", error);
550
+ }
551
+ }
552
+ if (enableIPFetch) {
553
+ const ip = await tryGetIPAddress();
554
+ if (!ip) {
555
+ setIpWarning("\u26A0\uFE0F \u65E0\u6CD5\u83B7\u53D6IP\u5730\u5740\uFF0C\u5C06\u4EC5\u4F7F\u7528\u6D4F\u89C8\u5668\u6307\u7EB9\u751F\u6210\u7ED3\u679C");
556
+ }
557
+ }
558
+ setIsLoading(false);
559
+ };
560
+ initializeTest();
561
+ }, [enableIPFetch]);
562
+ const calculateResult = async () => {
563
+ try {
564
+ const fingerprint = getDeviceFingerprint();
565
+ if (enableIPFetch) {
566
+ const ip = await tryGetIPAddress();
567
+ if (ip) {
568
+ fingerprint.ip = ip;
569
+ }
570
+ }
571
+ const actualResults = results.length > 0 ? results : DEFAULT_RESULTS;
572
+ const hash = generateDeviceHash(fingerprint, customSalt);
573
+ const index = selectResultIndex(hash, actualResults.length);
574
+ const selectedResult = actualResults[index];
575
+ if (!selectedResult) {
576
+ console.error("\u65E0\u6CD5\u83B7\u53D6\u6D4B\u8BD5\u7ED3\u679C\uFF0Cindex:", index, "total:", actualResults.length);
577
+ throw new Error("\u65E0\u6CD5\u83B7\u53D6\u6D4B\u8BD5\u7ED3\u679C");
578
+ }
579
+ console.log("\u8BA1\u7B97\u7ED3\u679C\u6210\u529F:", selectedResult);
580
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(selectedResult));
581
+ return selectedResult;
582
+ } catch (error) {
583
+ console.error("\u8BA1\u7B97\u7ED3\u679C\u5931\u8D25:", error);
584
+ throw error;
585
+ }
586
+ };
587
+ const handlePressStart = (e) => {
588
+ if (status !== "idle") return;
589
+ e.preventDefault();
590
+ setStatus("pressing");
591
+ startTimeRef.current = Date.now();
592
+ progressIntervalRef.current = setInterval(() => {
593
+ const elapsed = Date.now() - startTimeRef.current;
594
+ const progress = Math.min(elapsed / longPressDuration * 100, 100);
595
+ setPressProgress(progress);
596
+ }, 16);
597
+ pressTimerRef.current = setTimeout(async () => {
598
+ try {
599
+ setPressProgress(100);
600
+ if (progressIntervalRef.current) {
601
+ clearInterval(progressIntervalRef.current);
602
+ progressIntervalRef.current = null;
603
+ }
604
+ console.log("\u5F00\u59CB\u8BA1\u7B97\u7ED3\u679C...");
605
+ const testResult = await calculateResult();
606
+ console.log("\u7ED3\u679C\u8BA1\u7B97\u5B8C\u6210\uFF0C\u66F4\u65B0\u72B6\u6001:", testResult);
607
+ setResult(testResult);
608
+ setTimeout(() => {
609
+ setStatus("completed");
610
+ console.log("\u72B6\u6001\u5DF2\u66F4\u65B0\u4E3A completed");
611
+ }, 0);
612
+ if (onResult) {
613
+ onResult(testResult);
614
+ }
615
+ } catch (error) {
616
+ console.error("\u6D4B\u8BD5\u5931\u8D25:", error);
617
+ setStatus("idle");
618
+ setPressProgress(0);
619
+ alert("\u6D4B\u8BD5\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
620
+ }
621
+ }, longPressDuration);
622
+ if ("button" in e && e.button === 0) {
623
+ const handleGlobalMouseUp = () => {
624
+ handlePressEnd();
625
+ document.removeEventListener("mouseup", handleGlobalMouseUp);
626
+ };
627
+ document.addEventListener("mouseup", handleGlobalMouseUp);
628
+ }
629
+ };
630
+ const handlePressEnd = () => {
631
+ if (status !== "pressing") return;
632
+ if (pressTimerRef.current) {
633
+ clearTimeout(pressTimerRef.current);
634
+ pressTimerRef.current = null;
635
+ }
636
+ if (progressIntervalRef.current) {
637
+ clearInterval(progressIntervalRef.current);
638
+ progressIntervalRef.current = null;
639
+ }
640
+ setStatus("idle");
641
+ setPressProgress(0);
642
+ };
643
+ const handleMouseLeave = (e) => {
644
+ };
645
+ const handleTouchMove = (e) => {
646
+ const touch = e.touches[0];
647
+ if (!touch) return;
648
+ const target = e.currentTarget;
649
+ const rect = target.getBoundingClientRect();
650
+ const isInside = touch.clientX >= rect.left && touch.clientX <= rect.right && touch.clientY >= rect.top && touch.clientY <= rect.bottom;
651
+ if (!isInside && status === "pressing") {
652
+ handlePressEnd();
653
+ }
654
+ };
655
+ useEffect(() => {
656
+ return () => {
657
+ if (pressTimerRef.current) {
658
+ clearTimeout(pressTimerRef.current);
659
+ }
660
+ if (progressIntervalRef.current) {
661
+ clearInterval(progressIntervalRef.current);
662
+ }
663
+ };
664
+ }, []);
665
+ const handleReset = () => {
666
+ localStorage.removeItem(STORAGE_KEY);
667
+ setResult(null);
668
+ setStatus("idle");
669
+ setPressProgress(0);
670
+ };
671
+ const backgroundStyle = {
672
+ position: "relative",
673
+ minHeight: "100vh",
674
+ overflow: "hidden",
675
+ background: "linear-gradient(135deg, #f3e8ff 0%, #fce7f3 50%, #dbeafe 100%)"
676
+ };
677
+ const DecorativeBackground = () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { style: {
678
+ position: "absolute",
679
+ top: 0,
680
+ left: 0,
681
+ width: "384px",
682
+ height: "384px",
683
+ background: "radial-gradient(circle, rgba(192, 132, 252, 0.3) 0%, transparent 70%)",
684
+ borderRadius: "50%",
685
+ filter: "blur(60px)",
686
+ transform: "translate(-50%, -50%)",
687
+ pointerEvents: "none"
688
+ } }), /* @__PURE__ */ React.createElement("div", { style: {
689
+ position: "absolute",
690
+ top: "50%",
691
+ right: 0,
692
+ width: "384px",
693
+ height: "384px",
694
+ background: "radial-gradient(circle, rgba(244, 114, 182, 0.3) 0%, transparent 70%)",
695
+ borderRadius: "50%",
696
+ filter: "blur(60px)",
697
+ transform: "translateX(50%)",
698
+ pointerEvents: "none"
699
+ } }), /* @__PURE__ */ React.createElement("div", { style: {
700
+ position: "absolute",
701
+ bottom: 0,
702
+ left: "50%",
703
+ width: "384px",
704
+ height: "384px",
705
+ background: "radial-gradient(circle, rgba(147, 197, 253, 0.3) 0%, transparent 70%)",
706
+ borderRadius: "50%",
707
+ filter: "blur(60px)",
708
+ transform: "translate(-50%, 50%)",
709
+ pointerEvents: "none"
710
+ } }));
711
+ if (isLoading) {
712
+ return /* @__PURE__ */ React.createElement("div", { className, style: backgroundStyle }, /* @__PURE__ */ React.createElement(DecorativeBackground, null), /* @__PURE__ */ React.createElement("div", { style: {
713
+ position: "relative",
714
+ zIndex: 10,
715
+ display: "flex",
716
+ alignItems: "center",
717
+ justifyContent: "center",
718
+ minHeight: "100vh"
719
+ } }, /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement("div", { style: {
720
+ position: "relative",
721
+ width: "64px",
722
+ height: "64px",
723
+ margin: "0 auto 16px"
724
+ } }, /* @__PURE__ */ React.createElement("div", { style: {
725
+ position: "absolute",
726
+ inset: 0,
727
+ border: "4px solid #e9d5ff",
728
+ borderRadius: "50%"
729
+ } }), /* @__PURE__ */ React.createElement("div", { style: {
730
+ position: "absolute",
731
+ inset: 0,
732
+ border: "4px solid transparent",
733
+ borderTopColor: "#a855f7",
734
+ borderRadius: "50%",
735
+ animation: "spin 1s linear infinite"
736
+ } })), /* @__PURE__ */ React.createElement("p", { style: { fontSize: "14px", color: "#6b7280" } }, "\u2728 \u52A0\u8F7D\u4E2D"))));
737
+ }
738
+ if (status === "completed" && result) {
739
+ return /* @__PURE__ */ React.createElement("div", { className, style: backgroundStyle }, /* @__PURE__ */ React.createElement(DecorativeBackground, null), /* @__PURE__ */ React.createElement("div", { style: {
740
+ position: "relative",
741
+ zIndex: 10,
742
+ minHeight: "100vh",
743
+ display: "flex",
744
+ alignItems: "center",
745
+ justifyContent: "center",
746
+ padding: "24px"
747
+ } }, /* @__PURE__ */ React.createElement("div", { style: { maxWidth: "420px", width: "100%" } }, /* @__PURE__ */ React.createElement("div", { style: {
748
+ position: "relative",
749
+ background: "linear-gradient(135deg, #fdf2f8 0%, #faf5ff 50%, #eff6ff 100%)",
750
+ borderRadius: "32px",
751
+ boxShadow: "0 25px 50px -12px rgba(168, 85, 247, 0.25), 0 0 0 1px rgba(168, 85, 247, 0.1)",
752
+ overflow: "hidden",
753
+ padding: "40px 32px",
754
+ textAlign: "center"
755
+ } }, /* @__PURE__ */ React.createElement("div", { style: { position: "absolute", top: "20px", left: "20px", fontSize: "24px", opacity: 0.6 } }, "\u2728"), /* @__PURE__ */ React.createElement("div", { style: { position: "absolute", top: "40px", right: "30px", fontSize: "20px", opacity: 0.5 } }, "\u2B50"), /* @__PURE__ */ React.createElement("div", { style: { position: "absolute", bottom: "30px", left: "40px", fontSize: "18px", opacity: 0.4 } }, "\u{1F4AB}"), /* @__PURE__ */ React.createElement("div", { style: { position: "absolute", bottom: "50px", right: "25px", fontSize: "22px", opacity: 0.5 } }, "\u{1F31F}"), /* @__PURE__ */ React.createElement("div", { style: { marginBottom: "24px" } }, /* @__PURE__ */ React.createElement("div", { style: {
756
+ display: "inline-block",
757
+ fontSize: "80px",
758
+ animation: "bounce-slow 2s ease-in-out infinite",
759
+ filter: "drop-shadow(0 10px 20px rgba(0,0,0,0.1))"
760
+ } }, result.imageType === "emoji" ? result.image : "\u{1F389}")), /* @__PURE__ */ React.createElement("h2", { style: {
761
+ fontSize: "32px",
762
+ fontWeight: 800,
763
+ background: "linear-gradient(135deg, #9333ea 0%, #ec4899 100%)",
764
+ WebkitBackgroundClip: "text",
765
+ WebkitTextFillColor: "transparent",
766
+ backgroundClip: "text",
767
+ marginBottom: "16px",
768
+ lineHeight: 1.3
769
+ } }, result.title), /* @__PURE__ */ React.createElement("div", { style: {
770
+ background: "rgba(255, 255, 255, 0.8)",
771
+ borderRadius: "20px",
772
+ padding: "20px 24px",
773
+ marginBottom: "28px",
774
+ boxShadow: "0 4px 15px rgba(168, 85, 247, 0.1)",
775
+ border: "2px dashed rgba(168, 85, 247, 0.2)"
776
+ } }, /* @__PURE__ */ React.createElement("p", { style: {
777
+ fontSize: "16px",
778
+ color: "#6b7280",
779
+ lineHeight: 1.7,
780
+ margin: 0
781
+ } }, result.description)), /* @__PURE__ */ React.createElement("div", { style: {
782
+ display: "flex",
783
+ alignItems: "center",
784
+ justifyContent: "center",
785
+ gap: "8px",
786
+ marginBottom: "24px"
787
+ } }, /* @__PURE__ */ React.createElement("span", { style: { width: "40px", height: "3px", background: "linear-gradient(to right, #a855f7, transparent)", borderRadius: "999px" } }), /* @__PURE__ */ React.createElement("span", { style: { fontSize: "16px" } }, "\u{1F495}"), /* @__PURE__ */ React.createElement("span", { style: { width: "40px", height: "3px", background: "linear-gradient(to left, #ec4899, transparent)", borderRadius: "999px" } })), /* @__PURE__ */ React.createElement(
788
+ "button",
789
+ {
790
+ onClick: handleReset,
791
+ style: {
792
+ display: "inline-flex",
793
+ alignItems: "center",
794
+ justifyContent: "center",
795
+ gap: "8px",
796
+ padding: "14px 32px",
797
+ fontSize: "16px",
798
+ fontWeight: 600,
799
+ color: "white",
800
+ background: "linear-gradient(135deg, #a855f7 0%, #ec4899 100%)",
801
+ border: "none",
802
+ borderRadius: "9999px",
803
+ cursor: "pointer",
804
+ boxShadow: "0 10px 25px -5px rgba(168, 85, 247, 0.4)",
805
+ transition: "all 0.3s ease"
806
+ },
807
+ onMouseEnter: (e) => {
808
+ e.currentTarget.style.transform = "scale(1.05) translateY(-2px)";
809
+ e.currentTarget.style.boxShadow = "0 15px 35px -5px rgba(168, 85, 247, 0.5)";
810
+ },
811
+ onMouseLeave: (e) => {
812
+ e.currentTarget.style.transform = "scale(1) translateY(0)";
813
+ e.currentTarget.style.boxShadow = "0 10px 25px -5px rgba(168, 85, 247, 0.4)";
814
+ }
815
+ },
816
+ /* @__PURE__ */ React.createElement("span", null, "\u{1F504}"),
817
+ /* @__PURE__ */ React.createElement("span", null, "\u91CD\u65B0\u6D4B\u8BD5")
818
+ )))));
819
+ }
820
+ return /* @__PURE__ */ React.createElement("div", { className, style: backgroundStyle }, /* @__PURE__ */ React.createElement(DecorativeBackground, null), /* @__PURE__ */ React.createElement("div", { style: {
821
+ position: "relative",
822
+ zIndex: 10,
823
+ minHeight: "100vh",
824
+ display: "flex",
825
+ alignItems: "center",
826
+ justifyContent: "center",
827
+ padding: "16px"
828
+ } }, /* @__PURE__ */ React.createElement("div", { style: { maxWidth: "512px", width: "100%", textAlign: "center", userSelect: "none" } }, /* @__PURE__ */ React.createElement("div", { style: { marginBottom: "48px" } }, /* @__PURE__ */ React.createElement("div", { style: {
829
+ display: "inline-block",
830
+ marginBottom: "16px",
831
+ animation: "bounce-slow 2s ease-in-out infinite"
832
+ } }, /* @__PURE__ */ React.createElement("span", { style: { fontSize: "56px" } }, "\u{1F3B2}")), /* @__PURE__ */ React.createElement("h1", { style: {
833
+ fontSize: "48px",
834
+ fontWeight: 900,
835
+ marginBottom: "12px",
836
+ background: "linear-gradient(135deg, #9333ea 0%, #ec4899 50%, #3b82f6 100%)",
837
+ WebkitBackgroundClip: "text",
838
+ WebkitTextFillColor: "transparent",
839
+ backgroundClip: "text",
840
+ lineHeight: 1.2
841
+ } }, gameTitle), gameDescription && /* @__PURE__ */ React.createElement("p", { style: {
842
+ fontSize: "18px",
843
+ color: "#6b7280",
844
+ fontWeight: 500
845
+ } }, gameDescription)), /* @__PURE__ */ React.createElement("div", { style: { marginBottom: "24px" } }, /* @__PURE__ */ React.createElement(
846
+ "button",
847
+ {
848
+ onMouseDown: handlePressStart,
849
+ onMouseLeave: handleMouseLeave,
850
+ onTouchStart: handlePressStart,
851
+ onTouchEnd: handlePressEnd,
852
+ onTouchMove: handleTouchMove,
853
+ onTouchCancel: handlePressEnd,
854
+ onContextMenu: (e) => e.preventDefault(),
855
+ onDragStart: (e) => e.preventDefault(),
856
+ style: {
857
+ display: "block",
858
+ margin: "0 auto",
859
+ width: "200px",
860
+ height: "200px",
861
+ borderRadius: "50%",
862
+ border: "none",
863
+ fontSize: "20px",
864
+ fontWeight: "bold",
865
+ cursor: "pointer",
866
+ position: "relative",
867
+ overflow: "hidden",
868
+ userSelect: "none",
869
+ WebkitTouchCallout: "none",
870
+ WebkitUserSelect: "none",
871
+ touchAction: "none",
872
+ transition: "transform 0.3s ease",
873
+ transform: status === "pressing" ? "scale(0.95)" : "scale(1)",
874
+ background: status === "pressing" ? `linear-gradient(to top, rgb(168, 85, 247) ${pressProgress}%, rgb(236, 72, 153) ${pressProgress}%)` : "linear-gradient(135deg, #4f46e5 0%, #7c3aed 25%, #db2777 50%, #f97316 75%, #059669 100%)",
875
+ boxShadow: status === "pressing" ? "inset 0 4px 12px rgba(0,0,0,0.3), 0 0 0 4px rgba(168, 85, 247, 0.5)" : "0 15px 35px -10px rgba(79, 70, 229, 0.6), 0 0 0 4px rgba(255,255,255,0.8)"
876
+ }
877
+ },
878
+ /* @__PURE__ */ React.createElement("div", { style: {
879
+ position: "absolute",
880
+ top: 0,
881
+ left: 0,
882
+ right: 0,
883
+ bottom: 0,
884
+ display: "flex",
885
+ flexDirection: "column",
886
+ alignItems: "center",
887
+ justifyContent: "center",
888
+ color: "white",
889
+ pointerEvents: "none"
890
+ } }, status === "pressing" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { style: { fontSize: "36px", fontWeight: 900, marginBottom: "4px" } }, Math.round(pressProgress), "%"), /* @__PURE__ */ React.createElement("span", { style: { fontSize: "14px", opacity: 0.8 } }, "\u7EE7\u7EED\u6309\u4F4F")) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { style: { fontSize: "32px", marginBottom: "8px" } }, "\u{1F446}"), /* @__PURE__ */ React.createElement("span", { style: { fontSize: "16px", fontWeight: "bold", padding: "0 16px" } }, buttonText))),
891
+ status === "idle" && /* @__PURE__ */ React.createElement("div", { style: {
892
+ position: "absolute",
893
+ top: "16px",
894
+ left: "16px",
895
+ right: "16px",
896
+ bottom: "16px",
897
+ border: "2px solid rgba(255,255,255,0.3)",
898
+ borderRadius: "50%"
899
+ } })
900
+ ), status === "pressing" && /* @__PURE__ */ React.createElement("div", { style: {
901
+ marginTop: "16px",
902
+ marginLeft: "auto",
903
+ marginRight: "auto",
904
+ width: "192px",
905
+ height: "8px",
906
+ backgroundColor: "#e5e7eb",
907
+ borderRadius: "9999px",
908
+ overflow: "hidden"
909
+ } }, /* @__PURE__ */ React.createElement("div", { style: {
910
+ height: "100%",
911
+ width: `${pressProgress}%`,
912
+ background: "linear-gradient(to right, #a855f7, #ec4899)",
913
+ transition: "width 0.1s ease"
914
+ } }))), /* @__PURE__ */ React.createElement("div", { style: { marginTop: "24px" } }, status === "pressing" ? /* @__PURE__ */ React.createElement("p", { style: {
915
+ fontSize: "18px",
916
+ fontWeight: 500,
917
+ color: "#9333ea",
918
+ animation: "pulse 2s ease-in-out infinite"
919
+ } }, "\u2728 \u6B63\u5728\u5206\u6790\u4E2D...") : /* @__PURE__ */ React.createElement("div", { style: {
920
+ display: "flex",
921
+ alignItems: "center",
922
+ justifyContent: "center",
923
+ gap: "8px"
924
+ } }, /* @__PURE__ */ React.createElement("span", { style: {
925
+ display: "inline-block",
926
+ width: "6px",
927
+ height: "6px",
928
+ backgroundColor: "#a855f7",
929
+ borderRadius: "50%",
930
+ animation: "bounce 1s infinite"
931
+ } }), /* @__PURE__ */ React.createElement("span", { style: {
932
+ display: "inline-block",
933
+ width: "6px",
934
+ height: "6px",
935
+ backgroundColor: "#ec4899",
936
+ borderRadius: "50%",
937
+ animation: "bounce 1s infinite 0.1s"
938
+ } }), /* @__PURE__ */ React.createElement("span", { style: {
939
+ display: "inline-block",
940
+ width: "6px",
941
+ height: "6px",
942
+ backgroundColor: "#3b82f6",
943
+ borderRadius: "50%",
944
+ animation: "bounce 1s infinite 0.2s"
945
+ } }))))));
946
+ };
947
+ var touchOptimizationStyles = `
948
+ @keyframes bounce-slow {
949
+ 0%, 100% {
950
+ transform: translateY(0);
951
+ }
952
+ 50% {
953
+ transform: translateY(-10px);
954
+ }
955
+ }
956
+
957
+ @keyframes bounce {
958
+ 0%, 100% {
959
+ transform: translateY(0);
960
+ }
961
+ 50% {
962
+ transform: translateY(-4px);
963
+ }
964
+ }
965
+
966
+ @keyframes pulse {
967
+ 0%, 100% {
968
+ opacity: 1;
969
+ }
970
+ 50% {
971
+ opacity: 0.5;
972
+ }
973
+ }
974
+
975
+ @keyframes spin {
976
+ from {
977
+ transform: rotate(0deg);
978
+ }
979
+ to {
980
+ transform: rotate(360deg);
981
+ }
982
+ }
983
+ `;
984
+ if (typeof document !== "undefined" && !document.getElementById("test-yourself-styles")) {
985
+ const style = document.createElement("style");
986
+ style.id = "test-yourself-styles";
987
+ style.textContent = touchOptimizationStyles;
988
+ document.head.appendChild(style);
989
+ }
990
+
991
+ export { DEFAULT_RESULTS, TestYourself, generateDeviceHash, getDeviceFingerprint, selectResultIndex, tryGetIPAddress };
992
+ //# sourceMappingURL=index.mjs.map
993
+ //# sourceMappingURL=index.mjs.map