@elyx-code/project-logic-tree 0.0.6579 → 0.0.6581

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.d.ts CHANGED
@@ -4872,15 +4872,14 @@ export declare class DefaultPublicationRunContext extends ExtensionContextBase<E
4872
4872
  get projectPublishedSemanticVersion(): string;
4873
4873
  get projectVersion(): string;
4874
4874
  get projectId(): string;
4875
- get cloudProvider(): CloudProviders;
4876
4875
  get triggeredBy(): string;
4877
4876
  get createdAt(): string;
4878
4877
  get updatedAt(): string;
4879
4878
  get status(): PublicationStatus;
4880
4879
  get steps(): IDeploymentStepDefinition<IInfrastructureResource>[];
4881
4880
  get editor(): IEditor;
4882
- get explicitResources(): Map<string, ExplicitInfrastructureResource>;
4883
- get implicitGlobalResources(): Map<InfrastructureResourceType.CompiledLocalCodebase | InfrastructureResourceType.CloudHostedCodebase, ImplicitGlobalInfrastructureResource | null>;
4881
+ get explicitResources(): Map<string, IRelationalDatabaseInfrastructureResource | IHttpApiInfrastructureResource | IServerlessFunctionInfrastructureResource | IHttpEndpointInfrastructureResource>;
4882
+ get implicitGlobalResources(): Map<InfrastructureResourceType.CompiledLocalCodebase | InfrastructureResourceType.CloudHostedCodebase, ICloudHostedCodebaseInfrastructureResource | ICompiledLocalCodebaseInfrastructureResource | null>;
4884
4883
  get finalGlobalEvent(): ProjectPublicationEventName | null;
4885
4884
  get finalStatus(): PublicationStatus.Success | PublicationStatus.Failed | null;
4886
4885
  }
@@ -15022,8 +15021,8 @@ export declare interface IPropertyTransfer extends IProperty_meta, IBaseVariable
15022
15021
  export declare interface IPublicationRun extends IPublication {
15023
15022
  steps: IDeploymentStepDefinition<IInfrastructureResource>[];
15024
15023
  editor: IEditor;
15025
- explicitResources: Map<string, ExplicitInfrastructureResource>;
15026
- implicitGlobalResources: Map<InfrastructureResourceType.CompiledLocalCodebase | InfrastructureResourceType.CloudHostedCodebase, ImplicitGlobalInfrastructureResource | null>;
15024
+ explicitResources: Map<string, IRelationalDatabaseInfrastructureResource | IHttpApiInfrastructureResource | IServerlessFunctionInfrastructureResource | IHttpEndpointInfrastructureResource>;
15025
+ implicitGlobalResources: Map<InfrastructureResourceType.CompiledLocalCodebase | InfrastructureResourceType.CloudHostedCodebase, ICloudHostedCodebaseInfrastructureResource | ICompiledLocalCodebaseInfrastructureResource | null>;
15027
15026
  finalGlobalEvent: ProjectPublicationEventName | null;
15028
15027
  finalStatus: PublicationStatus.Success | PublicationStatus.Failed | null;
15029
15028
  }
@@ -17977,7 +17976,6 @@ export declare class PublicationRun implements IPublicationRun, IPublicationRunC
17977
17976
  projectPublishedSemanticVersion: string;
17978
17977
  projectVersion: string;
17979
17978
  projectId: string;
17980
- cloudProvider: CloudProviders;
17981
17979
  triggeredBy: string;
17982
17980
  createdAt: string;
17983
17981
  updatedAt: string;
