import{_ as j}from"./DocsButton.vue_vue_type_script_setup_true_lang.59fb8def.js";import{C as g}from"./ContentLayout.46cee630.js";import{f as C,F as v,s as $}from"./FilesNavigator.19d914c2.js";import{a as F}from"./asyncComputed.61a4e861.js";import{d as D,ea as R,f as N,o as P,c as x,w as c,a as _,b as d,aG as p,u as i,dd as B,$ as U,db as S,em as k,en as A,a0 as T}from"./index.00900164.js";import{C as r}from"./gateway.61e97762.js";import"./tables.3355581b.js";import"./BookOutlined.d78d7289.js";import"./popupNotifcation.105ba4a6.js";import"./ant-design.a6952f3b.js";import"./string.a628f102.js";import"./record.9a19fe6f.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]="d9564177-6c4d-43df-98b4-7f81b9b7f94f",o._sentryDebugIdIdentifier="sentry-dbid-d9564177-6c4d-43df-98b4-7f81b9b7f94f")}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,s){const n={"Content-Type":"multipart/form-data"},l=new File([new Blob(s?[s]:[])],C(e));return r.post(`projects/${this.projectId}/files/upload?path=${encodeURIComponent(e)}`,l,n)}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,s){return r.patch(`projects/${this.projectId}/files?path=${encodeURIComponent(e)}&newPath=${encodeURIComponent(s)}`,{})}}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 s=R().params.projectId,n=u.fromProjectId(s),{loading:l,result:f,refetch:m}=F(()=>n.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,a){const b=t.join("/");await n.upload(b,a),await m()}function I(t){const a=t.join("/");return n.download(a)}function w(t){const a=t.join("/");return n.delete(a)}return(t,a)=>(P(),x(g,null,{default:c(()=>[_("div",z,[d(i(B),null,{default:c(()=>[p("Files")]),_:1}),d(i(S),null,{default:c(()=>[p(" Here you can upload, download and delete files in your persistent dir."),G,p(" Files can be used in your scripts. "),d(j,{path:"cloud/files"}),U(t.$slots,"description",{},void 0,!0)]),_:3}),d(v,{files:h.value,loading:i(l),separator:"/",onCreate:y,onDownload:I,onDelete:w,onRefetch:i(m)},null,8,["files","loading","onRefetch"])])]),_:3}))}});const ee=T(H,[["__scopeId","data-v-59df18c9"]]);export{ee as default};
//# sourceMappingURL=Files.7d8012c6.js.map
