import{a as r}from"./asyncComputed-Ab6ltgBh.js";import"./jwt-decode.esm-Dzy-9m8i.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="34f1accc-3ca9-4cfb-a1ea-746c164eeb51",t._sentryDebugIdIdentifier="sentry-dbid-34f1accc-3ca9-4cfb-a1ea-746c164eeb51")}catch{}})();class c{async check(){return(await fetch("/_editor/api/linters/check")).json()}async fix(e,s){const a=await fetch(`/_editor/api/linters/fix/${e}/${s}`,{method:"POST"});if(!a.ok)throw new Error("Failed to fix");return n.refetch(),a.json()}}const i=new c,n=r(async()=>(await i.check()).map(e=>new f(e)));class o{name;label;ruleName;constructor(e,s){this.name=e.name,this.label=e.label,this.ruleName=s}async fix(){await i.fix(this.ruleName,this.name)}}class l{constructor(e,s){this.ruleName=s,this.label=e.label,this.fixes=e.fixes.map(a=>new o(a,s))}label;fixes}class f{name;label;type;issues;constructor(e){this.name=e.name,this.label=e.label,this.type=e.type,this.issues=e.issues.map(s=>new l(s,this.name))}static get asyncComputed(){return n}static fromName(e){const s=n.result.value?.find(a=>a.name===e);if(!s)throw new Error(`Rule ${e} not found`);return s}}export{f as L};
//# sourceMappingURL=linters-DvFQho0g.js.map
