@elyx-code/project-logic-tree 0.0.6540 → 0.0.6541
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 +4 -2
- package/dist/index.js +0 -3
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5119,7 +5119,7 @@ export declare type DraggablePassThroughCallableEntityReference = PassThroughCal
|
|
|
5119
5119
|
|
|
5120
5120
|
export declare type DraggablePassThroughCallableEntityShallowTransfer = DraggablePassThroughCallableEntityWithOutputsShallowTransfer | IConditionShallowTransfer;
|
|
5121
5121
|
|
|
5122
|
-
export declare type DraggablePassThroughCallableEntityState =
|
|
5122
|
+
export declare type DraggablePassThroughCallableEntityState = DraggablePassThroughCallableEntityWithOutputsState | ConditionState;
|
|
5123
5123
|
|
|
5124
5124
|
export declare type DraggablePassThroughCallableEntityTransfer = DraggablePassThroughCallableEntityWithOutputsTransfer | IConditionTransfer;
|
|
5125
5125
|
|
|
@@ -5135,6 +5135,8 @@ export declare type DraggablePassThroughCallableEntityWithOutputsReference = IOp
|
|
|
5135
5135
|
|
|
5136
5136
|
export declare type DraggablePassThroughCallableEntityWithOutputsShallowTransfer = IOperationShallowTransfer | IFunctionCallShallowTransfer | ISearchShallowTransfer | IVariableDeclarationShallowTransfer | IVariableInstanceShallowTransfer | ILoopShallowTransfer;
|
|
5137
5137
|
|
|
5138
|
+
export declare type DraggablePassThroughCallableEntityWithOutputsState = OperationState | FunctionCallState | SearchState | VariableDeclarationState | VariableInstanceState | LoopState;
|
|
5139
|
+
|
|
5138
5140
|
export declare type DraggablePassThroughCallableEntityWithOutputsTransfer = IOperationTransfer | IFunctionCallTransfer | ISearchTransfer | IVariableDeclarationTransfer | IVariableInstanceTransfer | ILoopTransfer;
|
|
5139
5141
|
|
|
5140
5142
|
export declare type DraggablePassThroughCallableEntityWithOutputsTypesUnion = DraggablePassThroughCallableEntityWithOutputs | DraggablePassThroughCallableEntityWithOutputsTransfer | DraggablePassThroughCallableEntityWithOutputsShallowTransfer | DraggablePassThroughCallableEntityWithOutputsGenerationTarget;
|
|
@@ -17206,7 +17208,7 @@ export declare type PassThroughCallableEntityWithOutputsReference = DraggablePas
|
|
|
17206
17208
|
|
|
17207
17209
|
export declare type PassThroughCallableEntityWithOutputsShallowTransfer = DraggablePassThroughCallableEntityWithOutputsShallowTransfer | IInternalCallShallowTransfer;
|
|
17208
17210
|
|
|
17209
|
-
export declare type PassThroughCallableEntityWithOutputsState =
|
|
17211
|
+
export declare type PassThroughCallableEntityWithOutputsState = DraggablePassThroughCallableEntityWithOutputsState | InternalCallState;
|
|
17210
17212
|
|
|
17211
17213
|
export declare type PassThroughCallableEntityWithOutputsTransfer = DraggablePassThroughCallableEntityWithOutputsTransfer | IInternalCallTransfer;
|
|
17212
17214
|
|
package/dist/index.js
CHANGED
|
@@ -71391,14 +71391,12 @@ class Fo extends Uu {
|
|
|
71391
71391
|
`No implementation found for built-in function: ${i.declaration.id}`
|
|
71392
71392
|
);
|
|
71393
71393
|
} else {
|
|
71394
|
-
debugger;
|
|
71395
71394
|
T = await this.executeDetachedFullFunctionDeclarationLogic(
|
|
71396
71395
|
i.declaration,
|
|
71397
71396
|
a,
|
|
71398
71397
|
l,
|
|
71399
71398
|
e
|
|
71400
71399
|
);
|
|
71401
|
-
debugger;
|
|
71402
71400
|
let I = null;
|
|
71403
71401
|
if (T.error) {
|
|
71404
71402
|
H.warn("Raw error executing entity: ", T.error);
|
|
@@ -73357,7 +73355,6 @@ class Fo extends Uu {
|
|
|
73357
73355
|
l,
|
|
73358
73356
|
f
|
|
73359
73357
|
);
|
|
73360
|
-
debugger;
|
|
73361
73358
|
if (this.removeFromExecutingList(i), this.addToAlreadyExecutedList(i), this.storeLastExecutionValues(v), await ((T = f.onEntityExecuted) == null ? void 0 : T.call(
|
|
73362
73359
|
f,
|
|
73363
73360
|
i,
|
package/dist/index.umd.cjs
CHANGED
|
@@ -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[p7]=this[p7]={accessors:{}}).accessors,l=this.prototype;function f(e){const y=Zc(e);a[y]||(UCe(l,e),a[y]=!0)}return we.isArray(u)?u.forEach(f):f(u),this}}Um.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),we.reduceDescriptors(Um.prototype,({value:d},u)=>{let i=u[0].toUpperCase()+u.slice(1);return{get:()=>d,set(a){this[i]=a}}}),we.freezeMethods(Um);const Hs=Um;function EA(d,u){const i=this||vA,a=u||i,l=Hs.from(a.headers);let f=a.data;return we.forEach(d,function(y){f=y.call(i,f,l.normalize(),u?u.status:void 0)}),l.normalize(),f}function c7(d){return!!(d&&d.__CANCEL__)}function ku(d,u,i){Ut.call(this,d??"canceled",Ut.ERR_CANCELED,u,i),this.name="CanceledError"}we.inherits(ku,Ut,{__CANCEL__:!0});function f7(d,u,i){const a=i.config.validateStatus;!i.status||!a||a(i.status)?d(i):u(new Ut("Request failed with status code "+i.status,[Ut.ERR_BAD_REQUEST,Ut.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function jCe(d){const u=/^([-+\w]{1,25})(:?\/\/|:)/.exec(d);return u&&u[1]||""}function GCe(d,u){d=d||10;const i=new Array(d),a=new Array(d);let l=0,f=0,e;return u=u!==void 0?u:1e3,function(v){const T=Date.now(),A=a[f];e||(e=T),i[l]=v,a[l]=T;let I=f,O=0;for(;I!==l;)O+=i[I++],I=I%d;if(l=(l+1)%d,l===f&&(f=(f+1)%d),T-e<u)return;const L=A&&T-A;return L?Math.round(O*1e3/L):void 0}}function kCe(d,u){let i=0,a=1e3/u,l,f;const e=(T,A=Date.now())=>{i=A,l=null,f&&(clearTimeout(f),f=null),d.apply(null,T)};return[(...T)=>{const A=Date.now(),I=A-i;I>=a?e(T,A):(l=T,f||(f=setTimeout(()=>{f=null,e(l)},a-I)))},()=>l&&e(l)]}const jm=(d,u,i=3)=>{let a=0;const l=GCe(50,250);return kCe(f=>{const e=f.loaded,y=f.lengthComputable?f.total:void 0,v=e-a,T=l(v),A=e<=y;a=e;const I={loaded:e,total:y,progress:y?e/y:void 0,bytes:v,rate:T||void 0,estimated:T&&y&&A?(y-e)/T:void 0,event:f,lengthComputable:y!=null,[u?"download":"upload"]:!0};d(I)},i)},y7=(d,u)=>{const i=d!=null;return[a=>u[0]({lengthComputable:i,total:d,loaded:a}),u[1]]},h7=d=>(...u)=>we.asap(()=>d(...u)),FCe=dn.hasStandardBrowserEnv?((d,u)=>i=>(i=new URL(i,dn.origin),d.protocol===i.protocol&&d.host===i.host&&(u||d.port===i.port)))(new URL(dn.origin),dn.navigator&&/(msie|trident)/i.test(dn.navigator.userAgent)):()=>!0,KCe=dn.hasStandardBrowserEnv?{write(d,u,i,a,l,f){const e=[d+"="+encodeURIComponent(u)];we.isNumber(i)&&e.push("expires="+new Date(i).toGMTString()),we.isString(a)&&e.push("path="+a),we.isString(l)&&e.push("domain="+l),f===!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 qCe(d){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(d)}function ZCe(d,u){return u?d.replace(/\/?\/$/,"")+"/"+u.replace(/^\/+/,""):d}function m7(d,u,i){let a=!qCe(u);return d&&(a||i==!1)?ZCe(d,u):u}const v7=d=>d instanceof Hs?{...d}:d;function hd(d,u){u=u||{};const i={};function a(T,A,I,O){return we.isPlainObject(T)&&we.isPlainObject(A)?we.merge.call({caseless:O},T,A):we.isPlainObject(A)?we.merge({},A):we.isArray(A)?A.slice():A}function l(T,A,I,O){if(we.isUndefined(A)){if(!we.isUndefined(T))return a(void 0,T,I,O)}else return a(T,A,I,O)}function f(T,A){if(!we.isUndefined(A))return a(void 0,A)}function e(T,A){if(we.isUndefined(A)){if(!we.isUndefined(T))return a(void 0,T)}else return a(void 0,A)}function y(T,A,I){if(I in u)return a(T,A);if(I in d)return a(void 0,T)}const v={url:f,method:f,data:f,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,A,I)=>l(v7(T),v7(A),I,!0)};return we.forEach(Object.keys(Object.assign({},d,u)),function(A){const I=v[A]||l,O=I(d[A],u[A],A);we.isUndefined(O)&&I!==y||(i[A]=O)}),i}const T7=d=>{const u=hd({},d);let{data:i,withXSRFToken:a,xsrfHeaderName:l,xsrfCookieName:f,headers:e,auth:y}=u;u.headers=e=Hs.from(e),u.url=l7(m7(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(we.isFormData(i)){if(dn.hasStandardBrowserEnv||dn.hasStandardBrowserWebWorkerEnv)e.setContentType(void 0);else if((v=e.getContentType())!==!1){const[T,...A]=v?v.split(";").map(I=>I.trim()).filter(Boolean):[];e.setContentType([T||"multipart/form-data",...A].join("; "))}}if(dn.hasStandardBrowserEnv&&(a&&we.isFunction(a)&&(a=a(u)),a||a!==!1&&FCe(u.url))){const T=l&&f&&KCe.read(f);T&&e.set(l,T)}return u},WCe=typeof XMLHttpRequest<"u"&&function(d){return new Promise(function(i,a){const l=T7(d);let f=l.data;const e=Hs.from(l.headers).normalize();let{responseType:y,onUploadProgress:v,onDownloadProgress:T}=l,A,I,O,L,M;function j(){L&&L(),M&&M(),l.cancelToken&&l.cancelToken.unsubscribe(A),l.signal&&l.signal.removeEventListener("abort",A)}let q=new XMLHttpRequest;q.open(l.method.toUpperCase(),l.url,!0),q.timeout=l.timeout;function Z(){if(!q)return;const z=Hs.from("getAllResponseHeaders"in q&&q.getAllResponseHeaders()),fe={data:!y||y==="text"||y==="json"?q.responseText:q.response,status:q.status,statusText:q.statusText,headers:z,config:d,request:q};f7(function(ne){i(ne),j()},function(ne){a(ne),j()},fe),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 Ut("Request aborted",Ut.ECONNABORTED,d,q)),q=null)},q.onerror=function(){a(new Ut("Network Error",Ut.ERR_NETWORK,d,q)),q=null},q.ontimeout=function(){let ue=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded";const fe=l.transitional||d7;l.timeoutErrorMessage&&(ue=l.timeoutErrorMessage),a(new Ut(ue,fe.clarifyTimeoutError?Ut.ETIMEDOUT:Ut.ECONNABORTED,d,q)),q=null},f===void 0&&e.setContentType(null),"setRequestHeader"in q&&we.forEach(e.toJSON(),function(ue,fe){q.setRequestHeader(fe,ue)}),we.isUndefined(l.withCredentials)||(q.withCredentials=!!l.withCredentials),y&&y!=="json"&&(q.responseType=l.responseType),T&&([O,M]=jm(T,!0),q.addEventListener("progress",O)),v&&q.upload&&([I,L]=jm(v),q.upload.addEventListener("progress",I),q.upload.addEventListener("loadend",L)),(l.cancelToken||l.signal)&&(A=z=>{q&&(a(!z||z.type?new ku(null,d,q):z),q.abort(),q=null)},l.cancelToken&&l.cancelToken.subscribe(A),l.signal&&(l.signal.aborted?A():l.signal.addEventListener("abort",A)));const H=jCe(l.url);if(H&&dn.protocols.indexOf(H)===-1){a(new Ut("Unsupported protocol "+H+":",Ut.ERR_BAD_REQUEST,d));return}q.send(f||null)})},HCe=(d,u)=>{const{length:i}=d=d?d.filter(Boolean):[];if(u||i){let a=new AbortController,l;const f=function(T){if(!l){l=!0,y();const A=T instanceof Error?T:this.reason;a.abort(A instanceof Ut?A:new ku(A instanceof Error?A.message:A))}};let e=u&&setTimeout(()=>{e=null,f(new Ut(`timeout ${u} of ms exceeded`,Ut.ETIMEDOUT))},u);const y=()=>{d&&(e&&clearTimeout(e),e=null,d.forEach(T=>{T.unsubscribe?T.unsubscribe(f):T.removeEventListener("abort",f)}),d=null)};d.forEach(T=>T.addEventListener("abort",f));const{signal:v}=a;return v.unsubscribe=()=>we.asap(y),v}},SCe=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},JCe=async function*(d,u){for await(const i of zCe(d))yield*SCe(i,u)},zCe=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()}},E7=(d,u,i,a)=>{const l=JCe(d,u);let f=0,e,y=v=>{e||(e=!0,a&&a(v))};return new ReadableStream({async pull(v){try{const{done:T,value:A}=await l.next();if(T){y(),v.close();return}let I=A.byteLength;if(i){let O=f+=I;i(O)}v.enqueue(new Uint8Array(A))}catch(T){throw y(T),T}},cancel(v){return y(v),l.return()}},{highWaterMark:2})},Gm=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",b7=Gm&&typeof ReadableStream=="function",YCe=Gm&&(typeof TextEncoder=="function"?(d=>u=>d.encode(u))(new TextEncoder):async d=>new Uint8Array(await new Response(d).arrayBuffer())),I7=(d,...u)=>{try{return!!d(...u)}catch{return!1}},XCe=b7&&I7(()=>{let d=!1;const u=new Request(dn.origin,{body:new ReadableStream,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!u}),A7=64*1024,bA=b7&&I7(()=>we.isReadableStream(new Response("").body)),km={stream:bA&&(d=>d.body)};Gm&&(d=>{["text","arrayBuffer","blob","formData","stream"].forEach(u=>{!km[u]&&(km[u]=we.isFunction(d[u])?i=>i[u]():(i,a)=>{throw new Ut(`Response type '${u}' is not supported`,Ut.ERR_NOT_SUPPORT,a)})})})(new Response);const QCe=async d=>{if(d==null)return 0;if(we.isBlob(d))return d.size;if(we.isSpecCompliantForm(d))return(await new Request(dn.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(we.isArrayBufferView(d)||we.isArrayBuffer(d))return d.byteLength;if(we.isURLSearchParams(d)&&(d=d+""),we.isString(d))return(await YCe(d)).byteLength},e_e=async(d,u)=>{const i=we.toFiniteNumber(d.getContentLength());return i??QCe(u)},IA={http:bCe,xhr:WCe,fetch:Gm&&(async d=>{let{url:u,method:i,data:a,signal:l,cancelToken:f,timeout:e,onDownloadProgress:y,onUploadProgress:v,responseType:T,headers:A,withCredentials:I="same-origin",fetchOptions:O}=T7(d);T=T?(T+"").toLowerCase():"text";let L=HCe([l,f&&f.toAbortSignal()],e),M;const j=L&&L.unsubscribe&&(()=>{L.unsubscribe()});let q;try{if(v&&XCe&&i!=="get"&&i!=="head"&&(q=await e_e(A,a))!==0){let fe=new Request(u,{method:"POST",body:a,duplex:"half"}),ee;if(we.isFormData(a)&&(ee=fe.headers.get("content-type"))&&A.setContentType(ee),fe.body){const[ne,me]=y7(q,jm(h7(v)));a=E7(fe.body,A7,ne,me)}}we.isString(I)||(I=I?"include":"omit");const Z="credentials"in Request.prototype;M=new Request(u,{...O,signal:L,method:i.toUpperCase(),headers:A.normalize().toJSON(),body:a,duplex:"half",credentials:Z?I:void 0});let H=await fetch(M);const z=bA&&(T==="stream"||T==="response");if(bA&&(y||z&&j)){const fe={};["status","statusText","headers"].forEach(pe=>{fe[pe]=H[pe]});const ee=we.toFiniteNumber(H.headers.get("content-length")),[ne,me]=y&&y7(ee,jm(h7(y),!0))||[];H=new Response(E7(H.body,A7,ne,()=>{me&&me(),j&&j()}),fe)}T=T||"text";let ue=await km[we.findKey(km,T)||"text"](H,d);return!z&&j&&j(),await new Promise((fe,ee)=>{f7(fe,ee,{data:ue,headers:Hs.from(H.headers),status:H.status,statusText:H.statusText,config:d,request:M})})}catch(Z){throw j&&j(),Z&&Z.name==="TypeError"&&/Load failed|fetch/i.test(Z.message)?Object.assign(new Ut("Network Error",Ut.ERR_NETWORK,d,M),{cause:Z.cause||Z}):Ut.from(Z,Z&&Z.code,d,M)}})};we.forEach(IA,(d,u)=>{if(d){try{Object.defineProperty(d,"name",{value:u})}catch{}Object.defineProperty(d,"adapterName",{value:u})}});const w7=d=>`- ${d}`,t_e=d=>we.isFunction(d)||d===null||d===!1,R7={getAdapter:d=>{d=we.isArray(d)?d:[d];const{length:u}=d;let i,a;const l={};for(let f=0;f<u;f++){i=d[f];let e;if(a=i,!t_e(i)&&(a=IA[(e=String(i)).toLowerCase()],a===void 0))throw new Ut(`Unknown adapter '${e}'`);if(a)break;l[e||"#"+f]=a}if(!a){const f=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?f.length>1?`since :
|
|
70
70
|
`+f.map(w7).join(`
|
|
71
71
|
`):" "+w7(f[0]):"as no adapter specified";throw new Ut("There is no suitable adapter to dispatch the request "+e,"ERR_NOT_SUPPORT")}return a},adapters:IA};function AA(d){if(d.cancelToken&&d.cancelToken.throwIfRequested(),d.signal&&d.signal.aborted)throw new ku(null,d)}function g7(d){return AA(d),d.headers=Hs.from(d.headers),d.data=EA.call(d,d.transformRequest),["post","put","patch"].indexOf(d.method)!==-1&&d.headers.setContentType("application/x-www-form-urlencoded",!1),R7.getAdapter(d.adapter||vA.adapter)(d).then(function(a){return AA(d),a.data=EA.call(d,d.transformResponse,a),a.headers=Hs.from(a.headers),a},function(a){return c7(a)||(AA(d),a&&a.response&&(a.response.data=EA.call(d,d.transformResponse,a.response),a.response.headers=Hs.from(a.response.headers))),Promise.reject(a)})}const C7="1.9.0",Fm={};["object","boolean","number","function","string","symbol"].forEach((d,u)=>{Fm[d]=function(a){return typeof a===d||"a"+(u<1?"n ":" ")+d}});const _7={};Fm.transitional=function(u,i,a){function l(f,e){return"[Axios v"+C7+"] Transitional option '"+f+"'"+e+(a?". "+a:"")}return(f,e,y)=>{if(u===!1)throw new Ut(l(e," has been removed"+(i?" in "+i:"")),Ut.ERR_DEPRECATED);return i&&!_7[e]&&(_7[e]=!0,console.warn(l(e," has been deprecated since v"+i+" and will be removed in the near future"))),u?u(f,e,y):!0}},Fm.spelling=function(u){return(i,a)=>(console.warn(`${a} is likely a misspelling of ${u}`),!0)};function i_e(d,u,i){if(typeof d!="object")throw new Ut("options must be an object",Ut.ERR_BAD_OPTION_VALUE);const a=Object.keys(d);let l=a.length;for(;l-- >0;){const f=a[l],e=u[f];if(e){const y=d[f],v=y===void 0||e(y,f,d);if(v!==!0)throw new Ut("option "+f+" must be "+v,Ut.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new Ut("Unknown option "+f,Ut.ERR_BAD_OPTION)}}const Km={assertOptions:i_e,validators:Fm},Ia=Km.validators;class qm{constructor(u){this.defaults=u||{},this.interceptors={request:new o7,response:new o7}}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 f=l.stack?l.stack.replace(/^.+\n/,""):"";try{a.stack?f&&!String(a.stack).endsWith(f.replace(/^.+\n.+\n/,""))&&(a.stack+=`
|
|
72
|
-
`+f):a.stack=f}catch{}}throw a}}_request(u,i){typeof u=="string"?(i=i||{},i.url=u):i=u||{},i=hd(this.defaults,i);const{transitional:a,paramsSerializer:l,headers:f}=i;a!==void 0&&Km.assertOptions(a,{silentJSONParsing:Ia.transitional(Ia.boolean),forcedJSONParsing:Ia.transitional(Ia.boolean),clarifyTimeoutError:Ia.transitional(Ia.boolean)},!1),l!=null&&(we.isFunction(l)?i.paramsSerializer={serialize:l}:Km.assertOptions(l,{encode:Ia.function,serialize:Ia.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),Km.assertOptions(i,{baseUrl:Ia.spelling("baseURL"),withXsrfToken:Ia.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=f&&we.merge(f.common,f[i.method]);f&&we.forEach(["delete","get","head","post","put","patch","common"],M=>{delete f[M]}),i.headers=Hs.concat(e,f);const y=[];let v=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(i)===!1||(v=v&&j.synchronous,y.unshift(j.fulfilled,j.rejected))});const T=[];this.interceptors.response.forEach(function(j){T.push(j.fulfilled,j.rejected)});let A,I=0,O;if(!v){const M=[g7.bind(this),void 0];for(M.unshift.apply(M,y),M.push.apply(M,T),O=M.length,A=Promise.resolve(i);I<O;)A=A.then(M[I++],M[I++]);return A}O=y.length;let L=i;for(I=0;I<O;){const M=y[I++],j=y[I++];try{L=M(L)}catch(q){j.call(this,q);break}}try{A=g7.call(this,L)}catch(M){return Promise.reject(M)}for(I=0,O=T.length;I<O;)A=A.then(T[I++],T[I++]);return A}getUri(u){u=hd(this.defaults,u);const i=m7(u.baseURL,u.url,u.allowAbsoluteUrls);return l7(i,u.params,u.paramsSerializer)}}we.forEach(["delete","get","head","options"],function(u){qm.prototype[u]=function(i,a){return this.request(hd(a||{},{method:u,url:i,data:(a||{}).data}))}}),we.forEach(["post","put","patch"],function(u){function i(a){return function(f,e,y){return this.request(hd(y||{},{method:u,headers:a?{"Content-Type":"multipart/form-data"}:{},url:f,data:e}))}}qm.prototype[u]=i(),qm.prototype[u+"Form"]=i(!0)});const Zm=qm;class wA{constructor(u){if(typeof u!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(f){i=f});const a=this;this.promise.then(l=>{if(!a._listeners)return;let f=a._listeners.length;for(;f-- >0;)a._listeners[f](l);a._listeners=null}),this.promise.then=l=>{let f;const e=new Promise(y=>{a.subscribe(y),f=y}).then(l);return e.cancel=function(){a.unsubscribe(f)},e},u(function(f,e,y){a.reason||(a.reason=new ku(f,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 wA(function(l){u=l}),cancel:u}}}const r_e=wA;function n_e(d){return function(i){return d.apply(null,i)}}function s_e(d){return we.isObject(d)&&d.isAxiosError===!0}const RA={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(RA).forEach(([d,u])=>{RA[u]=d});const a_e=RA;function D7(d){const u=new Zm(d),i=WK(Zm.prototype.request,u);return we.extend(i,Zm.prototype,u,{allOwnKeys:!0}),we.extend(i,u,null,{allOwnKeys:!0}),i.create=function(l){return D7(hd(d,l))},i}const _r=D7(vA);_r.Axios=Zm,_r.CanceledError=ku,_r.CancelToken=r_e,_r.isCancel=c7,_r.VERSION=C7,_r.toFormData=Mm,_r.AxiosError=Ut,_r.Cancel=_r.CanceledError,_r.all=function(u){return Promise.all(u)},_r.spread=n_e,_r.isAxiosError=s_e,_r.mergeConfig=hd,_r.AxiosHeaders=Hs,_r.formToJSON=d=>u7(we.isHTMLForm(d)?new FormData(d):d),_r.getAdapter=R7.getAdapter,_r.HttpStatusCode=a_e,_r.default=_r;const l_e=_r;class O7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ri.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:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class P7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ri.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:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class $7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ri.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:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class N7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ri.Division);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),[f,e]=l;if(e===0)throw new Error("Division by zero is not allowed");const y=f/e;return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class V7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ri.Remainder);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),[f,e]=l;if(e===0)throw new Error("Division by zero is not allowed");const y=f%e;return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class L7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ri.Exponentiation);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),[f,e]=l,y=Math.pow(f,e);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class B7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateRandomInteger);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1],y=Pge(f,e);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class M7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateRandomFloat);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=FK();return{value:J.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class x7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateRandomHexadecimal);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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=KK(f);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class U7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateRandomBase62);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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=qK(f);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class j7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateRandomBase64);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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=Nge(f);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class G7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateRandomAlphanumeric);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(f);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class k7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateIdentifier);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1],y=ZK(f,e);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class F7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateRandomUUIDv4);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=fd();return{value:J.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class K7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{S.log("Initializing Random Generate Short Identifier Module");const a=i.find(l=>l.contextType===Ce.Logic);if(a){S.log("Project state found, setting up operation");const l=a.get(Ge.GenerateShortIdentifier);l?(S.log("Operation found, setting autoexecutable and implementation"),l.autoexecutable=!0,l.implementation=this.module.main):S.warn("Operation generate-short-identifier not found in project state")}else S.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,a)=>{try{const l=Lge();return{value:J.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class q7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateHexadecimalToken);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=Bge();return{value:J.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Z7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.Join);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],y=l.slice(1).join(f);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class W7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT,version:"1.0.0",description:"String split operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.Split);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1],y=f.split(e);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class H7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST,version:"1.0.0",description:"String delete last operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.DeleteLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const e=f.slice(0,-1);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class S7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST,version:"1.0.0",description:"String delete first operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.DeleteFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const e=f.slice(1);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class J7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.Reverse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const e=f.split("").reverse().join("");return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class z7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.ToLowerCase);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const e=f.toLowerCase();return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Y7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.ToUpperCase);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const e=f.toUpperCase();return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class X7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.DeleteIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>=f.length)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Index out of bounds",result:null};const y=f.slice(0,e)+f.slice(e+1);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Q7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.AddIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var A,I;return((A=T.value)==null?void 0:A.valueAsType)||((I=T.value)==null?void 0:I.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>f.length)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Index out of bounds",result:null};const v=f.slice(0,e)+y+f.slice(e);return{value:J.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class eq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST,version:"1.0.0",description:"String replace first operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.ReplaceFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var A,I;return((A=T.value)==null?void 0:A.valueAsType)||((I=T.value)==null?void 0:I.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const v=f.replace(e,y);return{value:J.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class tq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST,version:"1.0.0",description:"String replace last operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.ReplaceLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(A=>{var I,O;return((I=A.value)==null?void 0:I.valueAsType)||((O=A.value)==null?void 0:O.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const v=f.lastIndexOf(e);if(v===-1)return{value:J.Success,error:null,result:f};const T=f.slice(0,v)+f.slice(v).replace(e,y);return{value:J.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class iq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.ReplaceIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var A,I;return((A=T.value)==null?void 0:A.valueAsType)||((I=T.value)==null?void 0:I.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>=f.length)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Index out of bounds",result:null};const v=f.slice(0,e)+y+f.slice(e+1);return{value:J.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class rq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_SINGLE_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.ReplaceSingleMatch);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var A,I;return((A=T.value)==null?void 0:A.valueAsType)||((I=T.value)==null?void 0:I.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const v=f.replace(e,y);return{value:J.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class nq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.ReplaceAllMatches);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var A,I;return((A=T.value)==null?void 0:A.valueAsType)||((I=T.value)==null?void 0:I.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const v=f.split(e).join(y);return{value:J.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class sq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.GetIndexItem);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const y=f.charAt(e);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class aq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST,version:"1.0.0",description:"String get first operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.GetFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const e=f.charAt(0);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class lq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST,version:"1.0.0",description:"String get last operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.GetLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const e=f.charAt(f.length-1);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class oq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.GetIndexOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const y=f.indexOf(e);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class dq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.Append);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const y=f+e;return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class uq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.Prepend);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const y=e+f;return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class pq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.Join);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)});if(!l||l.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No input lists provided",result:null};if(!l.every(v=>Array.isArray(v)))return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"All inputs must be arrays",result:null};const f=l[0],y=l.slice(1).reduce((v,T)=>Array.isArray(T)?v.concat(T):v,f);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class cq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.Split);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var A,I;return((A=T.value)==null?void 0:A.valueAsType)||((I=T.value)==null?void 0:I.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const y=f.slice(0,e),v=f.slice(e);return{value:J.Success,error:null,result:[y,v]}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class fq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.Reverse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const e=f.slice().reverse();return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class yq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST,version:"1.0.0",description:"List delete last operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.DeleteLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const e=f.slice(0,-1);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class hq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST,version:"1.0.0",description:"List delete first operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.DeleteFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const e=f.slice(1);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class mq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.AddIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var A,I;return((A=T.value)==null?void 0:A.valueAsType)||((I=T.value)==null?void 0:I.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>f.length)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Index out of bounds",result:null};const v=[...f.slice(0,e),y,...f.slice(e)];return{value:J.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class vq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.ReplaceIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var A,I;return((A=T.value)==null?void 0:A.valueAsType)||((I=T.value)==null?void 0:I.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>=f.length)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Index out of bounds",result:null};const v=[...f];return v[e]=y,{value:J.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Tq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST,version:"1.0.0",description:"List replace first operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.ReplaceFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(A=>{var I,O;return((I=A.value)==null?void 0:I.valueAsType)||((O=A.value)==null?void 0:O.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const v=f.indexOf(e);if(v===-1)return{value:J.Success,error:null,result:f};const T=[...f];return T[v]=y,{value:J.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Eq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST,version:"1.0.0",description:"List replace last operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.ReplaceLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(A=>{var I,O;return((I=A.value)==null?void 0:I.valueAsType)||((O=A.value)==null?void 0:O.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const v=f.lastIndexOf(e);if(v===-1)return{value:J.Success,error:null,result:f};const T=[...f];return T[v]=y,{value:J.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class bq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.GetIndexItem);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>=f.length)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Index out of bounds",result:null};const y=f[e];return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Iq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.GetFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const e=f[0];return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Aq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.GetLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const e=f[f.length-1];return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class wq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.Append);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const y=[...f,e];return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Rq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.Prepend);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const y=[e,...f];return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class gq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_PARALLEL,version:"1.0.0",description:"Execution parallel operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(fi.Parallel);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=a.map(I=>{var O,L;return((O=I.value)==null?void 0:O.valueAsType)||((L=I.value)==null?void 0:L.value)})[0];if(!f)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(f))return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const y=this.extensionsRegistry.requestContexts(this,[Ce.Editor])[0],T=f.map(I=>{const O=new no(y.logic,[I],I,null,this.extensionsRegistry);return O.inheritValuesFromContext(y),O}).map(I=>I.execute()),A=await Promise.all(T);return{value:J.Success,error:null,result:A}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Cq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SEQUENTIAL,version:"1.0.0",description:"Execution sequential operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(fi.Sequential);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(f))return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const e=[];for(let y=0;y<f.length;y++){const v=f[y],A=this.extensionsRegistry.requestContexts(this,[Ce.Editor])[0],I=new no(A.logic,[v],v,null,this.extensionsRegistry);I.inheritValuesFromContext(A);const O=await I.execute();e.push(O)}return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class _q extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(fi.Wait);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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 f!="number"||f<0?{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Invalid wait time provided",result:null}:(await new Promise(e=>setTimeout(e,f)),{value:J.Success,error:null,result:null})}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Dq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(ur.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)});S.log("Inputs for entity validation: ",l);const e=jb(l[1]).safeParse(l[0]);return e.success?{value:J.Success,error:null,result:{data:l[0]}}:{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:e.error.errors,result:null}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Oq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(nn.HttpRequest);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[3]||{},e={method:l[0],url:l[1],params:l[2],headers:f,data:l[4]};S.log("Axios request config: ",e);const y=await l_e(e);return{value:J.Success,error:null,result:{status:y.status,headers:y.headers,data:y.data}}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class gA extends lA{constructor(u,i,a=i.projectId){super(u,Ce.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 o_e(d,u){return u instanceof gA?u:new gA(d,u)}function d_e(d){d.register(new kK(d)),d.register(new GK(d)),d.register(new MK(d)),d.register(new UK(d)),d.register(new jK(d)),d.register(new xK(d)),d.register(new O7(d)),d.register(new P7(d)),d.register(new $7(d)),d.register(new V7(d)),d.register(new N7(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)),d.register(new Z7(d)),d.register(new W7(d)),d.register(new H7(d)),d.register(new S7(d)),d.register(new J7(d)),d.register(new z7(d)),d.register(new Y7(d)),d.register(new X7(d)),d.register(new Q7(d)),d.register(new eq(d)),d.register(new tq(d)),d.register(new iq(d)),d.register(new rq(d)),d.register(new nq(d)),d.register(new sq(d)),d.register(new aq(d)),d.register(new lq(d)),d.register(new oq(d)),d.register(new dq(d)),d.register(new uq(d)),d.register(new pq(d)),d.register(new cq(d)),d.register(new fq(d)),d.register(new yq(d)),d.register(new hq(d)),d.register(new mq(d)),d.register(new vq(d)),d.register(new Tq(d)),d.register(new Eq(d)),d.register(new bq(d)),d.register(new Iq(d)),d.register(new Aq(d)),d.register(new wq(d)),d.register(new Rq(d)),d.register(new gq(d)),d.register(new Cq(d)),d.register(new _q(d)),d.register(new Dq(d)),d.register(new Oq(d))}class Pq{constructor(u=new xu){_(this,"extensionsRegistry",new Map);_(this,"initialized",new Set);_(this,"initializedContexts",new Set);_(this,"onResolveEditorContextCallback",()=>null);_(this,"onResolveProjectLogicContextCallback",()=>null);_(this,"onResolveGUIContextCallback",()=>null);_(this,"onResolveCompileContextCallback",()=>null);this.events=u,this.off=this.events.off.bind(this.events),this.on=this.events.on.bind(this.events),this.emit=this.events.emit.bind(this.events),this.emitAsync=this.events.emitAsync.bind(this.events),this.emitAsyncAll=this.events.emitAsyncAll.bind(this.events),this.emitAsyncAllSettled=this.events.emitAsyncAllSettled.bind(this.events),this.emitAsyncSequentially=this.events.emitAsyncSequentially.bind(this.events),this.emitAsyncSequentiallyAll=this.events.emitAsyncSequentiallyAll.bind(this.events),this.emitAsyncSequentiallyAllSettled=this.events.emitAsyncSequentiallyAllSettled.bind(this.events)}onResolveEditorContext(u){this.onResolveEditorContextCallback=u}onResolveProjectLogicContext(u){this.onResolveProjectLogicContextCallback=u}onResolveGUIContext(u){this.onResolveGUIContextCallback=u}onResolveCompileContext(u){this.onResolveCompileContextCallback=u}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((u,i)=>(u.manifest.initPriority||Qe.Normal)-(i.manifest.initPriority||Qe.Normal))}async setup(){d_e(this),S.log("Initializing extensions without context..."),this.initForReady()}requestContext(u){switch(u){case Ce.Editor:return this.onResolveEditorContextCallback();case Ce.Logic:return this.onResolveProjectLogicContextCallback();case Ce.GUI:return this.onResolveGUIContextCallback();case Ce.Compile:return this.onResolveCompileContextCallback();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 f=this.requestContext(l);f&&a.push(f)}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(f=>this.requestContext(f)).filter(f=>f!==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(){S.log("Initializing extensions for ready contexts...");for(const u of this.extensionInOrder)if(u.module.init&&!this.initialized.has(u.manifest.id)){S.log("Initializing "+u.manifest.id+" extension...");const i=this.requestContexts(u);u.manifest.contexts.every(l=>!!i.find(f=>f.contextType===l))?(await u.module.init(i),this.initialized.add(u.manifest.id)):S.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)?(S.log("Set "+u.manifest.id+" extension as initialized by default..."),this.initialized.add(u.manifest.id)):S.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)){S.warn(`Context ${u} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(u),u){case Ce.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case Ce.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}S.log(`Context ${u} is now available. Initializing extensions for this context...`),await this.initForReady()}}let Wm=null;const CA={requestExtension:d=>(Wm||(Wm=new Pq,Wm.setup()),Wm.requestExtension(d))},ro={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var _A=(d=>(d.FinishedSuccess="finished-success",d.FinishedError="finished-error",d.Running="running",d.Paused="paused",d.Stopped="stopped",d.NotStarted="not-started",d))(_A||{});const $q={...CA};class no extends xu{constructor(i,a,l,f=null,e=$q){super();_(this,"project");_(this,"entryPoint");_(this,"state","not-started");_(this,"events",new xu);_(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=f,this.localTestValues=new Bc(V.UUID.uuid(),this.project),this.resolvedValues=new Bc(V.UUID.uuid(),this.project),this.persistedExecutionResults=new Bc(V.UUID.uuid(),this.project),this.lastExecutionResults=new Bc(V.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),Lr.includes(i.type)&&pt(i).forEach(a=>this.skip(a))))}async schedule(i,a,l){if(this.hasExecuted(i))return null;if(Bt.includes(i.type))return this.executeBranch(i,l,a);if(Jr.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[...pi,...Bt].includes(a.type)?l.push(...a.inputs):Mt.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&&Bt.includes(a.type)&&(y=i.find(T=>{var A;return((A=T.valueOwner.declaration)==null?void 0:A.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 Jn.includes(e.type)?ba(e,this.valueResolutionContext):ud(e,this.valueResolutionContext)}).reduce((e,y)=>{const v=Zs(y==null?void 0:y.valueOwner,this.project),T=y?[y]:[];return v.forEach(A=>{var L,M,j;if(A.id===(y==null?void 0:y.valueOwner.id))return;const I=rt(A.getDataType(null),A,this.project);I==null||I.metaSync({value:(L=y==null?void 0:y.value)==null?void 0:L.value},null),I==null||I.setValueAsTypeList(((M=y==null?void 0:y.value)==null?void 0:M.valueAsTypeList)||null),I==null||I.setValueAsTypeSingle(((j=y==null?void 0:y.value)==null?void 0:j.valueAsTypeSingle)||null);const O={...y,valueOwner:A,value:I};T.push(O)}),[...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,f={}){var y,v;const e={...ro,...f};try{let T={value:J.Success,error:null,result:null};if(a.sort((A,I)=>A.valueOwner.index-I.valueOwner.index),Object.values(vr).includes(i.declaration.id)){const A=this.parentContext.requestExtension(Uu+i.declaration.id).module.main;A?T=await A(i,a):S.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{debugger;T=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,a,l,e);debugger;let A=null;if(T.error){S.warn("Raw error executing entity: ",T.error);const I=(y=i.error)==null?void 0:y.getDataType(null),O=rt(I||null,i.error,l);I!=null&&I.asType?O==null||O.setValueAsTypeSingle(T.error):O==null||O.metaSync({value:T.error},null),A={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:O}}return{value:T.value,entity:i,error:A,result:{value:T.result||null,valueOwner:i,type:Ae.ExecutionResult,inheritanceLink:null}}}return{...T,entity:i}}catch(T){S.warn("Internal call execution error: ",T);let A=null;if(i.error){const I=(v=i.error)==null?void 0:v.getDataType(null),O=rt(I,i.error,l);I!=null&&I.asType?O==null||O.setValueAsTypeSingle(T):O==null||O.metaSync({value:T},null),A={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:O}}return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,entity:i,error:A,result:null}}}static async executeOperation(i,a,l){var f,e;try{let y={value:J.Success,error:null,result:null};a.sort((T,A)=>T.valueOwner.index-A.valueOwner.index),i.declaration.implementation&&(y=await i.declaration.implementation(i,a));let v=null;if(y.error&&i.error){S.warn("Raw error executing entity: ",y.error);const T=((f=i.error)==null?void 0:f.getDataType(null))||null,A=rt(T,i.error,l);T!=null&&T.asType?A==null||A.setValueAsTypeSingle(y.error):A==null||A.metaSync({value:y.error},null),v={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:A}}return{value:y.value,entity:i,error:v,result:{value:y.result||null,valueOwner:i,type:Ae.ExecutionResult,inheritanceLink:null}}}catch(y){S.warn("Operation execution error: ",y);let v=null;if(i.error){const T=(e=i.error)==null?void 0:e.getDataType(null),A=rt(T,i.error,l);T!=null&&T.asType?A==null||A.setValueAsTypeSingle(y):A==null||A.metaSync({value:y},null),v={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:A}}return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,entity:i,error:v,result:null}}}async executeSearch(i,a,l){var f;try{let e={value:J.Success,error:null,result:null};const y=await(await this.parentContext.requestExtension(st.SEARCH_NODE_IMPLEMENTATION)).module.main(i,a),v=i==null?void 0:i.getDataType(null),T=rt(v,i,l);return T==null||T.metaSync({value:y.data},null),y.error?{value:J.UnhandledError,entity:i,error:{valueOwner:i,type:Ae.ExecutionResult,inheritanceLink:null,value:T},result:null}:{value:e.value,entity:i,error:null,result:{value:T,valueOwner:i,type:Ae.ExecutionResult,inheritanceLink:null}}}catch(e){if(S.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,entity:i,error:null,result:null};const y=(f=i.error)==null?void 0:f.getDataType(null),v=rt(y,i.error,l);return v==null||v.metaSync({value:e},null),{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:v},result:null}}}async executeLoop(i,a,l,f={}){var y,v;const e={...ro,...f};try{let T={value:J.Success,error:null,result:null};const A=a.map(q=>{var Z,H;return((Z=q==null?void 0:q.value)==null?void 0:Z.valueAsType)||((H=q==null?void 0:q.value)==null?void 0:H.value)});let I={};i.getUniqueInputMaps().forEach(q=>{const Z=i.body.inputs.find(fe=>Q(fe,l)===on.fromInputMapToBodyArgumentDeclarationName(q)),H=q==null?void 0:q.getDataType(null),z=rt(H,Z,l);H!=null&&H.asType?z==null||z.setValueAsTypeList([]):z==null||z.metaSync({value:[]},null),this.lastExecutionResults.writeValue(Z,z);const ue={value:z,valueOwner:Z,type:Ae.ExecutionResult,inheritanceLink:null};I[Z.id]=ue});let L={value:J.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case ce.loop["counted-loop"].id:{const q=A[0];let Z=1;for(;Z<=q&&Z<=50;){const H=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const ue=i.currentIterationNumberArgumentDeclaration.getDataType(null),fe=Ed(ue),ee=this.lastExecutionResults.readValue(z.id);if(ee){ee.metaSync({value:Z},null),this.lastExecutionResults.writeValue(z,ee);const ae={value:ee,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null};return I[z.id]=ae,ae}const ne={id:V.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:V.UUID.uuid(),createdAt:new Date().toISOString(),author:V.sessionAuthor,deleted:!1,previousVersion:null,value:Z,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:fe,standaloneParent:z.toReference()},me=Ei(ne,l);this.lastExecutionResults.writeValue(z,me);const pe={value:me,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null};return I[z.id]=pe,pe}else return I[z.id]}).filter(z=>!!z);if(L=await this.executeFullFunctionDeclarationLogic(i.body,H,e),(L.results||[]).forEach(z=>{var ne,me,pe,ae;if(z.valueOwner.type!==p.InputMap||Mt.includes(z.valueOwner.parent.type))return;const ue=i.body.inputs.find(he=>Q(he,l)===on.fromInputMapToBodyArgumentDeclarationName(z.valueOwner)),ee=[...((me=(ne=I==null?void 0:I[ue.id])==null?void 0:ne.value)==null?void 0:me.value)||[],((pe=z==null?void 0:z.value)==null?void 0:pe.value)||null];(ae=I[ue.id].value)==null||ae.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,I[ue.id].value)}),[J.CaughtError,J.Break,J.Return].includes(L.value))break;Z++}break}case ce.loop["manual-flow-loop"].id:{let q=1;for(;q<=50;){const Z=i.body.inputs.map(H=>{if(H===i.currentIterationNumberArgumentDeclaration){const z=this.lastExecutionResults.readValue(H.id);if(z){z.metaSync({value:q},null),this.lastExecutionResults.writeValue(H,z);const ne={value:z,valueOwner:H,type:Ae.ExecutionResult,inheritanceLink:null};return I[H.id]=ne,ne}const ue=i.currentIterationNumberArgumentDeclaration.getDataType(null),fe=rt(ue,H,l);return fe==null||fe.metaSync({value:q},null),this.lastExecutionResults.writeValue(H,fe),{value:fe,valueOwner:H,type:Ae.ExecutionResult,inheritanceLink:null}}else return I[H.id]}).filter(H=>!!H);if(L=await this.executeFullFunctionDeclarationLogic(i.body,Z,e),(L.results||[]).forEach(H=>{var ee,ne,me;if(H.valueOwner.type!==p.InputMap||Mt.includes(H.valueOwner.parent.type))return;const z=i.body.inputs.find(pe=>Q(pe,l)===on.fromInputMapToBodyArgumentDeclarationName(H.valueOwner)),fe=[...(ee=I[z.id].value)==null?void 0:ee.value,((ne=H.value)==null?void 0:ne.value)||null];(me=I[z.id].value)==null||me.metaSync({value:fe},null),this.lastExecutionResults.writeValue(z,I[z.id].value)}),[J.CaughtError,J.Break,J.Return].includes(L.value))break;q++}break}case ce.loop["list-loop"].id:{const q=A[0];let Z=1;const H=q;for(let z=0;z<H.length;z++){const ue=H[z],fe=i.body.inputs.map(ee=>{if(ee===i.currentIterationNumberArgumentDeclaration){const ne=this.lastExecutionResults.readValue(ee.id);if(ne)return ne.metaSync({value:Z},null),this.lastExecutionResults.writeValue(ee,ne),{value:ne,valueOwner:ee,type:Ae.ExecutionResult,inheritanceLink:null};const me=i.currentIterationNumberArgumentDeclaration.getDataType(null),pe=rt(me,ee,l);return pe==null||pe.metaSync({value:Z},null),this.lastExecutionResults.writeValue(ee,pe),{value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(ee===i.currentValueArgumentDeclaration){const ne=i.currentValueArgumentDeclaration.getDataType(null),me=Ed(ne),pe=this.lastExecutionResults.readValue(ee.id);if(pe)return pe.metaSync({value:ue},null),this.lastExecutionResults.writeValue(ee,pe),{value:pe,valueOwner:ee,type:Ae.ExecutionResult,inheritanceLink:null};const ae={id:V.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:V.UUID.uuid(),createdAt:new Date().toISOString(),author:V.sessionAuthor,deleted:!1,previousVersion:null,value:ue,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:me,standaloneParent:ee.toReference()},he=Ei(ae,l);return this.lastExecutionResults.writeValue(ee,he),{value:he,valueOwner:i.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return I[ee.id]}).filter(ee=>!!ee);if(L=await this.executeFullFunctionDeclarationLogic(i.body,fe,e),(L.results||[]).forEach(ee=>{var ae,he,De;if(ee.valueOwner.type!==p.InputMap||Mt.includes(ee.valueOwner.parent.type))return;const ne=i.body.inputs.find(He=>Q(He,l)===on.fromInputMapToBodyArgumentDeclarationName(ee.valueOwner)),pe=[...(ae=I[ne.id].value)==null?void 0:ae.value,((he=ee.value)==null?void 0:he.value)||null];(De=I[ne.id].value)==null||De.metaSync({value:pe},null),this.lastExecutionResults.writeValue(ne,I[ne.id].value)}),[J.CaughtError,J.Break,J.Return].includes(L.value))break;Z++}break}case ce.loop["object-keys-loop"].id:{const q=A[0];let Z=1;const H=q?Object.keys(q):[];for(let z=0;z<H.length;z++){const ue=H[z],fe=i.body.inputs.map(ee=>{if(ee===i.currentIterationNumberArgumentDeclaration){const ne=this.lastExecutionResults.readValue(ee.id);if(ne)return ne.metaSync({value:Z},null),this.lastExecutionResults.writeValue(ee,ne),{value:ne,valueOwner:ee,type:Ae.ExecutionResult,inheritanceLink:null};const me=i.currentIterationNumberArgumentDeclaration.getDataType(null),pe=rt(me,ee,l);return pe==null||pe.metaSync({value:Z},null),this.lastExecutionResults.writeValue(ee,pe),{value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(ee===i.currentValueArgumentDeclaration){const ne=i.currentValueArgumentDeclaration.getDataType(null),me=Ed(ne),pe=this.lastExecutionResults.readValue(ee.id);if(pe)return pe.metaSync({value:ue},null),this.lastExecutionResults.writeValue(ee,pe),{value:pe,valueOwner:ee,type:Ae.ExecutionResult,inheritanceLink:null};const ae={id:V.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:V.UUID.uuid(),createdAt:new Date().toISOString(),author:V.sessionAuthor,deleted:!1,previousVersion:null,value:ue,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:me,standaloneParent:ee.toReference()},he=Ei(ae,l);return this.lastExecutionResults.writeValue(ee,he),{value:he,valueOwner:i.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return I[ee.id]}).filter(ee=>!!ee);if(L=await this.executeFullFunctionDeclarationLogic(i.body,fe,e),(L.results||[]).forEach(ee=>{var ae,he,De;if(ee.valueOwner.type!==p.InputMap||Mt.includes(ee.valueOwner.parent.type))return;const ne=i.body.inputs.find(He=>Q(He,l)===on.fromInputMapToBodyArgumentDeclarationName(ee.valueOwner)),pe=[...(ae=I[ne.id].value)==null?void 0:ae.value,((he=ee.value)==null?void 0:he.value)||null];(De=I[ne.id].value)==null||De.metaSync({value:pe},null),this.lastExecutionResults.writeValue(ne,I[ne.id].value)}),[J.CaughtError,J.Break,J.Return].includes(L.value))break;Z++}break}case ce.loop["object-values-loop"].id:{const q=A[0];let Z=1;const H=q?Object.values(q):[];for(let z=0;z<H.length;z++){const ue=H[z],fe=i.body.inputs.map(ee=>{if(ee===i.currentIterationNumberArgumentDeclaration){const ne=this.lastExecutionResults.readValue(ee.id);if(ne)return ne.metaSync({value:Z},null),this.lastExecutionResults.writeValue(ee,ne),{value:ne,valueOwner:ee,type:Ae.ExecutionResult,inheritanceLink:null};const me=i.currentIterationNumberArgumentDeclaration.getDataType(null),pe=rt(me,ee,l);return pe==null||pe.metaSync({value:Z},null),this.lastExecutionResults.writeValue(ee,pe),{value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(ee===i.currentValueArgumentDeclaration){const ne=i.currentValueArgumentDeclaration.getDataType(null),me=Ed(ne),pe=this.lastExecutionResults.readValue(ee.id);if(pe)return pe.metaSync({value:ue},null),this.lastExecutionResults.writeValue(ee,pe),{value:pe,valueOwner:ee,type:Ae.ExecutionResult,inheritanceLink:null};const ae={id:V.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:V.UUID.uuid(),createdAt:new Date().toISOString(),author:V.sessionAuthor,deleted:!1,previousVersion:null,value:ue,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:me,standaloneParent:ee.toReference()},he=Ei(ae,l);return this.lastExecutionResults.writeValue(ee,he),{value:he,valueOwner:i.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return I[ee.id]}).filter(ee=>!!ee);if(L=await this.executeFullFunctionDeclarationLogic(i.body,fe,e),(L.results||[]).forEach(ee=>{var ae,he,De;if(ee.valueOwner.type!==p.InputMap||Mt.includes(ee.valueOwner.parent.type))return;const ne=i.body.inputs.find(He=>Q(He,l)===on.fromInputMapToBodyArgumentDeclarationName(ee.valueOwner)),pe=[...(ae=I[ne.id].value)==null?void 0:ae.value,((he=ee.value)==null?void 0:he.value)||null];(De=I[ne.id].value)==null||De.metaSync({value:pe},null),this.lastExecutionResults.writeValue(ne,I[ne.id].value)}),[J.CaughtError,J.Break,J.Return].includes(L.value))break;Z++}break}case ce.loop["string-loop"].id:{const q=A[0];let Z=1;const H=q.split("");for(let z=0;z<H.length;z++){const ue=H[z],fe=i.body.inputs.map(ee=>{if(ee===i.currentIterationNumberArgumentDeclaration){const ne=this.lastExecutionResults.readValue(ee.id);if(ne)return ne.metaSync({value:Z},null),this.lastExecutionResults.writeValue(ee,ne),{value:ne,valueOwner:ee,type:Ae.ExecutionResult,inheritanceLink:null};const me=i.currentIterationNumberArgumentDeclaration.getDataType(null),pe=rt(me,ee,l);return pe==null||pe.metaSync({value:Z},null),this.lastExecutionResults.writeValue(ee,pe),{value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(ee===i.currentValueArgumentDeclaration){const ne=i.currentValueArgumentDeclaration.getDataType(null),me=Ed(ne),pe=this.lastExecutionResults.readValue(ee.id);if(pe)return pe.metaSync({value:ue},null),this.lastExecutionResults.writeValue(ee,pe),{value:pe,valueOwner:ee,type:Ae.ExecutionResult,inheritanceLink:null};const ae={id:V.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:V.UUID.uuid(),createdAt:new Date().toISOString(),author:V.sessionAuthor,deleted:!1,previousVersion:null,value:ue,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:me,standaloneParent:ee.toReference()},he=Ei(ae,l);return this.lastExecutionResults.writeValue(ee,he),{value:he,valueOwner:i.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return I[ee.id]}).filter(ee=>!!ee);if(L=await this.executeFullFunctionDeclarationLogic(i.body,fe,e),(L.results||[]).forEach(ee=>{var ae,he,De;if(ee.valueOwner.type!==p.InputMap||Mt.includes(ee.valueOwner.parent.type))return;const ne=i.body.inputs.find(He=>Q(He,l)===on.fromInputMapToBodyArgumentDeclarationName(ee.valueOwner)),pe=[...(ae=I[ne.id].value)==null?void 0:ae.value,((he=ee.value)==null?void 0:he.value)||null];(De=I[ne.id].value)==null||De.metaSync({value:pe},null),this.lastExecutionResults.writeValue(ne,I[ne.id].value)}),[J.CaughtError,J.Break,J.Return].includes(L.value))break;Z++}break}}let M=[];i.body.inputs.forEach(q=>{var H;const Z=I[q.id];if(Z){const z=(H=Z.value)==null?void 0:H.clone(null),ue=i.outputs.find(fe=>fe.declaration&&on.fromLoopOutputDeclarationToBodyArgumentDeclarationName(fe.declaration)===Q(q,l));if(!ue)return;M.push({valueOwner:ue,type:Ae.ExecutionResult,inheritanceLink:null,value:z})}}),T={value:[J.CaughtError,J.Return].includes(L.value)?L.value:J.Success,error:null,result:{value:T==null?void 0:T.result.value}};let j=null;if(T.error&&i.error){S.warn("Raw error executing entity: ",T.error);const q=(y=i.error)==null?void 0:y.getDataType(null),Z=rt(q||null,i.error,l);q!=null&&q.asType?Z==null||Z.setValueAsTypeSingle(T.error):Z==null||Z.metaSync({value:T.error},null),j={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:Z}}return{value:T.value,entity:i,error:j,result:T.result}}catch(T){if(S.warn("Error executing loop: ",T),i.error){const A=(v=i.error)==null?void 0:v.getDataType(null),I=rt(A,i.error,l);return A!=null&&A.asType?I==null||I.setValueAsTypeSingle(T):I==null||I.metaSync({value:T},null),{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:I},result:null}}else return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,a,l,f={}){var y,v;const e={...ro,...f};try{let T={value:J.Success,error:null,result:null};T=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,a,l,e);let A=null;if(T.error&&i.error){S.warn("Raw error executing entity: ",T.error);const I=(y=i.error)==null?void 0:y.getDataType(null),O=rt(I||null,i.error,l);I!=null&&I.asType?O==null||O.setValueAsTypeSingle(T.error):O==null||O.metaSync({value:T.error},null),A={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:O}}return{value:T.value,entity:i,error:A,result:T.result}}catch(T){if(!i.error)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,entity:i,error:null,result:null};const A=(v=i.error)==null?void 0:v.getDataType(null),I=rt(A,i.error,l);return A!=null&&A.asType?I==null||I.setValueAsTypeSingle(T):I==null||I.metaSync({value:T},null),{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:I},result:null}}}async executeCondition(i,a){var f,e,y,v,T,A,I,O,L,M,j,q,Z,H,z,ue,fe,ee,ne,me,pe,ae,he,De,He,Fe,$e,Me,Je,je,bt,Pt,bi,Bi,Ji,Er,Pr,Gn,ss,Qs,as,$r,kn,ea,Pa,vy,Od,Ty;let l=!1;switch(i.declaration.id){case hr.Empty:{l=!((e=(f=a[0])==null?void 0:f.value)!=null&&e.value);break}case hr.NotEmpty:{l=!!((v=(y=a[0])==null?void 0:y.value)!=null&&v.value);break}case lt.Equal:{if([te.String,te.Number,te.Boolean,te.Null,te.Enum,te.Date,te.UUID].includes((A=(T=a[0])==null?void 0:T.value)==null?void 0:A.name)){l=((O=(I=a[0])==null?void 0:I.value)==null?void 0:O.value)===((M=(L=a[1])==null?void 0:L.value)==null?void 0:M.value);break}if(((q=(j=a[0])==null?void 0:j.value)==null?void 0:q.name)===te.KeyValue||((H=(Z=a[0])==null?void 0:Z.value)==null?void 0:H.name)===te.Untyped){const $a=(ue=(z=a[0])==null?void 0:z.value)==null?void 0:ue.value,Nr=(ee=(fe=a[1])==null?void 0:fe.value)==null?void 0:ee.value;l=JSON.stringify($a)===JSON.stringify(Nr);break}break}case lt.NotEqual:{if([te.String,te.Number,te.Boolean,te.Null,te.Enum,te.Date,te.UUID].includes((me=(ne=a[0])==null?void 0:ne.value)==null?void 0:me.name)){l=((ae=(pe=a[0])==null?void 0:pe.value)==null?void 0:ae.value)!==((De=(he=a[1])==null?void 0:he.value)==null?void 0:De.value);break}if(((Fe=(He=a[0])==null?void 0:He.value)==null?void 0:Fe.name)===te.Untyped||((Me=($e=a[0])==null?void 0:$e.value)==null?void 0:Me.name)===te.KeyValue){const $a=(je=(Je=a[0])==null?void 0:Je.value)==null?void 0:je.value,Nr=(Pt=(bt=a[1])==null?void 0:bt.value)==null?void 0:Pt.value;l=JSON.stringify($a)!==JSON.stringify(Nr);break}break}case lt.MoreThanOrEqual:{l=((Bi=(bi=a[0])==null?void 0:bi.value)==null?void 0:Bi.value)>=((Er=(Ji=a[1])==null?void 0:Ji.value)==null?void 0:Er.value);break}case lt.MoreThan:{l=((Gn=(Pr=a[0])==null?void 0:Pr.value)==null?void 0:Gn.value)>((Qs=(ss=a[1])==null?void 0:ss.value)==null?void 0:Qs.value);break}case lt.LessThanOrEqual:{l=(($r=(as=a[0])==null?void 0:as.value)==null?void 0:$r.value)<=((ea=(kn=a[1])==null?void 0:kn.value)==null?void 0:ea.value);break}case lt.LessThan:{l=((vy=(Pa=a[0])==null?void 0:Pa.value)==null?void 0:vy.value)<((Ty=(Od=a[1])==null?void 0:Od.value)==null?void 0:Ty.value);break}case Ui.And:{l=(await Promise.all(i.andChildrenGroup.map(async Nr=>{const fp=this.mergeExernalValuesWithInternalInputs(a,Nr);return(await this.executeCondition(Nr,fp)).value===J.Success}))).every(Nr=>Nr);break}case Ui.Or:{l=(await Promise.all(i.orChildrenGroup.map(async Nr=>{const fp=this.mergeExernalValuesWithInternalInputs(a,Nr);return(await this.executeCondition(Nr,fp)).value===J.Success}))).some(Nr=>Nr);break}}return{value:l?J.Success:J.CaughtError,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,a,l,f={}){const e={...ro,...f,onBeforeEntityExecution:(T,A,I)=>{var O;return((O=f==null?void 0:f.onBeforeEntityExecution)==null?void 0:O.call(f,T,A,{...I,detached:!0}))||Promise.resolve()},onEntityExecuted:(T,A,I)=>{var O;return((O=f==null?void 0:f.onEntityExecuted)==null?void 0:O.call(f,T,A,{...I,detached:!0}))||Promise.resolve()}},y=new no(l,[i,...W0(i)],i,this,this.parentContext);return y.inheritValuesFromContext(this),await y.execute(e,a)}async executeFullFunctionDeclarationLogic(i,a,l={}){const f={...ro,...l},e=W0(i);e.forEach(T=>{this.addEntity(T)}),e.reduce((T,A)=>Mt.includes(A.type)?[...T,...A.outputs]:pi.includes(A.type)&&A.type!==p.Condition?[...T,...A.outputs,...A.inputs]:A.type===p.Condition?[...T,...A.inputs]:T,[]).forEach(T=>{this.lastExecutionResults.removeValue(T.id)});const v=await this.executeBranch(i,f,a);return{...v||{},value:(v==null?void 0:v.value)||J.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:J.Success,entity:i,error:null,result:null}}async executeReturnStatement(i,a){var y,v,T,A,I,O,L;if((y=i.throws)!=null&&y.readsValue){const M=ba(i.throws,this.valueResolutionContext);return{value:J.CaughtError,entity:i,error:{valueOwner:i.throws,type:Ae.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=ba(i,this.valueResolutionContext);const f=i.getDataType(null);if(f!=null&&f.isObject()){let M={};if(((v=f==null?void 0:f.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...f.entity.getActiveRawDefaultValue()}),l!=null&&l.value)yi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(A=l==null?void 0:l.value)==null?void 0:A.value}),l==null||l.value.metaSync({value:M},null);else{const j=rt(f,i,this.project);j==null||j.metaSync({value:M},null),l={valueOwner:i,type:Ae.ExecutionResult,inheritanceLink:null,value:j}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(j=>{var q;if(((q=j.declaration)==null?void 0:q.type)===p.Property&&j.declaration.static){const Z=this.lastExecutionResults.readValue(j.declaration.id),H=Q(j,this.project),z=Oi(H);if(Z)Z.metaSync({value:M[z]},null),this.lastExecutionResults.writeValue(j.declaration,Z);else{const ue=rt(j.getDataType(null),j,this.project);ue==null||ue.metaSync({value:M[z]},null),this.lastExecutionResults.writeValue(j.declaration,ue)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(I=l==null?void 0:l.value)!=null&&I.value&&yi((O=l.value)==null?void 0:O.value)?((L=l.value)==null?void 0:L.value)||{}:{};return i.outputs.map(M=>{const j=Oi(Q(M,this.project)),q=e[j],Z=rt(M.getDataType(null),M,this.project);Z==null||Z.metaSync({value:q},null),Ae.ExecutionResult}),l.type=Ae.ExecutionResult,{value:J.Success,entity:i,error:null,result:l}}async executeContinueStatement(i,a){var y,v,T,A,I,O,L;if((y=i.throws)!=null&&y.readsValue){const M=ba(i.throws,this.valueResolutionContext);return{value:J.CaughtError,entity:i,error:{valueOwner:i.throws,type:Ae.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=ba(i,this.valueResolutionContext);const f=i.getDataType(null);if(f!=null&&f.isObject()){let M={};if(((v=f==null?void 0:f.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...f.entity.getActiveRawDefaultValue()}),l!=null&&l.value)yi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(A=l==null?void 0:l.value)==null?void 0:A.value}),l==null||l.value.metaSync({value:M},null);else{const j=rt(f,i,this.project);j==null||j.metaSync({value:M},null),l={valueOwner:i,type:Ae.ExecutionResult,inheritanceLink:null,value:j}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(j=>{var q;if(((q=j.declaration)==null?void 0:q.type)===p.Property&&j.declaration.static){const Z=this.lastExecutionResults.readValue(j.declaration.id),H=Q(j,this.project),z=Oi(H);if(Z)Z.metaSync({value:M[z]},null),this.lastExecutionResults.writeValue(j.declaration,Z);else{const ue=rt(j.getDataType(null),j,this.project);ue==null||ue.metaSync({value:M[z]},null),this.lastExecutionResults.writeValue(j.declaration,ue)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(I=l==null?void 0:l.value)!=null&&I.value&&yi((O=l.value)==null?void 0:O.value)?((L=l.value)==null?void 0:L.value)||{}:{};return i.outputs.map(M=>{const j=Oi(Q(M,this.project)),q=e[j],Z=rt(M.getDataType(null),M,this.project);Z==null||Z.metaSync({value:q},null),Ae.ExecutionResult}),l.type=Ae.ExecutionResult,{value:J.Success,entity:i,error:null,result:l}}async executeBreakStatement(i,a){var y,v,T,A,I,O,L;if((y=i.throws)!=null&&y.readsValue){const M=ba(i.throws,this.valueResolutionContext);return{value:J.CaughtError,entity:i,error:{valueOwner:i.throws,type:Ae.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=ba(i,this.valueResolutionContext);const f=i.getDataType(null);if(f!=null&&f.isObject()){let M={};if(((v=f==null?void 0:f.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...f.entity.getActiveRawDefaultValue()}),l!=null&&l.value)yi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(A=l==null?void 0:l.value)==null?void 0:A.value}),l==null||l.value.metaSync({value:M},null);else{const j=rt(f,i,this.project);j==null||j.metaSync({value:M},null),l={valueOwner:i,type:Ae.ExecutionResult,inheritanceLink:null,value:j}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(j=>{var q;if(((q=j.declaration)==null?void 0:q.type)===p.Property&&j.declaration.static){const Z=this.lastExecutionResults.readValue(j.declaration.id),H=Q(j,this.project),z=Oi(H);if(Z)Z.metaSync({value:M[z]},null),this.lastExecutionResults.writeValue(j.declaration,Z);else{const ue=rt(j.getDataType(null),j,this.project);ue==null||ue.metaSync({value:M[z]},null),this.lastExecutionResults.writeValue(j.declaration,ue)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(I=l==null?void 0:l.value)!=null&&I.value&&yi((O=l.value)==null?void 0:O.value)?((L=l.value)==null?void 0:L.value)||{}:{};return i.outputs.map(M=>{const j=Oi(Q(M,this.project)),q=e[j],Z=rt(M.getDataType(null),M,this.project);Z==null||Z.metaSync({value:q},null),Ae.ExecutionResult}),l.type=Ae.ExecutionResult,{value:J.Success,entity:i,error:null,result:l}}async executeVariable(i,a){var v,T,A,I,O,L;let l=ba(i,this.valueResolutionContext);const f=Yr(i),e=f.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)yi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(A=l==null?void 0:l.value)==null?void 0:A.value}),l==null||l.value.metaSync({value:M},null);else{const j=rt(e,i,this.project);j==null||j.metaSync({value:M},null),l={valueOwner:f,type:Ae.ExecutionResult,inheritanceLink:null,value:j}}this.lastExecutionResults.writeValue(f,l.value),f.inputs.forEach(j=>{var q;if(((q=j.declaration)==null?void 0:q.type)===p.Property&&j.declaration.static){const Z=this.lastExecutionResults.readValue(j.declaration.id),H=Q(j,this.project),z=Oi(H);if(Z)Z.metaSync({value:M[z]},null),this.lastExecutionResults.writeValue(j.declaration,Z);else{const ue=rt(j.getDataType(null),j,this.project);ue==null||ue.metaSync({value:M[z]},null),this.lastExecutionResults.writeValue(j.declaration,ue)}}})}else this.lastExecutionResults.writeValue(f,l==null?void 0:l.value);const y=(I=l==null?void 0:l.value)!=null&&I.value&&yi((O=l.value)==null?void 0:O.value)?((L=l.value)==null?void 0:L.value)||{}:{};return i.outputs.map(M=>{const j=Oi(Q(M,this.project)),q=y[j],Z=rt(M.getDataType(null),M,this.project);Z==null||Z.metaSync({value:q},null),Ae.ExecutionResult}),l.type=Ae.ExecutionResult,{value:J.Success,entity:i,error:null,result:l}}mergeValues(i,a){const l=[];for(let f=0;f<a.length;f++)i!=null&&i[f]?l.push(i[f]):l.push(a[f]);return l}async executeEntity(i,a=[],l={}){var y,v,T,A,I,O,L,M,j,q,Z;const f={...ro,...l},e={detached:!1};switch(i.type){case p.Condition:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((y=f.onBeforeEntityExecution)==null?void 0:y.call(f,i,H,e)),this.executeCondition(i,H)}case p.InternalCall:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((v=f.onBeforeEntityExecution)==null?void 0:v.call(f,i,H,e)),this.executeInternalCall(i,H,this.project)}case p.Operation:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((T=f.onBeforeEntityExecution)==null?void 0:T.call(f,i,H,e)),no.executeOperation(i,H,this.project)}case p.VariableInstance:case p.VariableDeclaration:return this.executeVariable(i,a);case p.FunctionCall:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((A=f.onBeforeEntityExecution)==null?void 0:A.call(f,i,H,e)),this.executeFunctionCall(i,H,this.project)}case p.FunctionDeclaration:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((I=f.onBeforeEntityExecution)==null?void 0:I.call(f,i,H,e)),no.executeEntryPointEntity(i,H)}case p.Search:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((O=f.onBeforeEntityExecution)==null?void 0:O.call(f,i,H,e)),this.executeSearch(i,H,this.project)}case p.Loop:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((L=f.onBeforeEntityExecution)==null?void 0:L.call(f,i,H,e)),this.executeLoop(i,H,this.project,f)}case p.ReturnStatement:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((M=f.onBeforeEntityExecution)==null?void 0:M.call(f,i,H,e)),this.executeReturnStatement(i,H)}case p.ContinueStatement:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((j=f.onBeforeEntityExecution)==null?void 0:j.call(f,i,H,e)),this.executeContinueStatement(i,H)}case p.BreakStatement:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((q=f.onBeforeEntityExecution)==null?void 0:q.call(f,i,H,e)),this.executeBreakStatement(i,H)}case p.GlobalEvent:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((Z=f.onBeforeEntityExecution)==null?void 0:Z.call(f,i,H,e)),no.executeEntryPointEntity(i,H)}default:throw new Error(`Entity type ${i==null?void 0:i.type} is not recognized for execution.`)}}storeLastExecutionValues(i){var l,f;i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value);const a=Zs((l=i.result)==null?void 0:l.valueOwner,this.project);(f=i.result)!=null&&f.value?a.forEach(e=>{var y;this.lastExecutionResults.writeValue(e,(y=i.result)==null?void 0:y.value)}):a.forEach(e=>{this.lastExecutionResults.removeValue(e.id)})}async executeBranch(i,a={},l=[]){var T;const f={...ro,...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,f);debugger;if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(v),await((T=f.onEntityExecuted)==null?void 0:T.call(f,i,v,e)),v.value===J.Success){const A=(i.successCalls||i.calls||[]).filter(j=>this.hasEntity(j));(i.errorCalls||[]).forEach(j=>{this.skip(j)});let O=[];const L=(await Promise.all(A.map(j=>this.schedule(j,[],f)))).filter(j=>!!j),M=L.filter(j=>!!j).find(j=>j.value===J.CaughtError||j.value===J.Return||j.value===J.Break||j.value===J.Continue);return M||(O=[...O,...L],v)}else if(v.value===J.CaughtError){const A=(i.errorCalls||[]).filter(j=>this.hasEntity(j));(i.successCalls||i.calls||[]).forEach(j=>{this.skip(j)});let O=[];const L=(await Promise.all(A.map(j=>this.schedule(j,[],f)))).filter(j=>!!j),M=L.filter(j=>!!j).find(j=>j.value===J.CaughtError||j.value===J.UnhandledError||j.value===J.Return||j.value===J.Break||j.value===J.Continue);return M||(O=[...O,...L],v)}else{if(v.value===J.UnhandledError)return this.executing.forEach(A=>{this.skip(A)}),this.scheduled.forEach(A=>{this.skip(A)}),Lr.includes(v.entity.type)&&pt(v.entity).forEach(A=>{this.skip(A)}),v;if(v.value===J.Return)return v;if(v.value===J.Break)return v;if(v.value===J.Continue)return v}return v}async execute(i={},a=[]){const l={...ro,...i};this.state="running";const f=await this.executeBranch(this.entryPoint,l,a);return this.state="finished-success",f}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 f,e,y;if(this.entities.includes(i))return!0;if(((f=i.parent)==null?void 0:f.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=_i(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 u_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 te.Number:return"number";case te.String:return"text";case te.Boolean:return"boolean";case te.UUID:return"uuid";case te.Date:return"date-time";default:return"definition-entity"}}const ts={[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 DA(d){const u=H0(d);if(!u){const a=op(d);if(a.includes(de.HTTP_ENDPOINT))return"HTTP endpoint";if(a.includes(de.PERSISTED_ENTITY))return"Persisted entity";if(a.includes(de.CRON_JOB))return"Scheduled execution";if(a.includes(de.RELATIONAL_DATABASE))return"Relational database"}if(u){let a="Extension of "+Q(u,u.project)+" entity",l=Vu(a);const f=op(d);return f.includes(de.HTTP_ENDPOINT)?"HTTP endpoint"+(l?", "+l:""):f.includes(de.PERSISTED_ENTITY)?"Persisted entity"+(l?", "+l:""):f.includes(de.CRON_JOB)?"Scheduled execution"+(l?", "+l:""):f.includes(de.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 Nq(d){return d.parent.type===p.DefinitionEntity||d.parent.type===p.InstalledProject?"Internal action of "+Q(d.parent,d.project):d.parent.type===p.Loop?"Action repeated on every iteration":"Internal action of entity"}function OA(d){return Sw(d)?Nq(d):"Custom trigger"}function p_e(d){var u;switch(d.type){case p.DefinitionEntity:return DA(d);case p.FunctionDeclaration:return OA(d)}return(u=ts[d.type])==null?void 0:u.singular}function c_e(d){var u;switch(d.type){case p.DefinitionEntity:return DA(d);case p.FunctionDeclaration:return OA(d)}return(u=ts[d.type])==null?void 0:u.singular}const PA=4e4,Vq=280,f_e=300,$A=65,Fu=32,Hm=39,Lq=26,Bq=49,Sm=44,y_e=35,Jm=52,NA=10,cl=NA*2,zm=38,Ym=90,VA=270,Mq=PA/2+120,xq=PA/2+180;function Uq(d){let i=Fu+Sm+zm+NA;const a=[...d.inputs];return a.length&&(i+=cl,a.forEach(()=>{i+=Lq})),{height:i,width:280}}function jq(d){let i=$A;const a=[];if([p.DefinitionEntity].includes(d.type)){const v=[...d.suggestedProperties||[],...d.properties||[]];v.length&&(i+=cl,v.forEach(T=>{i+=T.static?Bq:Hm}))}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+=cl,v.forEach(T=>{const A=Uq(T);i+=A.height}))}pi.includes(d.type)?(gt.includes(d.type)?a.push(...(d.usedInputs||[]).flatMap(v=>[v])||[]):a.push(...(d.inputs||[]).flatMap(v=>[v])||[]),d.error&&(i+=Jm)):[p.ReturnStatement,p.BreakStatement,p.ContinueStatement].includes(d.type)?(a.push(...d.outputs||[]),d.throws&&(i+=Jm)):d.type===p.Condition&&(a.push(d.inputs[0]),d.inputs[1]&&a.push(d.inputs[1]));const l=a.length;l&&(i+=l*Hm,i+=cl);const f=[];if(d.type===p.FunctionDeclaration||d.type===p.GlobalEvent?f.push(...d.inputs||[]):pi.includes(d.type)&&(gt.includes(d.type)?f.push(...d.usedOutputs||[]):f.push(...d.outputs||[])),gt.includes(d.type)){d.readsValue&&(i+=cl,i+=Sm),d.writesValues.length&&(i+=cl,i+=Sm),d.internalCalls.length&&d.usedInternalCalls.forEach(()=>i+=Jm+cl);const v=d.getDataType(null);(!v||v.inferred)&&(i+=zm)}const e=f.length;return e&&(i+=e*Hm,i+=cl),[p.DefinitionEntity,p.FunctionDeclaration,p.ReturnStatement,p.BreakStatement,p.ContinueStatement].includes(d.type)&&(i+=zm),{height:i,width:280}}function Wc(d){return`${d.split("-").map((a,l)=>l===0?a.charAt(0).toUpperCase()+a.slice(1):a.toLowerCase()).join(" ")}.`}function h_e(d){switch(d.code){case re.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case re.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case re.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case re.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case re.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case re.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case re.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case le.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case le.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case re.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case re.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case le.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case re.NoProperties:return"This entity has no properties, so it doesn't do anything";case re.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case re.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case re.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case re.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case re.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case re.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case re.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case re.PropertyImplementsNonAbstact:return"This property implements a non-template property";case re.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case re.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case re.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case re.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case re.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case le.InternalCallDeclarationIsNotFunctionDeclaration:return"This internal call is not an action";case le.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case le.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case le.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case le.UnreachableEntity:return"This entity is unreachable";case re.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case re.AbstractEntityImplements:return"This template entity implements a non-template entity";case re.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case re.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case re.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case re.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case re.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case re.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case re.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case re.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case re.MissingRequiredValue:return"This action is missing a required value";case re.NoPrimaryKeyProperty:return"This entity has no primary key property";case re.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case re.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case re.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case re.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case re.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case re.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case re.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case le.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case le.EmptyName:return"This entity has no name";case le.InvalidObjectStructure:return"This entity has an invalid structure";case le.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case le.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case le.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case le.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case le.MissingCaller:return"This action is missing a caller";case le.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case le.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case le.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case le.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case le.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case le.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case le.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case le.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case Oa.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Oa.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case jn.UUIDMustBeString:return`UUID must be a string, eg: "${fd()}"`;case jn.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${fd()}"`;case jn.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${fd()}"`;case pn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case pn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case pn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return Wc(d.code)}}function m_e(d){switch(d.code){case re.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case re.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case re.IncorrectEntityImplementation:return"Incorrect implementation";case re.IncorrectMethodImplementation:return"Incorrect action implementation";case re.IncorrectPropertyImplementation:return"Incorrect property implementation";case re.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case re.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case le.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case le.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case re.MissingMethodImplementation:return"Missing action";case re.MissingPropertyImplementation:return"Missing property";case le.NameNotUniqueInScope:return"Duplicate name";case re.NoProperties:return"No properties";case re.NonStaticPropertyInStaticEntity:return"Non-static property";case re.StaticEntityWithNonStaticProperties:return"Non-static properties";case re.ReadingFromIncompatibleType:return"Read from different type";case re.WritingToIncompatibleType:return"Write to different type";case re.ScopeWithoutLogic:return"No logic";case re.NonStaticPropertyImplementsStatic:return"Invalid static property";case re.PropertyImplementsIncompatibleType:return"Incompatible data type";case re.PropertyImplementsNonAbstact:return"Non-template property";case re.StaticPropertyImplementsNonStatic:return"Non-static property";case re.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case re.VariableHasInputsAndInternalCall:return"Bad internal call";case re.VariableHasOutputsAndInternalCall:return"Bad internal call";case re.VariableIsCalledAndHasInternalCall:return"Bad internal call";case le.InternalCallDeclarationIsNotFunctionDeclaration:return"Declaration not an action";case le.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case le.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case le.InternalCallParentMissingDataType:return"Parent has no data type";case le.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case le.UnreachableEntity:return"Unreachable entity";case re.DisconnectedCallableEntity:return"Disconnected entity";case re.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case re.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case re.InvalidPropertiesCombination:return"Invalid properties combination";case re.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case re.ExtendsIncompatibleEntities:return"Extends incompatible entities";case re.ImplementingNonAbstractEntity:return"Implementing non-template entity";case re.ImplementsIncompatibleEntities:return"Implements incompatible entities";case re.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case re.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case re.MissingRequiredValue:return"Missing required value";case re.NoPrimaryKeyProperty:return"No primary key property";case re.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case re.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case re.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case re.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case re.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case re.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case re.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case le.EmptyName:return"Empty name";case le.InvalidObjectStructure:return"Invalid object structure";case le.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case le.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case le.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case le.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case le.MissingCaller:return"Missing caller";case le.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case le.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case le.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case le.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case le.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case le.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case le.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case le.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case Oa.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Oa.StatusCodeMustBeNumber:return"HTTP status code must be a number";case jn.UUIDMustBeString:return"UUID must be a string";case jn.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case jn.UUIDMustBeValidFormat:return"UUID must be in a valid format";case pn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case pn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case pn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return Wc(d.code)}}function v_e(d){switch(d.code){case re.AbstractEntityWithNonAbstractMethods:return`${Q(d.entity,d.entity.project)} has non-template actions`;case re.AbstractEntityWithNonAbstractProperties:return`${Q(d.entity,d.entity.project)} has non-template properties`;case re.IncorrectEntityImplementation:return`${Q(d.entity,d.entity.project)} incorrectly implements template`;case re.IncorrectMethodImplementation:return`${Q(d.entity,d.entity.project)} incorrectly implements the template`;case re.IncorrectPropertyImplementation:return`${Q(d.entity,d.entity.project)} incorrectly implements the template`;case re.AbstractMethodInNonAbstractEntity:return`${Q(d.entity,d.entity.project)} can't be a template`;case re.AbstractPropertyInNonAbstractEntity:return`${Q(d.entity,d.entity.project)} can't be a template`;case le.MethodOverwritesOtherSiblingWithSameName:return`${Q(d.entity,d.entity.project)} overwrites action`;case le.PropertyOverwritesOtherSiblingWithSameName:return`${Q(d.entity,d.entity.project)} overwrites property`;case re.MissingMethodImplementation:return`${Q(d.entity,d.entity.project)} is missing action`;case re.MissingPropertyImplementation:return`${Q(d.entity,d.entity.project)} is missing property`;case le.NameNotUniqueInScope:return`${Q(d.entity,d.entity.project)} name is not unique`;case re.NoProperties:return`${Q(d.entity,d.entity.project)} has no properties`;case re.NonStaticPropertyInStaticEntity:return`${Q(d.entity,d.entity.project)} has non-static property`;case re.StaticEntityWithNonStaticProperties:return`${Q(d.entity,d.entity.project)} has non-static properties`;case re.ReadingFromIncompatibleType:return`${Q(d.entity,d.entity.project)} reads from different type`;case re.WritingToIncompatibleType:return`${Q(d.entity,d.entity.project)} writes to different type`;case re.ScopeWithoutLogic:return`${Q(d.entity,d.entity.project)} has no logic`;case re.NonStaticPropertyImplementsStatic:return`${Q(d.entity,d.entity.project)} has invalid static property`;case re.PropertyImplementsIncompatibleType:return`${Q(d.entity,d.entity.project)} has incompatible data type`;case re.PropertyImplementsNonAbstact:return`${Q(d.entity,d.entity.project)} has non-template property`;case re.StaticPropertyImplementsNonStatic:return`${Q(d.entity,d.entity.project)} has non-static property`;case re.VariableCallsOthersAndHasInternalCall:return`${Q(d.entity,d.entity.project)} has bad internal call`;case re.VariableHasInputsAndInternalCall:return`${Q(d.entity,d.entity.project)} has bad internal call`;case re.VariableHasOutputsAndInternalCall:return`${Q(d.entity,d.entity.project)} has bad internal call`;case re.VariableIsCalledAndHasInternalCall:return`${Q(d.entity,d.entity.project)} has bad internal call`;case le.InternalCallDeclarationIsNotFunctionDeclaration:return`${Q(d.entity,d.entity.project)} has declaration that is not an action`;case le.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${Q(d.entity,d.entity.project)} has declaration that is not found in parent`;case le.InternalCallParentDeclarationEntityInvalidType:return`${Q(d.entity,d.entity.project)} has invalid parent declaration type`;case le.InternalCallParentMissingDataType:return`${Q(d.entity,d.entity.project)}'s parent has no data type`;case le.InternalCallDeclarationNotInParentDatatypeEntity:return`${Q(d.entity,d.entity.project)} has declaration that is not in parent`;case le.UnreachableEntity:return`${Q(d.entity,d.entity.project)} is unreachable`;case re.DisconnectedCallableEntity:return`${Q(d.entity,d.entity.project)} is not executed by any entity`;case re.AbstractEntityImplements:return`${Q(d.entity,d.entity.project)} implements a non-template entity`;case re.AbstractExtendingNonAbstractEntity:return`${Q(d.entity,d.entity.project)} extends a non-template entity`;case re.InvalidPropertiesCombination:return`${Q(d.entity,d.entity.project)} has invalid properties combination`;case re.ExtendingNonInteractiveEntity:return`${Q(d.entity,d.entity.project)} extends a non-interactive entity`;case re.ExtendsIncompatibleEntities:return`${Q(d.entity,d.entity.project)} extends incompatible entities`;case re.ImplementingNonAbstractEntity:return`${Q(d.entity,d.entity.project)} implements a non-template entity`;case re.ImplementsIncompatibleEntities:return`${Q(d.entity,d.entity.project)} implements incompatible entities`;case re.LackingReturnStatementOnSomeBranches:return`${Q(d.entity,d.entity.project)} is missing termination on some branches`;case re.LastCalledEntityMustBeReturnEntity:return`${Q(d.entity,d.entity.project)}'s last called entity must be a termination node`;case re.MissingRequiredValue:return`${Q(d.entity,d.entity.project)} is missing a required value`;case re.NoPrimaryKeyProperty:return`${Q(d.entity,d.entity.project)} has no primary key property`;case re.NonAbstractExtendingAbstractEntity:return`${Q(d.entity,d.entity.project)} extends a template entity`;case re.NonStaticExtendingStaticEntity:return`${Q(d.entity,d.entity.project)} extends a static entity`;case re.NonStaticImplementingStaticEntity:return`${Q(d.entity,d.entity.project)} implements a static entity`;case re.StaticExtendingNonStaticEntity:return`${Q(d.entity,d.entity.project)} extends a non-static entity`;case re.StaticImplementingNonStaticEntity:return`${Q(d.entity,d.entity.project)} implements a non-static entity`;case re.VariableReadsValueAndInternalCall:return`${Q(d.entity,d.entity.project)} reads a value and has internal call`;case re.VariableWritesValuesAndInternalCall:return`${Q(d.entity,d.entity.project)} writes values and has internal call`;case le.EmptyName:return`${ts[d.entity.type]} has no name`;case le.InvalidObjectStructure:return`${Q(d.entity,d.entity.project)} has invalid structure`;case le.LoopBodyFunctionOverwrite:return`${Q(d.entity,d.entity.project)}'s loop body action overwrites an action`;case le.MethodOverwritesBaseMethodWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites base action`;case le.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites another action with same implementation`;case le.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites another action with same implementation`;case le.MissingCaller:return`${Q(d.entity,d.entity.project)} is missing a caller`;case le.NameAsResolvedCodeNameNotUniqueInScope:return`${Q(d.entity,d.entity.project)} has a name not unique in the scope`;case le.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${Q(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case le.NameMustStartWithLetterOrUnderscore:return`${Q(d.entity,d.entity.project)} name must start with letter or underscore`;case le.NoOverlapWithImplementedSignature:return`${Q(d.entity,d.entity.project)} has no overlap with implemented signature`;case le.PropertyOverwritesBasePropertyWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites base property`;case le.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites another property with same implementation`;case le.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites another property with same implementation`;case le.ReaderWriterIncompatibleDataType:return`${Q(d.entity,d.entity.project)} has reader/writer with incompatible data type`;case Oa.StatusCodeMustBeBetween100And599:return`${Q(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case Oa.StatusCodeMustBeNumber:return`${Q(d.entity,d.entity.project)} HTTP status code must be a number`;case jn.UUIDMustBeString:return`${Q(d.entity,d.entity.project)} UUID must be a string`;case jn.UUIDMustNotContainSpaces:return`${Q(d.entity,d.entity.project)} UUID must not contain spaces`;case jn.UUIDMustBeValidFormat:return`${Q(d.entity,d.entity.project)} UUID must be in a valid format`;case pn.MustBeUniqueAmongSameEntities:return`${Q(d.entity,d.entity.project)} value must be unique among the same kind`;case pn.StringValueMustNotHaveDashes:return`${Q(d.entity,d.entity.project)} value must not contain dashes`;case pn.StringValueMustNotHaveSpaces:return`${Q(d.entity,d.entity.project)} value must not contain spaces`;default:return`${Q(d.entity,d.entity.project)} Error: ${Wc(d.code)}`}}function T_e(d){var u,i,a,l;switch(d.code){case re.AbstractEntityWithNonAbstractMethods:return`${Q(d.entity,d.entity.project)} has non-template actions`;case re.AbstractEntityWithNonAbstractProperties:return`${Q(d.entity,d.entity.project)} has non-template properties`;case re.IncorrectEntityImplementation:return`${Q(d.entity,d.entity.project)} incorrectly implements the template entity`;case re.IncorrectMethodImplementation:return`${Q(d.entity,d.entity.project)} incorrectly implements the template action it's based on`;case re.IncorrectPropertyImplementation:return`${Q(d.entity,d.entity.project)} incorrectly implements the template property it's based on`;case re.AbstractMethodInNonAbstractEntity:return`${Q(d.entity,d.entity.project)} is a template action in a non-template entity`;case re.AbstractPropertyInNonAbstractEntity:return`${Q(d.entity,d.entity.project)} is a template property in a non-template entity`;case le.MethodOverwritesOtherSiblingWithSameName:return`${Q(d.entity,d.entity.project)} overwrites an action in the template entity`;case le.PropertyOverwritesOtherSiblingWithSameName:return`${Q(d.entity,d.entity.project)} overwrites a property in the template entity`;case re.MissingMethodImplementation:return`${Q(d.entity,d.entity.project)} is missing an action implementation from the template entity`;case re.MissingPropertyImplementation:return`${Q(d.entity,d.entity.project)} is missing a property implementation from the template entity`;case le.NameNotUniqueInScope:return`${Q(d.entity,d.entity.project)} has a duplicate name in the same scope`;case re.NoProperties:return`${Q(d.entity,d.entity.project)} has no properties, so it doesn't do anything`;case re.NonStaticPropertyInStaticEntity:return`${Q(d.entity,d.entity.project)} has a non-static property in a static entity`;case re.StaticEntityWithNonStaticProperties:return`${Q(d.entity,d.entity.project)} has non-static properties in a static entity`;case re.ReadingFromIncompatibleType:return`${Q(d.entity,d.entity.project)} reads data from a value of a different data type`;case re.WritingToIncompatibleType:return`${Q(d.entity,d.entity.project)} writes data to a value of a different data type`;case re.ScopeWithoutLogic:return`${Q(d.entity,d.entity.project)} has no logic`;case re.NonStaticPropertyImplementsStatic:return`${Q(d.entity,d.entity.project)} has a static property in a non-static entity`;case re.PropertyImplementsIncompatibleType:return`${Q(d.entity,d.entity.project)} implements a property of a different data type`;case re.PropertyImplementsNonAbstact:return`${Q(d.entity,d.entity.project)} implements a non-template property`;case re.StaticPropertyImplementsNonStatic:return`${Q(d.entity,d.entity.project)} has a static property in a non-static entity`;case re.VariableCallsOthersAndHasInternalCall:return`${Q(d.entity,d.entity.project)} calls other entities while being used to execute internal logic`;case re.VariableHasInputsAndInternalCall:return`${Q(d.entity,d.entity.project)} has inputs while being used to execute internal logic`;case re.VariableHasOutputsAndInternalCall:return`${Q(d.entity,d.entity.project)} has outputs while being used to execute internal logic`;case re.VariableIsCalledAndHasInternalCall:return`${Q(d.entity,d.entity.project)} is called while being used to execute internal logic`;case le.InternalCallDeclarationIsNotFunctionDeclaration:return`${Q(d.entity,d.entity.project)} has a declaration that is not an action`;case le.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${Q(d.entity,d.entity.project)} has a declaration that is not found in ${(u=d.entity.parent.getDataType(null))!=null&&u.entity?Q((i=d.entity.parent.getDataType(null))==null?void 0:i.entity,d.entity.project):"the variable's data-type entity"}`;case le.InternalCallParentDeclarationEntityInvalidType:return`${Q(d.entity,d.entity.project)} is part of a variable whos data-type entity can't have actions`;case le.InternalCallParentMissingDataType:return`${Q(d.entity,d.entity.project)} is part of a variable with no data-type entity`;case le.InternalCallDeclarationNotInParentDatatypeEntity:return`${Q(d.entity,d.entity.project)} has a declaration doesn't belong to ${(a=d.entity.parent.getDataType(null))!=null&&a.entity?Q((l=d.entity.parent.getDataType(null))==null?void 0:l.entity,d.entity.project):"the variable's data-type entity"}`;case le.UnreachableEntity:return`${Q(d.entity,d.entity.project)} is unreachable`;case re.DisconnectedCallableEntity:return`${Q(d.entity,d.entity.project)} is disconnected and won't be executed by anything after publishing`;case re.AbstractEntityImplements:return`${Q(d.entity,d.entity.project)} implements a non-template entity`;case re.AbstractExtendingNonAbstractEntity:return`${Q(d.entity,d.entity.project)} extends a non-template entity`;case re.InvalidPropertiesCombination:return`${Q(d.entity,d.entity.project)} has an invalid combination of properties`;case re.ExtendingNonInteractiveEntity:return`${Q(d.entity,d.entity.project)} extends a non-interactive entity`;case re.ExtendsIncompatibleEntities:return`${Q(d.entity,d.entity.project)} extends incompatible entities`;case re.ImplementingNonAbstractEntity:return`${Q(d.entity,d.entity.project)} implements a non-template entity`;case re.ImplementsIncompatibleEntities:return`${Q(d.entity,d.entity.project)} implements incompatible entities`;case re.LackingReturnStatementOnSomeBranches:return`${Q(d.entity,d.entity.project)} has branches that don't terminate`;case re.LastCalledEntityMustBeReturnEntity:return`${Q(d.entity,d.entity.project)} must end with a termination node`;case re.MissingRequiredValue:return`${Q(d.entity,d.entity.project)} is missing a required value`;case re.NoPrimaryKeyProperty:return`${Q(d.entity,d.entity.project)} has no primary key property`;case re.NonAbstractExtendingAbstractEntity:return`${Q(d.entity,d.entity.project)} is a non-template entity extending a template entity`;case re.NonStaticExtendingStaticEntity:return`${Q(d.entity,d.entity.project)} is a non-static entity extending a static entity`;case re.NonStaticImplementingStaticEntity:return`${Q(d.entity,d.entity.project)} is a non-static entity implementing a static entity`;case re.StaticExtendingNonStaticEntity:return`${Q(d.entity,d.entity.project)} is a static entity extending a non-static entity`;case re.StaticImplementingNonStaticEntity:return`${Q(d.entity,d.entity.project)} is a static entity implementing a non-static entity`;case re.VariableReadsValueAndInternalCall:return`${Q(d.entity,d.entity.project)} reads a value and has an internal call`;case re.VariableWritesValuesAndInternalCall:return`${Q(d.entity,d.entity.project)} writes values and has an internal call`;case le.EmptyName:return`${ts[d.entity.type]} has no name`;case le.InvalidObjectStructure:return`${Q(d.entity,d.entity.project)} has an invalid structure`;case le.LoopBodyFunctionOverwrite:return`${Q(d.entity,d.entity.project)}'s loop body action overwrites`;case le.MethodOverwritesBaseMethodWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites a base action with same implementation`;case le.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites another action with same implementation`;case le.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites another action with same implementation`;case le.MissingCaller:return`${Q(d.entity,d.entity.project)} is missing a caller`;case le.NameAsResolvedCodeNameNotUniqueInScope:return`${Q(d.entity,d.entity.project)} has a name that is not unique in the scope`;case le.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${Q(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case le.NameMustStartWithLetterOrUnderscore:return`${Q(d.entity,d.entity.project)} name must start with letter or underscore`;case le.NoOverlapWithImplementedSignature:return`${Q(d.entity,d.entity.project)} has no overlap with implemented signature`;case le.PropertyOverwritesBasePropertyWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites a base property with same implementation`;case le.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites another property with same implementation`;case le.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites another property with same implementation`;case le.ReaderWriterIncompatibleDataType:return`${Q(d.entity,d.entity.project)} has a reader/writer with incompatible data type`;case Oa.StatusCodeMustBeBetween100And599:return`${Q(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case Oa.StatusCodeMustBeNumber:return`${Q(d.entity,d.entity.project)} HTTP status code must be a number, between 100 and 599`;case jn.UUIDMustBeString:return`${Q(d.entity,d.entity.project)} UUID must be a string, eg: "${fd()}"`;case jn.UUIDMustNotContainSpaces:return`${Q(d.entity,d.entity.project)} UUID must not contain spaces, eg: "${fd()}"`;case jn.UUIDMustBeValidFormat:return`${Q(d.entity,d.entity.project)} UUID must be in a valid format. Eg: "${fd()}"`;case pn.MustBeUniqueAmongSameEntities:return`${Q(d.entity,d.entity.project)} value must be unique among the same kind`;case pn.StringValueMustNotHaveDashes:return`${Q(d.entity,d.entity.project)} value must not contain dashes`;case pn.StringValueMustNotHaveSpaces:return`${Q(d.entity,d.entity.project)} value must not contain spaces`;default:return`${Q(d.entity,d.entity.project)} Error: ${Wc(d.code)}`}}var LA=(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))(LA||{});const E_e=Object.values(LA);var BA=(d=>(d.NotPartOfOngoingTest="not-part-of-ongoing-test",d.CannotBeAddedToTest="cannot-be-added-to-test",d))(BA||{});const b_e=Object.values(BA);var MA=(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))(MA||{});const I_e=Object.values(MA);function A_e(d,u){const i=[...d,...u];return Array.from(new Set(i))}function w_e(d,u){const i=[...d,...u],a=Array.from(new Set(i));return{hasChanged:a.length!==d.length,reasons:a}}function R_e(d,u){const i=d.filter(l=>!u.includes(l));return{hasChanged:i.length!==d.length,reasons:i}}function g_e(d,u){return d.find(i=>i.entity.id===u)||null}function Gq(d){return d.filter((u,i)=>d.indexOf(u)===i)}class Gr{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=Mq-VA-Vq,f=xq-Ym-$A;u.metaSync({x:u.x||l,y:u.y||f},i);const e=new Gr(u,0,null,i);e._onlyEntities=a||[],e.ids=["0"];const y=[];e.next(T=>{y.push(...T)}),Gr.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&&Gr.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,f)=>l||f.findAreaInChildrenFromEntity(u),null)}findAreaFromEntity(u){if(this.entity===u)return this;const i=this.calculationEntryPoint.children,a=i.find(f=>f.entity===u);return a||i.reduce((f,e)=>f||e.findAreaInChildrenFromEntity(u),null)}addParent(u){if(!this.parents.includes(u)){const i=Gr.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=Ys(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(Bt.includes(e.type)){l.push(e);return}i.push(e)});const f=i.sort((e,y)=>{const v=!!U0(e,y).length,T=Ys(e),A=Ys(y);return v?0:T.length&&!A.length?-1:!T.length&&A.length?1:0}).filter(e=>!bo(e).length);this.childEntities=[...a,...l,...f]}else{const i=[],a=[],l=[],f=[],e=[];Lr.includes(this.entity.type)&&k0(this.entity).forEach(T=>{if(gt.includes(T.type)){l.push(T);return}const A=_i(T);i.push(A)}),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:gt.includes(v.type)?(l.push(v),!1):Jr.includes(v.type)&&!T?(f.push(v),!1):v.type===p.DefinitionEntity?(e.push(v),!1):!0});i.sort((v,T)=>Rd(v,T)?-1:0),f.sort((v,T)=>Rd(v,T)?-1:0),l.sort((v,T)=>kw(v,T)?1:kw(T,v)?-1:0),this.childEntities=[...e,...i,...f,...y,...l,...a]}}calculateCardSize(){const u=jq(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(f=>!i.includes(f));return a.reduce((f,e)=>i.includes(e)?f:Gr.getBoundriesOfTwoAreas(f,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)=>Gr.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)=>Gr.getBoundriesOfTwoAreas(e,y),a)}getFullAreaUntil(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(f=>f!==u).map(f=>f.getFullAreaUntil(u)).reduce((f,e)=>Gr.getBoundriesOfTwoAreas(f,e),i)}get fullBranchArea(){const u=this.ownEntityPlusBufferArea;return this.children.map(l=>l.fullBranchArea).reduce((l,f)=>Gr.getBoundriesOfTwoAreas(l,f),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+Ym,right:u.right+VA}}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,f)=>f.getEarliestLevel()>l.getEarliestLevel()?f: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([...Bt].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 f=this.countColumns(),e=l.countColumns();return f>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(Gr.getEarliestParentInChain(l)!==this)return;const e=g_e(a,l.entity.id);a=Gr.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=Gr.filterOutRepeatedAreas([...this.flattenSiblings(),...u]);Gr.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(f=>f!==i);i.shiftRightUntilAny(l,u)})}shiftDownAlone(u){this.move(this.entity,{y:this.entity.y+u})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const u=this.parents.reduce((l,f)=>{const e=f.ownEntityArea,y=e.top+Fu,v={top:y,left:e.left,bottom:y,right:e.right};return Gr.getBoundriesOfTwoAreas(l,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-Fu;this.shiftDownAlone(a)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const u=this.children.reduce((l,f)=>{const e=f.ownEntityArea,y=e.top+Fu,v={top:y,left:e.left,bottom:y,right:e.right};return Gr.getBoundriesOfTwoAreas(l,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-Fu;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 f=a.ids.sort((y,v)=>y.length<v.length?-1:0),e=l.ids.sort((y,v)=>y.length<v.length?-1:0);return f[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),f=a.children.slice(l+1);return[...i,...f]},[]);return Gq(u)}getLowerAreas(){const u=this.getLowerSiblings(),i=this.parents.reduce((a,l)=>[...a,...l.getLowerAreas()],[]);return Gq([...u,...i])}adjustVerticallyToAvoidOverlaps(u=[]){const a=Gr.getEarliestParentInChain(this).children[this.index-1];if(!a)return u;const l=this.flattenEarlierSiblings(),f=this.flattenParents(),e=[...l,...f,a],T=g(e.flatMap(L=>U0(this.entity,L.entity))).filter(L=>L.id!==this.entity.id).map(L=>this.findAreaFromEntity(L)).filter(L=>!!L),A=this.getFullAreaUntilAny(T),I=a.getFullAreaUntilAny(T),O=e.reduce((L,M)=>M===this||M.fullBranchArea.left!==A.left?L:Math.max(L,M.fullBranchArea.bottom),I.bottom);if(A.top<O){const L=O-A.top+Ym;return this.shiftDownUntilAny(u,L)}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 Gr(i,u,this.calculationEntryPoint));const l=this.ownEntityPlusBufferArea;this.children.includes(a)||(this.children.push(a),a.addParent(this));const f=a.fullBranchArea;if(f.left<l.right){const e=l.right-f.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 f=this.addChild(l);f&&i.push(f)}),u(i)}}var Hc=(d=>(d.Amazon="amazon",d.Google="google",d.Microsoft="microsoft",d))(Hc||{}),sr=(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))(sr||{}),xA=(d=>(d.Post="post",d.Get="get",d.Acknowledgement="acknowledgment",d.Progress="progress",d.Error="error",d.Complete="complete",d))(xA||{}),md=(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))(md||{}),UA=(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))(UA||{}),vt=(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))(vt||{}),Ss=(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.CodebaseCleanup="codebase-cleanup",d))(Ss||{});sr.CloudHostedCodebase,sr.HttpApi,sr.RelationalDatabase,sr.CloudHostedCodebase,sr.CloudHostedCodebase,sr.RelationalDatabase,sr.CloudHostedCodebase,sr.CloudHostedCodebase;function kq(d){return`project-${d}-http-api`}function Fq(d){return`entity-${d}-database`}class Kq{constructor(u,i,a,l,f,e,y,v,T){_(this,"stepType");_(this,"id");_(this,"resourceType");_(this,"index");_(this,"dependency",[]);_(this,"lastEvent",null);_(this,"lasEventTimestamp",null);_(this,"status",md.Queued);_(this,"publicationRun");_(this,"resource");this.stepType=u,this.id=i,this.resourceType=a,this.status=l,this.dependency=f,this.index=e,this.lasEventTimestamp=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 qq=(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))(qq||{});class jA{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 GA extends jA{constructor(i,a,l,f){super(i,l,f);_(this,"resourceType");_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(e=>{this.owners.set(e.id,e)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,a;return this.resourceType===sr.HttpApi?this.resourceId=kq(this.publicationRun.project.id):this.resourceType===sr.RelationalDatabase&&(this.resourceId=Fq((a=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:a.id)),this.resourceId}}class kA extends jA{constructor(i,a,l){super(i,a,l);_(this,"resourceType");_(this,"details",null);_(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceType===sr.CompiledLocalCodebase?this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`:this.resourceType===sr.CloudHostedCodebase&&(this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`),this.resourceId}}class C_e{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.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}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(sr.CompiledLocalCodebase,new kA(this,sr.CompiledLocalCodebase,Hc.Amazon)),this.implicitGlobalResources.set(sr.CloudHostedCodebase,new kA(this,sr.CloudHostedCodebase,Hc.Amazon));const u=this.project.entities.filter(a=>ar(a,de.HTTP_ENDPOINT)),i=this.project.entities.filter(a=>ar(a,de.RELATIONAL_DATABASE));if(i.length&&i.forEach(a=>{const l=new GA(this,[a],sr.RelationalDatabase,Hc.Amazon);this.explicitResources.set(l.resourceId,l)}),u.length){const a=new GA(this,u,sr.HttpApi,Hc.Amazon);this.explicitResources.set(a.resourceId,a)}}setSteps(u,i){u.forEach(a=>{this.addStep(a,i)}),this.editor.events.emit(vt.ProjectPublishRequestAcknowledged,{})}addStep(u,i){const a=u.dependency||[];if(a.length){const f=a.filter(e=>!this.steps.find(y=>y.id===e));if(f.length)throw new Error(`Missing dependencies: ${f.join(", ")}`)}if(!u.resource)throw new Error(`Resource not found for step ${u.stepType} (${u.id})`);if(!this.steps.find(f=>f.id===u.id)){const f=this.implicitGlobalResources.get(u.resourceType)||this.explicitResources.get(u.resource.resourceId),e=new Kq(u.stepType,u.id,u.resourceType,u.status,a,u.index,i,this,f);this.steps.push(e)}}onUpdate(u){var i;if(S.log("onUpdate",u),(i=u.payload)!=null&&i.stepType){const a=this.steps.find(l=>{var f;return l.id===((f=u.payload)==null?void 0:f.id)});a&&B(u.emittedAt).isAfter(B(a.lasEventTimestamp))&&a.update(u.payload)}this.editor.events.emit("publication-updated",{}),u.type===xA.Error?(this.finalStatus=UA.Failed,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-error",u)):u.type===xA.Complete&&(this.finalStatus=UA.Success,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-completed",u))}}function __e(d){switch(d){case Ss.CodeCompilation:return"Code generation";case Ss.RelationalDatabaseDeployment:return"Database creation";case Ss.HttpApiDeployment:return"HTTP gateway creation";case Ss.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case Ss.BundleCodebase:return"Bundle code";case Ss.MigrateRelationalDatabase:return"Database structure migration";case Ss.BusinessLogicCodebaseDeployment:return"Update servers with new code";case Ss.CodebaseCleanup:return"Code cleanup";case Ss.HttpApiDeletion:return"HTTP gateway deletion";case Ss.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function D_e(d){switch(d){case vt.DeploymentCompleted:return"Successfully published";case vt.DeploymentStarted:return"Publication started";case vt.DeploymentFailed:return"Publication failed";case vt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case vt.RequestPayloadValidationFailed:return"Request payload validation failed";case vt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case vt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case vt.RelationalDatabaseDeploymentStarted:return"Database creation started";case vt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case vt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case vt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case vt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case vt.RelationalDatabaseAlreadyExists:return"Database already exists";case vt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case vt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case vt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case vt.CreatingNewHttpApi:return"Creating new HTTP gateway";case vt.HttpApiAlreadyExists:return"HTTP gateway already exists";case vt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case vt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case vt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case vt.BundlingCodebaseForDownload:return"Bundling code for download";case vt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case vt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case vt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case vt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case vt.CodeCompilationStarted:return"Code generation started";case vt.CodeCompilationCompleted:return"Code generation completed";case vt.CodeCompilationFailed:return"Code generation failed";case vt.BundleCodebaseStarted:return"Code bundling started";case vt.BundleCodebaseCompleted:return"Code bundling completed";case vt.BundleCodebaseFailed:return"Code bundling failed";case vt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case vt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case vt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case vt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case vt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case vt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case vt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case vt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case vt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case vt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case vt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case vt.ProjectNotFound:return"Project not found";case vt.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case vt.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case vt.HttpApiDeletionStarted:return"HTTP gateway deletion started";case vt.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case vt.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case vt.RelationalDatabaseDeletionStarted:return"Database deletion started";case vt.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case vt.RelationalDatabaseDeletionFailed:return"Database deletion failed";case vt.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var Zq=(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))(Zq||{});function O_e(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 P_e(d){switch(d){case sr.RelationalDatabase:return"Relational database";case sr.HttpEndpoint:case sr.HttpApi:return"HTTP endpoints";case sr.ServerlessFunction:case sr.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function $_e(d){switch(d){case md.Running:return"In progress";case md.Failed:return"Failed";case md.Success:return"Succeeded";case md.Skipped:return"Skipped";case md.Queued:default:return"Queued"}}function Wq(d){var a;if(!ar(d,de.EXTERNAL_INTEGRATION_CONNECTION))return null;let u=null;const i=ce["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(d.type===p.BuiltInBaseEntity?ar(d,de.EXTERNAL_INTEGRATION_CONNECTION)&&(u=FA(d.name)):d.type===p.DefinitionEntity&&d.implements.forEach(l=>{if(ar(l,de.EXTERNAL_INTEGRATION_CONNECTION)){const f=FA(l==null?void 0:l.name);if(f)return u=f,!0}}),!u){const l=d.properties.find(f=>!!f.implements.find(e=>e.id===i)||!!f.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 Hq(d){return rP[d]}function FA(d){return d.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?d.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function Sq(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(Lt).includes(u.id))return u.id.split("--")[1]||null}return null}function N_e(d){return Object.values(de).find(i=>{if(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")){const a=Hq(d);if(!a)return!1;if(i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===a.toLowerCase())return!0}return!1})||null}function V_e(d){return d.type===p.BuiltInBaseEntity||d.type===p.DefinitionEntity?Wq(d):d.type===p.ActionDescriptor||d.type===p.Operation?Sq(d):null}function Jq(d){var l,f,e;if(!ar(d,de.EXTERNAL_INTEGRATION_CONNECTION))return null;let u=null;const i=zH(d,de.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const a=ce["built-in-base-entity"][i.id].properties.connectionId.id;if(d.type===p.BuiltInBaseEntity){if(ar(d,de.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 A;return((A=T.extends)==null?void 0:A.id)===a}));if(!y&&((f=d.extends)==null?void 0:f.type)===p.DefinitionEntity)return Jq(d.extends);u=(e=y==null?void 0:y.getDefaultValue())==null?void 0:e.value}return u}function zq(d){var l;(l=d.dataType)==null||l.validate(),d.inputs.forEach(f=>f.validate()),d.outputs.forEach(f=>f.validate()),d.internalCalls.forEach(f=>f.validate());const i=[...hl(d),...wd(d),...Yq(d),...ml(d),...Xq(d)],a=Pw(d);return i.push(...a),$i(d.errors,i)}function Yq(d,u){const a=[...d.project.getVariableDeclarations()].filter(l=>l.id!==d.id);return ny(d,[Oi],a,u)}function Xq(d){const u=[];if(d.parent!==d.project)return u;if(d.catchesError){const i=Ct({id:`${d.id}--${le.GlobalVariableDeclarationCannotCatchError}`,message:`${ts[d.type].singular} "${Q(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:Y.Error,code:le.GlobalVariableDeclarationCannotCatchError,entity:d});u.push(i.error)}if(d.errorCalls.length){const i=Ct({id:`${d.id}--${le.GlobalVariableDeclarationCannotCallOnError}`,message:`${ts[d.type].singular} "${Q(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:Y.Error,code:le.GlobalVariableDeclarationCannotCallOnError,entity:d});u.push(i.error)}if(d.calledBy.length){const i=Ct({id:`${d.id}--${le.GlobalVariableDeclarationCannotBeCalled}`,message:`${ts[d.type].singular} "${Q(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:Y.Error,code:le.GlobalVariableDeclarationCannotBeCalled,entity:d});u.push(i.error)}return[]}const L_e=Object.freeze(Object.defineProperty({__proto__:null,validate:zq,validateGlobalVariableDeclaration:Xq,validateVariableDeclarationName:Yq},Symbol.toStringTag,{value:"Module"}));function Qq(d){d.inputs.forEach(l=>l.validate()),d.outputs.forEach(l=>l.validate()),d.internalCalls.forEach(l=>l.validate());const i=[...hl(d),...wd(d),...ml(d)],a=Pw(d);return i.push(...a),$i(d.errors,i)}const B_e=Object.freeze(Object.defineProperty({__proto__:null,validate:Qq},Symbol.toStringTag,{value:"Module"}));var KA=(d=>(d.Parent="parent",d.DataTypeEntity="data-type-entity",d.VarDeclaration="var-declaration",d))(KA||{});const Ht=class Ht extends nr{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:V.UUID.uuid(),version:V.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||V.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 L=X(i.parent);l=a.get(L)}const f=X(i.declaration),e=a.get(f),y=i.calledByEntry.map(L=>{const M=X(L);return a.get(M)}),v=i.calledBySuccess.map(L=>{const M=X(L);return a.get(M)}),T=i.calledByError.map(L=>{const M=X(L);return a.get(M)});let A=null;if(i.readsValue){const L=X(i.readsValue);A=a.get(L)}const I={id:i.id,version:V.UUID.uuid(),createdAt:B().toISOString(),author:V.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:A,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:l},O=se(I,a);return O.setParent(l,null),O}static validateGenerationTarget(i,a){let l=JSON.parse(JSON.stringify(i));const f=[],e=Or(l,{parent:{list:!1,types:[...qi,p.Project],optional:!0},declaration:{list:!1,types:[p.VariableDeclaration]}},a);return l=e.modifiedData,f.push(...e.errors,...zi(l)),{errors:f,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 f=Ad(l,this);return l=f.modifiedData,a.push(...f.errors),i.parent&&a.push(new oe({id:`${this.id}--${W.InvalidParentUpdate}`,code:W.InvalidParentUpdate,severity:Y.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
|
+
`+f):a.stack=f}catch{}}throw a}}_request(u,i){typeof u=="string"?(i=i||{},i.url=u):i=u||{},i=hd(this.defaults,i);const{transitional:a,paramsSerializer:l,headers:f}=i;a!==void 0&&Km.assertOptions(a,{silentJSONParsing:Ia.transitional(Ia.boolean),forcedJSONParsing:Ia.transitional(Ia.boolean),clarifyTimeoutError:Ia.transitional(Ia.boolean)},!1),l!=null&&(we.isFunction(l)?i.paramsSerializer={serialize:l}:Km.assertOptions(l,{encode:Ia.function,serialize:Ia.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),Km.assertOptions(i,{baseUrl:Ia.spelling("baseURL"),withXsrfToken:Ia.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=f&&we.merge(f.common,f[i.method]);f&&we.forEach(["delete","get","head","post","put","patch","common"],M=>{delete f[M]}),i.headers=Hs.concat(e,f);const y=[];let v=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(i)===!1||(v=v&&j.synchronous,y.unshift(j.fulfilled,j.rejected))});const T=[];this.interceptors.response.forEach(function(j){T.push(j.fulfilled,j.rejected)});let A,I=0,O;if(!v){const M=[g7.bind(this),void 0];for(M.unshift.apply(M,y),M.push.apply(M,T),O=M.length,A=Promise.resolve(i);I<O;)A=A.then(M[I++],M[I++]);return A}O=y.length;let L=i;for(I=0;I<O;){const M=y[I++],j=y[I++];try{L=M(L)}catch(q){j.call(this,q);break}}try{A=g7.call(this,L)}catch(M){return Promise.reject(M)}for(I=0,O=T.length;I<O;)A=A.then(T[I++],T[I++]);return A}getUri(u){u=hd(this.defaults,u);const i=m7(u.baseURL,u.url,u.allowAbsoluteUrls);return l7(i,u.params,u.paramsSerializer)}}we.forEach(["delete","get","head","options"],function(u){qm.prototype[u]=function(i,a){return this.request(hd(a||{},{method:u,url:i,data:(a||{}).data}))}}),we.forEach(["post","put","patch"],function(u){function i(a){return function(f,e,y){return this.request(hd(y||{},{method:u,headers:a?{"Content-Type":"multipart/form-data"}:{},url:f,data:e}))}}qm.prototype[u]=i(),qm.prototype[u+"Form"]=i(!0)});const Zm=qm;class wA{constructor(u){if(typeof u!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(f){i=f});const a=this;this.promise.then(l=>{if(!a._listeners)return;let f=a._listeners.length;for(;f-- >0;)a._listeners[f](l);a._listeners=null}),this.promise.then=l=>{let f;const e=new Promise(y=>{a.subscribe(y),f=y}).then(l);return e.cancel=function(){a.unsubscribe(f)},e},u(function(f,e,y){a.reason||(a.reason=new ku(f,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 wA(function(l){u=l}),cancel:u}}}const r_e=wA;function n_e(d){return function(i){return d.apply(null,i)}}function s_e(d){return we.isObject(d)&&d.isAxiosError===!0}const RA={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(RA).forEach(([d,u])=>{RA[u]=d});const a_e=RA;function D7(d){const u=new Zm(d),i=WK(Zm.prototype.request,u);return we.extend(i,Zm.prototype,u,{allOwnKeys:!0}),we.extend(i,u,null,{allOwnKeys:!0}),i.create=function(l){return D7(hd(d,l))},i}const _r=D7(vA);_r.Axios=Zm,_r.CanceledError=ku,_r.CancelToken=r_e,_r.isCancel=c7,_r.VERSION=C7,_r.toFormData=Mm,_r.AxiosError=Ut,_r.Cancel=_r.CanceledError,_r.all=function(u){return Promise.all(u)},_r.spread=n_e,_r.isAxiosError=s_e,_r.mergeConfig=hd,_r.AxiosHeaders=Hs,_r.formToJSON=d=>u7(we.isHTMLForm(d)?new FormData(d):d),_r.getAdapter=R7.getAdapter,_r.HttpStatusCode=a_e,_r.default=_r;const l_e=_r;class O7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ri.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:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class P7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ri.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:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class $7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ri.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:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class N7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ri.Division);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),[f,e]=l;if(e===0)throw new Error("Division by zero is not allowed");const y=f/e;return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class V7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ri.Remainder);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),[f,e]=l;if(e===0)throw new Error("Division by zero is not allowed");const y=f%e;return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class L7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ri.Exponentiation);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),[f,e]=l,y=Math.pow(f,e);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class B7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateRandomInteger);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1],y=Pge(f,e);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class M7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateRandomFloat);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=FK();return{value:J.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class x7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateRandomHexadecimal);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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=KK(f);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class U7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateRandomBase62);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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=qK(f);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class j7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateRandomBase64);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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=Nge(f);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class G7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateRandomAlphanumeric);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(f);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class k7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateIdentifier);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1],y=ZK(f,e);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class F7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateRandomUUIDv4);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=fd();return{value:J.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class K7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{S.log("Initializing Random Generate Short Identifier Module");const a=i.find(l=>l.contextType===Ce.Logic);if(a){S.log("Project state found, setting up operation");const l=a.get(Ge.GenerateShortIdentifier);l?(S.log("Operation found, setting autoexecutable and implementation"),l.autoexecutable=!0,l.implementation=this.module.main):S.warn("Operation generate-short-identifier not found in project state")}else S.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,a)=>{try{const l=Lge();return{value:J.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class q7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(Ge.GenerateHexadecimalToken);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=Bge();return{value:J.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Z7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.Join);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],y=l.slice(1).join(f);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class W7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT,version:"1.0.0",description:"String split operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.Split);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1],y=f.split(e);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class H7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST,version:"1.0.0",description:"String delete last operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.DeleteLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const e=f.slice(0,-1);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class S7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST,version:"1.0.0",description:"String delete first operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.DeleteFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const e=f.slice(1);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class J7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.Reverse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const e=f.split("").reverse().join("");return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class z7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.ToLowerCase);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const e=f.toLowerCase();return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Y7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.ToUpperCase);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const e=f.toUpperCase();return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class X7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.DeleteIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>=f.length)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Index out of bounds",result:null};const y=f.slice(0,e)+f.slice(e+1);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Q7 extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.AddIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var A,I;return((A=T.value)==null?void 0:A.valueAsType)||((I=T.value)==null?void 0:I.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>f.length)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Index out of bounds",result:null};const v=f.slice(0,e)+y+f.slice(e);return{value:J.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class eq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST,version:"1.0.0",description:"String replace first operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.ReplaceFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var A,I;return((A=T.value)==null?void 0:A.valueAsType)||((I=T.value)==null?void 0:I.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const v=f.replace(e,y);return{value:J.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class tq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST,version:"1.0.0",description:"String replace last operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.ReplaceLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(A=>{var I,O;return((I=A.value)==null?void 0:I.valueAsType)||((O=A.value)==null?void 0:O.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const v=f.lastIndexOf(e);if(v===-1)return{value:J.Success,error:null,result:f};const T=f.slice(0,v)+f.slice(v).replace(e,y);return{value:J.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class iq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.ReplaceIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var A,I;return((A=T.value)==null?void 0:A.valueAsType)||((I=T.value)==null?void 0:I.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>=f.length)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Index out of bounds",result:null};const v=f.slice(0,e)+y+f.slice(e+1);return{value:J.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class rq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_SINGLE_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.ReplaceSingleMatch);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var A,I;return((A=T.value)==null?void 0:A.valueAsType)||((I=T.value)==null?void 0:I.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const v=f.replace(e,y);return{value:J.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class nq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.ReplaceAllMatches);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var A,I;return((A=T.value)==null?void 0:A.valueAsType)||((I=T.value)==null?void 0:I.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const v=f.split(e).join(y);return{value:J.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class sq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.GetIndexItem);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const y=f.charAt(e);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class aq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST,version:"1.0.0",description:"String get first operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.GetFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const e=f.charAt(0);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class lq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST,version:"1.0.0",description:"String get last operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.GetLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const e=f.charAt(f.length-1);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class oq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.GetIndexOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const y=f.indexOf(e);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class dq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.Append);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const y=f+e;return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class uq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(qe.Prepend);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No string provided or string is empty",result:null};const y=e+f;return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class pq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.Join);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)});if(!l||l.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No input lists provided",result:null};if(!l.every(v=>Array.isArray(v)))return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"All inputs must be arrays",result:null};const f=l[0],y=l.slice(1).reduce((v,T)=>Array.isArray(T)?v.concat(T):v,f);return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class cq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.Split);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var A,I;return((A=T.value)==null?void 0:A.valueAsType)||((I=T.value)==null?void 0:I.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const y=f.slice(0,e),v=f.slice(e);return{value:J.Success,error:null,result:[y,v]}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class fq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.Reverse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const e=f.slice().reverse();return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class yq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST,version:"1.0.0",description:"List delete last operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.DeleteLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const e=f.slice(0,-1);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class hq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST,version:"1.0.0",description:"List delete first operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.DeleteFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const e=f.slice(1);return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class mq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.AddIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var A,I;return((A=T.value)==null?void 0:A.valueAsType)||((I=T.value)==null?void 0:I.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>f.length)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Index out of bounds",result:null};const v=[...f.slice(0,e),y,...f.slice(e)];return{value:J.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class vq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.ReplaceIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var A,I;return((A=T.value)==null?void 0:A.valueAsType)||((I=T.value)==null?void 0:I.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>=f.length)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Index out of bounds",result:null};const v=[...f];return v[e]=y,{value:J.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Tq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST,version:"1.0.0",description:"List replace first operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.ReplaceFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(A=>{var I,O;return((I=A.value)==null?void 0:I.valueAsType)||((O=A.value)==null?void 0:O.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const v=f.indexOf(e);if(v===-1)return{value:J.Success,error:null,result:f};const T=[...f];return T[v]=y,{value:J.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Eq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST,version:"1.0.0",description:"List replace last operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.ReplaceLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(A=>{var I,O;return((I=A.value)==null?void 0:I.valueAsType)||((O=A.value)==null?void 0:O.value)}),f=l[0],e=l[1],y=l[2];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const v=f.lastIndexOf(e);if(v===-1)return{value:J.Success,error:null,result:f};const T=[...f];return T[v]=y,{value:J.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class bq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.GetIndexItem);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>=f.length)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Index out of bounds",result:null};const y=f[e];return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Iq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.GetFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const e=f[0];return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Aq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.GetLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const e=f[f.length-1];return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class wq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.Append);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const y=[...f,e];return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Rq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(at.Prepend);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[0],e=l[1];if(!f||f.length===0)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list provided or list is empty",result:null};const y=[e,...f];return{value:J.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class gq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_PARALLEL,version:"1.0.0",description:"Execution parallel operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(fi.Parallel);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=a.map(I=>{var O,L;return((O=I.value)==null?void 0:O.valueAsType)||((L=I.value)==null?void 0:L.value)})[0];if(!f)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(f))return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const y=this.extensionsRegistry.requestContexts(this,[Ce.Editor])[0],T=f.map(I=>{const O=new no(y.logic,[I],I,null,this.extensionsRegistry);return O.inheritValuesFromContext(y),O}).map(I=>I.execute()),A=await Promise.all(T);return{value:J.Success,error:null,result:A}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Cq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SEQUENTIAL,version:"1.0.0",description:"Execution sequential operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(fi.Sequential);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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(!f)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(f))return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const e=[];for(let y=0;y<f.length;y++){const v=f[y],A=this.extensionsRegistry.requestContexts(this,[Ce.Editor])[0],I=new no(A.logic,[v],v,null,this.extensionsRegistry);I.inheritValuesFromContext(A);const O=await I.execute();e.push(O)}return{value:J.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class _q extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(fi.Wait);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const f=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 f!="number"||f<0?{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:"Invalid wait time provided",result:null}:(await new Promise(e=>setTimeout(e,f)),{value:J.Success,error:null,result:null})}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Dq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(ur.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)});S.log("Inputs for entity validation: ",l);const e=jb(l[1]).safeParse(l[0]);return e.success?{value:J.Success,error:null,result:{data:l[0]}}:{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:e.error.errors,result:null}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class Oq extends ot{constructor(){super(...arguments);_(this,"manifest",{id:st.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:Qe.High,permissions:[nt.All],contexts:[Ce.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===Ce.Logic);if(a){const l=a.get(nn.HttpRequest);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,A;return((T=v.value)==null?void 0:T.valueAsType)||((A=v.value)==null?void 0:A.value)}),f=l[3]||{},e={method:l[0],url:l[1],params:l[2],headers:f,data:l[4]};S.log("Axios request config: ",e);const y=await l_e(e);return{value:J.Success,error:null,result:{status:y.status,headers:y.headers,data:y.data}}}catch(l){return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,error:l,result:null}}}})}}class gA extends lA{constructor(u,i,a=i.projectId){super(u,Ce.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 o_e(d,u){return u instanceof gA?u:new gA(d,u)}function d_e(d){d.register(new kK(d)),d.register(new GK(d)),d.register(new MK(d)),d.register(new UK(d)),d.register(new jK(d)),d.register(new xK(d)),d.register(new O7(d)),d.register(new P7(d)),d.register(new $7(d)),d.register(new V7(d)),d.register(new N7(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)),d.register(new Z7(d)),d.register(new W7(d)),d.register(new H7(d)),d.register(new S7(d)),d.register(new J7(d)),d.register(new z7(d)),d.register(new Y7(d)),d.register(new X7(d)),d.register(new Q7(d)),d.register(new eq(d)),d.register(new tq(d)),d.register(new iq(d)),d.register(new rq(d)),d.register(new nq(d)),d.register(new sq(d)),d.register(new aq(d)),d.register(new lq(d)),d.register(new oq(d)),d.register(new dq(d)),d.register(new uq(d)),d.register(new pq(d)),d.register(new cq(d)),d.register(new fq(d)),d.register(new yq(d)),d.register(new hq(d)),d.register(new mq(d)),d.register(new vq(d)),d.register(new Tq(d)),d.register(new Eq(d)),d.register(new bq(d)),d.register(new Iq(d)),d.register(new Aq(d)),d.register(new wq(d)),d.register(new Rq(d)),d.register(new gq(d)),d.register(new Cq(d)),d.register(new _q(d)),d.register(new Dq(d)),d.register(new Oq(d))}class Pq{constructor(u=new xu){_(this,"extensionsRegistry",new Map);_(this,"initialized",new Set);_(this,"initializedContexts",new Set);_(this,"onResolveEditorContextCallback",()=>null);_(this,"onResolveProjectLogicContextCallback",()=>null);_(this,"onResolveGUIContextCallback",()=>null);_(this,"onResolveCompileContextCallback",()=>null);this.events=u,this.off=this.events.off.bind(this.events),this.on=this.events.on.bind(this.events),this.emit=this.events.emit.bind(this.events),this.emitAsync=this.events.emitAsync.bind(this.events),this.emitAsyncAll=this.events.emitAsyncAll.bind(this.events),this.emitAsyncAllSettled=this.events.emitAsyncAllSettled.bind(this.events),this.emitAsyncSequentially=this.events.emitAsyncSequentially.bind(this.events),this.emitAsyncSequentiallyAll=this.events.emitAsyncSequentiallyAll.bind(this.events),this.emitAsyncSequentiallyAllSettled=this.events.emitAsyncSequentiallyAllSettled.bind(this.events)}onResolveEditorContext(u){this.onResolveEditorContextCallback=u}onResolveProjectLogicContext(u){this.onResolveProjectLogicContextCallback=u}onResolveGUIContext(u){this.onResolveGUIContextCallback=u}onResolveCompileContext(u){this.onResolveCompileContextCallback=u}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((u,i)=>(u.manifest.initPriority||Qe.Normal)-(i.manifest.initPriority||Qe.Normal))}async setup(){d_e(this),S.log("Initializing extensions without context..."),this.initForReady()}requestContext(u){switch(u){case Ce.Editor:return this.onResolveEditorContextCallback();case Ce.Logic:return this.onResolveProjectLogicContextCallback();case Ce.GUI:return this.onResolveGUIContextCallback();case Ce.Compile:return this.onResolveCompileContextCallback();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 f=this.requestContext(l);f&&a.push(f)}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(f=>this.requestContext(f)).filter(f=>f!==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(){S.log("Initializing extensions for ready contexts...");for(const u of this.extensionInOrder)if(u.module.init&&!this.initialized.has(u.manifest.id)){S.log("Initializing "+u.manifest.id+" extension...");const i=this.requestContexts(u);u.manifest.contexts.every(l=>!!i.find(f=>f.contextType===l))?(await u.module.init(i),this.initialized.add(u.manifest.id)):S.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)?(S.log("Set "+u.manifest.id+" extension as initialized by default..."),this.initialized.add(u.manifest.id)):S.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)){S.warn(`Context ${u} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(u),u){case Ce.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case Ce.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}S.log(`Context ${u} is now available. Initializing extensions for this context...`),await this.initForReady()}}let Wm=null;const CA={requestExtension:d=>(Wm||(Wm=new Pq,Wm.setup()),Wm.requestExtension(d))},ro={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var _A=(d=>(d.FinishedSuccess="finished-success",d.FinishedError="finished-error",d.Running="running",d.Paused="paused",d.Stopped="stopped",d.NotStarted="not-started",d))(_A||{});const $q={...CA};class no extends xu{constructor(i,a,l,f=null,e=$q){super();_(this,"project");_(this,"entryPoint");_(this,"state","not-started");_(this,"events",new xu);_(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=f,this.localTestValues=new Bc(V.UUID.uuid(),this.project),this.resolvedValues=new Bc(V.UUID.uuid(),this.project),this.persistedExecutionResults=new Bc(V.UUID.uuid(),this.project),this.lastExecutionResults=new Bc(V.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),Lr.includes(i.type)&&pt(i).forEach(a=>this.skip(a))))}async schedule(i,a,l){if(this.hasExecuted(i))return null;if(Bt.includes(i.type))return this.executeBranch(i,l,a);if(Jr.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[...pi,...Bt].includes(a.type)?l.push(...a.inputs):Mt.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&&Bt.includes(a.type)&&(y=i.find(T=>{var A;return((A=T.valueOwner.declaration)==null?void 0:A.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 Jn.includes(e.type)?ba(e,this.valueResolutionContext):ud(e,this.valueResolutionContext)}).reduce((e,y)=>{const v=Zs(y==null?void 0:y.valueOwner,this.project),T=y?[y]:[];return v.forEach(A=>{var L,M,j;if(A.id===(y==null?void 0:y.valueOwner.id))return;const I=rt(A.getDataType(null),A,this.project);I==null||I.metaSync({value:(L=y==null?void 0:y.value)==null?void 0:L.value},null),I==null||I.setValueAsTypeList(((M=y==null?void 0:y.value)==null?void 0:M.valueAsTypeList)||null),I==null||I.setValueAsTypeSingle(((j=y==null?void 0:y.value)==null?void 0:j.valueAsTypeSingle)||null);const O={...y,valueOwner:A,value:I};T.push(O)}),[...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,f={}){var y,v;const e={...ro,...f};try{let T={value:J.Success,error:null,result:null};if(a.sort((A,I)=>A.valueOwner.index-I.valueOwner.index),Object.values(vr).includes(i.declaration.id)){const A=this.parentContext.requestExtension(Uu+i.declaration.id).module.main;A?T=await A(i,a):S.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{T=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,a,l,e);let A=null;if(T.error){S.warn("Raw error executing entity: ",T.error);const I=(y=i.error)==null?void 0:y.getDataType(null),O=rt(I||null,i.error,l);I!=null&&I.asType?O==null||O.setValueAsTypeSingle(T.error):O==null||O.metaSync({value:T.error},null),A={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:O}}return{value:T.value,entity:i,error:A,result:{value:T.result||null,valueOwner:i,type:Ae.ExecutionResult,inheritanceLink:null}}}return{...T,entity:i}}catch(T){S.warn("Internal call execution error: ",T);let A=null;if(i.error){const I=(v=i.error)==null?void 0:v.getDataType(null),O=rt(I,i.error,l);I!=null&&I.asType?O==null||O.setValueAsTypeSingle(T):O==null||O.metaSync({value:T},null),A={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:O}}return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,entity:i,error:A,result:null}}}static async executeOperation(i,a,l){var f,e;try{let y={value:J.Success,error:null,result:null};a.sort((T,A)=>T.valueOwner.index-A.valueOwner.index),i.declaration.implementation&&(y=await i.declaration.implementation(i,a));let v=null;if(y.error&&i.error){S.warn("Raw error executing entity: ",y.error);const T=((f=i.error)==null?void 0:f.getDataType(null))||null,A=rt(T,i.error,l);T!=null&&T.asType?A==null||A.setValueAsTypeSingle(y.error):A==null||A.metaSync({value:y.error},null),v={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:A}}return{value:y.value,entity:i,error:v,result:{value:y.result||null,valueOwner:i,type:Ae.ExecutionResult,inheritanceLink:null}}}catch(y){S.warn("Operation execution error: ",y);let v=null;if(i.error){const T=(e=i.error)==null?void 0:e.getDataType(null),A=rt(T,i.error,l);T!=null&&T.asType?A==null||A.setValueAsTypeSingle(y):A==null||A.metaSync({value:y},null),v={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:A}}return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,entity:i,error:v,result:null}}}async executeSearch(i,a,l){var f;try{let e={value:J.Success,error:null,result:null};const y=await(await this.parentContext.requestExtension(st.SEARCH_NODE_IMPLEMENTATION)).module.main(i,a),v=i==null?void 0:i.getDataType(null),T=rt(v,i,l);return T==null||T.metaSync({value:y.data},null),y.error?{value:J.UnhandledError,entity:i,error:{valueOwner:i,type:Ae.ExecutionResult,inheritanceLink:null,value:T},result:null}:{value:e.value,entity:i,error:null,result:{value:T,valueOwner:i,type:Ae.ExecutionResult,inheritanceLink:null}}}catch(e){if(S.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,entity:i,error:null,result:null};const y=(f=i.error)==null?void 0:f.getDataType(null),v=rt(y,i.error,l);return v==null||v.metaSync({value:e},null),{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:v},result:null}}}async executeLoop(i,a,l,f={}){var y,v;const e={...ro,...f};try{let T={value:J.Success,error:null,result:null};const A=a.map(q=>{var Z,H;return((Z=q==null?void 0:q.value)==null?void 0:Z.valueAsType)||((H=q==null?void 0:q.value)==null?void 0:H.value)});let I={};i.getUniqueInputMaps().forEach(q=>{const Z=i.body.inputs.find(fe=>Q(fe,l)===on.fromInputMapToBodyArgumentDeclarationName(q)),H=q==null?void 0:q.getDataType(null),z=rt(H,Z,l);H!=null&&H.asType?z==null||z.setValueAsTypeList([]):z==null||z.metaSync({value:[]},null),this.lastExecutionResults.writeValue(Z,z);const ue={value:z,valueOwner:Z,type:Ae.ExecutionResult,inheritanceLink:null};I[Z.id]=ue});let L={value:J.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case ce.loop["counted-loop"].id:{const q=A[0];let Z=1;for(;Z<=q&&Z<=50;){const H=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const ue=i.currentIterationNumberArgumentDeclaration.getDataType(null),fe=Ed(ue),ee=this.lastExecutionResults.readValue(z.id);if(ee){ee.metaSync({value:Z},null),this.lastExecutionResults.writeValue(z,ee);const ae={value:ee,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null};return I[z.id]=ae,ae}const ne={id:V.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:V.UUID.uuid(),createdAt:new Date().toISOString(),author:V.sessionAuthor,deleted:!1,previousVersion:null,value:Z,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:fe,standaloneParent:z.toReference()},me=Ei(ne,l);this.lastExecutionResults.writeValue(z,me);const pe={value:me,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null};return I[z.id]=pe,pe}else return I[z.id]}).filter(z=>!!z);if(L=await this.executeFullFunctionDeclarationLogic(i.body,H,e),(L.results||[]).forEach(z=>{var ne,me,pe,ae;if(z.valueOwner.type!==p.InputMap||Mt.includes(z.valueOwner.parent.type))return;const ue=i.body.inputs.find(he=>Q(he,l)===on.fromInputMapToBodyArgumentDeclarationName(z.valueOwner)),ee=[...((me=(ne=I==null?void 0:I[ue.id])==null?void 0:ne.value)==null?void 0:me.value)||[],((pe=z==null?void 0:z.value)==null?void 0:pe.value)||null];(ae=I[ue.id].value)==null||ae.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,I[ue.id].value)}),[J.CaughtError,J.Break,J.Return].includes(L.value))break;Z++}break}case ce.loop["manual-flow-loop"].id:{let q=1;for(;q<=50;){const Z=i.body.inputs.map(H=>{if(H===i.currentIterationNumberArgumentDeclaration){const z=this.lastExecutionResults.readValue(H.id);if(z){z.metaSync({value:q},null),this.lastExecutionResults.writeValue(H,z);const ne={value:z,valueOwner:H,type:Ae.ExecutionResult,inheritanceLink:null};return I[H.id]=ne,ne}const ue=i.currentIterationNumberArgumentDeclaration.getDataType(null),fe=rt(ue,H,l);return fe==null||fe.metaSync({value:q},null),this.lastExecutionResults.writeValue(H,fe),{value:fe,valueOwner:H,type:Ae.ExecutionResult,inheritanceLink:null}}else return I[H.id]}).filter(H=>!!H);if(L=await this.executeFullFunctionDeclarationLogic(i.body,Z,e),(L.results||[]).forEach(H=>{var ee,ne,me;if(H.valueOwner.type!==p.InputMap||Mt.includes(H.valueOwner.parent.type))return;const z=i.body.inputs.find(pe=>Q(pe,l)===on.fromInputMapToBodyArgumentDeclarationName(H.valueOwner)),fe=[...(ee=I[z.id].value)==null?void 0:ee.value,((ne=H.value)==null?void 0:ne.value)||null];(me=I[z.id].value)==null||me.metaSync({value:fe},null),this.lastExecutionResults.writeValue(z,I[z.id].value)}),[J.CaughtError,J.Break,J.Return].includes(L.value))break;q++}break}case ce.loop["list-loop"].id:{const q=A[0];let Z=1;const H=q;for(let z=0;z<H.length;z++){const ue=H[z],fe=i.body.inputs.map(ee=>{if(ee===i.currentIterationNumberArgumentDeclaration){const ne=this.lastExecutionResults.readValue(ee.id);if(ne)return ne.metaSync({value:Z},null),this.lastExecutionResults.writeValue(ee,ne),{value:ne,valueOwner:ee,type:Ae.ExecutionResult,inheritanceLink:null};const me=i.currentIterationNumberArgumentDeclaration.getDataType(null),pe=rt(me,ee,l);return pe==null||pe.metaSync({value:Z},null),this.lastExecutionResults.writeValue(ee,pe),{value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(ee===i.currentValueArgumentDeclaration){const ne=i.currentValueArgumentDeclaration.getDataType(null),me=Ed(ne),pe=this.lastExecutionResults.readValue(ee.id);if(pe)return pe.metaSync({value:ue},null),this.lastExecutionResults.writeValue(ee,pe),{value:pe,valueOwner:ee,type:Ae.ExecutionResult,inheritanceLink:null};const ae={id:V.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:V.UUID.uuid(),createdAt:new Date().toISOString(),author:V.sessionAuthor,deleted:!1,previousVersion:null,value:ue,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:me,standaloneParent:ee.toReference()},he=Ei(ae,l);return this.lastExecutionResults.writeValue(ee,he),{value:he,valueOwner:i.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return I[ee.id]}).filter(ee=>!!ee);if(L=await this.executeFullFunctionDeclarationLogic(i.body,fe,e),(L.results||[]).forEach(ee=>{var ae,he,De;if(ee.valueOwner.type!==p.InputMap||Mt.includes(ee.valueOwner.parent.type))return;const ne=i.body.inputs.find(He=>Q(He,l)===on.fromInputMapToBodyArgumentDeclarationName(ee.valueOwner)),pe=[...(ae=I[ne.id].value)==null?void 0:ae.value,((he=ee.value)==null?void 0:he.value)||null];(De=I[ne.id].value)==null||De.metaSync({value:pe},null),this.lastExecutionResults.writeValue(ne,I[ne.id].value)}),[J.CaughtError,J.Break,J.Return].includes(L.value))break;Z++}break}case ce.loop["object-keys-loop"].id:{const q=A[0];let Z=1;const H=q?Object.keys(q):[];for(let z=0;z<H.length;z++){const ue=H[z],fe=i.body.inputs.map(ee=>{if(ee===i.currentIterationNumberArgumentDeclaration){const ne=this.lastExecutionResults.readValue(ee.id);if(ne)return ne.metaSync({value:Z},null),this.lastExecutionResults.writeValue(ee,ne),{value:ne,valueOwner:ee,type:Ae.ExecutionResult,inheritanceLink:null};const me=i.currentIterationNumberArgumentDeclaration.getDataType(null),pe=rt(me,ee,l);return pe==null||pe.metaSync({value:Z},null),this.lastExecutionResults.writeValue(ee,pe),{value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(ee===i.currentValueArgumentDeclaration){const ne=i.currentValueArgumentDeclaration.getDataType(null),me=Ed(ne),pe=this.lastExecutionResults.readValue(ee.id);if(pe)return pe.metaSync({value:ue},null),this.lastExecutionResults.writeValue(ee,pe),{value:pe,valueOwner:ee,type:Ae.ExecutionResult,inheritanceLink:null};const ae={id:V.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:V.UUID.uuid(),createdAt:new Date().toISOString(),author:V.sessionAuthor,deleted:!1,previousVersion:null,value:ue,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:me,standaloneParent:ee.toReference()},he=Ei(ae,l);return this.lastExecutionResults.writeValue(ee,he),{value:he,valueOwner:i.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return I[ee.id]}).filter(ee=>!!ee);if(L=await this.executeFullFunctionDeclarationLogic(i.body,fe,e),(L.results||[]).forEach(ee=>{var ae,he,De;if(ee.valueOwner.type!==p.InputMap||Mt.includes(ee.valueOwner.parent.type))return;const ne=i.body.inputs.find(He=>Q(He,l)===on.fromInputMapToBodyArgumentDeclarationName(ee.valueOwner)),pe=[...(ae=I[ne.id].value)==null?void 0:ae.value,((he=ee.value)==null?void 0:he.value)||null];(De=I[ne.id].value)==null||De.metaSync({value:pe},null),this.lastExecutionResults.writeValue(ne,I[ne.id].value)}),[J.CaughtError,J.Break,J.Return].includes(L.value))break;Z++}break}case ce.loop["object-values-loop"].id:{const q=A[0];let Z=1;const H=q?Object.values(q):[];for(let z=0;z<H.length;z++){const ue=H[z],fe=i.body.inputs.map(ee=>{if(ee===i.currentIterationNumberArgumentDeclaration){const ne=this.lastExecutionResults.readValue(ee.id);if(ne)return ne.metaSync({value:Z},null),this.lastExecutionResults.writeValue(ee,ne),{value:ne,valueOwner:ee,type:Ae.ExecutionResult,inheritanceLink:null};const me=i.currentIterationNumberArgumentDeclaration.getDataType(null),pe=rt(me,ee,l);return pe==null||pe.metaSync({value:Z},null),this.lastExecutionResults.writeValue(ee,pe),{value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(ee===i.currentValueArgumentDeclaration){const ne=i.currentValueArgumentDeclaration.getDataType(null),me=Ed(ne),pe=this.lastExecutionResults.readValue(ee.id);if(pe)return pe.metaSync({value:ue},null),this.lastExecutionResults.writeValue(ee,pe),{value:pe,valueOwner:ee,type:Ae.ExecutionResult,inheritanceLink:null};const ae={id:V.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:V.UUID.uuid(),createdAt:new Date().toISOString(),author:V.sessionAuthor,deleted:!1,previousVersion:null,value:ue,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:me,standaloneParent:ee.toReference()},he=Ei(ae,l);return this.lastExecutionResults.writeValue(ee,he),{value:he,valueOwner:i.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return I[ee.id]}).filter(ee=>!!ee);if(L=await this.executeFullFunctionDeclarationLogic(i.body,fe,e),(L.results||[]).forEach(ee=>{var ae,he,De;if(ee.valueOwner.type!==p.InputMap||Mt.includes(ee.valueOwner.parent.type))return;const ne=i.body.inputs.find(He=>Q(He,l)===on.fromInputMapToBodyArgumentDeclarationName(ee.valueOwner)),pe=[...(ae=I[ne.id].value)==null?void 0:ae.value,((he=ee.value)==null?void 0:he.value)||null];(De=I[ne.id].value)==null||De.metaSync({value:pe},null),this.lastExecutionResults.writeValue(ne,I[ne.id].value)}),[J.CaughtError,J.Break,J.Return].includes(L.value))break;Z++}break}case ce.loop["string-loop"].id:{const q=A[0];let Z=1;const H=q.split("");for(let z=0;z<H.length;z++){const ue=H[z],fe=i.body.inputs.map(ee=>{if(ee===i.currentIterationNumberArgumentDeclaration){const ne=this.lastExecutionResults.readValue(ee.id);if(ne)return ne.metaSync({value:Z},null),this.lastExecutionResults.writeValue(ee,ne),{value:ne,valueOwner:ee,type:Ae.ExecutionResult,inheritanceLink:null};const me=i.currentIterationNumberArgumentDeclaration.getDataType(null),pe=rt(me,ee,l);return pe==null||pe.metaSync({value:Z},null),this.lastExecutionResults.writeValue(ee,pe),{value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(ee===i.currentValueArgumentDeclaration){const ne=i.currentValueArgumentDeclaration.getDataType(null),me=Ed(ne),pe=this.lastExecutionResults.readValue(ee.id);if(pe)return pe.metaSync({value:ue},null),this.lastExecutionResults.writeValue(ee,pe),{value:pe,valueOwner:ee,type:Ae.ExecutionResult,inheritanceLink:null};const ae={id:V.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:V.UUID.uuid(),createdAt:new Date().toISOString(),author:V.sessionAuthor,deleted:!1,previousVersion:null,value:ue,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:me,standaloneParent:ee.toReference()},he=Ei(ae,l);return this.lastExecutionResults.writeValue(ee,he),{value:he,valueOwner:i.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return I[ee.id]}).filter(ee=>!!ee);if(L=await this.executeFullFunctionDeclarationLogic(i.body,fe,e),(L.results||[]).forEach(ee=>{var ae,he,De;if(ee.valueOwner.type!==p.InputMap||Mt.includes(ee.valueOwner.parent.type))return;const ne=i.body.inputs.find(He=>Q(He,l)===on.fromInputMapToBodyArgumentDeclarationName(ee.valueOwner)),pe=[...(ae=I[ne.id].value)==null?void 0:ae.value,((he=ee.value)==null?void 0:he.value)||null];(De=I[ne.id].value)==null||De.metaSync({value:pe},null),this.lastExecutionResults.writeValue(ne,I[ne.id].value)}),[J.CaughtError,J.Break,J.Return].includes(L.value))break;Z++}break}}let M=[];i.body.inputs.forEach(q=>{var H;const Z=I[q.id];if(Z){const z=(H=Z.value)==null?void 0:H.clone(null),ue=i.outputs.find(fe=>fe.declaration&&on.fromLoopOutputDeclarationToBodyArgumentDeclarationName(fe.declaration)===Q(q,l));if(!ue)return;M.push({valueOwner:ue,type:Ae.ExecutionResult,inheritanceLink:null,value:z})}}),T={value:[J.CaughtError,J.Return].includes(L.value)?L.value:J.Success,error:null,result:{value:T==null?void 0:T.result.value}};let j=null;if(T.error&&i.error){S.warn("Raw error executing entity: ",T.error);const q=(y=i.error)==null?void 0:y.getDataType(null),Z=rt(q||null,i.error,l);q!=null&&q.asType?Z==null||Z.setValueAsTypeSingle(T.error):Z==null||Z.metaSync({value:T.error},null),j={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:Z}}return{value:T.value,entity:i,error:j,result:T.result}}catch(T){if(S.warn("Error executing loop: ",T),i.error){const A=(v=i.error)==null?void 0:v.getDataType(null),I=rt(A,i.error,l);return A!=null&&A.asType?I==null||I.setValueAsTypeSingle(T):I==null||I.metaSync({value:T},null),{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:I},result:null}}else return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,a,l,f={}){var y,v;const e={...ro,...f};try{let T={value:J.Success,error:null,result:null};T=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,a,l,e);let A=null;if(T.error&&i.error){S.warn("Raw error executing entity: ",T.error);const I=(y=i.error)==null?void 0:y.getDataType(null),O=rt(I||null,i.error,l);I!=null&&I.asType?O==null||O.setValueAsTypeSingle(T.error):O==null||O.metaSync({value:T.error},null),A={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:O}}return{value:T.value,entity:i,error:A,result:T.result}}catch(T){if(!i.error)return{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,entity:i,error:null,result:null};const A=(v=i.error)==null?void 0:v.getDataType(null),I=rt(A,i.error,l);return A!=null&&A.asType?I==null||I.setValueAsTypeSingle(T):I==null||I.metaSync({value:T},null),{value:i.catchesError||i.errorCalls.length?J.CaughtError:J.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:I},result:null}}}async executeCondition(i,a){var f,e,y,v,T,A,I,O,L,M,j,q,Z,H,z,ue,fe,ee,ne,me,pe,ae,he,De,He,Fe,$e,Me,Je,je,bt,Pt,bi,Bi,Ji,Er,Pr,Gn,ss,Qs,as,$r,kn,ea,Pa,vy,Od,Ty;let l=!1;switch(i.declaration.id){case hr.Empty:{l=!((e=(f=a[0])==null?void 0:f.value)!=null&&e.value);break}case hr.NotEmpty:{l=!!((v=(y=a[0])==null?void 0:y.value)!=null&&v.value);break}case lt.Equal:{if([te.String,te.Number,te.Boolean,te.Null,te.Enum,te.Date,te.UUID].includes((A=(T=a[0])==null?void 0:T.value)==null?void 0:A.name)){l=((O=(I=a[0])==null?void 0:I.value)==null?void 0:O.value)===((M=(L=a[1])==null?void 0:L.value)==null?void 0:M.value);break}if(((q=(j=a[0])==null?void 0:j.value)==null?void 0:q.name)===te.KeyValue||((H=(Z=a[0])==null?void 0:Z.value)==null?void 0:H.name)===te.Untyped){const $a=(ue=(z=a[0])==null?void 0:z.value)==null?void 0:ue.value,Nr=(ee=(fe=a[1])==null?void 0:fe.value)==null?void 0:ee.value;l=JSON.stringify($a)===JSON.stringify(Nr);break}break}case lt.NotEqual:{if([te.String,te.Number,te.Boolean,te.Null,te.Enum,te.Date,te.UUID].includes((me=(ne=a[0])==null?void 0:ne.value)==null?void 0:me.name)){l=((ae=(pe=a[0])==null?void 0:pe.value)==null?void 0:ae.value)!==((De=(he=a[1])==null?void 0:he.value)==null?void 0:De.value);break}if(((Fe=(He=a[0])==null?void 0:He.value)==null?void 0:Fe.name)===te.Untyped||((Me=($e=a[0])==null?void 0:$e.value)==null?void 0:Me.name)===te.KeyValue){const $a=(je=(Je=a[0])==null?void 0:Je.value)==null?void 0:je.value,Nr=(Pt=(bt=a[1])==null?void 0:bt.value)==null?void 0:Pt.value;l=JSON.stringify($a)!==JSON.stringify(Nr);break}break}case lt.MoreThanOrEqual:{l=((Bi=(bi=a[0])==null?void 0:bi.value)==null?void 0:Bi.value)>=((Er=(Ji=a[1])==null?void 0:Ji.value)==null?void 0:Er.value);break}case lt.MoreThan:{l=((Gn=(Pr=a[0])==null?void 0:Pr.value)==null?void 0:Gn.value)>((Qs=(ss=a[1])==null?void 0:ss.value)==null?void 0:Qs.value);break}case lt.LessThanOrEqual:{l=(($r=(as=a[0])==null?void 0:as.value)==null?void 0:$r.value)<=((ea=(kn=a[1])==null?void 0:kn.value)==null?void 0:ea.value);break}case lt.LessThan:{l=((vy=(Pa=a[0])==null?void 0:Pa.value)==null?void 0:vy.value)<((Ty=(Od=a[1])==null?void 0:Od.value)==null?void 0:Ty.value);break}case Ui.And:{l=(await Promise.all(i.andChildrenGroup.map(async Nr=>{const fp=this.mergeExernalValuesWithInternalInputs(a,Nr);return(await this.executeCondition(Nr,fp)).value===J.Success}))).every(Nr=>Nr);break}case Ui.Or:{l=(await Promise.all(i.orChildrenGroup.map(async Nr=>{const fp=this.mergeExernalValuesWithInternalInputs(a,Nr);return(await this.executeCondition(Nr,fp)).value===J.Success}))).some(Nr=>Nr);break}}return{value:l?J.Success:J.CaughtError,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,a,l,f={}){const e={...ro,...f,onBeforeEntityExecution:(T,A,I)=>{var O;return((O=f==null?void 0:f.onBeforeEntityExecution)==null?void 0:O.call(f,T,A,{...I,detached:!0}))||Promise.resolve()},onEntityExecuted:(T,A,I)=>{var O;return((O=f==null?void 0:f.onEntityExecuted)==null?void 0:O.call(f,T,A,{...I,detached:!0}))||Promise.resolve()}},y=new no(l,[i,...W0(i)],i,this,this.parentContext);return y.inheritValuesFromContext(this),await y.execute(e,a)}async executeFullFunctionDeclarationLogic(i,a,l={}){const f={...ro,...l},e=W0(i);e.forEach(T=>{this.addEntity(T)}),e.reduce((T,A)=>Mt.includes(A.type)?[...T,...A.outputs]:pi.includes(A.type)&&A.type!==p.Condition?[...T,...A.outputs,...A.inputs]:A.type===p.Condition?[...T,...A.inputs]:T,[]).forEach(T=>{this.lastExecutionResults.removeValue(T.id)});const v=await this.executeBranch(i,f,a);return{...v||{},value:(v==null?void 0:v.value)||J.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:J.Success,entity:i,error:null,result:null}}async executeReturnStatement(i,a){var y,v,T,A,I,O,L;if((y=i.throws)!=null&&y.readsValue){const M=ba(i.throws,this.valueResolutionContext);return{value:J.CaughtError,entity:i,error:{valueOwner:i.throws,type:Ae.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=ba(i,this.valueResolutionContext);const f=i.getDataType(null);if(f!=null&&f.isObject()){let M={};if(((v=f==null?void 0:f.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...f.entity.getActiveRawDefaultValue()}),l!=null&&l.value)yi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(A=l==null?void 0:l.value)==null?void 0:A.value}),l==null||l.value.metaSync({value:M},null);else{const j=rt(f,i,this.project);j==null||j.metaSync({value:M},null),l={valueOwner:i,type:Ae.ExecutionResult,inheritanceLink:null,value:j}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(j=>{var q;if(((q=j.declaration)==null?void 0:q.type)===p.Property&&j.declaration.static){const Z=this.lastExecutionResults.readValue(j.declaration.id),H=Q(j,this.project),z=Oi(H);if(Z)Z.metaSync({value:M[z]},null),this.lastExecutionResults.writeValue(j.declaration,Z);else{const ue=rt(j.getDataType(null),j,this.project);ue==null||ue.metaSync({value:M[z]},null),this.lastExecutionResults.writeValue(j.declaration,ue)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(I=l==null?void 0:l.value)!=null&&I.value&&yi((O=l.value)==null?void 0:O.value)?((L=l.value)==null?void 0:L.value)||{}:{};return i.outputs.map(M=>{const j=Oi(Q(M,this.project)),q=e[j],Z=rt(M.getDataType(null),M,this.project);Z==null||Z.metaSync({value:q},null),Ae.ExecutionResult}),l.type=Ae.ExecutionResult,{value:J.Success,entity:i,error:null,result:l}}async executeContinueStatement(i,a){var y,v,T,A,I,O,L;if((y=i.throws)!=null&&y.readsValue){const M=ba(i.throws,this.valueResolutionContext);return{value:J.CaughtError,entity:i,error:{valueOwner:i.throws,type:Ae.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=ba(i,this.valueResolutionContext);const f=i.getDataType(null);if(f!=null&&f.isObject()){let M={};if(((v=f==null?void 0:f.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...f.entity.getActiveRawDefaultValue()}),l!=null&&l.value)yi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(A=l==null?void 0:l.value)==null?void 0:A.value}),l==null||l.value.metaSync({value:M},null);else{const j=rt(f,i,this.project);j==null||j.metaSync({value:M},null),l={valueOwner:i,type:Ae.ExecutionResult,inheritanceLink:null,value:j}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(j=>{var q;if(((q=j.declaration)==null?void 0:q.type)===p.Property&&j.declaration.static){const Z=this.lastExecutionResults.readValue(j.declaration.id),H=Q(j,this.project),z=Oi(H);if(Z)Z.metaSync({value:M[z]},null),this.lastExecutionResults.writeValue(j.declaration,Z);else{const ue=rt(j.getDataType(null),j,this.project);ue==null||ue.metaSync({value:M[z]},null),this.lastExecutionResults.writeValue(j.declaration,ue)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(I=l==null?void 0:l.value)!=null&&I.value&&yi((O=l.value)==null?void 0:O.value)?((L=l.value)==null?void 0:L.value)||{}:{};return i.outputs.map(M=>{const j=Oi(Q(M,this.project)),q=e[j],Z=rt(M.getDataType(null),M,this.project);Z==null||Z.metaSync({value:q},null),Ae.ExecutionResult}),l.type=Ae.ExecutionResult,{value:J.Success,entity:i,error:null,result:l}}async executeBreakStatement(i,a){var y,v,T,A,I,O,L;if((y=i.throws)!=null&&y.readsValue){const M=ba(i.throws,this.valueResolutionContext);return{value:J.CaughtError,entity:i,error:{valueOwner:i.throws,type:Ae.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=ba(i,this.valueResolutionContext);const f=i.getDataType(null);if(f!=null&&f.isObject()){let M={};if(((v=f==null?void 0:f.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...f.entity.getActiveRawDefaultValue()}),l!=null&&l.value)yi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(A=l==null?void 0:l.value)==null?void 0:A.value}),l==null||l.value.metaSync({value:M},null);else{const j=rt(f,i,this.project);j==null||j.metaSync({value:M},null),l={valueOwner:i,type:Ae.ExecutionResult,inheritanceLink:null,value:j}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(j=>{var q;if(((q=j.declaration)==null?void 0:q.type)===p.Property&&j.declaration.static){const Z=this.lastExecutionResults.readValue(j.declaration.id),H=Q(j,this.project),z=Oi(H);if(Z)Z.metaSync({value:M[z]},null),this.lastExecutionResults.writeValue(j.declaration,Z);else{const ue=rt(j.getDataType(null),j,this.project);ue==null||ue.metaSync({value:M[z]},null),this.lastExecutionResults.writeValue(j.declaration,ue)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(I=l==null?void 0:l.value)!=null&&I.value&&yi((O=l.value)==null?void 0:O.value)?((L=l.value)==null?void 0:L.value)||{}:{};return i.outputs.map(M=>{const j=Oi(Q(M,this.project)),q=e[j],Z=rt(M.getDataType(null),M,this.project);Z==null||Z.metaSync({value:q},null),Ae.ExecutionResult}),l.type=Ae.ExecutionResult,{value:J.Success,entity:i,error:null,result:l}}async executeVariable(i,a){var v,T,A,I,O,L;let l=ba(i,this.valueResolutionContext);const f=Yr(i),e=f.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)yi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(A=l==null?void 0:l.value)==null?void 0:A.value}),l==null||l.value.metaSync({value:M},null);else{const j=rt(e,i,this.project);j==null||j.metaSync({value:M},null),l={valueOwner:f,type:Ae.ExecutionResult,inheritanceLink:null,value:j}}this.lastExecutionResults.writeValue(f,l.value),f.inputs.forEach(j=>{var q;if(((q=j.declaration)==null?void 0:q.type)===p.Property&&j.declaration.static){const Z=this.lastExecutionResults.readValue(j.declaration.id),H=Q(j,this.project),z=Oi(H);if(Z)Z.metaSync({value:M[z]},null),this.lastExecutionResults.writeValue(j.declaration,Z);else{const ue=rt(j.getDataType(null),j,this.project);ue==null||ue.metaSync({value:M[z]},null),this.lastExecutionResults.writeValue(j.declaration,ue)}}})}else this.lastExecutionResults.writeValue(f,l==null?void 0:l.value);const y=(I=l==null?void 0:l.value)!=null&&I.value&&yi((O=l.value)==null?void 0:O.value)?((L=l.value)==null?void 0:L.value)||{}:{};return i.outputs.map(M=>{const j=Oi(Q(M,this.project)),q=y[j],Z=rt(M.getDataType(null),M,this.project);Z==null||Z.metaSync({value:q},null),Ae.ExecutionResult}),l.type=Ae.ExecutionResult,{value:J.Success,entity:i,error:null,result:l}}mergeValues(i,a){const l=[];for(let f=0;f<a.length;f++)i!=null&&i[f]?l.push(i[f]):l.push(a[f]);return l}async executeEntity(i,a=[],l={}){var y,v,T,A,I,O,L,M,j,q,Z;const f={...ro,...l},e={detached:!1};switch(i.type){case p.Condition:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((y=f.onBeforeEntityExecution)==null?void 0:y.call(f,i,H,e)),this.executeCondition(i,H)}case p.InternalCall:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((v=f.onBeforeEntityExecution)==null?void 0:v.call(f,i,H,e)),this.executeInternalCall(i,H,this.project)}case p.Operation:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((T=f.onBeforeEntityExecution)==null?void 0:T.call(f,i,H,e)),no.executeOperation(i,H,this.project)}case p.VariableInstance:case p.VariableDeclaration:return this.executeVariable(i,a);case p.FunctionCall:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((A=f.onBeforeEntityExecution)==null?void 0:A.call(f,i,H,e)),this.executeFunctionCall(i,H,this.project)}case p.FunctionDeclaration:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((I=f.onBeforeEntityExecution)==null?void 0:I.call(f,i,H,e)),no.executeEntryPointEntity(i,H)}case p.Search:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((O=f.onBeforeEntityExecution)==null?void 0:O.call(f,i,H,e)),this.executeSearch(i,H,this.project)}case p.Loop:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((L=f.onBeforeEntityExecution)==null?void 0:L.call(f,i,H,e)),this.executeLoop(i,H,this.project,f)}case p.ReturnStatement:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((M=f.onBeforeEntityExecution)==null?void 0:M.call(f,i,H,e)),this.executeReturnStatement(i,H)}case p.ContinueStatement:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((j=f.onBeforeEntityExecution)==null?void 0:j.call(f,i,H,e)),this.executeContinueStatement(i,H)}case p.BreakStatement:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((q=f.onBeforeEntityExecution)==null?void 0:q.call(f,i,H,e)),this.executeBreakStatement(i,H)}case p.GlobalEvent:{const H=this.mergeExernalValuesWithInternalInputs(a,i);return await((Z=f.onBeforeEntityExecution)==null?void 0:Z.call(f,i,H,e)),no.executeEntryPointEntity(i,H)}default:throw new Error(`Entity type ${i==null?void 0:i.type} is not recognized for execution.`)}}storeLastExecutionValues(i){var l,f;i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value);const a=Zs((l=i.result)==null?void 0:l.valueOwner,this.project);(f=i.result)!=null&&f.value?a.forEach(e=>{var y;this.lastExecutionResults.writeValue(e,(y=i.result)==null?void 0:y.value)}):a.forEach(e=>{this.lastExecutionResults.removeValue(e.id)})}async executeBranch(i,a={},l=[]){var T;const f={...ro,...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,f);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(v),await((T=f.onEntityExecuted)==null?void 0:T.call(f,i,v,e)),v.value===J.Success){const A=(i.successCalls||i.calls||[]).filter(j=>this.hasEntity(j));(i.errorCalls||[]).forEach(j=>{this.skip(j)});let O=[];const L=(await Promise.all(A.map(j=>this.schedule(j,[],f)))).filter(j=>!!j),M=L.filter(j=>!!j).find(j=>j.value===J.CaughtError||j.value===J.Return||j.value===J.Break||j.value===J.Continue);return M||(O=[...O,...L],v)}else if(v.value===J.CaughtError){const A=(i.errorCalls||[]).filter(j=>this.hasEntity(j));(i.successCalls||i.calls||[]).forEach(j=>{this.skip(j)});let O=[];const L=(await Promise.all(A.map(j=>this.schedule(j,[],f)))).filter(j=>!!j),M=L.filter(j=>!!j).find(j=>j.value===J.CaughtError||j.value===J.UnhandledError||j.value===J.Return||j.value===J.Break||j.value===J.Continue);return M||(O=[...O,...L],v)}else{if(v.value===J.UnhandledError)return this.executing.forEach(A=>{this.skip(A)}),this.scheduled.forEach(A=>{this.skip(A)}),Lr.includes(v.entity.type)&&pt(v.entity).forEach(A=>{this.skip(A)}),v;if(v.value===J.Return)return v;if(v.value===J.Break)return v;if(v.value===J.Continue)return v}return v}async execute(i={},a=[]){const l={...ro,...i};this.state="running";const f=await this.executeBranch(this.entryPoint,l,a);return this.state="finished-success",f}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 f,e,y;if(this.entities.includes(i))return!0;if(((f=i.parent)==null?void 0:f.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=_i(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 u_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 te.Number:return"number";case te.String:return"text";case te.Boolean:return"boolean";case te.UUID:return"uuid";case te.Date:return"date-time";default:return"definition-entity"}}const ts={[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 DA(d){const u=H0(d);if(!u){const a=op(d);if(a.includes(de.HTTP_ENDPOINT))return"HTTP endpoint";if(a.includes(de.PERSISTED_ENTITY))return"Persisted entity";if(a.includes(de.CRON_JOB))return"Scheduled execution";if(a.includes(de.RELATIONAL_DATABASE))return"Relational database"}if(u){let a="Extension of "+Q(u,u.project)+" entity",l=Vu(a);const f=op(d);return f.includes(de.HTTP_ENDPOINT)?"HTTP endpoint"+(l?", "+l:""):f.includes(de.PERSISTED_ENTITY)?"Persisted entity"+(l?", "+l:""):f.includes(de.CRON_JOB)?"Scheduled execution"+(l?", "+l:""):f.includes(de.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 Nq(d){return d.parent.type===p.DefinitionEntity||d.parent.type===p.InstalledProject?"Internal action of "+Q(d.parent,d.project):d.parent.type===p.Loop?"Action repeated on every iteration":"Internal action of entity"}function OA(d){return Sw(d)?Nq(d):"Custom trigger"}function p_e(d){var u;switch(d.type){case p.DefinitionEntity:return DA(d);case p.FunctionDeclaration:return OA(d)}return(u=ts[d.type])==null?void 0:u.singular}function c_e(d){var u;switch(d.type){case p.DefinitionEntity:return DA(d);case p.FunctionDeclaration:return OA(d)}return(u=ts[d.type])==null?void 0:u.singular}const PA=4e4,Vq=280,f_e=300,$A=65,Fu=32,Hm=39,Lq=26,Bq=49,Sm=44,y_e=35,Jm=52,NA=10,cl=NA*2,zm=38,Ym=90,VA=270,Mq=PA/2+120,xq=PA/2+180;function Uq(d){let i=Fu+Sm+zm+NA;const a=[...d.inputs];return a.length&&(i+=cl,a.forEach(()=>{i+=Lq})),{height:i,width:280}}function jq(d){let i=$A;const a=[];if([p.DefinitionEntity].includes(d.type)){const v=[...d.suggestedProperties||[],...d.properties||[]];v.length&&(i+=cl,v.forEach(T=>{i+=T.static?Bq:Hm}))}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+=cl,v.forEach(T=>{const A=Uq(T);i+=A.height}))}pi.includes(d.type)?(gt.includes(d.type)?a.push(...(d.usedInputs||[]).flatMap(v=>[v])||[]):a.push(...(d.inputs||[]).flatMap(v=>[v])||[]),d.error&&(i+=Jm)):[p.ReturnStatement,p.BreakStatement,p.ContinueStatement].includes(d.type)?(a.push(...d.outputs||[]),d.throws&&(i+=Jm)):d.type===p.Condition&&(a.push(d.inputs[0]),d.inputs[1]&&a.push(d.inputs[1]));const l=a.length;l&&(i+=l*Hm,i+=cl);const f=[];if(d.type===p.FunctionDeclaration||d.type===p.GlobalEvent?f.push(...d.inputs||[]):pi.includes(d.type)&&(gt.includes(d.type)?f.push(...d.usedOutputs||[]):f.push(...d.outputs||[])),gt.includes(d.type)){d.readsValue&&(i+=cl,i+=Sm),d.writesValues.length&&(i+=cl,i+=Sm),d.internalCalls.length&&d.usedInternalCalls.forEach(()=>i+=Jm+cl);const v=d.getDataType(null);(!v||v.inferred)&&(i+=zm)}const e=f.length;return e&&(i+=e*Hm,i+=cl),[p.DefinitionEntity,p.FunctionDeclaration,p.ReturnStatement,p.BreakStatement,p.ContinueStatement].includes(d.type)&&(i+=zm),{height:i,width:280}}function Wc(d){return`${d.split("-").map((a,l)=>l===0?a.charAt(0).toUpperCase()+a.slice(1):a.toLowerCase()).join(" ")}.`}function h_e(d){switch(d.code){case re.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case re.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case re.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case re.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case re.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case re.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case re.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case le.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case le.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case re.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case re.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case le.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case re.NoProperties:return"This entity has no properties, so it doesn't do anything";case re.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case re.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case re.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case re.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case re.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case re.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case re.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case re.PropertyImplementsNonAbstact:return"This property implements a non-template property";case re.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case re.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case re.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case re.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case re.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case le.InternalCallDeclarationIsNotFunctionDeclaration:return"This internal call is not an action";case le.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case le.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case le.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case le.UnreachableEntity:return"This entity is unreachable";case re.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case re.AbstractEntityImplements:return"This template entity implements a non-template entity";case re.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case re.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case re.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case re.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case re.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case re.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case re.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case re.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case re.MissingRequiredValue:return"This action is missing a required value";case re.NoPrimaryKeyProperty:return"This entity has no primary key property";case re.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case re.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case re.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case re.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case re.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case re.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case re.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case le.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case le.EmptyName:return"This entity has no name";case le.InvalidObjectStructure:return"This entity has an invalid structure";case le.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case le.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case le.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case le.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case le.MissingCaller:return"This action is missing a caller";case le.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case le.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case le.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case le.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case le.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case le.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case le.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case le.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case Oa.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Oa.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case jn.UUIDMustBeString:return`UUID must be a string, eg: "${fd()}"`;case jn.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${fd()}"`;case jn.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${fd()}"`;case pn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case pn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case pn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return Wc(d.code)}}function m_e(d){switch(d.code){case re.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case re.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case re.IncorrectEntityImplementation:return"Incorrect implementation";case re.IncorrectMethodImplementation:return"Incorrect action implementation";case re.IncorrectPropertyImplementation:return"Incorrect property implementation";case re.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case re.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case le.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case le.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case re.MissingMethodImplementation:return"Missing action";case re.MissingPropertyImplementation:return"Missing property";case le.NameNotUniqueInScope:return"Duplicate name";case re.NoProperties:return"No properties";case re.NonStaticPropertyInStaticEntity:return"Non-static property";case re.StaticEntityWithNonStaticProperties:return"Non-static properties";case re.ReadingFromIncompatibleType:return"Read from different type";case re.WritingToIncompatibleType:return"Write to different type";case re.ScopeWithoutLogic:return"No logic";case re.NonStaticPropertyImplementsStatic:return"Invalid static property";case re.PropertyImplementsIncompatibleType:return"Incompatible data type";case re.PropertyImplementsNonAbstact:return"Non-template property";case re.StaticPropertyImplementsNonStatic:return"Non-static property";case re.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case re.VariableHasInputsAndInternalCall:return"Bad internal call";case re.VariableHasOutputsAndInternalCall:return"Bad internal call";case re.VariableIsCalledAndHasInternalCall:return"Bad internal call";case le.InternalCallDeclarationIsNotFunctionDeclaration:return"Declaration not an action";case le.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case le.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case le.InternalCallParentMissingDataType:return"Parent has no data type";case le.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case le.UnreachableEntity:return"Unreachable entity";case re.DisconnectedCallableEntity:return"Disconnected entity";case re.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case re.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case re.InvalidPropertiesCombination:return"Invalid properties combination";case re.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case re.ExtendsIncompatibleEntities:return"Extends incompatible entities";case re.ImplementingNonAbstractEntity:return"Implementing non-template entity";case re.ImplementsIncompatibleEntities:return"Implements incompatible entities";case re.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case re.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case re.MissingRequiredValue:return"Missing required value";case re.NoPrimaryKeyProperty:return"No primary key property";case re.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case re.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case re.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case re.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case re.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case re.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case re.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case le.EmptyName:return"Empty name";case le.InvalidObjectStructure:return"Invalid object structure";case le.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case le.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case le.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case le.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case le.MissingCaller:return"Missing caller";case le.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case le.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case le.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case le.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case le.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case le.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case le.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case le.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case Oa.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Oa.StatusCodeMustBeNumber:return"HTTP status code must be a number";case jn.UUIDMustBeString:return"UUID must be a string";case jn.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case jn.UUIDMustBeValidFormat:return"UUID must be in a valid format";case pn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case pn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case pn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return Wc(d.code)}}function v_e(d){switch(d.code){case re.AbstractEntityWithNonAbstractMethods:return`${Q(d.entity,d.entity.project)} has non-template actions`;case re.AbstractEntityWithNonAbstractProperties:return`${Q(d.entity,d.entity.project)} has non-template properties`;case re.IncorrectEntityImplementation:return`${Q(d.entity,d.entity.project)} incorrectly implements template`;case re.IncorrectMethodImplementation:return`${Q(d.entity,d.entity.project)} incorrectly implements the template`;case re.IncorrectPropertyImplementation:return`${Q(d.entity,d.entity.project)} incorrectly implements the template`;case re.AbstractMethodInNonAbstractEntity:return`${Q(d.entity,d.entity.project)} can't be a template`;case re.AbstractPropertyInNonAbstractEntity:return`${Q(d.entity,d.entity.project)} can't be a template`;case le.MethodOverwritesOtherSiblingWithSameName:return`${Q(d.entity,d.entity.project)} overwrites action`;case le.PropertyOverwritesOtherSiblingWithSameName:return`${Q(d.entity,d.entity.project)} overwrites property`;case re.MissingMethodImplementation:return`${Q(d.entity,d.entity.project)} is missing action`;case re.MissingPropertyImplementation:return`${Q(d.entity,d.entity.project)} is missing property`;case le.NameNotUniqueInScope:return`${Q(d.entity,d.entity.project)} name is not unique`;case re.NoProperties:return`${Q(d.entity,d.entity.project)} has no properties`;case re.NonStaticPropertyInStaticEntity:return`${Q(d.entity,d.entity.project)} has non-static property`;case re.StaticEntityWithNonStaticProperties:return`${Q(d.entity,d.entity.project)} has non-static properties`;case re.ReadingFromIncompatibleType:return`${Q(d.entity,d.entity.project)} reads from different type`;case re.WritingToIncompatibleType:return`${Q(d.entity,d.entity.project)} writes to different type`;case re.ScopeWithoutLogic:return`${Q(d.entity,d.entity.project)} has no logic`;case re.NonStaticPropertyImplementsStatic:return`${Q(d.entity,d.entity.project)} has invalid static property`;case re.PropertyImplementsIncompatibleType:return`${Q(d.entity,d.entity.project)} has incompatible data type`;case re.PropertyImplementsNonAbstact:return`${Q(d.entity,d.entity.project)} has non-template property`;case re.StaticPropertyImplementsNonStatic:return`${Q(d.entity,d.entity.project)} has non-static property`;case re.VariableCallsOthersAndHasInternalCall:return`${Q(d.entity,d.entity.project)} has bad internal call`;case re.VariableHasInputsAndInternalCall:return`${Q(d.entity,d.entity.project)} has bad internal call`;case re.VariableHasOutputsAndInternalCall:return`${Q(d.entity,d.entity.project)} has bad internal call`;case re.VariableIsCalledAndHasInternalCall:return`${Q(d.entity,d.entity.project)} has bad internal call`;case le.InternalCallDeclarationIsNotFunctionDeclaration:return`${Q(d.entity,d.entity.project)} has declaration that is not an action`;case le.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${Q(d.entity,d.entity.project)} has declaration that is not found in parent`;case le.InternalCallParentDeclarationEntityInvalidType:return`${Q(d.entity,d.entity.project)} has invalid parent declaration type`;case le.InternalCallParentMissingDataType:return`${Q(d.entity,d.entity.project)}'s parent has no data type`;case le.InternalCallDeclarationNotInParentDatatypeEntity:return`${Q(d.entity,d.entity.project)} has declaration that is not in parent`;case le.UnreachableEntity:return`${Q(d.entity,d.entity.project)} is unreachable`;case re.DisconnectedCallableEntity:return`${Q(d.entity,d.entity.project)} is not executed by any entity`;case re.AbstractEntityImplements:return`${Q(d.entity,d.entity.project)} implements a non-template entity`;case re.AbstractExtendingNonAbstractEntity:return`${Q(d.entity,d.entity.project)} extends a non-template entity`;case re.InvalidPropertiesCombination:return`${Q(d.entity,d.entity.project)} has invalid properties combination`;case re.ExtendingNonInteractiveEntity:return`${Q(d.entity,d.entity.project)} extends a non-interactive entity`;case re.ExtendsIncompatibleEntities:return`${Q(d.entity,d.entity.project)} extends incompatible entities`;case re.ImplementingNonAbstractEntity:return`${Q(d.entity,d.entity.project)} implements a non-template entity`;case re.ImplementsIncompatibleEntities:return`${Q(d.entity,d.entity.project)} implements incompatible entities`;case re.LackingReturnStatementOnSomeBranches:return`${Q(d.entity,d.entity.project)} is missing termination on some branches`;case re.LastCalledEntityMustBeReturnEntity:return`${Q(d.entity,d.entity.project)}'s last called entity must be a termination node`;case re.MissingRequiredValue:return`${Q(d.entity,d.entity.project)} is missing a required value`;case re.NoPrimaryKeyProperty:return`${Q(d.entity,d.entity.project)} has no primary key property`;case re.NonAbstractExtendingAbstractEntity:return`${Q(d.entity,d.entity.project)} extends a template entity`;case re.NonStaticExtendingStaticEntity:return`${Q(d.entity,d.entity.project)} extends a static entity`;case re.NonStaticImplementingStaticEntity:return`${Q(d.entity,d.entity.project)} implements a static entity`;case re.StaticExtendingNonStaticEntity:return`${Q(d.entity,d.entity.project)} extends a non-static entity`;case re.StaticImplementingNonStaticEntity:return`${Q(d.entity,d.entity.project)} implements a non-static entity`;case re.VariableReadsValueAndInternalCall:return`${Q(d.entity,d.entity.project)} reads a value and has internal call`;case re.VariableWritesValuesAndInternalCall:return`${Q(d.entity,d.entity.project)} writes values and has internal call`;case le.EmptyName:return`${ts[d.entity.type]} has no name`;case le.InvalidObjectStructure:return`${Q(d.entity,d.entity.project)} has invalid structure`;case le.LoopBodyFunctionOverwrite:return`${Q(d.entity,d.entity.project)}'s loop body action overwrites an action`;case le.MethodOverwritesBaseMethodWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites base action`;case le.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites another action with same implementation`;case le.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites another action with same implementation`;case le.MissingCaller:return`${Q(d.entity,d.entity.project)} is missing a caller`;case le.NameAsResolvedCodeNameNotUniqueInScope:return`${Q(d.entity,d.entity.project)} has a name not unique in the scope`;case le.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${Q(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case le.NameMustStartWithLetterOrUnderscore:return`${Q(d.entity,d.entity.project)} name must start with letter or underscore`;case le.NoOverlapWithImplementedSignature:return`${Q(d.entity,d.entity.project)} has no overlap with implemented signature`;case le.PropertyOverwritesBasePropertyWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites base property`;case le.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites another property with same implementation`;case le.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites another property with same implementation`;case le.ReaderWriterIncompatibleDataType:return`${Q(d.entity,d.entity.project)} has reader/writer with incompatible data type`;case Oa.StatusCodeMustBeBetween100And599:return`${Q(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case Oa.StatusCodeMustBeNumber:return`${Q(d.entity,d.entity.project)} HTTP status code must be a number`;case jn.UUIDMustBeString:return`${Q(d.entity,d.entity.project)} UUID must be a string`;case jn.UUIDMustNotContainSpaces:return`${Q(d.entity,d.entity.project)} UUID must not contain spaces`;case jn.UUIDMustBeValidFormat:return`${Q(d.entity,d.entity.project)} UUID must be in a valid format`;case pn.MustBeUniqueAmongSameEntities:return`${Q(d.entity,d.entity.project)} value must be unique among the same kind`;case pn.StringValueMustNotHaveDashes:return`${Q(d.entity,d.entity.project)} value must not contain dashes`;case pn.StringValueMustNotHaveSpaces:return`${Q(d.entity,d.entity.project)} value must not contain spaces`;default:return`${Q(d.entity,d.entity.project)} Error: ${Wc(d.code)}`}}function T_e(d){var u,i,a,l;switch(d.code){case re.AbstractEntityWithNonAbstractMethods:return`${Q(d.entity,d.entity.project)} has non-template actions`;case re.AbstractEntityWithNonAbstractProperties:return`${Q(d.entity,d.entity.project)} has non-template properties`;case re.IncorrectEntityImplementation:return`${Q(d.entity,d.entity.project)} incorrectly implements the template entity`;case re.IncorrectMethodImplementation:return`${Q(d.entity,d.entity.project)} incorrectly implements the template action it's based on`;case re.IncorrectPropertyImplementation:return`${Q(d.entity,d.entity.project)} incorrectly implements the template property it's based on`;case re.AbstractMethodInNonAbstractEntity:return`${Q(d.entity,d.entity.project)} is a template action in a non-template entity`;case re.AbstractPropertyInNonAbstractEntity:return`${Q(d.entity,d.entity.project)} is a template property in a non-template entity`;case le.MethodOverwritesOtherSiblingWithSameName:return`${Q(d.entity,d.entity.project)} overwrites an action in the template entity`;case le.PropertyOverwritesOtherSiblingWithSameName:return`${Q(d.entity,d.entity.project)} overwrites a property in the template entity`;case re.MissingMethodImplementation:return`${Q(d.entity,d.entity.project)} is missing an action implementation from the template entity`;case re.MissingPropertyImplementation:return`${Q(d.entity,d.entity.project)} is missing a property implementation from the template entity`;case le.NameNotUniqueInScope:return`${Q(d.entity,d.entity.project)} has a duplicate name in the same scope`;case re.NoProperties:return`${Q(d.entity,d.entity.project)} has no properties, so it doesn't do anything`;case re.NonStaticPropertyInStaticEntity:return`${Q(d.entity,d.entity.project)} has a non-static property in a static entity`;case re.StaticEntityWithNonStaticProperties:return`${Q(d.entity,d.entity.project)} has non-static properties in a static entity`;case re.ReadingFromIncompatibleType:return`${Q(d.entity,d.entity.project)} reads data from a value of a different data type`;case re.WritingToIncompatibleType:return`${Q(d.entity,d.entity.project)} writes data to a value of a different data type`;case re.ScopeWithoutLogic:return`${Q(d.entity,d.entity.project)} has no logic`;case re.NonStaticPropertyImplementsStatic:return`${Q(d.entity,d.entity.project)} has a static property in a non-static entity`;case re.PropertyImplementsIncompatibleType:return`${Q(d.entity,d.entity.project)} implements a property of a different data type`;case re.PropertyImplementsNonAbstact:return`${Q(d.entity,d.entity.project)} implements a non-template property`;case re.StaticPropertyImplementsNonStatic:return`${Q(d.entity,d.entity.project)} has a static property in a non-static entity`;case re.VariableCallsOthersAndHasInternalCall:return`${Q(d.entity,d.entity.project)} calls other entities while being used to execute internal logic`;case re.VariableHasInputsAndInternalCall:return`${Q(d.entity,d.entity.project)} has inputs while being used to execute internal logic`;case re.VariableHasOutputsAndInternalCall:return`${Q(d.entity,d.entity.project)} has outputs while being used to execute internal logic`;case re.VariableIsCalledAndHasInternalCall:return`${Q(d.entity,d.entity.project)} is called while being used to execute internal logic`;case le.InternalCallDeclarationIsNotFunctionDeclaration:return`${Q(d.entity,d.entity.project)} has a declaration that is not an action`;case le.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${Q(d.entity,d.entity.project)} has a declaration that is not found in ${(u=d.entity.parent.getDataType(null))!=null&&u.entity?Q((i=d.entity.parent.getDataType(null))==null?void 0:i.entity,d.entity.project):"the variable's data-type entity"}`;case le.InternalCallParentDeclarationEntityInvalidType:return`${Q(d.entity,d.entity.project)} is part of a variable whos data-type entity can't have actions`;case le.InternalCallParentMissingDataType:return`${Q(d.entity,d.entity.project)} is part of a variable with no data-type entity`;case le.InternalCallDeclarationNotInParentDatatypeEntity:return`${Q(d.entity,d.entity.project)} has a declaration doesn't belong to ${(a=d.entity.parent.getDataType(null))!=null&&a.entity?Q((l=d.entity.parent.getDataType(null))==null?void 0:l.entity,d.entity.project):"the variable's data-type entity"}`;case le.UnreachableEntity:return`${Q(d.entity,d.entity.project)} is unreachable`;case re.DisconnectedCallableEntity:return`${Q(d.entity,d.entity.project)} is disconnected and won't be executed by anything after publishing`;case re.AbstractEntityImplements:return`${Q(d.entity,d.entity.project)} implements a non-template entity`;case re.AbstractExtendingNonAbstractEntity:return`${Q(d.entity,d.entity.project)} extends a non-template entity`;case re.InvalidPropertiesCombination:return`${Q(d.entity,d.entity.project)} has an invalid combination of properties`;case re.ExtendingNonInteractiveEntity:return`${Q(d.entity,d.entity.project)} extends a non-interactive entity`;case re.ExtendsIncompatibleEntities:return`${Q(d.entity,d.entity.project)} extends incompatible entities`;case re.ImplementingNonAbstractEntity:return`${Q(d.entity,d.entity.project)} implements a non-template entity`;case re.ImplementsIncompatibleEntities:return`${Q(d.entity,d.entity.project)} implements incompatible entities`;case re.LackingReturnStatementOnSomeBranches:return`${Q(d.entity,d.entity.project)} has branches that don't terminate`;case re.LastCalledEntityMustBeReturnEntity:return`${Q(d.entity,d.entity.project)} must end with a termination node`;case re.MissingRequiredValue:return`${Q(d.entity,d.entity.project)} is missing a required value`;case re.NoPrimaryKeyProperty:return`${Q(d.entity,d.entity.project)} has no primary key property`;case re.NonAbstractExtendingAbstractEntity:return`${Q(d.entity,d.entity.project)} is a non-template entity extending a template entity`;case re.NonStaticExtendingStaticEntity:return`${Q(d.entity,d.entity.project)} is a non-static entity extending a static entity`;case re.NonStaticImplementingStaticEntity:return`${Q(d.entity,d.entity.project)} is a non-static entity implementing a static entity`;case re.StaticExtendingNonStaticEntity:return`${Q(d.entity,d.entity.project)} is a static entity extending a non-static entity`;case re.StaticImplementingNonStaticEntity:return`${Q(d.entity,d.entity.project)} is a static entity implementing a non-static entity`;case re.VariableReadsValueAndInternalCall:return`${Q(d.entity,d.entity.project)} reads a value and has an internal call`;case re.VariableWritesValuesAndInternalCall:return`${Q(d.entity,d.entity.project)} writes values and has an internal call`;case le.EmptyName:return`${ts[d.entity.type]} has no name`;case le.InvalidObjectStructure:return`${Q(d.entity,d.entity.project)} has an invalid structure`;case le.LoopBodyFunctionOverwrite:return`${Q(d.entity,d.entity.project)}'s loop body action overwrites`;case le.MethodOverwritesBaseMethodWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites a base action with same implementation`;case le.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites another action with same implementation`;case le.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites another action with same implementation`;case le.MissingCaller:return`${Q(d.entity,d.entity.project)} is missing a caller`;case le.NameAsResolvedCodeNameNotUniqueInScope:return`${Q(d.entity,d.entity.project)} has a name that is not unique in the scope`;case le.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${Q(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case le.NameMustStartWithLetterOrUnderscore:return`${Q(d.entity,d.entity.project)} name must start with letter or underscore`;case le.NoOverlapWithImplementedSignature:return`${Q(d.entity,d.entity.project)} has no overlap with implemented signature`;case le.PropertyOverwritesBasePropertyWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites a base property with same implementation`;case le.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites another property with same implementation`;case le.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${Q(d.entity,d.entity.project)} overwrites another property with same implementation`;case le.ReaderWriterIncompatibleDataType:return`${Q(d.entity,d.entity.project)} has a reader/writer with incompatible data type`;case Oa.StatusCodeMustBeBetween100And599:return`${Q(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case Oa.StatusCodeMustBeNumber:return`${Q(d.entity,d.entity.project)} HTTP status code must be a number, between 100 and 599`;case jn.UUIDMustBeString:return`${Q(d.entity,d.entity.project)} UUID must be a string, eg: "${fd()}"`;case jn.UUIDMustNotContainSpaces:return`${Q(d.entity,d.entity.project)} UUID must not contain spaces, eg: "${fd()}"`;case jn.UUIDMustBeValidFormat:return`${Q(d.entity,d.entity.project)} UUID must be in a valid format. Eg: "${fd()}"`;case pn.MustBeUniqueAmongSameEntities:return`${Q(d.entity,d.entity.project)} value must be unique among the same kind`;case pn.StringValueMustNotHaveDashes:return`${Q(d.entity,d.entity.project)} value must not contain dashes`;case pn.StringValueMustNotHaveSpaces:return`${Q(d.entity,d.entity.project)} value must not contain spaces`;default:return`${Q(d.entity,d.entity.project)} Error: ${Wc(d.code)}`}}var LA=(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))(LA||{});const E_e=Object.values(LA);var BA=(d=>(d.NotPartOfOngoingTest="not-part-of-ongoing-test",d.CannotBeAddedToTest="cannot-be-added-to-test",d))(BA||{});const b_e=Object.values(BA);var MA=(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))(MA||{});const I_e=Object.values(MA);function A_e(d,u){const i=[...d,...u];return Array.from(new Set(i))}function w_e(d,u){const i=[...d,...u],a=Array.from(new Set(i));return{hasChanged:a.length!==d.length,reasons:a}}function R_e(d,u){const i=d.filter(l=>!u.includes(l));return{hasChanged:i.length!==d.length,reasons:i}}function g_e(d,u){return d.find(i=>i.entity.id===u)||null}function Gq(d){return d.filter((u,i)=>d.indexOf(u)===i)}class Gr{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=Mq-VA-Vq,f=xq-Ym-$A;u.metaSync({x:u.x||l,y:u.y||f},i);const e=new Gr(u,0,null,i);e._onlyEntities=a||[],e.ids=["0"];const y=[];e.next(T=>{y.push(...T)}),Gr.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&&Gr.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,f)=>l||f.findAreaInChildrenFromEntity(u),null)}findAreaFromEntity(u){if(this.entity===u)return this;const i=this.calculationEntryPoint.children,a=i.find(f=>f.entity===u);return a||i.reduce((f,e)=>f||e.findAreaInChildrenFromEntity(u),null)}addParent(u){if(!this.parents.includes(u)){const i=Gr.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=Ys(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(Bt.includes(e.type)){l.push(e);return}i.push(e)});const f=i.sort((e,y)=>{const v=!!U0(e,y).length,T=Ys(e),A=Ys(y);return v?0:T.length&&!A.length?-1:!T.length&&A.length?1:0}).filter(e=>!bo(e).length);this.childEntities=[...a,...l,...f]}else{const i=[],a=[],l=[],f=[],e=[];Lr.includes(this.entity.type)&&k0(this.entity).forEach(T=>{if(gt.includes(T.type)){l.push(T);return}const A=_i(T);i.push(A)}),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:gt.includes(v.type)?(l.push(v),!1):Jr.includes(v.type)&&!T?(f.push(v),!1):v.type===p.DefinitionEntity?(e.push(v),!1):!0});i.sort((v,T)=>Rd(v,T)?-1:0),f.sort((v,T)=>Rd(v,T)?-1:0),l.sort((v,T)=>kw(v,T)?1:kw(T,v)?-1:0),this.childEntities=[...e,...i,...f,...y,...l,...a]}}calculateCardSize(){const u=jq(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(f=>!i.includes(f));return a.reduce((f,e)=>i.includes(e)?f:Gr.getBoundriesOfTwoAreas(f,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)=>Gr.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)=>Gr.getBoundriesOfTwoAreas(e,y),a)}getFullAreaUntil(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(f=>f!==u).map(f=>f.getFullAreaUntil(u)).reduce((f,e)=>Gr.getBoundriesOfTwoAreas(f,e),i)}get fullBranchArea(){const u=this.ownEntityPlusBufferArea;return this.children.map(l=>l.fullBranchArea).reduce((l,f)=>Gr.getBoundriesOfTwoAreas(l,f),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+Ym,right:u.right+VA}}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,f)=>f.getEarliestLevel()>l.getEarliestLevel()?f: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([...Bt].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 f=this.countColumns(),e=l.countColumns();return f>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(Gr.getEarliestParentInChain(l)!==this)return;const e=g_e(a,l.entity.id);a=Gr.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=Gr.filterOutRepeatedAreas([...this.flattenSiblings(),...u]);Gr.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(f=>f!==i);i.shiftRightUntilAny(l,u)})}shiftDownAlone(u){this.move(this.entity,{y:this.entity.y+u})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const u=this.parents.reduce((l,f)=>{const e=f.ownEntityArea,y=e.top+Fu,v={top:y,left:e.left,bottom:y,right:e.right};return Gr.getBoundriesOfTwoAreas(l,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-Fu;this.shiftDownAlone(a)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const u=this.children.reduce((l,f)=>{const e=f.ownEntityArea,y=e.top+Fu,v={top:y,left:e.left,bottom:y,right:e.right};return Gr.getBoundriesOfTwoAreas(l,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-Fu;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 f=a.ids.sort((y,v)=>y.length<v.length?-1:0),e=l.ids.sort((y,v)=>y.length<v.length?-1:0);return f[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),f=a.children.slice(l+1);return[...i,...f]},[]);return Gq(u)}getLowerAreas(){const u=this.getLowerSiblings(),i=this.parents.reduce((a,l)=>[...a,...l.getLowerAreas()],[]);return Gq([...u,...i])}adjustVerticallyToAvoidOverlaps(u=[]){const a=Gr.getEarliestParentInChain(this).children[this.index-1];if(!a)return u;const l=this.flattenEarlierSiblings(),f=this.flattenParents(),e=[...l,...f,a],T=g(e.flatMap(L=>U0(this.entity,L.entity))).filter(L=>L.id!==this.entity.id).map(L=>this.findAreaFromEntity(L)).filter(L=>!!L),A=this.getFullAreaUntilAny(T),I=a.getFullAreaUntilAny(T),O=e.reduce((L,M)=>M===this||M.fullBranchArea.left!==A.left?L:Math.max(L,M.fullBranchArea.bottom),I.bottom);if(A.top<O){const L=O-A.top+Ym;return this.shiftDownUntilAny(u,L)}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 Gr(i,u,this.calculationEntryPoint));const l=this.ownEntityPlusBufferArea;this.children.includes(a)||(this.children.push(a),a.addParent(this));const f=a.fullBranchArea;if(f.left<l.right){const e=l.right-f.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 f=this.addChild(l);f&&i.push(f)}),u(i)}}var Hc=(d=>(d.Amazon="amazon",d.Google="google",d.Microsoft="microsoft",d))(Hc||{}),sr=(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))(sr||{}),xA=(d=>(d.Post="post",d.Get="get",d.Acknowledgement="acknowledgment",d.Progress="progress",d.Error="error",d.Complete="complete",d))(xA||{}),md=(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))(md||{}),UA=(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))(UA||{}),vt=(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))(vt||{}),Ss=(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.CodebaseCleanup="codebase-cleanup",d))(Ss||{});sr.CloudHostedCodebase,sr.HttpApi,sr.RelationalDatabase,sr.CloudHostedCodebase,sr.CloudHostedCodebase,sr.RelationalDatabase,sr.CloudHostedCodebase,sr.CloudHostedCodebase;function kq(d){return`project-${d}-http-api`}function Fq(d){return`entity-${d}-database`}class Kq{constructor(u,i,a,l,f,e,y,v,T){_(this,"stepType");_(this,"id");_(this,"resourceType");_(this,"index");_(this,"dependency",[]);_(this,"lastEvent",null);_(this,"lasEventTimestamp",null);_(this,"status",md.Queued);_(this,"publicationRun");_(this,"resource");this.stepType=u,this.id=i,this.resourceType=a,this.status=l,this.dependency=f,this.index=e,this.lasEventTimestamp=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 qq=(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))(qq||{});class jA{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 GA extends jA{constructor(i,a,l,f){super(i,l,f);_(this,"resourceType");_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(e=>{this.owners.set(e.id,e)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,a;return this.resourceType===sr.HttpApi?this.resourceId=kq(this.publicationRun.project.id):this.resourceType===sr.RelationalDatabase&&(this.resourceId=Fq((a=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:a.id)),this.resourceId}}class kA extends jA{constructor(i,a,l){super(i,a,l);_(this,"resourceType");_(this,"details",null);_(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceType===sr.CompiledLocalCodebase?this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`:this.resourceType===sr.CloudHostedCodebase&&(this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`),this.resourceId}}class C_e{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.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}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(sr.CompiledLocalCodebase,new kA(this,sr.CompiledLocalCodebase,Hc.Amazon)),this.implicitGlobalResources.set(sr.CloudHostedCodebase,new kA(this,sr.CloudHostedCodebase,Hc.Amazon));const u=this.project.entities.filter(a=>ar(a,de.HTTP_ENDPOINT)),i=this.project.entities.filter(a=>ar(a,de.RELATIONAL_DATABASE));if(i.length&&i.forEach(a=>{const l=new GA(this,[a],sr.RelationalDatabase,Hc.Amazon);this.explicitResources.set(l.resourceId,l)}),u.length){const a=new GA(this,u,sr.HttpApi,Hc.Amazon);this.explicitResources.set(a.resourceId,a)}}setSteps(u,i){u.forEach(a=>{this.addStep(a,i)}),this.editor.events.emit(vt.ProjectPublishRequestAcknowledged,{})}addStep(u,i){const a=u.dependency||[];if(a.length){const f=a.filter(e=>!this.steps.find(y=>y.id===e));if(f.length)throw new Error(`Missing dependencies: ${f.join(", ")}`)}if(!u.resource)throw new Error(`Resource not found for step ${u.stepType} (${u.id})`);if(!this.steps.find(f=>f.id===u.id)){const f=this.implicitGlobalResources.get(u.resourceType)||this.explicitResources.get(u.resource.resourceId),e=new Kq(u.stepType,u.id,u.resourceType,u.status,a,u.index,i,this,f);this.steps.push(e)}}onUpdate(u){var i;if(S.log("onUpdate",u),(i=u.payload)!=null&&i.stepType){const a=this.steps.find(l=>{var f;return l.id===((f=u.payload)==null?void 0:f.id)});a&&B(u.emittedAt).isAfter(B(a.lasEventTimestamp))&&a.update(u.payload)}this.editor.events.emit("publication-updated",{}),u.type===xA.Error?(this.finalStatus=UA.Failed,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-error",u)):u.type===xA.Complete&&(this.finalStatus=UA.Success,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-completed",u))}}function __e(d){switch(d){case Ss.CodeCompilation:return"Code generation";case Ss.RelationalDatabaseDeployment:return"Database creation";case Ss.HttpApiDeployment:return"HTTP gateway creation";case Ss.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case Ss.BundleCodebase:return"Bundle code";case Ss.MigrateRelationalDatabase:return"Database structure migration";case Ss.BusinessLogicCodebaseDeployment:return"Update servers with new code";case Ss.CodebaseCleanup:return"Code cleanup";case Ss.HttpApiDeletion:return"HTTP gateway deletion";case Ss.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function D_e(d){switch(d){case vt.DeploymentCompleted:return"Successfully published";case vt.DeploymentStarted:return"Publication started";case vt.DeploymentFailed:return"Publication failed";case vt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case vt.RequestPayloadValidationFailed:return"Request payload validation failed";case vt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case vt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case vt.RelationalDatabaseDeploymentStarted:return"Database creation started";case vt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case vt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case vt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case vt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case vt.RelationalDatabaseAlreadyExists:return"Database already exists";case vt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case vt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case vt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case vt.CreatingNewHttpApi:return"Creating new HTTP gateway";case vt.HttpApiAlreadyExists:return"HTTP gateway already exists";case vt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case vt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case vt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case vt.BundlingCodebaseForDownload:return"Bundling code for download";case vt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case vt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case vt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case vt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case vt.CodeCompilationStarted:return"Code generation started";case vt.CodeCompilationCompleted:return"Code generation completed";case vt.CodeCompilationFailed:return"Code generation failed";case vt.BundleCodebaseStarted:return"Code bundling started";case vt.BundleCodebaseCompleted:return"Code bundling completed";case vt.BundleCodebaseFailed:return"Code bundling failed";case vt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case vt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case vt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case vt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case vt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case vt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case vt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case vt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case vt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case vt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case vt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case vt.ProjectNotFound:return"Project not found";case vt.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case vt.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case vt.HttpApiDeletionStarted:return"HTTP gateway deletion started";case vt.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case vt.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case vt.RelationalDatabaseDeletionStarted:return"Database deletion started";case vt.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case vt.RelationalDatabaseDeletionFailed:return"Database deletion failed";case vt.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var Zq=(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))(Zq||{});function O_e(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 P_e(d){switch(d){case sr.RelationalDatabase:return"Relational database";case sr.HttpEndpoint:case sr.HttpApi:return"HTTP endpoints";case sr.ServerlessFunction:case sr.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function $_e(d){switch(d){case md.Running:return"In progress";case md.Failed:return"Failed";case md.Success:return"Succeeded";case md.Skipped:return"Skipped";case md.Queued:default:return"Queued"}}function Wq(d){var a;if(!ar(d,de.EXTERNAL_INTEGRATION_CONNECTION))return null;let u=null;const i=ce["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(d.type===p.BuiltInBaseEntity?ar(d,de.EXTERNAL_INTEGRATION_CONNECTION)&&(u=FA(d.name)):d.type===p.DefinitionEntity&&d.implements.forEach(l=>{if(ar(l,de.EXTERNAL_INTEGRATION_CONNECTION)){const f=FA(l==null?void 0:l.name);if(f)return u=f,!0}}),!u){const l=d.properties.find(f=>!!f.implements.find(e=>e.id===i)||!!f.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 Hq(d){return rP[d]}function FA(d){return d.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?d.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function Sq(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(Lt).includes(u.id))return u.id.split("--")[1]||null}return null}function N_e(d){return Object.values(de).find(i=>{if(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")){const a=Hq(d);if(!a)return!1;if(i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===a.toLowerCase())return!0}return!1})||null}function V_e(d){return d.type===p.BuiltInBaseEntity||d.type===p.DefinitionEntity?Wq(d):d.type===p.ActionDescriptor||d.type===p.Operation?Sq(d):null}function Jq(d){var l,f,e;if(!ar(d,de.EXTERNAL_INTEGRATION_CONNECTION))return null;let u=null;const i=zH(d,de.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const a=ce["built-in-base-entity"][i.id].properties.connectionId.id;if(d.type===p.BuiltInBaseEntity){if(ar(d,de.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 A;return((A=T.extends)==null?void 0:A.id)===a}));if(!y&&((f=d.extends)==null?void 0:f.type)===p.DefinitionEntity)return Jq(d.extends);u=(e=y==null?void 0:y.getDefaultValue())==null?void 0:e.value}return u}function zq(d){var l;(l=d.dataType)==null||l.validate(),d.inputs.forEach(f=>f.validate()),d.outputs.forEach(f=>f.validate()),d.internalCalls.forEach(f=>f.validate());const i=[...hl(d),...wd(d),...Yq(d),...ml(d),...Xq(d)],a=Pw(d);return i.push(...a),$i(d.errors,i)}function Yq(d,u){const a=[...d.project.getVariableDeclarations()].filter(l=>l.id!==d.id);return ny(d,[Oi],a,u)}function Xq(d){const u=[];if(d.parent!==d.project)return u;if(d.catchesError){const i=Ct({id:`${d.id}--${le.GlobalVariableDeclarationCannotCatchError}`,message:`${ts[d.type].singular} "${Q(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:Y.Error,code:le.GlobalVariableDeclarationCannotCatchError,entity:d});u.push(i.error)}if(d.errorCalls.length){const i=Ct({id:`${d.id}--${le.GlobalVariableDeclarationCannotCallOnError}`,message:`${ts[d.type].singular} "${Q(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:Y.Error,code:le.GlobalVariableDeclarationCannotCallOnError,entity:d});u.push(i.error)}if(d.calledBy.length){const i=Ct({id:`${d.id}--${le.GlobalVariableDeclarationCannotBeCalled}`,message:`${ts[d.type].singular} "${Q(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:Y.Error,code:le.GlobalVariableDeclarationCannotBeCalled,entity:d});u.push(i.error)}return[]}const L_e=Object.freeze(Object.defineProperty({__proto__:null,validate:zq,validateGlobalVariableDeclaration:Xq,validateVariableDeclarationName:Yq},Symbol.toStringTag,{value:"Module"}));function Qq(d){d.inputs.forEach(l=>l.validate()),d.outputs.forEach(l=>l.validate()),d.internalCalls.forEach(l=>l.validate());const i=[...hl(d),...wd(d),...ml(d)],a=Pw(d);return i.push(...a),$i(d.errors,i)}const B_e=Object.freeze(Object.defineProperty({__proto__:null,validate:Qq},Symbol.toStringTag,{value:"Module"}));var KA=(d=>(d.Parent="parent",d.DataTypeEntity="data-type-entity",d.VarDeclaration="var-declaration",d))(KA||{});const Ht=class Ht extends nr{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:V.UUID.uuid(),version:V.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||V.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 L=X(i.parent);l=a.get(L)}const f=X(i.declaration),e=a.get(f),y=i.calledByEntry.map(L=>{const M=X(L);return a.get(M)}),v=i.calledBySuccess.map(L=>{const M=X(L);return a.get(M)}),T=i.calledByError.map(L=>{const M=X(L);return a.get(M)});let A=null;if(i.readsValue){const L=X(i.readsValue);A=a.get(L)}const I={id:i.id,version:V.UUID.uuid(),createdAt:B().toISOString(),author:V.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:A,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:l},O=se(I,a);return O.setParent(l,null),O}static validateGenerationTarget(i,a){let l=JSON.parse(JSON.stringify(i));const f=[],e=Or(l,{parent:{list:!1,types:[...qi,p.Project],optional:!0},declaration:{list:!1,types:[p.VariableDeclaration]}},a);return l=e.modifiedData,f.push(...e.errors,...zi(l)),{errors:f,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 f=Ad(l,this);return l=f.modifiedData,a.push(...f.errors),i.parent&&a.push(new oe({id:`${this.id}--${W.InvalidParentUpdate}`,code:W.InvalidParentUpdate,severity:Y.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,V.sessionAuthor,B().toISOString(),this,!0,"sync-dependents"))){const a=[],l=[],f=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),l.push(...v.added),f.push(...v.removed),e.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:g(a),added:g(l),removed:g(f),affected:g(e),self:this}}onDetachedDependencyRemoved(i,a,l){const f=[],e=[],y=[],v=[];if(a==="parent"){const{updated:T,added:A,removed:I}=this.remove({ignoreUpstream:!1},l);f.push(...T),e.push(...A),y.push(...I)}if(a==="var-declaration"){const{updated:T,added:A,removed:I}=this.remove({ignoreUpstream:!1},l);f.push(...T),e.push(...A),y.push(...I)}return{updated:g(f),added:g(e),removed:g(y),affected:g(v),self:this}}onDetachedDependencyRestored(i,a,l){const f=[],e=[],y=[],v=[];if(a==="parent"){const{updated:T,added:A,removed:I}=this.restore({},l);f.push(...T),e.push(...A),y.push(...I)}if(a==="var-declaration"){const{updated:T,added:A,removed:I}=this.restore({},l);f.push(...T),e.push(...A),y.push(...I)}return{updated:g(f),added:g(e),removed:g(y),affected:g(v),self:this}}unsubscribeFromDependencies(){var i,a,l,f,e,y,v;return(a=(i=this.parent)==null?void 0:i.unsubscribeDependents)==null||a.call(i,[{entity:this,field:"parent"}]),(e=(f=(l=this.declaration.dataType)==null?void 0:l.entity)==null?void 0:f.unsubscribeDependents)==null||e.call(f,[{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,f;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"parent"}]),(f=(l=(a=this.declaration.dataType)==null?void 0:a.entity)==null?void 0:l.subscribeDependents)==null||f.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=V.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 Ht(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=[],f=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),l.push(...y.added),f.push(...y.removed)}return{updated:g(a),added:g(l),removed:g(f),affected:g(e),self:this}}async restoreVersion(i){var v;const a=[],l=[],f=[],e=[];if(this.version===i)return{updated:g(a),added:g(l),removed:g(f),affected:g(e),self:this};if(!this.knownVersions){const T=new Map;for(const[A,I]of this.knownVersions||new Map){if(T.set(A,I),I.activeVersion=!1,I.knownVersions)for(const[O,L]of I.knownVersions)T.set(O,L);I.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 Ht(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:g(a),added:g(l),removed:g(f),affected:g(e),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,V.sessionAuthor,B().toISOString(),this,!0,P.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this))return S.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=X(i.parent),f=this.project.get(l),e=this.parent;if(e&&e.id!==(f==null?void 0:f.id)&&this.removeFromParent(a),f)this.setParent(f,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=X(i.readsValue),f=this.project.get(l),e=this.readsValue;e&&e.id!==(f==null?void 0:f.id)&&this.removeValueWriter(a),f&&this.setValueWriter(f,a)}if(i.declaration){const l=X(i.declaration),f=this.project.get(l);f&&this.setDeclaration(f)}return i.calledByEntry.forEach(l=>{const f=X(l),e=this.project.get(f);e&&(this.addEntryCaller(e,a),e.addCall(this,a))}),[...this.calledByEntry].forEach(l=>{i.calledByEntry.find(e=>X(e)===l.id)||(this.removeCaller(l,a),l.removeCall(this,a))}),i.calledBySuccess.forEach(l=>{const f=X(l),e=this.project.get(f);e&&(this.addSuccessCaller(e,a),e.addSuccessCall(this,a))}),[...this.calledBySuccess].forEach(l=>{i.calledBySuccess.find(e=>X(e)===l.id)||(this.removeCaller(l,a),l.removeCall(this,a))}),i.calledByError.forEach(l=>{const f=X(l),e=this.project.get(f);e&&(this.addErrorCaller(e,a),e.addErrorCall(this,a))}),[...this.calledBySuccess].forEach(l=>{i.calledBySuccess.find(e=>X(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=[],f=[];if(this.initialData.parent){const e=X(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=X(this.initialData.readsValue),y=this.project.get(e);y&&(this.setValueWriter(y,null),i.push(y))}if(this.initialData.declaration){const e=X(this.initialData.declaration),y=this.project.get(e);y&&(this.setDeclaration(y),i.push(y))}return this.initialData.calledByEntry.forEach(e=>{const y=X(e),v=this.project.get(y);v&&this.addEntryCaller(v,null)}),this.initialData.calledBySuccess.forEach(e=>{const y=X(e),v=this.project.get(y);v&&this.addSuccessCaller(v,null)}),this.initialData.calledByError.forEach(e=>{const y=X(e),v=this.project.get(y);v&&this.addErrorCaller(v,null)}),{updated:g(i),added:g(a),removed:g(l),affected:g(f),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new G(this.project,V.sessionAuthor,B().toISOString(),this,!0,P.AfterAllChildrenInitialized))){var $e;if(!this.checkCanEdit(this))return S.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=[],f=[],e=[];if(this.initialized=!0,!this.declaration.dataType||($e=this.declaration.dataType)!=null&&$e.inferred){const{added:Me,updated:Je,removed:je,affected:bt}=this.declaration.inferDataTypeAndSyncInstancesInputsAndOutputs(i);l.push(...Me),a.push(...Je),f.push(...je),e.push(...bt)}const{added:y,updated:v,removed:T,affected:A}=this.syncInputs(i);l.push(...y),a.push(...v),f.push(...T),e.push(...A);const{added:I,updated:O,removed:L,affected:M}=this.syncOutputs(i);l.push(...I),a.push(...O),f.push(...L),e.push(...M);const{added:j,updated:q,removed:Z,affected:H}=this.generateUnusedInternalCalls(i);l.push(...j),a.push(...q),f.push(...Z),e.push(...H);const{added:z,updated:ue,removed:fe,affected:ee}=this.removeUnrecognizedInputs(i);l.push(...z),a.push(...ue),f.push(...fe),e.push(...ee);const{added:ne,updated:me,removed:pe,affected:ae}=this.removeUnrecognizedOutputs(i);l.push(...ne),a.push(...me),f.push(...pe),e.push(...ae);const{added:he,updated:De,removed:He,affected:Fe}=this.removeUnrecognizedInternalCalls(i);return l.push(...he),a.push(...De),f.push(...He),e.push(...Fe),this.captureVersion(),i==null||i.attemptAutoclose(P.AfterAllChildrenInitialized,this.id),{updated:g(a),added:g(l),removed:g(f),affected:g(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new G(this.project,V.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){const a=[this],l=[],f=[],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:g(a),added:g(l),removed:g(f),affected:g(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,V.sessionAuthor,B().toISOString(),this,!0,"remove-variable-instance-internal-call"))){const l=this.internalCalls.findIndex(f=>f.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,V.sessionAuthor,B().toISOString(),this,!0,P.RemoveInput))){if(!this.checkCanEdit(this))return S.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(f=>f.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,V.sessionAuthor,B().toISOString(),this,!0,P.AddInput))){return this.checkCanEdit(this)?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):(S.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,V.sessionAuthor,B().toISOString(),this,!0,"add-output"))){return this.checkCanEdit(this)?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):(S.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,V.sessionAuthor,B().toISOString(),this,!0,"remove-output"))){if(!this.checkCanEdit(this))return S.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(f=>f.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,V.sessionAuthor,B().toISOString(),this,!0,P.AddSuccessCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.AddSuccessCaller,a)?(this.calledBySuccess.find(f=>f.id===i.id)||(this.calledBySuccess.push(i),a==null||a.add(this,K.Updated),l&&Ye(this,a)),a==null||a.attemptAutoclose(P.AddSuccessCaller,this.id),this):this}addErrorCaller(i,a=this.project.addChangeSet(new G(this.project,V.sessionAuthor,B().toISOString(),this,!0,P.AddErrorCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.AddErrorCaller,a)?(this.calledByError.find(f=>f.id===i.id)||(this.calledByError.push(i),a==null||a.add(this,K.Updated),l&&Ye(this,a)),a==null||a.attemptAutoclose(P.AddErrorCaller,this.id),this):this}addEntryCaller(i,a=this.project.addChangeSet(new G(this.project,V.sessionAuthor,B().toISOString(),this,!0,P.AddEntryCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.AddEntryCaller,a)?(this.calledByEntry.find(f=>f.id===i.id)||(this.calledByEntry.push(i),a==null||a.add(this,K.Updated),l&&Ye(this,a)),a==null||a.attemptAutoclose(P.AddEntryCaller,this.id),this):this}addErrorCall(i,a=this.project.addChangeSet(new G(this.project,V.sessionAuthor,B().toISOString(),this,!0,P.AddErrorCall)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.AddErrorCall,a)?(this.errorCalls.find(f=>f.id===i.id)||(this.errorCalls.push(i),l&&Ye(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,V.sessionAuthor,B().toISOString(),this,!0,P.AddSuccessCall)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.AddSuccessCall,a)?(this.successCalls.find(f=>f.id===i.id)||(this.successCalls.push(i),l&&Ye(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,V.sessionAuthor,B().toISOString(),this,!0,P.RemoveCall)),l=!1){if(!this.checkCanEditWithCounterpartAndSideEffects(this,i,P.RemoveCall,a))return this;const f=this.successCalls.findIndex(y=>y.id===i.id);f>-1&&(this.successCalls.splice(f,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&&Ye(this,a),a==null||a.attemptAutoclose(P.RemoveCall,this.id),this}removeCaller(i,a=this.project.addChangeSet(new G(this.project,V.sessionAuthor,B().toISOString(),this,!0,"remove-caller")),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.RemoveCaller,a)?(this.calledBySuccess=this.calledBySuccess.filter(f=>f.id!==i.id?!0:(a==null||a.add(this,K.Updated),a==null||a.add(f,K.Affected),!1)),this.calledByError=this.calledByError.filter(f=>f.id!==i.id?!0:(a==null||a.add(this,K.Updated),a==null||a.add(f,K.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(f=>f.id!==i.id?!0:(a==null||a.add(this,K.Updated),a==null||a.add(f,K.Affected),!1)),l&&Ye(this,a),a==null||a.attemptAutoclose(P.RemoveCaller,this.id),this):this}addValueReader(i,a=this.project.addChangeSet(new G(this.project,V.sessionAuthor,B().toISOString(),this,!0,P.AddValueReader))){return this.checkCanEditWithCounterpartAndSideEffects(this,i,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,V.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,V.sessionAuthor,B().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=se(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=se(this.initialData.declaration,this.project),this.declaration.initChildren(i);return yy.initWritesValues(this,this.parent),_d.initReadsValue(this),this.initialData.inputs.forEach(a=>{const l=se(a,this.project);return l.setParent(this,null),l.initChildren(i),this.addInput(l,null),l}),this.initialData.outputs.forEach(a=>{const l=se(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=se(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 f=fr(this,this.project);l.setParent(f,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=se(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 f=fr(this,this.project);l.setParent(f,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 f=this.project.findSubscribedInstanceFromReference(l);if(!f)return a;const e=f;return e.setParent(this,null),[...a,e]}else{const f=se(l,this.project);return f.setParent(this,null),f.initChildren(i),[...a,f]}},[]),this.initialData.error&&(this.error=se(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,V.sessionAuthor,B().toISOString(),this,!0,P.SetValueWriter))){return i&&!this.checkCanEditWithCounterpartAndSideEffects(this,i,P.SetValueWriter,a)?this:!i&&!this.checkCanEdit(this)?(S.warn(`[setValueWriter] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),a==null||a.attemptAutoclose(P.SetValueWriter,this.id),this):(this.readsValue!==i&&(this.readsValue=i,a==null||a.add(this,K.Updated)),a==null||a.attemptAutoclose(P.SetValueWriter,this.id),this)}removeValueWriter(i=this.project.addChangeSet(new G(this.project,V.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,V.sessionAuthor,B().toISOString(),this,!0,P.RemoveValueReader))){return this.checkCanEditWithCounterpartAndSideEffects(this,i,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,V.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const l=Xi(this,i),f=Yi(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),l.deleted===!0&&!e.deleted?a==null||a.add(this,K.Removed):l.deleted===!1&&e.deleted?a==null||a.add(this,K.Added):f&&(a==null||a.add(this,K.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ie,...a){return await Ht.repository.APILoad(this.id,...a),this}async APICreate(i=Ie,...a){return await Ht.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=Ie,...a){return await Ht.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=Ie,...a){return await Ht.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=Ie,...a){return await Ht.repository.APIClone(this.id,...a),this}async APILoadVersion(i=Ie,a,...l){return await Ht.repository.APILoadVersion(this.id,a,...l)}removeFromParent(i=this.project.addChangeSet(new G(this.project,V.sessionAuthor,B().toISOString(),this,!0,P.RemoveFromParent))){if(!this.checkCanEdit(this))return S.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=[],f=[],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:g(f),updated:g(a),removed:g(l),affected:g(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,V.sessionAuthor,B().toISOString(),this,!0,P.RemoveEntity))){var v;if(!this.checkCanDelete(this)||!this.checkCanEdit(this))return S.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:Si.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=[],f=[],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(f.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(T=>{const{updated:A,removed:I,added:O}=T.entity.onDetachedDependencyRemoved(this,T.field,a);l.push(...A),f.push(...I),e.push(...O)}),this.defaultValue){const{updated:T,removed:A}=this.defaultValue.remove({ignoreUpstream:!0},a);l.push(...T),f.push(...A)}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:A,removed:I}=T.remove({ignoreUpstream:!0},a);l.push(...A),f.push(...I)}),this.outputs.forEach(T=>{const{updated:A,removed:I}=T.remove({ignoreUpstream:!0},a);l.push(...A),f.push(...I)}),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:A,removed:I}=T.remove({ignoreUpstream:!0},a);l.push(...A),f.push(...I)}),!i){const T=this.removeFromParent(a);e.push(...T.added),l.push(...T.updated),f.push(...T.removed),y.push(...T.affected),this.calledBy.forEach(A=>{l.push(A),A.removeCall(this,a)})}return a==null||a.attemptAutoclose(P.RemoveEntity,this.id),{added:g(e),updated:g(l),removed:g(f),affected:g(y),self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,V.sessionAuthor,B().toISOString(),this,!0,P.RestoreEntity))){if(!this.checkCanEdit(this))return S.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=[],f=[],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:A}=y.entity.onDetachedDependencyRestored(this,y.field,i);l.push(...v),f.push(...T),a.push(...A)}),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:g(a),updated:g(l),removed:g(f),affected:g(e),self:this}}toFlat(i=new Set){var l,f;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)),...((f=this.readsValue)==null?void 0:f.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(f=>f.toFlatIds(i)),...this.successCalls.flatMap(f=>f.toFlatIds(i)),...this.errorCalls.flatMap(f=>f.toFlatIds(i)),...this.inputs.flatMap(f=>f.toFlatIds(i)),...this.outputs.flatMap(f=>f.toFlatIds(i)),...this.internalCalls.flatMap(f=>f.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,f;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:((f=this.error)==null?void 0:f.toJSON(i))||null,x:this.x,y:this.y})}toJSONClone(i=ke){var l,f,e,y,v,T,A,I;let a;return(l=i.seenEntityMaps)!=null&&l.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||or(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(f=i.seenEntities)!=null&&f.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:V.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:((A=this.readsValue)==null?void 0:A.toReference({seenEntityMaps:i.seenEntityMaps}))||null,writesValues:this.writesValues.map(O=>O.toJSONClone({...i,newId:null})),inputs:this.inputs.map(O=>O.toJSONClone({...i,newId:null})),outputs:this.outputs.map(O=>O.toJSONClone({...i,newId:null})),successCalls:this.successCalls.map(O=>O.toJSONClone({...i,newId:null})),errorCalls:this.errorCalls.map(O=>O.toJSONClone({...i,newId:null})),internalCalls:this.internalCalls.map(O=>this.calledBy.length||this.readsValue?O.toJSONClone({...i,newId:null}):O.toReference({seenEntityMaps:i.seenEntityMaps})),calledBySuccess:this.calledBySuccess.map(O=>O.toReference({seenEntityMaps:i.seenEntityMaps})),calledByError:this.calledByError.map(O=>O.toReference({seenEntityMaps:i.seenEntityMaps})),calledByEntry:this.calledByEntry.map(O=>O.toReference({seenEntityMaps:i.seenEntityMaps})),error:((I=this.error)==null?void 0:I.toJSONClone({...i,newId:null}))||null,parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps}),x:this.x,y:this.y})}toReference(i=ke){var l;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+V.UUID.uuid()+"--ref",type:p.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=ke){var l,f,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:((f=this.defaultValue)==null?void 0:f.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,f;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((l=this.defaultValue)==null?void 0:l.toFlatJSON(i))||[],...((f=this.declaration)==null?void 0:f.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,f,e;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((l=this.defaultValue)==null?void 0:l.toFlatGenerationTarget(i))||[],...((f=this.declaration)==null?void 0:f.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=Qq(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(f=>f.getErrors()),...this.internalCalls.flatMap(f=>f.getErrors()),...this.outputs.flatMap(f=>f.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,V.sessionAuthor,B().toISOString(),this,!0,"set-default-value"))){if(!this.checkCanEdit(this))return S.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,V.sessionAuthor,B().toISOString(),this,!0,P.CloneEntity)),a=null,l=null,f=!0){var M,j,q,Z;let e=lr(a,this);const y=this.toJSON(),v=l||V.UUID.uuid();y.inputs=[],y.id=v,y.version=V.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;const T=Ei(y,e);a?T.setParent(a,null):T.setParent(this.parent,null),f&&T.subscribe(),T.initChildren(i),i==null||i.add(T,K.Added);const A=(M=this.defaultValue)==null?void 0:M.clone(i,T,V.UUID.uuid(),f);T.defaultValue=A||null;const I=(j=this.inputs)==null?void 0:j.map(H=>H.clone(i,T,V.UUID.uuid(),f));T.inputs=I;const O=(q=this.outputs)==null?void 0:q.map(H=>H.clone(i,T,V.UUID.uuid(),f));T.outputs=O;const L=(Z=this.internalCalls)==null?void 0:Z.map(H=>H.clone(i,T,V.UUID.uuid(),f));return T.internalCalls=L,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,V.sessionAuthor,B().toISOString(),this,!0,P.RemoveUnrecognizedInputs))){if(!this.checkCanEdit(this))return S.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=[],f=[],e=[];return this.declaration.dataType&&!this.declaration.dataType.isObject()?[...this.inputs].forEach(y=>{const v=y.remove({ignoreUpstream:!1},i);f.push(...v.removed),a.push(...v.updated)}):this.declaration.dataType&&this.declaration.dataType.hasStrictObjectStructure()&&[...this.inputs].forEach(y=>{var T;if(!y.declaration){const A=y.remove({ignoreUpstream:!1},i);f.push(...A.removed),a.push(...A.updated);return}if(![...((T=this.declaration.dataType)==null?void 0:T.entity).allProperties].find(A=>y.declaration===A)){const A=y.remove({ignoreUpstream:!1},i);f.push(...A.removed),a.push(...A.updated)}}),i==null||i.attemptAutoclose(P.RemoveUnrecognizedInputs,this.id),{updated:g(a),added:g(l),removed:g(f),affected:g(e),self:this}}removeUnrecognizedOutputs(i=this.project.addChangeSet(new G(this.project,V.sessionAuthor,B().toISOString(),this,!0,"remove-unrecognized-variable-instance-outputs"))){if(!this.checkCanEdit(this))return S.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=[],f=[],e=[];return this.declaration.dataType&&!this.declaration.dataType.isObject()?[...this.outputs].forEach(y=>{const v=y.remove({ignoreUpstream:!1},i);f.push(...v.removed),a.push(...v.updated)}):this.declaration.dataType&&this.declaration.dataType.hasStrictObjectStructure()&&[...this.outputs].forEach(y=>{var T;if(!y.declaration){const A=y.remove({ignoreUpstream:!1},i);f.push(...A.removed),a.push(...A.updated);return}if(![...((T=this.declaration.dataType)==null?void 0:T.entity).allProperties].find(A=>y.declaration===A)){const A=y.remove({ignoreUpstream:!1},i);f.push(...A.removed),a.push(...A.updated)}}),i==null||i.attemptAutoclose("remove-unrecognized-variable-instance-outputs",this.id),{updated:g(a),added:g(l),removed:g(f),affected:g(e),self:this}}removeUnrecognizedInternalCalls(i=this.project.addChangeSet(new G(this.project,V.sessionAuthor,B().toISOString(),this,!0,"remove-unrecognized-variable-declaration-internal-calls"))){const a=[],l=[],f=[],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);f.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(A=>!v.some(I=>{var O,L;return I.id!==A.id&&(((O=I.implements)==null?void 0:O.id)===A.id||((L=I.extends)==null?void 0:L.id)===A.id)})&&!A.deleted);[...this.internalCalls].forEach(A=>{if(!A.declaration){const O=A.remove({ignoreUpstream:!1},i);f.push(...O.removed),a.push(...O.updated);return}if(!T.find(O=>A.declaration===O)){const O=A.remove({ignoreUpstream:!1},i);f.push(...O.removed),a.push(...O.updated);return}})}return this.internalCalls.filter((v,T)=>{const A=this.internalCalls.findIndex(O=>O.declaration===v.declaration&&O!==v);if(A===-1)return!1;const I=this.internalCalls[A];return B(I==null?void 0:I.createdAt).isSame(B(v.createdAt))?T>A:!!B(I==null?void 0:I.createdAt).isAfter(v.createdAt)}).forEach(v=>{const T=v.remove({ignoreUpstream:!1},i);f.push(...T.removed),a.push(...T.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-variable-declaration-internal-calls",this.id),{updated:g(a),added:g(l),removed:g(f),affected:g(e),self:this}}syncInputs(i=this.project.addChangeSet(new G(this.project,V.sessionAuthor,B().toISOString(),this,!0,"sync-variable-instance-inputs"))){const a=[],l=[],f=[],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(I=>!I.getDataType(i)).forEach(I=>{const O=this.inputs.find(j=>Q(j,this.project)===Q(I,this.project));if(!O)return;const L=this.declaration.getMasterInputWithValueWritterFromAllInstances(O);if(!L)return;const M=Ra(L);I.setDataType(M,i),O.setDeclaration(I,i)}),y.filter(I=>!this.inputs.find(O=>{var L;return((L=O.declaration)==null?void 0:L.id)===I.id})).forEach(I=>{const O={id:V.UUID.uuid(),version:V.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:V.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.InputMap,parentRelationType:null,parent:this.toReference(),name:null,description:null,codeName:null,declaration:I,defaultValue:null,index:I.index,readsValue:null},L=se(O,this.project);return L.setParent(this,i),L.initChildren(i),i==null||i.add(L,K.Added),this.addInput(L,i),L}),this.inputs.filter(I=>!I.declaration).forEach(I=>{const O=y.find(L=>Q(L,this.project)===Q(I,this.project));O&&I.setDeclaration(O,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:g(a),updated:g(l),removed:g(f),affected:g(e),self:this}}syncOutputs(i=this.project.addChangeSet(new G(this.project,V.sessionAuthor,B().toISOString(),this,!0,P.SyncOutputs))){if(!this.checkCanEdit(this))return S.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=[],f=[],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(A=>A.declaration===T)).map(T=>{const A={id:V.UUID.uuid(),version:V.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:V.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.OutputMap,parent:this.toReference(),declaration:T,index:T.index,writesValues:[]},I=se(A,this.project);return I.setParent(this,i),I.initChildren(i),i==null||i.add(I,K.Added),this.addOutput(I,i),I});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:g(a),updated:g(l),removed:g(f),affected:g(e),self:this}}generateUnusedInternalCalls(i=this.project.addChangeSet(new G(this.project,V.sessionAuthor,B().toISOString(),this,!0,"generate-unused-internal-calls"))){const a=[],l=[],f=[],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(A=>!y.some(I=>{var O,L;return I.id!==A.id&&(((O=I.implements)==null?void 0:O.id)===A.id||((L=I.extends)==null?void 0:L.id)===A.id)})&&!A.deleted).filter(A=>!this.internalCalls.find(O=>{var M,j,q,Z,H;return(((M=O.declaration)==null?void 0:M.id)||((q=(j=O.initialData)==null?void 0:j.declaration)==null?void 0:q.entityId)||((H=(Z=O.initialData)==null?void 0:Z.declaration)==null?void 0:H.id))===A.id})).forEach(A=>{const I=this.internalCalls.find(O=>{const L=gd(O.declaration),M=gd(A);return L.id===M.id});if(I)I.setDeclaration(A),I.subscribeToDependencies();else{const O=A.createInternalCall(i,this);i==null||i.add(O,K.Added),this.addInternalCall(O)}})}}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:g(a),updated:g(l),removed:g(f),affected:g(e),self:this}}getDataType(i=this.project.addChangeSet(new G(this.project,V.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)}};_(Ht,"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}),_(Ht,"type",p.VariableInstance),_(Ht,"USER_MANAGED_PARENT_TYPES",[...qi,p.Project]),_(Ht,"PARENT_TYPES",[...Ht.USER_MANAGED_PARENT_TYPES]),_(Ht,"MUTABLE_BASE_PROPERTIES",["catchesError"]),_(Ht,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),_(Ht,"BASE_PROPERTIES",[...Ht.MUTABLE_BASE_PROPERTIES,...Ht.INMUTABLE_BASE_PROPERTIES]),_(Ht,"MUTABLE_META_PROPERTIES",[...Ht.MUTABLE_BASE_PROPERTIES,"x","y"]),_(Ht,"INMUTABLE_META_PROPERTIES",[...Ht.INMUTABLE_BASE_PROPERTIES]),_(Ht,"META_PROPERTIES",[...Ht.MUTABLE_META_PROPERTIES,...Ht.INMUTABLE_META_PROPERTIES]),_(Ht,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","readsValue"]),_(Ht,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),_(Ht,"UPSTREAM_PROPERTIES",[...Ht.MUTABLE_UPSTREAM_PROPERTIES,...Ht.INMUTABLE_UPSTREAM_PROPERTIES]),_(Ht,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues","inputs","outputs","successCalls","errorCalls","internalCalls"]),_(Ht,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),_(Ht,"DOWNSTREAM_PROPERTIES",[...Ht.MUTABLE_DOWNSTREAM_PROPERTIES,...Ht.INMUTABLE_DOWNSTREAM_PROPERTIES]),_(Ht,"PROPERTIES",[...Ht.META_PROPERTIES,...Ht.UPSTREAM_PROPERTIES,...Ht.DOWNSTREAM_PROPERTIES]);let so=Ht;var e9=(d=>(d.Parent="variable-declaration-parent",d.DataTypeEntity="variable-declaration-data-type-entity",d.DataType="variable-declaration-data-type",d))(e9||{});const St=class St extends nr{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:V.UUID.uuid(),version:V.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||V.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 I=X(i.parent);l=a.get(I)}const f=i.calledByEntry.map(I=>{const O=X(I);return a.get(O)}),e=i.calledBySuccess.map(I=>{const O=X(I);return a.get(O)}),y=i.calledByError.map(I=>{const O=X(I);return a.get(O)});let v=null;if(i.readsValue){const I=X(i.readsValue);v=a.get(I)}const T={id:i.id,version:V.UUID.uuid(),createdAt:B().toISOString(),author:V.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:f,calledBySuccess:e,calledByError:y,dataType:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:v,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:l},A=se(T,a);return A.setParent(l,null),A}static validateGenerationTarget(i,a){let l=JSON.parse(JSON.stringify(i));const f=[],e=Or(l,{parent:{list:!1,types:[...qi,p.Project],optional:!0}},a);l=e.modifiedData;const y=t1(l,a);return f.push(...e.errors,...y,...zi(l)),{errors:f,modifiedData:l}}get variableInstances(){const i=[];return Object.values(this.detachedDependents).forEach(a=>{a.field===KA.VarDeclaration&&!i.includes(a.entity)&&i.push(a.entity)}),i}validateGeneratedUpdate(i){const a=[];let l=JSON.parse(JSON.stringify(i));const f=Ad(l,this);return l=f.modifiedData,a.push(...f.errors),i.parent&&a.push(new oe({id:`${this.id}--${W.InvalidParentUpdate}`,code:W.InvalidParentUpdate,severity:Y.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.
|
|
3
|
+
"version": "0.0.6541",
|
|
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",
|