import{_ as j}from"./DocsButton.vue_vue_type_script_setup_true_lang.b4d03e94.js";import{C as g}from"./ContentLayout.5eb06f3f.js";import{f as C,F as v,s as $}from"./FilesNavigator.5aeee49a.js";import{a as D}from"./asyncComputed.b31540a4.js";import{d as F,ec 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,eD as k,eE as A,a0 as T}from"./index.82b3148c.js";import{C as r}from"./gateway.8733a5f3.js";import"./tables.b60a390b.js";import"./BookOutlined.e58a4796.js";import"./popupNotifcation.e1bf1f8c.js";import"./ant-design.9b251c5e.js";import"./string.ab0c206a.js";import"./PhFolder.vue.5ffcdfaa.js";import"./record.cb9a902e.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]="69014a13-6e4a-4aa9-83fb-09320fb3433d",o._sentryDebugIdIdentifier="sentry-dbid-69014a13-6e4a-4aa9-83fb-09320fb3433d")}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"},l=new File([new Blob(a?[a]:[])],C(e));return r.post(`projects/${this.projectId}/files/upload?path=${encodeURIComponent(e)}`,l,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"},E=V(()=>_("br",null,null,-1)),G=F({__name:"Files",setup(o){const a=R().params.projectId,s=u.fromProjectId(a),{loading:l,result:f,refetch:m}=D(()=>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 b=t.join("/");await s.upload(b,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: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."),E,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 te=T(G,[["__scopeId","data-v-59df18c9"]]);export{te as default};
//# sourceMappingURL=Files.1b2367f0.js.map
