import { DEFAULT_RESULTS } from '../chunk-CNTILN5J.mjs';
export { ConfigList, ConfigManager, DEFAULT_RESULTS } from '../chunk-CNTILN5J.mjs';
export { DatabaseConfigAdapter, createDatabaseConfigAdapter, testYourselfConfigShares, testYourselfConfigUsage, testYourselfConfigs } from '../chunk-NEPD75MX.mjs';
export { ConfigService, createConfigService, getDefaultConfigService } from '../chunk-TFQF2HDO.mjs';
import '../chunk-BJTO5JO5.mjs';
import React, { useState, useEffect, useRef } from 'react';

// src/testYourself/utils/fingerprint.ts
function getCanvasFingerprint() {
  try {
    const canvas = document.createElement("canvas");
    const ctx = canvas.getContext("2d");
    if (!ctx) return "no-canvas";
    canvas.width = 200;
    canvas.height = 50;
    ctx.textBaseline = "top";
    ctx.font = "14px Arial";
    ctx.fillStyle = "#f60";
    ctx.fillRect(0, 0, 200, 50);
    ctx.fillStyle = "#069";
    ctx.fillText("Canvas Fingerprint \u{1F3A8}", 2, 15);
    return canvas.toDataURL();
  } catch (error) {
    return "canvas-error";
  }
}
function getWebGLFingerprint() {
  try {
    const canvas = document.createElement("canvas");
    const gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
    if (!gl) return "no-webgl";
    const glContext = gl;
    const debugInfo = glContext.getExtension("WEBGL_debug_renderer_info");
    if (debugInfo) {
      const vendor = glContext.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);
      const renderer = glContext.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
      return `${vendor}~${renderer}`;
    }
    return "webgl-no-debug";
  } catch (error) {
    return "webgl-error";
  }
}
function getAvailableFonts() {
  const testFonts = [
    "Arial",
    "Verdana",
    "Courier New",
    "Georgia",
    "Times New Roman",
    "Comic Sans MS",
    "Trebuchet MS",
    "Arial Black",
    "Impact",
    "Courier",
    "Helvetica",
    "Monaco",
    "Consolas",
    "Menlo"
  ];
  const availableFonts = [];
  const canvas = document.createElement("canvas");
  const ctx = canvas.getContext("2d");
  if (!ctx) return "no-fonts";
  const baseFonts = ["monospace", "sans-serif", "serif"];
  const testString = "mmmmmmmmmmlli";
  const baseWidths = {};
  baseFonts.forEach((font) => {
    ctx.font = `72px ${font}`;
    baseWidths[font] = ctx.measureText(testString).width;
  });
  testFonts.forEach((font) => {
    let detected = false;
    baseFonts.forEach((baseFont) => {
      ctx.font = `72px ${font}, ${baseFont}`;
      const width = ctx.measureText(testString).width;
      if (width !== baseWidths[baseFont]) {
        detected = true;
      }
    });
    if (detected) {
      availableFonts.push(font);
    }
  });
  return availableFonts.join(",") || "no-custom-fonts";
}
function getDeviceFingerprint() {
  const fingerprint = {
    // 基础信息
    userAgent: navigator.userAgent,
    screenResolution: `${window.screen.width}x${window.screen.height}`,
    timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
    language: navigator.language,
    platform: navigator.platform,
    // 显示信息
    colorDepth: window.screen.colorDepth,
    devicePixelRatio: window.devicePixelRatio,
    // 硬件信息
    hardwareConcurrency: navigator.hardwareConcurrency || 0,
    maxTouchPoints: navigator.maxTouchPoints || 0,
    // Canvas和WebGL指纹
    canvasFingerprint: getCanvasFingerprint(),
    webglFingerprint: getWebGLFingerprint(),
    // 字体检测
    fonts: getAvailableFonts(),
    // 浏览器能力
    cookieEnabled: navigator.cookieEnabled,
    localStorageEnabled: (() => {
      try {
        return typeof localStorage !== "undefined";
      } catch {
        return false;
      }
    })(),
    sessionStorageEnabled: (() => {
      try {
        return typeof sessionStorage !== "undefined";
      } catch {
        return false;
      }
    })(),
    indexedDBEnabled: (() => {
      try {
        return typeof indexedDB !== "undefined";
      } catch {
        return false;
      }
    })()
  };
  return fingerprint;
}
async function tryGetIPAddress() {
  try {
    const response = await fetch("https://api.ipify.org?format=json", {
      method: "GET",
      mode: "cors"
    });
    if (response.ok) {
      const data = await response.json();
      return data.ip || null;
    }
  } catch (error) {
    console.warn("\u65E0\u6CD5\u83B7\u53D6IP\u5730\u5740:", error);
  }
  return null;
}
function simpleHash(str) {
  let hash = 5381;
  for (let i = 0; i < str.length; i++) {
    hash = (hash << 5) + hash + str.charCodeAt(i);
  }
  return Math.abs(hash);
}
function generateDeviceHash(fingerprint, salt = "test-yourself-salt-2024") {
  const components = [
    // 基础信息
    fingerprint.userAgent,
    fingerprint.ip || "no-ip",
    fingerprint.screenResolution,
    fingerprint.timezone,
    fingerprint.language,
    fingerprint.platform,
    // 显示信息
    fingerprint.colorDepth?.toString() || "0",
    fingerprint.devicePixelRatio?.toString() || "0",
    // 硬件信息
    fingerprint.hardwareConcurrency?.toString() || "0",
    fingerprint.maxTouchPoints?.toString() || "0",
    // Canvas和WebGL指纹（这些是最独特的）
    fingerprint.canvasFingerprint || "no-canvas",
    fingerprint.webglFingerprint || "no-webgl",
    // 字体（不同设备安装的字体不同）
    fingerprint.fonts || "no-fonts",
    // 浏览器能力
    fingerprint.cookieEnabled ? "1" : "0",
    fingerprint.localStorageEnabled ? "1" : "0",
    fingerprint.sessionStorageEnabled ? "1" : "0",
    fingerprint.indexedDBEnabled ? "1" : "0",
    // 盐值
    salt
  ];
  const combined = components.join("|");
  const hash = simpleHash(combined);
  return hash.toString(36);
}
function selectResultIndex(hash, totalResults) {
  const numHash = parseInt(hash, 36);
  return numHash % totalResults;
}

