import{_ as b}from"./DocsButton.vue_vue_type_script_setup_true_lang.00c3f4e2.js";import{C as g}from"./ContentLayout.878e9d53.js";import{f as C,F as v,s as $}from"./FilesNavigator.7dbb090a.js";import{a as F}from"./asyncComputed.bfad5b5f.js";import{d as D,ea as R,f as N,o as P,c as x,w as l,a as _,b as d,aG as p,u as c,dd as B,$ as U,db as S,em as k,en as A,a0 as T}from"./index.c4f9f025.js";import{C as r}from"./gateway.408bdde1.js";import"./tables.95f3c281.js";import"./BookOutlined.ec23cf35.js";import"./popupNotifcation.ebc30b56.js";import"./ant-design.b662a793.js";import"./string.45b9e9dc.js";import"./record.8b302d80.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[e]="000d0caa-dbd3-40cc-a2d1-ed1481a22210",o._sentryDebugIdIdentifier="sentry-dbid-000d0caa-dbd3-40cc-a2d1-ed1481a22210")}catch{}})();class u{constructor(e){this.projectId=e}static fromProjectId(e){return new u(e)}async list(){return r.get(`projects/${this.projectId}/files`)}async upload(e,a){const s={"Content-Type":"multipart/form-data"},i=new File([new Blob(a?[a]:[])],C(e));return r.post(`projects/${this.projectId}/files/upload?path=${encodeURIComponent(e)}`,i,s)}async download(e){return r.getBlob(`projects/${this.projectId}/files/download?path=${encodeURIComponent(e)}`)}async delete(e){return r.delete(`projects/${this.projectId}/files?path=${encodeURIComponent(e)}`)}async move(e,a){return r.patch(`projects/${this.projectId}/files?path=${encodeURIComponent(e)}&newPath=${encodeURIComponent(a)}`,{})}}const V=o=>(k("data-v-59df18c9"),o=o(),A(),o),z={class:"files-layout"},G=V(()=>_("br",null,null,-1)),H=D({__name:"Files",setup(o){const a=R().params.projectId,s=u.fromProjectId(a),{loading:i,result:f,refetch:m}=F(()=>s.list()),h=N(()=>f.value?f.value.map(t=>({pathParts:t.path.split("/"),size:t.type==="file"?$(t.size):0,lastModified:t.date,type:t.type})):[]);async function y(t,n){const j=t.join("/");await s.upload(j,n),await m()}function I(t){const n=t.join("/");return s.download(n)}function w(t){const n=t.join("/");return s.delete(n)}return(t,n)=>(P(),x(g,null,{default:l(()=>[_("div",z,[d(c(B),null,{default:l(()=>[p("Files")]),_:1}),d(c(S),null,{default:l(()=>[p(" Here you can upload, download and delete files in your persistent dir."),G,p(" Files can be used in your scripts. "),d(b,{path:"cloud/files"}),U(t.$slots,"description",{},void 0,!0)]),_:3}),d(v,{files:h.value,loading:c(i),separator:"/",onCreate:y,onDownload:I,onDelete:w,onRefetch:c(m)},null,8,["files","loading","onRefetch"])])]),_:3}))}});const ee=T(H,[["__scopeId","data-v-59df18c9"]]);export{ee as default};
//# sourceMappingURL=Files.d0afb5f0.js.map
