@elyx-code/project-logic-tree 0.0.7092 → 0.0.7093

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -58,7 +58,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
58
58
  `)),!u.includes(" ")&&/\\t/.test(u)&&(u=u.replace(/\\t/g," ")),u=u.replace(/\r\n/g,`
59
59
  `).replace(/\r/g,`
60
60
  `),u=u.replace(/\n/g,`\r
61
- `),u}class uSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:Os+je.GoogleDriveUploadFile,version:"2.0.0",description:"Upload a file to Google Drive (media / import+copy) with auto content detection and simplified inputs.",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Editor,ae.Logic]});w(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(je.GoogleDriveUploadFile);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e,f,h,m,T,b,A,D,I,C,$,L,x,M,q,W,z,H,ie,oe,J,te,ne,pe,de,he,Ee,ve,Ie,Ce,Me;try{const ke=((c=(a=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.connection.id}))==null?void 0:a.value)==null?void 0:c.valueAsType)??((f=(e=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.connection.id}))==null?void 0:e.value)==null?void 0:f.value);if(!(ke instanceof ea))return mu(i,"Invalid or missing connection entity");const we=((m=(h=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.content.id}))==null?void 0:h.value)==null?void 0:m.valueAsType)??((b=(T=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.content.id}))==null?void 0:T.value)==null?void 0:b.value),Fe=($=((D=(A=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.name.id}))==null?void 0:A.value)==null?void 0:D.valueAsType)??((C=(I=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.name.id}))==null?void 0:I.value)==null?void 0:C.value))==null?void 0:$.trim(),Je=(((x=(L=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:L.value)==null?void 0:x.valueAsType)??((q=(M=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:M.value)==null?void 0:q.value))||"application/octet-stream",qe=(((z=(W=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:W.value)==null?void 0:z.valueAsType)??((ie=(H=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:H.value)==null?void 0:ie.value))||void 0,ct=(((J=(oe=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:oe.value)==null?void 0:J.valueAsType)??((ne=(te=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:te.value)==null?void 0:ne.value))||void 0,gt=(((de=(pe=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:pe.value)==null?void 0:de.valueAsType)??((Ee=(he=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:he.value)==null?void 0:Ee.value))||"text/plain";if(!Fe)return mu(i,"Missing required input: name");const dt=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0],st=id(ke),Ci={Authorization:`Bearer ${await dt.getAccessToken()}`},qi=`${((ve=dt.env)==null?void 0:ve.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${dt.projectId}/${Nr["google-drive"]}/${st}`,Ct=async(Li,si,{params:li,body:ya,contentType:Jn,providerHeaders:kr,responseType:$r}={})=>{const Yt=`${qi}/${bVi(si)}`,Kt={...Ci};return Jn&&(Kt["Content-Type"]=Jn),(kr||$r)&&(Kt[EVi]=JSON.stringify({...kr?{headers:kr}:{},...$r?{responseType:$r}:{}})),qr.request({method:Li,url:Yt,params:li,data:ya,responseType:$r||"json",headers:Kt})},ft=typeof Je=="string"&&Je.startsWith("application/vnd.google-apps.");if(ft&&(we==null||we==="")){const Li={name:Fe,mimeType:Je};qe&&(Li.parents=[qe]),typeof ct=="string"&&(Li.description=ct);const si=await Ct("POST","/drive/v3/files",{params:{supportsAllDrives:"true",fields:mE},body:JSON.stringify(Li),contentType:"application/json"});return si.status!==200&&si.status!==201?mu(i,`Drive create failed (status=${si.status})`):qP({file:si.data})}if(ft&&we!=null){let Li=await gVi(we);const li=(($r,Yt)=>Yt||($r==="application/vnd.google-apps.spreadsheet"?"text/csv":$r==="application/vnd.google-apps.document"||$r==="application/vnd.google-apps.presentation"?"text/html":"text/plain"))(Je,gt),ya=li.startsWith("text/")&&!/charset=/i.test(li)?`${li}; charset=UTF-8`:li;li.startsWith("text/csv")&&(Li=IVi(Li));const Jn=new TextEncoder().encode(Li);if(Jn.byteLength>Xj)return mu(i,`Text body exceeds simple upload limit (${Jn.byteLength} bytes).`);let kr;try{const $r=await Ct("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:mE},body:Jn,contentType:ya});if($r.status!==200&&$r.status!==201)return mu(i,`Drive media upload failed (status=${$r.status})`);if(kr=(Ie=$r.data)==null?void 0:Ie.id,!kr)return mu(i,"Drive media upload did not return an id");const Yt={name:Fe,mimeType:Je};qe&&(Yt.parents=[qe]),typeof ct=="string"&&(Yt.description=ct);const Kt=await Ct("POST",`/drive/v3/files/${encodeURIComponent(kr)}/copy`,{params:{supportsAllDrives:"true",fields:mE},body:JSON.stringify(Yt),contentType:"application/json"});return Kt.status!==200&&Kt.status!==201?mu(i,`Drive copy-convert failed (status=${Kt.status})`):qP({file:Kt.data})}finally{if(kr)try{await Ct("DELETE",`/drive/v3/files/${encodeURIComponent(kr)}`,{params:{supportsAllDrives:"true"}})}catch{}}}if(we==null)return mu(i,"Missing content for non-native upload");const{bytes:ri,inferredMime:nt,isBinary:Tt}=await AVi(we),Ot=ri.byteLength;if(Ot>Xj)return mu(i,`File too large for simple upload (${Ot} bytes).`);const Gr=await Ct("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:mE},body:ri,contentType:Je||nt||(Tt?"application/octet-stream":"text/plain; charset=UTF-8")});if(Gr.status!==200&&Gr.status!==201)return mu(i,`Drive media upload failed (status=${Gr.status})`);let Oa=Gr.data;const fa=(Ce=Gr.data)==null?void 0:Ce.id;return fa&&(qe||Fe||ct)&&(Oa=await RVi(Ct,fa,Fe,ct,qe)),qP({file:Oa})}catch(ke){const we=((Me=ke.response)==null?void 0:Me.data)||ke.message||ke;return re.Logger.error("[Google Drive] Upload document failed:",we),{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,error:we,result:null}}}})}}function qP(s){return{value:K.Success,error:null,result:s}}function mu(s,u){return re.Logger.log("[Google Drive] Upload error:",u),{value:s.catchesError||s.errorCalls.length?K.CaughtError:K.UnhandledError,error:u,result:null}}async function RVi(s,u,i,r,a){const c={};i&&(c.name=i),typeof r=="string"&&(c.description=r);const e={supportsAllDrives:"true",fields:mE},f={...e};a&&(f.addParents=a,f.removeParents="root");let h=await s("PATCH",`/drive/v3/files/${encodeURIComponent(u)}`,{params:f,body:JSON.stringify(c),contentType:"application/json"});if(h.status>=400&&a&&(h=await s("PATCH",`/drive/v3/files/${encodeURIComponent(u)}`,{params:{...e,addParents:a},body:JSON.stringify(c),contentType:"application/json"})),h.status!==200)throw new Error(`Drive metadata update failed (status=${h.status})`);return h.data}class pSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:Os+je.GoogleGeminiGenerateContent,version:"1.0.0",description:"Send Gmail email operation implementation module",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Editor,ae.Logic]});w(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(je.GoogleGeminiGenerateContent);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e,f,h;try{const m=r.find(x=>{var M,q;return((q=(M=x.valueOwner)==null?void 0:M.declaration)==null?void 0:q.id)===U.operation["external-integration--google-gemini--post--generate-content"].inputs.connection.id}),T=(a=m==null?void 0:m.value)==null?void 0:a.valueAsType;if(!T)return{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No entity template provided",result:null};if(!(T instanceof ea))return{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,error:"Invalid entity template value provided",result:null};const b=r.find(x=>{var M,q;return((q=(M=x.valueOwner)==null?void 0:M.declaration)==null?void 0:q.id)===U.operation["external-integration--google-gemini--post--generate-content"].inputs.prompt.id}),A=(c=b==null?void 0:b.value)==null?void 0:c.value;if(!A||typeof A!="string")return{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,error:"Invalid prompt value provided",result:null};const D=r.find(x=>{var M,q;return((q=(M=x.valueOwner)==null?void 0:M.declaration)==null?void 0:q.id)===U.operation["external-integration--google-gemini--post--generate-content"].inputs.model.id}),I=(e=D==null?void 0:D.value)==null?void 0:e.value;if(!I||typeof I!="string")return{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,error:"Invalid model value provided",result:null};const C=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0],$=id(T);console.log("Triggering Google Gemini generate content action with connectionId:",$);const L=await(await qr.post(`${(f=C.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/trigger-action/${Nr["google-gemini"]}/${$}/generate-content`,{payload:{prompt:A,model:I}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${await C.getAccessToken()}`}})).data;return re.Logger.log("[Google Gemini] Generate content action response:",L),{value:K.Success,error:null,result:{content:L.content}}}catch(m){const T=((h=m.response)==null?void 0:h.data)||m.message||m;return re.Logger.error("[Google Gemini] Generate content failed:",T),{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class cSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE,version:"1.0.0",description:"Cloud File System: Upload File",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.UploadFile);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f;try{const h=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!h||!h.env)throw new Error("Editor context or environment missing");const m=Et(i,i.project,"uploadFile"),b="["+ze(i,i.project,"Upload file")+": `"+m+"`] ",A=r.find(he=>{var Ee,ve;return((ve=(Ee=he.valueOwner)==null?void 0:Ee.declaration)==null?void 0:ve.id)===U.operation[Ue.UploadFile].inputs.bucket.id}),D=(a=A==null?void 0:A.value)==null?void 0:a.valueAsType;if(!D||!D.id||!D.name||D.type!==d.DefinitionEntity)throw new Error(`${b}Invalid input "${ze(A==null?void 0:A.valueOwner,h==null?void 0:h.logic,"Storage")}" (\`${Et(A==null?void 0:A.valueOwner,h==null?void 0:h.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=La(D==null?void 0:D.id,((c=h.branchHead)==null?void 0:c.identifier)||"main");if(!((h==null?void 0:h.liveResources)||[]).find(he=>he.resourceId===I))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const $=r.find(he=>{var Ee,ve;return((ve=(Ee=he.valueOwner)==null?void 0:Ee.declaration)==null?void 0:ve.id)===U.operation[Ue.UploadFile].inputs.key.id}),L=(e=$==null?void 0:$.value)==null?void 0:e.value;if(!L||L==="")throw new Error(`${b}The "${ze($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"key")}\`) input is missing.`);if(typeof L!="string")throw new Error(`${b}The "${ze($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=r.find(he=>{var Ee,ve;return((ve=(Ee=he.valueOwner)==null?void 0:Ee.declaration)==null?void 0:ve.id)===U.operation[Ue.UploadFile].inputs.file.id}),M=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!M)throw new Error(`${b}The "${ze(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"File")}" (\`${Et(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"file")}\`) input is missing'`);if(typeof M!="object"||!M.uri||typeof M.uri!="string")throw new Error(`${b}The "${ze(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"File")}" (\`${Et(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"file")}\`) input is invalid, should be an object with a text 'uri' property`);const q=i.project.id,W=M.uri,z=M.mimeType||"application/octet-stream",H=L,ie=await qr.post(`${h.env.API_BASE_URL}/cloud-files-service/v1/files?projectId=${q}&bucket=${I}&key=${encodeURIComponent(H)}&contentType=${encodeURIComponent(z)}`,{},{headers:{Authorization:`Bearer ${await h.getAccessToken()}`}}),{uploadUrl:oe}=ie.data;let J;if(W.startsWith("http://")||W.startsWith("https://"))try{const he=await h.getAccessToken();he&&(J={Authorization:`Bearer ${he}`})}catch{}const te=await fetch(W,{headers:J});if(!te.ok&&!W.startsWith("data:")&&!W.startsWith("blob:"))throw new Error(`${b}Failed to fetch file content from '${W}' (status: ${te.status})`);const ne=await te.blob();await qr.put(oe,ne,{headers:{"Content-Type":z}});const de={uri:`${h.env.API_BASE_URL}/cloud-files-service/v1/files/download?projectId=${q}&bucketId=${I}&key=${encodeURIComponent(H)}`,name:H.split("/").pop()||H,mimeType:z,size:ne.size};return{value:K.Success,error:null,result:de}}catch(h){return{value:K.UnhandledError,error:h,result:null}}}})}}class fSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DOWNLOAD_FILE,version:"1.0.0",description:"Cloud File System: Download File",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.DownloadFile);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const h=Et(i,i.project,"downloadFile"),T="["+ze(i,i.project,"Download file")+": `"+h+"`] ",b=r.find(H=>{var ie,oe;return((oe=(ie=H.valueOwner)==null?void 0:ie.declaration)==null?void 0:oe.id)===U.operation[Ue.DownloadFile].inputs.bucket.id}),A=(a=b==null?void 0:b.value)==null?void 0:a.valueAsType;if(!A||!A.id||!A.name||A.type!==d.DefinitionEntity)throw new Error(`${T}Invalid input "${ze(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Et(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=La(A==null?void 0:A.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(H=>H.resourceId===D))throw new Error("The provided storage is not live. Publish the project first, then try again to run the operation node.");const C=r.find(H=>{var ie,oe;return((oe=(ie=H.valueOwner)==null?void 0:ie.declaration)==null?void 0:oe.id)===U.operation[Ue.DownloadFile].inputs.key.id}),$=(e=C==null?void 0:C.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const L=i.project.id,x=H=>{var te;if(!H)return"application/octet-stream";const ie=H.split(".");if(ie.length===1)return"application/octet-stream";const oe=(te=ie.pop())==null?void 0:te.toLowerCase();return{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",pdf:"application/pdf",txt:"text/plain",html:"text/html",csv:"text/csv",json:"application/json",mp4:"video/mp4"}[oe]||"application/octet-stream"};let M=0,q=x($);try{const H=await qr.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?projectId=${L}&bucket=${D}&key=${encodeURIComponent($)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});H.data&&(typeof H.data.size=="number"&&(M=H.data.size),H.data.mimeType&&H.data.mimeType!=="application/octet-stream"&&(q=H.data.mimeType))}catch{}const z={uri:`${f.env.API_BASE_URL}/cloud-files-service/v1/files/download?projectId=${L}&bucket=${D}&key=${encodeURIComponent($)}`,name:$.split("/").pop()||$,mimeType:q,size:M};return{value:K.Success,error:null,result:z}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class ySe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_LIST_FILES,version:"1.0.0",description:"Cloud File System: List Files",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.ListFiles);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h;try{const m=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Et(i,i.project,"listFiles"),A="["+ze(i,i.project,"List files")+": `"+T+"`] ",D=r.find(ve=>{var Ie,Ce;return((Ce=(Ie=ve.valueOwner)==null?void 0:Ie.declaration)==null?void 0:Ce.id)===U.operation[Ue.ListFiles].inputs.bucket.id}),I=(a=D==null?void 0:D.value)==null?void 0:a.valueAsType;if(!I||!I.id||!I.name||I.type!==d.DefinitionEntity)throw new Error(`${A}Invalid input "${ze(D==null?void 0:D.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Et(D==null?void 0:D.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const C=La(I==null?void 0:I.id,((c=m.branchHead)==null?void 0:c.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(ve=>ve.resourceId===C))throw new Error(`${A}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const L=r.find(ve=>{var Ie,Ce;return((Ce=(Ie=ve.valueOwner)==null?void 0:Ie.declaration)==null?void 0:Ce.id)===U.operation[Ue.ListFiles].inputs.path.id}),x=(e=L==null?void 0:L.value)==null?void 0:e.value;if(x!==void 0&&(typeof x!="string"||x===""))throw new Error(`${A}The "${ze(L==null?void 0:L.valueOwner,m==null?void 0:m.logic,"Path")}" (\`${Et(L==null?void 0:L.valueOwner,m==null?void 0:m.logic,"path")}\`) input value is invalid, if present, it must be a non-empty string.`);const M=r.find(ve=>{var Ie,Ce;return((Ce=(Ie=ve.valueOwner)==null?void 0:Ie.declaration)==null?void 0:Ce.id)===U.operation[Ue.ListFiles].inputs.maxKeys.id}),q=(f=M==null?void 0:M.value)==null?void 0:f.value;if(q!==void 0&&(typeof q!="number"||q<=0))throw new Error(`${A}The "${ze(M==null?void 0:M.valueOwner,m==null?void 0:m.logic,"Max results")}" (\`${Et(M==null?void 0:M.valueOwner,m==null?void 0:m.logic,"maxKeys")}\`) input value is invalid, if present, it must be a number greater than 0.`);const W=r.find(ve=>{var Ie,Ce;return((Ce=(Ie=ve.valueOwner)==null?void 0:Ie.declaration)==null?void 0:Ce.id)===U.operation[Ue.ListFiles].inputs.startAfter.id}),z=(h=W==null?void 0:W.value)==null?void 0:h.value;if(z!==void 0&&(typeof z!="string"||z===""))throw new Error(`${A}The "${ze(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,"Start after")}" (\`${Et(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,"startAfter")}\`) input value is invalid, if present, it must be a non-empty string.`);const H=i.project.id;let ie=`${m.env.API_BASE_URL}/cloud-files-service/v1/files?projectId=${H}&bucket=${C}`;x&&(ie+=`&path=${encodeURIComponent(x)}`),q&&(ie+=`&maxKeys=${q}`),z&&(ie+=`&startAfter=${encodeURIComponent(z)}`);const oe=await qr.get(ie,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}}),J=ve=>{var ke;if(!ve)return"application/octet-stream";const Ie=ve.split(".");if(Ie.length===1)return"application/octet-stream";const Ce=(ke=Ie.pop())==null?void 0:ke.toLowerCase();return{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",pdf:"application/pdf",txt:"text/plain",html:"text/html",csv:"text/csv",json:"application/json",mp4:"video/mp4"}[Ce]||"application/octet-stream"},ne=(oe.data.items||oe.data.files||[]).map(ve=>{var Ie;return{uri:ve.uri||ve.url||`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?projectId=${H}&bucket=${C}&key=${encodeURIComponent(ve.key)}`,name:ve.name||((Ie=ve.key)==null?void 0:Ie.split("/").pop())||ve.key,key:ve.key,mimeType:ve.mimeType||J(ve.key),size:ve.size||0,lastModified:ve.lastModified||ve.lastModifiedDate,access:ve.access}}),pe=oe.data.total!==void 0?oe.data.total:ne.length,de=oe.data.size!==void 0?oe.data.size:ne.reduce((ve,Ie)=>ve+(Ie.size||0),0),he=oe.data.nextStartAfter!==void 0?oe.data.nextStartAfter:null,Ee=oe.data.hasMore!==void 0?oe.data.hasMore:!1;return{value:K.Success,error:null,result:{items:ne,total:pe,size:de,nextStartAfter:he,hasMore:Ee}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class hSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FILES,version:"1.0.0",description:"Cloud File System: Delete Files",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.DeleteFiles);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const h=Et(i,i.project,"deleteFiles"),T="["+ze(i,i.project,"Delete files")+": `"+h+"`] ",b=r.find(q=>{var W,z;return((z=(W=q.valueOwner)==null?void 0:W.declaration)==null?void 0:z.id)===U.operation[Ue.DeleteFiles].inputs.bucket.id}),A=(a=b==null?void 0:b.value)==null?void 0:a.valueAsType;if(!A||!A.id||!A.name||A.type!==d.DefinitionEntity)throw new Error(`${T}Invalid input "${ze(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Et(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=La(A==null?void 0:A.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(q=>q.resourceId===D))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const C=r.find(q=>{var W,z;return((z=(W=q.valueOwner)==null?void 0:W.declaration)==null?void 0:z.id)===U.operation[Ue.DeleteFiles].inputs.keys.id}),$=(e=C==null?void 0:C.value)==null?void 0:e.value,L=Array.isArray($)?$:typeof $=="string"&&$!==""?[$]:[];if(!L||L.length===0)throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"keys")}\`) input is missing.`);if(!Array.isArray(L)||L.some(q=>typeof q!="string"||q===""))throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"keys")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const x=i.project.id,M=await qr.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{projectId:x,bucket:D,keys:L}});return{value:K.Success,error:null,result:M.data}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class mSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COPY_FILE,version:"1.0.0",description:"Cloud File System: Copy File",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.CopyFile);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m;try{const T=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const b=Et(i,i.project,"copyFile"),D="["+ze(i,i.project,"Copy file")+": `"+b+"`] ",I=r.find(pe=>{var de,he;return((he=(de=pe.valueOwner)==null?void 0:de.declaration)==null?void 0:he.id)===U.operation[Ue.CopyFile].inputs.bucket.id}),C=(a=I==null?void 0:I.value)==null?void 0:a.valueAsType;if(!C||!C.id||!C.name||C.type!==d.DefinitionEntity)throw new Error(`${D}Invalid input "${ze(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${Et(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const $=La(C==null?void 0:C.id,((c=T.branchHead)==null?void 0:c.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(pe=>pe.resourceId===$))throw new Error(`${D}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=r.find(pe=>{var de,he;return((he=(de=pe.valueOwner)==null?void 0:de.declaration)==null?void 0:he.id)===U.operation[Ue.CopyFile].inputs.sourceKey.id}),M=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!M||M==="")throw new Error(`${D}The "${ze(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Et(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof M!="string")throw new Error(`${D}The "${ze(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Et(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=r.find(pe=>{var de,he;return((he=(de=pe.valueOwner)==null?void 0:de.declaration)==null?void 0:he.id)===U.operation[Ue.CopyFile].inputs.destinationKey.id}),W=(f=q==null?void 0:q.value)==null?void 0:f.value;if(!W||W==="")throw new Error(`${D}The "${ze(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Et(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input is missing.`);if(typeof W!="string")throw new Error(`${D}The "${ze(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Et(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const z=r.find(pe=>{var de,he;return((he=(de=pe.valueOwner)==null?void 0:de.declaration)==null?void 0:he.id)===U.operation[Ue.CopyFile].inputs.destinationBucket.id}),H=(h=z==null?void 0:z.value)==null?void 0:h.valueAsType;if(H&&(!H.id||!H.name||H.type!==d.DefinitionEntity))throw new Error(`${D}Invalid input "${ze(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,"Destination Storage")}" (\`${Et(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const ie=H!=null&&H.id?La(H.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):$;if(!((T==null?void 0:T.liveResources)||[]).find(pe=>pe.resourceId===ie))throw new Error(`${D}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const J=i.project.id,te={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},ne=await qr.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/copy`,{projectId:J,bucket:$,destinationBucket:ie,sourceKey:M,destinationKey:W},te);return{value:K.Success,error:null,result:ne.data}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}}class TSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_MOVE_FILE,version:"1.0.0",description:"Cloud File System: Move File",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.MoveFile);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m;try{const T=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const b=Et(i,i.project,"moveFile"),D="["+ze(i,i.project,"Move file")+": `"+b+"`] ",I=r.find(pe=>{var de,he;return((he=(de=pe.valueOwner)==null?void 0:de.declaration)==null?void 0:he.id)===U.operation[Ue.MoveFile].inputs.bucket.id}),C=(a=I==null?void 0:I.value)==null?void 0:a.valueAsType;if(!C||!C.id||!C.name||C.type!==d.DefinitionEntity)throw new Error(`${D}Invalid input "${ze(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${Et(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const $=La(C==null?void 0:C.id,((c=T.branchHead)==null?void 0:c.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(pe=>pe.resourceId===$))throw new Error(`${D}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=r.find(pe=>{var de,he;return((he=(de=pe.valueOwner)==null?void 0:de.declaration)==null?void 0:he.id)===U.operation[Ue.MoveFile].inputs.sourceKey.id}),M=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!M||M==="")throw new Error(`${D}The "${ze(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Et(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof M!="string")throw new Error(`${D}The "${ze(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Et(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=r.find(pe=>{var de,he;return((he=(de=pe.valueOwner)==null?void 0:de.declaration)==null?void 0:he.id)===U.operation[Ue.MoveFile].inputs.destinationKey.id}),W=(f=q==null?void 0:q.value)==null?void 0:f.value;if(!W||W==="")throw new Error(`${D}The "${ze(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Et(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input is missing.`);if(typeof W!="string")throw new Error(`${D}The "${ze(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Et(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const z=r.find(pe=>{var de,he;return((he=(de=pe.valueOwner)==null?void 0:de.declaration)==null?void 0:he.id)===U.operation[Ue.MoveFile].inputs.destinationBucket.id}),H=(h=z==null?void 0:z.value)==null?void 0:h.valueAsType,ie=i.project.id;if(H&&(!H.id||!H.name||H.type!==d.DefinitionEntity))throw new Error(`${D}Invalid input "${ze(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,"Destination storage")}" (\`${Et(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const oe=H!=null&&H.id?La(H.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):$;if(!((T==null?void 0:T.liveResources)||[]).find(pe=>pe.resourceId===oe))throw new Error(`${D}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const te={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},ne=await qr.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/move`,{projectId:ie,bucket:$,destinationBucket:oe,sourceKey:M,destinationKey:W},te);return{value:K.Success,error:null,result:ne.data}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}}class vSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_RENAME_FILE,version:"1.0.0",description:"Cloud File System: Rename File",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.RenameFile);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f;try{const h=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!h||!h.env)throw new Error("Editor context or environment missing");const m=Et(i,i.project,"renameFile"),b="["+ze(i,i.project,"Rename file")+": `"+m+"`] ",A=r.find(oe=>{var J,te;return((te=(J=oe.valueOwner)==null?void 0:J.declaration)==null?void 0:te.id)===U.operation[Ue.RenameFile].inputs.bucket.id}),D=(a=A==null?void 0:A.value)==null?void 0:a.valueAsType;if(!D||!D.id||!D.name||D.type!==d.DefinitionEntity)throw new Error(`${b}Invalid input "${ze(A==null?void 0:A.valueOwner,h==null?void 0:h.logic,"Storage")}" (\`${Et(A==null?void 0:A.valueOwner,h==null?void 0:h.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=La(D==null?void 0:D.id,((c=h.branchHead)==null?void 0:c.identifier)||"main");if(!((h==null?void 0:h.liveResources)||[]).find(oe=>oe.resourceId===I))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const $=r.find(oe=>{var J,te;return((te=(J=oe.valueOwner)==null?void 0:J.declaration)==null?void 0:te.id)===U.operation[Ue.RenameFile].inputs.key.id}),L=(e=$==null?void 0:$.value)==null?void 0:e.value;if(!L||L==="")throw new Error(`${b}The "${ze($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"key")}\`) input is missing.`);if(typeof L!="string")throw new Error(`${b}The "${ze($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=r.find(oe=>{var J,te;return((te=(J=oe.valueOwner)==null?void 0:J.declaration)==null?void 0:te.id)===U.operation[Ue.RenameFile].inputs.newName.id}),M=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!M||M==="")throw new Error(`${b}The "${ze(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"New name")}" (\`${Et(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"newName")}\`) input is missing.`);if(typeof M!="string")throw new Error(`${b}The "${ze(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"New name")}" (\`${Et(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"newName")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=i.project.id,W=L.lastIndexOf("/"),H=`${W!==-1?L.substring(0,W+1):""}${M}`,ie={headers:{Authorization:`Bearer ${await h.getAccessToken()}`}};return await qr.post(`${h.env.API_BASE_URL}/cloud-files-service/v1/files/rename`,{projectId:q,bucket:I,sourceKey:L,destinationKey:H,newName:M},ie),{value:K.Success,error:null,result:{key:H,oldKey:L}}}catch(h){return{value:K.UnhandledError,error:h,result:null}}}})}}class ESe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE_METADATA,version:"1.0.0",description:"Cloud File System: Get File Metadata",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.GetFileMetadata);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const h=Et(i,i.project,"getFileMetadata"),T="["+ze(i,i.project,"Get file metadata")+": `"+h+"`] ",b=r.find(M=>{var q,W;return((W=(q=M.valueOwner)==null?void 0:q.declaration)==null?void 0:W.id)===U.operation[Ue.GetFileMetadata].inputs.bucket.id}),A=(a=b==null?void 0:b.value)==null?void 0:a.valueAsType;if(!A||!A.id||!A.name||A.type!==d.DefinitionEntity)throw new Error(`${T}Invalid input "${ze(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Et(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=La(A==null?void 0:A.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(M=>M.resourceId===D))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const C=r.find(M=>{var q,W;return((W=(q=M.valueOwner)==null?void 0:q.declaration)==null?void 0:W.id)===U.operation[Ue.GetFileMetadata].inputs.key.id}),$=(e=C==null?void 0:C.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const L=i.project.id,x=await qr.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?projectId=${L}&bucket=${D}&key=${encodeURIComponent($)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:x.data}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class bSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CHECK_FILE_EXISTS,version:"1.0.0",description:"Cloud File System: Check File Exists",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.CheckFileExists);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const h=Et(i,i.project,"checkFileExists"),T="["+ze(i,i.project,"Check File Exists")+": `"+h+"`] ",b=r.find(M=>{var q,W;return((W=(q=M.valueOwner)==null?void 0:q.declaration)==null?void 0:W.id)===U.operation[Ue.CheckFileExists].inputs.bucket.id}),A=(a=b==null?void 0:b.value)==null?void 0:a.valueAsType;if(!A||!A.id||!A.name||A.type!==d.DefinitionEntity)throw new Error(`${T}Invalid input "${ze(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Et(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=La(A==null?void 0:A.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(M=>M.resourceId===D))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const C=r.find(M=>{var q,W;return((W=(q=M.valueOwner)==null?void 0:q.declaration)==null?void 0:W.id)===U.operation[Ue.CheckFileExists].inputs.key.id}),$=(e=C==null?void 0:C.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const L=i.project.id,x=await qr.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/exists?projectId=${L}&bucket=${D}&key=${encodeURIComponent($)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:x.data.exists}}catch(f){return{value:K.UnhandledError,error:f,result:!1}}}})}}class ASe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Pre-signed URL",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.GetPresignedUrl);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h;try{const m=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Et(i,i.project,"getPresignedUrl"),A="["+ze(i,i.project,"Get pre-signed URL")+": `"+T+"`] ",D=r.find(ne=>{var pe,de;return((de=(pe=ne.valueOwner)==null?void 0:pe.declaration)==null?void 0:de.id)===U.operation[Ue.GetPresignedUrl].inputs.bucket.id}),I=(a=D==null?void 0:D.value)==null?void 0:a.valueAsType;if(!I||!I.id||!I.name||I.type!==d.DefinitionEntity)throw new Error(`${A}Invalid input "${ze(D==null?void 0:D.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Et(D==null?void 0:D.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const C=La(I==null?void 0:I.id,((c=m.branchHead)==null?void 0:c.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(ne=>ne.resourceId===C))throw new Error(`${A}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const L=r.find(ne=>{var pe,de;return((de=(pe=ne.valueOwner)==null?void 0:pe.declaration)==null?void 0:de.id)===U.operation[Ue.GetPresignedUrl].inputs.key.id}),x=(e=L==null?void 0:L.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${A}The "${ze(L==null?void 0:L.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Et(L==null?void 0:L.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${A}The "${ze(L==null?void 0:L.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Et(L==null?void 0:L.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const M=r.find(ne=>{var pe,de;return((de=(pe=ne.valueOwner)==null?void 0:pe.declaration)==null?void 0:de.id)===U.operation[Ue.GetPresignedUrl].inputs.action.id}),q=(f=M==null?void 0:M.value)==null?void 0:f.value,W=(q||"read").toLowerCase(),z=["read","write","delete","metadata","upload","putobject","head","headobject","getobject","get"];if(!q||q==="")throw new Error(`${A}The "${ze(M==null?void 0:M.valueOwner,m==null?void 0:m.logic,"Action")}" (\`${Et(M==null?void 0:M.valueOwner,m==null?void 0:m.logic,"action")}\`) input is missing.`);if(!z.includes(W))throw new Error(`${A}Invalid "${ze(M==null?void 0:M.valueOwner,m==null?void 0:m.logic,"Action")}" (\`${Et(M==null?void 0:M.valueOwner,m==null?void 0:m.logic,"action")}\`) input value, must be one of "read", "write", "delete" or "metadata".`);const H=r.find(ne=>{var pe,de;return((de=(pe=ne.valueOwner)==null?void 0:pe.declaration)==null?void 0:de.id)===U.operation[Ue.GetPresignedUrl].inputs.expiresInSeconds.id}),ie=(h=H==null?void 0:H.value)==null?void 0:h.value,oe=ie!=null?Number(ie):3600;if(isNaN(oe)||oe<=0)throw new Error(`${A}Invalid "${ze(H==null?void 0:H.valueOwner,m==null?void 0:m.logic,"Expires in seconds")}" (\`${Et(H==null?void 0:H.valueOwner,m==null?void 0:m.logic,"expiresInSeconds")}\`) input value, expected a positive number.`);const J=i.project.id,te=await qr.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/presigned-url?projectId=${J}&bucket=${C}&key=${encodeURIComponent(x)}&action=${W}&expiresInSeconds=${oe}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:te.data}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class gSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_SET_FILE_ACCESS,version:"1.0.0",description:"Cloud File System: Set File Access",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.SetFileAccess);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f;try{const h=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!h||!h.env)throw new Error("Editor context or environment missing");const m=Et(i,i.project,"setFileAccess"),b="["+ze(i,i.project,"Set file access")+": `"+m+"`] ",A=r.find(W=>{var z,H;return((H=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:H.id)===U.operation[Ue.SetFileAccess].inputs.bucket.id}),D=(a=A==null?void 0:A.value)==null?void 0:a.valueAsType;if(!D||!D.id||!D.name||D.type!==d.DefinitionEntity)throw new Error(`${b}Invalid input "${ze(A==null?void 0:A.valueOwner,h==null?void 0:h.logic,"Storage")}" (\`${Et(A==null?void 0:A.valueOwner,h==null?void 0:h.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=La(D==null?void 0:D.id,((c=h.branchHead)==null?void 0:c.identifier)||"main");if(!((h==null?void 0:h.liveResources)||[]).find(W=>W.resourceId===I))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const $=r.find(W=>{var z,H;return((H=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:H.id)===U.operation[Ue.SetFileAccess].inputs.key.id}),L=(e=$==null?void 0:$.value)==null?void 0:e.value;if(!L||L==="")throw new Error(`${b}The "${ze($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"key")}\`) input is missing.`);if(typeof L!="string")throw new Error(`${b}The "${ze($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=r.find(W=>{var z,H;return((H=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:H.id)===U.operation[Ue.SetFileAccess].inputs.access.id}),M=((f=x==null?void 0:x.value)==null?void 0:f.value)??"private";if(!M||M==="")throw new Error(`${b}The "${ze(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"Access")}" (\`${Et(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"access")}\`) input is missing.`);if(typeof M!="string"||!["public","private"].includes(M))throw new Error(`${b}The "${ze(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"Access")}" (\`${Et(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"access")}\`) input value is invalid, if present, it must be exactly the "public" or "private" text values.`);const q=i.project.id;return await qr.post(`${h.env.API_BASE_URL}/cloud-files-service/v1/files/access`,{projectId:q,nucket:I,key:L,access:M},{headers:{Authorization:`Bearer ${await h.getAccessToken()}`}}),{value:K.Success,error:null,result:null}}catch(h){return{value:K.UnhandledError,error:h,result:null}}}})}}class ISe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_FOLDER,version:"1.0.0",description:"Cloud File System: Create Folder",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.CreateFolder);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const h=Et(i,i.project,"createFolder"),T="["+ze(i,i.project,"Create folder")+": `"+h+"`] ",b=r.find(M=>{var q,W;return((W=(q=M.valueOwner)==null?void 0:q.declaration)==null?void 0:W.id)===U.operation[Ue.CreateFolder].inputs.bucket.id}),A=(a=b==null?void 0:b.value)==null?void 0:a.valueAsType;if(!A||!A.id||!A.name||A.type!==d.DefinitionEntity)throw new Error(`${T}Invalid input "${ze(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Et(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=La(A==null?void 0:A.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(M=>M.resourceId===D))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const C=r.find(M=>{var q,W;return((W=(q=M.valueOwner)==null?void 0:q.declaration)==null?void 0:W.id)===U.operation[Ue.CreateFolder].inputs.folderPath.id}),$=(e=C==null?void 0:C.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input value is invalid, if present, it must be a non-empty string.`);const L=i.project.id,x=await qr.post(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{projectId:L,bucket:D,folderPath:$},{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:x.data}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class RSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FOLDERS,version:"1.0.0",description:"Cloud File System: Delete Folders",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.DeleteFolders);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const h=Et(i,i.project,"deleteFolders"),T="["+ze(i,i.project,"Delete folders")+": `"+h+"`] ",b=r.find(q=>{var W,z;return((z=(W=q.valueOwner)==null?void 0:W.declaration)==null?void 0:z.id)===U.operation[Ue.DeleteFolders].inputs.bucket.id}),A=(a=b==null?void 0:b.value)==null?void 0:a.valueAsType;if(!A||!A.id||!A.name||A.type!==d.DefinitionEntity)throw new Error(`${T}Invalid input "${ze(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Et(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=La(A==null?void 0:A.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(q=>q.resourceId===D))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const C=r.find(q=>{var W,z;return((z=(W=q.valueOwner)==null?void 0:W.declaration)==null?void 0:z.id)===U.operation[Ue.DeleteFolders].inputs.folderPaths.id}),$=(e=C==null?void 0:C.value)==null?void 0:e.value,L=Array.isArray($)?$:typeof $=="string"&&$!==""?[$]:[];if(!L||L.length===0)throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input is missing.`);if(!Array.isArray(L)||L.some(q=>typeof q!="string"||q===""))throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const x=i.project.id,M=await qr.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{projectId:x,bucket:D,folderPaths:L}});return{value:K.Success,error:null,result:M.data}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class wSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Create Multipart Upload",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.CreateMultipartUpload);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h;try{const m=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Et(i,i.project,"createMultipartUpload"),A="["+ze(i,i.project,"Create multipart upload")+": `"+T+"`] ",D=r.find(z=>{var H,ie;return((ie=(H=z.valueOwner)==null?void 0:H.declaration)==null?void 0:ie.id)===U.operation[Ue.CreateMultipartUpload].inputs.bucket.id}),I=(a=D==null?void 0:D.value)==null?void 0:a.valueAsType;if(!I||!I.id||!I.name||I.type!==d.DefinitionEntity)throw new Error(`${A}Invalid input "${ze(D==null?void 0:D.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Et(D==null?void 0:D.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const C=La(I==null?void 0:I.id,((c=m.branchHead)==null?void 0:c.identifier)||"main"),$=r.find(z=>{var H,ie;return((ie=(H=z.valueOwner)==null?void 0:H.declaration)==null?void 0:ie.id)===U.operation[Ue.CreateMultipartUpload].inputs.key.id}),L=(e=$==null?void 0:$.value)==null?void 0:e.value;if(!L||L==="")throw new Error(`${A}The "${ze($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof L!="string")throw new Error(`${A}The "${ze($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=r.find(z=>{var H,ie;return((ie=(H=z.valueOwner)==null?void 0:H.declaration)==null?void 0:ie.id)===U.operation[Ue.CreateMultipartUpload].inputs.contentType.id}),M=((f=x==null?void 0:x.value)==null?void 0:f.value)||"application/octet-stream";if(!M||M==="")throw new Error(`${A}The "${ze(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${Et(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input is missing.`);if(typeof M!="string")throw new Error(`${A}The "${ze(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${Et(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=i.project.id,W=await qr.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart?projectId=${q}&bucket=${C}&key=${encodeURIComponent(L)}&contentType=${encodeURIComponent(M)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:{uploadId:typeof W.data=="object"&&((h=W.data)!=null&&h.uploadId)?W.data.uploadId:W.data}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class DSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_UPLOAD_PART_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Upload Part Pre-signed URL",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.GetUploadPartPresignedUrl);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m,T;try{const b=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const A=Et(i,i.project,"getUploadPartPresignedUrl"),I="["+ze(i,i.project,"Get upload part pre-signed URL")+": `"+A+"`] ",C=r.find(J=>{var te,ne;return((ne=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:ne.id)===U.operation[Ue.GetUploadPartPresignedUrl].inputs.bucket.id}),$=(a=C==null?void 0:C.value)==null?void 0:a.valueAsType;if(!$||!$.id||!$.name||$.type!==d.DefinitionEntity)throw new Error(`${I}${I}Invalid input "${ze(C==null?void 0:C.valueOwner,b==null?void 0:b.logic,"Storage")}" (\`${Et(C==null?void 0:C.valueOwner,b==null?void 0:b.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const L=La($==null?void 0:$.id,((c=b.branchHead)==null?void 0:c.identifier)||"main"),x=r.find(J=>{var te,ne;return((ne=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:ne.id)===U.operation[Ue.GetUploadPartPresignedUrl].inputs.key.id}),M=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!M||M==="")throw new Error(`${I}The "${ze(x==null?void 0:x.valueOwner,b==null?void 0:b.logic,"Key")}" (\`${Et(x==null?void 0:x.valueOwner,b==null?void 0:b.logic,"key")}\`) input is missing.`);if(typeof M!="string")throw new Error(`${I}The "${ze(x==null?void 0:x.valueOwner,b==null?void 0:b.logic,"Key")}" (\`${Et(x==null?void 0:x.valueOwner,b==null?void 0:b.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=r.find(J=>{var te,ne;return((ne=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:ne.id)===U.operation[Ue.GetUploadPartPresignedUrl].inputs.uploadId.id}),W=(f=q==null?void 0:q.value)==null?void 0:f.value;if(!W||W==="")throw new Error(`${I}The "${ze(q==null?void 0:q.valueOwner,b==null?void 0:b.logic,"Upload ID")}" (\`${Et(q==null?void 0:q.valueOwner,b==null?void 0:b.logic,"uploadId")}\`) input is missing.`);if(typeof W!="string")throw new Error(`${I}The "${ze(q==null?void 0:q.valueOwner,b==null?void 0:b.logic,"Upload ID")}" (\`${Et(q==null?void 0:q.valueOwner,b==null?void 0:b.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const z=r.find(J=>{var te,ne;return((ne=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:ne.id)===U.operation[Ue.GetUploadPartPresignedUrl].inputs.partNumber.id}),H=Number((h=z==null?void 0:z.value)==null?void 0:h.value);if(isNaN(H)||H<=0)throw new Error(`${I}The "${ze(z==null?void 0:z.valueOwner,b==null?void 0:b.logic,"Part number")}" (\`${Et(z==null?void 0:z.valueOwner,b==null?void 0:b.logic,"partNumber")}\`) input is missing or invalid.`);const ie=i.project.id,oe=await qr.get(`${b.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${W}?projectId=${ie}&bucket=${L}&key=${encodeURIComponent(M)}&partNumber=${H}`,{headers:{Authorization:`Bearer ${await b.getAccessToken()}`}});return{value:K.Success,error:null,result:{uploadUrl:typeof oe.data=="object"&&((m=oe.data)!=null&&m.uploadUrl||(T=oe.data)!=null&&T.url)?oe.data.uploadUrl||oe.data.url:oe.data}}}catch(b){return{value:K.UnhandledError,error:b,result:null}}}})}}class CSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COMPLETE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Complete Multipart Upload",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.CompleteMultipartUpload);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h;try{const m=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Et(i,i.project,"completeMultipartUpload"),A="["+ze(i,i.project,"Complete multipart upload")+": `"+T+"`] ",D=r.find(oe=>{var J,te;return((te=(J=oe.valueOwner)==null?void 0:J.declaration)==null?void 0:te.id)===U.operation[Ue.CompleteMultipartUpload].inputs.bucket.id}),I=(a=D==null?void 0:D.value)==null?void 0:a.valueAsType;if(!I||!I.id||!I.name||I.type!==d.DefinitionEntity)throw new Error(`${A}Invalid input "${ze(D==null?void 0:D.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Et(D==null?void 0:D.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const C=La(I==null?void 0:I.id,((c=m.branchHead)==null?void 0:c.identifier)||"main"),$=r.find(oe=>{var J,te;return((te=(J=oe.valueOwner)==null?void 0:J.declaration)==null?void 0:te.id)===U.operation[Ue.CompleteMultipartUpload].inputs.key.id}),L=(e=$==null?void 0:$.value)==null?void 0:e.value;if(!L||L==="")throw new Error(`${A}The "${ze($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof L!="string")throw new Error(`${A}The "${ze($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=r.find(oe=>{var J,te;return((te=(J=oe.valueOwner)==null?void 0:J.declaration)==null?void 0:te.id)===U.operation[Ue.CompleteMultipartUpload].inputs.uploadId.id}),M=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!M||M==="")throw new Error(`${A}The "${ze(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Et(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof M!="string")throw new Error(`${A}The "${ze(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Et(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=r.find(oe=>{var J,te;return((te=(J=oe.valueOwner)==null?void 0:J.declaration)==null?void 0:te.id)===U.operation[Ue.CompleteMultipartUpload].inputs.parts.id}),W=(h=q==null?void 0:q.value)==null?void 0:h.value;if(!Array.isArray(W)||W.length===0)throw new Error(`${A}The "${ze(q==null?void 0:q.valueOwner,m==null?void 0:m.logic,"Parts")}" (\`${Et(q==null?void 0:q.valueOwner,m==null?void 0:m.logic,"parts")}\`) input is missing or empty.`);const z=i.project.id,ie=(await qr.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${M}/complete?projectId=${z}&bucket=${C}&key=${encodeURIComponent(L)}`,{parts:W},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data||{};return{value:K.Success,error:null,result:{location:ie.location||ie.Location||L,key:ie.key||ie.Key||L,etag:ie.etag||ie.ETag||null}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class OSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_ABORT_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Abort Multipart Upload",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.AbortMultipartUpload);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f;try{const h=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!h||!h.env)throw new Error("Editor context or environment missing");const m=Et(i,i.project,"abortMultipartUpload"),b="["+ze(i,i.project,"Abort multipart upload")+": `"+m+"`] ",A=r.find(W=>{var z,H;return((H=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:H.id)===U.operation[Ue.AbortMultipartUpload].inputs.bucket.id}),D=(a=A==null?void 0:A.value)==null?void 0:a.valueAsType;if(!D||!D.id||!D.name||D.type!==d.DefinitionEntity)throw new Error(`${b}Invalid input "${ze(A==null?void 0:A.valueOwner,h==null?void 0:h.logic,"Storage")}" (\`${Et(A==null?void 0:A.valueOwner,h==null?void 0:h.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=La(D==null?void 0:D.id,((c=h.branchHead)==null?void 0:c.identifier)||"main"),C=r.find(W=>{var z,H;return((H=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:H.id)===U.operation[Ue.AbortMultipartUpload].inputs.key.id}),$=(e=C==null?void 0:C.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${b}The "${ze(C==null?void 0:C.valueOwner,h==null?void 0:h.logic,"Key")}" (\`${Et(C==null?void 0:C.valueOwner,h==null?void 0:h.logic,"key")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${ze(C==null?void 0:C.valueOwner,h==null?void 0:h.logic,"Key")}" (\`${Et(C==null?void 0:C.valueOwner,h==null?void 0:h.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const L=r.find(W=>{var z,H;return((H=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:H.id)===U.operation[Ue.AbortMultipartUpload].inputs.uploadId.id}),x=(f=L==null?void 0:L.value)==null?void 0:f.value;if(!x||x==="")throw new Error(`${b}The "${ze(L==null?void 0:L.valueOwner,h==null?void 0:h.logic,"Upload ID")}" (\`${Et(L==null?void 0:L.valueOwner,h==null?void 0:h.logic,"uploadId")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${b}The "${ze(L==null?void 0:L.valueOwner,h==null?void 0:h.logic,"Upload ID")}" (\`${Et(L==null?void 0:L.valueOwner,h==null?void 0:h.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const M=i.project.id,q=await qr.delete(`${h.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${x}?projectId=${M}&bucket=${I}&key=${encodeURIComponent($)}`,{headers:{Authorization:`Bearer ${await h.getAccessToken()}`}});return{value:K.Success,error:null,result:q.data}}catch(h){return{value:K.UnhandledError,error:h,result:null}}}})}}class LN extends hD{constructor(u,i,r=i.projectId){super(u,ae.Editor),this._editor=i,this.id=r}get ready(){return this._editor.ready}get env(){return this._editor.env}get hasLoadedLogic(){return this._editor.hasLoadedLogic}get destroyed(){return this._editor.destroyed}get logicLoadingPromise(){return this._editor.logicLoadingPromise}get logic(){return this._editor.logic}get lastPublishedProjectState(){return this._editor.lastPublishedProjectState}get branchHead(){return this._editor.branchHead}get branchHeadPromise(){return this._editor.branchHeadPromise}get projectId(){return this._editor.projectId}get sessionId(){return this._editor.sessionId}get userAuthorId(){return this._editor.userAuthorId}get peerConnections(){return this._editor.peerConnections}get test(){return this._editor.test}get localTestValues(){return this._editor.localTestValues}get resolvedValues(){return this._editor.resolvedValues}get persistedExecutionResults(){return this._editor.persistedExecutionResults}get publication(){return this._editor.publication}get livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(u){this._editor.undoableStackValueIndex=u}get activeWorkspace(){return this._editor.activeWorkspace}get branches(){return this._editor.branches}get roles(){return this._editor.roles}get READ_ONLY(){return this._editor.READ_ONLY}get isViewingNonHead(){return this._editor.isViewingNonHead}get canEdit(){return this._editor.canEdit}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}getRefreshToken(){return this._editor.getRefreshToken()}removeValueByOwnerId(u){return this._editor.removeValueByOwnerId(u)}removeValue(u){return this._editor.removeValue(u)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(u,i){return this._editor.initTest(u,i)}removeTest(u){return this._editor.removeTest(u)}async copyEntities(u,i={}){return this._editor.copyEntities(u,i)}resolveInitialChildrenPositions(u,i,r){return this._editor.resolveInitialChildrenPositions(u,i,r)}publish(){return this._editor.publish()}loadGivenPublication(u){return this._editor.loadGivenPublication(u)}validateProjectState(u){return this._editor.validateProjectState(u)}requestActiveDynamicValue(u,i=!1){return this._editor.requestActiveDynamicValue(u,i)}getValueTypePreference(u){return this._editor.getValueTypePreference(u)}setValueTypePreference(u,i){return this._editor.setValueTypePreference(u,i)}implementFeature(u){return this._editor.implementFeature(u)}getProjectRoles(){return this._editor.getProjectRoles()}getLastPublishedVersionLogic(u){return this._editor.getLastPublishedVersionLogic(u)}initialLoads(u){return this._editor.initialLoads(u)}moveBranchHeadToVersion(u,i,r){return this._editor.moveBranchHeadToVersion(u,i,r)}loadInitialBranchHead(){return this._editor.loadInitialBranchHead()}}function wVi(s,u){return u instanceof LN?u:new LN(s,u)}class BN extends hD{constructor(u,i){super(u,ae.PublicationRun),this._publicationRun=i}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get envIdentifier(){return this._publicationRun.envIdentifier}get projectVersion(){return this._publicationRun.projectVersion}get projectBranchId(){return this._publicationRun.projectBranchId}get projectId(){return this._publicationRun.projectId}get triggeredBy(){return this._publicationRun.triggeredBy}get createdAt(){return this._publicationRun.createdAt}get updatedAt(){return this._publicationRun.updatedAt}get status(){return this._publicationRun.status}get steps(){return this._publicationRun.steps}get cleanupSteps(){return this._publicationRun.cleanupSteps}get editor(){return this._publicationRun.editor}get explicitResources(){return this._publicationRun.explicitResources}get implicitGlobalResources(){return this._publicationRun.implicitGlobalResources}get finalGlobalEvent(){return this._publicationRun.finalGlobalEvent}get finalStatus(){return this._publicationRun.finalStatus}}function DVi(s,u){return u instanceof BN?u:new BN(s,u)}function CVi(s){s.register(new J2e(s)),s.register(new Y2e(s)),s.register(new Z2e(s)),s.register(new W2e(s)),s.register(new z2e(s)),s.register(new H2e(s)),s.register(new N4e(s)),s.register(new x4e(s)),s.register(new V4e(s)),s.register(new L4e(s)),s.register(new $4e(s)),s.register(new B4e(s)),s.register(new gKe(s)),s.register(new IKe(s)),s.register(new RKe(s)),s.register(new wKe(s)),s.register(new DKe(s)),s.register(new CKe(s)),s.register(new OKe(s)),s.register(new _Ke(s)),s.register(new PKe(s)),s.register(new NKe(s)),s.register(new PFe(s)),s.register(new NFe(s)),s.register(new xFe(s)),s.register(new VFe(s)),s.register(new $Fe(s)),s.register(new LFe(s)),s.register(new BFe(s)),s.register(new MFe(s)),s.register(new GFe(s)),s.register(new kFe(s)),s.register(new UFe(s)),s.register(new FFe(s)),s.register(new jFe(s)),s.register(new KFe(s)),s.register(new SFe(s)),s.register(new qFe(s)),s.register(new ZFe(s)),s.register(new HFe(s)),s.register(new WFe(s)),s.register(new JFe(s)),s.register(new QFe(s)),s.register(new XFe(s)),s.register(new YUe(s)),s.register(new JUe(s)),s.register(new QUe(s)),s.register(new XUe(s)),s.register(new eFe(s)),s.register(new tFe(s)),s.register(new iFe(s)),s.register(new rFe(s)),s.register(new nFe(s)),s.register(new sFe(s)),s.register(new lFe(s)),s.register(new oFe(s)),s.register(new dFe(s)),s.register(new uFe(s)),s.register(new hUe(s)),s.register(new Uje(s)),s.register(new Gje(s)),s.register(new kje(s)),s.register(new yke(s)),s.register(new hke(s)),s.register(new mke(s)),s.register(new Tke(s)),s.register(new vke(s)),s.register(new Eke(s)),s.register(new bke(s)),s.register(new Ake(s)),s.register(new gke(s)),s.register(new Lke(s)),s.register(new cUe(s)),s.register(new fUe(s)),s.register(new yUe(s)),s.register(new Ike(s)),s.register(new Rke(s)),s.register(new wke(s)),s.register(new Dke(s)),s.register(new Cke(s)),s.register(new Oke(s)),s.register(new _ke(s)),s.register(new Pke(s)),s.register(new Nke(s)),s.register(new xke(s)),s.register(new Vke(s)),s.register(new $ke(s)),s.register(new Bke(s)),s.register(new Mke(s)),s.register(new Gke(s)),s.register(new kke(s)),s.register(new Uke(s)),s.register(new Fke(s)),s.register(new jke(s)),s.register(new Kke(s)),s.register(new Ske(s)),s.register(new qke(s)),s.register(new Zke(s)),s.register(new Hke(s)),s.register(new iUe(s)),s.register(new rUe(s)),s.register(new nUe(s)),s.register(new Wke(s)),s.register(new zke(s)),s.register(new Yke(s)),s.register(new Jke(s)),s.register(new Qke(s)),s.register(new Xke(s)),s.register(new eUe(s)),s.register(new tUe(s)),s.register(new Sje(s)),s.register(new qje(s)),s.register(new Zje(s)),s.register(new Hje(s)),s.register(new Fje(s)),s.register(new jje(s)),s.register(new Kje(s)),s.register(new Wje(s)),s.register(new Yje(s)),s.register(new Qje(s)),s.register(new zje(s)),s.register(new Jje(s)),s.register(new Xje(s)),s.register(new iKe(s)),s.register(new eKe(s)),s.register(new tKe(s)),s.register(new pFe(s)),s.register(new hFe(s)),s.register(new mFe(s)),s.register(new EFe(s)),s.register(new bFe(s)),s.register(new AFe(s)),s.register(new gFe(s)),s.register(new IFe(s)),s.register(new RFe(s)),s.register(new wFe(s)),s.register(new DFe(s)),s.register(new TFe(s)),s.register(new vFe(s)),s.register(new cSe(s)),s.register(new fSe(s)),s.register(new ySe(s)),s.register(new hSe(s)),s.register(new mSe(s)),s.register(new TSe(s)),s.register(new vSe(s)),s.register(new ESe(s)),s.register(new bSe(s)),s.register(new ASe(s)),s.register(new gSe(s)),s.register(new ISe(s)),s.register(new RSe(s)),s.register(new wSe(s)),s.register(new DSe(s)),s.register(new CSe(s)),s.register(new OSe(s)),s.register(new fFe(s)),s.register(new yFe(s)),s.register(new cFe(s)),s.register(new aFe(s)),s.register(new OFe(s)),s.register(new _Fe(s)),s.register(new CFe(s)),s.register(new G4e(s)),s.register(new oje(s)),s.register(new lje(s)),s.register(new dje(s)),s.register(new uje(s)),s.register(new F4e(s)),s.register(new j4e(s)),s.register(new W4e(s)),s.register(new Z4e(s)),s.register(new aje(s)),s.register(new X4e(s)),s.register(new tje(s)),s.register(new rje(s)),s.register(new ije(s)),s.register(new H4e(s)),s.register(new Y4e(s)),s.register(new J4e(s)),s.register(new z4e(s)),s.register(new M4e(s)),s.register(new K4e(s)),s.register(new eje(s)),s.register(new fje(s)),s.register(new _N(s)),s.register(new U4e(s)),s.register(new S4e(s)),s.register(new k4e(s)),s.register(new nje(s)),s.register(new q4e(s)),s.register(new Q4e(s)),s.register(new sje(s)),s.register(new cje(s)),s.register(new pje(s)),s.register(new yje(s)),s.register(new _N(s)),s.register(new mje(s)),s.register(new hje(s)),s.register(new Tje(s)),s.register(new y4e(s)),s.register(new h4e(s)),s.register(new m4e(s)),s.register(new t4e(s)),s.register(new YFe(s)),s.register(new a4e(s)),s.register(new d4e(s)),s.register(new zFe(s)),s.register(new u4e(s)),s.register(new f4e(s)),s.register(new l4e(s)),s.register(new s4e(s)),s.register(new TR(s)),s.register(new T4e(s)),s.register(new v4e(s)),s.register(new o4e(s)),s.register(new c4e(s)),s.register(new p4e(s)),s.register(new n4e(s)),s.register(new r4e(s)),s.register(new i4e(s)),s.register(new e4e(s)),s.register(new A4e(s)),s.register(new b4e(s)),s.register(new g4e(s)),s.register(new E4e(s)),s.register(new oUe(s)),s.register(new aUe(s)),s.register(new lUe(s)),s.register(new dUe(s)),s.register(new uUe(s)),s.register(new sUe(s)),s.register(new pUe(s)),s.register(new xKe(s)),s.register(new GKe(s)),s.register(new UKe(s)),s.register(new jKe(s)),s.register(new MKe(s)),s.register(new kKe(s)),s.register(new FKe(s)),s.register(new BKe(s)),s.register(new LKe(s)),s.register(new $Ke(s)),s.register(new VKe(s)),s.register(new HKe(s)),s.register(new WKe(s)),s.register(new qKe(s)),s.register(new ZKe(s)),s.register(new AKe(s)),s.register(new KKe(s)),s.register(new SKe(s)),s.register(new YKe(s)),s.register(new zKe(s)),s.register(new JKe(s)),s.register(new QKe(s)),s.register(new XKe(s)),s.register(new Q2e(s)),s.register(new X2e(s)),s.register(new hR(s)),s.register(new mR(s)),s.register(new iSe(s)),s.register(new rSe(s)),s.register(new sSe(s)),s.register(new pSe(s)),s.register(new oSe(s)),s.register(new nSe(s)),s.register(new aSe(s)),s.register(new dSe(s)),s.register(new lSe(s)),s.register(new uSe(s))}class bB{constructor(u=new re.Events("extensions-registry-fallback-events")){w(this,"extensionsRegistry",new Map);w(this,"initialized",new Set);w(this,"initializedContexts",new Set);w(this,"onResolveEditorContextCallback",()=>null);w(this,"onResolveProjectLogicContextCallback",()=>null);w(this,"onResolveEditorGUIContextCallback",()=>null);w(this,"onResolveGUIContextCallback",()=>null);w(this,"onResolveCompileContextCallback",()=>null);w(this,"onResolvePublicationRunContextCallback",()=>null);this.events=u,this.off=this.events.off.bind(this.events),this.on=this.events.on.bind(this.events),this.emit=this.events.emit.bind(this.events),this.emitAsync=this.events.emitAsync.bind(this.events),this.emitAsyncAll=this.events.emitAsyncAll.bind(this.events),this.emitAsyncAllSettled=this.events.emitAsyncAllSettled.bind(this.events),this.emitAsyncSequentially=this.events.emitAsyncSequentially.bind(this.events),this.emitAsyncSequentiallyAll=this.events.emitAsyncSequentiallyAll.bind(this.events),this.emitAsyncSequentiallyAllSettled=this.events.emitAsyncSequentiallyAllSettled.bind(this.events)}onResolveEditorContext(u){this.onResolveEditorContextCallback=u}onResolveProjectLogicContext(u){this.onResolveProjectLogicContextCallback=u}onResolveGUIContext(u){this.onResolveGUIContextCallback=u}onResolveEditorGUIContext(u){this.onResolveEditorGUIContextCallback=u}onResolveCompileContext(u){this.onResolveCompileContextCallback=u}onResolvePublicationRunContext(u){this.onResolvePublicationRunContextCallback=u}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((u,i)=>(u.manifest.initPriority||Oe.Normal)-(i.manifest.initPriority||Oe.Normal))}async setup(){CVi(this),re.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(u){switch(u){case ae.Editor:return this.onResolveEditorContextCallback();case ae.Logic:return this.onResolveProjectLogicContextCallback();case ae.EditorGUI:return this.onResolveEditorGUIContextCallback();case ae.Compile:return this.onResolveCompileContextCallback();case ae.PublicationRun:return this.onResolvePublicationRunContextCallback();case ae.GUI:return this.onResolveGUIContextCallback();case ae.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${u}`)}}requestContexts(u,i=[]){const r=[];i.length===0&&(i=u.manifest.contexts);for(const a of i){const c=this.requestContext(a);c&&r.push(c)}return r}requestExtension(u){const i=this.extensionsRegistry.get(u);if(i)return i;throw new Error(`Unknown extension: ${u}`)}register(u){this.extensionsRegistry.set(u.manifest.id,u)}async initAll(){var u,i;for(const r of this.extensionInOrder)if(r.module.init&&!this.initialized.has(r.manifest.id)){const a=r.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);a.length&&(await((i=(u=r.module).init)==null?void 0:i.call(u,a)),this.initialized.add(r.manifest.id))}else!r.module.init&&!this.initialized.has(r.manifest.id)&&this.initialized.add(r.manifest.id)}async initForReady(){re.Logger.log("Initializing extensions for ready contexts...");for(const u of this.extensionInOrder)if(u.module.init&&!this.initialized.has(u.manifest.id)){re.Logger.debug("Initializing "+u.manifest.id+" extension...");const i=this.requestContexts(u);u.manifest.contexts.every(a=>!!i.find(c=>c.contextType===a))?(await u.module.init(i),this.initialized.add(u.manifest.id)):re.Logger.warn(`Skipping initialization of ${u.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${u.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(a=>a.contextType).join(", ")}`)}else!u.module.init&&!this.initialized.has(u.manifest.id)?(re.Logger.log("Set "+u.manifest.id+" extension as initialized by default..."),this.initialized.add(u.manifest.id)):re.Logger.log(`Skipping initialization of ${u.manifest.id} extension, already initialized or no init method defined.`)}async destroyAll(){for(const u of[...this.extensionInOrder].reverse())u.module.destroy&&await u.module.destroy();this.events.destroy()}on(u,i){this.events.on(u,i)}emit(u,...i){this.events.emit(u,...i)}off(u,i){this.events.off(u,i)}emitAsync(u,...i){return this.events.emitAsync(u,...i)}emitAsyncAll(u,...i){return this.events.emitAsyncAll(u,...i)}emitAsyncAllSettled(u,...i){return this.events.emitAsyncAllSettled(u,...i)}emitAsyncSequentially(u,...i){return this.events.emitAsyncSequentially(u,...i)}emitAsyncSequentiallyAll(u,...i){return this.events.emitAsyncSequentiallyAll(u,...i)}emitAsyncSequentiallyAllSettled(u,...i){return this.events.emitAsyncSequentiallyAllSettled(u,...i)}async contextAvailable(u){if(this.initializedContexts.has(u)){re.Logger.warn(`Context ${u} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(u),u){case ae.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case ae.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}re.Logger.log(`Context ${u} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(u){return window.localStorage.getItem("dynamic-value-type-preference--"+u)||null}setValueTypePreference(u,i){window.localStorage.setItem("dynamic-value-type-preference--"+u,(i==null?void 0:i.toString())||""),this.emit(u,{})}}let kI=null;const AB={requestExtension:s=>(kI||(kI=new bB,kI.setup()),kI.requestExtension(s))};function Cc(s){return!(s instanceof Error)&&typeof s=="object"&&s!==null?s:s instanceof Error?{name:s.name,message:s.message,stack:s.stack,...s}:s}function eK(s){var u,i,r;if(s&&typeof s=="object"&&"value"in s){const a=s;return{single:((u=a.value)==null?void 0:u.valueAsTypeSingle)??((i=a.value)==null?void 0:i.value),list:((r=a.value)==null?void 0:r.valueAsTypeList)??null}}return{single:s,list:Array.isArray(s)?s:null}}const Oc={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};class MN extends Error{constructor(){super("Execution was stopped"),this.name="ExecutionStoppedError"}}var gB=(s=>(s.FinishedSuccess="finished-success",s.FinishedError="finished-error",s.Running="running",s.Paused="paused",s.Stopped="stopped",s.NotStarted="not-started",s))(gB||{});const _Se={...AB,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class $m extends re.Events{constructor(i,r,a,c=null,e=_Se){super();w(this,"project");w(this,"entryPoint");w(this,"state","not-started");w(this,"events",new re.Events("fe-exec-inst-events"));w(this,"entities",[]);w(this,"parentExecution",null);w(this,"executing",[]);w(this,"executed",[]);w(this,"skipped",[]);w(this,"scheduled",[]);w(this,"localTestValues");w(this,"resolvedValues");w(this,"persistedExecutionResults");w(this,"lastExecutionResults");w(this,"onAddToSkippedListCallback",null);w(this,"onRemoveFromSkippedListCallback",null);w(this,"onAddEntityCallback",null);w(this,"onRemoveEntityCallback",null);w(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=r,this.entryPoint=a,this.project=i,this.parentExecution=c,this.localTestValues=new yE(B.UUID.uuid(),this.project),this.resolvedValues=new yE(B.UUID.uuid(),this.project),this.persistedExecutionResults=new yE(B.UUID.uuid(),this.project),this.lastExecutionResults=new yE(B.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}get rootExecution(){let i=this;for(;i.parentExecution;)i=i.parentExecution;return i}get rootState(){return this.rootExecution.state}isStopped(){return this.state==="stopped"||this.rootExecution.state==="stopped"}isPaused(){return this.state==="paused"||this.rootExecution.state==="paused"}async checkStateAndPause(){if(this.isStopped())throw new MN;for(;this.isPaused();){if(this.isStopped())throw new MN;await new Promise(i=>setTimeout(i,100))}}skip(i){this.hasEntity(i)&&(this.removeFromScheduledList(i),!this.skipped.includes(i)&&(this.skipped.push(i),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(i),Dr.includes(i.type)&&Lt(i).forEach(r=>this.skip(r))))}async schedule(i,r,a){if(this.hasExecuted(i))return null;if(Ei.includes(i.type))return this.executeBranch(i,a,r);if(Cr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,a,r);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,r){const a=[];return vi.includes(r.type)?a.push(...r.inputs.filter(e=>Jy(e))):[...ni,...Ei].includes(r.type)?a.push(...r.inputs):ti.includes(r.type)&&a.push(...r.outputs.filter(e=>Jy(e))),a.map(e=>{var h;let f=i.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&Ei.includes(r.type)&&(f=i.find(m=>{var T;return((T=m.valueOwner.declaration)==null?void 0:T.id)===e.id})),f){const m=(h=f.value)==null?void 0:h.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return Mn.includes(e.type)?yd(e,this.valueResolutionContext):wp(e,this.valueResolutionContext)}).reduce((e,f)=>{const h=Ru(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return h.forEach(T=>{var D,I,C;if(T.id===(f==null?void 0:f.valueOwner.id))return;const b=Gi(T.getDataType(null),T,this.project);b==null||b.metaSync({value:(D=f==null?void 0:f.value)==null?void 0:D.value},null),b==null||b.setValueAsTypeList(((I=f==null?void 0:f.value)==null?void 0:I.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((C=f==null?void 0:f.value)==null?void 0:C.valueAsTypeSingle)||null);const A={...f,valueOwner:T,value:b};m.push(A)}),[...e,...m]},[]).sort((e,f)=>e.valueOwner.index-f.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,r,a,c={}){var f,h;this.logBeforeExecution("executeInternalCall",i,r);const e={...Oc,...c};try{let m={value:K.Success,error:null,result:null};if(r.sort((C,$)=>C.valueOwner.index-$.valueOwner.index),Object.values(In).includes(i.declaration.id)){const C=this.parentContext.requestExtension(Os+i.declaration.id).module.main;C?m=await C(i,r,this):re.Logger.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{const C=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);m={value:C.value,error:C.error,result:C.result}}let T=null;if(m.error&&i.error){re.Logger.warn("Raw error executing entity: ",m.error);const{single:C,list:$}=eK(m.error),L=Cc(C),x=(f=i.error)==null?void 0:f.getDataType(null),M=Gi(x||null,i.error,a);if(x!=null&&x.asType)$!==null?M==null||M.setValueAsTypeList($):M==null||M.setValueAsTypeSingle(C);else{const q=hn(L)?JSON.stringify(L,null,2):L;M==null||M.metaSync({value:q},null)}T={valueOwner:i.error,type:Se.ExecutionResult,inheritanceLink:null,value:M}}const b=i==null?void 0:i.getDataType(null),A=Gi(b,i,a),{single:D,list:I}=eK(m.result);return b!=null&&b.asType?I!==null?A==null||A.setValueAsTypeList(I):A==null||A.setValueAsTypeSingle(D):A==null||A.metaSync({value:D},null),{value:m.value,entity:i,error:T,result:{value:A||null,valueOwner:i,type:Se.ExecutionResult,inheritanceLink:null}}}catch(m){if(m&&(m.name==="ExecutionStoppedError"||m.message==="Execution was stopped"))throw m;re.Logger.warn("Internal call execution error: ",m);let T=null;if(i.error){const b=Cc(m),A=(h=i.error)==null?void 0:h.getDataType(null),D=Gi(A,i.error,a);if(A!=null&&A.asType)D==null||D.setValueAsTypeSingle(m);else{const I=hn(b)?JSON.stringify(b,null,2):b;D==null||D.metaSync({value:I},null)}T={valueOwner:i.error,type:Se.ExecutionResult,inheritanceLink:null,value:D}}return{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,entity:i,error:T,result:null}}}static async executeOperation(i,r,a,c){var e,f;c?c.logBeforeExecution("executeOperation",i,r):console.log(`executeOperation (${i.type}) -> [${ye(i,a)}] Inputs:${r.length?`
61
+ `),u}class uSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:Os+je.GoogleDriveUploadFile,version:"2.0.0",description:"Upload a file to Google Drive (media / import+copy) with auto content detection and simplified inputs.",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Editor,ae.Logic]});w(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(je.GoogleDriveUploadFile);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e,f,h,m,T,b,A,D,I,C,$,L,x,M,q,W,z,H,ie,oe,J,te,ne,pe,de,he,Ee,ve,Ie,Ce,Me;try{const ke=((c=(a=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.connection.id}))==null?void 0:a.value)==null?void 0:c.valueAsType)??((f=(e=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.connection.id}))==null?void 0:e.value)==null?void 0:f.value);if(!(ke instanceof ea))return mu(i,"Invalid or missing connection entity");const we=((m=(h=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.content.id}))==null?void 0:h.value)==null?void 0:m.valueAsType)??((b=(T=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.content.id}))==null?void 0:T.value)==null?void 0:b.value),Fe=($=((D=(A=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.name.id}))==null?void 0:A.value)==null?void 0:D.valueAsType)??((C=(I=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.name.id}))==null?void 0:I.value)==null?void 0:C.value))==null?void 0:$.trim(),Je=(((x=(L=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:L.value)==null?void 0:x.valueAsType)??((q=(M=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.mimeType.id}))==null?void 0:M.value)==null?void 0:q.value))||"application/octet-stream",qe=(((z=(W=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:W.value)==null?void 0:z.valueAsType)??((ie=(H=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.folderId.id}))==null?void 0:H.value)==null?void 0:ie.value))||void 0,ct=(((J=(oe=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:oe.value)==null?void 0:J.valueAsType)??((ne=(te=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.description.id}))==null?void 0:te.value)==null?void 0:ne.value))||void 0,gt=(((de=(pe=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:pe.value)==null?void 0:de.valueAsType)??((Ee=(he=r.find(Li=>{var si,li;return((li=(si=Li.valueOwner)==null?void 0:si.declaration)==null?void 0:li.id)===U.operation[je.GoogleDriveUploadFile].inputs.importMimeType.id}))==null?void 0:he.value)==null?void 0:Ee.value))||"text/plain";if(!Fe)return mu(i,"Missing required input: name");const dt=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0],st=id(ke),Ci={Authorization:`Bearer ${await dt.getAccessToken()}`},qi=`${((ve=dt.env)==null?void 0:ve.API_BASE_URL)+"/editor-runtime"}/v2/external-integrations/proxy/${dt.projectId}/${Nr["google-drive"]}/${st}`,Ct=async(Li,si,{params:li,body:ya,contentType:Jn,providerHeaders:kr,responseType:$r}={})=>{const Yt=`${qi}/${bVi(si)}`,Kt={...Ci};return Jn&&(Kt["Content-Type"]=Jn),(kr||$r)&&(Kt[EVi]=JSON.stringify({...kr?{headers:kr}:{},...$r?{responseType:$r}:{}})),qr.request({method:Li,url:Yt,params:li,data:ya,responseType:$r||"json",headers:Kt})},ft=typeof Je=="string"&&Je.startsWith("application/vnd.google-apps.");if(ft&&(we==null||we==="")){const Li={name:Fe,mimeType:Je};qe&&(Li.parents=[qe]),typeof ct=="string"&&(Li.description=ct);const si=await Ct("POST","/drive/v3/files",{params:{supportsAllDrives:"true",fields:mE},body:JSON.stringify(Li),contentType:"application/json"});return si.status!==200&&si.status!==201?mu(i,`Drive create failed (status=${si.status})`):qP({file:si.data})}if(ft&&we!=null){let Li=await gVi(we);const li=(($r,Yt)=>Yt||($r==="application/vnd.google-apps.spreadsheet"?"text/csv":$r==="application/vnd.google-apps.document"||$r==="application/vnd.google-apps.presentation"?"text/html":"text/plain"))(Je,gt),ya=li.startsWith("text/")&&!/charset=/i.test(li)?`${li}; charset=UTF-8`:li;li.startsWith("text/csv")&&(Li=IVi(Li));const Jn=new TextEncoder().encode(Li);if(Jn.byteLength>Xj)return mu(i,`Text body exceeds simple upload limit (${Jn.byteLength} bytes).`);let kr;try{const $r=await Ct("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:mE},body:Jn,contentType:ya});if($r.status!==200&&$r.status!==201)return mu(i,`Drive media upload failed (status=${$r.status})`);if(kr=(Ie=$r.data)==null?void 0:Ie.id,!kr)return mu(i,"Drive media upload did not return an id");const Yt={name:Fe,mimeType:Je};qe&&(Yt.parents=[qe]),typeof ct=="string"&&(Yt.description=ct);const Kt=await Ct("POST",`/drive/v3/files/${encodeURIComponent(kr)}/copy`,{params:{supportsAllDrives:"true",fields:mE},body:JSON.stringify(Yt),contentType:"application/json"});return Kt.status!==200&&Kt.status!==201?mu(i,`Drive copy-convert failed (status=${Kt.status})`):qP({file:Kt.data})}finally{if(kr)try{await Ct("DELETE",`/drive/v3/files/${encodeURIComponent(kr)}`,{params:{supportsAllDrives:"true"}})}catch{}}}if(we==null)return mu(i,"Missing content for non-native upload");const{bytes:ri,inferredMime:nt,isBinary:Tt}=await AVi(we),Ot=ri.byteLength;if(Ot>Xj)return mu(i,`File too large for simple upload (${Ot} bytes).`);const Gr=await Ct("POST","/upload/drive/v3/files",{params:{uploadType:"media",supportsAllDrives:"true",fields:mE},body:ri,contentType:Je||nt||(Tt?"application/octet-stream":"text/plain; charset=UTF-8")});if(Gr.status!==200&&Gr.status!==201)return mu(i,`Drive media upload failed (status=${Gr.status})`);let Oa=Gr.data;const fa=(Ce=Gr.data)==null?void 0:Ce.id;return fa&&(qe||Fe||ct)&&(Oa=await RVi(Ct,fa,Fe,ct,qe)),qP({file:Oa})}catch(ke){const we=((Me=ke.response)==null?void 0:Me.data)||ke.message||ke;return re.Logger.error("[Google Drive] Upload document failed:",we),{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,error:we,result:null}}}})}}function qP(s){return{value:K.Success,error:null,result:s}}function mu(s,u){return re.Logger.log("[Google Drive] Upload error:",u),{value:s.catchesError||s.errorCalls.length?K.CaughtError:K.UnhandledError,error:u,result:null}}async function RVi(s,u,i,r,a){const c={};i&&(c.name=i),typeof r=="string"&&(c.description=r);const e={supportsAllDrives:"true",fields:mE},f={...e};a&&(f.addParents=a,f.removeParents="root");let h=await s("PATCH",`/drive/v3/files/${encodeURIComponent(u)}`,{params:f,body:JSON.stringify(c),contentType:"application/json"});if(h.status>=400&&a&&(h=await s("PATCH",`/drive/v3/files/${encodeURIComponent(u)}`,{params:{...e,addParents:a},body:JSON.stringify(c),contentType:"application/json"})),h.status!==200)throw new Error(`Drive metadata update failed (status=${h.status})`);return h.data}class pSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:Os+je.GoogleGeminiGenerateContent,version:"1.0.0",description:"Send Gmail email operation implementation module",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Editor,ae.Logic]});w(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(je.GoogleGeminiGenerateContent);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e,f,h;try{const m=r.find(x=>{var M,q;return((q=(M=x.valueOwner)==null?void 0:M.declaration)==null?void 0:q.id)===U.operation["external-integration--google-gemini--post--generate-content"].inputs.connection.id}),T=(a=m==null?void 0:m.value)==null?void 0:a.valueAsType;if(!T)return{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,error:"No entity template provided",result:null};if(!(T instanceof ea))return{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,error:"Invalid entity template value provided",result:null};const b=r.find(x=>{var M,q;return((q=(M=x.valueOwner)==null?void 0:M.declaration)==null?void 0:q.id)===U.operation["external-integration--google-gemini--post--generate-content"].inputs.prompt.id}),A=(c=b==null?void 0:b.value)==null?void 0:c.value;if(!A||typeof A!="string")return{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,error:"Invalid prompt value provided",result:null};const D=r.find(x=>{var M,q;return((q=(M=x.valueOwner)==null?void 0:M.declaration)==null?void 0:q.id)===U.operation["external-integration--google-gemini--post--generate-content"].inputs.model.id}),I=(e=D==null?void 0:D.value)==null?void 0:e.value;if(!I||typeof I!="string")return{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,error:"Invalid model value provided",result:null};const C=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0],$=id(T);console.log("Triggering Google Gemini generate content action with connectionId:",$);const L=await(await qr.post(`${(f=C.env)==null?void 0:f.API_BASE_URL}/editor-runtime/v1/external-integrations/trigger-action/${Nr["google-gemini"]}/${$}/generate-content`,{payload:{prompt:A,model:I}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${await C.getAccessToken()}`}})).data;return re.Logger.log("[Google Gemini] Generate content action response:",L),{value:K.Success,error:null,result:{content:L.content}}}catch(m){const T=((h=m.response)==null?void 0:h.data)||m.message||m;return re.Logger.error("[Google Gemini] Generate content failed:",T),{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,error:T,result:null}}}})}}class cSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_UPLOAD_FILE,version:"1.0.0",description:"Cloud File System: Upload File",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.UploadFile);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f;try{const h=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!h||!h.env)throw new Error("Editor context or environment missing");const m=Et(i,i.project,"uploadFile"),b="["+ze(i,i.project,"Upload file")+": `"+m+"`] ",A=r.find(he=>{var Ee,ve;return((ve=(Ee=he.valueOwner)==null?void 0:Ee.declaration)==null?void 0:ve.id)===U.operation[Ue.UploadFile].inputs.bucket.id}),D=(a=A==null?void 0:A.value)==null?void 0:a.valueAsType;if(!D||!D.id||!D.name||D.type!==d.DefinitionEntity)throw new Error(`${b}Invalid input "${ze(A==null?void 0:A.valueOwner,h==null?void 0:h.logic,"Storage")}" (\`${Et(A==null?void 0:A.valueOwner,h==null?void 0:h.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=La(D==null?void 0:D.id,((c=h.branchHead)==null?void 0:c.identifier)||"main");if(!((h==null?void 0:h.liveResources)||[]).find(he=>he.resourceId===I))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const $=r.find(he=>{var Ee,ve;return((ve=(Ee=he.valueOwner)==null?void 0:Ee.declaration)==null?void 0:ve.id)===U.operation[Ue.UploadFile].inputs.key.id}),L=(e=$==null?void 0:$.value)==null?void 0:e.value;if(!L||L==="")throw new Error(`${b}The "${ze($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"key")}\`) input is missing.`);if(typeof L!="string")throw new Error(`${b}The "${ze($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=r.find(he=>{var Ee,ve;return((ve=(Ee=he.valueOwner)==null?void 0:Ee.declaration)==null?void 0:ve.id)===U.operation[Ue.UploadFile].inputs.file.id}),M=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!M)throw new Error(`${b}The "${ze(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"File")}" (\`${Et(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"file")}\`) input is missing'`);if(typeof M!="object"||!M.uri||typeof M.uri!="string")throw new Error(`${b}The "${ze(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"File")}" (\`${Et(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"file")}\`) input is invalid, should be an object with a text 'uri' property`);const q=i.project.id,W=M.uri,z=M.mimeType||"application/octet-stream",H=L,ie=await qr.post(`${h.env.API_BASE_URL}/cloud-files-service/v1/files?projectId=${q}&bucket=${I}&key=${encodeURIComponent(H)}&contentType=${encodeURIComponent(z)}`,{},{headers:{Authorization:`Bearer ${await h.getAccessToken()}`}}),{uploadUrl:oe}=ie.data;let J;if(W.startsWith("http://")||W.startsWith("https://"))try{const he=await h.getAccessToken();he&&(J={Authorization:`Bearer ${he}`})}catch{}const te=await fetch(W,{headers:J});if(!te.ok&&!W.startsWith("data:")&&!W.startsWith("blob:"))throw new Error(`${b}Failed to fetch file content from '${W}' (status: ${te.status})`);const ne=await te.blob();await qr.put(oe,ne,{headers:{"Content-Type":z}});const de={uri:`${h.env.API_BASE_URL}/cloud-files-service/v1/files/download?projectId=${q}&bucketId=${I}&key=${encodeURIComponent(H)}`,name:H.split("/").pop()||H,mimeType:z,size:ne.size};return{value:K.Success,error:null,result:de}}catch(h){return{value:K.UnhandledError,error:h,result:null}}}})}}class fSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DOWNLOAD_FILE,version:"1.0.0",description:"Cloud File System: Download File",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.DownloadFile);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const h=Et(i,i.project,"downloadFile"),T="["+ze(i,i.project,"Download file")+": `"+h+"`] ",b=r.find(H=>{var ie,oe;return((oe=(ie=H.valueOwner)==null?void 0:ie.declaration)==null?void 0:oe.id)===U.operation[Ue.DownloadFile].inputs.bucket.id}),A=(a=b==null?void 0:b.value)==null?void 0:a.valueAsType;if(!A||!A.id||!A.name||A.type!==d.DefinitionEntity)throw new Error(`${T}Invalid input "${ze(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Et(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=La(A==null?void 0:A.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(H=>H.resourceId===D))throw new Error("The provided storage is not live. Publish the project first, then try again to run the operation node.");const C=r.find(H=>{var ie,oe;return((oe=(ie=H.valueOwner)==null?void 0:ie.declaration)==null?void 0:oe.id)===U.operation[Ue.DownloadFile].inputs.key.id}),$=(e=C==null?void 0:C.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const L=i.project.id,x=H=>{var te;if(!H)return"application/octet-stream";const ie=H.split(".");if(ie.length===1)return"application/octet-stream";const oe=(te=ie.pop())==null?void 0:te.toLowerCase();return{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",pdf:"application/pdf",txt:"text/plain",html:"text/html",csv:"text/csv",json:"application/json",mp4:"video/mp4"}[oe]||"application/octet-stream"};let M=0,q=x($);try{const H=await qr.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?projectId=${L}&bucket=${D}&key=${encodeURIComponent($)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});H.data&&(typeof H.data.size=="number"&&(M=H.data.size),H.data.mimeType&&H.data.mimeType!=="application/octet-stream"&&(q=H.data.mimeType))}catch{}const z={uri:`${f.env.API_BASE_URL}/cloud-files-service/v1/files/download?projectId=${L}&bucket=${D}&key=${encodeURIComponent($)}`,name:$.split("/").pop()||$,mimeType:q,size:M};return{value:K.Success,error:null,result:z}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class ySe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_LIST_FILES,version:"1.0.0",description:"Cloud File System: List Files",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.ListFiles);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h;try{const m=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Et(i,i.project,"listFiles"),A="["+ze(i,i.project,"List files")+": `"+T+"`] ",D=r.find(ve=>{var Ie,Ce;return((Ce=(Ie=ve.valueOwner)==null?void 0:Ie.declaration)==null?void 0:Ce.id)===U.operation[Ue.ListFiles].inputs.bucket.id}),I=(a=D==null?void 0:D.value)==null?void 0:a.valueAsType;if(!I||!I.id||!I.name||I.type!==d.DefinitionEntity)throw new Error(`${A}Invalid input "${ze(D==null?void 0:D.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Et(D==null?void 0:D.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const C=La(I==null?void 0:I.id,((c=m.branchHead)==null?void 0:c.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(ve=>ve.resourceId===C))throw new Error(`${A}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const L=r.find(ve=>{var Ie,Ce;return((Ce=(Ie=ve.valueOwner)==null?void 0:Ie.declaration)==null?void 0:Ce.id)===U.operation[Ue.ListFiles].inputs.path.id}),x=(e=L==null?void 0:L.value)==null?void 0:e.value;if(x!==void 0&&(typeof x!="string"||x===""))throw new Error(`${A}The "${ze(L==null?void 0:L.valueOwner,m==null?void 0:m.logic,"Path")}" (\`${Et(L==null?void 0:L.valueOwner,m==null?void 0:m.logic,"path")}\`) input value is invalid, if present, it must be a non-empty string.`);const M=r.find(ve=>{var Ie,Ce;return((Ce=(Ie=ve.valueOwner)==null?void 0:Ie.declaration)==null?void 0:Ce.id)===U.operation[Ue.ListFiles].inputs.maxKeys.id}),q=(f=M==null?void 0:M.value)==null?void 0:f.value;if(q!==void 0&&(typeof q!="number"||q<=0))throw new Error(`${A}The "${ze(M==null?void 0:M.valueOwner,m==null?void 0:m.logic,"Max results")}" (\`${Et(M==null?void 0:M.valueOwner,m==null?void 0:m.logic,"maxKeys")}\`) input value is invalid, if present, it must be a number greater than 0.`);const W=r.find(ve=>{var Ie,Ce;return((Ce=(Ie=ve.valueOwner)==null?void 0:Ie.declaration)==null?void 0:Ce.id)===U.operation[Ue.ListFiles].inputs.startAfter.id}),z=(h=W==null?void 0:W.value)==null?void 0:h.value;if(z!==void 0&&(typeof z!="string"||z===""))throw new Error(`${A}The "${ze(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,"Start after")}" (\`${Et(W==null?void 0:W.valueOwner,m==null?void 0:m.logic,"startAfter")}\`) input value is invalid, if present, it must be a non-empty string.`);const H=i.project.id;let ie=`${m.env.API_BASE_URL}/cloud-files-service/v1/files?projectId=${H}&bucket=${C}`;x&&(ie+=`&path=${encodeURIComponent(x)}`),q&&(ie+=`&maxKeys=${q}`),z&&(ie+=`&startAfter=${encodeURIComponent(z)}`);const oe=await qr.get(ie,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}}),J=ve=>{var ke;if(!ve)return"application/octet-stream";const Ie=ve.split(".");if(Ie.length===1)return"application/octet-stream";const Ce=(ke=Ie.pop())==null?void 0:ke.toLowerCase();return{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",pdf:"application/pdf",txt:"text/plain",html:"text/html",csv:"text/csv",json:"application/json",mp4:"video/mp4"}[Ce]||"application/octet-stream"},ne=(oe.data.items||oe.data.files||[]).map(ve=>{var Ie;return{uri:ve.uri||ve.url||`${m.env.API_BASE_URL}/cloud-files-service/v1/files/download?projectId=${H}&bucket=${C}&key=${encodeURIComponent(ve.key)}`,name:ve.name||((Ie=ve.key)==null?void 0:Ie.split("/").pop())||ve.key,key:ve.key,mimeType:ve.mimeType||J(ve.key),size:ve.size||0,lastModified:ve.lastModified||ve.lastModifiedDate,access:ve.access}}),pe=oe.data.total!==void 0?oe.data.total:ne.length,de=oe.data.size!==void 0?oe.data.size:ne.reduce((ve,Ie)=>ve+(Ie.size||0),0),he=oe.data.nextStartAfter!==void 0?oe.data.nextStartAfter:null,Ee=oe.data.hasMore!==void 0?oe.data.hasMore:!1;return{value:K.Success,error:null,result:{items:ne,total:pe,size:de,nextStartAfter:he,hasMore:Ee}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class hSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FILES,version:"1.0.0",description:"Cloud File System: Delete Files",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.DeleteFiles);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const h=Et(i,i.project,"deleteFiles"),T="["+ze(i,i.project,"Delete files")+": `"+h+"`] ",b=r.find(q=>{var W,z;return((z=(W=q.valueOwner)==null?void 0:W.declaration)==null?void 0:z.id)===U.operation[Ue.DeleteFiles].inputs.bucket.id}),A=(a=b==null?void 0:b.value)==null?void 0:a.valueAsType;if(!A||!A.id||!A.name||A.type!==d.DefinitionEntity)throw new Error(`${T}Invalid input "${ze(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Et(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=La(A==null?void 0:A.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(q=>q.resourceId===D))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const C=r.find(q=>{var W,z;return((z=(W=q.valueOwner)==null?void 0:W.declaration)==null?void 0:z.id)===U.operation[Ue.DeleteFiles].inputs.keys.id}),$=(e=C==null?void 0:C.value)==null?void 0:e.value,L=Array.isArray($)?$:typeof $=="string"&&$!==""?[$]:[];if(!L||L.length===0)throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"keys")}\`) input is missing.`);if(!Array.isArray(L)||L.some(q=>typeof q!="string"||q===""))throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Keys")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"keys")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const x=i.project.id,M=await qr.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{projectId:x,bucket:D,keys:L}});return{value:K.Success,error:null,result:M.data}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class mSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COPY_FILE,version:"1.0.0",description:"Cloud File System: Copy File",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.CopyFile);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m;try{const T=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const b=Et(i,i.project,"copyFile"),D="["+ze(i,i.project,"Copy file")+": `"+b+"`] ",I=r.find(pe=>{var de,he;return((he=(de=pe.valueOwner)==null?void 0:de.declaration)==null?void 0:he.id)===U.operation[Ue.CopyFile].inputs.bucket.id}),C=(a=I==null?void 0:I.value)==null?void 0:a.valueAsType;if(!C||!C.id||!C.name||C.type!==d.DefinitionEntity)throw new Error(`${D}Invalid input "${ze(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${Et(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const $=La(C==null?void 0:C.id,((c=T.branchHead)==null?void 0:c.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(pe=>pe.resourceId===$))throw new Error(`${D}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=r.find(pe=>{var de,he;return((he=(de=pe.valueOwner)==null?void 0:de.declaration)==null?void 0:he.id)===U.operation[Ue.CopyFile].inputs.sourceKey.id}),M=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!M||M==="")throw new Error(`${D}The "${ze(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Et(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof M!="string")throw new Error(`${D}The "${ze(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Et(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=r.find(pe=>{var de,he;return((he=(de=pe.valueOwner)==null?void 0:de.declaration)==null?void 0:he.id)===U.operation[Ue.CopyFile].inputs.destinationKey.id}),W=(f=q==null?void 0:q.value)==null?void 0:f.value;if(!W||W==="")throw new Error(`${D}The "${ze(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Et(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input is missing.`);if(typeof W!="string")throw new Error(`${D}The "${ze(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Et(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const z=r.find(pe=>{var de,he;return((he=(de=pe.valueOwner)==null?void 0:de.declaration)==null?void 0:he.id)===U.operation[Ue.CopyFile].inputs.destinationBucket.id}),H=(h=z==null?void 0:z.value)==null?void 0:h.valueAsType;if(H&&(!H.id||!H.name||H.type!==d.DefinitionEntity))throw new Error(`${D}Invalid input "${ze(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,"Destination Storage")}" (\`${Et(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const ie=H!=null&&H.id?La(H.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):$;if(!((T==null?void 0:T.liveResources)||[]).find(pe=>pe.resourceId===ie))throw new Error(`${D}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const J=i.project.id,te={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},ne=await qr.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/copy`,{projectId:J,bucket:$,destinationBucket:ie,sourceKey:M,destinationKey:W},te);return{value:K.Success,error:null,result:ne.data}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}}class TSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_MOVE_FILE,version:"1.0.0",description:"Cloud File System: Move File",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.MoveFile);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m;try{const T=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!T||!T.env)throw new Error("Editor context or environment missing");const b=Et(i,i.project,"moveFile"),D="["+ze(i,i.project,"Move file")+": `"+b+"`] ",I=r.find(pe=>{var de,he;return((he=(de=pe.valueOwner)==null?void 0:de.declaration)==null?void 0:he.id)===U.operation[Ue.MoveFile].inputs.bucket.id}),C=(a=I==null?void 0:I.value)==null?void 0:a.valueAsType;if(!C||!C.id||!C.name||C.type!==d.DefinitionEntity)throw new Error(`${D}Invalid input "${ze(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"Storage")}" (\`${Et(I==null?void 0:I.valueOwner,T==null?void 0:T.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const $=La(C==null?void 0:C.id,((c=T.branchHead)==null?void 0:c.identifier)||"main");if(!((T==null?void 0:T.liveResources)||[]).find(pe=>pe.resourceId===$))throw new Error(`${D}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const x=r.find(pe=>{var de,he;return((he=(de=pe.valueOwner)==null?void 0:de.declaration)==null?void 0:he.id)===U.operation[Ue.MoveFile].inputs.sourceKey.id}),M=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!M||M==="")throw new Error(`${D}The "${ze(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Et(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input is missing.`);if(typeof M!="string")throw new Error(`${D}The "${ze(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"Source key")}" (\`${Et(x==null?void 0:x.valueOwner,T==null?void 0:T.logic,"sourceKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=r.find(pe=>{var de,he;return((he=(de=pe.valueOwner)==null?void 0:de.declaration)==null?void 0:he.id)===U.operation[Ue.MoveFile].inputs.destinationKey.id}),W=(f=q==null?void 0:q.value)==null?void 0:f.value;if(!W||W==="")throw new Error(`${D}The "${ze(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Et(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input is missing.`);if(typeof W!="string")throw new Error(`${D}The "${ze(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"Destination key")}" (\`${Et(q==null?void 0:q.valueOwner,T==null?void 0:T.logic,"destinationKey")}\`) input value is invalid, if present, it must be a non-empty string.`);const z=r.find(pe=>{var de,he;return((he=(de=pe.valueOwner)==null?void 0:de.declaration)==null?void 0:he.id)===U.operation[Ue.MoveFile].inputs.destinationBucket.id}),H=(h=z==null?void 0:z.value)==null?void 0:h.valueAsType,ie=i.project.id;if(H&&(!H.id||!H.name||H.type!==d.DefinitionEntity))throw new Error(`${D}Invalid input "${ze(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,"Destination storage")}" (\`${Et(z==null?void 0:z.valueOwner,T==null?void 0:T.logic,"destinationBucket")}\`), expected a valid "Cloud file system" node.`);const oe=H!=null&&H.id?La(H.id,((m=T.branchHead)==null?void 0:m.identifier)||"main"):$;if(!((T==null?void 0:T.liveResources)||[]).find(pe=>pe.resourceId===oe))throw new Error(`${D}The destination "Cloud file system" is not live. Publish the project first, then try again to run the operation node.`);const te={headers:{Authorization:`Bearer ${await T.getAccessToken()}`}},ne=await qr.post(`${T.env.API_BASE_URL}/cloud-files-service/v1/files/move`,{projectId:ie,bucket:$,destinationBucket:oe,sourceKey:M,destinationKey:W},te);return{value:K.Success,error:null,result:ne.data}}catch(T){return{value:K.UnhandledError,error:T,result:null}}}})}}class vSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_RENAME_FILE,version:"1.0.0",description:"Cloud File System: Rename File",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.RenameFile);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f;try{const h=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!h||!h.env)throw new Error("Editor context or environment missing");const m=Et(i,i.project,"renameFile"),b="["+ze(i,i.project,"Rename file")+": `"+m+"`] ",A=r.find(oe=>{var J,te;return((te=(J=oe.valueOwner)==null?void 0:J.declaration)==null?void 0:te.id)===U.operation[Ue.RenameFile].inputs.bucket.id}),D=(a=A==null?void 0:A.value)==null?void 0:a.valueAsType;if(!D||!D.id||!D.name||D.type!==d.DefinitionEntity)throw new Error(`${b}Invalid input "${ze(A==null?void 0:A.valueOwner,h==null?void 0:h.logic,"Storage")}" (\`${Et(A==null?void 0:A.valueOwner,h==null?void 0:h.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=La(D==null?void 0:D.id,((c=h.branchHead)==null?void 0:c.identifier)||"main");if(!((h==null?void 0:h.liveResources)||[]).find(oe=>oe.resourceId===I))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const $=r.find(oe=>{var J,te;return((te=(J=oe.valueOwner)==null?void 0:J.declaration)==null?void 0:te.id)===U.operation[Ue.RenameFile].inputs.key.id}),L=(e=$==null?void 0:$.value)==null?void 0:e.value;if(!L||L==="")throw new Error(`${b}The "${ze($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"key")}\`) input is missing.`);if(typeof L!="string")throw new Error(`${b}The "${ze($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=r.find(oe=>{var J,te;return((te=(J=oe.valueOwner)==null?void 0:J.declaration)==null?void 0:te.id)===U.operation[Ue.RenameFile].inputs.newName.id}),M=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!M||M==="")throw new Error(`${b}The "${ze(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"New name")}" (\`${Et(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"newName")}\`) input is missing.`);if(typeof M!="string")throw new Error(`${b}The "${ze(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"New name")}" (\`${Et(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"newName")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=i.project.id,W=L.lastIndexOf("/"),H=`${W!==-1?L.substring(0,W+1):""}${M}`,ie={headers:{Authorization:`Bearer ${await h.getAccessToken()}`}};return await qr.post(`${h.env.API_BASE_URL}/cloud-files-service/v1/files/rename`,{projectId:q,bucket:I,sourceKey:L,destinationKey:H,newName:M},ie),{value:K.Success,error:null,result:{key:H,oldKey:L}}}catch(h){return{value:K.UnhandledError,error:h,result:null}}}})}}class ESe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_FILE_METADATA,version:"1.0.0",description:"Cloud File System: Get File Metadata",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.GetFileMetadata);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const h=Et(i,i.project,"getFileMetadata"),T="["+ze(i,i.project,"Get file metadata")+": `"+h+"`] ",b=r.find(M=>{var q,W;return((W=(q=M.valueOwner)==null?void 0:q.declaration)==null?void 0:W.id)===U.operation[Ue.GetFileMetadata].inputs.bucket.id}),A=(a=b==null?void 0:b.value)==null?void 0:a.valueAsType;if(!A||!A.id||!A.name||A.type!==d.DefinitionEntity)throw new Error(`${T}Invalid input "${ze(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Et(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=La(A==null?void 0:A.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(M=>M.resourceId===D))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const C=r.find(M=>{var q,W;return((W=(q=M.valueOwner)==null?void 0:q.declaration)==null?void 0:W.id)===U.operation[Ue.GetFileMetadata].inputs.key.id}),$=(e=C==null?void 0:C.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const L=i.project.id,x=await qr.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/metadata?projectId=${L}&bucket=${D}&key=${encodeURIComponent($)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:x.data}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class bSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CHECK_FILE_EXISTS,version:"1.0.0",description:"Cloud File System: Check File Exists",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.CheckFileExists);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const h=Et(i,i.project,"checkFileExists"),T="["+ze(i,i.project,"Check File Exists")+": `"+h+"`] ",b=r.find(M=>{var q,W;return((W=(q=M.valueOwner)==null?void 0:q.declaration)==null?void 0:W.id)===U.operation[Ue.CheckFileExists].inputs.bucket.id}),A=(a=b==null?void 0:b.value)==null?void 0:a.valueAsType;if(!A||!A.id||!A.name||A.type!==d.DefinitionEntity)throw new Error(`${T}Invalid input "${ze(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Et(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=La(A==null?void 0:A.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(M=>M.resourceId===D))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const C=r.find(M=>{var q,W;return((W=(q=M.valueOwner)==null?void 0:q.declaration)==null?void 0:W.id)===U.operation[Ue.CheckFileExists].inputs.key.id}),$=(e=C==null?void 0:C.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"key")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Key")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const L=i.project.id,x=await qr.get(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/exists?projectId=${L}&bucket=${D}&key=${encodeURIComponent($)}`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:x.data.exists}}catch(f){return{value:K.UnhandledError,error:f,result:!1}}}})}}class ASe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Pre-signed URL",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.GetPresignedUrl);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h;try{const m=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Et(i,i.project,"getPresignedUrl"),A="["+ze(i,i.project,"Get pre-signed URL")+": `"+T+"`] ",D=r.find(ne=>{var pe,de;return((de=(pe=ne.valueOwner)==null?void 0:pe.declaration)==null?void 0:de.id)===U.operation[Ue.GetPresignedUrl].inputs.bucket.id}),I=(a=D==null?void 0:D.value)==null?void 0:a.valueAsType;if(!I||!I.id||!I.name||I.type!==d.DefinitionEntity)throw new Error(`${A}Invalid input "${ze(D==null?void 0:D.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Et(D==null?void 0:D.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const C=La(I==null?void 0:I.id,((c=m.branchHead)==null?void 0:c.identifier)||"main");if(!((m==null?void 0:m.liveResources)||[]).find(ne=>ne.resourceId===C))throw new Error(`${A}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const L=r.find(ne=>{var pe,de;return((de=(pe=ne.valueOwner)==null?void 0:pe.declaration)==null?void 0:de.id)===U.operation[Ue.GetPresignedUrl].inputs.key.id}),x=(e=L==null?void 0:L.value)==null?void 0:e.value;if(!x||x==="")throw new Error(`${A}The "${ze(L==null?void 0:L.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Et(L==null?void 0:L.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${A}The "${ze(L==null?void 0:L.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Et(L==null?void 0:L.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const M=r.find(ne=>{var pe,de;return((de=(pe=ne.valueOwner)==null?void 0:pe.declaration)==null?void 0:de.id)===U.operation[Ue.GetPresignedUrl].inputs.action.id}),q=(f=M==null?void 0:M.value)==null?void 0:f.value,W=(q||"read").toLowerCase(),z=["read","write","delete","metadata","upload","putobject","head","headobject","getobject","get"];if(!q||q==="")throw new Error(`${A}The "${ze(M==null?void 0:M.valueOwner,m==null?void 0:m.logic,"Action")}" (\`${Et(M==null?void 0:M.valueOwner,m==null?void 0:m.logic,"action")}\`) input is missing.`);if(!z.includes(W))throw new Error(`${A}Invalid "${ze(M==null?void 0:M.valueOwner,m==null?void 0:m.logic,"Action")}" (\`${Et(M==null?void 0:M.valueOwner,m==null?void 0:m.logic,"action")}\`) input value, must be one of "read", "write", "delete" or "metadata".`);const H=r.find(ne=>{var pe,de;return((de=(pe=ne.valueOwner)==null?void 0:pe.declaration)==null?void 0:de.id)===U.operation[Ue.GetPresignedUrl].inputs.expiresInSeconds.id}),ie=(h=H==null?void 0:H.value)==null?void 0:h.value,oe=ie!=null?Number(ie):3600;if(isNaN(oe)||oe<=0)throw new Error(`${A}Invalid "${ze(H==null?void 0:H.valueOwner,m==null?void 0:m.logic,"Expires in seconds")}" (\`${Et(H==null?void 0:H.valueOwner,m==null?void 0:m.logic,"expiresInSeconds")}\`) input value, expected a positive number.`);const J=i.project.id,te=await qr.get(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/presigned-url?projectId=${J}&bucket=${C}&key=${encodeURIComponent(x)}&action=${W}&expiresInSeconds=${oe}`,{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:te.data}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class gSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_SET_FILE_ACCESS,version:"1.0.0",description:"Cloud File System: Set File Access",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.SetFileAccess);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f;try{const h=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!h||!h.env)throw new Error("Editor context or environment missing");const m=Et(i,i.project,"setFileAccess"),b="["+ze(i,i.project,"Set file access")+": `"+m+"`] ",A=r.find(W=>{var z,H;return((H=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:H.id)===U.operation[Ue.SetFileAccess].inputs.bucket.id}),D=(a=A==null?void 0:A.value)==null?void 0:a.valueAsType;if(!D||!D.id||!D.name||D.type!==d.DefinitionEntity)throw new Error(`${b}Invalid input "${ze(A==null?void 0:A.valueOwner,h==null?void 0:h.logic,"Storage")}" (\`${Et(A==null?void 0:A.valueOwner,h==null?void 0:h.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=La(D==null?void 0:D.id,((c=h.branchHead)==null?void 0:c.identifier)||"main");if(!((h==null?void 0:h.liveResources)||[]).find(W=>W.resourceId===I))throw new Error(`${b}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const $=r.find(W=>{var z,H;return((H=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:H.id)===U.operation[Ue.SetFileAccess].inputs.key.id}),L=(e=$==null?void 0:$.value)==null?void 0:e.value;if(!L||L==="")throw new Error(`${b}The "${ze($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"key")}\`) input is missing.`);if(typeof L!="string")throw new Error(`${b}The "${ze($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,h==null?void 0:h.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=r.find(W=>{var z,H;return((H=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:H.id)===U.operation[Ue.SetFileAccess].inputs.access.id}),M=((f=x==null?void 0:x.value)==null?void 0:f.value)??"private";if(!M||M==="")throw new Error(`${b}The "${ze(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"Access")}" (\`${Et(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"access")}\`) input is missing.`);if(typeof M!="string"||!["public","private"].includes(M))throw new Error(`${b}The "${ze(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"Access")}" (\`${Et(x==null?void 0:x.valueOwner,h==null?void 0:h.logic,"access")}\`) input value is invalid, if present, it must be exactly the "public" or "private" text values.`);const q=i.project.id;return await qr.post(`${h.env.API_BASE_URL}/cloud-files-service/v1/files/access`,{projectId:q,bucket:I,key:L,access:M},{headers:{Authorization:`Bearer ${await h.getAccessToken()}`}}),{value:K.Success,error:null,result:null}}catch(h){return{value:K.UnhandledError,error:h,result:null}}}})}}class ISe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_FOLDER,version:"1.0.0",description:"Cloud File System: Create Folder",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.CreateFolder);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const h=Et(i,i.project,"createFolder"),T="["+ze(i,i.project,"Create folder")+": `"+h+"`] ",b=r.find(M=>{var q,W;return((W=(q=M.valueOwner)==null?void 0:q.declaration)==null?void 0:W.id)===U.operation[Ue.CreateFolder].inputs.bucket.id}),A=(a=b==null?void 0:b.value)==null?void 0:a.valueAsType;if(!A||!A.id||!A.name||A.type!==d.DefinitionEntity)throw new Error(`${T}Invalid input "${ze(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Et(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=La(A==null?void 0:A.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(M=>M.resourceId===D))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const C=r.find(M=>{var q,W;return((W=(q=M.valueOwner)==null?void 0:q.declaration)==null?void 0:W.id)===U.operation[Ue.CreateFolder].inputs.folderPath.id}),$=(e=C==null?void 0:C.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Folder path")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"folderPath")}\`) input value is invalid, if present, it must be a non-empty string.`);const L=i.project.id,x=await qr.post(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{projectId:L,bucket:D,folderPath:$},{headers:{Authorization:`Bearer ${await f.getAccessToken()}`}});return{value:K.Success,error:null,result:x.data}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class RSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_DELETE_FOLDERS,version:"1.0.0",description:"Cloud File System: Delete Folders",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.DeleteFolders);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e;try{const f=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!f||!f.env)throw new Error("Editor context or environment missing");const h=Et(i,i.project,"deleteFolders"),T="["+ze(i,i.project,"Delete folders")+": `"+h+"`] ",b=r.find(q=>{var W,z;return((z=(W=q.valueOwner)==null?void 0:W.declaration)==null?void 0:z.id)===U.operation[Ue.DeleteFolders].inputs.bucket.id}),A=(a=b==null?void 0:b.value)==null?void 0:a.valueAsType;if(!A||!A.id||!A.name||A.type!==d.DefinitionEntity)throw new Error(`${T}Invalid input "${ze(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"Storage")}" (\`${Et(b==null?void 0:b.valueOwner,f==null?void 0:f.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const D=La(A==null?void 0:A.id,((c=f.branchHead)==null?void 0:c.identifier)||"main");if(!((f==null?void 0:f.liveResources)||[]).find(q=>q.resourceId===D))throw new Error(`${T}The provided storage is not live. Publish the project first, then try again to run the operation node.`);const C=r.find(q=>{var W,z;return((z=(W=q.valueOwner)==null?void 0:W.declaration)==null?void 0:z.id)===U.operation[Ue.DeleteFolders].inputs.folderPaths.id}),$=(e=C==null?void 0:C.value)==null?void 0:e.value,L=Array.isArray($)?$:typeof $=="string"&&$!==""?[$]:[];if(!L||L.length===0)throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input is missing.`);if(!Array.isArray(L)||L.some(q=>typeof q!="string"||q===""))throw new Error(`${T}The "${ze(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"Folder paths")}" (\`${Et(C==null?void 0:C.valueOwner,f==null?void 0:f.logic,"folderPaths")}\`) input value is invalid, if present, it must be a list of non-empty strings.`);const x=i.project.id,M=await qr.delete(`${f.env.API_BASE_URL}/cloud-files-service/v1/files/folders`,{headers:{Authorization:`Bearer ${await f.getAccessToken()}`},data:{projectId:x,bucket:D,folderPaths:L}});return{value:K.Success,error:null,result:M.data}}catch(f){return{value:K.UnhandledError,error:f,result:null}}}})}}class wSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_CREATE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Create Multipart Upload",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.CreateMultipartUpload);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h;try{const m=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Et(i,i.project,"createMultipartUpload"),A="["+ze(i,i.project,"Create multipart upload")+": `"+T+"`] ",D=r.find(z=>{var H,ie;return((ie=(H=z.valueOwner)==null?void 0:H.declaration)==null?void 0:ie.id)===U.operation[Ue.CreateMultipartUpload].inputs.bucket.id}),I=(a=D==null?void 0:D.value)==null?void 0:a.valueAsType;if(!I||!I.id||!I.name||I.type!==d.DefinitionEntity)throw new Error(`${A}Invalid input "${ze(D==null?void 0:D.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Et(D==null?void 0:D.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const C=La(I==null?void 0:I.id,((c=m.branchHead)==null?void 0:c.identifier)||"main"),$=r.find(z=>{var H,ie;return((ie=(H=z.valueOwner)==null?void 0:H.declaration)==null?void 0:ie.id)===U.operation[Ue.CreateMultipartUpload].inputs.key.id}),L=(e=$==null?void 0:$.value)==null?void 0:e.value;if(!L||L==="")throw new Error(`${A}The "${ze($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof L!="string")throw new Error(`${A}The "${ze($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=r.find(z=>{var H,ie;return((ie=(H=z.valueOwner)==null?void 0:H.declaration)==null?void 0:ie.id)===U.operation[Ue.CreateMultipartUpload].inputs.contentType.id}),M=((f=x==null?void 0:x.value)==null?void 0:f.value)||"application/octet-stream";if(!M||M==="")throw new Error(`${A}The "${ze(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${Et(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input is missing.`);if(typeof M!="string")throw new Error(`${A}The "${ze(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Content Type")}" (\`${Et(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"contentType")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=i.project.id,W=await qr.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart?projectId=${q}&bucket=${C}&key=${encodeURIComponent(L)}&contentType=${encodeURIComponent(M)}`,{},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}});return{value:K.Success,error:null,result:{uploadId:typeof W.data=="object"&&((h=W.data)!=null&&h.uploadId)?W.data.uploadId:W.data}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class DSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_GET_UPLOAD_PART_PRESIGNED_URL,version:"1.0.0",description:"Cloud File System: Get Upload Part Pre-signed URL",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.GetUploadPartPresignedUrl);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m,T;try{const b=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!b||!b.env)throw new Error("Editor context or environment missing");const A=Et(i,i.project,"getUploadPartPresignedUrl"),I="["+ze(i,i.project,"Get upload part pre-signed URL")+": `"+A+"`] ",C=r.find(J=>{var te,ne;return((ne=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:ne.id)===U.operation[Ue.GetUploadPartPresignedUrl].inputs.bucket.id}),$=(a=C==null?void 0:C.value)==null?void 0:a.valueAsType;if(!$||!$.id||!$.name||$.type!==d.DefinitionEntity)throw new Error(`${I}${I}Invalid input "${ze(C==null?void 0:C.valueOwner,b==null?void 0:b.logic,"Storage")}" (\`${Et(C==null?void 0:C.valueOwner,b==null?void 0:b.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const L=La($==null?void 0:$.id,((c=b.branchHead)==null?void 0:c.identifier)||"main"),x=r.find(J=>{var te,ne;return((ne=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:ne.id)===U.operation[Ue.GetUploadPartPresignedUrl].inputs.key.id}),M=(e=x==null?void 0:x.value)==null?void 0:e.value;if(!M||M==="")throw new Error(`${I}The "${ze(x==null?void 0:x.valueOwner,b==null?void 0:b.logic,"Key")}" (\`${Et(x==null?void 0:x.valueOwner,b==null?void 0:b.logic,"key")}\`) input is missing.`);if(typeof M!="string")throw new Error(`${I}The "${ze(x==null?void 0:x.valueOwner,b==null?void 0:b.logic,"Key")}" (\`${Et(x==null?void 0:x.valueOwner,b==null?void 0:b.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=r.find(J=>{var te,ne;return((ne=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:ne.id)===U.operation[Ue.GetUploadPartPresignedUrl].inputs.uploadId.id}),W=(f=q==null?void 0:q.value)==null?void 0:f.value;if(!W||W==="")throw new Error(`${I}The "${ze(q==null?void 0:q.valueOwner,b==null?void 0:b.logic,"Upload ID")}" (\`${Et(q==null?void 0:q.valueOwner,b==null?void 0:b.logic,"uploadId")}\`) input is missing.`);if(typeof W!="string")throw new Error(`${I}The "${ze(q==null?void 0:q.valueOwner,b==null?void 0:b.logic,"Upload ID")}" (\`${Et(q==null?void 0:q.valueOwner,b==null?void 0:b.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const z=r.find(J=>{var te,ne;return((ne=(te=J.valueOwner)==null?void 0:te.declaration)==null?void 0:ne.id)===U.operation[Ue.GetUploadPartPresignedUrl].inputs.partNumber.id}),H=Number((h=z==null?void 0:z.value)==null?void 0:h.value);if(isNaN(H)||H<=0)throw new Error(`${I}The "${ze(z==null?void 0:z.valueOwner,b==null?void 0:b.logic,"Part number")}" (\`${Et(z==null?void 0:z.valueOwner,b==null?void 0:b.logic,"partNumber")}\`) input is missing or invalid.`);const ie=i.project.id,oe=await qr.get(`${b.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${W}?projectId=${ie}&bucket=${L}&key=${encodeURIComponent(M)}&partNumber=${H}`,{headers:{Authorization:`Bearer ${await b.getAccessToken()}`}});return{value:K.Success,error:null,result:{uploadUrl:typeof oe.data=="object"&&((m=oe.data)!=null&&m.uploadUrl||(T=oe.data)!=null&&T.url)?oe.data.uploadUrl||oe.data.url:oe.data}}}catch(b){return{value:K.UnhandledError,error:b,result:null}}}})}}class CSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_COMPLETE_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Complete Multipart Upload",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.CompleteMultipartUpload);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h;try{const m=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!m||!m.env)throw new Error("Editor context or environment missing");const T=Et(i,i.project,"completeMultipartUpload"),A="["+ze(i,i.project,"Complete multipart upload")+": `"+T+"`] ",D=r.find(oe=>{var J,te;return((te=(J=oe.valueOwner)==null?void 0:J.declaration)==null?void 0:te.id)===U.operation[Ue.CompleteMultipartUpload].inputs.bucket.id}),I=(a=D==null?void 0:D.value)==null?void 0:a.valueAsType;if(!I||!I.id||!I.name||I.type!==d.DefinitionEntity)throw new Error(`${A}Invalid input "${ze(D==null?void 0:D.valueOwner,m==null?void 0:m.logic,"Storage")}" (\`${Et(D==null?void 0:D.valueOwner,m==null?void 0:m.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const C=La(I==null?void 0:I.id,((c=m.branchHead)==null?void 0:c.identifier)||"main"),$=r.find(oe=>{var J,te;return((te=(J=oe.valueOwner)==null?void 0:J.declaration)==null?void 0:te.id)===U.operation[Ue.CompleteMultipartUpload].inputs.key.id}),L=(e=$==null?void 0:$.value)==null?void 0:e.value;if(!L||L==="")throw new Error(`${A}The "${ze($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"key")}\`) input is missing.`);if(typeof L!="string")throw new Error(`${A}The "${ze($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"Key")}" (\`${Et($==null?void 0:$.valueOwner,m==null?void 0:m.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const x=r.find(oe=>{var J,te;return((te=(J=oe.valueOwner)==null?void 0:J.declaration)==null?void 0:te.id)===U.operation[Ue.CompleteMultipartUpload].inputs.uploadId.id}),M=(f=x==null?void 0:x.value)==null?void 0:f.value;if(!M||M==="")throw new Error(`${A}The "${ze(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Et(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input is missing.`);if(typeof M!="string")throw new Error(`${A}The "${ze(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"Upload ID")}" (\`${Et(x==null?void 0:x.valueOwner,m==null?void 0:m.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const q=r.find(oe=>{var J,te;return((te=(J=oe.valueOwner)==null?void 0:J.declaration)==null?void 0:te.id)===U.operation[Ue.CompleteMultipartUpload].inputs.parts.id}),W=(h=q==null?void 0:q.value)==null?void 0:h.value;if(!Array.isArray(W)||W.length===0)throw new Error(`${A}The "${ze(q==null?void 0:q.valueOwner,m==null?void 0:m.logic,"Parts")}" (\`${Et(q==null?void 0:q.valueOwner,m==null?void 0:m.logic,"parts")}\`) input is missing or empty.`);const z=i.project.id,ie=(await qr.post(`${m.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${M}/complete?projectId=${z}&bucket=${C}&key=${encodeURIComponent(L)}`,{parts:W},{headers:{Authorization:`Bearer ${await m.getAccessToken()}`}})).data||{};return{value:K.Success,error:null,result:{location:ie.location||ie.Location||L,key:ie.key||ie.Key||L,etag:ie.etag||ie.ETag||null}}}catch(m){return{value:K.UnhandledError,error:m,result:null}}}})}}class OSe extends xe{constructor(){super(...arguments);w(this,"manifest",{id:$e.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CLOUD_FILE_SYSTEM_ABORT_MULTIPART_UPLOAD,version:"1.0.0",description:"Cloud File System: Abort Multipart Upload",initPriority:Oe.High,permissions:[Ne.All],contexts:[ae.Logic]});w(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ue.AbortMultipartUpload);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f;try{const h=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0];if(!h||!h.env)throw new Error("Editor context or environment missing");const m=Et(i,i.project,"abortMultipartUpload"),b="["+ze(i,i.project,"Abort multipart upload")+": `"+m+"`] ",A=r.find(W=>{var z,H;return((H=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:H.id)===U.operation[Ue.AbortMultipartUpload].inputs.bucket.id}),D=(a=A==null?void 0:A.value)==null?void 0:a.valueAsType;if(!D||!D.id||!D.name||D.type!==d.DefinitionEntity)throw new Error(`${b}Invalid input "${ze(A==null?void 0:A.valueOwner,h==null?void 0:h.logic,"Storage")}" (\`${Et(A==null?void 0:A.valueOwner,h==null?void 0:h.logic,"bucket")}\`), expected a valid "Cloud file system" node.`);const I=La(D==null?void 0:D.id,((c=h.branchHead)==null?void 0:c.identifier)||"main"),C=r.find(W=>{var z,H;return((H=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:H.id)===U.operation[Ue.AbortMultipartUpload].inputs.key.id}),$=(e=C==null?void 0:C.value)==null?void 0:e.value;if(!$||$==="")throw new Error(`${b}The "${ze(C==null?void 0:C.valueOwner,h==null?void 0:h.logic,"Key")}" (\`${Et(C==null?void 0:C.valueOwner,h==null?void 0:h.logic,"key")}\`) input is missing.`);if(typeof $!="string")throw new Error(`${b}The "${ze(C==null?void 0:C.valueOwner,h==null?void 0:h.logic,"Key")}" (\`${Et(C==null?void 0:C.valueOwner,h==null?void 0:h.logic,"key")}\`) input value is invalid, if present, it must be a non-empty string.`);const L=r.find(W=>{var z,H;return((H=(z=W.valueOwner)==null?void 0:z.declaration)==null?void 0:H.id)===U.operation[Ue.AbortMultipartUpload].inputs.uploadId.id}),x=(f=L==null?void 0:L.value)==null?void 0:f.value;if(!x||x==="")throw new Error(`${b}The "${ze(L==null?void 0:L.valueOwner,h==null?void 0:h.logic,"Upload ID")}" (\`${Et(L==null?void 0:L.valueOwner,h==null?void 0:h.logic,"uploadId")}\`) input is missing.`);if(typeof x!="string")throw new Error(`${b}The "${ze(L==null?void 0:L.valueOwner,h==null?void 0:h.logic,"Upload ID")}" (\`${Et(L==null?void 0:L.valueOwner,h==null?void 0:h.logic,"uploadId")}\`) input value is invalid, if present, it must be a non-empty string.`);const M=i.project.id,q=await qr.delete(`${h.env.API_BASE_URL}/cloud-files-service/v1/files/multipart/${x}?projectId=${M}&bucket=${I}&key=${encodeURIComponent($)}`,{headers:{Authorization:`Bearer ${await h.getAccessToken()}`}});return{value:K.Success,error:null,result:q.data}}catch(h){return{value:K.UnhandledError,error:h,result:null}}}})}}class LN extends hD{constructor(u,i,r=i.projectId){super(u,ae.Editor),this._editor=i,this.id=r}get ready(){return this._editor.ready}get env(){return this._editor.env}get hasLoadedLogic(){return this._editor.hasLoadedLogic}get destroyed(){return this._editor.destroyed}get logicLoadingPromise(){return this._editor.logicLoadingPromise}get logic(){return this._editor.logic}get lastPublishedProjectState(){return this._editor.lastPublishedProjectState}get branchHead(){return this._editor.branchHead}get branchHeadPromise(){return this._editor.branchHeadPromise}get projectId(){return this._editor.projectId}get sessionId(){return this._editor.sessionId}get userAuthorId(){return this._editor.userAuthorId}get peerConnections(){return this._editor.peerConnections}get test(){return this._editor.test}get localTestValues(){return this._editor.localTestValues}get resolvedValues(){return this._editor.resolvedValues}get persistedExecutionResults(){return this._editor.persistedExecutionResults}get publication(){return this._editor.publication}get livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(u){this._editor.undoableStackValueIndex=u}get activeWorkspace(){return this._editor.activeWorkspace}get branches(){return this._editor.branches}get roles(){return this._editor.roles}get READ_ONLY(){return this._editor.READ_ONLY}get isViewingNonHead(){return this._editor.isViewingNonHead}get canEdit(){return this._editor.canEdit}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}getRefreshToken(){return this._editor.getRefreshToken()}removeValueByOwnerId(u){return this._editor.removeValueByOwnerId(u)}removeValue(u){return this._editor.removeValue(u)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(u,i){return this._editor.initTest(u,i)}removeTest(u){return this._editor.removeTest(u)}async copyEntities(u,i={}){return this._editor.copyEntities(u,i)}resolveInitialChildrenPositions(u,i,r){return this._editor.resolveInitialChildrenPositions(u,i,r)}publish(){return this._editor.publish()}loadGivenPublication(u){return this._editor.loadGivenPublication(u)}validateProjectState(u){return this._editor.validateProjectState(u)}requestActiveDynamicValue(u,i=!1){return this._editor.requestActiveDynamicValue(u,i)}getValueTypePreference(u){return this._editor.getValueTypePreference(u)}setValueTypePreference(u,i){return this._editor.setValueTypePreference(u,i)}implementFeature(u){return this._editor.implementFeature(u)}getProjectRoles(){return this._editor.getProjectRoles()}getLastPublishedVersionLogic(u){return this._editor.getLastPublishedVersionLogic(u)}initialLoads(u){return this._editor.initialLoads(u)}moveBranchHeadToVersion(u,i,r){return this._editor.moveBranchHeadToVersion(u,i,r)}loadInitialBranchHead(){return this._editor.loadInitialBranchHead()}}function wVi(s,u){return u instanceof LN?u:new LN(s,u)}class BN extends hD{constructor(u,i){super(u,ae.PublicationRun),this._publicationRun=i}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get envIdentifier(){return this._publicationRun.envIdentifier}get projectVersion(){return this._publicationRun.projectVersion}get projectBranchId(){return this._publicationRun.projectBranchId}get projectId(){return this._publicationRun.projectId}get triggeredBy(){return this._publicationRun.triggeredBy}get createdAt(){return this._publicationRun.createdAt}get updatedAt(){return this._publicationRun.updatedAt}get status(){return this._publicationRun.status}get steps(){return this._publicationRun.steps}get cleanupSteps(){return this._publicationRun.cleanupSteps}get editor(){return this._publicationRun.editor}get explicitResources(){return this._publicationRun.explicitResources}get implicitGlobalResources(){return this._publicationRun.implicitGlobalResources}get finalGlobalEvent(){return this._publicationRun.finalGlobalEvent}get finalStatus(){return this._publicationRun.finalStatus}}function DVi(s,u){return u instanceof BN?u:new BN(s,u)}function CVi(s){s.register(new J2e(s)),s.register(new Y2e(s)),s.register(new Z2e(s)),s.register(new W2e(s)),s.register(new z2e(s)),s.register(new H2e(s)),s.register(new N4e(s)),s.register(new x4e(s)),s.register(new V4e(s)),s.register(new L4e(s)),s.register(new $4e(s)),s.register(new B4e(s)),s.register(new gKe(s)),s.register(new IKe(s)),s.register(new RKe(s)),s.register(new wKe(s)),s.register(new DKe(s)),s.register(new CKe(s)),s.register(new OKe(s)),s.register(new _Ke(s)),s.register(new PKe(s)),s.register(new NKe(s)),s.register(new PFe(s)),s.register(new NFe(s)),s.register(new xFe(s)),s.register(new VFe(s)),s.register(new $Fe(s)),s.register(new LFe(s)),s.register(new BFe(s)),s.register(new MFe(s)),s.register(new GFe(s)),s.register(new kFe(s)),s.register(new UFe(s)),s.register(new FFe(s)),s.register(new jFe(s)),s.register(new KFe(s)),s.register(new SFe(s)),s.register(new qFe(s)),s.register(new ZFe(s)),s.register(new HFe(s)),s.register(new WFe(s)),s.register(new JFe(s)),s.register(new QFe(s)),s.register(new XFe(s)),s.register(new YUe(s)),s.register(new JUe(s)),s.register(new QUe(s)),s.register(new XUe(s)),s.register(new eFe(s)),s.register(new tFe(s)),s.register(new iFe(s)),s.register(new rFe(s)),s.register(new nFe(s)),s.register(new sFe(s)),s.register(new lFe(s)),s.register(new oFe(s)),s.register(new dFe(s)),s.register(new uFe(s)),s.register(new hUe(s)),s.register(new Uje(s)),s.register(new Gje(s)),s.register(new kje(s)),s.register(new yke(s)),s.register(new hke(s)),s.register(new mke(s)),s.register(new Tke(s)),s.register(new vke(s)),s.register(new Eke(s)),s.register(new bke(s)),s.register(new Ake(s)),s.register(new gke(s)),s.register(new Lke(s)),s.register(new cUe(s)),s.register(new fUe(s)),s.register(new yUe(s)),s.register(new Ike(s)),s.register(new Rke(s)),s.register(new wke(s)),s.register(new Dke(s)),s.register(new Cke(s)),s.register(new Oke(s)),s.register(new _ke(s)),s.register(new Pke(s)),s.register(new Nke(s)),s.register(new xke(s)),s.register(new Vke(s)),s.register(new $ke(s)),s.register(new Bke(s)),s.register(new Mke(s)),s.register(new Gke(s)),s.register(new kke(s)),s.register(new Uke(s)),s.register(new Fke(s)),s.register(new jke(s)),s.register(new Kke(s)),s.register(new Ske(s)),s.register(new qke(s)),s.register(new Zke(s)),s.register(new Hke(s)),s.register(new iUe(s)),s.register(new rUe(s)),s.register(new nUe(s)),s.register(new Wke(s)),s.register(new zke(s)),s.register(new Yke(s)),s.register(new Jke(s)),s.register(new Qke(s)),s.register(new Xke(s)),s.register(new eUe(s)),s.register(new tUe(s)),s.register(new Sje(s)),s.register(new qje(s)),s.register(new Zje(s)),s.register(new Hje(s)),s.register(new Fje(s)),s.register(new jje(s)),s.register(new Kje(s)),s.register(new Wje(s)),s.register(new Yje(s)),s.register(new Qje(s)),s.register(new zje(s)),s.register(new Jje(s)),s.register(new Xje(s)),s.register(new iKe(s)),s.register(new eKe(s)),s.register(new tKe(s)),s.register(new pFe(s)),s.register(new hFe(s)),s.register(new mFe(s)),s.register(new EFe(s)),s.register(new bFe(s)),s.register(new AFe(s)),s.register(new gFe(s)),s.register(new IFe(s)),s.register(new RFe(s)),s.register(new wFe(s)),s.register(new DFe(s)),s.register(new TFe(s)),s.register(new vFe(s)),s.register(new cSe(s)),s.register(new fSe(s)),s.register(new ySe(s)),s.register(new hSe(s)),s.register(new mSe(s)),s.register(new TSe(s)),s.register(new vSe(s)),s.register(new ESe(s)),s.register(new bSe(s)),s.register(new ASe(s)),s.register(new gSe(s)),s.register(new ISe(s)),s.register(new RSe(s)),s.register(new wSe(s)),s.register(new DSe(s)),s.register(new CSe(s)),s.register(new OSe(s)),s.register(new fFe(s)),s.register(new yFe(s)),s.register(new cFe(s)),s.register(new aFe(s)),s.register(new OFe(s)),s.register(new _Fe(s)),s.register(new CFe(s)),s.register(new G4e(s)),s.register(new oje(s)),s.register(new lje(s)),s.register(new dje(s)),s.register(new uje(s)),s.register(new F4e(s)),s.register(new j4e(s)),s.register(new W4e(s)),s.register(new Z4e(s)),s.register(new aje(s)),s.register(new X4e(s)),s.register(new tje(s)),s.register(new rje(s)),s.register(new ije(s)),s.register(new H4e(s)),s.register(new Y4e(s)),s.register(new J4e(s)),s.register(new z4e(s)),s.register(new M4e(s)),s.register(new K4e(s)),s.register(new eje(s)),s.register(new fje(s)),s.register(new _N(s)),s.register(new U4e(s)),s.register(new S4e(s)),s.register(new k4e(s)),s.register(new nje(s)),s.register(new q4e(s)),s.register(new Q4e(s)),s.register(new sje(s)),s.register(new cje(s)),s.register(new pje(s)),s.register(new yje(s)),s.register(new _N(s)),s.register(new mje(s)),s.register(new hje(s)),s.register(new Tje(s)),s.register(new y4e(s)),s.register(new h4e(s)),s.register(new m4e(s)),s.register(new t4e(s)),s.register(new YFe(s)),s.register(new a4e(s)),s.register(new d4e(s)),s.register(new zFe(s)),s.register(new u4e(s)),s.register(new f4e(s)),s.register(new l4e(s)),s.register(new s4e(s)),s.register(new TR(s)),s.register(new T4e(s)),s.register(new v4e(s)),s.register(new o4e(s)),s.register(new c4e(s)),s.register(new p4e(s)),s.register(new n4e(s)),s.register(new r4e(s)),s.register(new i4e(s)),s.register(new e4e(s)),s.register(new A4e(s)),s.register(new b4e(s)),s.register(new g4e(s)),s.register(new E4e(s)),s.register(new oUe(s)),s.register(new aUe(s)),s.register(new lUe(s)),s.register(new dUe(s)),s.register(new uUe(s)),s.register(new sUe(s)),s.register(new pUe(s)),s.register(new xKe(s)),s.register(new GKe(s)),s.register(new UKe(s)),s.register(new jKe(s)),s.register(new MKe(s)),s.register(new kKe(s)),s.register(new FKe(s)),s.register(new BKe(s)),s.register(new LKe(s)),s.register(new $Ke(s)),s.register(new VKe(s)),s.register(new HKe(s)),s.register(new WKe(s)),s.register(new qKe(s)),s.register(new ZKe(s)),s.register(new AKe(s)),s.register(new KKe(s)),s.register(new SKe(s)),s.register(new YKe(s)),s.register(new zKe(s)),s.register(new JKe(s)),s.register(new QKe(s)),s.register(new XKe(s)),s.register(new Q2e(s)),s.register(new X2e(s)),s.register(new hR(s)),s.register(new mR(s)),s.register(new iSe(s)),s.register(new rSe(s)),s.register(new sSe(s)),s.register(new pSe(s)),s.register(new oSe(s)),s.register(new nSe(s)),s.register(new aSe(s)),s.register(new dSe(s)),s.register(new lSe(s)),s.register(new uSe(s))}class bB{constructor(u=new re.Events("extensions-registry-fallback-events")){w(this,"extensionsRegistry",new Map);w(this,"initialized",new Set);w(this,"initializedContexts",new Set);w(this,"onResolveEditorContextCallback",()=>null);w(this,"onResolveProjectLogicContextCallback",()=>null);w(this,"onResolveEditorGUIContextCallback",()=>null);w(this,"onResolveGUIContextCallback",()=>null);w(this,"onResolveCompileContextCallback",()=>null);w(this,"onResolvePublicationRunContextCallback",()=>null);this.events=u,this.off=this.events.off.bind(this.events),this.on=this.events.on.bind(this.events),this.emit=this.events.emit.bind(this.events),this.emitAsync=this.events.emitAsync.bind(this.events),this.emitAsyncAll=this.events.emitAsyncAll.bind(this.events),this.emitAsyncAllSettled=this.events.emitAsyncAllSettled.bind(this.events),this.emitAsyncSequentially=this.events.emitAsyncSequentially.bind(this.events),this.emitAsyncSequentiallyAll=this.events.emitAsyncSequentiallyAll.bind(this.events),this.emitAsyncSequentiallyAllSettled=this.events.emitAsyncSequentiallyAllSettled.bind(this.events)}onResolveEditorContext(u){this.onResolveEditorContextCallback=u}onResolveProjectLogicContext(u){this.onResolveProjectLogicContextCallback=u}onResolveGUIContext(u){this.onResolveGUIContextCallback=u}onResolveEditorGUIContext(u){this.onResolveEditorGUIContextCallback=u}onResolveCompileContext(u){this.onResolveCompileContextCallback=u}onResolvePublicationRunContext(u){this.onResolvePublicationRunContextCallback=u}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((u,i)=>(u.manifest.initPriority||Oe.Normal)-(i.manifest.initPriority||Oe.Normal))}async setup(){CVi(this),re.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(u){switch(u){case ae.Editor:return this.onResolveEditorContextCallback();case ae.Logic:return this.onResolveProjectLogicContextCallback();case ae.EditorGUI:return this.onResolveEditorGUIContextCallback();case ae.Compile:return this.onResolveCompileContextCallback();case ae.PublicationRun:return this.onResolvePublicationRunContextCallback();case ae.GUI:return this.onResolveGUIContextCallback();case ae.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${u}`)}}requestContexts(u,i=[]){const r=[];i.length===0&&(i=u.manifest.contexts);for(const a of i){const c=this.requestContext(a);c&&r.push(c)}return r}requestExtension(u){const i=this.extensionsRegistry.get(u);if(i)return i;throw new Error(`Unknown extension: ${u}`)}register(u){this.extensionsRegistry.set(u.manifest.id,u)}async initAll(){var u,i;for(const r of this.extensionInOrder)if(r.module.init&&!this.initialized.has(r.manifest.id)){const a=r.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);a.length&&(await((i=(u=r.module).init)==null?void 0:i.call(u,a)),this.initialized.add(r.manifest.id))}else!r.module.init&&!this.initialized.has(r.manifest.id)&&this.initialized.add(r.manifest.id)}async initForReady(){re.Logger.log("Initializing extensions for ready contexts...");for(const u of this.extensionInOrder)if(u.module.init&&!this.initialized.has(u.manifest.id)){re.Logger.debug("Initializing "+u.manifest.id+" extension...");const i=this.requestContexts(u);u.manifest.contexts.every(a=>!!i.find(c=>c.contextType===a))?(await u.module.init(i),this.initialized.add(u.manifest.id)):re.Logger.warn(`Skipping initialization of ${u.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${u.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(a=>a.contextType).join(", ")}`)}else!u.module.init&&!this.initialized.has(u.manifest.id)?(re.Logger.log("Set "+u.manifest.id+" extension as initialized by default..."),this.initialized.add(u.manifest.id)):re.Logger.log(`Skipping initialization of ${u.manifest.id} extension, already initialized or no init method defined.`)}async destroyAll(){for(const u of[...this.extensionInOrder].reverse())u.module.destroy&&await u.module.destroy();this.events.destroy()}on(u,i){this.events.on(u,i)}emit(u,...i){this.events.emit(u,...i)}off(u,i){this.events.off(u,i)}emitAsync(u,...i){return this.events.emitAsync(u,...i)}emitAsyncAll(u,...i){return this.events.emitAsyncAll(u,...i)}emitAsyncAllSettled(u,...i){return this.events.emitAsyncAllSettled(u,...i)}emitAsyncSequentially(u,...i){return this.events.emitAsyncSequentially(u,...i)}emitAsyncSequentiallyAll(u,...i){return this.events.emitAsyncSequentiallyAll(u,...i)}emitAsyncSequentiallyAllSettled(u,...i){return this.events.emitAsyncSequentiallyAllSettled(u,...i)}async contextAvailable(u){if(this.initializedContexts.has(u)){re.Logger.warn(`Context ${u} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(u),u){case ae.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case ae.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}re.Logger.log(`Context ${u} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(u){return window.localStorage.getItem("dynamic-value-type-preference--"+u)||null}setValueTypePreference(u,i){window.localStorage.setItem("dynamic-value-type-preference--"+u,(i==null?void 0:i.toString())||""),this.emit(u,{})}}let kI=null;const AB={requestExtension:s=>(kI||(kI=new bB,kI.setup()),kI.requestExtension(s))};function Cc(s){return!(s instanceof Error)&&typeof s=="object"&&s!==null?s:s instanceof Error?{name:s.name,message:s.message,stack:s.stack,...s}:s}function eK(s){var u,i,r;if(s&&typeof s=="object"&&"value"in s){const a=s;return{single:((u=a.value)==null?void 0:u.valueAsTypeSingle)??((i=a.value)==null?void 0:i.value),list:((r=a.value)==null?void 0:r.valueAsTypeList)??null}}return{single:s,list:Array.isArray(s)?s:null}}const Oc={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};class MN extends Error{constructor(){super("Execution was stopped"),this.name="ExecutionStoppedError"}}var gB=(s=>(s.FinishedSuccess="finished-success",s.FinishedError="finished-error",s.Running="running",s.Paused="paused",s.Stopped="stopped",s.NotStarted="not-started",s))(gB||{});const _Se={...AB,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class $m extends re.Events{constructor(i,r,a,c=null,e=_Se){super();w(this,"project");w(this,"entryPoint");w(this,"state","not-started");w(this,"events",new re.Events("fe-exec-inst-events"));w(this,"entities",[]);w(this,"parentExecution",null);w(this,"executing",[]);w(this,"executed",[]);w(this,"skipped",[]);w(this,"scheduled",[]);w(this,"localTestValues");w(this,"resolvedValues");w(this,"persistedExecutionResults");w(this,"lastExecutionResults");w(this,"onAddToSkippedListCallback",null);w(this,"onRemoveFromSkippedListCallback",null);w(this,"onAddEntityCallback",null);w(this,"onRemoveEntityCallback",null);w(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=r,this.entryPoint=a,this.project=i,this.parentExecution=c,this.localTestValues=new yE(B.UUID.uuid(),this.project),this.resolvedValues=new yE(B.UUID.uuid(),this.project),this.persistedExecutionResults=new yE(B.UUID.uuid(),this.project),this.lastExecutionResults=new yE(B.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}get rootExecution(){let i=this;for(;i.parentExecution;)i=i.parentExecution;return i}get rootState(){return this.rootExecution.state}isStopped(){return this.state==="stopped"||this.rootExecution.state==="stopped"}isPaused(){return this.state==="paused"||this.rootExecution.state==="paused"}async checkStateAndPause(){if(this.isStopped())throw new MN;for(;this.isPaused();){if(this.isStopped())throw new MN;await new Promise(i=>setTimeout(i,100))}}skip(i){this.hasEntity(i)&&(this.removeFromScheduledList(i),!this.skipped.includes(i)&&(this.skipped.push(i),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(i),Dr.includes(i.type)&&Lt(i).forEach(r=>this.skip(r))))}async schedule(i,r,a){if(this.hasExecuted(i))return null;if(Ei.includes(i.type))return this.executeBranch(i,a,r);if(Cr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,a,r);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,r){const a=[];return vi.includes(r.type)?a.push(...r.inputs.filter(e=>Jy(e))):[...ni,...Ei].includes(r.type)?a.push(...r.inputs):ti.includes(r.type)&&a.push(...r.outputs.filter(e=>Jy(e))),a.map(e=>{var h;let f=i.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&Ei.includes(r.type)&&(f=i.find(m=>{var T;return((T=m.valueOwner.declaration)==null?void 0:T.id)===e.id})),f){const m=(h=f.value)==null?void 0:h.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return Mn.includes(e.type)?yd(e,this.valueResolutionContext):wp(e,this.valueResolutionContext)}).reduce((e,f)=>{const h=Ru(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return h.forEach(T=>{var D,I,C;if(T.id===(f==null?void 0:f.valueOwner.id))return;const b=Gi(T.getDataType(null),T,this.project);b==null||b.metaSync({value:(D=f==null?void 0:f.value)==null?void 0:D.value},null),b==null||b.setValueAsTypeList(((I=f==null?void 0:f.value)==null?void 0:I.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((C=f==null?void 0:f.value)==null?void 0:C.valueAsTypeSingle)||null);const A={...f,valueOwner:T,value:b};m.push(A)}),[...e,...m]},[]).sort((e,f)=>e.valueOwner.index-f.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,r,a,c={}){var f,h;this.logBeforeExecution("executeInternalCall",i,r);const e={...Oc,...c};try{let m={value:K.Success,error:null,result:null};if(r.sort((C,$)=>C.valueOwner.index-$.valueOwner.index),Object.values(In).includes(i.declaration.id)){const C=this.parentContext.requestExtension(Os+i.declaration.id).module.main;C?m=await C(i,r,this):re.Logger.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{const C=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);m={value:C.value,error:C.error,result:C.result}}let T=null;if(m.error&&i.error){re.Logger.warn("Raw error executing entity: ",m.error);const{single:C,list:$}=eK(m.error),L=Cc(C),x=(f=i.error)==null?void 0:f.getDataType(null),M=Gi(x||null,i.error,a);if(x!=null&&x.asType)$!==null?M==null||M.setValueAsTypeList($):M==null||M.setValueAsTypeSingle(C);else{const q=hn(L)?JSON.stringify(L,null,2):L;M==null||M.metaSync({value:q},null)}T={valueOwner:i.error,type:Se.ExecutionResult,inheritanceLink:null,value:M}}const b=i==null?void 0:i.getDataType(null),A=Gi(b,i,a),{single:D,list:I}=eK(m.result);return b!=null&&b.asType?I!==null?A==null||A.setValueAsTypeList(I):A==null||A.setValueAsTypeSingle(D):A==null||A.metaSync({value:D},null),{value:m.value,entity:i,error:T,result:{value:A||null,valueOwner:i,type:Se.ExecutionResult,inheritanceLink:null}}}catch(m){if(m&&(m.name==="ExecutionStoppedError"||m.message==="Execution was stopped"))throw m;re.Logger.warn("Internal call execution error: ",m);let T=null;if(i.error){const b=Cc(m),A=(h=i.error)==null?void 0:h.getDataType(null),D=Gi(A,i.error,a);if(A!=null&&A.asType)D==null||D.setValueAsTypeSingle(m);else{const I=hn(b)?JSON.stringify(b,null,2):b;D==null||D.metaSync({value:I},null)}T={valueOwner:i.error,type:Se.ExecutionResult,inheritanceLink:null,value:D}}return{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,entity:i,error:T,result:null}}}static async executeOperation(i,r,a,c){var e,f;c?c.logBeforeExecution("executeOperation",i,r):console.log(`executeOperation (${i.type}) -> [${ye(i,a)}] Inputs:${r.length?`
62
62
  `:""}${r.map(h=>{var m,T,b;return`${(m=h.valueOwner)==null?void 0:m.type} (${(T=h.valueOwner)==null?void 0:T.id}) "${ye(h.valueOwner,a)}": ${JSON.stringify((b=h.value)==null?void 0:b.value,null,2)}`}).join(`
63
63
  `)}
64
64
  `);try{let h={value:K.Success,error:null,result:null};r.sort((A,D)=>A.valueOwner.index-D.valueOwner.index),i.declaration.implementation&&(h=await i.declaration.implementation(i,r.sort((A,D)=>A.valueOwner.index-D.valueOwner.index)));let m=null;if(h.error&&i.error){const A=Cc(h.error),D=((e=i.error)==null?void 0:e.getDataType(null))||null,I=Gi(D,i.error,a);if(D!=null&&D.asType)I==null||I.setValueAsTypeSingle(h.error);else{const C=hn(A)?JSON.stringify(A,null,2):A;I==null||I.metaSync({value:C},null)}m={valueOwner:i.error,type:Se.ExecutionResult,inheritanceLink:null,value:I}}const T=i==null?void 0:i.getDataType(null),b=Gi(T,i,a);return T!=null&&T.asType?b==null||b.setValueAsTypeSingle(h.result):b==null||b.metaSync({value:h.result},null),{value:h.value,entity:i,error:m,result:{value:b||null,valueOwner:i,type:Se.ExecutionResult,inheritanceLink:null}}}catch(h){if(h&&(h.name==="ExecutionStoppedError"||h.message==="Execution was stopped"))throw h;console.warn("Operation execution error: ",h);let m=null;if(i.error){const T=Cc(h),b=(f=i.error)==null?void 0:f.getDataType(null),A=Gi(b,i.error,a);if(b!=null&&b.asType)A==null||A.setValueAsTypeSingle(h);else{const D=hn(T)?JSON.stringify(T,null,2):T;A==null||A.metaSync({value:D},null)}m={valueOwner:i.error,type:Se.ExecutionResult,inheritanceLink:null,value:A}}return{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,entity:i,error:m,result:null}}}async executeSearch(i,r,a){var c;this.logBeforeExecution("executeSearch",i,r);try{let e={value:K.Success,error:null,result:null};const f=await(await this.parentContext.requestExtension($e.SEARCH_NODE_IMPLEMENTATION)).module.main(i,r),h=i==null?void 0:i.getDataType(null),m=Gi(h,i,a);return m==null||m.metaSync({value:f},null),f.error?{value:K.UnhandledError,entity:i,error:{valueOwner:i,type:Se.ExecutionResult,inheritanceLink:null,value:m},result:null}:{value:e.value,entity:i,error:null,result:{value:m,valueOwner:i,type:Se.ExecutionResult,inheritanceLink:null}}}catch(e){if(e&&(e.name==="ExecutionStoppedError"||e.message==="Execution was stopped"))throw e;if(re.Logger.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,entity:i,error:null,result:null};const f=Cc(e),h=(c=i.error)==null?void 0:c.getDataType(null),m=Gi(h,i.error,a),T=hn(f)?JSON.stringify(f,null,2):f;return m==null||m.metaSync({value:T},null),{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,entity:i,error:{valueOwner:i.error,type:Se.ExecutionResult,inheritanceLink:null,value:m},result:null}}}async executeLoop(i,r,a,c={}){var f,h,m,T,b,A,D,I,C,$,L,x,M,q,W,z,H;this.logBeforeExecution("executeLoop",i,r);const e={...Oc,...c};try{let ie={value:K.Success,error:null,result:null};const oe=r.map(Ee=>{var ve,Ie;return((ve=Ee==null?void 0:Ee.value)==null?void 0:ve.valueAsType)||((Ie=Ee==null?void 0:Ee.value)==null?void 0:Ie.value)});let J={};const te=i.body.inputs.find(Ee=>Ee!==i.currentIterationNumberArgumentDeclaration&&Ee!==i.currentValueArgumentDeclaration);if(te){const Ee=te,ve=Gi(Ee.getDataType(null),Ee,a);ve==null||ve.metaSync({value:((f=Ee.defaultValue)==null?void 0:f.value)||null},null),J[Ee.id]={value:ve||null,valueOwner:Ee,type:Se.ExecutionResult,inheritanceLink:null}}let ne={value:K.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case U.loop["counted-loop"].id:{const Ee=oe[0];let ve=1;for(;ve<=Ee&&ve<=1e3;){await this.checkStateAndPause();const Ie=i.body.inputs.map(Ce=>{if(Ce===i.currentIterationNumberArgumentDeclaration){const Me=i.currentIterationNumberArgumentDeclaration.getDataType(null),ke=Ep(Me),we=this.lastExecutionResults.readValue(Ce.id);if(we){we.metaSync({value:ve},null);const ct=Hr(we,Ce);this.lastExecutionResults.writeValue(Ce,ct);const gt={value:ct,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Se.ExecutionResult,inheritanceLink:null};return J[Ce.id]=gt,gt}const Fe={id:B.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:B.UUID.uuid(),createdAt:new Date().toISOString(),author:B.sessionAuthor,deleted:!1,previousVersion:null,value:ve,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ke,standaloneParent:Ce.toReference()},Je=Fr(Fe,a);this.lastExecutionResults.writeValue(Ce,Je);const qe={value:Je,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Se.ExecutionResult,inheritanceLink:null};return J[Ce.id]=qe,qe}else return J[Ce.id]}).filter(Ce=>!!Ce);if(ne=await this.executeFullFunctionDeclarationLogic(i.body,Ie,e),ne!=null&&ne.result&&ne.value!==K.Return){const Ce=i.body.inputs.find(Me=>Me!==i.currentIterationNumberArgumentDeclaration&&Me!==i.currentValueArgumentDeclaration);if(Ce){let Me=(h=ne.result.value)==null?void 0:h.value;Me===void 0&&(Me=null),(m=J[Ce.id].value)==null||m.metaSync({value:Me},null);const ke=Hr(J[Ce.id].value,Ce);this.lastExecutionResults.writeValue(Ce,ke)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ne.value))break;ve++}break}case U.loop["manual-flow-loop"].id:{let Ee=1;for(;Ee<=50;){await this.checkStateAndPause();const ve=i.body.inputs.map(Ie=>{if(Ie===i.currentIterationNumberArgumentDeclaration){const Ce=this.lastExecutionResults.readValue(Ie.id);if(Ce){Ce.metaSync({value:Ee},null);const Fe=Hr(Ce,Ie);this.lastExecutionResults.writeValue(Ie,Fe);const Je={value:Fe,valueOwner:Ie,type:Se.ExecutionResult,inheritanceLink:null};return J[Ie.id]=Je,Je}const Me=i.currentIterationNumberArgumentDeclaration.getDataType(null),ke=Gi(Me,Ie,a);return ke==null||ke.metaSync({value:Ee},null),this.lastExecutionResults.writeValue(Ie,ke),{value:ke,valueOwner:Ie,type:Se.ExecutionResult,inheritanceLink:null}}else return J[Ie.id]}).filter(Ie=>!!Ie);if(ne=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),ne!=null&&ne.result&&ne.value!==K.Return){const Ie=i.body.inputs.find(Ce=>Ce!==i.currentIterationNumberArgumentDeclaration&&Ce!==i.currentValueArgumentDeclaration);if(Ie){let Ce=(T=ne.result.value)==null?void 0:T.value;Ce===void 0&&(Ce=null),(b=J[Ie.id].value)==null||b.metaSync({value:Ce},null);const Me=Hr(J[Ie.id].value,Ie);this.lastExecutionResults.writeValue(Ie,Me)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ne.value))break;Ee++}break}case U.loop["list-loop"].id:{const Ee=oe[0];let ve=1;const Ie=Ee;for(let Ce=0;Ce<Ie.length;Ce++){await this.checkStateAndPause();const Me=Ie[Ce],ke=i.body.inputs.map(we=>{if(we===i.currentIterationNumberArgumentDeclaration){const Fe=this.lastExecutionResults.readValue(we.id);if(Fe){Fe.metaSync({value:ve},null);const gt=Hr(Fe,we);return this.lastExecutionResults.writeValue(we,gt),{value:gt,valueOwner:we,type:Se.ExecutionResult,inheritanceLink:null}}const Je=i.currentIterationNumberArgumentDeclaration.getDataType(null),qe=Gi(Je,we,a);return qe==null||qe.metaSync({value:ve},null),this.lastExecutionResults.writeValue(we,qe),{value:qe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Se.ExecutionResult,inheritanceLink:null}}else if(we===i.currentValueArgumentDeclaration){const Fe=i.currentValueArgumentDeclaration.getDataType(null),Je=Ep(Fe),qe=this.lastExecutionResults.readValue(we.id);if(qe){qe.metaSync({value:Me},null);const st=Hr(qe,we);return this.lastExecutionResults.writeValue(we,st),{value:st,valueOwner:we,type:Se.ExecutionResult,inheritanceLink:null}}const ct={id:B.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:B.UUID.uuid(),createdAt:new Date().toISOString(),author:B.sessionAuthor,deleted:!1,previousVersion:null,value:Me,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Je,standaloneParent:we.toReference()},gt=Fr(ct,a);return this.lastExecutionResults.writeValue(we,gt),{value:gt,valueOwner:i.currentValueArgumentDeclaration,type:Se.ExecutionResult,inheritanceLink:null}}else return J[we.id]}).filter(we=>!!we);if(ne=await this.executeFullFunctionDeclarationLogic(i.body,ke,e),ne!=null&&ne.result&&ne.value!==K.Return){const we=i.body.inputs.find(Fe=>Fe!==i.currentIterationNumberArgumentDeclaration&&Fe!==i.currentValueArgumentDeclaration);if(we){let Fe=(A=ne.result.value)==null?void 0:A.value;Fe===void 0&&(Fe=null),(D=J[we.id].value)==null||D.metaSync({value:Fe},null);const Je=Hr(J[we.id].value,we);this.lastExecutionResults.writeValue(we,Je)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ne.value))break;ve++}break}case U.loop["object-keys-loop"].id:{const Ee=oe[0];let ve=1;const Ie=Ee?Object.keys(Ee):[];for(let Ce=0;Ce<Ie.length;Ce++){await this.checkStateAndPause();const Me=Ie[Ce],ke=i.body.inputs.map(we=>{if(we===i.currentIterationNumberArgumentDeclaration){const Fe=this.lastExecutionResults.readValue(we.id);if(Fe){Fe.metaSync({value:ve},null);const gt=Hr(Fe,we);return this.lastExecutionResults.writeValue(we,gt),{value:gt,valueOwner:we,type:Se.ExecutionResult,inheritanceLink:null}}const Je=i.currentIterationNumberArgumentDeclaration.getDataType(null),qe=Gi(Je,we,a);return qe==null||qe.metaSync({value:ve},null),this.lastExecutionResults.writeValue(we,qe),{value:qe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Se.ExecutionResult,inheritanceLink:null}}else if(we===i.currentValueArgumentDeclaration){const Fe=i.currentValueArgumentDeclaration.getDataType(null),Je=Ep(Fe),qe=this.lastExecutionResults.readValue(we.id);if(qe){qe.metaSync({value:Me},null);const st=Hr(qe,we);return this.lastExecutionResults.writeValue(we,st),{value:qe,valueOwner:we,type:Se.ExecutionResult,inheritanceLink:null}}const ct={id:B.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:B.UUID.uuid(),createdAt:new Date().toISOString(),author:B.sessionAuthor,deleted:!1,previousVersion:null,value:Me,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Je,standaloneParent:we.toReference()},gt=Fr(ct,a);return this.lastExecutionResults.writeValue(we,gt),{value:gt,valueOwner:i.currentValueArgumentDeclaration,type:Se.ExecutionResult,inheritanceLink:null}}else return J[we.id]}).filter(we=>!!we);if(ne=await this.executeFullFunctionDeclarationLogic(i.body,ke,e),ne!=null&&ne.result&&ne.value!==K.Return){const we=i.body.inputs.find(Fe=>Fe!==i.currentIterationNumberArgumentDeclaration&&Fe!==i.currentValueArgumentDeclaration);if(we){let Fe=(I=ne.result.value)==null?void 0:I.value;Fe===void 0&&(Fe=null),(C=J[we.id].value)==null||C.metaSync({value:Fe},null);const Je=Hr(J[we.id].value,we);this.lastExecutionResults.writeValue(we,Je)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ne.value))break;ve++}break}case U.loop["object-values-loop"].id:{const Ee=oe[0];let ve=1;const Ie=Ee?Object.values(Ee):[];for(let Ce=0;Ce<Ie.length;Ce++){await this.checkStateAndPause();const Me=Ie[Ce],ke=i.body.inputs.map(we=>{if(we===i.currentIterationNumberArgumentDeclaration){const Fe=this.lastExecutionResults.readValue(we.id);if(Fe){Fe.metaSync({value:ve},null);const gt=Hr(Fe,we);return this.lastExecutionResults.writeValue(we,gt),{value:gt,valueOwner:we,type:Se.ExecutionResult,inheritanceLink:null}}const Je=i.currentIterationNumberArgumentDeclaration.getDataType(null),qe=Gi(Je,we,a);return qe==null||qe.metaSync({value:ve},null),this.lastExecutionResults.writeValue(we,qe),{value:qe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Se.ExecutionResult,inheritanceLink:null}}else if(we===i.currentValueArgumentDeclaration){const Fe=i.currentValueArgumentDeclaration.getDataType(null),Je=Ep(Fe),qe=this.lastExecutionResults.readValue(we.id);if(qe){qe.metaSync({value:Me},null);const st=Hr(qe,we);return this.lastExecutionResults.writeValue(we,st),{value:qe,valueOwner:we,type:Se.ExecutionResult,inheritanceLink:null}}const ct={id:B.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:B.UUID.uuid(),createdAt:new Date().toISOString(),author:B.sessionAuthor,deleted:!1,previousVersion:null,value:Me,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Je,standaloneParent:we.toReference()},gt=Fr(ct,a);return this.lastExecutionResults.writeValue(we,gt),{value:gt,valueOwner:i.currentValueArgumentDeclaration,type:Se.ExecutionResult,inheritanceLink:null}}else return J[we.id]}).filter(we=>!!we);if(ne=await this.executeFullFunctionDeclarationLogic(i.body,ke,e),ne!=null&&ne.result&&ne.value!==K.Return){const we=i.body.inputs.find(Fe=>Fe!==i.currentIterationNumberArgumentDeclaration&&Fe!==i.currentValueArgumentDeclaration);if(we){let Fe=($=ne.result.value)==null?void 0:$.value;Fe===void 0&&(Fe=null),(L=J[we.id].value)==null||L.metaSync({value:Fe},null);const Je=Hr(J[we.id].value,we);this.lastExecutionResults.writeValue(we,Je)}}if([K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ne.value))break;ve++}break}case U.loop["string-loop"].id:{const Ee=oe[0];let ve=1;const Ie=Ee.split("");for(let Ce=0;Ce<Ie.length;Ce++){await this.checkStateAndPause();const Me=Ie[Ce],ke=i.body.inputs.map(we=>{if(we===i.currentIterationNumberArgumentDeclaration){const Fe=this.lastExecutionResults.readValue(we.id);if(Fe){Fe.metaSync({value:ve},null);const gt=Hr(Fe,we);return this.lastExecutionResults.writeValue(we,gt),{value:gt,valueOwner:we,type:Se.ExecutionResult,inheritanceLink:null}}const Je=i.currentIterationNumberArgumentDeclaration.getDataType(null),qe=Gi(Je,we,a);return qe==null||qe.metaSync({value:ve},null),this.lastExecutionResults.writeValue(we,qe),{value:qe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Se.ExecutionResult,inheritanceLink:null}}else if(we===i.currentValueArgumentDeclaration){const Fe=i.currentValueArgumentDeclaration.getDataType(null),Je=Ep(Fe),qe=this.lastExecutionResults.readValue(we.id);if(qe){qe.metaSync({value:Me},null);const st=Hr(qe,we);return this.lastExecutionResults.writeValue(we,st),{value:st,valueOwner:we,type:Se.ExecutionResult,inheritanceLink:null}}const ct={id:B.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:B.UUID.uuid(),createdAt:new Date().toISOString(),author:B.sessionAuthor,deleted:!1,previousVersion:null,value:Me,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Je,standaloneParent:we.toReference()},gt=Fr(ct,a);return this.lastExecutionResults.writeValue(we,gt),{value:gt,valueOwner:i.currentValueArgumentDeclaration,type:Se.ExecutionResult,inheritanceLink:null}}else return J[we.id]}).filter(we=>!!we);if(ne=await this.executeFullFunctionDeclarationLogic(i.body,ke,e),(ne.results||[]).forEach(we=>{var gt,dt,st;if(we.valueOwner.type!==d.InputMap||ti.includes(we.valueOwner.parent.type))return;const Fe=i.body.inputs.find(ut=>ye(ut,a)===ye(we.valueOwner,a)),qe=[...(gt=J[Fe.id].value)==null?void 0:gt.value,((dt=we.value)==null?void 0:dt.value)||null];(st=J[Fe.id].value)==null||st.metaSync({value:qe},null);const ct=Hr(J[Fe.id].value,Fe);this.lastExecutionResults.writeValue(Fe,ct)}),[K.CaughtError,K.UnhandledError,K.Break,K.Return].includes(ne.value))break;ve++}break}}let pe=K.Success;if(ne.value===K.UnhandledError?i.catchesError||i.errorCalls.length?pe=K.CaughtError:pe=K.UnhandledError:[K.CaughtError,K.Return].includes(ne.value)&&(pe=ne.value),ie={value:pe,error:((M=(x=ne.error)==null?void 0:x.value)==null?void 0:M.value)||null,result:((W=(q=ne==null?void 0:ne.result)==null?void 0:q.value)==null?void 0:W.value)||null},ie.value===K.UnhandledError||ie.value===K.CaughtError){let Ee=null;if(i.error){const ve=Cc(ie.error),Ie=(z=i.error)==null?void 0:z.getDataType(null),Ce=Gi(Ie||null,i.error,a);if(Ie!=null&&Ie.asType)Ce==null||Ce.setValueAsTypeSingle(ie.error);else{const Me=hn(ve)?JSON.stringify(ve,null,2):ve;Ce==null||Ce.metaSync({value:Me},null)}Ee={valueOwner:i.error,type:Se.ExecutionResult,inheritanceLink:null,value:Ce}}return{value:ie.value,entity:i,error:Ee,result:null}}const de=i==null?void 0:i.getDataType(null),he=Gi(de,i,a);return de!=null&&de.asType?he==null||he.setValueAsTypeSingle(ie.result):he==null||he.metaSync({value:ie.result},null),{value:ie.value,entity:i,error:null,result:{value:he||null,valueOwner:i,type:Se.ExecutionResult,inheritanceLink:null}}}catch(ie){if(ie&&(ie.name==="ExecutionStoppedError"||ie.message==="Execution was stopped"))throw ie;if(re.Logger.warn("Error executing loop: ",ie),i.error){const oe=Cc(ie),J=(H=i.error)==null?void 0:H.getDataType(null),te=Gi(J,i.error,a);if(J!=null&&J.asType)te==null||te.setValueAsTypeSingle(ie);else{const ne=hn(oe)?JSON.stringify(oe,null,2):oe;te==null||te.metaSync({value:ne},null)}return{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,entity:i,error:{valueOwner:i.error,type:Se.ExecutionResult,inheritanceLink:null,value:te},result:null}}else return{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,r,a,c={}){var f,h,m,T,b,A,D,I,C,$,L,x,M,q,W,z,H,ie,oe,J,te,ne,pe,de,he,Ee;const e={...Oc,...c};try{this.logBeforeExecution("executeFunctionCall",i,r);const ve=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);let Ie=null;if(ve.error&&i.error){re.Logger.warn("Raw error executing entity: ",ve.error);const we=(f=i.error)==null?void 0:f.getDataType(null),Fe=Gi(we||null,i.error,a);we!=null&&we.asType?(m=(h=ve.error)==null?void 0:h.value)!=null&&m.valueAsTypeSingle?Fe==null||Fe.setValueAsTypeSingle((b=(T=ve.error)==null?void 0:T.value)==null?void 0:b.valueAsTypeSingle):(D=(A=ve.error)==null?void 0:A.value)!=null&&D.valueAsTypeList&&Array.isArray((C=(I=ve.error)==null?void 0:I.value)==null?void 0:C.valueAsTypeList)&&(Fe==null||Fe.setValueAsTypeList((L=($=ve.error)==null?void 0:$.value)==null?void 0:L.valueAsTypeList)):Fe==null||Fe.metaSync({value:(M=(x=ve.error)==null?void 0:x.value)==null?void 0:M.value},null),Ie={valueOwner:i.error,type:Se.ExecutionResult,inheritanceLink:null,value:Fe}}let Ce=K.Success;ve.value===K.UnhandledError&&(i.catchesError||i.errorCalls.length?Ce=K.CaughtError:Ce=K.UnhandledError);const Me=i==null?void 0:i.getDataType(null),ke=Gi(Me,i,a);return Me!=null&&Me.asType?(W=(q=ve.result)==null?void 0:q.value)!=null&&W.valueAsTypeSingle?ke==null||ke.setValueAsTypeSingle((H=(z=ve.result)==null?void 0:z.value)==null?void 0:H.valueAsTypeSingle):(oe=(ie=ve.result)==null?void 0:ie.value)!=null&&oe.valueAsTypeList&&Array.isArray((te=(J=ve.result)==null?void 0:J.value)==null?void 0:te.valueAsTypeList)&&(ke==null||ke.setValueAsTypeList((pe=(ne=ve.result)==null?void 0:ne.value)==null?void 0:pe.valueAsTypeList)):ke==null||ke.metaSync({value:((he=(de=ve.result)==null?void 0:de.value)==null?void 0:he.value)||null},null),{value:Ce,entity:i,error:Ie,result:{value:ke||null,valueOwner:i,type:Se.ExecutionResult,inheritanceLink:null}}}catch(ve){if(ve&&(ve.name==="ExecutionStoppedError"||ve.message==="Execution was stopped"))throw ve;if(!i.error)return{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,entity:i,error:null,result:null};const Ie=Cc(ve),Ce=(Ee=i.error)==null?void 0:Ee.getDataType(null),Me=Gi(Ce,i.error,a);if(Ce!=null&&Ce.asType)Me==null||Me.setValueAsTypeSingle(ve);else{const ke=hn(Ie)?JSON.stringify(Ie,null,2):Ie;Me==null||Me.metaSync({value:ke},null)}return{value:i.catchesError||i.errorCalls.length?K.CaughtError:K.UnhandledError,entity:i,error:{valueOwner:i.error,type:Se.ExecutionResult,inheritanceLink:null,value:Me},result:null}}}async executeCondition(i,r){var c,e,f,h;this.logBeforeExecution("executeCondition",i,r);let a=!1;switch(i.declaration.id){case oa.BooleanIsTrue:{const m=(e=(c=r[0])==null?void 0:c.value)==null?void 0:e.value;if(typeof m!="boolean")throw new TypeError("BooleanIsTrue expects a boolean input.");a=m===!0;break}case oa.BooleanIsFalse:{const m=(h=(f=r[0])==null?void 0:f.value)==null?void 0:h.value;if(typeof m!="boolean")throw new TypeError("BooleanIsFalse expects a boolean input.");a=m===!1;break}case mn.And:{a=(await Promise.all(i.andChildrenGroup.map(async T=>{const b=this.mergeExernalValuesWithInternalInputs(r,T);return(await this.executeCondition(T,b)).value===K.Success}))).every(T=>T);break}case mn.Or:{a=(await Promise.all(i.orChildrenGroup.map(async T=>{const b=this.mergeExernalValuesWithInternalInputs(r,T);return(await this.executeCondition(T,b)).value===K.Success}))).some(T=>T);break}default:throw new Error(`Condition declaration ${i.declaration.name} does not have an implementation.`)}return{value:a?K.Success:K.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,r,a,c={}){this.logBeforeExecution("executeDetachedFullFunctionDeclarationLogic",i,r);const e={...Oc,...c,onBeforeEntityExecution:(m,T,b)=>{var A;return((A=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:A.call(c,m,T,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(m,T,b)=>{var A;return((A=c==null?void 0:c.onEntityExecuted)==null?void 0:A.call(c,m,T,{...b,detached:!0}))||Promise.resolve()}},f=new $m(a,[i,...MR(i)],i,this,this.parentContext);return f.inheritValuesFromContext(this),await f.execute(e,r)}async executeFullFunctionDeclarationLogic(i,r,a={}){this.logBeforeExecution("executeFullFunctionDeclarationLogic",i,r);const c={...Oc,...a},e=MR(i),f=[];e.forEach(T=>{if(T.type===d.VariableDeclaration||T.type===d.VariableInstance){const b=T;b.internalCalls&&f.push(...b.internalCalls)}}),e.push(...f),console.log(`[executeFullFunctionDeclarationLogic] Reseting children for: ${ye(i,this.project)}
package/dist/index.js CHANGED
@@ -139985,7 +139985,7 @@ class UDi extends Ve {
139985
139985
  const S = i.project.id;
139986
139986
  return await Zr.post(
139987
139987
  `${h.env.API_BASE_URL}/cloud-files-service/v1/files/access`,
139988
- { projectId: S, nucket: g, key: L, access: B },
139988
+ { projectId: S, bucket: g, key: L, access: B },
139989
139989
  {
139990
139990
  headers: {
139991
139991
  Authorization: `Bearer ${await h.getAccessToken()}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.7092",
3
+ "version": "0.0.7093",
4
4
  "author": "Sergio Herrero",
5
5
  "license": "UNLICENSED",
6
6
  "description": "An installable module which contains the type definitions and ephemeral state management for a projects' logic tree data structure",