function e(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var t=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)},n=class extends Error{},r=class e extends n{constructor(t,n,r,i,a){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`request-id`),this.error=n,this.type=a??null}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(n,r,i,o){if(!n||!o)return new a({message:i,cause:t(r)});let h=r,g=h?.error?.type;return n===400?new s(n,h,i,o,g):n===401?new c(n,h,i,o,g):n===403?new l(n,h,i,o,g):n===404?new u(n,h,i,o,g):n===409?new d(n,h,i,o,g):n===422?new f(n,h,i,o,g):n===429?new p(n,h,i,o,g):n>=500?new m(n,h,i,o,g):new e(n,h,i,o,g)}},i=class extends r{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},a=class extends r{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},o=class extends a{constructor({message:e}={}){super({message:e??`Request timed out.`})}},s=class extends r{},c=class extends r{},l=class extends r{},u=class extends r{},d=class extends r{},f=class extends r{},p=class extends r{},m=class extends r{},h=/^[a-z][a-z0-9+.-]*:/i,g=e=>h.test(e),_=e=>(_=Array.isArray,_(e)),v=_;function y(e){return typeof e==`object`?e??{}:{}}function b(e){if(!e)return!0;for(let t in e)return!1;return!0}function x(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var S=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new n(`${e} must be an integer`);if(t<0)throw new n(`${e} must be a positive integer`);return t},C=e=>{try{return JSON.parse(e)}catch{return}},w=(e,t)=>{let n=e[t];return delete e[t],n};export{e as C,t as S,m as _,y as a,p as b,S as c,r as d,i as f,d as g,s as h,v as i,a as l,c as m,g as n,w as o,n as p,b as r,C as s,x as t,o as u,u as v,f as x,l as y};