@@ -18017,10 +18015,10 @@ export declare class PublicationRun implements IPublicationRun, IPublicationRunC
18017
18015
  export declare class PublicationStep implements IDeploymentStepDefinition<ExplicitInfrastructureResource | ImplicitGlobalInfrastructureResource> {
18018
18016
  stepType: PublishingSequenceStep;
18019
18017
  id: string;
18020
- resourceType: InfrastructureResourceType;
18018
+ resourceType: InfrastructureResourceType | null;
18021
18019
  index: number;
18022
18020
  dependency: string[];
18023
- lastEvent: ProjectPublicationEventName | null;
18021
+ lastEvent?: ProjectPublicationEventName | null;
18024
18022
  lastEventTimestamp: string | null;
18025
18023
  status: PublicationStepStatus;
18026
18024
  publicationRun: PublicationRun;
package/dist/index.js CHANGED
@@ -72582,9 +72582,6 @@ class J$ extends t1 {
72582
72582
  get projectId() {
72583
72583
  return this._publicationRun.projectId;
72584
72584
  }
72585
- get cloudProvider() {
72586
- return this._publicationRun.cloudProvider;
72587
- }
72588
72585
  get triggeredBy() {
72589
72586
  return this._publicationRun.triggeredBy;
72590
72587
  }
@@ -77401,7 +77398,6 @@ class NBt {
77401
77398
  _(this, "projectPublishedSemanticVersion");
77402
77399
  _(this, "projectVersion");
77403
77400
  _(this, "projectId");
77404
- _(this, "cloudProvider");
77405
77401
  _(this, "triggeredBy");
77406
77402
  _(this, "createdAt");
77407
77403
  _(this, "updatedAt");
@@ -77414,7 +77410,7 @@ class NBt {
77414
77410
  _(this, "finalStatus", null);
77415
77411
  _(this, "contextType", De.PublicationRun);
77416
77412
  _(this, "extensionsRegistry");
77417
- this.id = u.id, this.projectAutoIncrementPublicationCount = u.projectAutoIncrementPublicationCount, this.projectPublishedSemanticVersion = u.projectPublishedSemanticVersion, this.projectVersion = u.projectVersion, this.projectId = u.projectId, this.cloudProvider = u.cloudProvider, this.triggeredBy = u.triggeredBy, this.createdAt = u.createdAt, this.updatedAt = u.updatedAt, this.status = u.status, this.editor = i, this.initRegistry();
77413
+ this.id = u.id, this.projectAutoIncrementPublicationCount = u.projectAutoIncrementPublicationCount, this.projectPublishedSemanticVersion = u.projectPublishedSemanticVersion, this.projectVersion = u.projectVersion, this.projectId = u.projectId, this.triggeredBy = u.triggeredBy, this.createdAt = u.createdAt, this.updatedAt = u.updatedAt, this.status = u.status, this.editor = i, this.initRegistry();
77418
77414
  }
77419
77415
  get off() {
77420
77416
  return this.extensionsRegistry.off;
@@ -69,7 +69,7 @@ If an entity is called by another, they must be in the same scope, which means t
69
69
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(u){return u instanceof this?u:new this(u)}static concat(u,...i){const a=new this(u);return i.forEach(l=>a.set(l)),a}static accessor(u){const a=(this[gq]=this[gq]={accessors:{}}).accessors,l=this.prototype;function c(e){const y=Sc(e);a[y]||(A_e(l,e),a[y]=!0)}return ge.isArray(u)?u.forEach(c):c(u),this}}Km.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ge.reduceDescriptors(Km.prototype,({value:d},u)=>{let i=u[0].toUpperCase()+u.slice(1);return{get:()=>d,set(a){this[i]=a}}}),ge.freezeMethods(Km);const Xs=Km;function gA(d,u){const i=this||RA,a=u||i,l=Xs.from(a.headers);let c=a.data;return ge.forEach(d,function(y){c=y.call(i,c,l.normalize(),u?u.status:void 0)}),l.normalize(),c}function _q(d){return!!(d&&d.__CANCEL__)}function qu(d,u,i){Ft.call(this,d??"canceled",Ft.ERR_CANCELED,u,i),this.name="CanceledError"}ge.inherits(qu,Ft,{__CANCEL__:!0});function Dq(d,u,i){const a=i.config.validateStatus;!i.status||!a||a(i.status)?d(i):u(new Ft("Request failed with status code "+i.status,[Ft.ERR_BAD_REQUEST,Ft.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function w_e(d){const u=/^([-+\w]{1,25})(:?\/\/|:)/.exec(d);return u&&u[1]||""}function R_e(d,u){d=d||10;const i=new Array(d),a=new Array(d);let l=0,c=0,e;return u=u!==void 0?u:1e3,function(v){const T=Date.now(),I=a[c];e||(e=T),i[l]=v,a[l]=T;let b=c,D=0;for(;b!==l;)D+=i[b++],b=b%d;if(l=(l+1)%d,l===c&&(c=(c+1)%d),T-e<u)return;const V=I&&T-I;return V?Math.round(D*1e3/V):void 0}}function C_e(d,u){let i=0,a=1e3/u,l,c;const e=(T,I=Date.now())=>{i=I,l=null,c&&(clearTimeout(c),c=null),d.apply(null,T)};return[(...T)=>{const I=Date.now(),b=I-i;b>=a?e(T,I):(l=T,c||(c=setTimeout(()=>{c=null,e(l)},a-b)))},()=>l&&e(l)]}const qm=(d,u,i=3)=>{let a=0;const l=R_e(50,250);return C_e(c=>{const e=c.loaded,y=c.lengthComputable?c.total:void 0,v=e-a,T=l(v),I=e<=y;a=e;const b={loaded:e,total:y,progress:y?e/y:void 0,bytes:v,rate:T||void 0,estimated:T&&y&&I?(y-e)/T:void 0,event:c,lengthComputable:y!=null,[u?"download":"upload"]:!0};d(b)},i)},Oq=(d,u)=>{const i=d!=null;return[a=>u[0]({lengthComputable:i,total:d,loaded:a}),u[1]]},Pq=d=>(...u)=>ge.asap(()=>d(...u)),g_e=fn.hasStandardBrowserEnv?((d,u)=>i=>(i=new URL(i,fn.origin),d.protocol===i.protocol&&d.host===i.host&&(u||d.port===i.port)))(new URL(fn.origin),fn.navigator&&/(msie|trident)/i.test(fn.navigator.userAgent)):()=>!0,__e=fn.hasStandardBrowserEnv?{write(d,u,i,a,l,c){const e=[d+"="+encodeURIComponent(u)];ge.isNumber(i)&&e.push("expires="+new Date(i).toGMTString()),ge.isString(a)&&e.push("path="+a),ge.isString(l)&&e.push("domain="+l),c===!0&&e.push("secure"),document.cookie=e.join("; ")},read(d){const u=document.cookie.match(new RegExp("(^|;\\s*)("+d+")=([^;]*)"));return u?decodeURIComponent(u[3]):null},remove(d){this.write(d,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function D_e(d){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(d)}function O_e(d,u){return u?d.replace(/\/?\/$/,"")+"/"+u.replace(/^\/+/,""):d}function $q(d,u,i){let a=!D_e(u);return d&&(a||i==!1)?O_e(d,u):u}const Nq=d=>d instanceof Xs?{...d}:d;function vd(d,u){u=u||{};const i={};function a(T,I,b,D){return ge.isPlainObject(T)&&ge.isPlainObject(I)?ge.merge.call({caseless:D},T,I):ge.isPlainObject(I)?ge.merge({},I):ge.isArray(I)?I.slice():I}function l(T,I,b,D){if(ge.isUndefined(I)){if(!ge.isUndefined(T))return a(void 0,T,b,D)}else return a(T,I,b,D)}function c(T,I){if(!ge.isUndefined(I))return a(void 0,I)}function e(T,I){if(ge.isUndefined(I)){if(!ge.isUndefined(T))return a(void 0,T)}else return a(void 0,I)}function y(T,I,b){if(b in u)return a(T,I);if(b in d)return a(void 0,T)}const v={url:c,method:c,data:c,baseURL:e,transformRequest:e,transformResponse:e,paramsSerializer:e,timeout:e,timeoutMessage:e,withCredentials:e,withXSRFToken:e,adapter:e,responseType:e,xsrfCookieName:e,xsrfHeaderName:e,onUploadProgress:e,onDownloadProgress:e,decompress:e,maxContentLength:e,maxBodyLength:e,beforeRedirect:e,transport:e,httpAgent:e,httpsAgent:e,cancelToken:e,socketPath:e,responseEncoding:e,validateStatus:y,headers:(T,I,b)=>l(Nq(T),Nq(I),b,!0)};return ge.forEach(Object.keys(Object.assign({},d,u)),function(I){const b=v[I]||l,D=b(d[I],u[I],I);ge.isUndefined(D)&&b!==y||(i[I]=D)}),i}const Vq=d=>{const u=vd({},d);let{data:i,withXSRFToken:a,xsrfHeaderName:l,xsrfCookieName:c,headers:e,auth:y}=u;u.headers=e=Xs.from(e),u.url=Aq($q(u.baseURL,u.url,u.allowAbsoluteUrls),d.params,d.paramsSerializer),y&&e.set("Authorization","Basic "+btoa((y.username||"")+":"+(y.password?unescape(encodeURIComponent(y.password)):"")));let v;if(ge.isFormData(i)){if(fn.hasStandardBrowserEnv||fn.hasStandardBrowserWebWorkerEnv)e.setContentType(void 0);else if((v=e.getContentType())!==!1){const[T,...I]=v?v.split(";").map(b=>b.trim()).filter(Boolean):[];e.setContentType([T||"multipart/form-data",...I].join("; "))}}if(fn.hasStandardBrowserEnv&&(a&&ge.isFunction(a)&&(a=a(u)),a||a!==!1&&g_e(u.url))){const T=l&&c&&__e.read(c);T&&e.set(l,T)}return u},P_e=typeof XMLHttpRequest<"u"&&function(d){return new Promise(function(i,a){const l=Vq(d);let c=l.data;const e=Xs.from(l.headers).normalize();let{responseType:y,onUploadProgress:v,onDownloadProgress:T}=l,I,b,D,V,M;function x(){V&&V(),M&&M(),l.cancelToken&&l.cancelToken.unsubscribe(I),l.signal&&l.signal.removeEventListener("abort",I)}let q=new XMLHttpRequest;q.open(l.method.toUpperCase(),l.url,!0),q.timeout=l.timeout;function Z(){if(!q)return;const z=Xs.from("getAllResponseHeaders"in q&&q.getAllResponseHeaders()),J={data:!y||y==="text"||y==="json"?q.responseText:q.response,status:q.status,statusText:q.statusText,headers:z,config:d,request:q};Dq(function(le){i(le),x()},function(le){a(le),x()},J),q=null}"onloadend"in q?q.onloadend=Z:q.onreadystatechange=function(){!q||q.readyState!==4||q.status===0&&!(q.responseURL&&q.responseURL.indexOf("file:")===0)||setTimeout(Z)},q.onabort=function(){q&&(a(new Ft("Request aborted",Ft.ECONNABORTED,d,q)),q=null)},q.onerror=function(){a(new Ft("Network Error",Ft.ERR_NETWORK,d,q)),q=null},q.ontimeout=function(){let ae=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded";const J=l.transitional||Rq;l.timeoutErrorMessage&&(ae=l.timeoutErrorMessage),a(new Ft(ae,J.clarifyTimeoutError?Ft.ETIMEDOUT:Ft.ECONNABORTED,d,q)),q=null},c===void 0&&e.setContentType(null),"setRequestHeader"in q&&ge.forEach(e.toJSON(),function(ae,J){q.setRequestHeader(J,ae)}),ge.isUndefined(l.withCredentials)||(q.withCredentials=!!l.withCredentials),y&&y!=="json"&&(q.responseType=l.responseType),T&&([D,M]=qm(T,!0),q.addEventListener("progress",D)),v&&q.upload&&([b,V]=qm(v),q.upload.addEventListener("progress",b),q.upload.addEventListener("loadend",V)),(l.cancelToken||l.signal)&&(I=z=>{q&&(a(!z||z.type?new qu(null,d,q):z),q.abort(),q=null)},l.cancelToken&&l.cancelToken.subscribe(I),l.signal&&(l.signal.aborted?I():l.signal.addEventListener("abort",I)));const W=w_e(l.url);if(W&&fn.protocols.indexOf(W)===-1){a(new Ft("Unsupported protocol "+W+":",Ft.ERR_BAD_REQUEST,d));return}q.send(c||null)})},$_e=(d,u)=>{const{length:i}=d=d?d.filter(Boolean):[];if(u||i){let a=new AbortController,l;const c=function(T){if(!l){l=!0,y();const I=T instanceof Error?T:this.reason;a.abort(I instanceof Ft?I:new qu(I instanceof Error?I.message:I))}};let e=u&&setTimeout(()=>{e=null,c(new Ft(`timeout ${u} of ms exceeded`,Ft.ETIMEDOUT))},u);const y=()=>{d&&(e&&clearTimeout(e),e=null,d.forEach(T=>{T.unsubscribe?T.unsubscribe(c):T.removeEventListener("abort",c)}),d=null)};d.forEach(T=>T.addEventListener("abort",c));const{signal:v}=a;return v.unsubscribe=()=>ge.asap(y),v}},N_e=function*(d,u){let i=d.byteLength;if(!u||i<u){yield d;return}let a=0,l;for(;a<i;)l=a+u,yield d.slice(a,l),a=l},V_e=async function*(d,u){for await(const i of L_e(d))yield*N_e(i,u)},L_e=async function*(d){if(d[Symbol.asyncIterator]){yield*d;return}const u=d.getReader();try{for(;;){const{done:i,value:a}=await u.read();if(i)break;yield a}}finally{await u.cancel()}},Lq=(d,u,i,a)=>{const l=V_e(d,u);let c=0,e,y=v=>{e||(e=!0,a&&a(v))};return new ReadableStream({async pull(v){try{const{done:T,value:I}=await l.next();if(T){y(),v.close();return}let b=I.byteLength;if(i){let D=c+=b;i(D)}v.enqueue(new Uint8Array(I))}catch(T){throw y(T),T}},cancel(v){return y(v),l.return()}},{highWaterMark:2})},Zm=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Bq=Zm&&typeof ReadableStream=="function",B_e=Zm&&(typeof TextEncoder=="function"?(d=>u=>d.encode(u))(new TextEncoder):async d=>new Uint8Array(await new Response(d).arrayBuffer())),Mq=(d,...u)=>{try{return!!d(...u)}catch{return!1}},M_e=Bq&&Mq(()=>{let d=!1;const u=new Request(fn.origin,{body:new ReadableStream,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!u}),xq=64*1024,_A=Bq&&Mq(()=>ge.isReadableStream(new Response("").body)),Wm={stream:_A&&(d=>d.body)};Zm&&(d=>{["text","arrayBuffer","blob","formData","stream"].forEach(u=>{!Wm[u]&&(Wm[u]=ge.isFunction(d[u])?i=>i[u]():(i,a)=>{throw new Ft(`Response type '${u}' is not supported`,Ft.ERR_NOT_SUPPORT,a)})})})(new Response);const x_e=async d=>{if(d==null)return 0;if(ge.isBlob(d))return d.size;if(ge.isSpecCompliantForm(d))return(await new Request(fn.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(ge.isArrayBufferView(d)||ge.isArrayBuffer(d))return d.byteLength;if(ge.isURLSearchParams(d)&&(d=d+""),ge.isString(d))return(await B_e(d)).byteLength},U_e=async(d,u)=>{const i=ge.toFiniteNumber(d.getContentLength());return i??x_e(u)},DA={http:n_e,xhr:P_e,fetch:Zm&&(async d=>{let{url:u,method:i,data:a,signal:l,cancelToken:c,timeout:e,onDownloadProgress:y,onUploadProgress:v,responseType:T,headers:I,withCredentials:b="same-origin",fetchOptions:D}=Vq(d);T=T?(T+"").toLowerCase():"text";let V=$_e([l,c&&c.toAbortSignal()],e),M;const x=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let q;try{if(v&&M_e&&i!=="get"&&i!=="head"&&(q=await U_e(I,a))!==0){let J=new Request(u,{method:"POST",body:a,duplex:"half"}),fe;if(ge.isFormData(a)&&(fe=J.headers.get("content-type"))&&I.setContentType(fe),J.body){const[le,ye]=Oq(q,qm(Pq(v)));a=Lq(J.body,xq,le,ye)}}ge.isString(b)||(b=b?"include":"omit");const Z="credentials"in Request.prototype;M=new Request(u,{...D,signal:V,method:i.toUpperCase(),headers:I.normalize().toJSON(),body:a,duplex:"half",credentials:Z?b:void 0});let W=await fetch(M);const z=_A&&(T==="stream"||T==="response");if(_A&&(y||z&&x)){const J={};["status","statusText","headers"].forEach(me=>{J[me]=W[me]});const fe=ge.toFiniteNumber(W.headers.get("content-length")),[le,ye]=y&&Oq(fe,qm(Pq(y),!0))||[];W=new Response(Lq(W.body,xq,le,()=>{ye&&ye(),x&&x()}),J)}T=T||"text";let ae=await Wm[ge.findKey(Wm,T)||"text"](W,d);return!z&&x&&x(),await new Promise((J,fe)=>{Dq(J,fe,{data:ae,headers:Xs.from(W.headers),status:W.status,statusText:W.statusText,config:d,request:M})})}catch(Z){throw x&&x(),Z&&Z.name==="TypeError"&&/Load failed|fetch/i.test(Z.message)?Object.assign(new Ft("Network Error",Ft.ERR_NETWORK,d,M),{cause:Z.cause||Z}):Ft.from(Z,Z&&Z.code,d,M)}})};ge.forEach(DA,(d,u)=>{if(d){try{Object.defineProperty(d,"name",{value:u})}catch{}Object.defineProperty(d,"adapterName",{value:u})}});const Uq=d=>`- ${d}`,j_e=d=>ge.isFunction(d)||d===null||d===!1,jq={getAdapter:d=>{d=ge.isArray(d)?d:[d];const{length:u}=d;let i,a;const l={};for(let c=0;c<u;c++){i=d[c];let e;if(a=i,!j_e(i)&&(a=DA[(e=String(i)).toLowerCase()],a===void 0))throw new Ft(`Unknown adapter '${e}'`);if(a)break;l[e||"#"+c]=a}if(!a){const c=Object.entries(l).map(([y,v])=>`adapter ${y} `+(v===!1?"is not supported by the environment":"is not available in the build"));let e=u?c.length>1?`since :
70
70
  `+c.map(Uq).join(`
71
71
  `):" "+Uq(c[0]):"as no adapter specified";throw new Ft("There is no suitable adapter to dispatch the request "+e,"ERR_NOT_SUPPORT")}return a},adapters:DA};function OA(d){if(d.cancelToken&&d.cancelToken.throwIfRequested(),d.signal&&d.signal.aborted)throw new qu(null,d)}function Gq(d){return OA(d),d.headers=Xs.from(d.headers),d.data=gA.call(d,d.transformRequest),["post","put","patch"].indexOf(d.method)!==-1&&d.headers.setContentType("application/x-www-form-urlencoded",!1),jq.getAdapter(d.adapter||RA.adapter)(d).then(function(a){return OA(d),a.data=gA.call(d,d.transformResponse,a),a.headers=Xs.from(a.headers),a},function(a){return _q(a)||(OA(d),a&&a.response&&(a.response.data=gA.call(d,d.transformResponse,a.response),a.response.headers=Xs.from(a.response.headers))),Promise.reject(a)})}const kq="1.9.0",Hm={};["object","boolean","number","function","string","symbol"].forEach((d,u)=>{Hm[d]=function(a){return typeof a===d||"a"+(u<1?"n ":" ")+d}});const Fq={};Hm.transitional=function(u,i,a){function l(c,e){return"[Axios v"+kq+"] Transitional option '"+c+"'"+e+(a?". "+a:"")}return(c,e,y)=>{if(u===!1)throw new Ft(l(e," has been removed"+(i?" in "+i:"")),Ft.ERR_DEPRECATED);return i&&!Fq[e]&&(Fq[e]=!0,console.warn(l(e," has been deprecated since v"+i+" and will be removed in the near future"))),u?u(c,e,y):!0}},Hm.spelling=function(u){return(i,a)=>(console.warn(`${a} is likely a misspelling of ${u}`),!0)};function G_e(d,u,i){if(typeof d!="object")throw new Ft("options must be an object",Ft.ERR_BAD_OPTION_VALUE);const a=Object.keys(d);let l=a.length;for(;l-- >0;){const c=a[l],e=u[c];if(e){const y=d[c],v=y===void 0||e(y,c,d);if(v!==!0)throw new Ft("option "+c+" must be "+v,Ft.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new Ft("Unknown option "+c,Ft.ERR_BAD_OPTION)}}const zm={assertOptions:G_e,validators:Hm},wa=zm.validators;class Jm{constructor(u){this.defaults=u||{},this.interceptors={request:new wq,response:new wq}}async request(u,i){try{return await this._request(u,i)}catch(a){if(a instanceof Error){let l={};Error.captureStackTrace?Error.captureStackTrace(l):l=new Error;const c=l.stack?l.stack.replace(/^.+\n/,""):"";try{a.stack?c&&!String(a.stack).endsWith(c.replace(/^.+\n.+\n/,""))&&(a.stack+=`
72
- `+c):a.stack=c}catch{}}throw a}}_request(u,i){typeof u=="string"?(i=i||{},i.url=u):i=u||{},i=vd(this.defaults,i);const{transitional:a,paramsSerializer:l,headers:c}=i;a!==void 0&&zm.assertOptions(a,{silentJSONParsing:wa.transitional(wa.boolean),forcedJSONParsing:wa.transitional(wa.boolean),clarifyTimeoutError:wa.transitional(wa.boolean)},!1),l!=null&&(ge.isFunction(l)?i.paramsSerializer={serialize:l}:zm.assertOptions(l,{encode:wa.function,serialize:wa.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),zm.assertOptions(i,{baseUrl:wa.spelling("baseURL"),withXsrfToken:wa.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=c&&ge.merge(c.common,c[i.method]);c&&ge.forEach(["delete","get","head","post","put","patch","common"],M=>{delete c[M]}),i.headers=Xs.concat(e,c);const y=[];let v=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(i)===!1||(v=v&&x.synchronous,y.unshift(x.fulfilled,x.rejected))});const T=[];this.interceptors.response.forEach(function(x){T.push(x.fulfilled,x.rejected)});let I,b=0,D;if(!v){const M=[Gq.bind(this),void 0];for(M.unshift.apply(M,y),M.push.apply(M,T),D=M.length,I=Promise.resolve(i);b<D;)I=I.then(M[b++],M[b++]);return I}D=y.length;let V=i;for(b=0;b<D;){const M=y[b++],x=y[b++];try{V=M(V)}catch(q){x.call(this,q);break}}try{I=Gq.call(this,V)}catch(M){return Promise.reject(M)}for(b=0,D=T.length;b<D;)I=I.then(T[b++],T[b++]);return I}getUri(u){u=vd(this.defaults,u);const i=$q(u.baseURL,u.url,u.allowAbsoluteUrls);return Aq(i,u.params,u.paramsSerializer)}}ge.forEach(["delete","get","head","options"],function(u){Jm.prototype[u]=function(i,a){return this.request(vd(a||{},{method:u,url:i,data:(a||{}).data}))}}),ge.forEach(["post","put","patch"],function(u){function i(a){return function(c,e,y){return this.request(vd(y||{},{method:u,headers:a?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}Jm.prototype[u]=i(),Jm.prototype[u+"Form"]=i(!0)});const Ym=Jm;class PA{constructor(u){if(typeof u!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(c){i=c});const a=this;this.promise.then(l=>{if(!a._listeners)return;let c=a._listeners.length;for(;c-- >0;)a._listeners[c](l);a._listeners=null}),this.promise.then=l=>{let c;const e=new Promise(y=>{a.subscribe(y),c=y}).then(l);return e.cancel=function(){a.unsubscribe(c)},e},u(function(c,e,y){a.reason||(a.reason=new qu(c,e,y),i(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(u){if(this.reason){u(this.reason);return}this._listeners?this._listeners.push(u):this._listeners=[u]}unsubscribe(u){if(!this._listeners)return;const i=this._listeners.indexOf(u);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const u=new AbortController,i=a=>{u.abort(a)};return this.subscribe(i),u.signal.unsubscribe=()=>this.unsubscribe(i),u.signal}static source(){let u;return{token:new PA(function(l){u=l}),cancel:u}}}const k_e=PA;function F_e(d){return function(i){return d.apply(null,i)}}function K_e(d){return ge.isObject(d)&&d.isAxiosError===!0}const $A={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries($A).forEach(([d,u])=>{$A[u]=d});const q_e=$A;function Kq(d){const u=new Ym(d),i=lq(Ym.prototype.request,u);return ge.extend(i,Ym.prototype,u,{allOwnKeys:!0}),ge.extend(i,u,null,{allOwnKeys:!0}),i.create=function(l){return Kq(vd(d,l))},i}const Br=Kq(RA);Br.Axios=Ym,Br.CanceledError=qu,Br.CancelToken=k_e,Br.isCancel=_q,Br.VERSION=kq,Br.toFormData=km,Br.AxiosError=Ft,Br.Cancel=Br.CanceledError,Br.all=function(u){return Promise.all(u)},Br.spread=F_e,Br.isAxiosError=K_e,Br.mergeConfig=vd,Br.AxiosHeaders=Xs,Br.formToJSON=d=>Cq(ge.isHTMLForm(d)?new FormData(d):d),Br.getAdapter=jq.getAdapter,Br.HttpStatusCode=q_e,Br.default=Br;const Z_e=Br;class qq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get($i.Addition);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const e=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)}).reduce((y,v)=>y+v,0);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Zq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get($i.Subtraction);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const e=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)}).reduce((y,v)=>y-v,0);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Wq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get($i.Multiplication);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const e=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)}).reduce((y,v)=>y*v,1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Hq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get($i.Division);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),[c,e]=l;if(e===0)throw new Error("Division by zero is not allowed");const y=c/e;return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class zq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get($i.Remainder);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),[c,e]=l;if(e===0)throw new Error("Division by zero is not allowed");const y=c%e;return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Jq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get($i.Exponentiation);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),[c,e]=l,y=Math.pow(c,e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Yq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateRandomInteger);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1],y=hge(c,e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Sq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateRandomFloat);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=iq();return{value:X.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Xq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateRandomHexadecimal);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0],e=rq(c);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Qq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateRandomBase62);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0],e=nq(c);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class e7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateRandomBase64);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0],e=vge(c);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class t7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateRandomAlphanumeric);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0],e=sq(c);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class i7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateIdentifier);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1],y=aq(c,e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class r7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateRandomUUIDv4);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=hd();return{value:X.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class n7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{Y.log("Initializing Random Generate Short Identifier Module");const a=i.find(l=>l.contextType===Oe.Logic);if(a){Y.log("Project state found, setting up operation");const l=a.get(Ze.GenerateShortIdentifier);l?(Y.log("Operation found, setting autoexecutable and implementation"),l.autoexecutable=!0,l.implementation=this.module.main):Y.warn("Operation generate-short-identifier not found in project state")}else Y.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,a)=>{try{const l=Tge();return{value:X.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class s7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateHexadecimalToken);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=Ege();return{value:X.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class a7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.Join);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],y=l.slice(1).join(c);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class l7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT,version:"1.0.0",description:"String split operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.Split);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1],y=c.split(e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class o7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST,version:"1.0.0",description:"String delete last operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.DeleteLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.slice(0,-1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class d7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST,version:"1.0.0",description:"String delete first operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.DeleteFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.slice(1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class u7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.Reverse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.split("").reverse().join("");return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class p7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.ToLowerCase);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.toLowerCase();return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class c7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.ToUpperCase);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.toUpperCase();return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class f7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.DeleteIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>=c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const y=c.slice(0,e)+c.slice(e+1);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class y7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.AddIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const v=c.slice(0,e)+y+c.slice(e);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class h7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST,version:"1.0.0",description:"String replace first operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.ReplaceFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const v=c.replace(e,y);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class m7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST,version:"1.0.0",description:"String replace last operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.ReplaceLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(I=>{var b,D;return((b=I.value)==null?void 0:b.valueAsType)||((D=I.value)==null?void 0:D.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const v=c.lastIndexOf(e);if(v===-1)return{value:X.Success,error:null,result:c};const T=c.slice(0,v)+c.slice(v).replace(e,y);return{value:X.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class v7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.ReplaceIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>=c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const v=c.slice(0,e)+y+c.slice(e+1);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class T7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_SINGLE_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.ReplaceSingleMatch);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const v=c.replace(e,y);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class E7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.ReplaceAllMatches);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const v=c.split(e).join(y);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class b7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.GetIndexItem);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const y=c.charAt(e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class I7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST,version:"1.0.0",description:"String get first operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.GetFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.charAt(0);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class A7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST,version:"1.0.0",description:"String get last operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.GetLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.charAt(c.length-1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class w7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.GetIndexOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const y=c.indexOf(e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class R7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.Append);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const y=c+e;return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class C7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.Prepend);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const y=e+c;return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class g7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.Join);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)});if(!l||l.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No input lists provided",result:null};if(!l.every(v=>Array.isArray(v)))return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"All inputs must be arrays",result:null};const c=l[0],y=l.slice(1).reduce((v,T)=>Array.isArray(T)?v.concat(T):v,c);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class _7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.Split);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const y=c.slice(0,e),v=c.slice(e);return{value:X.Success,error:null,result:[y,v]}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class D7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.Reverse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c.slice().reverse();return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class O7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST,version:"1.0.0",description:"List delete last operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.DeleteLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c.slice(0,-1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class P7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST,version:"1.0.0",description:"List delete first operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.DeleteFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c.slice(1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class $7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.AddIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const v=[...c.slice(0,e),y,...c.slice(e)];return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class N7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.ReplaceIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>=c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const v=[...c];return v[e]=y,{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class V7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST,version:"1.0.0",description:"List replace first operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.ReplaceFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(I=>{var b,D;return((b=I.value)==null?void 0:b.valueAsType)||((D=I.value)==null?void 0:D.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const v=c.indexOf(e);if(v===-1)return{value:X.Success,error:null,result:c};const T=[...c];return T[v]=y,{value:X.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class L7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST,version:"1.0.0",description:"List replace last operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.ReplaceLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(I=>{var b,D;return((b=I.value)==null?void 0:b.valueAsType)||((D=I.value)==null?void 0:D.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const v=c.lastIndexOf(e);if(v===-1)return{value:X.Success,error:null,result:c};const T=[...c];return T[v]=y,{value:X.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class B7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.GetIndexItem);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>=c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const y=c[e];return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class M7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.GetFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c[0];return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class x7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.GetLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c[c.length-1];return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class U7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.Append);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const y=[...c,e];return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class j7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.Prepend);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const y=[e,...c];return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class G7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_PARALLEL,version:"1.0.0",description:"Execution parallel operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ei.Parallel);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(b=>{var D,V;return((D=b.value)==null?void 0:D.valueAsType)||((V=b.value)==null?void 0:V.value)})[0];if(!c)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(c))return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const y=this.extensionsRegistry.requestContexts(this,[Oe.Editor])[0],T=c.map(b=>{const D=new so(y.logic,[b],b,null,this.extensionsRegistry);return D.inheritValuesFromContext(y),D}).map(b=>b.execute()),I=await Promise.all(T);return{value:X.Success,error:null,result:I}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class k7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SEQUENTIAL,version:"1.0.0",description:"Execution sequential operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ei.Sequential);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(c))return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const e=[];for(let y=0;y<c.length;y++){const v=c[y],I=this.extensionsRegistry.requestContexts(this,[Oe.Editor])[0],b=new so(I.logic,[v],v,null,this.extensionsRegistry);b.inheritValuesFromContext(I);const D=await b.execute();e.push(D)}return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class F7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ei.Wait);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(e=>{var y,v;return((y=e.value)==null?void 0:y.valueAsType)||((v=e.value)==null?void 0:v.value)})[0];return typeof c!="number"||c<0?{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Invalid wait time provided",result:null}:(await new Promise(e=>setTimeout(e,c)),{value:X.Success,error:null,result:null})}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class K7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(mr.Validate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)});Y.log("Inputs for entity validation: ",l);const e=Hb(l[1]).safeParse(l[0]);return e.success?{value:X.Success,error:null,result:{data:l[0]}}:{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:e.error.errors,result:null}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class q7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(pn.HttpRequest);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[3]||{},e={method:l[0],url:l[1],params:l[2],headers:c,data:l[4]};Y.log("Axios request config: ",e);const y=await Z_e(e);return{value:X.Success,error:null,result:{status:y.status,headers:y.headers,data:y.data}}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class NA extends Bm{constructor(u,i,a=i.projectId){super(u,Oe.Editor),this._editor=i,this.id=a}get ready(){return this._editor.ready}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 branch(){return this._editor.branch}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 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 PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}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(){return this._editor.removeTest()}async copyEntities(u){return this._editor.copyEntities(u)}resolveInitialChildrenPositions(u,i,a){return this._editor.resolveInitialChildrenPositions(u,i,a)}publish(){return this._editor.publish()}loadActivePublication(u){return this._editor.loadActivePublication(u)}requestActiveDynamicValue(u,i=!1){return this._editor.requestActiveDynamicValue(u,i)}}function W_e(d,u){return u instanceof NA?u:new NA(d,u)}class VA extends Bm{constructor(u,i){super(u,Oe.PublicationRun),this._publicationRun=i}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get projectVersion(){return this._publicationRun.projectVersion}get projectId(){return this._publicationRun.projectId}get cloudProvider(){return this._publicationRun.cloudProvider}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 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 H_e(d,u){return u instanceof VA?u:new VA(d,u)}function z_e(d){d.register(new tq(d)),d.register(new eq(d)),d.register(new YK(d)),d.register(new XK(d)),d.register(new QK(d)),d.register(new SK(d)),d.register(new qq(d)),d.register(new Zq(d)),d.register(new Wq(d)),d.register(new zq(d)),d.register(new Hq(d)),d.register(new Jq(d)),d.register(new Yq(d)),d.register(new Sq(d)),d.register(new Xq(d)),d.register(new Qq(d)),d.register(new e7(d)),d.register(new t7(d)),d.register(new i7(d)),d.register(new r7(d)),d.register(new n7(d)),d.register(new s7(d)),d.register(new a7(d)),d.register(new l7(d)),d.register(new o7(d)),d.register(new d7(d)),d.register(new u7(d)),d.register(new p7(d)),d.register(new c7(d)),d.register(new f7(d)),d.register(new y7(d)),d.register(new h7(d)),d.register(new m7(d)),d.register(new v7(d)),d.register(new T7(d)),d.register(new E7(d)),d.register(new b7(d)),d.register(new I7(d)),d.register(new A7(d)),d.register(new w7(d)),d.register(new R7(d)),d.register(new C7(d)),d.register(new g7(d)),d.register(new _7(d)),d.register(new D7(d)),d.register(new O7(d)),d.register(new P7(d)),d.register(new $7(d)),d.register(new N7(d)),d.register(new V7(d)),d.register(new L7(d)),d.register(new B7(d)),d.register(new M7(d)),d.register(new x7(d)),d.register(new U7(d)),d.register(new j7(d)),d.register(new G7(d)),d.register(new k7(d)),d.register(new F7(d)),d.register(new K7(d)),d.register(new q7(d))}class LA{constructor(u=new Gu){_(this,"extensionsRegistry",new Map);_(this,"initialized",new Set);_(this,"initializedContexts",new Set);_(this,"onResolveEditorContextCallback",()=>null);_(this,"onResolveProjectLogicContextCallback",()=>null);_(this,"onResolveEditorGUIContextCallback",()=>null);_(this,"onResolveCompileContextCallback",()=>null);_(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.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||rt.Normal)-(i.manifest.initPriority||rt.Normal))}async setup(){z_e(this),Y.log("Initializing extensions without context..."),this.initForReady()}requestContext(u){switch(u){case Oe.Editor:return this.onResolveEditorContextCallback();case Oe.Logic:return this.onResolveProjectLogicContextCallback();case Oe.EditorGUI:return this.onResolveEditorGUIContextCallback();case Oe.Compile:return this.onResolveCompileContextCallback();case Oe.PublicationRun:return this.onResolvePublicationRunContextCallback();default:throw new Error(`Unknown context type: ${u}`)}}requestContexts(u,i=[]){const a=[];i.length===0&&(i=u.manifest.contexts);for(const l of i){const c=this.requestContext(l);c&&a.push(c)}return a}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 a of this.extensionInOrder)if(a.module.init&&!this.initialized.has(a.manifest.id)){const l=a.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);l.length&&(await((i=(u=a.module).init)==null?void 0:i.call(u,l)),this.initialized.add(a.manifest.id))}else!a.module.init&&!this.initialized.has(a.manifest.id)&&this.initialized.add(a.manifest.id)}async initForReady(){Y.log("Initializing extensions for ready contexts...");for(const u of this.extensionInOrder)if(u.module.init&&!this.initialized.has(u.manifest.id)){Y.log("Initializing "+u.manifest.id+" extension...");const i=this.requestContexts(u);u.manifest.contexts.every(l=>!!i.find(c=>c.contextType===l))?(await u.module.init(i),this.initialized.add(u.manifest.id)):Y.warn(`Skipping initialization of ${u.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${u.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(l=>l.contextType).join(", ")}`)}else!u.module.init&&!this.initialized.has(u.manifest.id)?(Y.log("Set "+u.manifest.id+" extension as initialized by default..."),this.initialized.add(u.manifest.id)):Y.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)){Y.warn(`Context ${u} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(u),u){case Oe.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case Oe.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}Y.log(`Context ${u} is now available. Initializing extensions for this context...`),await this.initForReady()}}let Sm=null;const BA={requestExtension:d=>(Sm||(Sm=new LA,Sm.setup()),Sm.requestExtension(d))},no={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var MA=(d=>(d.FinishedSuccess="finished-success",d.FinishedError="finished-error",d.Running="running",d.Paused="paused",d.Stopped="stopped",d.NotStarted="not-started",d))(MA||{});const Z7={...BA};class so extends Gu{constructor(i,a,l,c=null,e=Z7){super();_(this,"project");_(this,"entryPoint");_(this,"state","not-started");_(this,"events",new Gu);_(this,"entities",[]);_(this,"parentExecution",null);_(this,"executing",[]);_(this,"executed",[]);_(this,"skipped",[]);_(this,"scheduled",[]);_(this,"localTestValues");_(this,"resolvedValues");_(this,"persistedExecutionResults");_(this,"lastExecutionResults");_(this,"onAddToSkippedListCallback",null);_(this,"onRemoveFromSkippedListCallback",null);_(this,"onAddEntityCallback",null);_(this,"onRemoveEntityCallback",null);_(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=a,this.entryPoint=l,this.project=i,this.parentExecution=c,this.localTestValues=new kc(L.UUID.uuid(),this.project),this.resolvedValues=new kc(L.UUID.uuid(),this.project),this.persistedExecutionResults=new kc(L.UUID.uuid(),this.project),this.lastExecutionResults=new kc(L.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults}}skip(i){this.hasEntity(i)&&(this.removeFromScheduledList(i),!this.skipped.includes(i)&&(this.skipped.push(i),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(i),Gr.includes(i.type)&&ht(i).forEach(a=>this.skip(a))))}async schedule(i,a,l){if(this.hasExecuted(i))return null;if(Gt.includes(i.type))return this.executeBranch(i,l,a);if(tn.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,l,a);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,a){const l=[];return[...mi,...Gt].includes(a.type)?l.push(...a.inputs):xt.includes(a.type)&&l.push(...a.outputs),l.map(e=>{var v;let y=i.find(T=>T.valueOwner.id===e.id);if(y)return y;if(!y&&Gt.includes(a.type)&&(y=i.find(T=>{var I;return((I=T.valueOwner.declaration)==null?void 0:I.id)===e.id})),y){const T=(v=y.value)==null?void 0:v.clone(null);return T==null||T.setStandaloneParent(e),{...y,valueOwner:e,value:T||null,inheritanceLink:{sources:[y],target:e}}}return Xn.includes(e.type)?Aa(e,this.valueResolutionContext):cd(e,this.valueResolutionContext)}).reduce((e,y)=>{const v=Ys(y==null?void 0:y.valueOwner,this.project),T=y?[y]:[];return v.forEach(I=>{var V,M,x;if(I.id===(y==null?void 0:y.valueOwner.id))return;const b=it(I.getDataType(null),I,this.project);b==null||b.metaSync({value:(V=y==null?void 0:y.value)==null?void 0:V.value},null),b==null||b.setValueAsTypeList(((M=y==null?void 0:y.value)==null?void 0:M.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((x=y==null?void 0:y.value)==null?void 0:x.valueAsTypeSingle)||null);const D={...y,valueOwner:I,value:b};T.push(D)}),[...e,...T]},[]).sort((e,y)=>e.valueOwner.index-y.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,a,l,c={}){var y,v;const e={...no,...c};try{let T={value:X.Success,error:null,result:null};if(a.sort((I,b)=>I.valueOwner.index-b.valueOwner.index),Object.values(dr).includes(i.declaration.id)){const I=this.parentContext.requestExtension(ku+i.declaration.id).module.main;I?T=await I(i,a):Y.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{T=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,a,l,e);let I=null;if(T.error){Y.warn("Raw error executing entity: ",T.error);const b=(y=i.error)==null?void 0:y.getDataType(null),D=it(b||null,i.error,l);b!=null&&b.asType?D==null||D.setValueAsTypeSingle(T.error):D==null||D.metaSync({value:T.error},null),I={valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:D}}return{value:T.value,entity:i,error:I,result:{value:T.result||null,valueOwner:i,type:Ce.ExecutionResult,inheritanceLink:null}}}return{...T,entity:i}}catch(T){Y.warn("Internal call execution error: ",T);let I=null;if(i.error){const b=(v=i.error)==null?void 0:v.getDataType(null),D=it(b,i.error,l);b!=null&&b.asType?D==null||D.setValueAsTypeSingle(T):D==null||D.metaSync({value:T},null),I={valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:D}}return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:I,result:null}}}static async executeOperation(i,a,l){var c,e;try{let y={value:X.Success,error:null,result:null};a.sort((b,D)=>b.valueOwner.index-D.valueOwner.index),i.declaration.implementation&&(y=await i.declaration.implementation(i,a));let v=null;if(y.error&&i.error){Y.warn("Raw error executing entity: ",y.error);const b=((c=i.error)==null?void 0:c.getDataType(null))||null,D=it(b,i.error,l);b!=null&&b.asType?D==null||D.setValueAsTypeSingle(y.error):D==null||D.metaSync({value:y.error},null),v={valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:D}}const T=i==null?void 0:i.getDataType(null),I=it(T,i,l);return T!=null&&T.asType?I==null||I.setValueAsTypeSingle(y.result):I==null||I.metaSync({value:y.result},null),{value:y.value,entity:i,error:v,result:{value:I||null,valueOwner:i,type:Ce.ExecutionResult,inheritanceLink:null}}}catch(y){Y.warn("Operation execution error: ",y);let v=null;if(i.error){const T=(e=i.error)==null?void 0:e.getDataType(null),I=it(T,i.error,l);T!=null&&T.asType?I==null||I.setValueAsTypeSingle(y):I==null||I.metaSync({value:y},null),v={valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:I}}return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:v,result:null}}}async executeSearch(i,a,l){var c;try{let e={value:X.Success,error:null,result:null};const y=await(await this.parentContext.requestExtension(ot.SEARCH_NODE_IMPLEMENTATION)).module.main(i,a),v=i==null?void 0:i.getDataType(null),T=it(v,i,l);return T==null||T.metaSync({value:{data:y.data}},null),y.error?{value:X.UnhandledError,entity:i,error:{valueOwner:i,type:Ce.ExecutionResult,inheritanceLink:null,value:T},result:null}:{value:e.value,entity:i,error:null,result:{value:T,valueOwner:i,type:Ce.ExecutionResult,inheritanceLink:null}}}catch(e){if(Y.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:null,result:null};const y=(c=i.error)==null?void 0:c.getDataType(null),v=it(y,i.error,l);return v==null||v.metaSync({value:e},null),{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:v},result:null}}}async executeLoop(i,a,l,c={}){var y,v,T,I,b,D;const e={...no,...c};try{let V={value:X.Success,error:null,result:null};const M=a.map(ae=>{var J,fe;return((J=ae==null?void 0:ae.value)==null?void 0:J.valueAsType)||((fe=ae==null?void 0:ae.value)==null?void 0:fe.value)});let x={};i.getUniqueInputMaps().forEach(ae=>{const J=i.body.inputs.find(me=>S(me,l)===S(ae,l)),fe=ae==null?void 0:ae.getDataType(null),le=it(fe,J,l);fe!=null&&fe.asType?le==null||le.setValueAsTypeList([]):le==null||le.metaSync({value:[]},null),this.lastExecutionResults.writeValue(J,le);const ye={value:le,valueOwner:J,type:Ce.ExecutionResult,inheritanceLink:null};x[J.id]=ye});let Z={value:X.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case pe.loop["counted-loop"].id:{const ae=M[0];let J=1;for(;J<=ae&&J<=50;){const fe=i.body.inputs.map(le=>{if(le===i.currentIterationNumberArgumentDeclaration){const ye=i.currentIterationNumberArgumentDeclaration.getDataType(null),me=Ad(ye),Q=this.lastExecutionResults.readValue(le.id);if(Q){Q.metaSync({value:J},null),this.lastExecutionResults.writeValue(le,Q);const $e={value:Q,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null};return x[le.id]=$e,$e}const ue={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:J,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:me,standaloneParent:le.toReference()},Ee=Ci(ue,l);this.lastExecutionResults.writeValue(le,Ee);const _e={value:Ee,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null};return x[le.id]=_e,_e}else return x[le.id]}).filter(le=>!!le);if(Z=await this.executeFullFunctionDeclarationLogic(i.body,fe,e),(Z.results||[]).forEach(le=>{var ue,Ee,_e,$e;if(le.valueOwner.type!==p.InputMap||xt.includes(le.valueOwner.parent.type))return;const ye=i.body.inputs.find(Ie=>S(Ie,l)===S(le.valueOwner,l)),Q=[...((Ee=(ue=x==null?void 0:x[ye.id])==null?void 0:ue.value)==null?void 0:Ee.value)||[],((_e=le==null?void 0:le.value)==null?void 0:_e.value)||null];($e=x[ye.id].value)==null||$e.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ye,x[ye.id].value)}),[X.CaughtError,X.Break,X.Return].includes(Z.value))break;J++}break}case pe.loop["manual-flow-loop"].id:{let ae=1;for(;ae<=50;){const J=i.body.inputs.map(fe=>{if(fe===i.currentIterationNumberArgumentDeclaration){const le=this.lastExecutionResults.readValue(fe.id);if(le){le.metaSync({value:ae},null),this.lastExecutionResults.writeValue(fe,le);const ue={value:le,valueOwner:fe,type:Ce.ExecutionResult,inheritanceLink:null};return x[fe.id]=ue,ue}const ye=i.currentIterationNumberArgumentDeclaration.getDataType(null),me=it(ye,fe,l);return me==null||me.metaSync({value:ae},null),this.lastExecutionResults.writeValue(fe,me),{value:me,valueOwner:fe,type:Ce.ExecutionResult,inheritanceLink:null}}else return x[fe.id]}).filter(fe=>!!fe);if(Z=await this.executeFullFunctionDeclarationLogic(i.body,J,e),(Z.results||[]).forEach(fe=>{var Q,ue,Ee;if(fe.valueOwner.type!==p.InputMap||xt.includes(fe.valueOwner.parent.type))return;const le=i.body.inputs.find(_e=>S(_e,l)===S(fe.valueOwner,l)),me=[...(Q=x[le.id].value)==null?void 0:Q.value,((ue=fe.value)==null?void 0:ue.value)||null];(Ee=x[le.id].value)==null||Ee.metaSync({value:me},null),this.lastExecutionResults.writeValue(le,x[le.id].value)}),[X.CaughtError,X.Break,X.Return].includes(Z.value))break;ae++}break}case pe.loop["list-loop"].id:{const ae=M[0];let J=1;const fe=ae;for(let le=0;le<fe.length;le++){const ye=fe[le],me=i.body.inputs.map(Q=>{if(Q===i.currentIterationNumberArgumentDeclaration){const ue=this.lastExecutionResults.readValue(Q.id);if(ue)return ue.metaSync({value:J},null),this.lastExecutionResults.writeValue(Q,ue),{value:ue,valueOwner:Q,type:Ce.ExecutionResult,inheritanceLink:null};const Ee=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=it(Ee,Q,l);return _e==null||_e.metaSync({value:J},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null}}else if(Q===i.currentValueArgumentDeclaration){const ue=i.currentValueArgumentDeclaration.getDataType(null),Ee=Ad(ue),_e=this.lastExecutionResults.readValue(Q.id);if(_e)return _e.metaSync({value:ye},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:Q,type:Ce.ExecutionResult,inheritanceLink:null};const $e={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:ye,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ee,standaloneParent:Q.toReference()},Ie=Ci($e,l);return this.lastExecutionResults.writeValue(Q,Ie),{value:Ie,valueOwner:i.currentValueArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null}}else return x[Q.id]}).filter(Q=>!!Q);if(Z=await this.executeFullFunctionDeclarationLogic(i.body,me,e),(Z.results||[]).forEach(Q=>{var $e,Ie,Re;if(Q.valueOwner.type!==p.InputMap||xt.includes(Q.valueOwner.parent.type))return;const ue=i.body.inputs.find(je=>S(je,l)===S(Q.valueOwner,l)),_e=[...($e=x[ue.id].value)==null?void 0:$e.value,((Ie=Q.value)==null?void 0:Ie.value)||null];(Re=x[ue.id].value)==null||Re.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ue,x[ue.id].value)}),[X.CaughtError,X.Break,X.Return].includes(Z.value))break;J++}break}case pe.loop["object-keys-loop"].id:{const ae=M[0];let J=1;const fe=ae?Object.keys(ae):[];for(let le=0;le<fe.length;le++){const ye=fe[le],me=i.body.inputs.map(Q=>{if(Q===i.currentIterationNumberArgumentDeclaration){const ue=this.lastExecutionResults.readValue(Q.id);if(ue)return ue.metaSync({value:J},null),this.lastExecutionResults.writeValue(Q,ue),{value:ue,valueOwner:Q,type:Ce.ExecutionResult,inheritanceLink:null};const Ee=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=it(Ee,Q,l);return _e==null||_e.metaSync({value:J},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null}}else if(Q===i.currentValueArgumentDeclaration){const ue=i.currentValueArgumentDeclaration.getDataType(null),Ee=Ad(ue),_e=this.lastExecutionResults.readValue(Q.id);if(_e)return _e.metaSync({value:ye},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:Q,type:Ce.ExecutionResult,inheritanceLink:null};const $e={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:ye,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ee,standaloneParent:Q.toReference()},Ie=Ci($e,l);return this.lastExecutionResults.writeValue(Q,Ie),{value:Ie,valueOwner:i.currentValueArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null}}else return x[Q.id]}).filter(Q=>!!Q);if(Z=await this.executeFullFunctionDeclarationLogic(i.body,me,e),(Z.results||[]).forEach(Q=>{var $e,Ie,Re;if(Q.valueOwner.type!==p.InputMap||xt.includes(Q.valueOwner.parent.type))return;const ue=i.body.inputs.find(je=>S(je,l)===S(Q.valueOwner,l)),_e=[...($e=x[ue.id].value)==null?void 0:$e.value,((Ie=Q.value)==null?void 0:Ie.value)||null];(Re=x[ue.id].value)==null||Re.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ue,x[ue.id].value)}),[X.CaughtError,X.Break,X.Return].includes(Z.value))break;J++}break}case pe.loop["object-values-loop"].id:{const ae=M[0];let J=1;const fe=ae?Object.values(ae):[];for(let le=0;le<fe.length;le++){const ye=fe[le],me=i.body.inputs.map(Q=>{if(Q===i.currentIterationNumberArgumentDeclaration){const ue=this.lastExecutionResults.readValue(Q.id);if(ue)return ue.metaSync({value:J},null),this.lastExecutionResults.writeValue(Q,ue),{value:ue,valueOwner:Q,type:Ce.ExecutionResult,inheritanceLink:null};const Ee=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=it(Ee,Q,l);return _e==null||_e.metaSync({value:J},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null}}else if(Q===i.currentValueArgumentDeclaration){const ue=i.currentValueArgumentDeclaration.getDataType(null),Ee=Ad(ue),_e=this.lastExecutionResults.readValue(Q.id);if(_e)return _e.metaSync({value:ye},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:Q,type:Ce.ExecutionResult,inheritanceLink:null};const $e={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:ye,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ee,standaloneParent:Q.toReference()},Ie=Ci($e,l);return this.lastExecutionResults.writeValue(Q,Ie),{value:Ie,valueOwner:i.currentValueArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null}}else return x[Q.id]}).filter(Q=>!!Q);if(Z=await this.executeFullFunctionDeclarationLogic(i.body,me,e),(Z.results||[]).forEach(Q=>{var $e,Ie,Re;if(Q.valueOwner.type!==p.InputMap||xt.includes(Q.valueOwner.parent.type))return;const ue=i.body.inputs.find(je=>S(je,l)===S(Q.valueOwner,l)),_e=[...($e=x[ue.id].value)==null?void 0:$e.value,((Ie=Q.value)==null?void 0:Ie.value)||null];(Re=x[ue.id].value)==null||Re.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ue,x[ue.id].value)}),[X.CaughtError,X.Break,X.Return].includes(Z.value))break;J++}break}case pe.loop["string-loop"].id:{const ae=M[0];let J=1;const fe=ae.split("");for(let le=0;le<fe.length;le++){const ye=fe[le],me=i.body.inputs.map(Q=>{if(Q===i.currentIterationNumberArgumentDeclaration){const ue=this.lastExecutionResults.readValue(Q.id);if(ue)return ue.metaSync({value:J},null),this.lastExecutionResults.writeValue(Q,ue),{value:ue,valueOwner:Q,type:Ce.ExecutionResult,inheritanceLink:null};const Ee=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=it(Ee,Q,l);return _e==null||_e.metaSync({value:J},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null}}else if(Q===i.currentValueArgumentDeclaration){const ue=i.currentValueArgumentDeclaration.getDataType(null),Ee=Ad(ue),_e=this.lastExecutionResults.readValue(Q.id);if(_e)return _e.metaSync({value:ye},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:Q,type:Ce.ExecutionResult,inheritanceLink:null};const $e={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:ye,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ee,standaloneParent:Q.toReference()},Ie=Ci($e,l);return this.lastExecutionResults.writeValue(Q,Ie),{value:Ie,valueOwner:i.currentValueArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null}}else return x[Q.id]}).filter(Q=>!!Q);if(Z=await this.executeFullFunctionDeclarationLogic(i.body,me,e),(Z.results||[]).forEach(Q=>{var $e,Ie,Re;if(Q.valueOwner.type!==p.InputMap||xt.includes(Q.valueOwner.parent.type))return;const ue=i.body.inputs.find(je=>S(je,l)===S(Q.valueOwner,l)),_e=[...($e=x[ue.id].value)==null?void 0:$e.value,((Ie=Q.value)==null?void 0:Ie.value)||null];(Re=x[ue.id].value)==null||Re.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ue,x[ue.id].value)}),[X.CaughtError,X.Break,X.Return].includes(Z.value))break;J++}break}}if(V={value:[X.CaughtError,X.Return].includes(Z.value)?Z.value:X.Success,error:((v=(y=Z.error)==null?void 0:y.value)==null?void 0:v.value)||null,result:((I=(T=Z==null?void 0:Z.result)==null?void 0:T.value)==null?void 0:I.value)||null},V.error&&i.error){const ae=(b=i.error)==null?void 0:b.getDataType(null),J=it(ae||null,i.error,l);ae!=null&&ae.asType?J==null||J.setValueAsTypeSingle(V.error):J==null||J.metaSync({value:V.error},null);const fe={valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:J};return{value:V.value,entity:i,error:fe,result:null}}const W=i==null?void 0:i.getDataType(null),z=it(W,i,l);return W!=null&&W.asType?z==null||z.setValueAsTypeSingle(V.result):z==null||z.metaSync({value:V.result},null),{value:V.value,entity:i,error:null,result:{value:z||null,valueOwner:i,type:Ce.ExecutionResult,inheritanceLink:null}}}catch(V){if(Y.warn("Error executing loop: ",V),i.error){const M=(D=i.error)==null?void 0:D.getDataType(null),x=it(M,i.error,l);return M!=null&&M.asType?x==null||x.setValueAsTypeSingle(V):x==null||x.metaSync({value:V},null),{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:x},result:null}}else return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,a,l,c={}){var y,v;const e={...no,...c};try{let T={value:X.Success,error:null,result:null};T=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,a,l,e);let I=null;if(T.error&&i.error){Y.warn("Raw error executing entity: ",T.error);const b=(y=i.error)==null?void 0:y.getDataType(null),D=it(b||null,i.error,l);b!=null&&b.asType?D==null||D.setValueAsTypeSingle(T.error):D==null||D.metaSync({value:T.error},null),I={valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:D}}return{value:T.value,entity:i,error:I,result:T.result}}catch(T){if(!i.error)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:null,result:null};const I=(v=i.error)==null?void 0:v.getDataType(null),b=it(I,i.error,l);return I!=null&&I.asType?b==null||b.setValueAsTypeSingle(T):b==null||b.metaSync({value:T},null),{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:b},result:null}}}async executeCondition(i,a){var c,e,y,v,T,I,b,D,V,M,x,q,Z,W,z,ae,J,fe,le,ye,me,Q,ue,Ee,_e,$e,Ie,Re,je,Ve,Be,Ke,ct,tt,Mt,Dt,Ti,Ki,Si,an,Cr,qt,gi,cs,fs,Ry,Vd,Cy;let l=!1;switch(i.declaration.id){case Ar.Empty:{l=!((e=(c=a[0])==null?void 0:c.value)!=null&&e.value);break}case Ar.NotEmpty:{l=!!((v=(y=a[0])==null?void 0:y.value)!=null&&v.value);break}case ut.Equal:{if([ie.String,ie.Number,ie.Boolean,ie.Null,ie.Enum,ie.Date,ie.UUID].includes((I=(T=a[0])==null?void 0:T.value)==null?void 0:I.name)){l=((D=(b=a[0])==null?void 0:b.value)==null?void 0:D.value)===((M=(V=a[1])==null?void 0:V.value)==null?void 0:M.value);break}if(((q=(x=a[0])==null?void 0:x.value)==null?void 0:q.name)===ie.KeyValue||((W=(Z=a[0])==null?void 0:Z.value)==null?void 0:W.name)===ie.Untyped){const $a=(ae=(z=a[0])==null?void 0:z.value)==null?void 0:ae.value,Ur=(fe=(J=a[1])==null?void 0:J.value)==null?void 0:fe.value;l=JSON.stringify($a)===JSON.stringify(Ur);break}break}case ut.NotEqual:{if([ie.String,ie.Number,ie.Boolean,ie.Null,ie.Enum,ie.Date,ie.UUID].includes((ye=(le=a[0])==null?void 0:le.value)==null?void 0:ye.name)){l=((Q=(me=a[0])==null?void 0:me.value)==null?void 0:Q.value)!==((Ee=(ue=a[1])==null?void 0:ue.value)==null?void 0:Ee.value);break}if((($e=(_e=a[0])==null?void 0:_e.value)==null?void 0:$e.name)===ie.Untyped||((Re=(Ie=a[0])==null?void 0:Ie.value)==null?void 0:Re.name)===ie.KeyValue){const $a=(Ve=(je=a[0])==null?void 0:je.value)==null?void 0:Ve.value,Ur=(Ke=(Be=a[1])==null?void 0:Be.value)==null?void 0:Ke.value;l=JSON.stringify($a)!==JSON.stringify(Ur);break}break}case ut.MoreThanOrEqual:{l=((tt=(ct=a[0])==null?void 0:ct.value)==null?void 0:tt.value)>=((Dt=(Mt=a[1])==null?void 0:Mt.value)==null?void 0:Dt.value);break}case ut.MoreThan:{l=((Ki=(Ti=a[0])==null?void 0:Ti.value)==null?void 0:Ki.value)>((an=(Si=a[1])==null?void 0:Si.value)==null?void 0:an.value);break}case ut.LessThanOrEqual:{l=((qt=(Cr=a[0])==null?void 0:Cr.value)==null?void 0:qt.value)<=((cs=(gi=a[1])==null?void 0:gi.value)==null?void 0:cs.value);break}case ut.LessThan:{l=((Ry=(fs=a[0])==null?void 0:fs.value)==null?void 0:Ry.value)<((Cy=(Vd=a[1])==null?void 0:Vd.value)==null?void 0:Cy.value);break}case Gi.And:{l=(await Promise.all(i.andChildrenGroup.map(async Ur=>{const hp=this.mergeExernalValuesWithInternalInputs(a,Ur);return(await this.executeCondition(Ur,hp)).value===X.Success}))).every(Ur=>Ur);break}case Gi.Or:{l=(await Promise.all(i.orChildrenGroup.map(async Ur=>{const hp=this.mergeExernalValuesWithInternalInputs(a,Ur);return(await this.executeCondition(Ur,hp)).value===X.Success}))).some(Ur=>Ur);break}}return{value:l?X.Success:X.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,a,l,c={}){const e={...no,...c,onBeforeEntityExecution:(T,I,b)=>{var D;return((D=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:D.call(c,T,I,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(T,I,b)=>{var D;return((D=c==null?void 0:c.onEntityExecuted)==null?void 0:D.call(c,T,I,{...b,detached:!0}))||Promise.resolve()}},y=new so(l,[i,...ev(i)],i,this,this.parentContext);return y.inheritValuesFromContext(this),await y.execute(e,a)}async executeFullFunctionDeclarationLogic(i,a,l={}){const c={...no,...l},e=ev(i);e.forEach(T=>{this.addEntity(T)}),e.reduce((T,I)=>xt.includes(I.type)?[...T,...I.outputs]:mi.includes(I.type)&&I.type!==p.Condition?[...T,...I.outputs,...I.inputs]:I.type===p.Condition?[...T,...I.inputs]:T,[]).forEach(T=>{this.lastExecutionResults.removeValue(T.id)});const v=await this.executeBranch(i,c,a);return{...v||{},value:(v==null?void 0:v.value)||X.Success,entity:i,error:(v==null?void 0:v.error)||null,result:(v==null?void 0:v.result)||null}}static async executeEntryPointEntity(i,a){return{value:X.Success,entity:i,error:null,result:null}}async executeReturnStatement(i,a){var y,v,T,I,b,D,V;if((y=i.throws)!=null&&y.readsValue){const M=Aa(i.throws,this.valueResolutionContext);return{value:X.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Ce.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=Aa(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let M={};if(((v=c==null?void 0:c.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)bi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(I=l==null?void 0:l.value)==null?void 0:I.value}),l==null||l.value.metaSync({value:M},null);else{const x=it(c,i,this.project);x==null||x.metaSync({value:M},null),l={valueOwner:i,type:Ce.ExecutionResult,inheritanceLink:null,value:x}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(x=>{var q,Z;if(((q=x.declaration)==null?void 0:q.type)===p.Property&&x.declaration.static){const W=this.lastExecutionResults.readValue(x.declaration.id),z=S(x,this.project),ae=x.codeName||((Z=x.declaration)==null?void 0:Z.codeName)||Bi(z);if(W)W.metaSync({value:M[ae]},null),this.lastExecutionResults.writeValue(x.declaration,W);else{const J=it(x.getDataType(null),x,this.project);J==null||J.metaSync({value:M[ae]},null),this.lastExecutionResults.writeValue(x.declaration,J)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&bi((D=l.value)==null?void 0:D.value)?((V=l.value)==null?void 0:V.value)||{}:{};return i.outputs.map(M=>{var W;const x=M.codeName||((W=M.declaration)==null?void 0:W.codeName)||Bi(S(M,this.project)),q=e[x],Z=it(M.getDataType(null),M,this.project);Z==null||Z.metaSync({value:q},null),Ce.ExecutionResult}),l.type=Ce.ExecutionResult,{value:X.Return,entity:i,error:null,result:l}}async executeContinueStatement(i,a){var y,v,T,I,b,D,V;if((y=i.throws)!=null&&y.readsValue){const M=Aa(i.throws,this.valueResolutionContext);return{value:X.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Ce.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=Aa(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let M={};if(((v=c==null?void 0:c.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)bi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(I=l==null?void 0:l.value)==null?void 0:I.value}),l==null||l.value.metaSync({value:M},null);else{const x=it(c,i,this.project);x==null||x.metaSync({value:M},null),l={valueOwner:i,type:Ce.ExecutionResult,inheritanceLink:null,value:x}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(x=>{var q,Z;if(((q=x.declaration)==null?void 0:q.type)===p.Property&&x.declaration.static){const W=this.lastExecutionResults.readValue(x.declaration.id),z=S(x,this.project),ae=x.codeName||((Z=x.declaration)==null?void 0:Z.codeName)||Bi(z);if(W)W.metaSync({value:M[ae]},null),this.lastExecutionResults.writeValue(x.declaration,W);else{const J=it(x.getDataType(null),x,this.project);J==null||J.metaSync({value:M[ae]},null),this.lastExecutionResults.writeValue(x.declaration,J)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&bi((D=l.value)==null?void 0:D.value)?((V=l.value)==null?void 0:V.value)||{}:{};return i.outputs.map(M=>{var W;const x=M.codeName||((W=M.declaration)==null?void 0:W.codeName)||Bi(S(M,this.project)),q=e[x],Z=it(M.getDataType(null),M,this.project);Z==null||Z.metaSync({value:q},null),Ce.ExecutionResult}),l.type=Ce.ExecutionResult,{value:X.Continue,entity:i,error:null,result:l}}async executeBreakStatement(i,a){var y,v,T,I,b,D,V;if((y=i.throws)!=null&&y.readsValue){const M=Aa(i.throws,this.valueResolutionContext);return{value:X.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Ce.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=Aa(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let M={};if(((v=c==null?void 0:c.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)bi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(I=l==null?void 0:l.value)==null?void 0:I.value}),l==null||l.value.metaSync({value:M},null);else{const x=it(c,i,this.project);x==null||x.metaSync({value:M},null),l={valueOwner:i,type:Ce.ExecutionResult,inheritanceLink:null,value:x}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(x=>{var q,Z;if(((q=x.declaration)==null?void 0:q.type)===p.Property&&x.declaration.static){const W=this.lastExecutionResults.readValue(x.declaration.id),z=S(x,this.project),ae=x.codeName||((Z=x.declaration)==null?void 0:Z.codeName)||Bi(z);if(W)W.metaSync({value:M[ae]},null),this.lastExecutionResults.writeValue(x.declaration,W);else{const J=it(x.getDataType(null),x,this.project);J==null||J.metaSync({value:M[ae]},null),this.lastExecutionResults.writeValue(x.declaration,J)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&bi((D=l.value)==null?void 0:D.value)?((V=l.value)==null?void 0:V.value)||{}:{};return i.outputs.map(M=>{var W;const x=M.codeName||((W=M.declaration)==null?void 0:W.codeName)||Bi(S(M,this.project)),q=e[x],Z=it(M.getDataType(null),M,this.project);Z==null||Z.metaSync({value:q},null),Ce.ExecutionResult}),l.type=Ce.ExecutionResult,{value:X.Break,entity:i,error:null,result:l}}async executeVariable(i,a){var v,T,I,b,D,V;let l=Aa(i,this.valueResolutionContext);const c=nn(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let M={};if(((v=e==null?void 0:e.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...e.entity.getActiveRawDefaultValue()}),l!=null&&l.value)bi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(I=l==null?void 0:l.value)==null?void 0:I.value}),l==null||l.value.metaSync({value:M},null);else{const x=it(e,i,this.project);x==null||x.metaSync({value:M},null),l={valueOwner:c,type:Ce.ExecutionResult,inheritanceLink:null,value:x}}this.lastExecutionResults.writeValue(c,l.value),c.inputs.forEach(x=>{var q,Z;if(((q=x.declaration)==null?void 0:q.type)===p.Property&&x.declaration.static){const W=this.lastExecutionResults.readValue(x.declaration.id),z=S(x,this.project),ae=x.codeName||((Z=x.declaration)==null?void 0:Z.codeName)||Bi(z);if(W)W.metaSync({value:M[ae]},null),this.lastExecutionResults.writeValue(x.declaration,W);else{const J=it(x.getDataType(null),x,this.project);J==null||J.metaSync({value:M[ae]},null),this.lastExecutionResults.writeValue(x.declaration,J)}}})}else this.lastExecutionResults.writeValue(c,l==null?void 0:l.value);const y=(b=l==null?void 0:l.value)!=null&&b.value&&bi((D=l.value)==null?void 0:D.value)?((V=l.value)==null?void 0:V.value)||{}:{};return i.outputs.map(M=>{var W;const x=M.codeName||((W=M.declaration)==null?void 0:W.codeName)||Bi(S(M,this.project)),q=y[x],Z=it(M.getDataType(null),M,this.project);Z==null||Z.metaSync({value:q},null),Ce.ExecutionResult}),l.type=Ce.ExecutionResult,{value:X.Success,entity:i,error:null,result:l}}mergeValues(i,a){const l=[];for(let c=0;c<a.length;c++)i!=null&&i[c]?l.push(i[c]):l.push(a[c]);return l}async executeEntity(i,a=[],l={}){var y,v,T,I,b,D,V,M,x,q,Z;const c={...no,...l},e={detached:!1};switch(i.type){case p.Condition:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((y=c.onBeforeEntityExecution)==null?void 0:y.call(c,i,W,e)),this.executeCondition(i,W)}case p.InternalCall:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((v=c.onBeforeEntityExecution)==null?void 0:v.call(c,i,W,e)),this.executeInternalCall(i,W,this.project)}case p.Operation:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((T=c.onBeforeEntityExecution)==null?void 0:T.call(c,i,W,e)),so.executeOperation(i,W,this.project)}case p.VariableInstance:case p.VariableDeclaration:return this.executeVariable(i,a);case p.FunctionCall:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((I=c.onBeforeEntityExecution)==null?void 0:I.call(c,i,W,e)),this.executeFunctionCall(i,W,this.project)}case p.FunctionDeclaration:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((b=c.onBeforeEntityExecution)==null?void 0:b.call(c,i,W,e)),so.executeEntryPointEntity(i,W)}case p.Search:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((D=c.onBeforeEntityExecution)==null?void 0:D.call(c,i,W,e)),this.executeSearch(i,W,this.project)}case p.Loop:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((V=c.onBeforeEntityExecution)==null?void 0:V.call(c,i,W,e)),this.executeLoop(i,W,this.project,c)}case p.ReturnStatement:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((M=c.onBeforeEntityExecution)==null?void 0:M.call(c,i,W,e)),this.executeReturnStatement(i,W)}case p.ContinueStatement:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((x=c.onBeforeEntityExecution)==null?void 0:x.call(c,i,W,e)),this.executeContinueStatement(i,W)}case p.BreakStatement:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((q=c.onBeforeEntityExecution)==null?void 0:q.call(c,i,W,e)),this.executeBreakStatement(i,W)}case p.GlobalEvent:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((Z=c.onBeforeEntityExecution)==null?void 0:Z.call(c,i,W,e)),so.executeEntryPointEntity(i,W)}default:throw new Error(`Entity type ${i==null?void 0:i.type} is not recognized for execution.`)}}storeLastExecutionValues(i){var l,c,e;if(i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value),!i.result||!((l=i.result)!=null&&l.valueOwner))return;const a=Ys((c=i.result)==null?void 0:c.valueOwner,this.project);(e=i.result)!=null&&e.value?a.forEach(y=>{var v;this.lastExecutionResults.writeValue(y,(v=i.result)==null?void 0:v.value)}):a.forEach(y=>{this.lastExecutionResults.removeValue(y.id)})}async executeBranch(i,a={},l=[]){var T;const c={...no,...a},e={detached:!1};if(!this.hasEntity(i)||this.hasSkipped(i))return null;this.addToExecutingList(i),this.hasScheduled(i)&&this.removeScheduled(i);const v=await this.executeEntity(i,l,c);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(v),await((T=c.onEntityExecuted)==null?void 0:T.call(c,i,v,e)),v.value===X.Success){const I=(i.successCalls||i.calls||[]).filter(x=>this.hasEntity(x));(i.errorCalls||[]).forEach(x=>{this.skip(x)});let D=[];const V=(await Promise.all(I.map(x=>this.schedule(x,[],c)))).filter(x=>!!x),M=V.filter(x=>!!x).find(x=>x.value===X.CaughtError||x.value===X.Return||x.value===X.Break||x.value===X.Continue);return M||(D=[...D,...V],v)}else if(v.value===X.CaughtError||v.value===X.ConditionNotMet){const I=(i.errorCalls||[]).filter(x=>this.hasEntity(x));(i.successCalls||i.calls||[]).forEach(x=>{this.skip(x)});let D=[];const V=(await Promise.all(I.map(x=>this.schedule(x,[],c)))).filter(x=>!!x),M=V.filter(x=>!!x).find(x=>x.value===X.CaughtError||x.value===X.UnhandledError||x.value===X.Return||x.value===X.Break||x.value===X.Continue);return M||(D=[...D,...V],v)}else{if(v.value===X.UnhandledError)return this.executing.forEach(I=>{this.skip(I)}),this.scheduled.forEach(I=>{this.skip(I)}),Gr.includes(v.entity.type)&&ht(v.entity).forEach(I=>{this.skip(I)}),v;if(v.value===X.Return)return v;if(v.value===X.Break)return v;if(v.value===X.Continue)return v}return v}async execute(i={},a=[]){const l={...no,...i};this.state="running";const c=await this.executeBranch(this.entryPoint,l,a);return this.state="finished-success",c}addEntity(i){var a;this.entities.includes(i)||(this.entities.push(i),(a=this.onAddEntityCallback)==null||a.call(this,i))}addEntities(i){i.forEach(a=>this.addEntity(a))}removeEntity(i){var a;if(i!==this.entryPoint){const l=this.entities.indexOf(i);l>-1&&(this.entities.splice(l,1),(a=this.onRemoveEntityCallback)==null||a.call(this,i))}}hasEntity(i){var c,e,y;if(this.entities.includes(i))return!0;if(((c=i.parent)==null?void 0:c.type)===p.FunctionDeclaration&&((y=(e=i.parent)==null?void 0:e.parent)==null?void 0:y.type)===p.DefinitionEntity)return this.entities.includes(i.parent);const a=Pi(i);if(!a)return!1;const l=a.type===p.Loop&&i.parent===a.body?a.body:null;return l?this.entities.includes(l)||this.entities.includes(a):this.entities.includes(a)}removeScheduled(i){const a=this.scheduled.indexOf(i);a>-1&&this.scheduled.splice(a,1)}hasScheduled(i){return!!this.scheduled.includes(i)}hasSkipped(i){return!!this.skipped.includes(i)}hasExecuted(i){return!!this.executed.includes(i)}hasEntityWithId(i){const a=this.project.get(i);return a?this.hasEntity(a):!1}onAddToSkippedList(i){this.onAddToSkippedListCallback=i}onAbortExecution(i){this.onAbortExecutionCallback=i}onAddEntity(i){this.onAddEntityCallback=i}onRemoveFromSkippedList(i){this.onRemoveFromSkippedListCallback=i}onRemoveEntity(i){this.onRemoveEntityCallback=i}addToExecutingList(i){this.executing.includes(i)||this.executing.push(i)}addToScheduledList(i){this.scheduled.includes(i)||this.scheduled.push(i)}removeFromScheduledList(i){const a=this.scheduled.indexOf(i);a>-1&&this.scheduled.splice(a,1)}removeFromExecutingList(i){var l;const a=this.executing.indexOf(i);a>-1&&(this.executing.splice(a,1),(l=this.onAbortExecutionCallback)==null||l.call(this,i))}removeFromAlreadyExecutedList(i){const a=this.executed.indexOf(i);a>-1&&this.executed.splice(a,1)}removeFromSkippedList(i){var l;const a=this.skipped.indexOf(i);a>-1&&(this.skipped.splice(a,1),(l=this.onRemoveFromSkippedListCallback)==null||l.call(this,i))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var a;this.skipped.includes(i)||(this.skipped.push(i),(a=this.onAddToSkippedListCallback)==null||a.call(this,i))}}function J_e(d){var u,i;if(d.isList)return"list";if(((u=d.entity)==null?void 0:u.type)===p.DefinitionEntity)return"definition-entity";switch((i=d.entity)==null?void 0:i.name){case ie.Number:return"number";case ie.String:return"text";case ie.Boolean:return"boolean";case ie.UUID:return"uuid";case ie.Date:return"date-time";default:return"definition-entity"}}const ss={[p.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[p.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[p.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[p.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[p.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[p.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[p.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[p.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[p.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[p.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[p.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[p.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[p.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[p.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[p.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[p.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[p.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[p.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[p.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[p.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[p.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[p.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[p.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[p.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"},[p.DataType]:{singular:"Data type",plural:"Data types",shortSingular:"Data type",shortPlural:"Data types"},[p.LiteralValue]:{singular:"Literal value",plural:"Literal values",shortSingular:"Value",shortPlural:"Values"}};function xA(d){const u=tv(d);if(!u){const a=pp(d);if(a.includes(ce.HTTP_ENDPOINT))return"HTTP endpoint";if(a.includes(ce.PERSISTED_ENTITY))return"Persisted entity";if(a.includes(ce.CRON_JOB))return"Scheduled execution";if(a.includes(ce.RELATIONAL_DATABASE))return"Relational database"}if(u){let a="Extension of "+S(u,u.project)+" entity",l=Mu(a);const c=pp(d);return c.includes(ce.HTTP_ENDPOINT)?"HTTP endpoint"+(l?", "+l:""):c.includes(ce.PERSISTED_ENTITY)?"Persisted entity"+(l?", "+l:""):c.includes(ce.CRON_JOB)?"Scheduled execution"+(l?", "+l:""):c.includes(ce.RELATIONAL_DATABASE)?"Relational database"+(l?", "+l:""):a}let i="";return d.abstract&&(i="Template "),d.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function W7(d){return d.parent.type===p.DefinitionEntity||d.parent.type===p.InstalledProject?"Internal action of "+S(d.parent,d.project):d.parent.type===p.Loop?"Action repeated on every iteration":"Internal action of entity"}function UA(d){return rR(d)?W7(d):"Custom trigger"}function Y_e(d){var u;switch(d.type){case p.DefinitionEntity:return xA(d);case p.FunctionDeclaration:return UA(d)}return(u=ss[d.type])==null?void 0:u.singular}function S_e(d){var u;switch(d.type){case p.DefinitionEntity:return xA(d);case p.FunctionDeclaration:return UA(d)}return(u=ss[d.type])==null?void 0:u.singular}const jA=4e4,H7=280,X_e=300,GA=65,Zu=32,Xm=39,z7=26,J7=49,Qm=44,Q_e=35,e0=52,kA=10,fl=kA*2,t0=38,i0=90,FA=270,Y7=jA/2+120,S7=jA/2+180;function X7(d){let i=Zu+Qm+t0+kA;const a=[...d.inputs];return a.length&&(i+=fl,a.forEach(()=>{i+=z7})),{height:i,width:280}}function Q7(d){let i=GA;const a=[];if([p.DefinitionEntity].includes(d.type)){const v=[...d.suggestedProperties||[],...d.properties||[]];v.length&&(i+=fl,v.forEach(T=>{i+=T.static?J7:Xm}))}if([p.DefinitionEntity,p.InstalledProject,p.Loop].includes(d.type)){const v=[...(d==null?void 0:d.suggestedMethods)||[],...d.methods||[],...d.functions||[],...d.body?[d.body]:[]];v.length&&(i+=fl,v.forEach(T=>{const I=X7(T);i+=I.height}))}mi.includes(d.type)?($t.includes(d.type)?a.push(...(d.usedInputs||[]).flatMap(v=>[v])||[]):a.push(...(d.inputs||[]).flatMap(v=>[v])||[]),d.error&&(i+=e0)):[p.ReturnStatement,p.BreakStatement,p.ContinueStatement].includes(d.type)?(a.push(...d.outputs||[]),d.throws&&(i+=e0)):d.type===p.Condition&&(a.push(d.inputs[0]),d.inputs[1]&&a.push(d.inputs[1]));const l=a.length;l&&(i+=l*Xm,i+=fl);const c=[];if(d.type===p.FunctionDeclaration||d.type===p.GlobalEvent?c.push(...d.inputs||[]):mi.includes(d.type)&&($t.includes(d.type)?c.push(...d.usedOutputs||[]):c.push(...d.outputs||[])),$t.includes(d.type)){d.readsValue&&(i+=fl,i+=Qm),d.writesValues.length&&(i+=fl,i+=Qm),d.internalCalls.length&&d.usedInternalCalls.forEach(()=>i+=e0+fl);const v=d.getDataType(null);(!v||v.inferred)&&(i+=t0)}const e=c.length;return e&&(i+=e*Xm,i+=fl),[p.DefinitionEntity,p.FunctionDeclaration,p.ReturnStatement,p.BreakStatement,p.ContinueStatement].includes(d.type)&&(i+=t0),{height:i,width:280}}function Xc(d){return`${d.split("-").map((a,l)=>l===0?a.charAt(0).toUpperCase()+a.slice(1):a.toLowerCase()).join(" ")}.`}function eDe(d){switch(d.code){case se.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case se.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case se.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case se.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case se.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case se.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case se.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case oe.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case oe.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case se.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case se.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case oe.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case se.NoProperties:return"This entity has no properties, so it doesn't do anything";case se.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case se.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case se.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case se.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case se.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case se.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case se.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case se.PropertyImplementsNonAbstact:return"This property implements a non-template property";case se.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case se.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case se.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case se.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case se.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case oe.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case oe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case oe.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case oe.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case oe.UnreachableEntity:return"This entity is unreachable";case se.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case se.AbstractEntityImplements:return"This template entity implements a non-template entity";case se.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case se.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case se.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case se.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case se.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case se.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case se.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case se.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case se.MissingRequiredValue:return"This action is missing a required value";case se.NoPrimaryKeyProperty:return"This entity has no primary key property";case se.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case se.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case se.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case se.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case se.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case se.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case se.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case oe.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case oe.EmptyName:return"This entity has no name";case oe.InvalidObjectStructure:return"This entity has an invalid structure";case oe.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case oe.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case oe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case oe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case oe.MissingCaller:return"This action is missing a caller";case oe.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case oe.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case oe.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case oe.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case oe.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case oe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case oe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case oe.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case Pa.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Pa.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case qn.UUIDMustBeString:return`UUID must be a string, eg: "${hd()}"`;case qn.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${hd()}"`;case qn.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${hd()}"`;case hn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case hn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case hn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return Xc(d.code)}}function tDe(d){switch(d.code){case se.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case se.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case se.IncorrectEntityImplementation:return"Incorrect implementation";case se.IncorrectMethodImplementation:return"Incorrect action implementation";case se.IncorrectPropertyImplementation:return"Incorrect property implementation";case se.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case se.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case oe.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case oe.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case se.MissingMethodImplementation:return"Missing action";case se.MissingPropertyImplementation:return"Missing property";case oe.NameNotUniqueInScope:return"Duplicate name";case se.NoProperties:return"No properties";case se.NonStaticPropertyInStaticEntity:return"Non-static property";case se.StaticEntityWithNonStaticProperties:return"Non-static properties";case se.ReadingFromIncompatibleType:return"Read from different type";case se.WritingToIncompatibleType:return"Write to different type";case se.ScopeWithoutLogic:return"No logic";case se.NonStaticPropertyImplementsStatic:return"Invalid static property";case se.PropertyImplementsIncompatibleType:return"Incompatible data type";case se.PropertyImplementsNonAbstact:return"Non-template property";case se.StaticPropertyImplementsNonStatic:return"Non-static property";case se.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case se.VariableHasInputsAndInternalCall:return"Bad internal call";case se.VariableHasOutputsAndInternalCall:return"Bad internal call";case se.VariableIsCalledAndHasInternalCall:return"Bad internal call";case oe.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case oe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case oe.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case oe.InternalCallParentMissingDataType:return"Parent has no data type";case oe.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case oe.UnreachableEntity:return"Unreachable entity";case se.DisconnectedCallableEntity:return"Disconnected entity";case se.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case se.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case se.InvalidPropertiesCombination:return"Invalid properties combination";case se.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case se.ExtendsIncompatibleEntities:return"Extends incompatible entities";case se.ImplementingNonAbstractEntity:return"Implementing non-template entity";case se.ImplementsIncompatibleEntities:return"Implements incompatible entities";case se.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case se.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case se.MissingRequiredValue:return"Missing required value";case se.NoPrimaryKeyProperty:return"No primary key property";case se.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case se.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case se.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case se.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case se.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case se.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case se.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case oe.EmptyName:return"Empty name";case oe.InvalidObjectStructure:return"Invalid object structure";case oe.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case oe.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case oe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case oe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case oe.MissingCaller:return"Missing caller";case oe.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case oe.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case oe.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case oe.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case oe.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case oe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case oe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case oe.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case Pa.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Pa.StatusCodeMustBeNumber:return"HTTP status code must be a number";case qn.UUIDMustBeString:return"UUID must be a string";case qn.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case qn.UUIDMustBeValidFormat:return"UUID must be in a valid format";case hn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case hn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case hn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return Xc(d.code)}}function iDe(d){switch(d.code){case se.AbstractEntityWithNonAbstractMethods:return`${S(d.entity,d.entity.project)} has non-template actions`;case se.AbstractEntityWithNonAbstractProperties:return`${S(d.entity,d.entity.project)} has non-template properties`;case se.IncorrectEntityImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements template`;case se.IncorrectMethodImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template`;case se.IncorrectPropertyImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template`;case se.AbstractMethodInNonAbstractEntity:return`${S(d.entity,d.entity.project)} can't be a template`;case se.AbstractPropertyInNonAbstractEntity:return`${S(d.entity,d.entity.project)} can't be a template`;case oe.MethodOverwritesOtherSiblingWithSameName:return`${S(d.entity,d.entity.project)} overwrites action`;case oe.PropertyOverwritesOtherSiblingWithSameName:return`${S(d.entity,d.entity.project)} overwrites property`;case se.MissingMethodImplementation:return`${S(d.entity,d.entity.project)} is missing action`;case se.MissingPropertyImplementation:return`${S(d.entity,d.entity.project)} is missing property`;case oe.NameNotUniqueInScope:return`${S(d.entity,d.entity.project)} name is not unique`;case se.NoProperties:return`${S(d.entity,d.entity.project)} has no properties`;case se.NonStaticPropertyInStaticEntity:return`${S(d.entity,d.entity.project)} has non-static property`;case se.StaticEntityWithNonStaticProperties:return`${S(d.entity,d.entity.project)} has non-static properties`;case se.ReadingFromIncompatibleType:return`${S(d.entity,d.entity.project)} reads from different type`;case se.WritingToIncompatibleType:return`${S(d.entity,d.entity.project)} writes to different type`;case se.ScopeWithoutLogic:return`${S(d.entity,d.entity.project)} has no logic`;case se.NonStaticPropertyImplementsStatic:return`${S(d.entity,d.entity.project)} has invalid static property`;case se.PropertyImplementsIncompatibleType:return`${S(d.entity,d.entity.project)} has incompatible data type`;case se.PropertyImplementsNonAbstact:return`${S(d.entity,d.entity.project)} has non-template property`;case se.StaticPropertyImplementsNonStatic:return`${S(d.entity,d.entity.project)} has non-static property`;case se.VariableCallsOthersAndHasInternalCall:return`${S(d.entity,d.entity.project)} has bad internal call`;case se.VariableHasInputsAndInternalCall:return`${S(d.entity,d.entity.project)} has bad internal call`;case se.VariableHasOutputsAndInternalCall:return`${S(d.entity,d.entity.project)} has bad internal call`;case se.VariableIsCalledAndHasInternalCall:return`${S(d.entity,d.entity.project)} has bad internal call`;case oe.InternalCallDeclarationIsInvalidType:return`${S(d.entity,d.entity.project)} has declaration that is not an action`;case oe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${S(d.entity,d.entity.project)} has declaration that is not found in parent`;case oe.InternalCallParentDeclarationEntityInvalidType:return`${S(d.entity,d.entity.project)} has invalid parent declaration type`;case oe.InternalCallParentMissingDataType:return`${S(d.entity,d.entity.project)}'s parent has no data type`;case oe.InternalCallDeclarationNotInParentDatatypeEntity:return`${S(d.entity,d.entity.project)} has declaration that is not in parent`;case oe.UnreachableEntity:return`${S(d.entity,d.entity.project)} is unreachable`;case se.DisconnectedCallableEntity:return`${S(d.entity,d.entity.project)} is not executed by any entity`;case se.AbstractEntityImplements:return`${S(d.entity,d.entity.project)} implements a non-template entity`;case se.AbstractExtendingNonAbstractEntity:return`${S(d.entity,d.entity.project)} extends a non-template entity`;case se.InvalidPropertiesCombination:return`${S(d.entity,d.entity.project)} has invalid properties combination`;case se.ExtendingNonInteractiveEntity:return`${S(d.entity,d.entity.project)} extends a non-interactive entity`;case se.ExtendsIncompatibleEntities:return`${S(d.entity,d.entity.project)} extends incompatible entities`;case se.ImplementingNonAbstractEntity:return`${S(d.entity,d.entity.project)} implements a non-template entity`;case se.ImplementsIncompatibleEntities:return`${S(d.entity,d.entity.project)} implements incompatible entities`;case se.LackingReturnStatementOnSomeBranches:return`${S(d.entity,d.entity.project)} is missing termination on some branches`;case se.LastCalledEntityMustBeReturnEntity:return`${S(d.entity,d.entity.project)}'s last called entity must be a termination node`;case se.MissingRequiredValue:return`${S(d.entity,d.entity.project)} is missing a required value`;case se.NoPrimaryKeyProperty:return`${S(d.entity,d.entity.project)} has no primary key property`;case se.NonAbstractExtendingAbstractEntity:return`${S(d.entity,d.entity.project)} extends a template entity`;case se.NonStaticExtendingStaticEntity:return`${S(d.entity,d.entity.project)} extends a static entity`;case se.NonStaticImplementingStaticEntity:return`${S(d.entity,d.entity.project)} implements a static entity`;case se.StaticExtendingNonStaticEntity:return`${S(d.entity,d.entity.project)} extends a non-static entity`;case se.StaticImplementingNonStaticEntity:return`${S(d.entity,d.entity.project)} implements a non-static entity`;case se.VariableReadsValueAndInternalCall:return`${S(d.entity,d.entity.project)} reads a value and has internal call`;case se.VariableWritesValuesAndInternalCall:return`${S(d.entity,d.entity.project)} writes values and has internal call`;case oe.EmptyName:return`${ss[d.entity.type]} has no name`;case oe.InvalidObjectStructure:return`${S(d.entity,d.entity.project)} has invalid structure`;case oe.LoopBodyFunctionOverwrite:return`${S(d.entity,d.entity.project)}'s loop body action overwrites an action`;case oe.MethodOverwritesBaseMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites base action`;case oe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another action with same implementation`;case oe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another action with same implementation`;case oe.MissingCaller:return`${S(d.entity,d.entity.project)} is missing a caller`;case oe.NameAsResolvedCodeNameNotUniqueInScope:return`${S(d.entity,d.entity.project)} has a name not unique in the scope`;case oe.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${S(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case oe.NameMustStartWithLetterOrUnderscore:return`${S(d.entity,d.entity.project)} name must start with letter or underscore`;case oe.NoOverlapWithImplementedSignature:return`${S(d.entity,d.entity.project)} has no overlap with implemented signature`;case oe.PropertyOverwritesBasePropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites base property`;case oe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another property with same implementation`;case oe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another property with same implementation`;case oe.ReaderWriterIncompatibleDataType:return`${S(d.entity,d.entity.project)} has reader/writer with incompatible data type`;case Pa.StatusCodeMustBeBetween100And599:return`${S(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case Pa.StatusCodeMustBeNumber:return`${S(d.entity,d.entity.project)} HTTP status code must be a number`;case qn.UUIDMustBeString:return`${S(d.entity,d.entity.project)} UUID must be a string`;case qn.UUIDMustNotContainSpaces:return`${S(d.entity,d.entity.project)} UUID must not contain spaces`;case qn.UUIDMustBeValidFormat:return`${S(d.entity,d.entity.project)} UUID must be in a valid format`;case hn.MustBeUniqueAmongSameEntities:return`${S(d.entity,d.entity.project)} value must be unique among the same kind`;case hn.StringValueMustNotHaveDashes:return`${S(d.entity,d.entity.project)} value must not contain dashes`;case hn.StringValueMustNotHaveSpaces:return`${S(d.entity,d.entity.project)} value must not contain spaces`;default:return`${S(d.entity,d.entity.project)} Error: ${Xc(d.code)}`}}function rDe(d){var u,i,a,l;switch(d.code){case se.AbstractEntityWithNonAbstractMethods:return`${S(d.entity,d.entity.project)} has non-template actions`;case se.AbstractEntityWithNonAbstractProperties:return`${S(d.entity,d.entity.project)} has non-template properties`;case se.IncorrectEntityImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template entity`;case se.IncorrectMethodImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template action it's based on`;case se.IncorrectPropertyImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template property it's based on`;case se.AbstractMethodInNonAbstractEntity:return`${S(d.entity,d.entity.project)} is a template action in a non-template entity`;case se.AbstractPropertyInNonAbstractEntity:return`${S(d.entity,d.entity.project)} is a template property in a non-template entity`;case oe.MethodOverwritesOtherSiblingWithSameName:return`${S(d.entity,d.entity.project)} overwrites an action in the template entity`;case oe.PropertyOverwritesOtherSiblingWithSameName:return`${S(d.entity,d.entity.project)} overwrites a property in the template entity`;case se.MissingMethodImplementation:return`${S(d.entity,d.entity.project)} is missing an action implementation from the template entity`;case se.MissingPropertyImplementation:return`${S(d.entity,d.entity.project)} is missing a property implementation from the template entity`;case oe.NameNotUniqueInScope:return`${S(d.entity,d.entity.project)} has a duplicate name in the same scope`;case se.NoProperties:return`${S(d.entity,d.entity.project)} has no properties, so it doesn't do anything`;case se.NonStaticPropertyInStaticEntity:return`${S(d.entity,d.entity.project)} has a non-static property in a static entity`;case se.StaticEntityWithNonStaticProperties:return`${S(d.entity,d.entity.project)} has non-static properties in a static entity`;case se.ReadingFromIncompatibleType:return`${S(d.entity,d.entity.project)} reads data from a value of a different data type`;case se.WritingToIncompatibleType:return`${S(d.entity,d.entity.project)} writes data to a value of a different data type`;case se.ScopeWithoutLogic:return`${S(d.entity,d.entity.project)} has no logic`;case se.NonStaticPropertyImplementsStatic:return`${S(d.entity,d.entity.project)} has a static property in a non-static entity`;case se.PropertyImplementsIncompatibleType:return`${S(d.entity,d.entity.project)} implements a property of a different data type`;case se.PropertyImplementsNonAbstact:return`${S(d.entity,d.entity.project)} implements a non-template property`;case se.StaticPropertyImplementsNonStatic:return`${S(d.entity,d.entity.project)} has a static property in a non-static entity`;case se.VariableCallsOthersAndHasInternalCall:return`${S(d.entity,d.entity.project)} calls other entities while being used to execute internal logic`;case se.VariableHasInputsAndInternalCall:return`${S(d.entity,d.entity.project)} has inputs while being used to execute internal logic`;case se.VariableHasOutputsAndInternalCall:return`${S(d.entity,d.entity.project)} has outputs while being used to execute internal logic`;case se.VariableIsCalledAndHasInternalCall:return`${S(d.entity,d.entity.project)} is called while being used to execute internal logic`;case oe.InternalCallDeclarationIsInvalidType:return`${S(d.entity,d.entity.project)} has a declaration that is not an action`;case oe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${S(d.entity,d.entity.project)} has a declaration that is not found in ${(u=d.entity.parent.getDataType(null))!=null&&u.entity?S((i=d.entity.parent.getDataType(null))==null?void 0:i.entity,d.entity.project):"the variable's data-type entity"}`;case oe.InternalCallParentDeclarationEntityInvalidType:return`${S(d.entity,d.entity.project)} is part of a variable whos data-type entity can't have actions`;case oe.InternalCallParentMissingDataType:return`${S(d.entity,d.entity.project)} is part of a variable with no data-type entity`;case oe.InternalCallDeclarationNotInParentDatatypeEntity:return`${S(d.entity,d.entity.project)} has a declaration doesn't belong to ${(a=d.entity.parent.getDataType(null))!=null&&a.entity?S((l=d.entity.parent.getDataType(null))==null?void 0:l.entity,d.entity.project):"the variable's data-type entity"}`;case oe.UnreachableEntity:return`${S(d.entity,d.entity.project)} is unreachable`;case se.DisconnectedCallableEntity:return`${S(d.entity,d.entity.project)} is disconnected and won't be executed by anything after publishing`;case se.AbstractEntityImplements:return`${S(d.entity,d.entity.project)} implements a non-template entity`;case se.AbstractExtendingNonAbstractEntity:return`${S(d.entity,d.entity.project)} extends a non-template entity`;case se.InvalidPropertiesCombination:return`${S(d.entity,d.entity.project)} has an invalid combination of properties`;case se.ExtendingNonInteractiveEntity:return`${S(d.entity,d.entity.project)} extends a non-interactive entity`;case se.ExtendsIncompatibleEntities:return`${S(d.entity,d.entity.project)} extends incompatible entities`;case se.ImplementingNonAbstractEntity:return`${S(d.entity,d.entity.project)} implements a non-template entity`;case se.ImplementsIncompatibleEntities:return`${S(d.entity,d.entity.project)} implements incompatible entities`;case se.LackingReturnStatementOnSomeBranches:return`${S(d.entity,d.entity.project)} has branches that don't terminate`;case se.LastCalledEntityMustBeReturnEntity:return`${S(d.entity,d.entity.project)} must end with a termination node`;case se.MissingRequiredValue:return`${S(d.entity,d.entity.project)} is missing a required value`;case se.NoPrimaryKeyProperty:return`${S(d.entity,d.entity.project)} has no primary key property`;case se.NonAbstractExtendingAbstractEntity:return`${S(d.entity,d.entity.project)} is a non-template entity extending a template entity`;case se.NonStaticExtendingStaticEntity:return`${S(d.entity,d.entity.project)} is a non-static entity extending a static entity`;case se.NonStaticImplementingStaticEntity:return`${S(d.entity,d.entity.project)} is a non-static entity implementing a static entity`;case se.StaticExtendingNonStaticEntity:return`${S(d.entity,d.entity.project)} is a static entity extending a non-static entity`;case se.StaticImplementingNonStaticEntity:return`${S(d.entity,d.entity.project)} is a static entity implementing a non-static entity`;case se.VariableReadsValueAndInternalCall:return`${S(d.entity,d.entity.project)} reads a value and has an internal call`;case se.VariableWritesValuesAndInternalCall:return`${S(d.entity,d.entity.project)} writes values and has an internal call`;case oe.EmptyName:return`${ss[d.entity.type]} has no name`;case oe.InvalidObjectStructure:return`${S(d.entity,d.entity.project)} has an invalid structure`;case oe.LoopBodyFunctionOverwrite:return`${S(d.entity,d.entity.project)}'s loop body action overwrites`;case oe.MethodOverwritesBaseMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites a base action with same implementation`;case oe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another action with same implementation`;case oe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another action with same implementation`;case oe.MissingCaller:return`${S(d.entity,d.entity.project)} is missing a caller`;case oe.NameAsResolvedCodeNameNotUniqueInScope:return`${S(d.entity,d.entity.project)} has a name that is not unique in the scope`;case oe.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${S(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case oe.NameMustStartWithLetterOrUnderscore:return`${S(d.entity,d.entity.project)} name must start with letter or underscore`;case oe.NoOverlapWithImplementedSignature:return`${S(d.entity,d.entity.project)} has no overlap with implemented signature`;case oe.PropertyOverwritesBasePropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites a base property with same implementation`;case oe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another property with same implementation`;case oe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another property with same implementation`;case oe.ReaderWriterIncompatibleDataType:return`${S(d.entity,d.entity.project)} has a reader/writer with incompatible data type`;case Pa.StatusCodeMustBeBetween100And599:return`${S(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case Pa.StatusCodeMustBeNumber:return`${S(d.entity,d.entity.project)} HTTP status code must be a number, between 100 and 599`;case qn.UUIDMustBeString:return`${S(d.entity,d.entity.project)} UUID must be a string, eg: "${hd()}"`;case qn.UUIDMustNotContainSpaces:return`${S(d.entity,d.entity.project)} UUID must not contain spaces, eg: "${hd()}"`;case qn.UUIDMustBeValidFormat:return`${S(d.entity,d.entity.project)} UUID must be in a valid format. Eg: "${hd()}"`;case hn.MustBeUniqueAmongSameEntities:return`${S(d.entity,d.entity.project)} value must be unique among the same kind`;case hn.StringValueMustNotHaveDashes:return`${S(d.entity,d.entity.project)} value must not contain dashes`;case hn.StringValueMustNotHaveSpaces:return`${S(d.entity,d.entity.project)} value must not contain spaces`;default:return`${S(d.entity,d.entity.project)} Error: ${Xc(d.code)}`}}var KA=(d=>(d.ValuesAlreadyConnected="values-already-connected",d.CannotReadMoreThanOneValue="cannot-read-more-than-one-value",d.CannotReadValueFromChildren="cannot-read-value-from-children",d.CannotWriteValueToChildren="cannot-write-value-to-children",d.CannotBeCalledByChildren="cannot-be-called-by-children",d.ExecutionsAlreadyConnected="executions-already-connected",d.DataTypesNotCompatible="data-types-not-compatible",d.CannotCallAncestor="cannot-call-ancestor",d.CannotConnectToItself="cannot-connect-to-itself",d.CannotWriteValueToAncestor="cannot-write-value-to-ancestor",d.NotInScope="not-in-scope",d.IsNotValueWrittingEntity="is-not-value-writting-entity",d.IsNotValueReadingEntity="is-not-value-reading-entity",d.ContinueOrBreakStatementCalledFromOutsideLoop="continue-or-break-statement-called-from-outside-loop",d.ElementInLoopBodyCallingOutsideLoop="element-in-loop-body-calling-outside-loop",d.CallerIsInHigherScope="caller-is-in-higher-scope",d.CallerIsInLowerScope="caller-is-in-lower-scope",d.CallIsInHigherScope="call-is-in-higher-scope",d.CallIsInLowerScope="call-is-in-lower-scope",d.OtherIncompatibleScopeReason="other-incompatible-scope-reason",d.SiblingInternalCallAlreadyUsedInParentVariable="sibling-internal-call-already-used-in-parent-variable",d.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees="error-output-map-cannot-be-connected-to-parent-success-branch-callees",d.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees="success-output-map-cannot-be-connected-to-parent-error-branch-callees",d))(KA||{});const nDe=Object.values(KA);var qA=(d=>(d.NotPartOfOngoingTest="not-part-of-ongoing-test",d.CannotBeAddedToTest="cannot-be-added-to-test",d))(qA||{});const sDe=Object.values(qA);var ZA=(d=>(d.Suggestion="suggestion",d.CanvasGloballyDisabled="canvas-globally-disabled",d.CannotInteractWithInputInVariableWithInternalCalls="cannot-interact-with-input-in-variable-with-internal-calls",d.CannotInteractWithOutputInVariableWithInternalCalls="cannot-interact-with-output-in-variable-with-internal-calls",d))(ZA||{});const aDe=Object.values(ZA);function lDe(d,u){const i=[...d,...u];return Array.from(new Set(i))}function oDe(d,u){const i=[...d,...u],a=Array.from(new Set(i));return{hasChanged:a.length!==d.length,reasons:a}}function dDe(d,u){const i=d.filter(l=>!u.includes(l));return{hasChanged:i.length!==d.length,reasons:i}}function uDe(d,u){return d.find(i=>i.entity.id===u)||null}function e9(d){return d.filter((u,i)=>d.indexOf(u)===i)}class Wr{constructor(u,i,a=null,l){_(this,"ids",[]);_(this,"entity");_(this,"entityCardHeight");_(this,"entityCardWidth");_(this,"index");_(this,"childEntities",[]);_(this,"children",[]);_(this,"parents",[]);_(this,"calculationEntryPoint");_(this,"_onlyEntities",null);_(this,"_changeSet",null);if(this.index=i,this.entity=u,this.calculationEntryPoint=a||this,this===this.calculationEntryPoint&&!l)throw new Error("Change set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(u,i,a){const l=Y7-FA-H7,c=S7-i0-GA;u.metaSync({x:u.x||l,y:u.y||c},i);const e=new Wr(u,0,null,i);e._onlyEntities=a||[],e.ids=["0"];const y=[];e.next(T=>{y.push(...T)}),Wr.recursivelyAssembleChildrenAreas(y),e.resolveChildrenOverlaps();const v=e.flattenChildEntities();return e._onlyEntities?v.filter(T=>(e._onlyEntities||[]).includes(T)):v}static recursivelyAssembleChildrenAreas(u){const i=[];u.forEach(a=>{a.next(l=>{i.push(...l)})}),i.length>0&&Wr.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(u){this.calculationEntryPoint._changeSet=u}findAreaInChildrenFromEntity(u){if(this.entity===u)return this;const i=this.children.find(l=>l.entity===u);return i||this.children.reduce((l,c)=>l||c.findAreaInChildrenFromEntity(u),null)}findAreaFromEntity(u){if(this.entity===u)return this;const i=this.calculationEntryPoint.children,a=i.find(c=>c.entity===u);return a||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(u),null)}addParent(u){if(!this.parents.includes(u)){const i=Wr.resolveIds(u,this.index);this.ids.push(...i),this.parents.push(u)}}static resolveIds(u,i){return u?u.ids.map(a=>`${a}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const u=ia(this.entity,!0);if(this.entity.type===p.Project){const i=[],a=[],l=[];u.forEach(e=>{if(p.DefinitionEntity===e.type){a.push(e);return}else if(Gt.includes(e.type)){l.push(e);return}i.push(e)});const c=i.sort((e,y)=>{const v=!!W0(e,y).length,T=ia(e),I=ia(y);return v?0:T.length&&!I.length?-1:!T.length&&I.length?1:0}).filter(e=>!Io(e).length);this.childEntities=[...a,...l,...c]}else{const i=[],a=[],l=[],c=[],e=[];Gr.includes(this.entity.type)&&J0(this.entity).forEach(T=>{if($t.includes(T.type)){l.push(T);return}const I=Pi(T);i.push(I)}),Qi.includes(this.entity.type)&&a.push(...this.entity.detachedChildren);const y=u.filter(v=>{const T=i.includes(v);return T||l.includes(v)||a.includes(v)?!1:$t.includes(v.type)?(l.push(v),!1):tn.includes(v.type)&&!T?(c.push(v),!1):v.type===p.DefinitionEntity?(e.push(v),!1):!0});i.sort((v,T)=>_d(v,T)?-1:0),c.sort((v,T)=>_d(v,T)?-1:0),l.sort((v,T)=>Yw(v,T)?1:Yw(T,v)?-1:0),this.childEntities=[...e,...i,...c,...y,...l,...a]}}calculateCardSize(){const u=Q7(this.entity);this.entityCardWidth=u.width,this.entityCardHeight=u.height}static getBoundriesOfTwoAreas(u,i){return{top:Math.min(u.top,i.top),left:Math.min(u.left,i.left),bottom:Math.max(u.bottom,i.bottom),right:Math.max(u.right,i.right)}}static getBoundriedOfCombinedAreas(u,i){const a=u.filter(c=>!i.includes(c));return a.reduce((c,e)=>i.includes(e)?c:Wr.getBoundriesOfTwoAreas(c,e.fullBranchArea),a[0].fullBranchArea)}getFullAreaUntilAny(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!u.includes(e)).map(e=>e.getFullAreaUntilAny(u)).reduce((e,y)=>Wr.getBoundriesOfTwoAreas(e,y),i)}getFullAreaUntilAreaOrAnyChildren(u){const i=[u,...u.flattenChildren()],a=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(u)).reduce((e,y)=>Wr.getBoundriesOfTwoAreas(e,y),a)}getFullAreaUntil(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==u).map(c=>c.getFullAreaUntil(u)).reduce((c,e)=>Wr.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const u=this.ownEntityPlusBufferArea;return this.children.map(l=>l.fullBranchArea).reduce((l,c)=>Wr.getBoundriesOfTwoAreas(l,c),u)}get ownEntityArea(){return{top:this.entity.y,left:this.entity.x,bottom:this.entity.y+this.entityCardHeight,right:this.entity.x+this.entityCardWidth}}get ownEntityPlusBufferArea(){const u=this.ownEntityArea;return{top:u.top,left:u.left,bottom:u.bottom+i0,right:u.right+FA}}static filterOutRepeatedAreas(u){return u.filter((i,a)=>u.indexOf(i)===a)}getEarliestId(u,i){const a=u.split("-"),l=i.split("-");return a.length<l.length?u:a.length>l.length?i:a.reduce((e,y,v)=>y<l[v]?u:i,u)}getEarliestLevel(){return this.ids.reduce((a,l)=>this.getEarliestId(a,l),this.ids[0]).split("-").length}countColumns(){let u=0;if(this!==this.calculationEntryPoint)u++;else return u;if(!this.parents.length)return u;const a=this.parents.reduce((l,c)=>c.getEarliestLevel()>l.getEarliestLevel()?c:l,this.parents[0]).countColumns();return u+=a,u}getLatestId(u,i){if(u===i)return u;const a=u.split("-"),l=i.split("-");return a.length<l.length?i:a.length>l.length?u:a.reduce((e,y,v)=>y>l[v]?u:i,u)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((a,l)=>this.getLatestId(a,l),this.ids[0]).split("-").length}smoothPosition(){const u=this.flattenSiblings();if(!u.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(a=>{a!==this.calculationEntryPoint&&a.shiftDownAlone(i)})}else if([...Gt].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=u.filter(a=>!this.parents.includes(a));i.length?i.every(l=>{const c=this.countColumns(),e=l.countColumns();return c>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(u,i){if(u.includes(this))return u;this.move(this.entity,{y:this.entity.y+i});let a=[...u,this];return this.children.forEach(l=>{if(Wr.getEarliestParentInChain(l)!==this)return;const e=uDe(a,l.entity.id);a=Wr.filterOutRepeatedAreas([...a]),e||(a=a.filter(v=>v!==l));const y=l.shiftDownUntilAny(a,i);a.push(...y)}),a}shiftRightUntilAny(u,i){u.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(a=>{const l=Wr.filterOutRepeatedAreas([...this.flattenSiblings(),...u]);Wr.getEarliestParentInChain(a)===this&&a.shiftRightUntilAny(l,i)}))}shiftRight(u){this.move(this.entity,{x:this.entity.x+u}),this.children.forEach(i=>{const l=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(l,u)})}shiftDownAlone(u){this.move(this.entity,{y:this.entity.y+u})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const u=this.parents.reduce((l,c)=>{const e=c.ownEntityArea,y=e.top+Zu,v={top:y,left:e.left,bottom:y,right:e.right};return Wr.getBoundriesOfTwoAreas(l,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-Zu;this.shiftDownAlone(a)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const u=this.children.reduce((l,c)=>{const e=c.ownEntityArea,y=e.top+Zu,v={top:y,left:e.left,bottom:y,right:e.right};return Wr.getBoundriesOfTwoAreas(l,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-Zu;return this.shiftDownAlone(a),a}resolveChildrenOverlaps(){const u=this.flattenChildren();let i=[];u.forEach(a=>{const l=a.adjustVerticallyToAvoidOverlaps();i.push(...l)}),u.forEach(a=>{a.smoothPosition()})}static getEarliestParentInChain(u){let i=u.parents[0];return u.parents.length&&(i=u.parents.sort((a,l)=>{if(!a.ids.length)return-1;if(!l.ids.length)return 1;const c=a.ids.sort((y,v)=>y.length<v.length?-1:0),e=l.ids.sort((y,v)=>y.length<v.length?-1:0);return c[0].length-e[0].length})[0]),i}flattenEarlierSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((a,l)=>{if(u.has(l.entity.id))return a;u.add(l.entity.id);const e=l.children.slice(0,l.children.indexOf(this)).reduce((y,v)=>[...y,v,...v.flattenChildren(u)],[]);return[...a,...e]},[])}flattenSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((a,l)=>{if(u.has(l.entity.id))return a;u.add(l.entity.id);const e=l.children.filter(y=>y!==this).reduce((y,v)=>[...y,v,...v.flattenChildren(u)],[]);return[...a,...e]},[])}flattenChildren(u=new Set){return this.children.reduce((i,a)=>u.has(a.entity.id)?i:(u.add(a.entity.id),[...i,a,...a.flattenChildren(u)]),[])}flattenParents(u=new Set){return this.parents.reduce((a,l)=>u.has(l.entity.id)?a:(u.add(l.entity.id),[...a,l,...l.flattenParents(u)]),[])}getAreaIfRendered(u){return this.calculationEntryPoint.flattenChildren().find(l=>l.entity.id===u.id)||null}getLowerSiblings(){const u=this.parents.reduce((i,a)=>{const l=a.children.indexOf(this),c=a.children.slice(l+1);return[...i,...c]},[]);return e9(u)}getLowerAreas(){const u=this.getLowerSiblings(),i=this.parents.reduce((a,l)=>[...a,...l.getLowerAreas()],[]);return e9([...u,...i])}adjustVerticallyToAvoidOverlaps(u=[]){const a=Wr.getEarliestParentInChain(this).children[this.index-1];if(!a)return u;const l=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...l,...c,a],T=C(e.flatMap(V=>W0(this.entity,V.entity))).filter(V=>V.id!==this.entity.id).map(V=>this.findAreaFromEntity(V)).filter(V=>!!V),I=this.getFullAreaUntilAny(T),b=a.getFullAreaUntilAny(T),D=e.reduce((V,M)=>M===this||M.fullBranchArea.left!==I.left?V:Math.max(V,M.fullBranchArea.bottom),b.bottom);if(I.top<D){const V=D-I.top+i0;return this.shiftDownUntilAny(u,V)}return u}move(u,i){(this.onlyEntities||[]).includes(u)&&u.metaSync(i,this.changeSet)}addChild(u){const i=this.childEntities[u];let a=null;i.x&&i.y?a=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),a||(a=new Wr(i,u,this.calculationEntryPoint));const l=this.ownEntityPlusBufferArea;this.children.includes(a)||(this.children.push(a),a.addParent(this));const c=a.fullBranchArea;if(c.left<l.right){const e=l.right-c.left;a.shiftRight(e)}return a}flattenChildEntities(u=new Set){return this.children.reduce((i,a)=>u.has(a.entity.id)?i:(u.add(a.entity.id),[...i,a.entity,...a.flattenChildEntities(u)]),[])}next(u){const i=[];this.childEntities.forEach((a,l)=>{const c=this.addChild(l);c&&i.push(c)}),u(i)}}var Qc=(d=>(d.Amazon="amazon",d.Google="google",d.Microsoft="microsoft",d))(Qc||{}),Wi=(d=>(d.RelationalDatabase="relational-database",d.CompiledLocalCodebase="compiled-local-codebase",d.CloudHostedCodebase="cloud-hosted-codebase",d.HttpApi="http-api",d.HttpEndpoint="http-endpoint",d.ServerlessFunction="serverless-function",d))(Wi||{}),WA=(d=>(d.Post="post",d.Get="get",d.Acknowledgement="acknowledgment",d.Progress="progress",d.Error="error",d.Complete="complete",d))(WA||{}),Td=(d=>(d.Queued="queued",d.Running="running",d.Success="success",d.Failed="failed",d.CleanedUp="cleaned-up",d.Skipped="skipped",d.AbortedByUser="aborted-by-user",d.UnrecoverableFailure="unrecoverable-failure",d.Reverted="reverted",d.UnpublishingStarted="unpublishing-started",d.Unpublished="unpublished",d))(Td||{}),HA=(d=>(d.Queued="queued",d.Running="running",d.Success="success",d.Failed="failed",d.CleanedUp="cleaned-up",d.UnrecoverableFailure="unrecoverable-failure",d.Reverted="reverted",d.UnpublishingStarted="unpublishing-started",d.Unpublished="unpublished",d))(HA||{}),bt=(d=>(d.ProjectNotFound="project-not-found",d.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",d.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",d.DeploymentCompleted="deployment-completed",d.DeploymentStarted="deployment-started",d.DeploymentFailed="deployment-failed",d.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",d.RequestPayloadValidationFailed="request-payload-validation-failed",d.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",d.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",d.ProjectAlreadyBeingPublished="project-already-being-published",d.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",d.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",d.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",d.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",d.CreatingNewRelationalDatabase="creating-new-relational-database",d.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",d.RelationalDatabaseAlreadyExists="relational-database-already-exists",d.RelationalDatabaseDeletionStarted="relational-database-deletion-started",d.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",d.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",d.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",d.HttpApiDeploymentStarted="http-api-deployment-started",d.HttpApiDeploymentCompleted="http-api-deployment-completed",d.HttpApiDeploymentFailed="http-api-deployment-failed",d.CreatingNewHttpApi="creating-new-http-api",d.HttpApiAlreadyExists="http-api-already-exists",d.HttpApiDeletionStarted="http-api-deletion-started",d.HttpApiDeletionCompleted="http-api-deletion-completed",d.HttpApiDeletionFailed="http-api-deletion-failed",d.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",d.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",d.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",d.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",d.BundlingCodebaseForDownload="bundling-codebase-for-download",d.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",d.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",d.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",d.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",d.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",d.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",d.CodeCompilationStarted="code-compilation-started",d.CodeCompilationCompleted="code-compilation-completed",d.CodeCompilationFailed="code-compilation-failed",d.BundleCodebaseStarted="bundle-codebase-started",d.BundleCodebaseCompleted="bundle-codebase-completed",d.BundleCodebaseFailed="bundle-codebase-failed",d.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",d.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",d.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",d.MigrateRelationalDatabaseStarted="migrate-relational-database-started",d.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",d.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",d.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",d.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",d.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",d))(bt||{}),Qs=(d=>(d.CodeCompilation="code-compilation",d.RelationalDatabaseDeployment="relational-database-deployment",d.RelationalDatabaseDeletion="relational-database-deletion",d.HttpApiDeployment="http-api-deployment",d.HttpApiDeletion="http-api-deletion",d.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",d.BundleCodebase="bundle-codebase",d.MigrateRelationalDatabase="migrate-relational-database",d.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",d.ExecutePublicationCompletedEvent="execute-publication-completed-event",d.CodebaseCleanup="codebase-cleanup",d))(Qs||{});Wi.CloudHostedCodebase,Wi.HttpApi,Wi.RelationalDatabase,Wi.CloudHostedCodebase,Wi.CloudHostedCodebase,Wi.RelationalDatabase,Wi.CloudHostedCodebase,Wi.CloudHostedCodebase;function t9(d){return`project-${d}-http-api`}function r0(d){return`entity-${d}-database`}class i9{constructor(u,i,a,l,c,e,y,v,T){_(this,"stepType");_(this,"id");_(this,"resourceType");_(this,"index");_(this,"dependency",[]);_(this,"lastEvent",null);_(this,"lastEventTimestamp",null);_(this,"status",Td.Queued);_(this,"publicationRun");_(this,"resource");this.stepType=u,this.id=i,this.resourceType=a,this.status=l,this.dependency=c,this.index=e,this.lastEventTimestamp=y,this.publicationRun=v,this.resource=T}toJSON(){return{stepType:this.stepType,id:this.id,resourceType:this.resourceType,index:this.index,status:this.status,dependency:this.dependency,lastEvent:this.lastEvent,resource:{resourceId:this.resource.resourceId,resourceType:this.resource.resourceType,provider:this.resource.provider,details:this.resource.details,status:this.resource.status,name:this.resource.name}}}async update(u){var i,a;this.status=u.status,this.dependency=u.dependency,this.index=u.index,this.stepType=u.stepType,this.resourceType=u.resourceType,this.lastEvent=u.lastEvent,this.id=u.id,(a=this.resource)==null||a.setDetails((i=u.resource)==null?void 0:i.details)}}var r9=(d=>(d.Ready="ready",d.Provisioning="provisioning",d.Queued="queued",d.ProvisioningFailed="provisioning-failed",d.Deleting="deleting",d.DeletingFailed="deleting-failed",d.Deleted="deleted",d))(r9||{});class Ed{constructor(u,i,a){_(this,"provisionedBy");_(this,"publicationRun");_(this,"resourceType");_(this,"provider");_(this,"resourceId");_(this,"details",null);_(this,"name",null);_(this,"status","queued");this.publicationRun=u,this.resourceType=i,this.provider=a}setDetails(u){this.details=u}setStatus(u){this.status=u}setProvisionedBy(u){this.provisionedBy=u}}class pDe extends Ed{constructor(i,a,l){super(i,Wi.HttpEndpoint,l);_(this,"resourceType",Wi.HttpEndpoint);_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,a;return this.resourceId=r0((a=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:a.id),this.resourceId}}class cDe extends Ed{constructor(i,a,l){super(i,Wi.ServerlessFunction,l);_(this,"resourceType",Wi.ServerlessFunction);_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,a;return this.resourceId=r0((a=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:a.id),this.resourceId}}class n9 extends Ed{constructor(i,a,l){super(i,Wi.HttpApi,l);_(this,"resourceType",Wi.HttpApi);_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=t9(this.publicationRun.project.id),this.resourceId}}class s9 extends Ed{constructor(i,a,l){super(i,Wi.RelationalDatabase,l);_(this,"resourceType",Wi.RelationalDatabase);_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,a;return this.resourceId=r0((a=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:a.id),this.resourceId}}class a9 extends Ed{constructor(i,a){super(i,Wi.CloudHostedCodebase,a);_(this,"resourceType",Wi.CloudHostedCodebase);_(this,"details",null);_(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class l9 extends Ed{constructor(i,a){super(i,Wi.CompiledLocalCodebase,a);_(this,"resourceType",Wi.CompiledLocalCodebase);_(this,"details",null);_(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`,this.resourceId}}class fDe{constructor(u,i){_(this,"id");_(this,"projectAutoIncrementPublicationCount");_(this,"projectPublishedSemanticVersion");_(this,"projectVersion");_(this,"projectId");_(this,"cloudProvider");_(this,"triggeredBy");_(this,"createdAt");_(this,"updatedAt");_(this,"status");_(this,"steps",[]);_(this,"editor");_(this,"explicitResources",new Map);_(this,"implicitGlobalResources",new Map);_(this,"finalGlobalEvent",null);_(this,"finalStatus",null);_(this,"contextType",Oe.PublicationRun);_(this,"extensionsRegistry");this.id=u.id,this.projectAutoIncrementPublicationCount=u.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=u.projectPublishedSemanticVersion,this.projectVersion=u.projectVersion,this.projectId=u.projectId,this.cloudProvider=u.cloudProvider,this.triggeredBy=u.triggeredBy,this.createdAt=u.createdAt,this.updatedAt=u.updatedAt,this.status=u.status,this.editor=i,this.initRegistry()}get off(){return this.extensionsRegistry.off}get on(){return this.extensionsRegistry.on}get emit(){return this.extensionsRegistry.emit}get emitAsync(){return this.extensionsRegistry.emitAsync}get emitAsyncAll(){return this.extensionsRegistry.emitAsyncAll}get emitAsyncAllSettled(){return this.extensionsRegistry.emitAsyncAllSettled}get emitAsyncSequentially(){return this.extensionsRegistry.emitAsyncSequentially}get emitAsyncSequentiallyAll(){return this.extensionsRegistry.emitAsyncSequentiallyAll}get emitAsyncSequentiallyAllSettled(){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled}get project(){return this.editor.project}getInfraTypes(u){return this.steps.filter(i=>u.includes(i.resourceType))}getStepsTypes(u){return this.steps.filter(i=>u.includes(i.stepType))}toIds(u){return u.map(i=>i.id)}getResourceForEntity(u){const i=Array.from(this.explicitResources.values()).find(a=>a.owners.has(u.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(Wi.CompiledLocalCodebase,new l9(this,Qc.Amazon)),this.implicitGlobalResources.set(Wi.CloudHostedCodebase,new a9(this,Qc.Amazon));const u=this.project.entities.filter(a=>cr(a,ce.HTTP_ENDPOINT)),i=this.project.entities.filter(a=>cr(a,ce.RELATIONAL_DATABASE));if(i.length&&i.forEach(a=>{const l=new s9(this,[a],Qc.Amazon);this.explicitResources.set(l.resourceId,l)}),u.length){const a=new n9(this,u,Qc.Amazon);this.explicitResources.set(a.resourceId,a)}}setSteps(u,i){u.forEach(a=>{this.addStep(a,i)}),this.editor.events.emit(bt.ProjectPublishRequestAcknowledged,{})}addStep(u,i){const a=u.dependency||[];if(a.length){const c=a.filter(e=>!this.steps.find(y=>y.id===e));if(c.length)throw new Error(`Missing dependencies: ${c.join(", ")}`)}if(!u.resource)throw new Error(`Resource not found for step ${u.stepType} (${u.id})`);if(!this.steps.find(c=>c.id===u.id)){const c=this.implicitGlobalResources.get(u.resourceType)||this.explicitResources.get(u.resource.resourceId),e=new i9(u.stepType,u.id,u.resourceType,u.status,a,u.index,i,this,c);this.steps.push(e)}}onUpdate(u){var i;if(Y.log("onUpdate",u),(i=u.payload)!=null&&i.stepType){const a=this.steps.find(l=>{var c;return l.id===((c=u.payload)==null?void 0:c.id)});a&&B(u.emittedAt).isAfter(B(a.lastEventTimestamp))&&a.update(u.payload)}this.editor.events.emit("publication-updated",{}),u.type===WA.Error?(this.finalStatus=HA.Failed,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-error",u)):u.type===WA.Complete&&(this.finalStatus=HA.Success,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-completed",u))}requestExtension(u){return this.extensionsRegistry.requestExtension(u)}async initRegistry(){return this.extensionsRegistry=new LA(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(Oe.PublicationRun),this.extensionsRegistry}}function yDe(d){switch(d){case Qs.CodeCompilation:return"Code generation";case Qs.RelationalDatabaseDeployment:return"Database creation";case Qs.HttpApiDeployment:return"HTTP gateway creation";case Qs.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case Qs.BundleCodebase:return"Bundle code";case Qs.MigrateRelationalDatabase:return"Database structure migration";case Qs.BusinessLogicCodebaseDeployment:return"Update servers with new code";case Qs.CodebaseCleanup:return"Code cleanup";case Qs.HttpApiDeletion:return"HTTP gateway deletion";case Qs.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function hDe(d){switch(d){case bt.DeploymentCompleted:return"Successfully published";case bt.DeploymentStarted:return"Publication started";case bt.DeploymentFailed:return"Publication failed";case bt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case bt.RequestPayloadValidationFailed:return"Request payload validation failed";case bt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case bt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case bt.RelationalDatabaseDeploymentStarted:return"Database creation started";case bt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case bt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case bt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case bt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case bt.RelationalDatabaseAlreadyExists:return"Database already exists";case bt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case bt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case bt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case bt.CreatingNewHttpApi:return"Creating new HTTP gateway";case bt.HttpApiAlreadyExists:return"HTTP gateway already exists";case bt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case bt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case bt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case bt.BundlingCodebaseForDownload:return"Bundling code for download";case bt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case bt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case bt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case bt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case bt.CodeCompilationStarted:return"Code generation started";case bt.CodeCompilationCompleted:return"Code generation completed";case bt.CodeCompilationFailed:return"Code generation failed";case bt.BundleCodebaseStarted:return"Code bundling started";case bt.BundleCodebaseCompleted:return"Code bundling completed";case bt.BundleCodebaseFailed:return"Code bundling failed";case bt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case bt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case bt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case bt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case bt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case bt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case bt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case bt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case bt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case bt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case bt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case bt.ProjectNotFound:return"Project not found";case bt.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case bt.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case bt.HttpApiDeletionStarted:return"HTTP gateway deletion started";case bt.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case bt.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case bt.RelationalDatabaseDeletionStarted:return"Database deletion started";case bt.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case bt.RelationalDatabaseDeletionFailed:return"Database deletion failed";case bt.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var o9=(d=>(d.NO_LOGIC="NO_LOGIC",d.NO_NAME="NO_NAME",d.NO_CHANGES="NO_CHANGES",d.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",d))(o9||{});function mDe(d){switch(d){case"NO_LOGIC":return"This project has no logic";case"NO_NAME":return"This project has no name";case"NO_CHANGES":return"This version has already been published";case"PROJECT_PUBLICATION_ALREADY_ONGOING":return"This project is already being published";default:return"Publishing is currently not available. Try again later"}}function vDe(d){switch(d){case Wi.RelationalDatabase:return"Relational database";case Wi.HttpEndpoint:case Wi.HttpApi:return"HTTP endpoints";case Wi.ServerlessFunction:case Wi.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function TDe(d){switch(d){case Td.Running:return"In progress";case Td.Failed:return"Failed";case Td.Success:return"Succeeded";case Td.Skipped:return"Skipped";case Td.Queued:default:return"Queued"}}function d9(d){var a;if(!cr(d,ce.EXTERNAL_INTEGRATION_CONNECTION))return null;let u=null;const i=pe["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(d.type===p.BuiltInBaseEntity?cr(d,ce.EXTERNAL_INTEGRATION_CONNECTION)&&(u=zA(d.name)):d.type===p.DefinitionEntity&&d.implements.forEach(l=>{if(cr(l,ce.EXTERNAL_INTEGRATION_CONNECTION)){const c=zA(l==null?void 0:l.name);if(c)return u=c,!0}}),!u){const l=d.properties.find(c=>!!c.implements.find(e=>e.id===i)||!!c.implements.find(e=>{var y;return((y=e.extends)==null?void 0:y.id)===i}));u=(a=l==null?void 0:l.getDefaultValue())==null?void 0:a.value}return u}function EDe(d){return cP[d]}function zA(d){return d.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?d.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function u9(d){if(d.type!==p.ActionDescriptor&&d.type!==p.Operation)throw new Error("Only ActionDescriptorState or OperationState can be used to resolve an external integration ID");if(d.type===p.ActionDescriptor){const u=d;if(u.id.startsWith("external-integration--"))return u.id.split("--")[1]}if(d.type===p.Operation){const u=d.declaration;if(Object.values(jt).includes(u.id))return u.id.split("--")[1]||null}return null}function bDe(d){if(!d)throw new Error("The integrationName parameter is required to resolve the base built-in name.");return Object.values(ce).find(i=>!!(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")&&i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===d.toLowerCase()))||null}function IDe(d){return d.type===p.BuiltInBaseEntity||d.type===p.DefinitionEntity?d9(d):d.type===p.ActionDescriptor||d.type===p.Operation?u9(d):null}function p9(d){var l,c,e;if(!cr(d,ce.EXTERNAL_INTEGRATION_CONNECTION))return null;let u=null;const i=vz(d,ce.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const a=pe["built-in-base-entity"][i.id].properties.connectionId.id;if(d.type===p.BuiltInBaseEntity){if(cr(d,ce.EXTERNAL_INTEGRATION_CONNECTION)){const y=d.properties.find(v=>{var T;return((T=v.extends)==null?void 0:T.id)===a});y&&(u=(l=y.getDefaultValue())==null?void 0:l.value)}}else if(d.type===p.DefinitionEntity){const y=d.properties.find(v=>!!v.implements.find(T=>T.id===a)||!!v.implements.find(T=>{var I;return((I=T.extends)==null?void 0:I.id)===a}));if(!y&&((c=d.extends)==null?void 0:c.type)===p.DefinitionEntity)return p9(d.extends);u=(e=y==null?void 0:y.getDefaultValue())==null?void 0:e.value}return u}function c9(d){var l;(l=d.dataType)==null||l.validate(),d.inputs.forEach(c=>c.validate()),d.outputs.forEach(c=>c.validate()),d.internalCalls.forEach(c=>c.validate());const i=[...ml(d),...gd(d),...f9(d),...vl(d),...y9(d)],a=Uw(d);return i.push(...a),xi(d.errors,i)}function f9(d,u){const a=[...d.project.getVariableDeclarations()].filter(l=>l.id!==d.id);return py(d,[Bi],a,u)}function y9(d){const u=[];if(d.parent!==d.project)return u;if(d.catchesError){const i=_t({id:`${d.id}--${oe.GlobalVariableDeclarationCannotCatchError}`,message:`${ss[d.type].singular} "${S(d,d.project)}" with id "${d.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:ee.Error,code:oe.GlobalVariableDeclarationCannotCatchError,entity:d});u.push(i.error)}if(d.errorCalls.length){const i=_t({id:`${d.id}--${oe.GlobalVariableDeclarationCannotCallOnError}`,message:`${ss[d.type].singular} "${S(d,d.project)}" with id "${d.id}" cannot call other entities from its error branch because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:ee.Error,code:oe.GlobalVariableDeclarationCannotCallOnError,entity:d});u.push(i.error)}if(d.calledBy.length){const i=_t({id:`${d.id}--${oe.GlobalVariableDeclarationCannotBeCalled}`,message:`${ss[d.type].singular} "${S(d,d.project)}" with id "${d.id}" cannot be called because it is globally declared. Global variable declarations must be self initialized when the project is loaded, and not be called for initialization.`,severity:ee.Error,code:oe.GlobalVariableDeclarationCannotBeCalled,entity:d});u.push(i.error)}return[]}const ADe=Object.freeze(Object.defineProperty({__proto__:null,validate:c9,validateGlobalVariableDeclaration:y9,validateVariableDeclarationName:f9},Symbol.toStringTag,{value:"Module"}));function h9(d){d.inputs.forEach(l=>l.validate()),d.outputs.forEach(l=>l.validate()),d.internalCalls.forEach(l=>l.validate());const i=[...ml(d),...gd(d),...vl(d)],a=Uw(d);return i.push(...a),xi(d.errors,i)}const wDe=Object.freeze(Object.defineProperty({__proto__:null,validate:h9},Symbol.toStringTag,{value:"Module"}));var JA=(d=>(d.Parent="parent",d.DataTypeEntity="data-type-entity",d.VarDeclaration="var-declaration",d))(JA||{});const Xt=class Xt extends pr{constructor(i,a){super(i);_(this,"initialData");_(this,"id");_(this,"x");_(this,"y");_(this,"type",p.VariableInstance);_(this,"catchesError",!1);_(this,"defaultValue",null);_(this,"writesValues",[]);_(this,"readsValue",null);_(this,"declaration");_(this,"inputs",[]);_(this,"outputs",[]);_(this,"error",null);_(this,"calledBySuccess",[]);_(this,"calledByError",[]);_(this,"calledByEntry",[]);_(this,"successCalls",[]);_(this,"errorCalls",[]);_(this,"internalCalls",[]);_(this,"project");_(this,"errors",[]);_(this,"parent");_(this,"detachedDependents",{});_(this,"knownVersions",null);_(this,"activeVersion",!1);_(this,"initialized",!1);_(this,"startedInitialization",!1);_(this,"suggestion",!1);_(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=a,this.id=i.id,this.x=i.x,this.y=i.y,this.catchesError=i.catchesError||!1}static new(i=null){return{id:L.UUID.uuid(),version:L.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||L.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.VariableInstance,catchesError:!0,declaration:null,internalCalls:[],successCalls:[],errorCalls:[],readsValue:null,writesValues:[],defaultValue:null,inputs:[],outputs:[],parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],error:null,x:0,y:0}}static fromGenerationTarget(i,a){let l=a;if(i.parent){const V=te(i.parent);l=a.get(V)}const c=te(i.declaration),e=a.get(c),y=i.calledByEntry.map(V=>{const M=te(V);return a.get(M)}),v=i.calledBySuccess.map(V=>{const M=te(V);return a.get(M)}),T=i.calledByError.map(V=>{const M=te(V);return a.get(M)});let I=null;if(i.readsValue){const V=te(i.readsValue);I=a.get(V)}const b={id:i.id,version:L.UUID.uuid(),createdAt:B().toISOString(),author:L.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.VariableInstance,catchesError:i.catchesError||!1,declaration:e.toReference(),calledByEntry:y,calledBySuccess:v,calledByError:T,defaultValue:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:I,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:l},D=ne(b,a);return D.setParent(l,null),D}static validateGenerationTarget(i,a){let l=JSON.parse(JSON.stringify(i));const c=[],e=xr(l,{parent:{list:!1,types:[...Qi,p.Project],optional:!0},declaration:{list:!1,types:[p.VariableDeclaration]}},a);return l=e.modifiedData,c.push(...e.errors,...rr(l)),{errors:c,modifiedData:l}}get codeName(){var i;return(i=this.declaration)==null?void 0:i.codeName}get codeNativeValueValidation(){var i;return this._codeNativeValueValidation||((i=this.declaration)==null?void 0:i.codeNativeValueValidation)||null}validateGeneratedUpdate(i){const a=[];let l=JSON.parse(JSON.stringify(i));const c=Cd(l,this);return l=c.modifiedData,a.push(...c.errors),i.parent&&a.push(new de({id:`${this.id}--${H.InvalidParentUpdate}`,code:H.InvalidParentUpdate,severity:ee.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
72
+ `+c):a.stack=c}catch{}}throw a}}_request(u,i){typeof u=="string"?(i=i||{},i.url=u):i=u||{},i=vd(this.defaults,i);const{transitional:a,paramsSerializer:l,headers:c}=i;a!==void 0&&zm.assertOptions(a,{silentJSONParsing:wa.transitional(wa.boolean),forcedJSONParsing:wa.transitional(wa.boolean),clarifyTimeoutError:wa.transitional(wa.boolean)},!1),l!=null&&(ge.isFunction(l)?i.paramsSerializer={serialize:l}:zm.assertOptions(l,{encode:wa.function,serialize:wa.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),zm.assertOptions(i,{baseUrl:wa.spelling("baseURL"),withXsrfToken:wa.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=c&&ge.merge(c.common,c[i.method]);c&&ge.forEach(["delete","get","head","post","put","patch","common"],M=>{delete c[M]}),i.headers=Xs.concat(e,c);const y=[];let v=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(i)===!1||(v=v&&x.synchronous,y.unshift(x.fulfilled,x.rejected))});const T=[];this.interceptors.response.forEach(function(x){T.push(x.fulfilled,x.rejected)});let I,b=0,D;if(!v){const M=[Gq.bind(this),void 0];for(M.unshift.apply(M,y),M.push.apply(M,T),D=M.length,I=Promise.resolve(i);b<D;)I=I.then(M[b++],M[b++]);return I}D=y.length;let V=i;for(b=0;b<D;){const M=y[b++],x=y[b++];try{V=M(V)}catch(q){x.call(this,q);break}}try{I=Gq.call(this,V)}catch(M){return Promise.reject(M)}for(b=0,D=T.length;b<D;)I=I.then(T[b++],T[b++]);return I}getUri(u){u=vd(this.defaults,u);const i=$q(u.baseURL,u.url,u.allowAbsoluteUrls);return Aq(i,u.params,u.paramsSerializer)}}ge.forEach(["delete","get","head","options"],function(u){Jm.prototype[u]=function(i,a){return this.request(vd(a||{},{method:u,url:i,data:(a||{}).data}))}}),ge.forEach(["post","put","patch"],function(u){function i(a){return function(c,e,y){return this.request(vd(y||{},{method:u,headers:a?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}Jm.prototype[u]=i(),Jm.prototype[u+"Form"]=i(!0)});const Ym=Jm;class PA{constructor(u){if(typeof u!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(c){i=c});const a=this;this.promise.then(l=>{if(!a._listeners)return;let c=a._listeners.length;for(;c-- >0;)a._listeners[c](l);a._listeners=null}),this.promise.then=l=>{let c;const e=new Promise(y=>{a.subscribe(y),c=y}).then(l);return e.cancel=function(){a.unsubscribe(c)},e},u(function(c,e,y){a.reason||(a.reason=new qu(c,e,y),i(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(u){if(this.reason){u(this.reason);return}this._listeners?this._listeners.push(u):this._listeners=[u]}unsubscribe(u){if(!this._listeners)return;const i=this._listeners.indexOf(u);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const u=new AbortController,i=a=>{u.abort(a)};return this.subscribe(i),u.signal.unsubscribe=()=>this.unsubscribe(i),u.signal}static source(){let u;return{token:new PA(function(l){u=l}),cancel:u}}}const k_e=PA;function F_e(d){return function(i){return d.apply(null,i)}}function K_e(d){return ge.isObject(d)&&d.isAxiosError===!0}const $A={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries($A).forEach(([d,u])=>{$A[u]=d});const q_e=$A;function Kq(d){const u=new Ym(d),i=lq(Ym.prototype.request,u);return ge.extend(i,Ym.prototype,u,{allOwnKeys:!0}),ge.extend(i,u,null,{allOwnKeys:!0}),i.create=function(l){return Kq(vd(d,l))},i}const Br=Kq(RA);Br.Axios=Ym,Br.CanceledError=qu,Br.CancelToken=k_e,Br.isCancel=_q,Br.VERSION=kq,Br.toFormData=km,Br.AxiosError=Ft,Br.Cancel=Br.CanceledError,Br.all=function(u){return Promise.all(u)},Br.spread=F_e,Br.isAxiosError=K_e,Br.mergeConfig=vd,Br.AxiosHeaders=Xs,Br.formToJSON=d=>Cq(ge.isHTMLForm(d)?new FormData(d):d),Br.getAdapter=jq.getAdapter,Br.HttpStatusCode=q_e,Br.default=Br;const Z_e=Br;class qq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get($i.Addition);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const e=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)}).reduce((y,v)=>y+v,0);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Zq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get($i.Subtraction);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const e=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)}).reduce((y,v)=>y-v,0);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Wq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get($i.Multiplication);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const e=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)}).reduce((y,v)=>y*v,1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Hq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get($i.Division);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),[c,e]=l;if(e===0)throw new Error("Division by zero is not allowed");const y=c/e;return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class zq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get($i.Remainder);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),[c,e]=l;if(e===0)throw new Error("Division by zero is not allowed");const y=c%e;return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Jq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get($i.Exponentiation);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),[c,e]=l,y=Math.pow(c,e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Yq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateRandomInteger);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1],y=hge(c,e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Sq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateRandomFloat);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=iq();return{value:X.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Xq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateRandomHexadecimal);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0],e=rq(c);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Qq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateRandomBase62);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0],e=nq(c);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class e7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateRandomBase64);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0],e=vge(c);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class t7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateRandomAlphanumeric);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0],e=sq(c);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class i7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateIdentifier);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1],y=aq(c,e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class r7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateRandomUUIDv4);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=hd();return{value:X.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class n7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{Y.log("Initializing Random Generate Short Identifier Module");const a=i.find(l=>l.contextType===Oe.Logic);if(a){Y.log("Project state found, setting up operation");const l=a.get(Ze.GenerateShortIdentifier);l?(Y.log("Operation found, setting autoexecutable and implementation"),l.autoexecutable=!0,l.implementation=this.module.main):Y.warn("Operation generate-short-identifier not found in project state")}else Y.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,a)=>{try{const l=Tge();return{value:X.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class s7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ze.GenerateHexadecimalToken);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=Ege();return{value:X.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class a7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.Join);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],y=l.slice(1).join(c);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class l7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT,version:"1.0.0",description:"String split operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.Split);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1],y=c.split(e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class o7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST,version:"1.0.0",description:"String delete last operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.DeleteLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.slice(0,-1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class d7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST,version:"1.0.0",description:"String delete first operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.DeleteFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.slice(1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class u7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.Reverse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.split("").reverse().join("");return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class p7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.ToLowerCase);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.toLowerCase();return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class c7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.ToUpperCase);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.toUpperCase();return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class f7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.DeleteIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>=c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const y=c.slice(0,e)+c.slice(e+1);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class y7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.AddIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const v=c.slice(0,e)+y+c.slice(e);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class h7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST,version:"1.0.0",description:"String replace first operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.ReplaceFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const v=c.replace(e,y);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class m7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST,version:"1.0.0",description:"String replace last operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.ReplaceLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(I=>{var b,D;return((b=I.value)==null?void 0:b.valueAsType)||((D=I.value)==null?void 0:D.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const v=c.lastIndexOf(e);if(v===-1)return{value:X.Success,error:null,result:c};const T=c.slice(0,v)+c.slice(v).replace(e,y);return{value:X.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class v7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.ReplaceIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>=c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const v=c.slice(0,e)+y+c.slice(e+1);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class T7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_SINGLE_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.ReplaceSingleMatch);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const v=c.replace(e,y);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class E7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.ReplaceAllMatches);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const v=c.split(e).join(y);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class b7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.GetIndexItem);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const y=c.charAt(e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class I7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST,version:"1.0.0",description:"String get first operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.GetFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.charAt(0);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class A7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST,version:"1.0.0",description:"String get last operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.GetLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.charAt(c.length-1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class w7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.GetIndexOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const y=c.indexOf(e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class R7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.Append);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const y=c+e;return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class C7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Je.Prepend);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const y=e+c;return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class g7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.Join);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)});if(!l||l.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No input lists provided",result:null};if(!l.every(v=>Array.isArray(v)))return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"All inputs must be arrays",result:null};const c=l[0],y=l.slice(1).reduce((v,T)=>Array.isArray(T)?v.concat(T):v,c);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class _7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.Split);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const y=c.slice(0,e),v=c.slice(e);return{value:X.Success,error:null,result:[y,v]}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class D7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.Reverse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c.slice().reverse();return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class O7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST,version:"1.0.0",description:"List delete last operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.DeleteLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c.slice(0,-1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class P7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST,version:"1.0.0",description:"List delete first operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.DeleteFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c.slice(1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class $7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.AddIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const v=[...c.slice(0,e),y,...c.slice(e)];return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class N7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.ReplaceIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>=c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const v=[...c];return v[e]=y,{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class V7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST,version:"1.0.0",description:"List replace first operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.ReplaceFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(I=>{var b,D;return((b=I.value)==null?void 0:b.valueAsType)||((D=I.value)==null?void 0:D.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const v=c.indexOf(e);if(v===-1)return{value:X.Success,error:null,result:c};const T=[...c];return T[v]=y,{value:X.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class L7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST,version:"1.0.0",description:"List replace last operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.ReplaceLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(I=>{var b,D;return((b=I.value)==null?void 0:b.valueAsType)||((D=I.value)==null?void 0:D.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const v=c.lastIndexOf(e);if(v===-1)return{value:X.Success,error:null,result:c};const T=[...c];return T[v]=y,{value:X.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class B7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.GetIndexItem);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>=c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const y=c[e];return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class M7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.GetFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c[0];return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class x7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.GetLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c[c.length-1];return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class U7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.Append);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const y=[...c,e];return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class j7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(dt.Prepend);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const y=[e,...c];return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class G7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_PARALLEL,version:"1.0.0",description:"Execution parallel operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ei.Parallel);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(b=>{var D,V;return((D=b.value)==null?void 0:D.valueAsType)||((V=b.value)==null?void 0:V.value)})[0];if(!c)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(c))return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const y=this.extensionsRegistry.requestContexts(this,[Oe.Editor])[0],T=c.map(b=>{const D=new so(y.logic,[b],b,null,this.extensionsRegistry);return D.inheritValuesFromContext(y),D}).map(b=>b.execute()),I=await Promise.all(T);return{value:X.Success,error:null,result:I}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class k7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SEQUENTIAL,version:"1.0.0",description:"Execution sequential operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ei.Sequential);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(c))return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const e=[];for(let y=0;y<c.length;y++){const v=c[y],I=this.extensionsRegistry.requestContexts(this,[Oe.Editor])[0],b=new so(I.logic,[v],v,null,this.extensionsRegistry);b.inheritValuesFromContext(I);const D=await b.execute();e.push(D)}return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class F7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(Ei.Wait);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(e=>{var y,v;return((y=e.value)==null?void 0:y.valueAsType)||((v=e.value)==null?void 0:v.value)})[0];return typeof c!="number"||c<0?{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Invalid wait time provided",result:null}:(await new Promise(e=>setTimeout(e,c)),{value:X.Success,error:null,result:null})}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class K7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(mr.Validate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)});Y.log("Inputs for entity validation: ",l);const e=Hb(l[1]).safeParse(l[0]);return e.success?{value:X.Success,error:null,result:{data:l[0]}}:{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:e.error.errors,result:null}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class q7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:rt.High,permissions:[lt.All],contexts:[Oe.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Oe.Logic);if(a){const l=a.get(pn.HttpRequest);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[3]||{},e={method:l[0],url:l[1],params:l[2],headers:c,data:l[4]};Y.log("Axios request config: ",e);const y=await Z_e(e);return{value:X.Success,error:null,result:{status:y.status,headers:y.headers,data:y.data}}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class NA extends Bm{constructor(u,i,a=i.projectId){super(u,Oe.Editor),this._editor=i,this.id=a}get ready(){return this._editor.ready}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 branch(){return this._editor.branch}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 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 PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}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(){return this._editor.removeTest()}async copyEntities(u){return this._editor.copyEntities(u)}resolveInitialChildrenPositions(u,i,a){return this._editor.resolveInitialChildrenPositions(u,i,a)}publish(){return this._editor.publish()}loadActivePublication(u){return this._editor.loadActivePublication(u)}requestActiveDynamicValue(u,i=!1){return this._editor.requestActiveDynamicValue(u,i)}}function W_e(d,u){return u instanceof NA?u:new NA(d,u)}class VA extends Bm{constructor(u,i){super(u,Oe.PublicationRun),this._publicationRun=i}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get projectVersion(){return this._publicationRun.projectVersion}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 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 H_e(d,u){return u instanceof VA?u:new VA(d,u)}function z_e(d){d.register(new tq(d)),d.register(new eq(d)),d.register(new YK(d)),d.register(new XK(d)),d.register(new QK(d)),d.register(new SK(d)),d.register(new qq(d)),d.register(new Zq(d)),d.register(new Wq(d)),d.register(new zq(d)),d.register(new Hq(d)),d.register(new Jq(d)),d.register(new Yq(d)),d.register(new Sq(d)),d.register(new Xq(d)),d.register(new Qq(d)),d.register(new e7(d)),d.register(new t7(d)),d.register(new i7(d)),d.register(new r7(d)),d.register(new n7(d)),d.register(new s7(d)),d.register(new a7(d)),d.register(new l7(d)),d.register(new o7(d)),d.register(new d7(d)),d.register(new u7(d)),d.register(new p7(d)),d.register(new c7(d)),d.register(new f7(d)),d.register(new y7(d)),d.register(new h7(d)),d.register(new m7(d)),d.register(new v7(d)),d.register(new T7(d)),d.register(new E7(d)),d.register(new b7(d)),d.register(new I7(d)),d.register(new A7(d)),d.register(new w7(d)),d.register(new R7(d)),d.register(new C7(d)),d.register(new g7(d)),d.register(new _7(d)),d.register(new D7(d)),d.register(new O7(d)),d.register(new P7(d)),d.register(new $7(d)),d.register(new N7(d)),d.register(new V7(d)),d.register(new L7(d)),d.register(new B7(d)),d.register(new M7(d)),d.register(new x7(d)),d.register(new U7(d)),d.register(new j7(d)),d.register(new G7(d)),d.register(new k7(d)),d.register(new F7(d)),d.register(new K7(d)),d.register(new q7(d))}class LA{constructor(u=new Gu){_(this,"extensionsRegistry",new Map);_(this,"initialized",new Set);_(this,"initializedContexts",new Set);_(this,"onResolveEditorContextCallback",()=>null);_(this,"onResolveProjectLogicContextCallback",()=>null);_(this,"onResolveEditorGUIContextCallback",()=>null);_(this,"onResolveCompileContextCallback",()=>null);_(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.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||rt.Normal)-(i.manifest.initPriority||rt.Normal))}async setup(){z_e(this),Y.log("Initializing extensions without context..."),this.initForReady()}requestContext(u){switch(u){case Oe.Editor:return this.onResolveEditorContextCallback();case Oe.Logic:return this.onResolveProjectLogicContextCallback();case Oe.EditorGUI:return this.onResolveEditorGUIContextCallback();case Oe.Compile:return this.onResolveCompileContextCallback();case Oe.PublicationRun:return this.onResolvePublicationRunContextCallback();default:throw new Error(`Unknown context type: ${u}`)}}requestContexts(u,i=[]){const a=[];i.length===0&&(i=u.manifest.contexts);for(const l of i){const c=this.requestContext(l);c&&a.push(c)}return a}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 a of this.extensionInOrder)if(a.module.init&&!this.initialized.has(a.manifest.id)){const l=a.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);l.length&&(await((i=(u=a.module).init)==null?void 0:i.call(u,l)),this.initialized.add(a.manifest.id))}else!a.module.init&&!this.initialized.has(a.manifest.id)&&this.initialized.add(a.manifest.id)}async initForReady(){Y.log("Initializing extensions for ready contexts...");for(const u of this.extensionInOrder)if(u.module.init&&!this.initialized.has(u.manifest.id)){Y.log("Initializing "+u.manifest.id+" extension...");const i=this.requestContexts(u);u.manifest.contexts.every(l=>!!i.find(c=>c.contextType===l))?(await u.module.init(i),this.initialized.add(u.manifest.id)):Y.warn(`Skipping initialization of ${u.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${u.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(l=>l.contextType).join(", ")}`)}else!u.module.init&&!this.initialized.has(u.manifest.id)?(Y.log("Set "+u.manifest.id+" extension as initialized by default..."),this.initialized.add(u.manifest.id)):Y.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)){Y.warn(`Context ${u} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(u),u){case Oe.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case Oe.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}Y.log(`Context ${u} is now available. Initializing extensions for this context...`),await this.initForReady()}}let Sm=null;const BA={requestExtension:d=>(Sm||(Sm=new LA,Sm.setup()),Sm.requestExtension(d))},no={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var MA=(d=>(d.FinishedSuccess="finished-success",d.FinishedError="finished-error",d.Running="running",d.Paused="paused",d.Stopped="stopped",d.NotStarted="not-started",d))(MA||{});const Z7={...BA};class so extends Gu{constructor(i,a,l,c=null,e=Z7){super();_(this,"project");_(this,"entryPoint");_(this,"state","not-started");_(this,"events",new Gu);_(this,"entities",[]);_(this,"parentExecution",null);_(this,"executing",[]);_(this,"executed",[]);_(this,"skipped",[]);_(this,"scheduled",[]);_(this,"localTestValues");_(this,"resolvedValues");_(this,"persistedExecutionResults");_(this,"lastExecutionResults");_(this,"onAddToSkippedListCallback",null);_(this,"onRemoveFromSkippedListCallback",null);_(this,"onAddEntityCallback",null);_(this,"onRemoveEntityCallback",null);_(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=a,this.entryPoint=l,this.project=i,this.parentExecution=c,this.localTestValues=new kc(L.UUID.uuid(),this.project),this.resolvedValues=new kc(L.UUID.uuid(),this.project),this.persistedExecutionResults=new kc(L.UUID.uuid(),this.project),this.lastExecutionResults=new kc(L.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults}}skip(i){this.hasEntity(i)&&(this.removeFromScheduledList(i),!this.skipped.includes(i)&&(this.skipped.push(i),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(i),Gr.includes(i.type)&&ht(i).forEach(a=>this.skip(a))))}async schedule(i,a,l){if(this.hasExecuted(i))return null;if(Gt.includes(i.type))return this.executeBranch(i,l,a);if(tn.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,l,a);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,a){const l=[];return[...mi,...Gt].includes(a.type)?l.push(...a.inputs):xt.includes(a.type)&&l.push(...a.outputs),l.map(e=>{var v;let y=i.find(T=>T.valueOwner.id===e.id);if(y)return y;if(!y&&Gt.includes(a.type)&&(y=i.find(T=>{var I;return((I=T.valueOwner.declaration)==null?void 0:I.id)===e.id})),y){const T=(v=y.value)==null?void 0:v.clone(null);return T==null||T.setStandaloneParent(e),{...y,valueOwner:e,value:T||null,inheritanceLink:{sources:[y],target:e}}}return Xn.includes(e.type)?Aa(e,this.valueResolutionContext):cd(e,this.valueResolutionContext)}).reduce((e,y)=>{const v=Ys(y==null?void 0:y.valueOwner,this.project),T=y?[y]:[];return v.forEach(I=>{var V,M,x;if(I.id===(y==null?void 0:y.valueOwner.id))return;const b=it(I.getDataType(null),I,this.project);b==null||b.metaSync({value:(V=y==null?void 0:y.value)==null?void 0:V.value},null),b==null||b.setValueAsTypeList(((M=y==null?void 0:y.value)==null?void 0:M.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((x=y==null?void 0:y.value)==null?void 0:x.valueAsTypeSingle)||null);const D={...y,valueOwner:I,value:b};T.push(D)}),[...e,...T]},[]).sort((e,y)=>e.valueOwner.index-y.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,a,l,c={}){var y,v;const e={...no,...c};try{let T={value:X.Success,error:null,result:null};if(a.sort((I,b)=>I.valueOwner.index-b.valueOwner.index),Object.values(dr).includes(i.declaration.id)){const I=this.parentContext.requestExtension(ku+i.declaration.id).module.main;I?T=await I(i,a):Y.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{T=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,a,l,e);let I=null;if(T.error){Y.warn("Raw error executing entity: ",T.error);const b=(y=i.error)==null?void 0:y.getDataType(null),D=it(b||null,i.error,l);b!=null&&b.asType?D==null||D.setValueAsTypeSingle(T.error):D==null||D.metaSync({value:T.error},null),I={valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:D}}return{value:T.value,entity:i,error:I,result:{value:T.result||null,valueOwner:i,type:Ce.ExecutionResult,inheritanceLink:null}}}return{...T,entity:i}}catch(T){Y.warn("Internal call execution error: ",T);let I=null;if(i.error){const b=(v=i.error)==null?void 0:v.getDataType(null),D=it(b,i.error,l);b!=null&&b.asType?D==null||D.setValueAsTypeSingle(T):D==null||D.metaSync({value:T},null),I={valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:D}}return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:I,result:null}}}static async executeOperation(i,a,l){var c,e;try{let y={value:X.Success,error:null,result:null};a.sort((b,D)=>b.valueOwner.index-D.valueOwner.index),i.declaration.implementation&&(y=await i.declaration.implementation(i,a));let v=null;if(y.error&&i.error){Y.warn("Raw error executing entity: ",y.error);const b=((c=i.error)==null?void 0:c.getDataType(null))||null,D=it(b,i.error,l);b!=null&&b.asType?D==null||D.setValueAsTypeSingle(y.error):D==null||D.metaSync({value:y.error},null),v={valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:D}}const T=i==null?void 0:i.getDataType(null),I=it(T,i,l);return T!=null&&T.asType?I==null||I.setValueAsTypeSingle(y.result):I==null||I.metaSync({value:y.result},null),{value:y.value,entity:i,error:v,result:{value:I||null,valueOwner:i,type:Ce.ExecutionResult,inheritanceLink:null}}}catch(y){Y.warn("Operation execution error: ",y);let v=null;if(i.error){const T=(e=i.error)==null?void 0:e.getDataType(null),I=it(T,i.error,l);T!=null&&T.asType?I==null||I.setValueAsTypeSingle(y):I==null||I.metaSync({value:y},null),v={valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:I}}return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:v,result:null}}}async executeSearch(i,a,l){var c;try{let e={value:X.Success,error:null,result:null};const y=await(await this.parentContext.requestExtension(ot.SEARCH_NODE_IMPLEMENTATION)).module.main(i,a),v=i==null?void 0:i.getDataType(null),T=it(v,i,l);return T==null||T.metaSync({value:{data:y.data}},null),y.error?{value:X.UnhandledError,entity:i,error:{valueOwner:i,type:Ce.ExecutionResult,inheritanceLink:null,value:T},result:null}:{value:e.value,entity:i,error:null,result:{value:T,valueOwner:i,type:Ce.ExecutionResult,inheritanceLink:null}}}catch(e){if(Y.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:null,result:null};const y=(c=i.error)==null?void 0:c.getDataType(null),v=it(y,i.error,l);return v==null||v.metaSync({value:e},null),{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:v},result:null}}}async executeLoop(i,a,l,c={}){var y,v,T,I,b,D;const e={...no,...c};try{let V={value:X.Success,error:null,result:null};const M=a.map(ae=>{var J,fe;return((J=ae==null?void 0:ae.value)==null?void 0:J.valueAsType)||((fe=ae==null?void 0:ae.value)==null?void 0:fe.value)});let x={};i.getUniqueInputMaps().forEach(ae=>{const J=i.body.inputs.find(me=>S(me,l)===S(ae,l)),fe=ae==null?void 0:ae.getDataType(null),le=it(fe,J,l);fe!=null&&fe.asType?le==null||le.setValueAsTypeList([]):le==null||le.metaSync({value:[]},null),this.lastExecutionResults.writeValue(J,le);const ye={value:le,valueOwner:J,type:Ce.ExecutionResult,inheritanceLink:null};x[J.id]=ye});let Z={value:X.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case pe.loop["counted-loop"].id:{const ae=M[0];let J=1;for(;J<=ae&&J<=50;){const fe=i.body.inputs.map(le=>{if(le===i.currentIterationNumberArgumentDeclaration){const ye=i.currentIterationNumberArgumentDeclaration.getDataType(null),me=Ad(ye),Q=this.lastExecutionResults.readValue(le.id);if(Q){Q.metaSync({value:J},null),this.lastExecutionResults.writeValue(le,Q);const $e={value:Q,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null};return x[le.id]=$e,$e}const ue={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:J,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:me,standaloneParent:le.toReference()},Ee=Ci(ue,l);this.lastExecutionResults.writeValue(le,Ee);const _e={value:Ee,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null};return x[le.id]=_e,_e}else return x[le.id]}).filter(le=>!!le);if(Z=await this.executeFullFunctionDeclarationLogic(i.body,fe,e),(Z.results||[]).forEach(le=>{var ue,Ee,_e,$e;if(le.valueOwner.type!==p.InputMap||xt.includes(le.valueOwner.parent.type))return;const ye=i.body.inputs.find(Ie=>S(Ie,l)===S(le.valueOwner,l)),Q=[...((Ee=(ue=x==null?void 0:x[ye.id])==null?void 0:ue.value)==null?void 0:Ee.value)||[],((_e=le==null?void 0:le.value)==null?void 0:_e.value)||null];($e=x[ye.id].value)==null||$e.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ye,x[ye.id].value)}),[X.CaughtError,X.Break,X.Return].includes(Z.value))break;J++}break}case pe.loop["manual-flow-loop"].id:{let ae=1;for(;ae<=50;){const J=i.body.inputs.map(fe=>{if(fe===i.currentIterationNumberArgumentDeclaration){const le=this.lastExecutionResults.readValue(fe.id);if(le){le.metaSync({value:ae},null),this.lastExecutionResults.writeValue(fe,le);const ue={value:le,valueOwner:fe,type:Ce.ExecutionResult,inheritanceLink:null};return x[fe.id]=ue,ue}const ye=i.currentIterationNumberArgumentDeclaration.getDataType(null),me=it(ye,fe,l);return me==null||me.metaSync({value:ae},null),this.lastExecutionResults.writeValue(fe,me),{value:me,valueOwner:fe,type:Ce.ExecutionResult,inheritanceLink:null}}else return x[fe.id]}).filter(fe=>!!fe);if(Z=await this.executeFullFunctionDeclarationLogic(i.body,J,e),(Z.results||[]).forEach(fe=>{var Q,ue,Ee;if(fe.valueOwner.type!==p.InputMap||xt.includes(fe.valueOwner.parent.type))return;const le=i.body.inputs.find(_e=>S(_e,l)===S(fe.valueOwner,l)),me=[...(Q=x[le.id].value)==null?void 0:Q.value,((ue=fe.value)==null?void 0:ue.value)||null];(Ee=x[le.id].value)==null||Ee.metaSync({value:me},null),this.lastExecutionResults.writeValue(le,x[le.id].value)}),[X.CaughtError,X.Break,X.Return].includes(Z.value))break;ae++}break}case pe.loop["list-loop"].id:{const ae=M[0];let J=1;const fe=ae;for(let le=0;le<fe.length;le++){const ye=fe[le],me=i.body.inputs.map(Q=>{if(Q===i.currentIterationNumberArgumentDeclaration){const ue=this.lastExecutionResults.readValue(Q.id);if(ue)return ue.metaSync({value:J},null),this.lastExecutionResults.writeValue(Q,ue),{value:ue,valueOwner:Q,type:Ce.ExecutionResult,inheritanceLink:null};const Ee=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=it(Ee,Q,l);return _e==null||_e.metaSync({value:J},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null}}else if(Q===i.currentValueArgumentDeclaration){const ue=i.currentValueArgumentDeclaration.getDataType(null),Ee=Ad(ue),_e=this.lastExecutionResults.readValue(Q.id);if(_e)return _e.metaSync({value:ye},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:Q,type:Ce.ExecutionResult,inheritanceLink:null};const $e={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:ye,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ee,standaloneParent:Q.toReference()},Ie=Ci($e,l);return this.lastExecutionResults.writeValue(Q,Ie),{value:Ie,valueOwner:i.currentValueArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null}}else return x[Q.id]}).filter(Q=>!!Q);if(Z=await this.executeFullFunctionDeclarationLogic(i.body,me,e),(Z.results||[]).forEach(Q=>{var $e,Ie,Re;if(Q.valueOwner.type!==p.InputMap||xt.includes(Q.valueOwner.parent.type))return;const ue=i.body.inputs.find(je=>S(je,l)===S(Q.valueOwner,l)),_e=[...($e=x[ue.id].value)==null?void 0:$e.value,((Ie=Q.value)==null?void 0:Ie.value)||null];(Re=x[ue.id].value)==null||Re.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ue,x[ue.id].value)}),[X.CaughtError,X.Break,X.Return].includes(Z.value))break;J++}break}case pe.loop["object-keys-loop"].id:{const ae=M[0];let J=1;const fe=ae?Object.keys(ae):[];for(let le=0;le<fe.length;le++){const ye=fe[le],me=i.body.inputs.map(Q=>{if(Q===i.currentIterationNumberArgumentDeclaration){const ue=this.lastExecutionResults.readValue(Q.id);if(ue)return ue.metaSync({value:J},null),this.lastExecutionResults.writeValue(Q,ue),{value:ue,valueOwner:Q,type:Ce.ExecutionResult,inheritanceLink:null};const Ee=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=it(Ee,Q,l);return _e==null||_e.metaSync({value:J},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null}}else if(Q===i.currentValueArgumentDeclaration){const ue=i.currentValueArgumentDeclaration.getDataType(null),Ee=Ad(ue),_e=this.lastExecutionResults.readValue(Q.id);if(_e)return _e.metaSync({value:ye},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:Q,type:Ce.ExecutionResult,inheritanceLink:null};const $e={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:ye,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ee,standaloneParent:Q.toReference()},Ie=Ci($e,l);return this.lastExecutionResults.writeValue(Q,Ie),{value:Ie,valueOwner:i.currentValueArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null}}else return x[Q.id]}).filter(Q=>!!Q);if(Z=await this.executeFullFunctionDeclarationLogic(i.body,me,e),(Z.results||[]).forEach(Q=>{var $e,Ie,Re;if(Q.valueOwner.type!==p.InputMap||xt.includes(Q.valueOwner.parent.type))return;const ue=i.body.inputs.find(je=>S(je,l)===S(Q.valueOwner,l)),_e=[...($e=x[ue.id].value)==null?void 0:$e.value,((Ie=Q.value)==null?void 0:Ie.value)||null];(Re=x[ue.id].value)==null||Re.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ue,x[ue.id].value)}),[X.CaughtError,X.Break,X.Return].includes(Z.value))break;J++}break}case pe.loop["object-values-loop"].id:{const ae=M[0];let J=1;const fe=ae?Object.values(ae):[];for(let le=0;le<fe.length;le++){const ye=fe[le],me=i.body.inputs.map(Q=>{if(Q===i.currentIterationNumberArgumentDeclaration){const ue=this.lastExecutionResults.readValue(Q.id);if(ue)return ue.metaSync({value:J},null),this.lastExecutionResults.writeValue(Q,ue),{value:ue,valueOwner:Q,type:Ce.ExecutionResult,inheritanceLink:null};const Ee=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=it(Ee,Q,l);return _e==null||_e.metaSync({value:J},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null}}else if(Q===i.currentValueArgumentDeclaration){const ue=i.currentValueArgumentDeclaration.getDataType(null),Ee=Ad(ue),_e=this.lastExecutionResults.readValue(Q.id);if(_e)return _e.metaSync({value:ye},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:Q,type:Ce.ExecutionResult,inheritanceLink:null};const $e={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:ye,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ee,standaloneParent:Q.toReference()},Ie=Ci($e,l);return this.lastExecutionResults.writeValue(Q,Ie),{value:Ie,valueOwner:i.currentValueArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null}}else return x[Q.id]}).filter(Q=>!!Q);if(Z=await this.executeFullFunctionDeclarationLogic(i.body,me,e),(Z.results||[]).forEach(Q=>{var $e,Ie,Re;if(Q.valueOwner.type!==p.InputMap||xt.includes(Q.valueOwner.parent.type))return;const ue=i.body.inputs.find(je=>S(je,l)===S(Q.valueOwner,l)),_e=[...($e=x[ue.id].value)==null?void 0:$e.value,((Ie=Q.value)==null?void 0:Ie.value)||null];(Re=x[ue.id].value)==null||Re.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ue,x[ue.id].value)}),[X.CaughtError,X.Break,X.Return].includes(Z.value))break;J++}break}case pe.loop["string-loop"].id:{const ae=M[0];let J=1;const fe=ae.split("");for(let le=0;le<fe.length;le++){const ye=fe[le],me=i.body.inputs.map(Q=>{if(Q===i.currentIterationNumberArgumentDeclaration){const ue=this.lastExecutionResults.readValue(Q.id);if(ue)return ue.metaSync({value:J},null),this.lastExecutionResults.writeValue(Q,ue),{value:ue,valueOwner:Q,type:Ce.ExecutionResult,inheritanceLink:null};const Ee=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=it(Ee,Q,l);return _e==null||_e.metaSync({value:J},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null}}else if(Q===i.currentValueArgumentDeclaration){const ue=i.currentValueArgumentDeclaration.getDataType(null),Ee=Ad(ue),_e=this.lastExecutionResults.readValue(Q.id);if(_e)return _e.metaSync({value:ye},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:Q,type:Ce.ExecutionResult,inheritanceLink:null};const $e={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:ye,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ee,standaloneParent:Q.toReference()},Ie=Ci($e,l);return this.lastExecutionResults.writeValue(Q,Ie),{value:Ie,valueOwner:i.currentValueArgumentDeclaration,type:Ce.ExecutionResult,inheritanceLink:null}}else return x[Q.id]}).filter(Q=>!!Q);if(Z=await this.executeFullFunctionDeclarationLogic(i.body,me,e),(Z.results||[]).forEach(Q=>{var $e,Ie,Re;if(Q.valueOwner.type!==p.InputMap||xt.includes(Q.valueOwner.parent.type))return;const ue=i.body.inputs.find(je=>S(je,l)===S(Q.valueOwner,l)),_e=[...($e=x[ue.id].value)==null?void 0:$e.value,((Ie=Q.value)==null?void 0:Ie.value)||null];(Re=x[ue.id].value)==null||Re.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ue,x[ue.id].value)}),[X.CaughtError,X.Break,X.Return].includes(Z.value))break;J++}break}}if(V={value:[X.CaughtError,X.Return].includes(Z.value)?Z.value:X.Success,error:((v=(y=Z.error)==null?void 0:y.value)==null?void 0:v.value)||null,result:((I=(T=Z==null?void 0:Z.result)==null?void 0:T.value)==null?void 0:I.value)||null},V.error&&i.error){const ae=(b=i.error)==null?void 0:b.getDataType(null),J=it(ae||null,i.error,l);ae!=null&&ae.asType?J==null||J.setValueAsTypeSingle(V.error):J==null||J.metaSync({value:V.error},null);const fe={valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:J};return{value:V.value,entity:i,error:fe,result:null}}const W=i==null?void 0:i.getDataType(null),z=it(W,i,l);return W!=null&&W.asType?z==null||z.setValueAsTypeSingle(V.result):z==null||z.metaSync({value:V.result},null),{value:V.value,entity:i,error:null,result:{value:z||null,valueOwner:i,type:Ce.ExecutionResult,inheritanceLink:null}}}catch(V){if(Y.warn("Error executing loop: ",V),i.error){const M=(D=i.error)==null?void 0:D.getDataType(null),x=it(M,i.error,l);return M!=null&&M.asType?x==null||x.setValueAsTypeSingle(V):x==null||x.metaSync({value:V},null),{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:x},result:null}}else return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,a,l,c={}){var y,v;const e={...no,...c};try{let T={value:X.Success,error:null,result:null};T=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,a,l,e);let I=null;if(T.error&&i.error){Y.warn("Raw error executing entity: ",T.error);const b=(y=i.error)==null?void 0:y.getDataType(null),D=it(b||null,i.error,l);b!=null&&b.asType?D==null||D.setValueAsTypeSingle(T.error):D==null||D.metaSync({value:T.error},null),I={valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:D}}return{value:T.value,entity:i,error:I,result:T.result}}catch(T){if(!i.error)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:null,result:null};const I=(v=i.error)==null?void 0:v.getDataType(null),b=it(I,i.error,l);return I!=null&&I.asType?b==null||b.setValueAsTypeSingle(T):b==null||b.metaSync({value:T},null),{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ce.ExecutionResult,inheritanceLink:null,value:b},result:null}}}async executeCondition(i,a){var c,e,y,v,T,I,b,D,V,M,x,q,Z,W,z,ae,J,fe,le,ye,me,Q,ue,Ee,_e,$e,Ie,Re,je,Ve,Be,Ke,ct,tt,Mt,Dt,Ti,Ki,Si,an,Cr,qt,gi,cs,fs,Ry,Vd,Cy;let l=!1;switch(i.declaration.id){case Ar.Empty:{l=!((e=(c=a[0])==null?void 0:c.value)!=null&&e.value);break}case Ar.NotEmpty:{l=!!((v=(y=a[0])==null?void 0:y.value)!=null&&v.value);break}case ut.Equal:{if([ie.String,ie.Number,ie.Boolean,ie.Null,ie.Enum,ie.Date,ie.UUID].includes((I=(T=a[0])==null?void 0:T.value)==null?void 0:I.name)){l=((D=(b=a[0])==null?void 0:b.value)==null?void 0:D.value)===((M=(V=a[1])==null?void 0:V.value)==null?void 0:M.value);break}if(((q=(x=a[0])==null?void 0:x.value)==null?void 0:q.name)===ie.KeyValue||((W=(Z=a[0])==null?void 0:Z.value)==null?void 0:W.name)===ie.Untyped){const $a=(ae=(z=a[0])==null?void 0:z.value)==null?void 0:ae.value,Ur=(fe=(J=a[1])==null?void 0:J.value)==null?void 0:fe.value;l=JSON.stringify($a)===JSON.stringify(Ur);break}break}case ut.NotEqual:{if([ie.String,ie.Number,ie.Boolean,ie.Null,ie.Enum,ie.Date,ie.UUID].includes((ye=(le=a[0])==null?void 0:le.value)==null?void 0:ye.name)){l=((Q=(me=a[0])==null?void 0:me.value)==null?void 0:Q.value)!==((Ee=(ue=a[1])==null?void 0:ue.value)==null?void 0:Ee.value);break}if((($e=(_e=a[0])==null?void 0:_e.value)==null?void 0:$e.name)===ie.Untyped||((Re=(Ie=a[0])==null?void 0:Ie.value)==null?void 0:Re.name)===ie.KeyValue){const $a=(Ve=(je=a[0])==null?void 0:je.value)==null?void 0:Ve.value,Ur=(Ke=(Be=a[1])==null?void 0:Be.value)==null?void 0:Ke.value;l=JSON.stringify($a)!==JSON.stringify(Ur);break}break}case ut.MoreThanOrEqual:{l=((tt=(ct=a[0])==null?void 0:ct.value)==null?void 0:tt.value)>=((Dt=(Mt=a[1])==null?void 0:Mt.value)==null?void 0:Dt.value);break}case ut.MoreThan:{l=((Ki=(Ti=a[0])==null?void 0:Ti.value)==null?void 0:Ki.value)>((an=(Si=a[1])==null?void 0:Si.value)==null?void 0:an.value);break}case ut.LessThanOrEqual:{l=((qt=(Cr=a[0])==null?void 0:Cr.value)==null?void 0:qt.value)<=((cs=(gi=a[1])==null?void 0:gi.value)==null?void 0:cs.value);break}case ut.LessThan:{l=((Ry=(fs=a[0])==null?void 0:fs.value)==null?void 0:Ry.value)<((Cy=(Vd=a[1])==null?void 0:Vd.value)==null?void 0:Cy.value);break}case Gi.And:{l=(await Promise.all(i.andChildrenGroup.map(async Ur=>{const hp=this.mergeExernalValuesWithInternalInputs(a,Ur);return(await this.executeCondition(Ur,hp)).value===X.Success}))).every(Ur=>Ur);break}case Gi.Or:{l=(await Promise.all(i.orChildrenGroup.map(async Ur=>{const hp=this.mergeExernalValuesWithInternalInputs(a,Ur);return(await this.executeCondition(Ur,hp)).value===X.Success}))).some(Ur=>Ur);break}}return{value:l?X.Success:X.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,a,l,c={}){const e={...no,...c,onBeforeEntityExecution:(T,I,b)=>{var D;return((D=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:D.call(c,T,I,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(T,I,b)=>{var D;return((D=c==null?void 0:c.onEntityExecuted)==null?void 0:D.call(c,T,I,{...b,detached:!0}))||Promise.resolve()}},y=new so(l,[i,...ev(i)],i,this,this.parentContext);return y.inheritValuesFromContext(this),await y.execute(e,a)}async executeFullFunctionDeclarationLogic(i,a,l={}){const c={...no,...l},e=ev(i);e.forEach(T=>{this.addEntity(T)}),e.reduce((T,I)=>xt.includes(I.type)?[...T,...I.outputs]:mi.includes(I.type)&&I.type!==p.Condition?[...T,...I.outputs,...I.inputs]:I.type===p.Condition?[...T,...I.inputs]:T,[]).forEach(T=>{this.lastExecutionResults.removeValue(T.id)});const v=await this.executeBranch(i,c,a);return{...v||{},value:(v==null?void 0:v.value)||X.Success,entity:i,error:(v==null?void 0:v.error)||null,result:(v==null?void 0:v.result)||null}}static async executeEntryPointEntity(i,a){return{value:X.Success,entity:i,error:null,result:null}}async executeReturnStatement(i,a){var y,v,T,I,b,D,V;if((y=i.throws)!=null&&y.readsValue){const M=Aa(i.throws,this.valueResolutionContext);return{value:X.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Ce.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=Aa(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let M={};if(((v=c==null?void 0:c.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)bi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(I=l==null?void 0:l.value)==null?void 0:I.value}),l==null||l.value.metaSync({value:M},null);else{const x=it(c,i,this.project);x==null||x.metaSync({value:M},null),l={valueOwner:i,type:Ce.ExecutionResult,inheritanceLink:null,value:x}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(x=>{var q,Z;if(((q=x.declaration)==null?void 0:q.type)===p.Property&&x.declaration.static){const W=this.lastExecutionResults.readValue(x.declaration.id),z=S(x,this.project),ae=x.codeName||((Z=x.declaration)==null?void 0:Z.codeName)||Bi(z);if(W)W.metaSync({value:M[ae]},null),this.lastExecutionResults.writeValue(x.declaration,W);else{const J=it(x.getDataType(null),x,this.project);J==null||J.metaSync({value:M[ae]},null),this.lastExecutionResults.writeValue(x.declaration,J)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&bi((D=l.value)==null?void 0:D.value)?((V=l.value)==null?void 0:V.value)||{}:{};return i.outputs.map(M=>{var W;const x=M.codeName||((W=M.declaration)==null?void 0:W.codeName)||Bi(S(M,this.project)),q=e[x],Z=it(M.getDataType(null),M,this.project);Z==null||Z.metaSync({value:q},null),Ce.ExecutionResult}),l.type=Ce.ExecutionResult,{value:X.Return,entity:i,error:null,result:l}}async executeContinueStatement(i,a){var y,v,T,I,b,D,V;if((y=i.throws)!=null&&y.readsValue){const M=Aa(i.throws,this.valueResolutionContext);return{value:X.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Ce.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=Aa(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let M={};if(((v=c==null?void 0:c.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)bi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(I=l==null?void 0:l.value)==null?void 0:I.value}),l==null||l.value.metaSync({value:M},null);else{const x=it(c,i,this.project);x==null||x.metaSync({value:M},null),l={valueOwner:i,type:Ce.ExecutionResult,inheritanceLink:null,value:x}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(x=>{var q,Z;if(((q=x.declaration)==null?void 0:q.type)===p.Property&&x.declaration.static){const W=this.lastExecutionResults.readValue(x.declaration.id),z=S(x,this.project),ae=x.codeName||((Z=x.declaration)==null?void 0:Z.codeName)||Bi(z);if(W)W.metaSync({value:M[ae]},null),this.lastExecutionResults.writeValue(x.declaration,W);else{const J=it(x.getDataType(null),x,this.project);J==null||J.metaSync({value:M[ae]},null),this.lastExecutionResults.writeValue(x.declaration,J)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&bi((D=l.value)==null?void 0:D.value)?((V=l.value)==null?void 0:V.value)||{}:{};return i.outputs.map(M=>{var W;const x=M.codeName||((W=M.declaration)==null?void 0:W.codeName)||Bi(S(M,this.project)),q=e[x],Z=it(M.getDataType(null),M,this.project);Z==null||Z.metaSync({value:q},null),Ce.ExecutionResult}),l.type=Ce.ExecutionResult,{value:X.Continue,entity:i,error:null,result:l}}async executeBreakStatement(i,a){var y,v,T,I,b,D,V;if((y=i.throws)!=null&&y.readsValue){const M=Aa(i.throws,this.valueResolutionContext);return{value:X.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Ce.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=Aa(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let M={};if(((v=c==null?void 0:c.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)bi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(I=l==null?void 0:l.value)==null?void 0:I.value}),l==null||l.value.metaSync({value:M},null);else{const x=it(c,i,this.project);x==null||x.metaSync({value:M},null),l={valueOwner:i,type:Ce.ExecutionResult,inheritanceLink:null,value:x}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(x=>{var q,Z;if(((q=x.declaration)==null?void 0:q.type)===p.Property&&x.declaration.static){const W=this.lastExecutionResults.readValue(x.declaration.id),z=S(x,this.project),ae=x.codeName||((Z=x.declaration)==null?void 0:Z.codeName)||Bi(z);if(W)W.metaSync({value:M[ae]},null),this.lastExecutionResults.writeValue(x.declaration,W);else{const J=it(x.getDataType(null),x,this.project);J==null||J.metaSync({value:M[ae]},null),this.lastExecutionResults.writeValue(x.declaration,J)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&bi((D=l.value)==null?void 0:D.value)?((V=l.value)==null?void 0:V.value)||{}:{};return i.outputs.map(M=>{var W;const x=M.codeName||((W=M.declaration)==null?void 0:W.codeName)||Bi(S(M,this.project)),q=e[x],Z=it(M.getDataType(null),M,this.project);Z==null||Z.metaSync({value:q},null),Ce.ExecutionResult}),l.type=Ce.ExecutionResult,{value:X.Break,entity:i,error:null,result:l}}async executeVariable(i,a){var v,T,I,b,D,V;let l=Aa(i,this.valueResolutionContext);const c=nn(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let M={};if(((v=e==null?void 0:e.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...e.entity.getActiveRawDefaultValue()}),l!=null&&l.value)bi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(I=l==null?void 0:l.value)==null?void 0:I.value}),l==null||l.value.metaSync({value:M},null);else{const x=it(e,i,this.project);x==null||x.metaSync({value:M},null),l={valueOwner:c,type:Ce.ExecutionResult,inheritanceLink:null,value:x}}this.lastExecutionResults.writeValue(c,l.value),c.inputs.forEach(x=>{var q,Z;if(((q=x.declaration)==null?void 0:q.type)===p.Property&&x.declaration.static){const W=this.lastExecutionResults.readValue(x.declaration.id),z=S(x,this.project),ae=x.codeName||((Z=x.declaration)==null?void 0:Z.codeName)||Bi(z);if(W)W.metaSync({value:M[ae]},null),this.lastExecutionResults.writeValue(x.declaration,W);else{const J=it(x.getDataType(null),x,this.project);J==null||J.metaSync({value:M[ae]},null),this.lastExecutionResults.writeValue(x.declaration,J)}}})}else this.lastExecutionResults.writeValue(c,l==null?void 0:l.value);const y=(b=l==null?void 0:l.value)!=null&&b.value&&bi((D=l.value)==null?void 0:D.value)?((V=l.value)==null?void 0:V.value)||{}:{};return i.outputs.map(M=>{var W;const x=M.codeName||((W=M.declaration)==null?void 0:W.codeName)||Bi(S(M,this.project)),q=y[x],Z=it(M.getDataType(null),M,this.project);Z==null||Z.metaSync({value:q},null),Ce.ExecutionResult}),l.type=Ce.ExecutionResult,{value:X.Success,entity:i,error:null,result:l}}mergeValues(i,a){const l=[];for(let c=0;c<a.length;c++)i!=null&&i[c]?l.push(i[c]):l.push(a[c]);return l}async executeEntity(i,a=[],l={}){var y,v,T,I,b,D,V,M,x,q,Z;const c={...no,...l},e={detached:!1};switch(i.type){case p.Condition:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((y=c.onBeforeEntityExecution)==null?void 0:y.call(c,i,W,e)),this.executeCondition(i,W)}case p.InternalCall:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((v=c.onBeforeEntityExecution)==null?void 0:v.call(c,i,W,e)),this.executeInternalCall(i,W,this.project)}case p.Operation:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((T=c.onBeforeEntityExecution)==null?void 0:T.call(c,i,W,e)),so.executeOperation(i,W,this.project)}case p.VariableInstance:case p.VariableDeclaration:return this.executeVariable(i,a);case p.FunctionCall:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((I=c.onBeforeEntityExecution)==null?void 0:I.call(c,i,W,e)),this.executeFunctionCall(i,W,this.project)}case p.FunctionDeclaration:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((b=c.onBeforeEntityExecution)==null?void 0:b.call(c,i,W,e)),so.executeEntryPointEntity(i,W)}case p.Search:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((D=c.onBeforeEntityExecution)==null?void 0:D.call(c,i,W,e)),this.executeSearch(i,W,this.project)}case p.Loop:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((V=c.onBeforeEntityExecution)==null?void 0:V.call(c,i,W,e)),this.executeLoop(i,W,this.project,c)}case p.ReturnStatement:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((M=c.onBeforeEntityExecution)==null?void 0:M.call(c,i,W,e)),this.executeReturnStatement(i,W)}case p.ContinueStatement:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((x=c.onBeforeEntityExecution)==null?void 0:x.call(c,i,W,e)),this.executeContinueStatement(i,W)}case p.BreakStatement:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((q=c.onBeforeEntityExecution)==null?void 0:q.call(c,i,W,e)),this.executeBreakStatement(i,W)}case p.GlobalEvent:{const W=this.mergeExernalValuesWithInternalInputs(a,i);return await((Z=c.onBeforeEntityExecution)==null?void 0:Z.call(c,i,W,e)),so.executeEntryPointEntity(i,W)}default:throw new Error(`Entity type ${i==null?void 0:i.type} is not recognized for execution.`)}}storeLastExecutionValues(i){var l,c,e;if(i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value),!i.result||!((l=i.result)!=null&&l.valueOwner))return;const a=Ys((c=i.result)==null?void 0:c.valueOwner,this.project);(e=i.result)!=null&&e.value?a.forEach(y=>{var v;this.lastExecutionResults.writeValue(y,(v=i.result)==null?void 0:v.value)}):a.forEach(y=>{this.lastExecutionResults.removeValue(y.id)})}async executeBranch(i,a={},l=[]){var T;const c={...no,...a},e={detached:!1};if(!this.hasEntity(i)||this.hasSkipped(i))return null;this.addToExecutingList(i),this.hasScheduled(i)&&this.removeScheduled(i);const v=await this.executeEntity(i,l,c);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(v),await((T=c.onEntityExecuted)==null?void 0:T.call(c,i,v,e)),v.value===X.Success){const I=(i.successCalls||i.calls||[]).filter(x=>this.hasEntity(x));(i.errorCalls||[]).forEach(x=>{this.skip(x)});let D=[];const V=(await Promise.all(I.map(x=>this.schedule(x,[],c)))).filter(x=>!!x),M=V.filter(x=>!!x).find(x=>x.value===X.CaughtError||x.value===X.Return||x.value===X.Break||x.value===X.Continue);return M||(D=[...D,...V],v)}else if(v.value===X.CaughtError||v.value===X.ConditionNotMet){const I=(i.errorCalls||[]).filter(x=>this.hasEntity(x));(i.successCalls||i.calls||[]).forEach(x=>{this.skip(x)});let D=[];const V=(await Promise.all(I.map(x=>this.schedule(x,[],c)))).filter(x=>!!x),M=V.filter(x=>!!x).find(x=>x.value===X.CaughtError||x.value===X.UnhandledError||x.value===X.Return||x.value===X.Break||x.value===X.Continue);return M||(D=[...D,...V],v)}else{if(v.value===X.UnhandledError)return this.executing.forEach(I=>{this.skip(I)}),this.scheduled.forEach(I=>{this.skip(I)}),Gr.includes(v.entity.type)&&ht(v.entity).forEach(I=>{this.skip(I)}),v;if(v.value===X.Return)return v;if(v.value===X.Break)return v;if(v.value===X.Continue)return v}return v}async execute(i={},a=[]){const l={...no,...i};this.state="running";const c=await this.executeBranch(this.entryPoint,l,a);return this.state="finished-success",c}addEntity(i){var a;this.entities.includes(i)||(this.entities.push(i),(a=this.onAddEntityCallback)==null||a.call(this,i))}addEntities(i){i.forEach(a=>this.addEntity(a))}removeEntity(i){var a;if(i!==this.entryPoint){const l=this.entities.indexOf(i);l>-1&&(this.entities.splice(l,1),(a=this.onRemoveEntityCallback)==null||a.call(this,i))}}hasEntity(i){var c,e,y;if(this.entities.includes(i))return!0;if(((c=i.parent)==null?void 0:c.type)===p.FunctionDeclaration&&((y=(e=i.parent)==null?void 0:e.parent)==null?void 0:y.type)===p.DefinitionEntity)return this.entities.includes(i.parent);const a=Pi(i);if(!a)return!1;const l=a.type===p.Loop&&i.parent===a.body?a.body:null;return l?this.entities.includes(l)||this.entities.includes(a):this.entities.includes(a)}removeScheduled(i){const a=this.scheduled.indexOf(i);a>-1&&this.scheduled.splice(a,1)}hasScheduled(i){return!!this.scheduled.includes(i)}hasSkipped(i){return!!this.skipped.includes(i)}hasExecuted(i){return!!this.executed.includes(i)}hasEntityWithId(i){const a=this.project.get(i);return a?this.hasEntity(a):!1}onAddToSkippedList(i){this.onAddToSkippedListCallback=i}onAbortExecution(i){this.onAbortExecutionCallback=i}onAddEntity(i){this.onAddEntityCallback=i}onRemoveFromSkippedList(i){this.onRemoveFromSkippedListCallback=i}onRemoveEntity(i){this.onRemoveEntityCallback=i}addToExecutingList(i){this.executing.includes(i)||this.executing.push(i)}addToScheduledList(i){this.scheduled.includes(i)||this.scheduled.push(i)}removeFromScheduledList(i){const a=this.scheduled.indexOf(i);a>-1&&this.scheduled.splice(a,1)}removeFromExecutingList(i){var l;const a=this.executing.indexOf(i);a>-1&&(this.executing.splice(a,1),(l=this.onAbortExecutionCallback)==null||l.call(this,i))}removeFromAlreadyExecutedList(i){const a=this.executed.indexOf(i);a>-1&&this.executed.splice(a,1)}removeFromSkippedList(i){var l;const a=this.skipped.indexOf(i);a>-1&&(this.skipped.splice(a,1),(l=this.onRemoveFromSkippedListCallback)==null||l.call(this,i))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var a;this.skipped.includes(i)||(this.skipped.push(i),(a=this.onAddToSkippedListCallback)==null||a.call(this,i))}}function J_e(d){var u,i;if(d.isList)return"list";if(((u=d.entity)==null?void 0:u.type)===p.DefinitionEntity)return"definition-entity";switch((i=d.entity)==null?void 0:i.name){case ie.Number:return"number";case ie.String:return"text";case ie.Boolean:return"boolean";case ie.UUID:return"uuid";case ie.Date:return"date-time";default:return"definition-entity"}}const ss={[p.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[p.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[p.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[p.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[p.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[p.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[p.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[p.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[p.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[p.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[p.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[p.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[p.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[p.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[p.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[p.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[p.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[p.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[p.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[p.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[p.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[p.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[p.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[p.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"},[p.DataType]:{singular:"Data type",plural:"Data types",shortSingular:"Data type",shortPlural:"Data types"},[p.LiteralValue]:{singular:"Literal value",plural:"Literal values",shortSingular:"Value",shortPlural:"Values"}};function xA(d){const u=tv(d);if(!u){const a=pp(d);if(a.includes(ce.HTTP_ENDPOINT))return"HTTP endpoint";if(a.includes(ce.PERSISTED_ENTITY))return"Persisted entity";if(a.includes(ce.CRON_JOB))return"Scheduled execution";if(a.includes(ce.RELATIONAL_DATABASE))return"Relational database"}if(u){let a="Extension of "+S(u,u.project)+" entity",l=Mu(a);const c=pp(d);return c.includes(ce.HTTP_ENDPOINT)?"HTTP endpoint"+(l?", "+l:""):c.includes(ce.PERSISTED_ENTITY)?"Persisted entity"+(l?", "+l:""):c.includes(ce.CRON_JOB)?"Scheduled execution"+(l?", "+l:""):c.includes(ce.RELATIONAL_DATABASE)?"Relational database"+(l?", "+l:""):a}let i="";return d.abstract&&(i="Template "),d.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function W7(d){return d.parent.type===p.DefinitionEntity||d.parent.type===p.InstalledProject?"Internal action of "+S(d.parent,d.project):d.parent.type===p.Loop?"Action repeated on every iteration":"Internal action of entity"}function UA(d){return rR(d)?W7(d):"Custom trigger"}function Y_e(d){var u;switch(d.type){case p.DefinitionEntity:return xA(d);case p.FunctionDeclaration:return UA(d)}return(u=ss[d.type])==null?void 0:u.singular}function S_e(d){var u;switch(d.type){case p.DefinitionEntity:return xA(d);case p.FunctionDeclaration:return UA(d)}return(u=ss[d.type])==null?void 0:u.singular}const jA=4e4,H7=280,X_e=300,GA=65,Zu=32,Xm=39,z7=26,J7=49,Qm=44,Q_e=35,e0=52,kA=10,fl=kA*2,t0=38,i0=90,FA=270,Y7=jA/2+120,S7=jA/2+180;function X7(d){let i=Zu+Qm+t0+kA;const a=[...d.inputs];return a.length&&(i+=fl,a.forEach(()=>{i+=z7})),{height:i,width:280}}function Q7(d){let i=GA;const a=[];if([p.DefinitionEntity].includes(d.type)){const v=[...d.suggestedProperties||[],...d.properties||[]];v.length&&(i+=fl,v.forEach(T=>{i+=T.static?J7:Xm}))}if([p.DefinitionEntity,p.InstalledProject,p.Loop].includes(d.type)){const v=[...(d==null?void 0:d.suggestedMethods)||[],...d.methods||[],...d.functions||[],...d.body?[d.body]:[]];v.length&&(i+=fl,v.forEach(T=>{const I=X7(T);i+=I.height}))}mi.includes(d.type)?($t.includes(d.type)?a.push(...(d.usedInputs||[]).flatMap(v=>[v])||[]):a.push(...(d.inputs||[]).flatMap(v=>[v])||[]),d.error&&(i+=e0)):[p.ReturnStatement,p.BreakStatement,p.ContinueStatement].includes(d.type)?(a.push(...d.outputs||[]),d.throws&&(i+=e0)):d.type===p.Condition&&(a.push(d.inputs[0]),d.inputs[1]&&a.push(d.inputs[1]));const l=a.length;l&&(i+=l*Xm,i+=fl);const c=[];if(d.type===p.FunctionDeclaration||d.type===p.GlobalEvent?c.push(...d.inputs||[]):mi.includes(d.type)&&($t.includes(d.type)?c.push(...d.usedOutputs||[]):c.push(...d.outputs||[])),$t.includes(d.type)){d.readsValue&&(i+=fl,i+=Qm),d.writesValues.length&&(i+=fl,i+=Qm),d.internalCalls.length&&d.usedInternalCalls.forEach(()=>i+=e0+fl);const v=d.getDataType(null);(!v||v.inferred)&&(i+=t0)}const e=c.length;return e&&(i+=e*Xm,i+=fl),[p.DefinitionEntity,p.FunctionDeclaration,p.ReturnStatement,p.BreakStatement,p.ContinueStatement].includes(d.type)&&(i+=t0),{height:i,width:280}}function Xc(d){return`${d.split("-").map((a,l)=>l===0?a.charAt(0).toUpperCase()+a.slice(1):a.toLowerCase()).join(" ")}.`}function eDe(d){switch(d.code){case se.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case se.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case se.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case se.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case se.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case se.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case se.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case oe.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case oe.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case se.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case se.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case oe.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case se.NoProperties:return"This entity has no properties, so it doesn't do anything";case se.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case se.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case se.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case se.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case se.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case se.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case se.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case se.PropertyImplementsNonAbstact:return"This property implements a non-template property";case se.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case se.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case se.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case se.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case se.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case oe.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case oe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case oe.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case oe.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case oe.UnreachableEntity:return"This entity is unreachable";case se.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case se.AbstractEntityImplements:return"This template entity implements a non-template entity";case se.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case se.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case se.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case se.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case se.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case se.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case se.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case se.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case se.MissingRequiredValue:return"This action is missing a required value";case se.NoPrimaryKeyProperty:return"This entity has no primary key property";case se.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case se.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case se.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case se.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case se.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case se.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case se.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case oe.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case oe.EmptyName:return"This entity has no name";case oe.InvalidObjectStructure:return"This entity has an invalid structure";case oe.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case oe.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case oe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case oe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case oe.MissingCaller:return"This action is missing a caller";case oe.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case oe.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case oe.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case oe.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case oe.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case oe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case oe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case oe.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case Pa.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Pa.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case qn.UUIDMustBeString:return`UUID must be a string, eg: "${hd()}"`;case qn.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${hd()}"`;case qn.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${hd()}"`;case hn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case hn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case hn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return Xc(d.code)}}function tDe(d){switch(d.code){case se.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case se.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case se.IncorrectEntityImplementation:return"Incorrect implementation";case se.IncorrectMethodImplementation:return"Incorrect action implementation";case se.IncorrectPropertyImplementation:return"Incorrect property implementation";case se.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case se.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case oe.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case oe.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case se.MissingMethodImplementation:return"Missing action";case se.MissingPropertyImplementation:return"Missing property";case oe.NameNotUniqueInScope:return"Duplicate name";case se.NoProperties:return"No properties";case se.NonStaticPropertyInStaticEntity:return"Non-static property";case se.StaticEntityWithNonStaticProperties:return"Non-static properties";case se.ReadingFromIncompatibleType:return"Read from different type";case se.WritingToIncompatibleType:return"Write to different type";case se.ScopeWithoutLogic:return"No logic";case se.NonStaticPropertyImplementsStatic:return"Invalid static property";case se.PropertyImplementsIncompatibleType:return"Incompatible data type";case se.PropertyImplementsNonAbstact:return"Non-template property";case se.StaticPropertyImplementsNonStatic:return"Non-static property";case se.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case se.VariableHasInputsAndInternalCall:return"Bad internal call";case se.VariableHasOutputsAndInternalCall:return"Bad internal call";case se.VariableIsCalledAndHasInternalCall:return"Bad internal call";case oe.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case oe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case oe.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case oe.InternalCallParentMissingDataType:return"Parent has no data type";case oe.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case oe.UnreachableEntity:return"Unreachable entity";case se.DisconnectedCallableEntity:return"Disconnected entity";case se.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case se.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case se.InvalidPropertiesCombination:return"Invalid properties combination";case se.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case se.ExtendsIncompatibleEntities:return"Extends incompatible entities";case se.ImplementingNonAbstractEntity:return"Implementing non-template entity";case se.ImplementsIncompatibleEntities:return"Implements incompatible entities";case se.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case se.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case se.MissingRequiredValue:return"Missing required value";case se.NoPrimaryKeyProperty:return"No primary key property";case se.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case se.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case se.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case se.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case se.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case se.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case se.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case oe.EmptyName:return"Empty name";case oe.InvalidObjectStructure:return"Invalid object structure";case oe.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case oe.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case oe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case oe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case oe.MissingCaller:return"Missing caller";case oe.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case oe.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case oe.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case oe.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case oe.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case oe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case oe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case oe.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case Pa.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Pa.StatusCodeMustBeNumber:return"HTTP status code must be a number";case qn.UUIDMustBeString:return"UUID must be a string";case qn.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case qn.UUIDMustBeValidFormat:return"UUID must be in a valid format";case hn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case hn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case hn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return Xc(d.code)}}function iDe(d){switch(d.code){case se.AbstractEntityWithNonAbstractMethods:return`${S(d.entity,d.entity.project)} has non-template actions`;case se.AbstractEntityWithNonAbstractProperties:return`${S(d.entity,d.entity.project)} has non-template properties`;case se.IncorrectEntityImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements template`;case se.IncorrectMethodImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template`;case se.IncorrectPropertyImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template`;case se.AbstractMethodInNonAbstractEntity:return`${S(d.entity,d.entity.project)} can't be a template`;case se.AbstractPropertyInNonAbstractEntity:return`${S(d.entity,d.entity.project)} can't be a template`;case oe.MethodOverwritesOtherSiblingWithSameName:return`${S(d.entity,d.entity.project)} overwrites action`;case oe.PropertyOverwritesOtherSiblingWithSameName:return`${S(d.entity,d.entity.project)} overwrites property`;case se.MissingMethodImplementation:return`${S(d.entity,d.entity.project)} is missing action`;case se.MissingPropertyImplementation:return`${S(d.entity,d.entity.project)} is missing property`;case oe.NameNotUniqueInScope:return`${S(d.entity,d.entity.project)} name is not unique`;case se.NoProperties:return`${S(d.entity,d.entity.project)} has no properties`;case se.NonStaticPropertyInStaticEntity:return`${S(d.entity,d.entity.project)} has non-static property`;case se.StaticEntityWithNonStaticProperties:return`${S(d.entity,d.entity.project)} has non-static properties`;case se.ReadingFromIncompatibleType:return`${S(d.entity,d.entity.project)} reads from different type`;case se.WritingToIncompatibleType:return`${S(d.entity,d.entity.project)} writes to different type`;case se.ScopeWithoutLogic:return`${S(d.entity,d.entity.project)} has no logic`;case se.NonStaticPropertyImplementsStatic:return`${S(d.entity,d.entity.project)} has invalid static property`;case se.PropertyImplementsIncompatibleType:return`${S(d.entity,d.entity.project)} has incompatible data type`;case se.PropertyImplementsNonAbstact:return`${S(d.entity,d.entity.project)} has non-template property`;case se.StaticPropertyImplementsNonStatic:return`${S(d.entity,d.entity.project)} has non-static property`;case se.VariableCallsOthersAndHasInternalCall:return`${S(d.entity,d.entity.project)} has bad internal call`;case se.VariableHasInputsAndInternalCall:return`${S(d.entity,d.entity.project)} has bad internal call`;case se.VariableHasOutputsAndInternalCall:return`${S(d.entity,d.entity.project)} has bad internal call`;case se.VariableIsCalledAndHasInternalCall:return`${S(d.entity,d.entity.project)} has bad internal call`;case oe.InternalCallDeclarationIsInvalidType:return`${S(d.entity,d.entity.project)} has declaration that is not an action`;case oe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${S(d.entity,d.entity.project)} has declaration that is not found in parent`;case oe.InternalCallParentDeclarationEntityInvalidType:return`${S(d.entity,d.entity.project)} has invalid parent declaration type`;case oe.InternalCallParentMissingDataType:return`${S(d.entity,d.entity.project)}'s parent has no data type`;case oe.InternalCallDeclarationNotInParentDatatypeEntity:return`${S(d.entity,d.entity.project)} has declaration that is not in parent`;case oe.UnreachableEntity:return`${S(d.entity,d.entity.project)} is unreachable`;case se.DisconnectedCallableEntity:return`${S(d.entity,d.entity.project)} is not executed by any entity`;case se.AbstractEntityImplements:return`${S(d.entity,d.entity.project)} implements a non-template entity`;case se.AbstractExtendingNonAbstractEntity:return`${S(d.entity,d.entity.project)} extends a non-template entity`;case se.InvalidPropertiesCombination:return`${S(d.entity,d.entity.project)} has invalid properties combination`;case se.ExtendingNonInteractiveEntity:return`${S(d.entity,d.entity.project)} extends a non-interactive entity`;case se.ExtendsIncompatibleEntities:return`${S(d.entity,d.entity.project)} extends incompatible entities`;case se.ImplementingNonAbstractEntity:return`${S(d.entity,d.entity.project)} implements a non-template entity`;case se.ImplementsIncompatibleEntities:return`${S(d.entity,d.entity.project)} implements incompatible entities`;case se.LackingReturnStatementOnSomeBranches:return`${S(d.entity,d.entity.project)} is missing termination on some branches`;case se.LastCalledEntityMustBeReturnEntity:return`${S(d.entity,d.entity.project)}'s last called entity must be a termination node`;case se.MissingRequiredValue:return`${S(d.entity,d.entity.project)} is missing a required value`;case se.NoPrimaryKeyProperty:return`${S(d.entity,d.entity.project)} has no primary key property`;case se.NonAbstractExtendingAbstractEntity:return`${S(d.entity,d.entity.project)} extends a template entity`;case se.NonStaticExtendingStaticEntity:return`${S(d.entity,d.entity.project)} extends a static entity`;case se.NonStaticImplementingStaticEntity:return`${S(d.entity,d.entity.project)} implements a static entity`;case se.StaticExtendingNonStaticEntity:return`${S(d.entity,d.entity.project)} extends a non-static entity`;case se.StaticImplementingNonStaticEntity:return`${S(d.entity,d.entity.project)} implements a non-static entity`;case se.VariableReadsValueAndInternalCall:return`${S(d.entity,d.entity.project)} reads a value and has internal call`;case se.VariableWritesValuesAndInternalCall:return`${S(d.entity,d.entity.project)} writes values and has internal call`;case oe.EmptyName:return`${ss[d.entity.type]} has no name`;case oe.InvalidObjectStructure:return`${S(d.entity,d.entity.project)} has invalid structure`;case oe.LoopBodyFunctionOverwrite:return`${S(d.entity,d.entity.project)}'s loop body action overwrites an action`;case oe.MethodOverwritesBaseMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites base action`;case oe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another action with same implementation`;case oe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another action with same implementation`;case oe.MissingCaller:return`${S(d.entity,d.entity.project)} is missing a caller`;case oe.NameAsResolvedCodeNameNotUniqueInScope:return`${S(d.entity,d.entity.project)} has a name not unique in the scope`;case oe.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${S(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case oe.NameMustStartWithLetterOrUnderscore:return`${S(d.entity,d.entity.project)} name must start with letter or underscore`;case oe.NoOverlapWithImplementedSignature:return`${S(d.entity,d.entity.project)} has no overlap with implemented signature`;case oe.PropertyOverwritesBasePropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites base property`;case oe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another property with same implementation`;case oe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another property with same implementation`;case oe.ReaderWriterIncompatibleDataType:return`${S(d.entity,d.entity.project)} has reader/writer with incompatible data type`;case Pa.StatusCodeMustBeBetween100And599:return`${S(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case Pa.StatusCodeMustBeNumber:return`${S(d.entity,d.entity.project)} HTTP status code must be a number`;case qn.UUIDMustBeString:return`${S(d.entity,d.entity.project)} UUID must be a string`;case qn.UUIDMustNotContainSpaces:return`${S(d.entity,d.entity.project)} UUID must not contain spaces`;case qn.UUIDMustBeValidFormat:return`${S(d.entity,d.entity.project)} UUID must be in a valid format`;case hn.MustBeUniqueAmongSameEntities:return`${S(d.entity,d.entity.project)} value must be unique among the same kind`;case hn.StringValueMustNotHaveDashes:return`${S(d.entity,d.entity.project)} value must not contain dashes`;case hn.StringValueMustNotHaveSpaces:return`${S(d.entity,d.entity.project)} value must not contain spaces`;default:return`${S(d.entity,d.entity.project)} Error: ${Xc(d.code)}`}}function rDe(d){var u,i,a,l;switch(d.code){case se.AbstractEntityWithNonAbstractMethods:return`${S(d.entity,d.entity.project)} has non-template actions`;case se.AbstractEntityWithNonAbstractProperties:return`${S(d.entity,d.entity.project)} has non-template properties`;case se.IncorrectEntityImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template entity`;case se.IncorrectMethodImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template action it's based on`;case se.IncorrectPropertyImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template property it's based on`;case se.AbstractMethodInNonAbstractEntity:return`${S(d.entity,d.entity.project)} is a template action in a non-template entity`;case se.AbstractPropertyInNonAbstractEntity:return`${S(d.entity,d.entity.project)} is a template property in a non-template entity`;case oe.MethodOverwritesOtherSiblingWithSameName:return`${S(d.entity,d.entity.project)} overwrites an action in the template entity`;case oe.PropertyOverwritesOtherSiblingWithSameName:return`${S(d.entity,d.entity.project)} overwrites a property in the template entity`;case se.MissingMethodImplementation:return`${S(d.entity,d.entity.project)} is missing an action implementation from the template entity`;case se.MissingPropertyImplementation:return`${S(d.entity,d.entity.project)} is missing a property implementation from the template entity`;case oe.NameNotUniqueInScope:return`${S(d.entity,d.entity.project)} has a duplicate name in the same scope`;case se.NoProperties:return`${S(d.entity,d.entity.project)} has no properties, so it doesn't do anything`;case se.NonStaticPropertyInStaticEntity:return`${S(d.entity,d.entity.project)} has a non-static property in a static entity`;case se.StaticEntityWithNonStaticProperties:return`${S(d.entity,d.entity.project)} has non-static properties in a static entity`;case se.ReadingFromIncompatibleType:return`${S(d.entity,d.entity.project)} reads data from a value of a different data type`;case se.WritingToIncompatibleType:return`${S(d.entity,d.entity.project)} writes data to a value of a different data type`;case se.ScopeWithoutLogic:return`${S(d.entity,d.entity.project)} has no logic`;case se.NonStaticPropertyImplementsStatic:return`${S(d.entity,d.entity.project)} has a static property in a non-static entity`;case se.PropertyImplementsIncompatibleType:return`${S(d.entity,d.entity.project)} implements a property of a different data type`;case se.PropertyImplementsNonAbstact:return`${S(d.entity,d.entity.project)} implements a non-template property`;case se.StaticPropertyImplementsNonStatic:return`${S(d.entity,d.entity.project)} has a static property in a non-static entity`;case se.VariableCallsOthersAndHasInternalCall:return`${S(d.entity,d.entity.project)} calls other entities while being used to execute internal logic`;case se.VariableHasInputsAndInternalCall:return`${S(d.entity,d.entity.project)} has inputs while being used to execute internal logic`;case se.VariableHasOutputsAndInternalCall:return`${S(d.entity,d.entity.project)} has outputs while being used to execute internal logic`;case se.VariableIsCalledAndHasInternalCall:return`${S(d.entity,d.entity.project)} is called while being used to execute internal logic`;case oe.InternalCallDeclarationIsInvalidType:return`${S(d.entity,d.entity.project)} has a declaration that is not an action`;case oe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${S(d.entity,d.entity.project)} has a declaration that is not found in ${(u=d.entity.parent.getDataType(null))!=null&&u.entity?S((i=d.entity.parent.getDataType(null))==null?void 0:i.entity,d.entity.project):"the variable's data-type entity"}`;case oe.InternalCallParentDeclarationEntityInvalidType:return`${S(d.entity,d.entity.project)} is part of a variable whos data-type entity can't have actions`;case oe.InternalCallParentMissingDataType:return`${S(d.entity,d.entity.project)} is part of a variable with no data-type entity`;case oe.InternalCallDeclarationNotInParentDatatypeEntity:return`${S(d.entity,d.entity.project)} has a declaration doesn't belong to ${(a=d.entity.parent.getDataType(null))!=null&&a.entity?S((l=d.entity.parent.getDataType(null))==null?void 0:l.entity,d.entity.project):"the variable's data-type entity"}`;case oe.UnreachableEntity:return`${S(d.entity,d.entity.project)} is unreachable`;case se.DisconnectedCallableEntity:return`${S(d.entity,d.entity.project)} is disconnected and won't be executed by anything after publishing`;case se.AbstractEntityImplements:return`${S(d.entity,d.entity.project)} implements a non-template entity`;case se.AbstractExtendingNonAbstractEntity:return`${S(d.entity,d.entity.project)} extends a non-template entity`;case se.InvalidPropertiesCombination:return`${S(d.entity,d.entity.project)} has an invalid combination of properties`;case se.ExtendingNonInteractiveEntity:return`${S(d.entity,d.entity.project)} extends a non-interactive entity`;case se.ExtendsIncompatibleEntities:return`${S(d.entity,d.entity.project)} extends incompatible entities`;case se.ImplementingNonAbstractEntity:return`${S(d.entity,d.entity.project)} implements a non-template entity`;case se.ImplementsIncompatibleEntities:return`${S(d.entity,d.entity.project)} implements incompatible entities`;case se.LackingReturnStatementOnSomeBranches:return`${S(d.entity,d.entity.project)} has branches that don't terminate`;case se.LastCalledEntityMustBeReturnEntity:return`${S(d.entity,d.entity.project)} must end with a termination node`;case se.MissingRequiredValue:return`${S(d.entity,d.entity.project)} is missing a required value`;case se.NoPrimaryKeyProperty:return`${S(d.entity,d.entity.project)} has no primary key property`;case se.NonAbstractExtendingAbstractEntity:return`${S(d.entity,d.entity.project)} is a non-template entity extending a template entity`;case se.NonStaticExtendingStaticEntity:return`${S(d.entity,d.entity.project)} is a non-static entity extending a static entity`;case se.NonStaticImplementingStaticEntity:return`${S(d.entity,d.entity.project)} is a non-static entity implementing a static entity`;case se.StaticExtendingNonStaticEntity:return`${S(d.entity,d.entity.project)} is a static entity extending a non-static entity`;case se.StaticImplementingNonStaticEntity:return`${S(d.entity,d.entity.project)} is a static entity implementing a non-static entity`;case se.VariableReadsValueAndInternalCall:return`${S(d.entity,d.entity.project)} reads a value and has an internal call`;case se.VariableWritesValuesAndInternalCall:return`${S(d.entity,d.entity.project)} writes values and has an internal call`;case oe.EmptyName:return`${ss[d.entity.type]} has no name`;case oe.InvalidObjectStructure:return`${S(d.entity,d.entity.project)} has an invalid structure`;case oe.LoopBodyFunctionOverwrite:return`${S(d.entity,d.entity.project)}'s loop body action overwrites`;case oe.MethodOverwritesBaseMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites a base action with same implementation`;case oe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another action with same implementation`;case oe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another action with same implementation`;case oe.MissingCaller:return`${S(d.entity,d.entity.project)} is missing a caller`;case oe.NameAsResolvedCodeNameNotUniqueInScope:return`${S(d.entity,d.entity.project)} has a name that is not unique in the scope`;case oe.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${S(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case oe.NameMustStartWithLetterOrUnderscore:return`${S(d.entity,d.entity.project)} name must start with letter or underscore`;case oe.NoOverlapWithImplementedSignature:return`${S(d.entity,d.entity.project)} has no overlap with implemented signature`;case oe.PropertyOverwritesBasePropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites a base property with same implementation`;case oe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another property with same implementation`;case oe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another property with same implementation`;case oe.ReaderWriterIncompatibleDataType:return`${S(d.entity,d.entity.project)} has a reader/writer with incompatible data type`;case Pa.StatusCodeMustBeBetween100And599:return`${S(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case Pa.StatusCodeMustBeNumber:return`${S(d.entity,d.entity.project)} HTTP status code must be a number, between 100 and 599`;case qn.UUIDMustBeString:return`${S(d.entity,d.entity.project)} UUID must be a string, eg: "${hd()}"`;case qn.UUIDMustNotContainSpaces:return`${S(d.entity,d.entity.project)} UUID must not contain spaces, eg: "${hd()}"`;case qn.UUIDMustBeValidFormat:return`${S(d.entity,d.entity.project)} UUID must be in a valid format. Eg: "${hd()}"`;case hn.MustBeUniqueAmongSameEntities:return`${S(d.entity,d.entity.project)} value must be unique among the same kind`;case hn.StringValueMustNotHaveDashes:return`${S(d.entity,d.entity.project)} value must not contain dashes`;case hn.StringValueMustNotHaveSpaces:return`${S(d.entity,d.entity.project)} value must not contain spaces`;default:return`${S(d.entity,d.entity.project)} Error: ${Xc(d.code)}`}}var KA=(d=>(d.ValuesAlreadyConnected="values-already-connected",d.CannotReadMoreThanOneValue="cannot-read-more-than-one-value",d.CannotReadValueFromChildren="cannot-read-value-from-children",d.CannotWriteValueToChildren="cannot-write-value-to-children",d.CannotBeCalledByChildren="cannot-be-called-by-children",d.ExecutionsAlreadyConnected="executions-already-connected",d.DataTypesNotCompatible="data-types-not-compatible",d.CannotCallAncestor="cannot-call-ancestor",d.CannotConnectToItself="cannot-connect-to-itself",d.CannotWriteValueToAncestor="cannot-write-value-to-ancestor",d.NotInScope="not-in-scope",d.IsNotValueWrittingEntity="is-not-value-writting-entity",d.IsNotValueReadingEntity="is-not-value-reading-entity",d.ContinueOrBreakStatementCalledFromOutsideLoop="continue-or-break-statement-called-from-outside-loop",d.ElementInLoopBodyCallingOutsideLoop="element-in-loop-body-calling-outside-loop",d.CallerIsInHigherScope="caller-is-in-higher-scope",d.CallerIsInLowerScope="caller-is-in-lower-scope",d.CallIsInHigherScope="call-is-in-higher-scope",d.CallIsInLowerScope="call-is-in-lower-scope",d.OtherIncompatibleScopeReason="other-incompatible-scope-reason",d.SiblingInternalCallAlreadyUsedInParentVariable="sibling-internal-call-already-used-in-parent-variable",d.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees="error-output-map-cannot-be-connected-to-parent-success-branch-callees",d.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees="success-output-map-cannot-be-connected-to-parent-error-branch-callees",d))(KA||{});const nDe=Object.values(KA);var qA=(d=>(d.NotPartOfOngoingTest="not-part-of-ongoing-test",d.CannotBeAddedToTest="cannot-be-added-to-test",d))(qA||{});const sDe=Object.values(qA);var ZA=(d=>(d.Suggestion="suggestion",d.CanvasGloballyDisabled="canvas-globally-disabled",d.CannotInteractWithInputInVariableWithInternalCalls="cannot-interact-with-input-in-variable-with-internal-calls",d.CannotInteractWithOutputInVariableWithInternalCalls="cannot-interact-with-output-in-variable-with-internal-calls",d))(ZA||{});const aDe=Object.values(ZA);function lDe(d,u){const i=[...d,...u];return Array.from(new Set(i))}function oDe(d,u){const i=[...d,...u],a=Array.from(new Set(i));return{hasChanged:a.length!==d.length,reasons:a}}function dDe(d,u){const i=d.filter(l=>!u.includes(l));return{hasChanged:i.length!==d.length,reasons:i}}function uDe(d,u){return d.find(i=>i.entity.id===u)||null}function e9(d){return d.filter((u,i)=>d.indexOf(u)===i)}class Wr{constructor(u,i,a=null,l){_(this,"ids",[]);_(this,"entity");_(this,"entityCardHeight");_(this,"entityCardWidth");_(this,"index");_(this,"childEntities",[]);_(this,"children",[]);_(this,"parents",[]);_(this,"calculationEntryPoint");_(this,"_onlyEntities",null);_(this,"_changeSet",null);if(this.index=i,this.entity=u,this.calculationEntryPoint=a||this,this===this.calculationEntryPoint&&!l)throw new Error("Change set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(u,i,a){const l=Y7-FA-H7,c=S7-i0-GA;u.metaSync({x:u.x||l,y:u.y||c},i);const e=new Wr(u,0,null,i);e._onlyEntities=a||[],e.ids=["0"];const y=[];e.next(T=>{y.push(...T)}),Wr.recursivelyAssembleChildrenAreas(y),e.resolveChildrenOverlaps();const v=e.flattenChildEntities();return e._onlyEntities?v.filter(T=>(e._onlyEntities||[]).includes(T)):v}static recursivelyAssembleChildrenAreas(u){const i=[];u.forEach(a=>{a.next(l=>{i.push(...l)})}),i.length>0&&Wr.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(u){this.calculationEntryPoint._changeSet=u}findAreaInChildrenFromEntity(u){if(this.entity===u)return this;const i=this.children.find(l=>l.entity===u);return i||this.children.reduce((l,c)=>l||c.findAreaInChildrenFromEntity(u),null)}findAreaFromEntity(u){if(this.entity===u)return this;const i=this.calculationEntryPoint.children,a=i.find(c=>c.entity===u);return a||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(u),null)}addParent(u){if(!this.parents.includes(u)){const i=Wr.resolveIds(u,this.index);this.ids.push(...i),this.parents.push(u)}}static resolveIds(u,i){return u?u.ids.map(a=>`${a}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const u=ia(this.entity,!0);if(this.entity.type===p.Project){const i=[],a=[],l=[];u.forEach(e=>{if(p.DefinitionEntity===e.type){a.push(e);return}else if(Gt.includes(e.type)){l.push(e);return}i.push(e)});const c=i.sort((e,y)=>{const v=!!W0(e,y).length,T=ia(e),I=ia(y);return v?0:T.length&&!I.length?-1:!T.length&&I.length?1:0}).filter(e=>!Io(e).length);this.childEntities=[...a,...l,...c]}else{const i=[],a=[],l=[],c=[],e=[];Gr.includes(this.entity.type)&&J0(this.entity).forEach(T=>{if($t.includes(T.type)){l.push(T);return}const I=Pi(T);i.push(I)}),Qi.includes(this.entity.type)&&a.push(...this.entity.detachedChildren);const y=u.filter(v=>{const T=i.includes(v);return T||l.includes(v)||a.includes(v)?!1:$t.includes(v.type)?(l.push(v),!1):tn.includes(v.type)&&!T?(c.push(v),!1):v.type===p.DefinitionEntity?(e.push(v),!1):!0});i.sort((v,T)=>_d(v,T)?-1:0),c.sort((v,T)=>_d(v,T)?-1:0),l.sort((v,T)=>Yw(v,T)?1:Yw(T,v)?-1:0),this.childEntities=[...e,...i,...c,...y,...l,...a]}}calculateCardSize(){const u=Q7(this.entity);this.entityCardWidth=u.width,this.entityCardHeight=u.height}static getBoundriesOfTwoAreas(u,i){return{top:Math.min(u.top,i.top),left:Math.min(u.left,i.left),bottom:Math.max(u.bottom,i.bottom),right:Math.max(u.right,i.right)}}static getBoundriedOfCombinedAreas(u,i){const a=u.filter(c=>!i.includes(c));return a.reduce((c,e)=>i.includes(e)?c:Wr.getBoundriesOfTwoAreas(c,e.fullBranchArea),a[0].fullBranchArea)}getFullAreaUntilAny(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!u.includes(e)).map(e=>e.getFullAreaUntilAny(u)).reduce((e,y)=>Wr.getBoundriesOfTwoAreas(e,y),i)}getFullAreaUntilAreaOrAnyChildren(u){const i=[u,...u.flattenChildren()],a=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(u)).reduce((e,y)=>Wr.getBoundriesOfTwoAreas(e,y),a)}getFullAreaUntil(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==u).map(c=>c.getFullAreaUntil(u)).reduce((c,e)=>Wr.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const u=this.ownEntityPlusBufferArea;return this.children.map(l=>l.fullBranchArea).reduce((l,c)=>Wr.getBoundriesOfTwoAreas(l,c),u)}get ownEntityArea(){return{top:this.entity.y,left:this.entity.x,bottom:this.entity.y+this.entityCardHeight,right:this.entity.x+this.entityCardWidth}}get ownEntityPlusBufferArea(){const u=this.ownEntityArea;return{top:u.top,left:u.left,bottom:u.bottom+i0,right:u.right+FA}}static filterOutRepeatedAreas(u){return u.filter((i,a)=>u.indexOf(i)===a)}getEarliestId(u,i){const a=u.split("-"),l=i.split("-");return a.length<l.length?u:a.length>l.length?i:a.reduce((e,y,v)=>y<l[v]?u:i,u)}getEarliestLevel(){return this.ids.reduce((a,l)=>this.getEarliestId(a,l),this.ids[0]).split("-").length}countColumns(){let u=0;if(this!==this.calculationEntryPoint)u++;else return u;if(!this.parents.length)return u;const a=this.parents.reduce((l,c)=>c.getEarliestLevel()>l.getEarliestLevel()?c:l,this.parents[0]).countColumns();return u+=a,u}getLatestId(u,i){if(u===i)return u;const a=u.split("-"),l=i.split("-");return a.length<l.length?i:a.length>l.length?u:a.reduce((e,y,v)=>y>l[v]?u:i,u)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((a,l)=>this.getLatestId(a,l),this.ids[0]).split("-").length}smoothPosition(){const u=this.flattenSiblings();if(!u.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(a=>{a!==this.calculationEntryPoint&&a.shiftDownAlone(i)})}else if([...Gt].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=u.filter(a=>!this.parents.includes(a));i.length?i.every(l=>{const c=this.countColumns(),e=l.countColumns();return c>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(u,i){if(u.includes(this))return u;this.move(this.entity,{y:this.entity.y+i});let a=[...u,this];return this.children.forEach(l=>{if(Wr.getEarliestParentInChain(l)!==this)return;const e=uDe(a,l.entity.id);a=Wr.filterOutRepeatedAreas([...a]),e||(a=a.filter(v=>v!==l));const y=l.shiftDownUntilAny(a,i);a.push(...y)}),a}shiftRightUntilAny(u,i){u.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(a=>{const l=Wr.filterOutRepeatedAreas([...this.flattenSiblings(),...u]);Wr.getEarliestParentInChain(a)===this&&a.shiftRightUntilAny(l,i)}))}shiftRight(u){this.move(this.entity,{x:this.entity.x+u}),this.children.forEach(i=>{const l=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(l,u)})}shiftDownAlone(u){this.move(this.entity,{y:this.entity.y+u})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const u=this.parents.reduce((l,c)=>{const e=c.ownEntityArea,y=e.top+Zu,v={top:y,left:e.left,bottom:y,right:e.right};return Wr.getBoundriesOfTwoAreas(l,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-Zu;this.shiftDownAlone(a)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const u=this.children.reduce((l,c)=>{const e=c.ownEntityArea,y=e.top+Zu,v={top:y,left:e.left,bottom:y,right:e.right};return Wr.getBoundriesOfTwoAreas(l,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-Zu;return this.shiftDownAlone(a),a}resolveChildrenOverlaps(){const u=this.flattenChildren();let i=[];u.forEach(a=>{const l=a.adjustVerticallyToAvoidOverlaps();i.push(...l)}),u.forEach(a=>{a.smoothPosition()})}static getEarliestParentInChain(u){let i=u.parents[0];return u.parents.length&&(i=u.parents.sort((a,l)=>{if(!a.ids.length)return-1;if(!l.ids.length)return 1;const c=a.ids.sort((y,v)=>y.length<v.length?-1:0),e=l.ids.sort((y,v)=>y.length<v.length?-1:0);return c[0].length-e[0].length})[0]),i}flattenEarlierSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((a,l)=>{if(u.has(l.entity.id))return a;u.add(l.entity.id);const e=l.children.slice(0,l.children.indexOf(this)).reduce((y,v)=>[...y,v,...v.flattenChildren(u)],[]);return[...a,...e]},[])}flattenSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((a,l)=>{if(u.has(l.entity.id))return a;u.add(l.entity.id);const e=l.children.filter(y=>y!==this).reduce((y,v)=>[...y,v,...v.flattenChildren(u)],[]);return[...a,...e]},[])}flattenChildren(u=new Set){return this.children.reduce((i,a)=>u.has(a.entity.id)?i:(u.add(a.entity.id),[...i,a,...a.flattenChildren(u)]),[])}flattenParents(u=new Set){return this.parents.reduce((a,l)=>u.has(l.entity.id)?a:(u.add(l.entity.id),[...a,l,...l.flattenParents(u)]),[])}getAreaIfRendered(u){return this.calculationEntryPoint.flattenChildren().find(l=>l.entity.id===u.id)||null}getLowerSiblings(){const u=this.parents.reduce((i,a)=>{const l=a.children.indexOf(this),c=a.children.slice(l+1);return[...i,...c]},[]);return e9(u)}getLowerAreas(){const u=this.getLowerSiblings(),i=this.parents.reduce((a,l)=>[...a,...l.getLowerAreas()],[]);return e9([...u,...i])}adjustVerticallyToAvoidOverlaps(u=[]){const a=Wr.getEarliestParentInChain(this).children[this.index-1];if(!a)return u;const l=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...l,...c,a],T=C(e.flatMap(V=>W0(this.entity,V.entity))).filter(V=>V.id!==this.entity.id).map(V=>this.findAreaFromEntity(V)).filter(V=>!!V),I=this.getFullAreaUntilAny(T),b=a.getFullAreaUntilAny(T),D=e.reduce((V,M)=>M===this||M.fullBranchArea.left!==I.left?V:Math.max(V,M.fullBranchArea.bottom),b.bottom);if(I.top<D){const V=D-I.top+i0;return this.shiftDownUntilAny(u,V)}return u}move(u,i){(this.onlyEntities||[]).includes(u)&&u.metaSync(i,this.changeSet)}addChild(u){const i=this.childEntities[u];let a=null;i.x&&i.y?a=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),a||(a=new Wr(i,u,this.calculationEntryPoint));const l=this.ownEntityPlusBufferArea;this.children.includes(a)||(this.children.push(a),a.addParent(this));const c=a.fullBranchArea;if(c.left<l.right){const e=l.right-c.left;a.shiftRight(e)}return a}flattenChildEntities(u=new Set){return this.children.reduce((i,a)=>u.has(a.entity.id)?i:(u.add(a.entity.id),[...i,a.entity,...a.flattenChildEntities(u)]),[])}next(u){const i=[];this.childEntities.forEach((a,l)=>{const c=this.addChild(l);c&&i.push(c)}),u(i)}}var Qc=(d=>(d.Amazon="amazon",d.Google="google",d.Microsoft="microsoft",d))(Qc||{}),Wi=(d=>(d.RelationalDatabase="relational-database",d.CompiledLocalCodebase="compiled-local-codebase",d.CloudHostedCodebase="cloud-hosted-codebase",d.HttpApi="http-api",d.HttpEndpoint="http-endpoint",d.ServerlessFunction="serverless-function",d))(Wi||{}),WA=(d=>(d.Post="post",d.Get="get",d.Acknowledgement="acknowledgment",d.Progress="progress",d.Error="error",d.Complete="complete",d))(WA||{}),Td=(d=>(d.Queued="queued",d.Running="running",d.Success="success",d.Failed="failed",d.CleanedUp="cleaned-up",d.Skipped="skipped",d.AbortedByUser="aborted-by-user",d.UnrecoverableFailure="unrecoverable-failure",d.Reverted="reverted",d.UnpublishingStarted="unpublishing-started",d.Unpublished="unpublished",d))(Td||{}),HA=(d=>(d.Queued="queued",d.Running="running",d.Success="success",d.Failed="failed",d.CleanedUp="cleaned-up",d.UnrecoverableFailure="unrecoverable-failure",d.Reverted="reverted",d.UnpublishingStarted="unpublishing-started",d.Unpublished="unpublished",d))(HA||{}),bt=(d=>(d.ProjectNotFound="project-not-found",d.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",d.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",d.DeploymentCompleted="deployment-completed",d.DeploymentStarted="deployment-started",d.DeploymentFailed="deployment-failed",d.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",d.RequestPayloadValidationFailed="request-payload-validation-failed",d.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",d.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",d.ProjectAlreadyBeingPublished="project-already-being-published",d.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",d.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",d.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",d.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",d.CreatingNewRelationalDatabase="creating-new-relational-database",d.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",d.RelationalDatabaseAlreadyExists="relational-database-already-exists",d.RelationalDatabaseDeletionStarted="relational-database-deletion-started",d.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",d.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",d.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",d.HttpApiDeploymentStarted="http-api-deployment-started",d.HttpApiDeploymentCompleted="http-api-deployment-completed",d.HttpApiDeploymentFailed="http-api-deployment-failed",d.CreatingNewHttpApi="creating-new-http-api",d.HttpApiAlreadyExists="http-api-already-exists",d.HttpApiDeletionStarted="http-api-deletion-started",d.HttpApiDeletionCompleted="http-api-deletion-completed",d.HttpApiDeletionFailed="http-api-deletion-failed",d.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",d.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",d.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",d.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",d.BundlingCodebaseForDownload="bundling-codebase-for-download",d.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",d.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",d.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",d.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",d.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",d.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",d.CodeCompilationStarted="code-compilation-started",d.CodeCompilationCompleted="code-compilation-completed",d.CodeCompilationFailed="code-compilation-failed",d.BundleCodebaseStarted="bundle-codebase-started",d.BundleCodebaseCompleted="bundle-codebase-completed",d.BundleCodebaseFailed="bundle-codebase-failed",d.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",d.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",d.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",d.MigrateRelationalDatabaseStarted="migrate-relational-database-started",d.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",d.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",d.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",d.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",d.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",d))(bt||{}),Qs=(d=>(d.CodeCompilation="code-compilation",d.RelationalDatabaseDeployment="relational-database-deployment",d.RelationalDatabaseDeletion="relational-database-deletion",d.HttpApiDeployment="http-api-deployment",d.HttpApiDeletion="http-api-deletion",d.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",d.BundleCodebase="bundle-codebase",d.MigrateRelationalDatabase="migrate-relational-database",d.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",d.ExecutePublicationCompletedEvent="execute-publication-completed-event",d.CodebaseCleanup="codebase-cleanup",d))(Qs||{});Wi.CloudHostedCodebase,Wi.HttpApi,Wi.RelationalDatabase,Wi.CloudHostedCodebase,Wi.CloudHostedCodebase,Wi.RelationalDatabase,Wi.CloudHostedCodebase,Wi.CloudHostedCodebase;function t9(d){return`project-${d}-http-api`}function r0(d){return`entity-${d}-database`}class i9{constructor(u,i,a,l,c,e,y,v,T){_(this,"stepType");_(this,"id");_(this,"resourceType");_(this,"index");_(this,"dependency",[]);_(this,"lastEvent",null);_(this,"lastEventTimestamp",null);_(this,"status",Td.Queued);_(this,"publicationRun");_(this,"resource");this.stepType=u,this.id=i,this.resourceType=a,this.status=l,this.dependency=c,this.index=e,this.lastEventTimestamp=y,this.publicationRun=v,this.resource=T}toJSON(){return{stepType:this.stepType,id:this.id,resourceType:this.resourceType,index:this.index,status:this.status,dependency:this.dependency,lastEvent:this.lastEvent,resource:{resourceId:this.resource.resourceId,resourceType:this.resource.resourceType,provider:this.resource.provider,details:this.resource.details,status:this.resource.status,name:this.resource.name}}}async update(u){var i,a;this.status=u.status,this.dependency=u.dependency,this.index=u.index,this.stepType=u.stepType,this.resourceType=u.resourceType,this.lastEvent=u.lastEvent,this.id=u.id,(a=this.resource)==null||a.setDetails((i=u.resource)==null?void 0:i.details)}}var r9=(d=>(d.Ready="ready",d.Provisioning="provisioning",d.Queued="queued",d.ProvisioningFailed="provisioning-failed",d.Deleting="deleting",d.DeletingFailed="deleting-failed",d.Deleted="deleted",d))(r9||{});class Ed{constructor(u,i,a){_(this,"provisionedBy");_(this,"publicationRun");_(this,"resourceType");_(this,"provider");_(this,"resourceId");_(this,"details",null);_(this,"name",null);_(this,"status","queued");this.publicationRun=u,this.resourceType=i,this.provider=a}setDetails(u){this.details=u}setStatus(u){this.status=u}setProvisionedBy(u){this.provisionedBy=u}}class pDe extends Ed{constructor(i,a,l){super(i,Wi.HttpEndpoint,l);_(this,"resourceType",Wi.HttpEndpoint);_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,a;return this.resourceId=r0((a=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:a.id),this.resourceId}}class cDe extends Ed{constructor(i,a,l){super(i,Wi.ServerlessFunction,l);_(this,"resourceType",Wi.ServerlessFunction);_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,a;return this.resourceId=r0((a=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:a.id),this.resourceId}}class n9 extends Ed{constructor(i,a,l){super(i,Wi.HttpApi,l);_(this,"resourceType",Wi.HttpApi);_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=t9(this.publicationRun.project.id),this.resourceId}}class s9 extends Ed{constructor(i,a,l){super(i,Wi.RelationalDatabase,l);_(this,"resourceType",Wi.RelationalDatabase);_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,a;return this.resourceId=r0((a=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:a.id),this.resourceId}}class a9 extends Ed{constructor(i,a){super(i,Wi.CloudHostedCodebase,a);_(this,"resourceType",Wi.CloudHostedCodebase);_(this,"details",null);_(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class l9 extends Ed{constructor(i,a){super(i,Wi.CompiledLocalCodebase,a);_(this,"resourceType",Wi.CompiledLocalCodebase);_(this,"details",null);_(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`,this.resourceId}}class fDe{constructor(u,i){_(this,"id");_(this,"projectAutoIncrementPublicationCount");_(this,"projectPublishedSemanticVersion");_(this,"projectVersion");_(this,"projectId");_(this,"triggeredBy");_(this,"createdAt");_(this,"updatedAt");_(this,"status");_(this,"steps",[]);_(this,"editor");_(this,"explicitResources",new Map);_(this,"implicitGlobalResources",new Map);_(this,"finalGlobalEvent",null);_(this,"finalStatus",null);_(this,"contextType",Oe.PublicationRun);_(this,"extensionsRegistry");this.id=u.id,this.projectAutoIncrementPublicationCount=u.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=u.projectPublishedSemanticVersion,this.projectVersion=u.projectVersion,this.projectId=u.projectId,this.triggeredBy=u.triggeredBy,this.createdAt=u.createdAt,this.updatedAt=u.updatedAt,this.status=u.status,this.editor=i,this.initRegistry()}get off(){return this.extensionsRegistry.off}get on(){return this.extensionsRegistry.on}get emit(){return this.extensionsRegistry.emit}get emitAsync(){return this.extensionsRegistry.emitAsync}get emitAsyncAll(){return this.extensionsRegistry.emitAsyncAll}get emitAsyncAllSettled(){return this.extensionsRegistry.emitAsyncAllSettled}get emitAsyncSequentially(){return this.extensionsRegistry.emitAsyncSequentially}get emitAsyncSequentiallyAll(){return this.extensionsRegistry.emitAsyncSequentiallyAll}get emitAsyncSequentiallyAllSettled(){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled}get project(){return this.editor.project}getInfraTypes(u){return this.steps.filter(i=>u.includes(i.resourceType))}getStepsTypes(u){return this.steps.filter(i=>u.includes(i.stepType))}toIds(u){return u.map(i=>i.id)}getResourceForEntity(u){const i=Array.from(this.explicitResources.values()).find(a=>a.owners.has(u.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(Wi.CompiledLocalCodebase,new l9(this,Qc.Amazon)),this.implicitGlobalResources.set(Wi.CloudHostedCodebase,new a9(this,Qc.Amazon));const u=this.project.entities.filter(a=>cr(a,ce.HTTP_ENDPOINT)),i=this.project.entities.filter(a=>cr(a,ce.RELATIONAL_DATABASE));if(i.length&&i.forEach(a=>{const l=new s9(this,[a],Qc.Amazon);this.explicitResources.set(l.resourceId,l)}),u.length){const a=new n9(this,u,Qc.Amazon);this.explicitResources.set(a.resourceId,a)}}setSteps(u,i){u.forEach(a=>{this.addStep(a,i)}),this.editor.events.emit(bt.ProjectPublishRequestAcknowledged,{})}addStep(u,i){const a=u.dependency||[];if(a.length){const c=a.filter(e=>!this.steps.find(y=>y.id===e));if(c.length)throw new Error(`Missing dependencies: ${c.join(", ")}`)}if(!u.resource)throw new Error(`Resource not found for step ${u.stepType} (${u.id})`);if(!this.steps.find(c=>c.id===u.id)){const c=this.implicitGlobalResources.get(u.resourceType)||this.explicitResources.get(u.resource.resourceId),e=new i9(u.stepType,u.id,u.resourceType,u.status,a,u.index,i,this,c);this.steps.push(e)}}onUpdate(u){var i;if(Y.log("onUpdate",u),(i=u.payload)!=null&&i.stepType){const a=this.steps.find(l=>{var c;return l.id===((c=u.payload)==null?void 0:c.id)});a&&B(u.emittedAt).isAfter(B(a.lastEventTimestamp))&&a.update(u.payload)}this.editor.events.emit("publication-updated",{}),u.type===WA.Error?(this.finalStatus=HA.Failed,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-error",u)):u.type===WA.Complete&&(this.finalStatus=HA.Success,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-completed",u))}requestExtension(u){return this.extensionsRegistry.requestExtension(u)}async initRegistry(){return this.extensionsRegistry=new LA(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(Oe.PublicationRun),this.extensionsRegistry}}function yDe(d){switch(d){case Qs.CodeCompilation:return"Code generation";case Qs.RelationalDatabaseDeployment:return"Database creation";case Qs.HttpApiDeployment:return"HTTP gateway creation";case Qs.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case Qs.BundleCodebase:return"Bundle code";case Qs.MigrateRelationalDatabase:return"Database structure migration";case Qs.BusinessLogicCodebaseDeployment:return"Update servers with new code";case Qs.CodebaseCleanup:return"Code cleanup";case Qs.HttpApiDeletion:return"HTTP gateway deletion";case Qs.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function hDe(d){switch(d){case bt.DeploymentCompleted:return"Successfully published";case bt.DeploymentStarted:return"Publication started";case bt.DeploymentFailed:return"Publication failed";case bt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case bt.RequestPayloadValidationFailed:return"Request payload validation failed";case bt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case bt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case bt.RelationalDatabaseDeploymentStarted:return"Database creation started";case bt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case bt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case bt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case bt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case bt.RelationalDatabaseAlreadyExists:return"Database already exists";case bt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case bt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case bt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case bt.CreatingNewHttpApi:return"Creating new HTTP gateway";case bt.HttpApiAlreadyExists:return"HTTP gateway already exists";case bt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case bt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case bt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case bt.BundlingCodebaseForDownload:return"Bundling code for download";case bt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case bt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case bt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case bt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case bt.CodeCompilationStarted:return"Code generation started";case bt.CodeCompilationCompleted:return"Code generation completed";case bt.CodeCompilationFailed:return"Code generation failed";case bt.BundleCodebaseStarted:return"Code bundling started";case bt.BundleCodebaseCompleted:return"Code bundling completed";case bt.BundleCodebaseFailed:return"Code bundling failed";case bt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case bt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case bt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case bt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case bt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case bt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case bt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case bt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case bt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case bt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case bt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case bt.ProjectNotFound:return"Project not found";case bt.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case bt.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case bt.HttpApiDeletionStarted:return"HTTP gateway deletion started";case bt.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case bt.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case bt.RelationalDatabaseDeletionStarted:return"Database deletion started";case bt.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case bt.RelationalDatabaseDeletionFailed:return"Database deletion failed";case bt.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var o9=(d=>(d.NO_LOGIC="NO_LOGIC",d.NO_NAME="NO_NAME",d.NO_CHANGES="NO_CHANGES",d.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",d))(o9||{});function mDe(d){switch(d){case"NO_LOGIC":return"This project has no logic";case"NO_NAME":return"This project has no name";case"NO_CHANGES":return"This version has already been published";case"PROJECT_PUBLICATION_ALREADY_ONGOING":return"This project is already being published";default:return"Publishing is currently not available. Try again later"}}function vDe(d){switch(d){case Wi.RelationalDatabase:return"Relational database";case Wi.HttpEndpoint:case Wi.HttpApi:return"HTTP endpoints";case Wi.ServerlessFunction:case Wi.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function TDe(d){switch(d){case Td.Running:return"In progress";case Td.Failed:return"Failed";case Td.Success:return"Succeeded";case Td.Skipped:return"Skipped";case Td.Queued:default:return"Queued"}}function d9(d){var a;if(!cr(d,ce.EXTERNAL_INTEGRATION_CONNECTION))return null;let u=null;const i=pe["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(d.type===p.BuiltInBaseEntity?cr(d,ce.EXTERNAL_INTEGRATION_CONNECTION)&&(u=zA(d.name)):d.type===p.DefinitionEntity&&d.implements.forEach(l=>{if(cr(l,ce.EXTERNAL_INTEGRATION_CONNECTION)){const c=zA(l==null?void 0:l.name);if(c)return u=c,!0}}),!u){const l=d.properties.find(c=>!!c.implements.find(e=>e.id===i)||!!c.implements.find(e=>{var y;return((y=e.extends)==null?void 0:y.id)===i}));u=(a=l==null?void 0:l.getDefaultValue())==null?void 0:a.value}return u}function EDe(d){return cP[d]}function zA(d){return d.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?d.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function u9(d){if(d.type!==p.ActionDescriptor&&d.type!==p.Operation)throw new Error("Only ActionDescriptorState or OperationState can be used to resolve an external integration ID");if(d.type===p.ActionDescriptor){const u=d;if(u.id.startsWith("external-integration--"))return u.id.split("--")[1]}if(d.type===p.Operation){const u=d.declaration;if(Object.values(jt).includes(u.id))return u.id.split("--")[1]||null}return null}function bDe(d){if(!d)throw new Error("The integrationName parameter is required to resolve the base built-in name.");return Object.values(ce).find(i=>!!(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")&&i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===d.toLowerCase()))||null}function IDe(d){return d.type===p.BuiltInBaseEntity||d.type===p.DefinitionEntity?d9(d):d.type===p.ActionDescriptor||d.type===p.Operation?u9(d):null}function p9(d){var l,c,e;if(!cr(d,ce.EXTERNAL_INTEGRATION_CONNECTION))return null;let u=null;const i=vz(d,ce.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const a=pe["built-in-base-entity"][i.id].properties.connectionId.id;if(d.type===p.BuiltInBaseEntity){if(cr(d,ce.EXTERNAL_INTEGRATION_CONNECTION)){const y=d.properties.find(v=>{var T;return((T=v.extends)==null?void 0:T.id)===a});y&&(u=(l=y.getDefaultValue())==null?void 0:l.value)}}else if(d.type===p.DefinitionEntity){const y=d.properties.find(v=>!!v.implements.find(T=>T.id===a)||!!v.implements.find(T=>{var I;return((I=T.extends)==null?void 0:I.id)===a}));if(!y&&((c=d.extends)==null?void 0:c.type)===p.DefinitionEntity)return p9(d.extends);u=(e=y==null?void 0:y.getDefaultValue())==null?void 0:e.value}return u}function c9(d){var l;(l=d.dataType)==null||l.validate(),d.inputs.forEach(c=>c.validate()),d.outputs.forEach(c=>c.validate()),d.internalCalls.forEach(c=>c.validate());const i=[...ml(d),...gd(d),...f9(d),...vl(d),...y9(d)],a=Uw(d);return i.push(...a),xi(d.errors,i)}function f9(d,u){const a=[...d.project.getVariableDeclarations()].filter(l=>l.id!==d.id);return py(d,[Bi],a,u)}function y9(d){const u=[];if(d.parent!==d.project)return u;if(d.catchesError){const i=_t({id:`${d.id}--${oe.GlobalVariableDeclarationCannotCatchError}`,message:`${ss[d.type].singular} "${S(d,d.project)}" with id "${d.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:ee.Error,code:oe.GlobalVariableDeclarationCannotCatchError,entity:d});u.push(i.error)}if(d.errorCalls.length){const i=_t({id:`${d.id}--${oe.GlobalVariableDeclarationCannotCallOnError}`,message:`${ss[d.type].singular} "${S(d,d.project)}" with id "${d.id}" cannot call other entities from its error branch because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:ee.Error,code:oe.GlobalVariableDeclarationCannotCallOnError,entity:d});u.push(i.error)}if(d.calledBy.length){const i=_t({id:`${d.id}--${oe.GlobalVariableDeclarationCannotBeCalled}`,message:`${ss[d.type].singular} "${S(d,d.project)}" with id "${d.id}" cannot be called because it is globally declared. Global variable declarations must be self initialized when the project is loaded, and not be called for initialization.`,severity:ee.Error,code:oe.GlobalVariableDeclarationCannotBeCalled,entity:d});u.push(i.error)}return[]}const ADe=Object.freeze(Object.defineProperty({__proto__:null,validate:c9,validateGlobalVariableDeclaration:y9,validateVariableDeclarationName:f9},Symbol.toStringTag,{value:"Module"}));function h9(d){d.inputs.forEach(l=>l.validate()),d.outputs.forEach(l=>l.validate()),d.internalCalls.forEach(l=>l.validate());const i=[...ml(d),...gd(d),...vl(d)],a=Uw(d);return i.push(...a),xi(d.errors,i)}const wDe=Object.freeze(Object.defineProperty({__proto__:null,validate:h9},Symbol.toStringTag,{value:"Module"}));var JA=(d=>(d.Parent="parent",d.DataTypeEntity="data-type-entity",d.VarDeclaration="var-declaration",d))(JA||{});const Xt=class Xt extends pr{constructor(i,a){super(i);_(this,"initialData");_(this,"id");_(this,"x");_(this,"y");_(this,"type",p.VariableInstance);_(this,"catchesError",!1);_(this,"defaultValue",null);_(this,"writesValues",[]);_(this,"readsValue",null);_(this,"declaration");_(this,"inputs",[]);_(this,"outputs",[]);_(this,"error",null);_(this,"calledBySuccess",[]);_(this,"calledByError",[]);_(this,"calledByEntry",[]);_(this,"successCalls",[]);_(this,"errorCalls",[]);_(this,"internalCalls",[]);_(this,"project");_(this,"errors",[]);_(this,"parent");_(this,"detachedDependents",{});_(this,"knownVersions",null);_(this,"activeVersion",!1);_(this,"initialized",!1);_(this,"startedInitialization",!1);_(this,"suggestion",!1);_(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=a,this.id=i.id,this.x=i.x,this.y=i.y,this.catchesError=i.catchesError||!1}static new(i=null){return{id:L.UUID.uuid(),version:L.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||L.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.VariableInstance,catchesError:!0,declaration:null,internalCalls:[],successCalls:[],errorCalls:[],readsValue:null,writesValues:[],defaultValue:null,inputs:[],outputs:[],parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],error:null,x:0,y:0}}static fromGenerationTarget(i,a){let l=a;if(i.parent){const V=te(i.parent);l=a.get(V)}const c=te(i.declaration),e=a.get(c),y=i.calledByEntry.map(V=>{const M=te(V);return a.get(M)}),v=i.calledBySuccess.map(V=>{const M=te(V);return a.get(M)}),T=i.calledByError.map(V=>{const M=te(V);return a.get(M)});let I=null;if(i.readsValue){const V=te(i.readsValue);I=a.get(V)}const b={id:i.id,version:L.UUID.uuid(),createdAt:B().toISOString(),author:L.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.VariableInstance,catchesError:i.catchesError||!1,declaration:e.toReference(),calledByEntry:y,calledBySuccess:v,calledByError:T,defaultValue:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:I,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:l},D=ne(b,a);return D.setParent(l,null),D}static validateGenerationTarget(i,a){let l=JSON.parse(JSON.stringify(i));const c=[],e=xr(l,{parent:{list:!1,types:[...Qi,p.Project],optional:!0},declaration:{list:!1,types:[p.VariableDeclaration]}},a);return l=e.modifiedData,c.push(...e.errors,...rr(l)),{errors:c,modifiedData:l}}get codeName(){var i;return(i=this.declaration)==null?void 0:i.codeName}get codeNativeValueValidation(){var i;return this._codeNativeValueValidation||((i=this.declaration)==null?void 0:i.codeNativeValueValidation)||null}validateGeneratedUpdate(i){const a=[];let l=JSON.parse(JSON.stringify(i));const c=Cd(l,this);return l=c.modifiedData,a.push(...c.errors),i.parent&&a.push(new de({id:`${this.id}--${H.InvalidParentUpdate}`,code:H.InvalidParentUpdate,severity:ee.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
73
73
  If an entity is called by another, they must be in the same scope, which means they have the same parent.
74
74
  Specifically for variables, their scope is also calculated from their value readers and value writters.
75
75
  You shouldn't have to manually update a 'parent' property. The equivalent result is to change its value readers, value writters, or callers.`})),{errors:a,modifiedData:l}}subscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,"sync-dependents"))){const a=[],l=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),l.push(...v.added),c.push(...v.removed),e.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this}}onDetachedDependencyRemoved(i,a,l){const c=[],e=[],y=[],v=[];if(a==="parent"){const{updated:T,added:I,removed:b}=this.remove({ignoreUpstream:!1},l);c.push(...T),e.push(...I),y.push(...b)}if(a==="var-declaration"){const{updated:T,added:I,removed:b}=this.remove({ignoreUpstream:!1},l);c.push(...T),e.push(...I),y.push(...b)}return{updated:C(c),added:C(e),removed:C(y),affected:C(v),self:this}}onDetachedDependencyRestored(i,a,l){const c=[],e=[],y=[],v=[];if(a==="parent"){const{updated:T,added:I,removed:b}=this.restore({},l);c.push(...T),e.push(...I),y.push(...b)}if(a==="var-declaration"){const{updated:T,added:I,removed:b}=this.restore({},l);c.push(...T),e.push(...I),y.push(...b)}return{updated:C(c),added:C(e),removed:C(y),affected:C(v),self:this}}unsubscribeFromDependencies(){var i,a,l,c,e,y,v;return(a=(i=this.parent)==null?void 0:i.unsubscribeDependents)==null||a.call(i,[{entity:this,field:"parent"}]),(e=(c=(l=this.declaration.dataType)==null?void 0:l.entity)==null?void 0:c.unsubscribeDependents)==null||e.call(c,[{entity:this,field:"data-type-entity"}]),(v=(y=this.declaration)==null?void 0:y.unsubscribeDependents)==null||v.call(y,[{entity:this,field:"var-declaration"}]),this}subscribeToDependencies(){var i,a,l,c;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"parent"}]),(c=(l=(a=this.declaration.dataType)==null?void 0:a.entity)==null?void 0:l.subscribeDependents)==null||c.call(l,[{entity:this,field:"data-type-entity"}]),this.declaration.subscribeDependents([{entity:this,field:"var-declaration"}]),this}increaseVersion(i){if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&B(i).isSame(B(this.createdAt))?this:(this.previousVersion=this.version,this.version=L.UUID.uuid(),this.createdAt=B(i).toISOString()||B().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new Xt(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.inputs=[...this.inputs],i.outputs=[...this.outputs],i.internalCalls=[...this.internalCalls],i.successCalls=[...this.successCalls],i.errorCalls=[...this.errorCalls],i.writesValues=[...this.writesValues],i.readsValue=this.readsValue,i.defaultValue=this.defaultValue,i.declaration=this.declaration,i.calledBySuccess=[...this.calledBySuccess],i.calledByError=[...this.calledByError],i.calledByEntry=[...this.calledByEntry],i.error=this.error,i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const a=[],l=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),l.push(...y.added),c.push(...y.removed)}return{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this}}async restoreVersion(i){var v;const a=[],l=[],c=[],e=[];if(this.version===i)return{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this};if(!this.knownVersions){const T=new Map;for(const[I,b]of this.knownVersions||new Map){if(T.set(I,b),b.activeVersion=!1,b.knownVersions)for(const[D,V]of b.knownVersions)T.set(D,V);b.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const T=await this.APILoadVersion({},i);if(!T)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new Xt(T,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.inputs=y.inputs,this.outputs=y.outputs,this.internalCalls=y.internalCalls,this.successCalls=y.successCalls,this.errorCalls=y.errorCalls,this.writesValues=y.writesValues,this.readsValue=y.readsValue,this.defaultValue=y.defaultValue,this.declaration=y.declaration,this.calledBySuccess=y.calledBySuccess,this.calledByError=y.calledByError,this.calledByEntry=y.calledByEntry,this.error=y.error,this.parent=y.parent,{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,a))return Y.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),a==null||a.attemptAutoclose(P.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,a),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent){const l=te(i.parent),c=this.project.get(l),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(a),c)this.setParent(c,a);else throw a==null||a.attemptAutoclose(P.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose(P.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.readsValue){const l=te(i.readsValue),c=this.project.get(l),e=this.readsValue;e&&e.id!==(c==null?void 0:c.id)&&this.removeValueWriter(a),c&&this.setValueWriter(c,a)}if(i.declaration){const l=te(i.declaration),c=this.project.get(l);c&&this.setDeclaration(c)}return i.calledByEntry.forEach(l=>{const c=te(l),e=this.project.get(c);e&&(this.addEntryCaller(e,a),e.addCall(this,a))}),[...this.calledByEntry].forEach(l=>{i.calledByEntry.find(e=>te(e)===l.id)||(this.removeCaller(l,a),l.removeCall(this,a))}),i.calledBySuccess.forEach(l=>{const c=te(l),e=this.project.get(c);e&&(this.addSuccessCaller(e,a),e.addSuccessCall(this,a))}),[...this.calledBySuccess].forEach(l=>{i.calledBySuccess.find(e=>te(e)===l.id)||(this.removeCaller(l,a),l.removeCall(this,a))}),i.calledByError.forEach(l=>{const c=te(l),e=this.project.get(c);e&&(this.addErrorCaller(e,a),e.addErrorCall(this,a))}),[...this.calledBySuccess].forEach(l=>{i.calledBySuccess.find(e=>te(e)===l.id)||(this.removeCaller(l,a),l.removeCall(this,a))}),this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose(P.UpdateWithShallowTransfer,this.id),this}hydrateAncestors(){const i=[],a=[],l=[],c=[];if(this.initialData.parent){const e=te(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.readsValue){const e=te(this.initialData.readsValue),y=this.project.get(e);y&&(this.setValueWriter(y,null),i.push(y))}if(this.initialData.declaration){const e=te(this.initialData.declaration),y=this.project.get(e);y&&(this.setDeclaration(y),i.push(y))}return this.initialData.calledByEntry.forEach(e=>{const y=te(e),v=this.project.get(y);v&&this.addEntryCaller(v,null)}),this.initialData.calledBySuccess.forEach(e=>{const y=te(e),v=this.project.get(y);v&&this.addSuccessCaller(v,null)}),this.initialData.calledByError.forEach(e=>{const y=te(e),v=this.project.get(y);v&&this.addErrorCaller(v,null)}),{updated:C(i),added:C(a),removed:C(l),affected:C(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.AfterAllChildrenInitialized))){var Ie;if(!this.checkCanEdit(this,i))return Y.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(P.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const a=[],l=[],c=[],e=[];if(this.initialized=!0,!this.declaration.dataType||(Ie=this.declaration.dataType)!=null&&Ie.inferred){const{added:Re,updated:je,removed:Ve,affected:Be}=this.declaration.inferDataTypeAndSyncInstancesInputsAndOutputs(i);l.push(...Re),a.push(...je),c.push(...Ve),e.push(...Be)}const{added:y,updated:v,removed:T,affected:I}=this.syncInputs(i);l.push(...y),a.push(...v),c.push(...T),e.push(...I);const{added:b,updated:D,removed:V,affected:M}=this.syncOutputs(i);l.push(...b),a.push(...D),c.push(...V),e.push(...M);const{added:x,updated:q,removed:Z,affected:W}=this.generateUnusedInternalCalls(i);l.push(...x),a.push(...q),c.push(...Z),e.push(...W);const{added:z,updated:ae,removed:J,affected:fe}=this.removeUnrecognizedInputs(i);l.push(...z),a.push(...ae),c.push(...J),e.push(...fe);const{added:le,updated:ye,removed:me,affected:Q}=this.removeUnrecognizedOutputs(i);l.push(...le),a.push(...ye),c.push(...me),e.push(...Q);const{added:ue,updated:Ee,removed:_e,affected:$e}=this.removeUnrecognizedInternalCalls(i);return l.push(...ue),a.push(...Ee),c.push(..._e),e.push(...$e),this.inputs.sort((Re,je)=>{var Ve,Be;return(Re.index??((Ve=Re.declaration)==null?void 0:Ve.index))-(je.index??((Be=je.declaration)==null?void 0:Be.index))}),this.outputs.sort((Re,je)=>{var Ve,Be;return(Re.index??((Ve=Re.declaration)==null?void 0:Ve.index))-(je.index??((Be=je.declaration)==null?void 0:Be.index))}),this.captureVersion(),i==null||i.attemptAutoclose(P.AfterAllChildrenInitialized,this.id),{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){const a=[this],l=[],c=[],e=[];return this.parent===this.project&&this.project.addVariableInstance(this),this.readsValue&&(this.readsValue.addValueReader(this,i),a.push(this.readsValue)),this.writesValues.forEach(y=>{y.setValueWriter(this,i),a.push(y)}),this.successCalls.forEach(y=>{y.addSuccessCaller(this,i),a.push(y)}),this.errorCalls.forEach(y=>{y.addErrorCaller(this,i),a.push(y)}),this.calledBySuccess.forEach(y=>{y.addSuccessCall(this,i),a.push(y)}),this.calledByError.forEach(y=>{y.addErrorCall(this,i),a.push(y)}),this.calledByEntry.forEach(y=>{y.addCall(this,i),a.push(y)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}get usedInputs(){return this.inputs.filter(i=>i.readsValue||i.defaultValue)}get unusedInputs(){return this.inputs.filter(i=>!i.readsValue&&!i.defaultValue)}get usedOutputs(){return this.outputs.filter(i=>i.writesValues.length)}get unusedOutputs(){return this.outputs.filter(i=>!i.writesValues.length)}get usedInternalCalls(){return this.internalCalls.filter(i=>!!i.calledBy.length||!!i.writesValues.length||!!i.successCalls.length||!!i.errorCalls.length)}get unusedInternalCalls(){const i=this.usedInternalCalls;return this.internalCalls.filter(l=>!(i.find(y=>y.id===l.id)||i.find(y=>y.declaration===l.declaration)))}removeInternalCall(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,"remove-variable-instance-internal-call"))){const l=this.internalCalls.findIndex(c=>c.id===i.id);return l>-1&&(this.internalCalls.splice(l,1),a&&(a==null||a.add(this,k.Affected))),a==null||a.attemptAutoclose("remove-variable-instance-internal-call",this.id),this}removeInput(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.RemoveInput))){if(!this.checkCanEdit(this,a))return Y.warn(`[removeInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),a==null||a.attemptAutoclose(P.RemoveInput,this.id),this;const l=this.inputs.findIndex(c=>c.id===i.id);return l>-1&&(this.inputs.splice(l,1),a&&(a==null||a.add(this,k.Affected))),a==null||a.attemptAutoclose(P.RemoveInput,this.id),this}addInput(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.AddInput))){return this.checkCanEdit(this,a)?this.inputs.includes(i)?(a==null||a.attemptAutoclose(P.AddInput,this.id),this):(this.inputs.push(i),a==null||a.add(this,k.Affected),a==null||a.attemptAutoclose(P.AddInput,this.id),this):(Y.warn(`[addInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),a==null||a.attemptAutoclose(P.AddInput,this.id),this)}addOutput(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,"add-output"))){return this.checkCanEdit(this,a)?this.outputs.includes(i)?(a==null||a.attemptAutoclose("add-output",this.id),this):(this.outputs.push(i),a==null||a.add(this,k.Affected),a==null||a.attemptAutoclose("add-output",this.id),this):(Y.warn(`[addOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),a==null||a.attemptAutoclose("add-output",this.id),this)}removeOutput(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,"remove-output"))){if(!this.checkCanEdit(this,a))return Y.warn(`[removeOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),a==null||a.attemptAutoclose("remove-output",this.id),this;const l=this.outputs.findIndex(c=>c.id===i.id);return l>-1&&(this.outputs.splice(l,1),a&&(a==null||a.add(this,k.Affected))),a==null||a.attemptAutoclose("remove-output",this.id),this}addSuccessCaller(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.AddSuccessCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.AddSuccessCaller,a)?(this.calledBySuccess.find(c=>c.id===i.id)||(this.calledBySuccess.push(i),a==null||a.add(this,k.Updated),l&&et(this,a)),a==null||a.attemptAutoclose(P.AddSuccessCaller,this.id),this):this}addErrorCaller(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.AddErrorCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.AddErrorCaller,a)?(this.calledByError.find(c=>c.id===i.id)||(this.calledByError.push(i),a==null||a.add(this,k.Updated),l&&et(this,a)),a==null||a.attemptAutoclose(P.AddErrorCaller,this.id),this):this}addEntryCaller(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.AddEntryCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.AddEntryCaller,a)?(this.calledByEntry.find(c=>c.id===i.id)||(this.calledByEntry.push(i),a==null||a.add(this,k.Updated),l&&et(this,a)),a==null||a.attemptAutoclose(P.AddEntryCaller,this.id),this):this}addErrorCall(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.AddErrorCall)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.AddErrorCall,a)?(this.errorCalls.find(c=>c.id===i.id)||(this.errorCalls.push(i),l&&et(this,a),a==null||a.add(this,k.Affected)),a==null||a.attemptAutoclose(P.AddErrorCall,this.id),this):this}addSuccessCall(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.AddSuccessCall)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.AddSuccessCall,a)?(this.successCalls.find(c=>c.id===i.id)||(this.successCalls.push(i),l&&et(this,a),a==null||a.add(this,k.Affected)),a==null||a.attemptAutoclose(P.AddSuccessCall,this.id),this):this}removeCall(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.RemoveCall)),l=!1){if(!this.checkCanEditWithCounterpartAndSideEffects(this,i,P.RemoveCall,a))return this;const c=this.successCalls.findIndex(y=>y.id===i.id);c>-1&&(this.successCalls.splice(c,1),a==null||a.add(this,k.Affected));const e=this.errorCalls.findIndex(y=>y.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),a==null||a.add(this,k.Affected)),l&&et(this,a),a==null||a.attemptAutoclose(P.RemoveCall,this.id),this}removeCaller(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,"remove-caller")),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.RemoveCaller,a)?(this.calledBySuccess=this.calledBySuccess.filter(c=>c.id!==i.id?!0:(a==null||a.add(this,k.Updated),a==null||a.add(c,k.Affected),!1)),this.calledByError=this.calledByError.filter(c=>c.id!==i.id?!0:(a==null||a.add(this,k.Updated),a==null||a.add(c,k.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(c=>c.id!==i.id?!0:(a==null||a.add(this,k.Updated),a==null||a.add(c,k.Affected),!1)),l&&et(this,a),a==null||a.attemptAutoclose(P.RemoveCaller,this.id),this):this}addValueReader(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.AddValueReader))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,P.AddValueReader,a)?this.writesValues.includes(i)?(a==null||a.attemptAutoclose(P.AddValueReader,this.id),this):(this.writesValues.push(i),a==null||a.add(this,k.Affected),this):this}setParent(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.SetParent))){var l;return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.SetParent,a)?(((l=this.parent)==null?void 0:l.id)!==(i==null?void 0:i.id)&&(this.parent=i,a&&(a==null||a.add(this,k.Updated))),a==null||a.attemptAutoclose(P.SetParent,this.id),this):this}initChildren(i=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=ne(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(i)),this.initialData.declaration.type===p.GenericReference){const a=this.project.findSubscribedInstanceFromReference(this.initialData.declaration);if(!a)return this;this.declaration=a}else this.declaration=ne(this.initialData.declaration,this.project),this.declaration.initChildren(i);return Iy.initWritesValues(this,this.parent),$d.initReadsValue(this),this.initialData.inputs.forEach(a=>{const l=ne(a,this.project);return l.setParent(this,null),l.initChildren(i),this.addInput(l,null),l}),this.initialData.outputs.forEach(a=>{const l=ne(a,this.project);return l.setParent(this,null),l.initChildren(i),this.addOutput(l,i),l}),this.successCalls=this.initialData.successCalls.map(a=>{const l=ne(a,this.project);if(l.addSuccessCaller(this,null),[p.BreakStatement,p.ContinueStatement].includes(l.type))l.setParent(this.parent.parent,null),l.initChildren(i);else if(l.type===p.ReturnStatement){const c=Rr(this,this.project);l.setParent(c,null),l.initChildren(i)}else l.type!==p.InternalCall&&(l.setParent(this.parent,null),l.initChildren(i));return l}),this.errorCalls=this.initialData.errorCalls.map(a=>{const l=ne(a,this.project);if(l.addErrorCaller(this,null),[p.BreakStatement,p.ContinueStatement].includes(l.type))l.setParent(this.parent.parent,null),l.initChildren(i);else if(l.type===p.ReturnStatement){const c=Rr(this,this.project);l.setParent(c,null),l.initChildren(i)}else l.type!==p.InternalCall&&(l.setParent(this.parent,null),l.initChildren(i));return l}),this.internalCalls=this.initialData.internalCalls.reduce((a,l)=>{if(l.type===p.GenericReference){const c=this.project.findSubscribedInstanceFromReference(l);if(!c)return a;const e=c;return e.setParent(this,null),[...a,e]}else{const c=ne(l,this.project);return c.setParent(this,null),c.initChildren(i),[...a,c]}},[]),this.initialData.error&&(this.error=ne(this.initialData.error,this.project),this.error.setParent(this,null),this.error.initChildren(i)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this}setValueWriter(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.SetValueWriter))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,P.SetValueWriter,a)?(this.readsValue!==i&&(this.readsValue=i,a==null||a.add(this,k.Updated)),a==null||a.attemptAutoclose(P.SetValueWriter,this.id),this):this}removeValueWriter(i=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.RemoveValueWriter))){return this.readsValue&&!this.checkCanEditWithCounterpartAndSideEffects(this,this.readsValue,P.RemoveValueWriter,i)?this:(this.readsValue&&(this.readsValue=null,i==null||i.add(this,k.Updated)),i==null||i.attemptAutoclose(P.RemoveValueWriter,this.id),this)}removeValueReader(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.RemoveValueReader))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,P.RemoveValueReader,a)?this.writesValues.includes(i)?(this.writesValues=this.writesValues.filter(l=>l.id!==i.id),a==null||a.add(this,k.Affected),this):(a==null||a.attemptAutoclose(P.RemoveValueReader,this.id),this):this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const l=sr(this,i,a),c=nr(this,l),e=this.toMeta();return this.x=l.x||e.x,this.y=l.y||e.y,this.catchesError=l.catchesError!==void 0?l.catchesError:this.catchesError,super.baseMetaSync(l,this,a),l.deleted===!0&&!e.deleted?a==null||a.add(this,k.Removed):l.deleted===!1&&e.deleted?a==null||a.add(this,k.Added):c&&(a==null||a.add(this,k.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=we,...a){return await Xt.repository.APILoad(this.id,...a),this}async APICreate(i=we,...a){return await Xt.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=we,...a){return await Xt.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=we,...a){return await Xt.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=we,...a){return await Xt.repository.APIClone(this.id,...a),this}async APILoadVersion(i=we,a,...l){return await Xt.repository.APILoadVersion(this.id,a,...l)}removeFromParent(i=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.RemoveFromParent))){if(!this.checkCanEdit(this,i))return Y.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(P.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],l=[],c=[],e=[];return this.parent.type===p.Project?(this.parent.removeVariableInstance(this),e.push(this.parent)):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose(P.RemoveFromParent,this.id),{added:C(c),updated:C(a),removed:C(l),affected:C(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.RemoveEntity))){var v;if(!this.checkCanDelete(this,a))return Y.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),a==null||a.event({id:`${P.RemoveEntity}-${this.id}`,action:P.RemoveEntity,owner:this,errorReason:ji.ActionOwnerEntityNonDeletable,rootAction:((v=a==null?void 0:a.self)==null?void 0:v.id)===this.id&&(a==null?void 0:a.autoCloseActionName)===P.RemoveEntity}),a==null||a.attemptAutoclose(P.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const l=[],c=[],e=[],y=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose(P.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(c.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(T=>{const{updated:I,removed:b,added:D}=T.entity.onDetachedDependencyRemoved(this,T.field,a);l.push(...I),c.push(...b),e.push(...D)}),this.defaultValue){const{updated:T,removed:I}=this.defaultValue.remove({ignoreUpstream:!0},a);l.push(...T),c.push(...I)}if(this.readsValue&&(l.push(this.readsValue),this.readsValue.removeValueReader(this,a)),this.writesValues.forEach(T=>{l.push(T),T.setValueWriter(null,a)}),this.inputs.forEach(T=>{const{updated:I,removed:b}=T.remove({ignoreUpstream:!0},a);l.push(...I),c.push(...b)}),this.outputs.forEach(T=>{const{updated:I,removed:b}=T.remove({ignoreUpstream:!0},a);l.push(...I),c.push(...b)}),this.successCalls.forEach(T=>{l.push(T),T.removeCaller(this,a)}),this.errorCalls.forEach(T=>{l.push(T),T.removeCaller(this,a)}),this.internalCalls.forEach(T=>{const{updated:I,removed:b}=T.remove({ignoreUpstream:!0},a);l.push(...I),c.push(...b)}),!i){const T=this.removeFromParent(a);e.push(...T.added),l.push(...T.updated),c.push(...T.removed),y.push(...T.affected),this.calledBy.forEach(I=>{l.push(I),I.removeCall(this,a)})}return a==null||a.attemptAutoclose(P.RemoveEntity,this.id),{added:C(e),updated:C(l),removed:C(c),affected:C(y),self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.RestoreEntity))){if(!this.checkCanEdit(this,i))return Y.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(P.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],l=[],c=[],e=[];if(i!=null&&i.hasAdded(this.id))return i==null||i.attemptAutoclose(P.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(y=>{const{updated:v,removed:T,added:I}=y.entity.onDetachedDependencyRestored(this,y.field,i);l.push(...v),c.push(...T),a.push(...I)}),this.defaultValue){const{updated:y}=this.defaultValue.restore({},i);l.push(...y)}return this.readsValue&&(l.push(this.readsValue),this.readsValue.addValueReader(this,i)),this.writesValues.forEach(y=>{l.push(y),y.setValueWriter(this,i)}),this.inputs.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),this.outputs.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),this.successCalls.forEach(y=>{l.push(y),y.addSuccessCaller(this,i)}),this.errorCalls.forEach(y=>{l.push(y),y.addErrorCaller(this,i)}),this.internalCalls.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),this.calledBySuccess.forEach(y=>{l.push(y),y.addSuccessCall(this,i)}),this.calledByError.forEach(y=>{l.push(y),y.addErrorCall(this,i)}),this.calledByEntry.forEach(y=>{l.push(y),y.addCall(this,i)}),i==null||i.attemptAutoclose(P.RestoreEntity,this.id),{added:C(a),updated:C(l),removed:C(c),affected:C(e),self:this}}toFlat(i=new Set){var l,c;return i.has(this.id)?[]:(i.add(this.id),[this,...((l=this.defaultValue)==null?void 0:l.toFlat(i))||[],...this.writesValues.flatMap(e=>e.toFlat(i)),...((c=this.readsValue)==null?void 0:c.toFlat(i))||[],...this.successCalls.flatMap(e=>e.toFlat(i)),...this.errorCalls.flatMap(e=>e.toFlat(i)),...this.inputs.flatMap(e=>e.toFlat(i)),...this.outputs.flatMap(e=>e.toFlat(i)),...this.internalCalls.flatMap(e=>e.toFlat(i))])}toFlatIds(i=new Set){var l;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((l=this.defaultValue)==null?void 0:l.toFlatIds(i))||[],...this.writesValues.flatMap(c=>c.toFlatIds(i)),...this.successCalls.flatMap(c=>c.toFlatIds(i)),...this.errorCalls.flatMap(c=>c.toFlatIds(i)),...this.inputs.flatMap(c=>c.toFlatIds(i)),...this.outputs.flatMap(c=>c.toFlatIds(i)),...this.internalCalls.flatMap(c=>c.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,catchesError:this.catchesError,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,x:this.x,y:this.y,type:this.type,editable:this.editable,deletable:this.deletable}}toJSON(i=new Set){var a,l,c;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,catchesError:this.catchesError,type:this.type,editable:this.editable,deletable:this.deletable,declaration:this.declaration.toJSON(i),defaultValue:((a=this.defaultValue)==null?void 0:a.toJSON(i))||null,readsValue:((l=this.readsValue)==null?void 0:l.toReference())||null,writesValues:this.writesValues.map(e=>e.toJSON(i)),inputs:this.inputs.map(e=>e.toJSON(i)),outputs:this.outputs.map(e=>e.toJSON(i)),successCalls:this.successCalls.map(e=>e.toJSON(i)),errorCalls:this.errorCalls.map(e=>e.toJSON(i)),internalCalls:this.internalCalls.map(e=>e.toJSON(i)),calledBySuccess:this.calledBySuccess.map(e=>e.toReference()),calledByError:this.calledByError.map(e=>e.toReference()),calledByEntry:this.calledByEntry.map(e=>e.toReference()),parent:this.parent.toReference(),error:((c=this.error)==null?void 0:c.toJSON(i))||null,x:this.x,y:this.y})}toJSONClone(i=He){var l,c,e,y,v,T,I,b;let a;return(l=i.seenEntityMaps)!=null&&l.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||yr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(c=i.seenEntities)!=null&&c.has(a)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(a),(v=i.seenEntities)==null||v.add(this.id),{id:a,version:L.UUID.uuid(),createdAt:i.timestamp||B().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,catchesError:this.catchesError,type:this.type,editable:this.editable,deletable:this.deletable,defaultValue:((T=this.defaultValue)==null?void 0:T.toJSONClone({...i,newId:null}))||null,declaration:this.declaration.toReference({seenEntityMaps:i.seenEntityMaps}),readsValue:((I=this.readsValue)==null?void 0:I.toReference({seenEntityMaps:i.seenEntityMaps}))||null,writesValues:this.writesValues.map(D=>D.toJSONClone({...i,newId:null})),inputs:this.inputs.map(D=>D.toJSONClone({...i,newId:null})),outputs:this.outputs.map(D=>D.toJSONClone({...i,newId:null})),successCalls:this.successCalls.map(D=>D.toJSONClone({...i,newId:null})),errorCalls:this.errorCalls.map(D=>D.toJSONClone({...i,newId:null})),internalCalls:this.internalCalls.map(D=>this.calledBy.length||this.readsValue?D.toJSONClone({...i,newId:null}):D.toReference({seenEntityMaps:i.seenEntityMaps})),calledBySuccess:this.calledBySuccess.map(D=>D.toReference({seenEntityMaps:i.seenEntityMaps})),calledByError:this.calledByError.map(D=>D.toReference({seenEntityMaps:i.seenEntityMaps})),calledByEntry:this.calledByEntry.map(D=>D.toReference({seenEntityMaps:i.seenEntityMaps})),error:((b=this.error)==null?void 0:b.toJSONClone({...i,newId:null}))||null,parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps}),x:this.x,y:this.y})}toReference(i=He){var l;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+L.UUID.uuid()+"--ref",type:p.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=He){var l,c,e,y,v;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,catchesError:this.catchesError,type:this.type,editable:this.editable,deletable:this.deletable,x:this.x,y:this.y,defaultValue:((c=this.defaultValue)==null?void 0:c.toReference(i))||null,declaration:((e=this.declaration)==null?void 0:e.toReference(i))||null,readsValue:((y=this.readsValue)==null?void 0:y.toReference(i))||null,writesValues:this.writesValues.map(T=>T.toReference(i)),inputs:this.inputs.map(T=>T.toReference(i)),outputs:this.outputs.map(T=>T.toReference(i)),successCalls:this.successCalls.map(T=>T.toReference(i)),errorCalls:this.errorCalls.map(T=>T.toReference(i)),calledBySuccess:this.calledBySuccess.map(T=>T.toReference(i)),calledByError:this.calledByError.map(T=>T.toReference(i)),calledByEntry:this.calledByEntry.map(T=>T.toReference(i)),internalCalls:this.internalCalls.map(T=>T.toReference(i)),error:((v=this.error)==null?void 0:v.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var l,c;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((l=this.defaultValue)==null?void 0:l.toFlatJSON(i))||[],...((c=this.declaration)==null?void 0:c.toFlatJSON(i))||[],...this.writesValues.flatMap(e=>e.toFlatJSON(i)),...this.successCalls.flatMap(e=>e.toFlatJSON(i)),...this.errorCalls.flatMap(e=>e.toFlatJSON(i)),...this.inputs.flatMap(e=>e.toFlatJSON(i)),...this.outputs.flatMap(e=>e.toFlatJSON(i)),...this.internalCalls.flatMap(e=>e.toFlatJSON(i)),...this.calledBy.flatMap(e=>e.toFlatJSON(i))])}toGenerationTarget(){const i=this.parent.type===p.Project?void 0:this.parent.id;return{id:this.id,type:this.type,declaration:this.declaration.id,calledByEntry:this.calledByEntry.map(a=>a.id),calledBySuccess:this.calledBySuccess.map(a=>a.id),calledByError:this.calledByError.map(a=>a.id),parent:i}}toFlatGenerationTarget(i=new Set){var l,c,e;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((l=this.defaultValue)==null?void 0:l.toFlatGenerationTarget(i))||[],...((c=this.declaration)==null?void 0:c.toFlatGenerationTarget(i))||[],...((e=this.readsValue)==null?void 0:e.toFlatGenerationTarget(i))||[],...this.writesValues.flatMap(y=>y.toFlatGenerationTarget(i)),...this.successCalls.flatMap(y=>y.toFlatGenerationTarget(i)),...this.errorCalls.flatMap(y=>y.toFlatGenerationTarget(i)),...this.inputs.flatMap(y=>y.toFlatGenerationTarget(i)),...this.outputs.flatMap(y=>y.toFlatGenerationTarget(i)),...this.internalCalls.flatMap(y=>y.toFlatGenerationTarget(i))])}clearErrors(){var i;return this.errors=[],(i=this.defaultValue)==null||i.clearErrors(),this.inputs.forEach(a=>a.clearErrors()),this.outputs.forEach(a=>a.clearErrors()),this.successCalls.forEach(a=>a.clearErrors()),this.errorCalls.forEach(a=>a.clearErrors()),this.internalCalls.forEach(a=>a.clearErrors()),this}validate(){const i=h9(this);return this.errors=i,{success:!0}}getErrors(){var a,l;return[...this.errors,...((a=this.defaultValue)==null?void 0:a.getErrors())||[],...this.inputs.flatMap(c=>c.getErrors()),...this.internalCalls.flatMap(c=>c.getErrors()),...this.outputs.flatMap(c=>c.getErrors()),...((l=this.readsValue)==null?void 0:l.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var i;return this.defaultValue||((i=this.declaration)==null?void 0:i.defaultValue)||null}setDefaultValue(i,a=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,"set-default-value"))){if(!this.checkCanEdit(this,a))return Y.warn(`[setDefaultValue] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),a==null||a.attemptAutoclose("set-default-value",this.id),this;const l=this.defaultValue;return(l==null?void 0:l.id)!==(i==null?void 0:i.id)&&(l==null||l.remove({ignoreUpstream:!0},a),this.defaultValue=i,a==null||a.add(this,k.Affected)),a==null||a.attemptAutoclose("set-default-value",this.id),this}clone(i=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.CloneEntity)),a=null,l=null,c=!0){var M,x,q,Z;let e=fr(a,this);const y=this.toJSON(),v=l||L.UUID.uuid();y.inputs=[],y.id=v,y.version=L.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||B().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1,y.deletable=!0,y.editable=!0;const T=Ci(y,e);a?T.setParent(a,null):T.setParent(this.parent,null),c&&T.subscribe(),T.initChildren(i),i==null||i.add(T,k.Added);const I=(M=this.defaultValue)==null?void 0:M.clone(i,T,L.UUID.uuid(),c);T.defaultValue=I||null;const b=(x=this.inputs)==null?void 0:x.map(W=>W.clone(i,T,L.UUID.uuid(),c));T.inputs=b;const D=(q=this.outputs)==null?void 0:q.map(W=>W.clone(i,T,L.UUID.uuid(),c));T.outputs=D;const V=(Z=this.internalCalls)==null?void 0:Z.map(W=>W.clone(i,T,L.UUID.uuid(),c));return T.internalCalls=V,i==null||i.attemptAutoclose(P.CloneEntity,this.id),T}addInternalCall(i){return this.internalCalls.find(a=>a===i)||this.internalCalls.push(i),this}setDeclaration(i){return this.declaration!==i&&(this.declaration=i),this}removeUnrecognizedInputs(i=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.RemoveUnrecognizedInputs))){if(!this.checkCanEdit(this,i))return Y.warn(`[removeUnrecognizedInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(P.RemoveUnrecognizedInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const a=[],l=[],c=[],e=[];return this.declaration.dataType&&!this.declaration.dataType.isObject()?[...this.inputs].forEach(y=>{const v=y.remove({ignoreUpstream:!1},i);c.push(...v.removed),a.push(...v.updated)}):this.declaration.dataType&&this.declaration.dataType.hasStrictObjectStructure()&&[...this.inputs].forEach(y=>{var T;if(!y.declaration){const I=y.remove({ignoreUpstream:!1},i);c.push(...I.removed),a.push(...I.updated);return}if(![...((T=this.declaration.dataType)==null?void 0:T.entity).allProperties].find(I=>y.declaration===I)){const I=y.remove({ignoreUpstream:!1},i);c.push(...I.removed),a.push(...I.updated)}}),i==null||i.attemptAutoclose(P.RemoveUnrecognizedInputs,this.id),{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this}}removeUnrecognizedOutputs(i=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,"remove-unrecognized-variable-instance-outputs"))){if(!this.checkCanEdit(this,i))return Y.warn(`[removeUnrecognizedOutputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(P.RemoveUnrecognizedOutputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const a=[],l=[],c=[],e=[];return this.declaration.dataType&&!this.declaration.dataType.isObject()?[...this.outputs].forEach(y=>{const v=y.remove({ignoreUpstream:!1},i);c.push(...v.removed),a.push(...v.updated)}):this.declaration.dataType&&this.declaration.dataType.hasStrictObjectStructure()&&[...this.outputs].forEach(y=>{var T;if(!y.declaration){const I=y.remove({ignoreUpstream:!1},i);c.push(...I.removed),a.push(...I.updated);return}if(![...((T=this.declaration.dataType)==null?void 0:T.entity).allProperties].find(I=>y.declaration===I)){const I=y.remove({ignoreUpstream:!1},i);c.push(...I.removed),a.push(...I.updated)}}),i==null||i.attemptAutoclose("remove-unrecognized-variable-instance-outputs",this.id),{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this}}removeUnrecognizedInternalCalls(i=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,"remove-unrecognized-variable-declaration-internal-calls"))){const a=[],l=[],c=[],e=[];if(!this.declaration.dataType||!this.declaration.dataType.entity||![p.DefinitionEntity,p.PrimitiveEntity,p.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type))[...this.internalCalls].forEach(v=>{const T=v.remove({ignoreUpstream:!1},i);c.push(...T.removed),a.push(...T.updated)});else if(this.declaration.dataType&&this.declaration.dataType.entity&&[p.DefinitionEntity,p.PrimitiveEntity,p.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)){const v=[...this.declaration.dataType.entity.getAllInteractiveMethods()],T=[...v].filter(I=>!v.some(b=>{var D,V;return b.id!==I.id&&(((D=b.implements)==null?void 0:D.id)===I.id||((V=b.extends)==null?void 0:V.id)===I.id)})&&!I.deleted);[...this.internalCalls].forEach(I=>{if(!I.declaration){const D=I.remove({ignoreUpstream:!1},i);c.push(...D.removed),a.push(...D.updated);return}if(!T.find(D=>I.declaration===D)){const D=I.remove({ignoreUpstream:!1},i);c.push(...D.removed),a.push(...D.updated);return}})}return this.internalCalls.filter((v,T)=>{const I=this.internalCalls.findIndex(D=>D.declaration===v.declaration&&D!==v);if(I===-1)return!1;const b=this.internalCalls[I];return B(b==null?void 0:b.createdAt).isSame(B(v.createdAt))?T>I:!!B(b==null?void 0:b.createdAt).isAfter(v.createdAt)}).forEach(v=>{const T=v.remove({ignoreUpstream:!1},i);c.push(...T.removed),a.push(...T.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-variable-declaration-internal-calls",this.id),{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this}}syncInputs(i=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,"sync-variable-instance-inputs"))){const a=[],l=[],c=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity){if([p.DefinitionEntity,p.PrimitiveEntity,p.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList){const y=[...this.declaration.dataType.entity.properties];y.filter(b=>!b.getDataType(i)).forEach(b=>{const D=this.inputs.find(x=>S(x,this.project)===S(b,this.project));if(!D)return;const V=this.declaration.getMasterInputWithValueWritterFromAllInstances(D);if(!V)return;const M=ga(V);b.setDataType(M,i),D.setDeclaration(b,i)}),y.filter(b=>!this.inputs.find(D=>{var V;return((V=D.declaration)==null?void 0:V.id)===b.id})).forEach(b=>{const D={id:L.UUID.uuid(),version:L.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:L.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.InputMap,parentRelationType:null,parent:this.toReference(),name:null,description:null,codeName:null,declaration:b,defaultValue:null,index:b.index,readsValue:null},V=ne(D,this.project);return V.setParent(this,i),V.initChildren(i),i==null||i.add(V,k.Added),this.addInput(V,i),V}),this.inputs.filter(b=>!b.declaration).forEach(b=>{const D=y.find(V=>S(V,this.project)===S(b,this.project));D&&b.setDeclaration(D,i)})}}else return i==null||i.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:C(a),updated:C(l),removed:C(c),affected:C(e),self:this}}syncOutputs(i=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.SyncOutputs))){if(!this.checkCanEdit(this,i))return Y.warn(`[syncOutputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(P.SyncOutputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const a=[],l=[],c=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity)[p.DefinitionEntity,p.PrimitiveEntity,p.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList&&[...this.declaration.dataType.entity.properties].filter(T=>!this.outputs.find(I=>I.declaration===T)).map(T=>{const I={id:L.UUID.uuid(),version:L.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:L.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.OutputMap,parent:this.toReference(),declaration:T,index:T.index,writesValues:[]},b=ne(I,this.project);return b.setParent(this,i),b.initChildren(i),i==null||i.add(b,k.Added),this.addOutput(b,i),b});else return i==null||i.attemptAutoclose(P.SyncOutputs,this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose(P.SyncOutputs,this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose(P.SyncOutputs,this.id),{added:C(a),updated:C(l),removed:C(c),affected:C(e),self:this}}generateUnusedInternalCalls(i=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,"generate-unused-internal-calls"))){const a=[],l=[],c=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity){if([p.DefinitionEntity,p.PrimitiveEntity,p.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList){const y=[...this.declaration.dataType.entity.getAllInteractiveMethods()];[...y].filter(I=>!y.some(b=>{var D,V;return b.id!==I.id&&(((D=b.implements)==null?void 0:D.id)===I.id||((V=b.extends)==null?void 0:V.id)===I.id)})&&!I.deleted).filter(I=>!this.internalCalls.find(D=>{var M,x,q,Z,W;return(((M=D.declaration)==null?void 0:M.id)||((q=(x=D.initialData)==null?void 0:x.declaration)==null?void 0:q.entityId)||((W=(Z=D.initialData)==null?void 0:Z.declaration)==null?void 0:W.id))===I.id})).forEach(I=>{const b=this.internalCalls.find(D=>{const V=Od(D.declaration),M=Od(I);return V.id===M.id});if(b)b.setDeclaration(I),b.subscribeToDependencies();else{const D=I.createInternalCall(i,this);i==null||i.add(D,k.Added),this.addInternalCall(D)}})}}else return i==null||i.attemptAutoclose("generate-unused-internal-calls",this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose("generate-unused-internal-calls",this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose("generate-unused-internal-calls",this.id),{added:C(a),updated:C(l),removed:C(c),affected:C(e),self:this}}getDataType(i=this.project.addChangeSet(new G(this.project,L.sessionAuthor,B().toISOString(),this,!0,"get-data-type"))){var l;const a=((l=this.declaration)==null?void 0:l.getDataType(i))||null;return i==null||i.attemptAutoclose("get-data-type",this.id),a}getUnusedInputs(){return this.inputs.filter(i=>i.suggestion||!i.readsValue&&!i.defaultValue)}getUnusedOutputs(){return this.outputs.filter(i=>i.suggestion||!i.writesValues.length)}getUsedInputs(){return this.inputs.filter(i=>!i.suggestion&&(i.readsValue||i.defaultValue))}getUsedOutputs(){return this.outputs.filter(i=>!i.suggestion&&i.writesValues.length)}};_(Xt,"repository",{APICreate:async(i,...a)=>i,APIUpdate:async(i,...a)=>i,APIDelete:async(i,...a)=>i,APIClone:async(i,...a)=>{},APILoad:async(i,...a)=>null,APILoadVersion:async(i,a,...l)=>null}),_(Xt,"type",p.VariableInstance),_(Xt,"USER_MANAGED_PARENT_TYPES",[...Qi,p.Project]),_(Xt,"PARENT_TYPES",[...Xt.USER_MANAGED_PARENT_TYPES]),_(Xt,"MUTABLE_BASE_PROPERTIES",["catchesError"]),_(Xt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),_(Xt,"BASE_PROPERTIES",[...Xt.MUTABLE_BASE_PROPERTIES,...Xt.INMUTABLE_BASE_PROPERTIES]),_(Xt,"MUTABLE_META_PROPERTIES",[...Xt.MUTABLE_BASE_PROPERTIES,"x","y"]),_(Xt,"INMUTABLE_META_PROPERTIES",[...Xt.INMUTABLE_BASE_PROPERTIES]),_(Xt,"META_PROPERTIES",[...Xt.MUTABLE_META_PROPERTIES,...Xt.INMUTABLE_META_PROPERTIES]),_(Xt,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","readsValue"]),_(Xt,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),_(Xt,"UPSTREAM_PROPERTIES",[...Xt.MUTABLE_UPSTREAM_PROPERTIES,...Xt.INMUTABLE_UPSTREAM_PROPERTIES]),_(Xt,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues","inputs","outputs","successCalls","errorCalls","internalCalls"]),_(Xt,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),_(Xt,"DOWNSTREAM_PROPERTIES",[...Xt.MUTABLE_DOWNSTREAM_PROPERTIES,...Xt.INMUTABLE_DOWNSTREAM_PROPERTIES]),_(Xt,"PROPERTIES",[...Xt.META_PROPERTIES,...Xt.UPSTREAM_PROPERTIES,...Xt.DOWNSTREAM_PROPERTIES]);let ao=Xt;var m9=(d=>(d.Parent="variable-declaration-parent",d.DataTypeEntity="variable-declaration-data-type-entity",d.DataType="variable-declaration-data-type",d))(m9||{});const Qt=class Qt extends pr{constructor(i,a){super(i);_(this,"initialData");_(this,"id");_(this,"name");_(this,"codeName",null);_(this,"description",null);_(this,"required",!1);_(this,"constant",!1);_(this,"x");_(this,"y");_(this,"type",p.VariableDeclaration);_(this,"catchesError",!1);_(this,"defaultValue",null);_(this,"dataType",null);_(this,"writesValues",[]);_(this,"readsValue",null);_(this,"inputs",[]);_(this,"outputs",[]);_(this,"error",null);_(this,"calledBySuccess",[]);_(this,"calledByError",[]);_(this,"calledByEntry",[]);_(this,"successCalls",[]);_(this,"errorCalls",[]);_(this,"internalCalls",[]);_(this,"parent");_(this,"errors",[]);_(this,"project");_(this,"detachedDependents",{});_(this,"knownVersions",null);_(this,"activeVersion",!1);_(this,"initialized",!1);_(this,"startedInitialization",!1);_(this,"suggestion",!1);_(this,"codeNativeValueValidation",null);this.initialData=i,this.project=a,this.id=i.id,this.name=i.name,this.description=i.description,this.constant=i.constant,this.codeName=i.codeName,this.required=i.required,this.x=i.x,this.y=i.y,this.catchesError=i.catchesError||!1}static new(i=null){return{id:L.UUID.uuid(),version:L.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||L.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.VariableDeclaration,catchesError:!0,name:"",codeName:null,description:"",dataType:null,internalCalls:[],successCalls:[],errorCalls:[],readsValue:null,writesValues:[],defaultValue:null,constant:!1,required:!1,inputs:[],outputs:[],parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],error:null,x:0,y:0}}static fromGenerationTarget(i,a){let l=a;if(i.parent){const b=te(i.parent);l=a.get(b)}const c=i.calledByEntry.map(b=>{const D=te(b);return a.get(D)}),e=i.calledBySuccess.map(b=>{const D=te(b);return a.get(D)}),y=i.calledByError.map(b=>{const D=te(b);return a.get(D)});let v=null;if(i.readsValue){const b=te(i.readsValue);v=a.get(b)}const T={id:i.id,version:L.UUID.uuid(),createdAt:B().toISOString(),author:L.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.VariableDeclaration,catchesError:i.catchesError||!1,name:i.name,defaultValue:null,codeName:i.codeName||null,description:i.description||null,constant:i.constant||!1,required:i.required||!1,calledByEntry:c,calledBySuccess:e,calledByError:y,dataType:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:v,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:l},I=ne(T,a);return I.setParent(l,null),I}static validateGenerationTarget(i,a){let l=JSON.parse(JSON.stringify(i));const c=[],e=xr(l,{parent:{list:!1,types:[...Qi,p.Project],optional:!0}},a);l=e.modifiedData;const y=uR(l,a);return c.push(...e.errors,...y,...rr(l)),{errors:c,modifiedData:l}}get variableInstances(){const i=[];return Object.values(this.detachedDependents).forEach(a=>{a.field===JA.VarDeclaration&&!i.includes(a.entity)&&i.push(a.entity)}),i}validateGeneratedUpdate(i){const a=[];let l=JSON.parse(JSON.stringify(i));const c=Cd(l,this);return l=c.modifiedData,a.push(...c.errors),i.parent&&a.push(new de({id:`${this.id}--${H.InvalidParentUpdate}`,code:H.InvalidParentUpdate,severity:ee.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6579",
3
+ "version": "0.0.6581",
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",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@elyx-code/common-ts-utils": "^0.0.111",
31
- "@elyx-code/definitions": "^0.0.7992",
31
+ "@elyx-code/definitions": "^0.0.7994",
32
32
  "axios": "^1.9.0",
33
33
  "dayjs": "^1.11.13",
34
34
  "sql-parser-cst": "^0.33.1",