{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/utils/is-network-error/index.js"],"sourcesContent":["/* oxlint-disable */\nconst objectToString = Object.prototype.toString;\n\nconst isError = (value) => objectToString.call(value) === \"[object Error]\";\n\nconst errorMessages = new Set([\n  \"network error\", // Chrome\n  \"Failed to fetch\", // Chrome\n  \"NetworkError when attempting to fetch resource.\", // Firefox\n  \"The Internet connection appears to be offline.\", // Safari 16\n  \"Network request failed\", // `cross-fetch`\n  \"fetch failed\", // Undici (Node.js)\n  \"terminated\", // Undici (Node.js)\n  \" A network error occurred.\", // Bun (WebKit)\n  \"Network connection lost\", // Cloudflare Workers (fetch)\n]);\n\nexport default function isNetworkError(error) {\n  const isValid =\n    error &&\n    isError(error) &&\n    error.name === \"TypeError\" &&\n    typeof error.message === \"string\";\n\n  if (!isValid) {\n    return false;\n  }\n\n  const { message, stack } = error;\n\n  // Safari 17+ has generic message but no stack for network errors\n  if (message === \"Load failed\") {\n    return (\n      stack === undefined ||\n      // Sentry adds its own stack trace to the fetch error, so also check for that\n      \"__sentry_captured__\" in error\n    );\n  }\n\n  // Deno network errors start with specific text\n  if (message.startsWith(\"error sending request for url\")) {\n    return true;\n  }\n\n  // Standard network error messages\n  return errorMessages.has(message);\n}\n"],"mappings":";AACA,MAAM,iBAAiB,OAAO,UAAU;AAExC,MAAM,WAAW,UAAU,eAAe,KAAK,MAAM,KAAK;AAE1D,MAAM,gBAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,SAAwB,eAAe,OAAO;AAO5C,KAAI,EALF,SACA,QAAQ,MAAM,IACd,MAAM,SAAS,eACf,OAAO,MAAM,YAAY,UAGzB,QAAO;CAGT,MAAM,EAAE,SAAS,UAAU;AAG3B,KAAI,YAAY,cACd,QACE,UAAU,KAAA,KAEV,yBAAyB;AAK7B,KAAI,QAAQ,WAAW,gCAAgC,CACrD,QAAO;AAIT,QAAO,cAAc,IAAI,QAAQ"}