var o=Object.defineProperty;var d=(a,e,s)=>e in a?o(a,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[e]=s;var i=(a,e,s)=>(d(a,typeof e!="symbol"?e+"":e,s),s);import{A as c,a as p,b,c as h,d as l,e as f,f as y,g as w}from"./linters.a9c213b8.js";import"./index.b7bd503f.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="b04218d1-e5a2-4683-a6bd-2d3ff074eb14",a._sentryDebugIdIdentifier="sentry-dbid-b04218d1-e5a2-4683-a6bd-2d3ff074eb14")}catch{}})();class g{async list(){const s=await(await fetch("/_editor/api/codebase/files")).json();return c.parse(s)}async create(e,s){const r=await(await fetch(`/_editor/api/codebase/files/${e}`,{method:"POST",body:s})).json();return p.parse(r)}async delete(e){const t=await(await fetch(`/_editor/api/codebase/files/${e}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();return b.parse(t)}async update(e,s){const r=await(await fetch(`/_editor/api/codebase/files/${e}`,{method:"PUT",body:s})).json();return h.parse(r)}async retrieve(e){const t=await(await fetch(`/_editor/api/codebase/files/${e}`)).arrayBuffer();return new Uint8Array(t)}async rename(e,s){const t=l.parse({pathParts:e,newPathParts:s}),n=await(await fetch("/_editor/api/codebase/files/rename",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json();return f.parse(n)}async mkdir(e){const t=await(await fetch(`/_editor/api/codebase/dir/${e}`,{method:"POST",headers:{"Content-Type":"application/json"}})).json();return y.parse(t)}async settings(){const s=await(await fetch("/_editor/api/codebase/settings")).json();return w.parse(s)}}class F{constructor(e,s){i(this,"uploadFile",async(e,s)=>{const t=e.join(this.settings.separator);await this.api.create(t,s)});i(this,"deleteFile",async e=>{const s=e.join(this.settings.separator);await this.api.delete(s)});i(this,"renameFile",async(e,s)=>{await this.api.rename(e,s)});i(this,"editFile",async(e,s)=>{const t=e.join(this.settings.separator);await this.api.update(t,s)});i(this,"getFile",async e=>{const s=e.join(this.settings.separator);return this.api.retrieve(s)});i(this,"mkdir",async e=>{const s=e.join(this.settings.separator);await this.api.mkdir(s)});this.api=e,this.settings=s}}export{g as C,F};
//# sourceMappingURL=filesController.91eca7c0.js.map