// src/testYourself/components/TestYourself.tsx
var STORAGE_KEY = "test-yourself-result";
var TestYourself = ({
  config: propConfig,
  configId,
  onResult,
  className = ""
}) => {
  const [loadedConfig, setLoadedConfig] = useState(null);
  const [configLoading, setConfigLoading] = useState(false);
  useEffect(() => {
    const loadConfig = async () => {
      if (configId) {
        setConfigLoading(true);
        try {
          const { getDefaultConfigService: getDefaultConfigService2 } = await import('../ConfigService-BV57YYFW.mjs');
          const service = getDefaultConfigService2();
          const savedConfig = await service.getConfig(configId);
          if (savedConfig) {
            setLoadedConfig(savedConfig.config);
          } else {
            console.warn(`\u914D\u7F6E ${configId} \u4E0D\u5B58\u5728\uFF0C\u4F7F\u7528\u9ED8\u8BA4\u914D\u7F6E`);
          }
        } catch (error) {
          console.error("\u52A0\u8F7D\u914D\u7F6E\u5931\u8D25:", error);
        } finally {
          setConfigLoading(false);
        }
      }
    };
    loadConfig();
  }, [configId]);
  const config = loadedConfig || propConfig || {
    gameTitle: "\u6D4B\u6D4B\u4F60\u662F\u4EC0\u4E48",
    gameDescription: "\u957F\u6309\u6309\u94AE\uFF0C\u53D1\u73B0\u4F60\u7684\u4E13\u5C5E\u5C5E\u6027",
    results: DEFAULT_RESULTS
  };
  const {
    gameTitle,
    gameDescription,
    buttonText = "\u957F\u6309\u5F00\u59CB\u6D4B\u8BD5",
    longPressDuration = 2e3,
    results = DEFAULT_RESULTS,
    enableIPFetch = false,
    customSalt,
    resultStyle = "card"
  } = config;
  const [status, setStatus] = useState("idle");
  const [result, setResult] = useState(null);
  const [pressProgress, setPressProgress] = useState(0);
  const [ipWarning, setIpWarning] = useState(null);
  const [isLoading, setIsLoading] = useState(true);
  const pressTimerRef = useRef(null);
  const progressIntervalRef = useRef(null);
  const startTimeRef = useRef(0);
  useEffect(() => {
    const initializeTest = async () => {
      if (configLoading) {
        return;
      }
      const storageKey = configId ? `${STORAGE_KEY}_${configId}` : STORAGE_KEY;
      const savedResult = localStorage.getItem(storageKey);
      if (savedResult) {
        try {
          const parsed = JSON.parse(savedResult);
          setResult(parsed);
          setStatus("completed");
          setIsLoading(false);
          return;
        } catch (error) {
          console.error("\u89E3\u6790\u4FDD\u5B58\u7684\u7ED3\u679C\u5931\u8D25:", error);
        }
      }
      if (enableIPFetch) {
        const ip = await tryGetIPAddress();
        if (!ip) {
          setIpWarning("\u26A0\uFE0F \u65E0\u6CD5\u83B7\u53D6IP\u5730\u5740\uFF0C\u5C06\u4EC5\u4F7F\u7528\u6D4F\u89C8\u5668\u6307\u7EB9\u751F\u6210\u7ED3\u679C");
        }
      }
      setIsLoading(false);
    };
    initializeTest();
  }, [enableIPFetch, configLoading, configId]);
  const calculateResult = async () => {
    try {
      const fingerprint = getDeviceFingerprint();
      if (enableIPFetch) {
        const ip = await tryGetIPAddress();
        if (ip) {
          fingerprint.ip = ip;
        }
      }
      const actualResults = results.length > 0 ? results : DEFAULT_RESULTS;
      const hash = generateDeviceHash(fingerprint, customSalt);
      const index = selectResultIndex(hash, actualResults.length);
      const selectedResult = actualResults[index];
      if (!selectedResult) {
        console.error("\u65E0\u6CD5\u83B7\u53D6\u6D4B\u8BD5\u7ED3\u679C\uFF0Cindex:", index, "total:", actualResults.length);
        throw new Error("\u65E0\u6CD5\u83B7\u53D6\u6D4B\u8BD5\u7ED3\u679C");
      }
      console.log("\u8BA1\u7B97\u7ED3\u679C\u6210\u529F:", selectedResult);
      const storageKey = configId ? `${STORAGE_KEY}_${configId}` : STORAGE_KEY;
      localStorage.setItem(storageKey, JSON.stringify(selectedResult));
      return selectedResult;
    } catch (error) {
      console.error("\u8BA1\u7B97\u7ED3\u679C\u5931\u8D25:", error);
      throw error;
    }
  };
  const handlePressStart = (e) => {
    if (status !== "idle") return;
    e.preventDefault();
    setStatus("pressing");
    startTimeRef.current = Date.now();
    progressIntervalRef.current = setInterval(() => {
      const elapsed = Date.now() - startTimeRef.current;
      const progress = Math.min(elapsed / longPressDuration * 100, 100);
      setPressProgress(progress);
    }, 16);
    pressTimerRef.current = setTimeout(async () => {
      try {
        setPressProgress(100);
        if (progressIntervalRef.current) {
          clearInterval(progressIntervalRef.current);
          progressIntervalRef.current = null;
        }
        console.log("\u5F00\u59CB\u8BA1\u7B97\u7ED3\u679C...");
        const testResult = await calculateResult();
        console.log("\u7ED3\u679C\u8BA1\u7B97\u5B8C\u6210\uFF0C\u66F4\u65B0\u72B6\u6001:", testResult);
        setResult(testResult);
        setTimeout(() => {
          setStatus("completed");
          console.log("\u72B6\u6001\u5DF2\u66F4\u65B0\u4E3A completed");
        }, 0);
        if (onResult) {
          onResult(testResult);
        }
      } catch (error) {
        console.error("\u6D4B\u8BD5\u5931\u8D25:", error);
        setStatus("idle");
        setPressProgress(0);
        alert("\u6D4B\u8BD5\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
      }
    }, longPressDuration);
    if ("button" in e && e.button === 0) {
      const handleGlobalMouseUp = () => {
        handlePressEnd();
        document.removeEventListener("mouseup", handleGlobalMouseUp);
      };
      document.addEventListener("mouseup", handleGlobalMouseUp);
    }
  };
  const handlePressEnd = () => {
    if (status !== "pressing") return;
    if (pressTimerRef.current) {
      clearTimeout(pressTimerRef.current);
      pressTimerRef.current = null;
    }
    if (progressIntervalRef.current) {
      clearInterval(progressIntervalRef.current);
      progressIntervalRef.current = null;
    }
    setStatus("idle");
    setPressProgress(0);
  };
  const handleMouseLeave = (e) => {
  };
  const handleTouchMove = (e) => {
    const touch = e.touches[0];
    if (!touch) return;
    const target = e.currentTarget;
    const rect = target.getBoundingClientRect();
    const isInside = touch.clientX >= rect.left && touch.clientX <= rect.right && touch.clientY >= rect.top && touch.clientY <= rect.bottom;
    if (!isInside && status === "pressing") {
      handlePressEnd();
    }
  };
  useEffect(() => {
    return () => {
      if (pressTimerRef.current) {
        clearTimeout(pressTimerRef.current);
      }
      if (progressIntervalRef.current) {
        clearInterval(progressIntervalRef.current);
      }
    };
  }, []);
  const handleReset = () => {
    const storageKey = configId ? `${STORAGE_KEY}_${configId}` : STORAGE_KEY;
    localStorage.removeItem(storageKey);
    setResult(null);
    setStatus("idle");
    setPressProgress(0);
  };
  const backgroundStyle = {
    position: "relative",
    minHeight: "100vh",
    overflow: "hidden",
    background: "linear-gradient(135deg, #f3e8ff 0%, #fce7f3 50%, #dbeafe 100%)"
  };
  const DecorativeBackground = () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { style: {
    position: "absolute",
    top: 0,
    left: 0,
    width: "384px",
    height: "384px",
    background: "radial-gradient(circle, rgba(192, 132, 252, 0.3) 0%, transparent 70%)",
    borderRadius: "50%",
    filter: "blur(60px)",
    transform: "translate(-50%, -50%)",
    pointerEvents: "none"
  } }), /* @__PURE__ */ React.createElement("div", { style: {
    position: "absolute",
    top: "50%",
    right: 0,
    width: "384px",
    height: "384px",
    background: "radial-gradient(circle, rgba(244, 114, 182, 0.3) 0%, transparent 70%)",
    borderRadius: "50%",
    filter: "blur(60px)",
    transform: "translateX(50%)",
    pointerEvents: "none"
  } }), /* @__PURE__ */ React.createElement("div", { style: {
    position: "absolute",
    bottom: 0,
    left: "50%",
    width: "384px",
    height: "384px",
    background: "radial-gradient(circle, rgba(147, 197, 253, 0.3) 0%, transparent 70%)",
    borderRadius: "50%",
    filter: "blur(60px)",
    transform: "translate(-50%, 50%)",
    pointerEvents: "none"
  } }));
  if (isLoading) {
    return /* @__PURE__ */ React.createElement("div", { className, style: backgroundStyle }, /* @__PURE__ */ React.createElement(DecorativeBackground, null), /* @__PURE__ */ React.createElement("div", { style: {
      position: "relative",
      zIndex: 10,
      display: "flex",
      alignItems: "center",
      justifyContent: "center",
      minHeight: "100vh"
    } }, /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement("div", { style: {
      position: "relative",
      width: "64px",
      height: "64px",
      margin: "0 auto 16px"
    } }, /* @__PURE__ */ React.createElement("div", { style: {
      position: "absolute",
      inset: 0,
      border: "4px solid #e9d5ff",
      borderRadius: "50%"
    } }), /* @__PURE__ */ React.createElement("div", { style: {
      position: "absolute",
      inset: 0,
      border: "4px solid transparent",
      borderTopColor: "#a855f7",
      borderRadius: "50%",
      animation: "spin 1s linear infinite"
    } })), /* @__PURE__ */ React.createElement("p", { style: { fontSize: "14px", color: "#6b7280" } }, "\u2728 \u52A0\u8F7D\u4E2D"))));
  }
  if (status === "completed" && result) {
    return /* @__PURE__ */ React.createElement("div", { className, style: backgroundStyle }, /* @__PURE__ */ React.createElement(DecorativeBackground, null), /* @__PURE__ */ React.createElement("div", { style: {
      position: "relative",
      zIndex: 10,
      minHeight: "100vh",
      display: "flex",
      alignItems: "center",
      justifyContent: "center",
      padding: "24px"
    } }, /* @__PURE__ */ React.createElement("div", { style: { maxWidth: "420px", width: "100%" } }, /* @__PURE__ */ React.createElement("div", { style: {
      position: "relative",
      background: "linear-gradient(135deg, #fdf2f8 0%, #faf5ff 50%, #eff6ff 100%)",
      borderRadius: "32px",
      boxShadow: "0 25px 50px -12px rgba(168, 85, 247, 0.25), 0 0 0 1px rgba(168, 85, 247, 0.1)",
      overflow: "hidden",
      padding: "40px 32px",
      textAlign: "center"
    } }, /* @__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: {
      display: "inline-block",
      fontSize: "80px",
      animation: "bounce-slow 2s ease-in-out infinite",
      filter: "drop-shadow(0 10px 20px rgba(0,0,0,0.1))"
    } }, result.imageType === "emoji" ? result.image : "\u{1F389}")), /* @__PURE__ */ React.createElement("h2", { style: {
      fontSize: "32px",
      fontWeight: 800,
      background: "linear-gradient(135deg, #9333ea 0%, #ec4899 100%)",
      WebkitBackgroundClip: "text",
      WebkitTextFillColor: "transparent",
      backgroundClip: "text",
      marginBottom: "16px",
      lineHeight: 1.3
    } }, result.title), /* @__PURE__ */ React.createElement("div", { style: {
      background: "rgba(255, 255, 255, 0.8)",
      borderRadius: "20px",
      padding: "20px 24px",
      marginBottom: "28px",
      boxShadow: "0 4px 15px rgba(168, 85, 247, 0.1)",
      border: "2px dashed rgba(168, 85, 247, 0.2)"
    } }, /* @__PURE__ */ React.createElement("p", { style: {
      fontSize: "16px",
      color: "#6b7280",
      lineHeight: 1.7,
      margin: 0
    } }, result.description)), /* @__PURE__ */ React.createElement("div", { style: {
      display: "flex",
      alignItems: "center",
      justifyContent: "center",
      gap: "8px",
      marginBottom: "24px"
    } }, /* @__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(
      "button",
      {
        onClick: handleReset,
        style: {
          display: "inline-flex",
          alignItems: "center",
          justifyContent: "center",
          gap: "8px",
          padding: "14px 32px",
          fontSize: "16px",
          fontWeight: 600,
          color: "white",
          background: "linear-gradient(135deg, #a855f7 0%, #ec4899 100%)",
          border: "none",
          borderRadius: "9999px",
          cursor: "pointer",
          boxShadow: "0 10px 25px -5px rgba(168, 85, 247, 0.4)",
          transition: "all 0.3s ease"
        },
        onMouseEnter: (e) => {
          e.currentTarget.style.transform = "scale(1.05) translateY(-2px)";
          e.currentTarget.style.boxShadow = "0 15px 35px -5px rgba(168, 85, 247, 0.5)";
        },
        onMouseLeave: (e) => {
          e.currentTarget.style.transform = "scale(1) translateY(0)";
          e.currentTarget.style.boxShadow = "0 10px 25px -5px rgba(168, 85, 247, 0.4)";
        }
      },
      /* @__PURE__ */ React.createElement("span", null, "\u{1F504}"),
      /* @__PURE__ */ React.createElement("span", null, "\u91CD\u65B0\u6D4B\u8BD5")
    )))));
  }
  return /* @__PURE__ */ React.createElement("div", { className, style: backgroundStyle }, /* @__PURE__ */ React.createElement(DecorativeBackground, null), /* @__PURE__ */ React.createElement("div", { style: {
    position: "relative",
    zIndex: 10,
    minHeight: "100vh",
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    padding: "16px"
  } }, /* @__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: {
    display: "inline-block",
    marginBottom: "16px",
    animation: "bounce-slow 2s ease-in-out infinite"
  } }, /* @__PURE__ */ React.createElement("span", { style: { fontSize: "56px" } }, "\u{1F3B2}")), /* @__PURE__ */ React.createElement("h1", { style: {
    fontSize: "48px",
    fontWeight: 900,
    marginBottom: "12px",
    background: "linear-gradient(135deg, #9333ea 0%, #ec4899 50%, #3b82f6 100%)",
    WebkitBackgroundClip: "text",
    WebkitTextFillColor: "transparent",
    backgroundClip: "text",
    lineHeight: 1.2
  } }, gameTitle), gameDescription && /* @__PURE__ */ React.createElement("p", { style: {
    fontSize: "18px",
    color: "#6b7280",
    fontWeight: 500
  } }, gameDescription)), /* @__PURE__ */ React.createElement("div", { style: { marginBottom: "24px" } }, /* @__PURE__ */ React.createElement(
    "button",
    {
      onMouseDown: handlePressStart,
      onMouseLeave: handleMouseLeave,
      onTouchStart: handlePressStart,
      onTouchEnd: handlePressEnd,
      onTouchMove: handleTouchMove,
      onTouchCancel: handlePressEnd,
      onContextMenu: (e) => e.preventDefault(),
      onDragStart: (e) => e.preventDefault(),
      style: {
        display: "block",
        margin: "0 auto",
        width: "200px",
        height: "200px",
        borderRadius: "50%",
        border: "none",
        fontSize: "20px",
        fontWeight: "bold",
        cursor: "pointer",
        position: "relative",
        overflow: "hidden",
        userSelect: "none",
        WebkitTouchCallout: "none",
        WebkitUserSelect: "none",
        touchAction: "none",
        transition: "transform 0.3s ease",
        transform: status === "pressing" ? "scale(0.95)" : "scale(1)",
        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%)",
        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)"
      }
    },
    /* @__PURE__ */ React.createElement("div", { style: {
      position: "absolute",
      top: 0,
      left: 0,
      right: 0,
      bottom: 0,
      display: "flex",
      flexDirection: "column",
      alignItems: "center",
      justifyContent: "center",
      color: "white",
      pointerEvents: "none"
    } }, 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))),
    status === "idle" && /* @__PURE__ */ React.createElement("div", { style: {
      position: "absolute",
      top: "16px",
      left: "16px",
      right: "16px",
      bottom: "16px",
      border: "2px solid rgba(255,255,255,0.3)",
      borderRadius: "50%"
    } })
  ), status === "pressing" && /* @__PURE__ */ React.createElement("div", { style: {
    marginTop: "16px",
    marginLeft: "auto",
    marginRight: "auto",
    width: "192px",
    height: "8px",
    backgroundColor: "#e5e7eb",
    borderRadius: "9999px",
    overflow: "hidden"
  } }, /* @__PURE__ */ React.createElement("div", { style: {
    height: "100%",
    width: `${pressProgress}%`,
    background: "linear-gradient(to right, #a855f7, #ec4899)",
    transition: "width 0.1s ease"
  } }))), /* @__PURE__ */ React.createElement("div", { style: { marginTop: "24px" } }, status === "pressing" ? /* @__PURE__ */ React.createElement("p", { style: {
    fontSize: "18px",
    fontWeight: 500,
    color: "#9333ea",
    animation: "pulse 2s ease-in-out infinite"
  } }, "\u2728 \u6B63\u5728\u5206\u6790\u4E2D...") : /* @__PURE__ */ React.createElement("div", { style: {
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    gap: "8px"
  } }, /* @__PURE__ */ React.createElement("span", { style: {
    display: "inline-block",
    width: "6px",
    height: "6px",
    backgroundColor: "#a855f7",
    borderRadius: "50%",
    animation: "bounce 1s infinite"
  } }), /* @__PURE__ */ React.createElement("span", { style: {
    display: "inline-block",
    width: "6px",
    height: "6px",
    backgroundColor: "#ec4899",
    borderRadius: "50%",
    animation: "bounce 1s infinite 0.1s"
  } }), /* @__PURE__ */ React.createElement("span", { style: {
    display: "inline-block",
    width: "6px",
    height: "6px",
    backgroundColor: "#3b82f6",
    borderRadius: "50%",
    animation: "bounce 1s infinite 0.2s"
  } }))))));
};
var touchOptimizationStyles = `
  @keyframes bounce-slow {
    0%, 100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-10px);
    }
  }
  
  @keyframes bounce {
    0%, 100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-4px);
    }
  }
  
  @keyframes pulse {
    0%, 100% {
      opacity: 1;
    }
    50% {
      opacity: 0.5;
    }
  }
  
  @keyframes spin {
    from {
      transform: rotate(0deg);
    }
    to {
      transform: rotate(360deg);
    }
  }
`;
if (typeof document !== "undefined" && !document.getElementById("test-yourself-styles")) {
  const style = document.createElement("style");
  style.id = "test-yourself-styles";
  style.textContent = touchOptimizationStyles;
  document.head.appendChild(style);
}

export { TestYourself, generateDeviceHash, getDeviceFingerprint, selectResultIndex, tryGetIPAddress };
//# sourceMappingURL=index.mjs.map
//# sourceMappingURL=index.mjs.map