var e,t;function r(){if(t)return e;t=1;class r extends SyntaxError{constructor(e,t,r,n){const s=((e,t,r)=>{if(!t)return{message:e.message+" while parsing empty string",position:0};const n=e.message.match(/^Unexpected token (.) .*position\s+(\d+)/i),s=n?+n[2]:e.message.match(/^Unexpected end of JSON.*/i)?t.length-1:null,o=n?e.message.replace(/^Unexpected token ./,`Unexpected token ${JSON.stringify(n[1])} (${(e=>{const t=e.charCodeAt(0).toString(16).toUpperCase();return"0x"+(t.length%2?"0":"")+t})(n[1])})`):e.message;if(null!=s){const e=s<=r?0:s-r,n=s+r>=t.length?t.length:s+r,i=(0===e?"":"...")+t.slice(e,n)+(n===t.length?"":"...");return{message:o+` while parsing ${t===i?"":"near "}${JSON.stringify(i)}`,position:s}}return{message:o+` while parsing '${t.slice(0,2*r)}'`,position:0}})(e,t,r=r||20);super(s.message),Object.assign(this,s),this.code="EJSONPARSE",this.systemError=e,Error.captureStackTrace(this,n||this.constructor)}get name(){return this.constructor.name}set name(e){}get[Symbol.toStringTag](){return this.constructor.name}}const n=Symbol.for("indent"),s=Symbol.for("newline"),o=/^\s*[{\[]((?:\r?\n)+)([\s\t]*)/,i=/^(?:\{\}|\[\])((?:\r?\n)+)?$/,a=(e,t,g)=>{const p=c(e);g=g||20;try{const[,e="\n",r="  "]=p.match(i)||p.match(o)||[,"",""],a=JSON.parse(p,t);return a&&"object"==typeof a&&(a[s]=e,a[n]=r),a}catch(t){if("string"!=typeof e&&!Buffer.isBuffer(e)){const r=Array.isArray(e)&&0===e.length;throw Object.assign(new TypeError(`Cannot parse ${r?"an empty array":String(e)}`),{code:"EJSONPARSE",systemError:t})}throw new r(t,p,g,a)}},c=e=>String(e).replace(/^\uFEFF/,"");return e=a,a.JSONParseError=r,a.noExceptions=(e,t)=>{try{return JSON.parse(c(e),t)}catch(e){}},e}export{r as __require};