{"version":3,"file":"errors.mjs","names":[],"sources":["../../src/utils/errors.ts"],"sourcesContent":["import { GraphQLError } from \"graphql\";\nimport { COPILOTKIT_VERSION } from \"../index\";\n\nexport enum Severity {\n  CRITICAL = \"critical\", // Critical errors that block core functionality\n  WARNING = \"warning\", // Configuration/setup issues that need attention\n  INFO = \"info\", // General errors and network issues\n}\n\nexport enum ErrorVisibility {\n  BANNER = \"banner\", // Critical errors shown as fixed banners\n  TOAST = \"toast\", // Regular errors shown as dismissible toasts\n  SILENT = \"silent\", // Errors logged but not shown to user\n  DEV_ONLY = \"dev_only\", // Errors only shown in development mode\n}\n\nexport const ERROR_NAMES = {\n  COPILOT_ERROR: \"CopilotError\",\n  COPILOT_API_DISCOVERY_ERROR: \"CopilotApiDiscoveryError\",\n  COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR:\n    \"CopilotKitRemoteEndpointDiscoveryError\",\n  COPILOT_KIT_AGENT_DISCOVERY_ERROR: \"CopilotKitAgentDiscoveryError\",\n  COPILOT_KIT_LOW_LEVEL_ERROR: \"CopilotKitLowLevelError\",\n  COPILOT_KIT_VERSION_MISMATCH_ERROR: \"CopilotKitVersionMismatchError\",\n  RESOLVED_COPILOT_KIT_ERROR: \"ResolvedCopilotKitError\",\n  CONFIGURATION_ERROR: \"ConfigurationError\",\n  MISSING_PUBLIC_API_KEY_ERROR: \"MissingPublicApiKeyError\",\n  UPGRADE_REQUIRED_ERROR: \"UpgradeRequiredError\",\n} as const;\n\n// Banner errors - critical configuration/discovery issues\nexport const BANNER_ERROR_NAMES = [\n  ERROR_NAMES.CONFIGURATION_ERROR,\n  ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR,\n  ERROR_NAMES.UPGRADE_REQUIRED_ERROR,\n  ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR,\n  ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR,\n  ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR,\n];\n\n// Legacy cloud error names for backward compatibility\nexport const COPILOT_CLOUD_ERROR_NAMES = BANNER_ERROR_NAMES;\n\nexport enum CopilotKitErrorCode {\n  NETWORK_ERROR = \"NETWORK_ERROR\",\n  NOT_FOUND = \"NOT_FOUND\",\n  AGENT_NOT_FOUND = \"AGENT_NOT_FOUND\",\n  API_NOT_FOUND = \"API_NOT_FOUND\",\n  REMOTE_ENDPOINT_NOT_FOUND = \"REMOTE_ENDPOINT_NOT_FOUND\",\n  AUTHENTICATION_ERROR = \"AUTHENTICATION_ERROR\",\n  MISUSE = \"MISUSE\",\n  UNKNOWN = \"UNKNOWN\",\n  VERSION_MISMATCH = \"VERSION_MISMATCH\",\n  CONFIGURATION_ERROR = \"CONFIGURATION_ERROR\",\n  MISSING_PUBLIC_API_KEY_ERROR = \"MISSING_PUBLIC_API_KEY_ERROR\",\n  UPGRADE_REQUIRED_ERROR = \"UPGRADE_REQUIRED_ERROR\",\n}\n\nconst BASE_URL = \"https://docs.copilotkit.ai\";\n\nconst getSeeMoreMarkdown = (link: string) => `See more: [${link}](${link})`;\n\nexport const ERROR_CONFIG = {\n  [CopilotKitErrorCode.NETWORK_ERROR]: {\n    statusCode: 503,\n    troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n    visibility: ErrorVisibility.BANNER,\n    severity: Severity.CRITICAL,\n  },\n  [CopilotKitErrorCode.NOT_FOUND]: {\n    statusCode: 404,\n    troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n    visibility: ErrorVisibility.BANNER,\n    severity: Severity.CRITICAL,\n  },\n  [CopilotKitErrorCode.AGENT_NOT_FOUND]: {\n    statusCode: 500,\n    troubleshootingUrl: `${BASE_URL}/coagents/troubleshooting/common-issues#i-am-getting-agent-not-found-error`,\n    visibility: ErrorVisibility.BANNER,\n    severity: Severity.CRITICAL,\n  },\n  [CopilotKitErrorCode.API_NOT_FOUND]: {\n    statusCode: 404,\n    troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n    visibility: ErrorVisibility.BANNER,\n    severity: Severity.CRITICAL,\n  },\n  [CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND]: {\n    statusCode: 404,\n    troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-copilotkits-remote-endpoint-not-found-error`,\n    visibility: ErrorVisibility.BANNER,\n    severity: Severity.CRITICAL,\n  },\n  [CopilotKitErrorCode.AUTHENTICATION_ERROR]: {\n    statusCode: 401,\n    troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#authentication-errors`,\n    visibility: ErrorVisibility.BANNER,\n    severity: Severity.CRITICAL,\n  },\n  [CopilotKitErrorCode.MISUSE]: {\n    statusCode: 400,\n    troubleshootingUrl: null,\n    visibility: ErrorVisibility.DEV_ONLY,\n    severity: Severity.WARNING,\n  },\n  [CopilotKitErrorCode.UNKNOWN]: {\n    statusCode: 500,\n    visibility: ErrorVisibility.TOAST,\n    severity: Severity.CRITICAL,\n  },\n  [CopilotKitErrorCode.CONFIGURATION_ERROR]: {\n    statusCode: 400,\n    troubleshootingUrl: null,\n    severity: Severity.WARNING,\n    visibility: ErrorVisibility.BANNER,\n  },\n  [CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR]: {\n    statusCode: 400,\n    troubleshootingUrl: null,\n    severity: Severity.CRITICAL,\n    visibility: ErrorVisibility.BANNER,\n  },\n  [CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR]: {\n    statusCode: 402,\n    troubleshootingUrl: null,\n    severity: Severity.WARNING,\n    visibility: ErrorVisibility.BANNER,\n  },\n  [CopilotKitErrorCode.VERSION_MISMATCH]: {\n    statusCode: 400,\n    troubleshootingUrl: null,\n    visibility: ErrorVisibility.DEV_ONLY,\n    severity: Severity.INFO,\n  },\n};\n\nexport class CopilotKitError extends GraphQLError {\n  code: CopilotKitErrorCode;\n  statusCode: number;\n  severity?: Severity;\n  visibility: ErrorVisibility;\n\n  constructor({\n    message = \"Unknown error occurred\",\n    code,\n    severity,\n    visibility,\n  }: {\n    message?: string;\n    code: CopilotKitErrorCode;\n    severity?: Severity;\n    visibility?: ErrorVisibility;\n  }) {\n    const name = ERROR_NAMES.COPILOT_ERROR;\n    const config = ERROR_CONFIG[code];\n    const { statusCode } = config;\n    const resolvedVisibility =\n      visibility ?? config.visibility ?? ErrorVisibility.TOAST;\n    const resolvedSeverity =\n      severity ?? (\"severity\" in config ? config.severity : undefined);\n\n    super(message, {\n      extensions: {\n        name,\n        statusCode,\n        code,\n        visibility: resolvedVisibility,\n        severity: resolvedSeverity,\n        troubleshootingUrl:\n          \"troubleshootingUrl\" in config ? config.troubleshootingUrl : null,\n        originalError: {\n          message,\n          stack: new Error().stack,\n        },\n      },\n    });\n\n    this.code = code;\n    this.name = name;\n    this.statusCode = statusCode;\n    this.severity = resolvedSeverity;\n    this.visibility = resolvedVisibility;\n  }\n}\n\n/**\n * Error thrown when we can identify wrong usage of our components.\n * This helps us notify the developer before real errors can happen\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitMisuseError extends CopilotKitError {\n  constructor({\n    message,\n    code = CopilotKitErrorCode.MISUSE,\n  }: {\n    message: string;\n    code?: CopilotKitErrorCode;\n  }) {\n    const docsLink =\n      \"troubleshootingUrl\" in ERROR_CONFIG[code] &&\n      ERROR_CONFIG[code].troubleshootingUrl\n        ? getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl as string)\n        : null;\n    const finalMessage = docsLink ? `${message}.\\n\\n${docsLink}` : message;\n    super({ message: finalMessage, code });\n    this.name = ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR;\n  }\n}\n\nconst getVersionMismatchErrorMessage = ({\n  reactCoreVersion,\n  runtimeVersion,\n  runtimeClientGqlVersion,\n}: VersionMismatchResponse) =>\n  `Version mismatch detected: @copilotkit/runtime@${runtimeVersion ?? \"\"} is not compatible with @copilotkit/react-core@${reactCoreVersion} and @copilotkit/runtime-client-gql@${runtimeClientGqlVersion}. Please ensure all installed copilotkit packages are on the same version.`;\n/**\n * Error thrown when CPK versions does not match\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitVersionMismatchError extends CopilotKitError {\n  constructor({\n    reactCoreVersion,\n    runtimeVersion,\n    runtimeClientGqlVersion,\n  }: VersionMismatchResponse) {\n    const code = CopilotKitErrorCode.VERSION_MISMATCH;\n    super({\n      message: getVersionMismatchErrorMessage({\n        reactCoreVersion,\n        runtimeVersion,\n        runtimeClientGqlVersion,\n      }),\n      code,\n    });\n    this.name = ERROR_NAMES.COPILOT_KIT_VERSION_MISMATCH_ERROR;\n  }\n}\n\n/**\n * Error thrown when the CopilotKit API endpoint cannot be discovered or accessed.\n * This typically occurs when:\n * - The API endpoint URL is invalid or misconfigured\n * - The API service is not running at the expected location\n * - There are network/firewall issues preventing access\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitApiDiscoveryError extends CopilotKitError {\n  constructor(\n    params: {\n      message?: string;\n      code?:\n        | CopilotKitErrorCode.API_NOT_FOUND\n        | CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND;\n      url?: string;\n    } = {},\n  ) {\n    const url = params.url ?? \"\";\n    let operationSuffix = \"\";\n    if (url?.includes(\"/info\"))\n      operationSuffix = `when fetching CopilotKit info`;\n    else if (url.includes(\"/actions/execute\"))\n      operationSuffix = `when attempting to execute actions.`;\n    else if (url.includes(\"/agents/state\"))\n      operationSuffix = `when attempting to get agent state.`;\n    else if (url.includes(\"/agents/execute\"))\n      operationSuffix = `when attempting to execute agent(s).`;\n    const message =\n      params.message ??\n      (params.url\n        ? `Failed to find CopilotKit API endpoint at url ${params.url} ${operationSuffix}`\n        : `Failed to find CopilotKit API endpoint.`);\n    const code = params.code ?? CopilotKitErrorCode.API_NOT_FOUND;\n    const errorMessage = `${message}.\\n\\n${getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl)}`;\n    super({ message: errorMessage, code });\n    this.name = ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR;\n  }\n}\n\n/**\n * This error is used for endpoints specified in runtime's remote endpoints. If they cannot be contacted\n * This typically occurs when:\n * - The API endpoint URL is invalid or misconfigured\n * - The API service is not running at the expected location\n *\n * @extends CopilotKitApiDiscoveryError\n */\nexport class CopilotKitRemoteEndpointDiscoveryError extends CopilotKitApiDiscoveryError {\n  constructor(params?: { message?: string; url?: string }) {\n    const message =\n      params?.message ??\n      (params?.url\n        ? `Failed to find or contact remote endpoint at url ${params.url}`\n        : \"Failed to find or contact remote endpoint\");\n    const code = CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND;\n    super({ message, code });\n    this.name = ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR;\n  }\n}\n\n/**\n * Error thrown when a LangGraph agent cannot be found or accessed.\n * This typically occurs when:\n * - The specified agent name does not exist in the deployment\n * - The agent configuration is invalid or missing\n * - The agent service is not properly deployed or initialized\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitAgentDiscoveryError extends CopilotKitError {\n  constructor(params: {\n    agentName?: string;\n    availableAgents: { name: string; id: string }[];\n  }) {\n    const { agentName, availableAgents } = params;\n    const code = CopilotKitErrorCode.AGENT_NOT_FOUND;\n\n    const seeMore = getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl);\n    let message;\n\n    if (availableAgents.length) {\n      const agentList = availableAgents.map((agent) => agent.name).join(\", \");\n\n      if (agentName) {\n        message = `Agent '${agentName}' was not found. Available agents are: ${agentList}. Please verify the agent name in your configuration and ensure it matches one of the available agents.\\n\\n${seeMore}`;\n      } else {\n        message = `The requested agent was not found. Available agents are: ${agentList}. Please verify the agent name in your configuration and ensure it matches one of the available agents.\\n\\n${seeMore}`;\n      }\n    } else {\n      message = `${agentName ? `Agent '${agentName}'` : \"The requested agent\"} was not found. Please set up at least one agent before proceeding. ${seeMore}`;\n    }\n\n    super({ message, code });\n    this.name = ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR;\n  }\n}\n\n/**\n * Handles low-level networking errors that occur before a request reaches the server.\n * These errors arise from issues in the underlying communication infrastructure rather than\n * application-level logic or server responses. Typically used to handle \"fetch failed\" errors\n * where no HTTP status code is available.\n *\n * Common scenarios include:\n * - Connection failures (ECONNREFUSED) when server is down/unreachable\n * - DNS resolution failures (ENOTFOUND) when domain can't be resolved\n * - Timeouts (ETIMEDOUT) when request takes too long\n * - Protocol/transport layer errors like SSL/TLS issues\n */\nexport class CopilotKitLowLevelError extends CopilotKitError {\n  constructor({\n    error,\n    url,\n    message,\n  }: {\n    error: Error;\n    url: string;\n    message?: string;\n  }) {\n    let code = CopilotKitErrorCode.NETWORK_ERROR;\n\n    // @ts-expect-error -- code may exist\n    const errorCode = error.code as string;\n    const errorMessage =\n      message ?? resolveLowLevelErrorMessage({ errorCode, url });\n\n    super({ message: errorMessage, code });\n\n    this.name = ERROR_NAMES.COPILOT_KIT_LOW_LEVEL_ERROR;\n  }\n}\n\n/**\n * Generic catch-all error handler for HTTP responses from the CopilotKit API where a status code is available.\n * Used when we receive an HTTP error status and wish to handle broad range of them\n *\n * This differs from CopilotKitLowLevelError in that:\n * - ResolvedCopilotKitError: Server was reached and returned an HTTP status\n * - CopilotKitLowLevelError: Error occurred before reaching server (e.g. network failure)\n *\n * @param status - The HTTP status code received from the API response\n * @param message - Optional error message to include\n * @param code - Optional specific CopilotKitErrorCode to override default behavior\n *\n * Default behavior:\n * - 400 Bad Request: Maps to CopilotKitApiDiscoveryError\n * - All other status codes: Maps to UNKNOWN error code if no specific code provided\n */\nexport class ResolvedCopilotKitError extends CopilotKitError {\n  constructor({\n    status,\n    message,\n    code,\n    isRemoteEndpoint,\n    url,\n  }: {\n    status: number;\n    message?: string;\n    code?: CopilotKitErrorCode;\n    isRemoteEndpoint?: boolean;\n    url?: string;\n  }) {\n    let resolvedCode = code;\n    if (!resolvedCode) {\n      switch (status) {\n        case 400:\n          throw new CopilotKitApiDiscoveryError({ message, url });\n        case 404:\n          throw isRemoteEndpoint\n            ? new CopilotKitRemoteEndpointDiscoveryError({ message, url })\n            : new CopilotKitApiDiscoveryError({ message, url });\n        default:\n          resolvedCode = CopilotKitErrorCode.UNKNOWN;\n          break;\n      }\n    }\n\n    super({ message, code: resolvedCode });\n    this.name = ERROR_NAMES.RESOLVED_COPILOT_KIT_ERROR;\n  }\n}\n\nexport class ConfigurationError extends CopilotKitError {\n  constructor(message: string) {\n    super({ message, code: CopilotKitErrorCode.CONFIGURATION_ERROR });\n    this.name = ERROR_NAMES.CONFIGURATION_ERROR;\n    this.severity = Severity.WARNING;\n  }\n}\n\nexport class MissingPublicApiKeyError extends ConfigurationError {\n  constructor(message: string) {\n    super(message);\n    this.name = ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR;\n    this.severity = Severity.CRITICAL;\n  }\n}\n\nexport class UpgradeRequiredError extends ConfigurationError {\n  constructor(message: string) {\n    super(message);\n    this.name = ERROR_NAMES.UPGRADE_REQUIRED_ERROR;\n    this.severity = Severity.WARNING;\n  }\n}\n\n/**\n * Checks if an error is already a structured CopilotKit error.\n * This utility centralizes the logic for detecting structured errors across the codebase.\n *\n * @param error - The error to check\n * @returns true if the error is already structured, false otherwise\n */\nexport function isStructuredCopilotKitError(error: any): boolean {\n  return (\n    error instanceof CopilotKitError ||\n    error instanceof CopilotKitLowLevelError ||\n    (error?.name && error.name.includes(\"CopilotKit\")) ||\n    error?.extensions?.code !== undefined // Check if it has our structured error properties\n  );\n}\n\n/**\n * Returns the error as-is if it's already structured, otherwise converts it using the provided converter function.\n * This utility centralizes the pattern of preserving structured errors while converting unstructured ones.\n *\n * @param error - The error to process\n * @param converter - Function to convert unstructured errors to structured ones\n * @returns The structured error\n */\nexport function ensureStructuredError<T extends CopilotKitError>(\n  error: any,\n  converter: (error: any) => T,\n): T | any {\n  return isStructuredCopilotKitError(error) ? error : converter(error);\n}\n\ninterface VersionMismatchResponse {\n  runtimeVersion?: string;\n  runtimeClientGqlVersion: string;\n  reactCoreVersion: string;\n}\n\nexport async function getPossibleVersionMismatch({\n  runtimeVersion,\n  runtimeClientGqlVersion,\n}: {\n  runtimeVersion?: string;\n  runtimeClientGqlVersion: string;\n}) {\n  if (!runtimeVersion || runtimeVersion === \"\" || !runtimeClientGqlVersion)\n    return;\n  if (\n    COPILOTKIT_VERSION !== runtimeVersion ||\n    COPILOTKIT_VERSION !== runtimeClientGqlVersion ||\n    runtimeVersion !== runtimeClientGqlVersion\n  ) {\n    return {\n      runtimeVersion,\n      runtimeClientGqlVersion,\n      reactCoreVersion: COPILOTKIT_VERSION,\n      message: getVersionMismatchErrorMessage({\n        runtimeVersion,\n        runtimeClientGqlVersion,\n        reactCoreVersion: COPILOTKIT_VERSION,\n      }),\n    };\n  }\n\n  return;\n}\n\nconst resolveLowLevelErrorMessage = ({\n  errorCode,\n  url,\n}: {\n  errorCode?: string;\n  url: string;\n}) => {\n  const troubleshootingLink =\n    ERROR_CONFIG[CopilotKitErrorCode.NETWORK_ERROR].troubleshootingUrl;\n  const genericMessage = (\n    description = `Failed to fetch from url ${url}.`,\n  ) => `${description}.\n\nPossible reasons:\n- -The server may have an error preventing it from returning a response (Check the server logs for more info).\n- -The server might be down or unreachable\n- -There might be a network issue (e.g., DNS failure, connection timeout) \n- -The URL might be incorrect\n- -The server is not running on the specified port\n\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n\n  if (url.includes(\"/info\"))\n    return genericMessage(\n      `Failed to fetch CopilotKit agents/action information from url ${url}.`,\n    );\n  if (url.includes(\"/actions/execute\"))\n    return genericMessage(`Fetch call to ${url} to execute actions failed.`);\n  if (url.includes(\"/agents/state\"))\n    return genericMessage(`Fetch call to ${url} to get agent state failed.`);\n  if (url.includes(\"/agents/execute\"))\n    return genericMessage(`Fetch call to ${url} to execute agent(s) failed.`);\n\n  switch (errorCode) {\n    case \"ECONNREFUSED\":\n      return `Connection to ${url} was refused. Ensure the server is running and accessible.\\n\\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n    case \"ENOTFOUND\":\n      return `The server on ${url} could not be found. Check the URL or your network configuration.\\n\\n${getSeeMoreMarkdown(ERROR_CONFIG[CopilotKitErrorCode.NOT_FOUND].troubleshootingUrl)}`;\n    case \"ETIMEDOUT\":\n      return `The connection to ${url} timed out. The server might be overloaded or taking too long to respond.\\n\\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n    default:\n      return;\n  }\n};\n"],"mappings":";;;;AAGA,IAAY,8CAAL;AACL;AACA;AACA;;;AAGF,IAAY,4DAAL;AACL;AACA;AACA;AACA;;;AAGF,MAAa,cAAc;CACzB,eAAe;CACf,6BAA6B;CAC7B,yCACE;CACF,mCAAmC;CACnC,6BAA6B;CAC7B,oCAAoC;CACpC,4BAA4B;CAC5B,qBAAqB;CACrB,8BAA8B;CAC9B,wBAAwB;CACzB;AAGD,MAAa,qBAAqB;CAChC,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACb;AAGD,MAAa,4BAA4B;AAEzC,IAAY,oEAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGF,MAAM,WAAW;AAEjB,MAAM,sBAAsB,SAAiB,cAAc,KAAK,IAAI,KAAK;AAEzE,MAAa,eAAe;EACzB,oBAAoB,gBAAgB;EACnC,YAAY;EACZ,oBAAoB,GAAG,SAAS;EAChC,YAAY,gBAAgB;EAC5B,UAAU,SAAS;EACpB;EACA,oBAAoB,YAAY;EAC/B,YAAY;EACZ,oBAAoB,GAAG,SAAS;EAChC,YAAY,gBAAgB;EAC5B,UAAU,SAAS;EACpB;EACA,oBAAoB,kBAAkB;EACrC,YAAY;EACZ,oBAAoB,GAAG,SAAS;EAChC,YAAY,gBAAgB;EAC5B,UAAU,SAAS;EACpB;EACA,oBAAoB,gBAAgB;EACnC,YAAY;EACZ,oBAAoB,GAAG,SAAS;EAChC,YAAY,gBAAgB;EAC5B,UAAU,SAAS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