import{s as t}from"./unist-util-stringify-position-CvSG9YTx.js";class e extends Error{constructor(e,s,o){super(),"string"==typeof s&&(o=s,s=void 0);let i="",a={},r=!1;if(s&&(a="line"in s&&"column"in s||"start"in s&&"end"in s?{place:s}:"type"in s?{ancestors:[s],place:s.position}:{...s}),"string"==typeof e?i=e:!a.cause&&e&&(r=!0,i=e.message,a.cause=e),!a.ruleId&&!a.source&&"string"==typeof o){const t=o.indexOf(":");-1===t?a.ruleId=o:(a.source=o.slice(0,t),a.ruleId=o.slice(t+1))}if(!a.place&&a.ancestors&&a.ancestors){const t=a.ancestors[a.ancestors.length-1];t&&(a.place=t.position)}const c=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=c?c.line:void 0,this.name=t(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=r&&a.cause&&"string"==typeof a.cause.stack?a.cause.stack:"",this.actual,this.expected,this.note,this.url}}e.prototype.file="",e.prototype.name="",e.prototype.reason="",e.prototype.message="",e.prototype.stack="",e.prototype.column=void 0,e.prototype.line=void 0,e.prototype.ancestors=void 0,e.prototype.cause=void 0,e.prototype.fatal=void 0,e.prototype.place=void 0,e.prototype.ruleId=void 0,e.prototype.source=void 0;export{e as V};
