var o=Object.defineProperty;var d=(t,e,a)=>e in t?o(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var i=(t,e,a)=>(d(t,typeof e!="symbol"?e+"":e,a),a);import{A as c,a as p,b as h,c as l,d as b,e as y,f,g as w}from"./linters.7f594867.js";import"./index.a59ca186.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]="a7adada6-24ed-4afa-a247-29047dccb579",t._sentryDebugIdIdentifier="sentry-dbid-a7adada6-24ed-4afa-a247-29047dccb579")}catch{}})();class g{async list(){const a=await(await fetch("/_editor/api/codebase/files")).json();return c.parse(a)}async create(e,a){const r=await(await fetch(`/_editor/api/codebase/files/${e}`,{method:"POST",body:a})).json();return p.parse(r)}async delete(e){const s=await(await fetch(`/_editor/api/codebase/files/${e}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();return h.parse(s)}async update(e,a){const r=await(await fetch(`/_editor/api/codebase/files/${e}`,{method:"PUT",body:a})).json();return l.parse(r)}async retrieve(e){const s=await(await fetch(`/_editor/api/codebase/files/${e}`)).arrayBuffer();return new Uint8Array(s)}async rename(e,a){const s=b.parse({pathParts:e,newPathParts:a}),n=await(await fetch("/_editor/api/codebase/files/rename",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})).json();return y.parse(n)}async mkdir(e){const s=await(await fetch(`/_editor/api/codebase/dir/${e}`,{method:"POST",headers:{"Content-Type":"application/json"}})).json();return f.parse(s)}async settings(){const a=await(await fetch("/_editor/api/codebase/settings")).json();return w.parse(a)}}class F{constructor(e,a){i(this,"uploadFile",async(e,a)=>{const s=e.join(this.settings.separator);await this.api.create(s,a)});i(this,"deleteFile",async e=>{const a=e.join(this.settings.separator);await this.api.delete(a)});i(this,"renameFile",async(e,a)=>{await this.api.rename(e,a)});i(this,"editFile",async(e,a)=>{const s=e.join(this.settings.separator);await this.api.update(s,a)});i(this,"getFile",async e=>{const a=e.join(this.settings.separator);return this.api.retrieve(a)});i(this,"mkdir",async e=>{const a=e.join(this.settings.separator);await this.api.mkdir(a)});this.api=e,this.settings=a}}export{g as C,F};
//# sourceMappingURL=filesController.493c63b2.js.map
