import{__require as e}from"../error-ex/index.mjs";import{__require as r}from"../json-parse-even-better-errors/index.mjs";import{__require as n}from"../lines-and-columns/build/index.mjs";import{__require as o}from"../@babel/code-frame/lib/index.mjs";var i,s;function t(){if(s)return i;s=1;const t=e(),a=r(),{default:m}=n(),{codeFrameColumns:l}=o(),c=t("JSONError",{fileName:t.append("in %s"),codeFrame:t.append("\n\n%s\n")}),u=(e,r,n)=>{"string"==typeof r&&(n=r,r=null);try{try{return JSON.parse(e,r)}catch(n){throw a(e,r),n}}catch(r){r.message=r.message.replace(/\n/g,"");const o=r.message.match(/in JSON at position (\d+) while parsing/),i=new c(r);if(n&&(i.fileName=n),o&&o.length>0){const r=new m(e),n=Number(o[1]),s=r.locationForIndex(n),t=l(e,{start:{line:s.line+1,column:s.column+1}},{highlightCode:!0});i.codeFrame=t}throw i}};return u.JSONError=c,i=u}export{t as __require};