{
  "version": 3,
  "sources": ["../dist-src/index.js", "../dist-src/auth.js", "../dist-src/is-rate-limit-error.js", "../dist-src/is-abuse-limit-error.js", "../dist-src/hook.js"],
  "sourcesContent": ["import { auth } from \"./auth\";\nimport { hook } from \"./hook\";\nconst createUnauthenticatedAuth = function createUnauthenticatedAuth2(options) {\n  if (!options || !options.reason) {\n    throw new Error(\n      \"[@octokit/auth-unauthenticated] No reason passed to createUnauthenticatedAuth\"\n    );\n  }\n  return Object.assign(auth.bind(null, options.reason), {\n    hook: hook.bind(null, options.reason)\n  });\n};\nexport {\n  createUnauthenticatedAuth\n};\n", "async function auth(reason) {\n  return {\n    type: \"unauthenticated\",\n    reason\n  };\n}\nexport {\n  auth\n};\n", "import { RequestError } from \"@octokit/request-error\";\nfunction isRateLimitError(error) {\n  if (error.status !== 403) {\n    return false;\n  }\n  if (!error.response) {\n    return false;\n  }\n  return error.response.headers[\"x-ratelimit-remaining\"] === \"0\";\n}\nexport {\n  isRateLimitError\n};\n", "import { RequestError } from \"@octokit/request-error\";\nconst REGEX_ABUSE_LIMIT_MESSAGE = /\\babuse\\b/i;\nfunction isAbuseLimitError(error) {\n  if (error.status !== 403) {\n    return false;\n  }\n  return REGEX_ABUSE_LIMIT_MESSAGE.test(error.message);\n}\nexport {\n  isAbuseLimitError\n};\n", "import { isRateLimitError } from \"./is-rate-limit-error\";\nimport { isAbuseLimitError } from \"./is-abuse-limit-error\";\nasync function hook(reason, request, route, parameters) {\n  const endpoint = request.endpoint.merge(\n    route,\n    parameters\n  );\n  return request(endpoint).catch((error) => {\n    if (error.status === 404) {\n      error.message = `Not found. May be due to lack of authentication. Reason: ${reason}`;\n      throw error;\n    }\n    if (isRateLimitError(error)) {\n      error.message = `API rate limit exceeded. This maybe caused by the lack of authentication. Reason: ${reason}`;\n      throw error;\n    }\n    if (isAbuseLimitError(error)) {\n      error.message = `You have triggered an abuse detection mechanism. This maybe caused by the lack of authentication. Reason: ${reason}`;\n      throw error;\n    }\n    if (error.status === 401) {\n      error.message = `Unauthorized. \"${endpoint.method} ${endpoint.url}\" failed most likely due to lack of authentication. Reason: ${reason}`;\n      throw error;\n    }\n    if (error.status >= 400 && error.status < 500) {\n      error.message = error.message.replace(\n        /\\.?$/,\n        `. May be caused by lack of authentication (${reason}).`\n      );\n    }\n    throw error;\n  });\n}\nexport {\n  hook\n};\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,eAAe,KAAK,QAAQ;AAC1B,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,EACF;AACF;;;ACLA,2BAA6B;AAC7B,SAAS,iBAAiB,OAAO;AAC/B,MAAI,MAAM,WAAW,KAAK;AACxB,WAAO;AAAA,EACT;AACA,MAAI,CAAC,MAAM,UAAU;AACnB,WAAO;AAAA,EACT;AACA,SAAO,MAAM,SAAS,QAAQ,uBAAuB,MAAM;AAC7D;;;ACTA,IAAAA,wBAA6B;AAC7B,IAAM,4BAA4B;AAClC,SAAS,kBAAkB,OAAO;AAChC,MAAI,MAAM,WAAW,KAAK;AACxB,WAAO;AAAA,EACT;AACA,SAAO,0BAA0B,KAAK,MAAM,OAAO;AACrD;;;ACLA,eAAe,KAAK,QAAQ,SAAS,OAAO,YAAY;AACtD,QAAM,WAAW,QAAQ,SAAS;AAAA,IAChC;AAAA,IACA;AAAA,EACF;AACA,SAAO,QAAQ,QAAQ,EAAE,MAAM,CAAC,UAAU;AACxC,QAAI,MAAM,WAAW,KAAK;AACxB,YAAM,UAAU,4DAA4D,MAAM;AAClF,YAAM;AAAA,IACR;AACA,QAAI,iBAAiB,KAAK,GAAG;AAC3B,YAAM,UAAU,qFAAqF,MAAM;AAC3G,YAAM;AAAA,IACR;AACA,QAAI,kBAAkB,KAAK,GAAG;AAC5B,YAAM,UAAU,6GAA6G,MAAM;AACnI,YAAM;AAAA,IACR;AACA,QAAI,MAAM,WAAW,KAAK;AACxB,YAAM,UAAU,kBAAkB,SAAS,MAAM,I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