/**
 * 错误码定义
 * 提供统一的错误码和错误信息映射
 */ /**
 * 错误码枚举
 */ export var ErrorCode = /*#__PURE__*/ function(ErrorCode) {
    // 框架启动错误 (1000-1999)
    ErrorCode[ErrorCode["CONTAINER_NOT_FOUND"] = 1001] = "CONTAINER_NOT_FOUND";
    ErrorCode[ErrorCode["STARTUP_FAILED"] = 1002] = "STARTUP_FAILED";
    ErrorCode[ErrorCode["INITIALIZATION_FAILED"] = 1003] = "INITIALIZATION_FAILED";
    // 配置错误 (2000-2999)
    ErrorCode[ErrorCode["CONFIG_LOAD_FAILED"] = 2001] = "CONFIG_LOAD_FAILED";
    ErrorCode[ErrorCode["CONFIG_VALIDATION_FAILED"] = 2002] = "CONFIG_VALIDATION_FAILED";
    ErrorCode[ErrorCode["CONFIG_FILE_NOT_FOUND"] = 2003] = "CONFIG_FILE_NOT_FOUND";
    // 插件错误 (3000-3999)
    ErrorCode[ErrorCode["PLUGIN_REGISTER_FAILED"] = 3001] = "PLUGIN_REGISTER_FAILED";
    ErrorCode[ErrorCode["PLUGIN_EXECUTION_FAILED"] = 3002] = "PLUGIN_EXECUTION_FAILED";
    ErrorCode[ErrorCode["PLUGIN_PERMISSION_DENIED"] = 3003] = "PLUGIN_PERMISSION_DENIED";
    // 状态管理错误 (4000-4999)
    ErrorCode[ErrorCode["STATE_MANAGER_NOT_INITIALIZED"] = 4001] = "STATE_MANAGER_NOT_INITIALIZED";
    ErrorCode[ErrorCode["STATE_INSTANCE_NOT_FOUND"] = 4002] = "STATE_INSTANCE_NOT_FOUND";
    ErrorCode[ErrorCode["STATE_SCOPE_NOT_FOUND"] = 4003] = "STATE_SCOPE_NOT_FOUND";
    // 存储错误 (5000-5999)
    ErrorCode[ErrorCode["STORAGE_INITIALIZATION_FAILED"] = 5001] = "STORAGE_INITIALIZATION_FAILED";
    ErrorCode[ErrorCode["STORAGE_OPERATION_FAILED"] = 5002] = "STORAGE_OPERATION_FAILED";
    // 网络错误 (6000-6999)
    ErrorCode[ErrorCode["NETWORK_ERROR"] = 6001] = "NETWORK_ERROR";
    ErrorCode[ErrorCode["NETWORK_TIMEOUT"] = 6002] = "NETWORK_TIMEOUT";
    // 未知错误 (9999)
    ErrorCode[ErrorCode["UNKNOWN_ERROR"] = 9999] = "UNKNOWN_ERROR";
    return ErrorCode;
}({});
/**
 * 错误信息映射
 */ export const ErrorMessages = {
    [1001]: '未找到挂载容器，请确保页面中存在 id="root" 的元素或通过 container 选项指定容器',
    [1002]: '框架启动失败',
    [1003]: '初始化失败',
    [2001]: '配置加载失败',
    [2002]: '配置验证失败',
    [2003]: '配置文件未找到',
    [3001]: '插件注册失败',
    [3002]: '插件执行失败',
    [3003]: '插件权限不足',
    [4001]: '状态管理器未初始化',
    [4002]: '状态实例未找到',
    [4003]: '状态作用域未找到',
    [5001]: '存储初始化失败',
    [5002]: '存储操作失败',
    [6001]: '网络错误',
    [6002]: '网络请求超时',
    [9999]: '未知错误'
};
/**
 * 获取错误信息
 * 
 * @param code - 错误码
 * @returns 错误信息
 */ export function getErrorMessage(code) {
    return ErrorMessages[code] || ErrorMessages[9999];
}
/**
 * 获取用户友好的错误提示
 * 
 * @param code - 错误码
 * @param details - 详细信息
 * @returns 用户友好的错误提示
 */ export function getUserFriendlyMessage(code, details) {
    const baseMessage = getErrorMessage(code);
    if (details) {
        return `${baseMessage}: ${details}`;
    }
    // 根据错误码提供修复建议
    const suggestions = {
        [1001]: '请检查HTML中是否存在id="root"的元素，或通过container选项指定容器',
        [2002]: '请检查配置文件格式是否正确，参考文档进行配置',
        [3003]: '请检查插件权限配置，确保插件有足够的权限'
    };
    const suggestion = suggestions[code];
    if (suggestion) {
        return `${baseMessage}\n建议: ${suggestion}`;
    }
    return baseMessage;
}

//# sourceMappingURL=ErrorCodes.js.map