@elyx-code/project-logic-tree 0.0.6487 → 0.0.6488

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.js CHANGED
@@ -51268,16 +51268,16 @@ class yEt extends tt {
51268
51268
  },
51269
51269
  main: async (r, a) => {
51270
51270
  try {
51271
- const o = a.map(
51272
- (v) => {
51273
- var E, w;
51274
- return ((E = v.value) == null ? void 0 : E.valueAsType) || ((w = v.value) == null ? void 0 : w.value);
51271
+ const e = a.map(
51272
+ (y) => {
51273
+ var v, E;
51274
+ return ((v = y.value) == null ? void 0 : v.valueAsType) || ((E = y.value) == null ? void 0 : E.value);
51275
51275
  }
51276
- ), [p, e] = o, y = p - e;
51276
+ ).reduce((y, v) => y - v, 0);
51277
51277
  return {
51278
51278
  value: q.Success,
51279
51279
  error: null,
51280
- results: [y]
51280
+ results: [e]
51281
51281
  };
51282
51282
  } catch (o) {
51283
51283
  return {
@@ -81,7 +81,7 @@ If an entity is called by another, they must be in the same scope, which means t
81
81
  `)}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,...r){const a=new this(u);return r.forEach(o=>a.set(o)),a}static accessor(u){const a=(this[Sx]=this[Sx]={accessors:{}}).accessors,o=this.prototype;function p(e){const y=Oc(e);a[y]||(Eme(o,e),a[y]=!0)}return Te.isArray(u)?u.forEach(p):p(u),this}}Iy.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Te.reduceDescriptors(Iy.prototype,({value:d},u)=>{let r=u[0].toUpperCase()+u.slice(1);return{get:()=>d,set(a){this[r]=a}}}),Te.freezeMethods(Iy);const yn=Iy;function kI(d,u){const r=this||SI,a=u||r,o=yn.from(a.headers);let p=a.data;return Te.forEach(d,function(y){p=y.call(r,p,o.normalize(),u?u.status:void 0)}),o.normalize(),p}function Kx(d){return!!(d&&d.__CANCEL__)}function Nd(d,u,r){Ot.call(this,d??"canceled",Ot.ERR_CANCELED,u,r),this.name="CanceledError"}Te.inherits(Nd,Ot,{__CANCEL__:!0});function kx(d,u,r){const a=r.config.validateStatus;!r.status||!a||a(r.status)?d(r):u(new Ot("Request failed with status code "+r.status,[Ot.ERR_BAD_REQUEST,Ot.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Tme(d){const u=/^([-+\w]{1,25})(:?\/\/|:)/.exec(d);return u&&u[1]||""}function Ime(d,u){d=d||10;const r=new Array(d),a=new Array(d);let o=0,p=0,e;return u=u!==void 0?u:1e3,function(v){const E=Date.now(),w=a[p];e||(e=E),r[o]=v,a[o]=E;let A=p,$=0;for(;A!==o;)$+=r[A++],A=A%d;if(o=(o+1)%d,o===p&&(p=(p+1)%d),E-e<u)return;const V=w&&E-w;return V?Math.round($*1e3/V):void 0}}function Ame(d,u){let r=0,a=1e3/u,o,p;const e=(E,w=Date.now())=>{r=w,o=null,p&&(clearTimeout(p),p=null),d.apply(null,E)};return[(...E)=>{const w=Date.now(),A=w-r;A>=a?e(E,w):(o=E,p||(p=setTimeout(()=>{p=null,e(o)},a-A)))},()=>o&&e(o)]}const Ay=(d,u,r=3)=>{let a=0;const o=Ime(50,250);return Ame(p=>{const e=p.loaded,y=p.lengthComputable?p.total:void 0,v=e-a,E=o(v),w=e<=y;a=e;const A={loaded:e,total:y,progress:y?e/y:void 0,bytes:v,rate:E||void 0,estimated:E&&y&&w?(y-e)/E:void 0,event:p,lengthComputable:y!=null,[u?"download":"upload"]:!0};d(A)},r)},qx=(d,u)=>{const r=d!=null;return[a=>u[0]({lengthComputable:r,total:d,loaded:a}),u[1]]},Hx=d=>(...u)=>Te.asap(()=>d(...u)),bme=Fi.hasStandardBrowserEnv?((d,u)=>r=>(r=new URL(r,Fi.origin),d.protocol===r.protocol&&d.host===r.host&&(u||d.port===r.port)))(new URL(Fi.origin),Fi.navigator&&/(msie|trident)/i.test(Fi.navigator.userAgent)):()=>!0,wme=Fi.hasStandardBrowserEnv?{write(d,u,r,a,o,p){const e=[d+"="+encodeURIComponent(u)];Te.isNumber(r)&&e.push("expires="+new Date(r).toGMTString()),Te.isString(a)&&e.push("path="+a),Te.isString(o)&&e.push("domain="+o),p===!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 Rme(d){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(d)}function gme(d,u){return u?d.replace(/\/?\/$/,"")+"/"+u.replace(/^\/+/,""):d}function Zx(d,u,r){let a=!Rme(u);return d&&(a||r==!1)?gme(d,u):u}const Jx=d=>d instanceof yn?{...d}:d;function fl(d,u){u=u||{};const r={};function a(E,w,A,$){return Te.isPlainObject(E)&&Te.isPlainObject(w)?Te.merge.call({caseless:$},E,w):Te.isPlainObject(w)?Te.merge({},w):Te.isArray(w)?w.slice():w}function o(E,w,A,$){if(Te.isUndefined(w)){if(!Te.isUndefined(E))return a(void 0,E,A,$)}else return a(E,w,A,$)}function p(E,w){if(!Te.isUndefined(w))return a(void 0,w)}function e(E,w){if(Te.isUndefined(w)){if(!Te.isUndefined(E))return a(void 0,E)}else return a(void 0,w)}function y(E,w,A){if(A in u)return a(E,w);if(A in d)return a(void 0,E)}const v={url:p,method:p,data:p,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:(E,w,A)=>o(Jx(E),Jx(w),A,!0)};return Te.forEach(Object.keys(Object.assign({},d,u)),function(w){const A=v[w]||o,$=A(d[w],u[w],w);Te.isUndefined($)&&A!==y||(r[w]=$)}),r}const Wx=d=>{const u=fl({},d);let{data:r,withXSRFToken:a,xsrfHeaderName:o,xsrfCookieName:p,headers:e,auth:y}=u;u.headers=e=yn.from(e),u.url=xx(Zx(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(Te.isFormData(r)){if(Fi.hasStandardBrowserEnv||Fi.hasStandardBrowserWebWorkerEnv)e.setContentType(void 0);else if((v=e.getContentType())!==!1){const[E,...w]=v?v.split(";").map(A=>A.trim()).filter(Boolean):[];e.setContentType([E||"multipart/form-data",...w].join("; "))}}if(Fi.hasStandardBrowserEnv&&(a&&Te.isFunction(a)&&(a=a(u)),a||a!==!1&&bme(u.url))){const E=o&&p&&wme.read(p);E&&e.set(o,E)}return u},_me=typeof XMLHttpRequest<"u"&&function(d){return new Promise(function(r,a){const o=Wx(d);let p=o.data;const e=yn.from(o.headers).normalize();let{responseType:y,onUploadProgress:v,onDownloadProgress:E}=o,w,A,$,V,B;function F(){V&&V(),B&&B(),o.cancelToken&&o.cancelToken.unsubscribe(w),o.signal&&o.signal.removeEventListener("abort",w)}let K=new XMLHttpRequest;K.open(o.method.toUpperCase(),o.url,!0),K.timeout=o.timeout;function q(){if(!K)return;const W=yn.from("getAllResponseHeaders"in K&&K.getAllResponseHeaders()),Q={data:!y||y==="text"||y==="json"?K.responseText:K.response,status:K.status,statusText:K.statusText,headers:W,config:d,request:K};kx(function(X){r(X),F()},function(X){a(X),F()},Q),K=null}"onloadend"in K?K.onloadend=q:K.onreadystatechange=function(){!K||K.readyState!==4||K.status===0&&!(K.responseURL&&K.responseURL.indexOf("file:")===0)||setTimeout(q)},K.onabort=function(){K&&(a(new Ot("Request aborted",Ot.ECONNABORTED,d,K)),K=null)},K.onerror=function(){a(new Ot("Network Error",Ot.ERR_NETWORK,d,K)),K=null},K.ontimeout=function(){let de=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const Q=o.transitional||Gx;o.timeoutErrorMessage&&(de=o.timeoutErrorMessage),a(new Ot(de,Q.clarifyTimeoutError?Ot.ETIMEDOUT:Ot.ECONNABORTED,d,K)),K=null},p===void 0&&e.setContentType(null),"setRequestHeader"in K&&Te.forEach(e.toJSON(),function(de,Q){K.setRequestHeader(Q,de)}),Te.isUndefined(o.withCredentials)||(K.withCredentials=!!o.withCredentials),y&&y!=="json"&&(K.responseType=o.responseType),E&&([$,B]=Ay(E,!0),K.addEventListener("progress",$)),v&&K.upload&&([A,V]=Ay(v),K.upload.addEventListener("progress",A),K.upload.addEventListener("loadend",V)),(o.cancelToken||o.signal)&&(w=W=>{K&&(a(!W||W.type?new Nd(null,d,K):W),K.abort(),K=null)},o.cancelToken&&o.cancelToken.subscribe(w),o.signal&&(o.signal.aborted?w():o.signal.addEventListener("abort",w)));const ie=Tme(o.url);if(ie&&Fi.protocols.indexOf(ie)===-1){a(new Ot("Unsupported protocol "+ie+":",Ot.ERR_BAD_REQUEST,d));return}K.send(p||null)})},Dme=(d,u)=>{const{length:r}=d=d?d.filter(Boolean):[];if(u||r){let a=new AbortController,o;const p=function(E){if(!o){o=!0,y();const w=E instanceof Error?E:this.reason;a.abort(w instanceof Ot?w:new Nd(w instanceof Error?w.message:w))}};let e=u&&setTimeout(()=>{e=null,p(new Ot(`timeout ${u} of ms exceeded`,Ot.ETIMEDOUT))},u);const y=()=>{d&&(e&&clearTimeout(e),e=null,d.forEach(E=>{E.unsubscribe?E.unsubscribe(p):E.removeEventListener("abort",p)}),d=null)};d.forEach(E=>E.addEventListener("abort",p));const{signal:v}=a;return v.unsubscribe=()=>Te.asap(y),v}},Ome=function*(d,u){let r=d.byteLength;if(!u||r<u){yield d;return}let a=0,o;for(;a<r;)o=a+u,yield d.slice(a,o),a=o},Cme=async function*(d,u){for await(const r of $me(d))yield*Ome(r,u)},$me=async function*(d){if(d[Symbol.asyncIterator]){yield*d;return}const u=d.getReader();try{for(;;){const{done:r,value:a}=await u.read();if(r)break;yield a}}finally{await u.cancel()}},Yx=(d,u,r,a)=>{const o=Cme(d,u);let p=0,e,y=v=>{e||(e=!0,a&&a(v))};return new ReadableStream({async pull(v){try{const{done:E,value:w}=await o.next();if(E){y(),v.close();return}let A=w.byteLength;if(r){let $=p+=A;r($)}v.enqueue(new Uint8Array(w))}catch(E){throw y(E),E}},cancel(v){return y(v),o.return()}},{highWaterMark:2})},by=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",zx=by&&typeof ReadableStream=="function",Pme=by&&(typeof TextEncoder=="function"?(d=>u=>d.encode(u))(new TextEncoder):async d=>new Uint8Array(await new Response(d).arrayBuffer())),Xx=(d,...u)=>{try{return!!d(...u)}catch{return!1}},Nme=zx&&Xx(()=>{let d=!1;const u=new Request(Fi.origin,{body:new ReadableStream,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!u}),Qx=64*1024,qI=zx&&Xx(()=>Te.isReadableStream(new Response("").body)),wy={stream:qI&&(d=>d.body)};by&&(d=>{["text","arrayBuffer","blob","formData","stream"].forEach(u=>{!wy[u]&&(wy[u]=Te.isFunction(d[u])?r=>r[u]():(r,a)=>{throw new Ot(`Response type '${u}' is not supported`,Ot.ERR_NOT_SUPPORT,a)})})})(new Response);const Vme=async d=>{if(d==null)return 0;if(Te.isBlob(d))return d.size;if(Te.isSpecCompliantForm(d))return(await new Request(Fi.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(Te.isArrayBufferView(d)||Te.isArrayBuffer(d))return d.byteLength;if(Te.isURLSearchParams(d)&&(d=d+""),Te.isString(d))return(await Pme(d)).byteLength},Lme=async(d,u)=>{const r=Te.toFiniteNumber(d.getContentLength());return r??Vme(u)},HI={http:eme,xhr:_me,fetch:by&&(async d=>{let{url:u,method:r,data:a,signal:o,cancelToken:p,timeout:e,onDownloadProgress:y,onUploadProgress:v,responseType:E,headers:w,withCredentials:A="same-origin",fetchOptions:$}=Wx(d);E=E?(E+"").toLowerCase():"text";let V=Dme([o,p&&p.toAbortSignal()],e),B;const F=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let K;try{if(v&&Nme&&r!=="get"&&r!=="head"&&(K=await Lme(w,a))!==0){let Q=new Request(u,{method:"POST",body:a,duplex:"half"}),ce;if(Te.isFormData(a)&&(ce=Q.headers.get("content-type"))&&w.setContentType(ce),Q.body){const[X,z]=qx(K,Ay(Hx(v)));a=Yx(Q.body,Qx,X,z)}}Te.isString(A)||(A=A?"include":"omit");const q="credentials"in Request.prototype;B=new Request(u,{...$,signal:V,method:r.toUpperCase(),headers:w.normalize().toJSON(),body:a,duplex:"half",credentials:q?A:void 0});let ie=await fetch(B);const W=qI&&(E==="stream"||E==="response");if(qI&&(y||W&&F)){const Q={};["status","statusText","headers"].forEach(pe=>{Q[pe]=ie[pe]});const ce=Te.toFiniteNumber(ie.headers.get("content-length")),[X,z]=y&&qx(ce,Ay(Hx(y),!0))||[];ie=new Response(Yx(ie.body,Qx,X,()=>{z&&z(),F&&F()}),Q)}E=E||"text";let de=await wy[Te.findKey(wy,E)||"text"](ie,d);return!W&&F&&F(),await new Promise((Q,ce)=>{kx(Q,ce,{data:de,headers:yn.from(ie.headers),status:ie.status,statusText:ie.statusText,config:d,request:B})})}catch(q){throw F&&F(),q&&q.name==="TypeError"&&/Load failed|fetch/i.test(q.message)?Object.assign(new Ot("Network Error",Ot.ERR_NETWORK,d,B),{cause:q.cause||q}):Ot.from(q,q&&q.code,d,B)}})};Te.forEach(HI,(d,u)=>{if(d){try{Object.defineProperty(d,"name",{value:u})}catch{}Object.defineProperty(d,"adapterName",{value:u})}});const ej=d=>`- ${d}`,Mme=d=>Te.isFunction(d)||d===null||d===!1,tj={getAdapter:d=>{d=Te.isArray(d)?d:[d];const{length:u}=d;let r,a;const o={};for(let p=0;p<u;p++){r=d[p];let e;if(a=r,!Mme(r)&&(a=HI[(e=String(r)).toLowerCase()],a===void 0))throw new Ot(`Unknown adapter '${e}'`);if(a)break;o[e||"#"+p]=a}if(!a){const p=Object.entries(o).map(([y,v])=>`adapter ${y} `+(v===!1?"is not supported by the environment":"is not available in the build"));let e=u?p.length>1?`since :
82
82
  `+p.map(ej).join(`
83
83
  `):" "+ej(p[0]):"as no adapter specified";throw new Ot("There is no suitable adapter to dispatch the request "+e,"ERR_NOT_SUPPORT")}return a},adapters:HI};function ZI(d){if(d.cancelToken&&d.cancelToken.throwIfRequested(),d.signal&&d.signal.aborted)throw new Nd(null,d)}function rj(d){return ZI(d),d.headers=yn.from(d.headers),d.data=kI.call(d,d.transformRequest),["post","put","patch"].indexOf(d.method)!==-1&&d.headers.setContentType("application/x-www-form-urlencoded",!1),tj.getAdapter(d.adapter||SI.adapter)(d).then(function(a){return ZI(d),a.data=kI.call(d,d.transformResponse,a),a.headers=yn.from(a.headers),a},function(a){return Kx(a)||(ZI(d),a&&a.response&&(a.response.data=kI.call(d,d.transformResponse,a.response),a.response.headers=yn.from(a.response.headers))),Promise.reject(a)})}const ij="1.9.0",Ry={};["object","boolean","number","function","string","symbol"].forEach((d,u)=>{Ry[d]=function(a){return typeof a===d||"a"+(u<1?"n ":" ")+d}});const sj={};Ry.transitional=function(u,r,a){function o(p,e){return"[Axios v"+ij+"] Transitional option '"+p+"'"+e+(a?". "+a:"")}return(p,e,y)=>{if(u===!1)throw new Ot(o(e," has been removed"+(r?" in "+r:"")),Ot.ERR_DEPRECATED);return r&&!sj[e]&&(sj[e]=!0,console.warn(o(e," has been deprecated since v"+r+" and will be removed in the near future"))),u?u(p,e,y):!0}},Ry.spelling=function(u){return(r,a)=>(console.warn(`${a} is likely a misspelling of ${u}`),!0)};function Bme(d,u,r){if(typeof d!="object")throw new Ot("options must be an object",Ot.ERR_BAD_OPTION_VALUE);const a=Object.keys(d);let o=a.length;for(;o-- >0;){const p=a[o],e=u[p];if(e){const y=d[p],v=y===void 0||e(y,p,d);if(v!==!0)throw new Ot("option "+p+" must be "+v,Ot.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Ot("Unknown option "+p,Ot.ERR_BAD_OPTION)}}const gy={assertOptions:Bme,validators:Ry},Hn=gy.validators;class _y{constructor(u){this.defaults=u||{},this.interceptors={request:new jx,response:new jx}}async request(u,r){try{return await this._request(u,r)}catch(a){if(a instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const p=o.stack?o.stack.replace(/^.+\n/,""):"";try{a.stack?p&&!String(a.stack).endsWith(p.replace(/^.+\n.+\n/,""))&&(a.stack+=`
84
- `+p):a.stack=p}catch{}}throw a}}_request(u,r){typeof u=="string"?(r=r||{},r.url=u):r=u||{},r=fl(this.defaults,r);const{transitional:a,paramsSerializer:o,headers:p}=r;a!==void 0&&gy.assertOptions(a,{silentJSONParsing:Hn.transitional(Hn.boolean),forcedJSONParsing:Hn.transitional(Hn.boolean),clarifyTimeoutError:Hn.transitional(Hn.boolean)},!1),o!=null&&(Te.isFunction(o)?r.paramsSerializer={serialize:o}:gy.assertOptions(o,{encode:Hn.function,serialize:Hn.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),gy.assertOptions(r,{baseUrl:Hn.spelling("baseURL"),withXsrfToken:Hn.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let e=p&&Te.merge(p.common,p[r.method]);p&&Te.forEach(["delete","get","head","post","put","patch","common"],B=>{delete p[B]}),r.headers=yn.concat(e,p);const y=[];let v=!0;this.interceptors.request.forEach(function(F){typeof F.runWhen=="function"&&F.runWhen(r)===!1||(v=v&&F.synchronous,y.unshift(F.fulfilled,F.rejected))});const E=[];this.interceptors.response.forEach(function(F){E.push(F.fulfilled,F.rejected)});let w,A=0,$;if(!v){const B=[rj.bind(this),void 0];for(B.unshift.apply(B,y),B.push.apply(B,E),$=B.length,w=Promise.resolve(r);A<$;)w=w.then(B[A++],B[A++]);return w}$=y.length;let V=r;for(A=0;A<$;){const B=y[A++],F=y[A++];try{V=B(V)}catch(K){F.call(this,K);break}}try{w=rj.call(this,V)}catch(B){return Promise.reject(B)}for(A=0,$=E.length;A<$;)w=w.then(E[A++],E[A++]);return w}getUri(u){u=fl(this.defaults,u);const r=Zx(u.baseURL,u.url,u.allowAbsoluteUrls);return xx(r,u.params,u.paramsSerializer)}}Te.forEach(["delete","get","head","options"],function(u){_y.prototype[u]=function(r,a){return this.request(fl(a||{},{method:u,url:r,data:(a||{}).data}))}}),Te.forEach(["post","put","patch"],function(u){function r(a){return function(p,e,y){return this.request(fl(y||{},{method:u,headers:a?{"Content-Type":"multipart/form-data"}:{},url:p,data:e}))}}_y.prototype[u]=r(),_y.prototype[u+"Form"]=r(!0)});const Dy=_y;class JI{constructor(u){if(typeof u!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(p){r=p});const a=this;this.promise.then(o=>{if(!a._listeners)return;let p=a._listeners.length;for(;p-- >0;)a._listeners[p](o);a._listeners=null}),this.promise.then=o=>{let p;const e=new Promise(y=>{a.subscribe(y),p=y}).then(o);return e.cancel=function(){a.unsubscribe(p)},e},u(function(p,e,y){a.reason||(a.reason=new Nd(p,e,y),r(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 r=this._listeners.indexOf(u);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const u=new AbortController,r=a=>{u.abort(a)};return this.subscribe(r),u.signal.unsubscribe=()=>this.unsubscribe(r),u.signal}static source(){let u;return{token:new JI(function(o){u=o}),cancel:u}}}const Ume=JI;function xme(d){return function(r){return d.apply(null,r)}}function jme(d){return Te.isObject(d)&&d.isAxiosError===!0}const WI={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(WI).forEach(([d,u])=>{WI[u]=d});const Gme=WI;function nj(d){const u=new Dy(d),r=wx(Dy.prototype.request,u);return Te.extend(r,Dy.prototype,u,{allOwnKeys:!0}),Te.extend(r,u,null,{allOwnKeys:!0}),r.create=function(o){return nj(fl(d,o))},r}const di=nj(SI);di.Axios=Dy,di.CanceledError=Nd,di.CancelToken=Ume,di.isCancel=Kx,di.VERSION=ij,di.toFormData=Ey,di.AxiosError=Ot,di.Cancel=di.CanceledError,di.all=function(u){return Promise.all(u)},di.spread=xme,di.isAxiosError=jme,di.mergeConfig=fl,di.AxiosHeaders=yn,di.formToJSON=d=>Fx(Te.isHTMLForm(d)?new FormData(d):d),di.getAdapter=tj.getAdapter,di.HttpStatusCode=Gme,di.default=di;const Fme=di;class aj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ht.Addition);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const e=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)}).reduce((y,v)=>y+v,0);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class oj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ht.Subtraction);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),[p,e]=o,y=p-e;return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class lj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ht.Multiplication);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const e=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)}).reduce((y,v)=>y*v,1);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class dj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ht.Division);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),[p,e]=o;if(e===0)throw new Error("Division by zero is not allowed");const y=p/e;return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class uj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ht.Remainder);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),[p,e]=o;if(e===0)throw new Error("Division by zero is not allowed");const y=p%e;return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class cj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ht.Exponentiation);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),[p,e]=o,y=Math.pow(p,e);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class pj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateRandomInteger);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1],y=uye(p,e);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class fj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateRandomFloat);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=Tx();return{value:H.Success,error:null,results:[o]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class hj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateRandomHexadecimal);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0],e=Ix(p);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class yj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateRandomBase62);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0],e=Ax(p);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class mj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateRandomBase64);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0],e=pye(p);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class vj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateRandomAlphanumeric);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0],e=fye(p);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Ej extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateIdentifier);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1],y=bx(p,e);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Tj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateRandomUUIDv4);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=cl();return{value:H.Success,error:null,results:[o]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Ij extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{Me.log("Initializing Random Generate Short Identifier Module");const a=r.find(o=>o.contextType===be.Logic);if(a){Me.log("Project state found, setting up operation");const o=a.get(_e.GenerateShortIdentifier);o?(Me.log("Operation found, setting autoexecutable and implementation"),o.autoexecutable=!0,o.implementation=this.module.main):Me.warn("Operation generate-short-identifier not found in project state")}else Me.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(r,a)=>{try{const o=hye();return{value:H.Success,error:null,results:[o]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Aj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateHexadecimalToken);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=yye();return{value:H.Success,error:null,results:[o]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class bj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.Join);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],y=o.slice(1).join(p);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class wj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT,version:"1.0.0",description:"String split operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.Split);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1],y=p.split(e);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Rj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST,version:"1.0.0",description:"String delete last operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.DeleteLast);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const e=p.slice(0,-1);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class gj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST,version:"1.0.0",description:"String delete first operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.DeleteFirst);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const e=p.slice(1);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class _j extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.Reverse);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const e=p.split("").reverse().join("");return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Dj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.ToLowerCase);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const e=p.toLowerCase();return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Oj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.ToUpperCase);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const e=p.toUpperCase();return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Cj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.DeleteIndex);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};if(e<0||e>=p.length)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Index out of bounds",results:[]};const y=p.slice(0,e)+p.slice(e+1);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class $j extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.AddIndex);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(E=>{var w,A;return((w=E.value)==null?void 0:w.valueAsType)||((A=E.value)==null?void 0:A.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};if(e<0||e>p.length)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Index out of bounds",results:[]};const v=p.slice(0,e)+y+p.slice(e);return{value:H.Success,error:null,results:[v]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Pj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST,version:"1.0.0",description:"String replace first operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.ReplaceFirst);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(E=>{var w,A;return((w=E.value)==null?void 0:w.valueAsType)||((A=E.value)==null?void 0:A.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const v=p.replace(e,y);return{value:H.Success,error:null,results:[v]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Nj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST,version:"1.0.0",description:"String replace last operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.ReplaceLast);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(w=>{var A,$;return((A=w.value)==null?void 0:A.valueAsType)||(($=w.value)==null?void 0:$.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const v=p.lastIndexOf(e);if(v===-1)return{value:H.Success,error:null,results:[p]};const E=p.slice(0,v)+p.slice(v).replace(e,y);return{value:H.Success,error:null,results:[E]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Vj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.ReplaceIndex);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(E=>{var w,A;return((w=E.value)==null?void 0:w.valueAsType)||((A=E.value)==null?void 0:A.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};if(e<0||e>=p.length)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Index out of bounds",results:[]};const v=p.slice(0,e)+y+p.slice(e+1);return{value:H.Success,error:null,results:[v]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Lj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_SINGLE_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.ReplaceSingleMatch);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(E=>{var w,A;return((w=E.value)==null?void 0:w.valueAsType)||((A=E.value)==null?void 0:A.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const v=p.replace(e,y);return{value:H.Success,error:null,results:[v]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Mj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.ReplaceAllMatches);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(E=>{var w,A;return((w=E.value)==null?void 0:w.valueAsType)||((A=E.value)==null?void 0:A.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const v=p.split(e).join(y);return{value:H.Success,error:null,results:[v]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Bj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.GetIndexItem);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const y=p.charAt(e);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Uj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST,version:"1.0.0",description:"String get first operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.GetFirst);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const e=p.charAt(0);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class xj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST,version:"1.0.0",description:"String get last operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.GetLast);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const e=p.charAt(p.length-1);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class jj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.GetIndexOf);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const y=p.indexOf(e);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Gj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.Append);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const y=p+e;return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Fj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.Prepend);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const y=e+p;return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Sj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.Join);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const y=p.join(e);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Kj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.Split);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const y=p.split(e);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class kj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.Reverse);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const e=p.slice().reverse();return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class qj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST,version:"1.0.0",description:"List delete last operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.DeleteLast);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const e=p.slice(0,-1);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Hj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST,version:"1.0.0",description:"List delete first operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.DeleteFirst);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const e=p.slice(1);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Zj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.AddIndex);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(E=>{var w,A;return((w=E.value)==null?void 0:w.valueAsType)||((A=E.value)==null?void 0:A.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};if(e<0||e>p.length)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Index out of bounds",results:[]};const v=[...p.slice(0,e),y,...p.slice(e)];return{value:H.Success,error:null,results:[v]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Jj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.ReplaceIndex);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(E=>{var w,A;return((w=E.value)==null?void 0:w.valueAsType)||((A=E.value)==null?void 0:A.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};if(e<0||e>=p.length)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Index out of bounds",results:[]};const v=[...p];return v[e]=y,{value:H.Success,error:null,results:[v]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Wj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST,version:"1.0.0",description:"List replace first operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.ReplaceFirst);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(w=>{var A,$;return((A=w.value)==null?void 0:A.valueAsType)||(($=w.value)==null?void 0:$.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const v=p.indexOf(e);if(v===-1)return{value:H.Success,error:null,results:[p]};const E=[...p];return E[v]=y,{value:H.Success,error:null,results:[E]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Yj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST,version:"1.0.0",description:"List replace last operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.ReplaceLast);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(w=>{var A,$;return((A=w.value)==null?void 0:A.valueAsType)||(($=w.value)==null?void 0:$.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const v=p.lastIndexOf(e);if(v===-1)return{value:H.Success,error:null,results:[p]};const E=[...p];return E[v]=y,{value:H.Success,error:null,results:[E]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class zj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.GetIndexItem);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};if(e<0||e>=p.length)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Index out of bounds",results:[]};const y=p[e];return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Xj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.GetFirst);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const e=p[0];return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Qj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.GetLast);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const e=p[p.length-1];return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class e3 extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.Append);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const y=[...p,e];return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class t3 extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.Prepend);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const y=[e,...p];return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class r3 extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_PARALLEL,version:"1.0.0",description:"Execution parallel operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(tr.Parallel);o&&(o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(A=>{var $,V;return(($=A.value)==null?void 0:$.valueAsType)||((V=A.value)==null?void 0:V.value)})[0];if(!p)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list of action entities provided",results:[]};if(!Array.isArray(p))return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Invalid input value. Expected a list of action entities",results:[]};const y=this.extensionsRegistry.requestContexts(this,[be.Editor])[0],E=p.map(A=>{const $=new mn(y.logic,[A],A,null,this.extensionsRegistry);return $.inheritValuesFromContext(y),$}).map(A=>A.execute()),w=await Promise.all(E);return{value:H.Success,error:null,results:[w]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class i3 extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SEQUENTIAL,version:"1.0.0",description:"Execution sequential operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(tr.Sequential);o&&(o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list of action entities provided",results:[]};if(!Array.isArray(p))return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Invalid input value. Expected a list of action entities",results:[]};const e=[];for(let y=0;y<p.length;y++){const v=p[y],w=this.extensionsRegistry.requestContexts(this,[be.Editor])[0],A=new mn(w.logic,[v],v,null,this.extensionsRegistry);A.inheritValuesFromContext(w);const $=await A.execute();e.push($)}return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class s3 extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(tr.Wait);o&&(o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=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 p!="number"||p<0?{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Invalid wait time provided",results:[]}:(await new Promise(e=>setTimeout(e,p)),{value:H.Success,error:null,results:[]})}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class n3 extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CREATE_NEW_INSTANCE,version:"1.0.0",description:"Entity create new instance operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(pr.CreateNewInstance);o&&(o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(w=>{var A,$;return((A=w.value)==null?void 0:A.valueAsType)||(($=w.value)==null?void 0:$.value)}),p=o[0];if(!p)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No entity template provided",results:[]};if(!(p instanceof Qn))return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Invalid entity template value provided",results:[]};const e=o[1]||{},v=Li(p).map(w=>w.name);let E=e;if(v.includes(Le.PERSISTED_ENTITY)){const w=p.properties.find($=>{var V;return((V=$.implements)==null?void 0:V.id)===he["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id});if(!w)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No database property found in entity",results:[]};if(!w.getDefaultValue())return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Database property has no database as entity as default value",results:[]}}return{value:H.Success,error:null,results:[E]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class a3 extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(pr.Validate);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)});Me.log("Inputs for entity validation: ",o);const e=rT(o[1]).safeParse(o[0]);return e.success?{value:H.Success,error:null,results:[o[0]]}:{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:e.error.errors,results:[]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class o3 extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(yi.HttpRequest);o&&(o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[3]||{},e={method:o[0],url:o[1],params:o[2],headers:p,data:o[4]};Me.log("Axios request config: ",e);const y=await Fme(e);return{value:H.Success,error:null,results:[y.status,y.headers,y.data]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class YI extends NI{constructor(u,r,a=r.projectId){super(u,be.Editor),this._editor=r,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,r){return this._editor.initTest(u,r)}removeTest(){return this._editor.removeTest()}async copyEntities(u){return this._editor.copyEntities(u)}resolveInitialChildrenPositions(u,r,a){return this._editor.resolveInitialChildrenPositions(u,r,a)}publish(){return this._editor.publish()}loadActivePublication(u){return this._editor.loadActivePublication(u)}requestActiveDynamicValue(u){return this._editor.requestActiveDynamicValue(u)}}function Sme(d,u){return u instanceof YI?u:new YI(d,u)}function Kme(d){d.register(new Ex(d)),d.register(new vx(d)),d.register(new fx(d)),d.register(new yx(d)),d.register(new mx(d)),d.register(new hx(d)),d.register(new aj(d)),d.register(new oj(d)),d.register(new lj(d)),d.register(new uj(d)),d.register(new dj(d)),d.register(new cj(d)),d.register(new pj(d)),d.register(new fj(d)),d.register(new hj(d)),d.register(new yj(d)),d.register(new mj(d)),d.register(new vj(d)),d.register(new Ej(d)),d.register(new Tj(d)),d.register(new Ij(d)),d.register(new Aj(d)),d.register(new bj(d)),d.register(new wj(d)),d.register(new Rj(d)),d.register(new gj(d)),d.register(new _j(d)),d.register(new Dj(d)),d.register(new Oj(d)),d.register(new Cj(d)),d.register(new $j(d)),d.register(new Pj(d)),d.register(new Nj(d)),d.register(new Vj(d)),d.register(new Lj(d)),d.register(new Mj(d)),d.register(new Bj(d)),d.register(new Uj(d)),d.register(new xj(d)),d.register(new jj(d)),d.register(new Gj(d)),d.register(new Fj(d)),d.register(new Sj(d)),d.register(new Kj(d)),d.register(new kj(d)),d.register(new qj(d)),d.register(new Hj(d)),d.register(new Zj(d)),d.register(new Jj(d)),d.register(new Wj(d)),d.register(new Yj(d)),d.register(new zj(d)),d.register(new Xj(d)),d.register(new Qj(d)),d.register(new e3(d)),d.register(new t3(d)),d.register(new r3(d)),d.register(new i3(d)),d.register(new s3(d)),d.register(new n3(d)),d.register(new a3(d)),d.register(new o3(d))}class l3{constructor(u=new gc){_(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,r)=>(u.manifest.initPriority||We.Normal)-(r.manifest.initPriority||We.Normal))}async setup(){Kme(this),Me.log("Initializing extensions without context..."),this.initForReady()}requestContext(u){switch(u){case be.Editor:return this.onResolveEditorContextCallback();case be.Logic:return this.onResolveProjectLogicContextCallback();case be.GUI:return this.onResolveGUIContextCallback();case be.Compile:return this.onResolveCompileContextCallback();default:throw new Error(`Unknown context type: ${u}`)}}requestContexts(u,r=[]){const a=[];r.length===0&&(r=u.manifest.contexts);for(const o of r){const p=this.requestContext(o);p&&a.push(p)}return a}requestModule(u){const r=this.extensionsRegistry.get(u);if(r){if(r.module)return r.module;throw new Error(`Module ${u} is not registered properly.`)}throw new Error(`Unknown module: ${u}`)}register(u){this.extensionsRegistry.set(u.manifest.id,u)}async initAll(){var u,r;for(const a of this.extensionInOrder)if(a.module.init&&!this.initialized.has(a.manifest.id)){const o=a.manifest.contexts.map(p=>this.requestContext(p)).filter(p=>p!==null);o.length&&(await((r=(u=a.module).init)==null?void 0:r.call(u,o)),this.initialized.add(a.manifest.id))}else!a.module.init&&!this.initialized.has(a.manifest.id)&&this.initialized.add(a.manifest.id)}async initForReady(){Me.log("Initializing extensions for ready contexts...");for(const u of this.extensionInOrder)if(u.module.init&&!this.initialized.has(u.manifest.id)){Me.log("Initializing "+u.manifest.id+" extension...");const r=this.requestContexts(u);u.manifest.contexts.every(o=>!!r.find(p=>p.contextType===o))?(await u.module.init(r),this.initialized.add(u.manifest.id)):Me.warn(`Skipping initialization of ${u.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${u.manifest.contexts.join(", ")}`,`Available contexts: ${r.map(o=>o.contextType).join(", ")}`)}else!u.module.init&&!this.initialized.has(u.manifest.id)?(Me.log("Set "+u.manifest.id+" extension as initialized by default..."),this.initialized.add(u.manifest.id)):Me.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,r){this.events.on(u,r)}emit(u,...r){this.events.emit(u,...r)}off(u,r){this.events.off(u,r)}emitAsync(u,...r){return this.events.emitAsync(u,...r)}emitAsyncAll(u,...r){return this.events.emitAsyncAll(u,...r)}emitAsyncAllSettled(u,...r){return this.events.emitAsyncAllSettled(u,...r)}emitAsyncSequentially(u,...r){return this.events.emitAsyncSequentially(u,...r)}emitAsyncSequentiallyAll(u,...r){return this.events.emitAsyncSequentiallyAll(u,...r)}emitAsyncSequentiallyAllSettled(u,...r){return this.events.emitAsyncSequentiallyAllSettled(u,...r)}async contextAvailable(u){if(this.initializedContexts.has(u)){Me.warn(`Context ${u} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(u),u){case be.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case be.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}Me.log(`Context ${u} is now available. Initializing extensions for this context...`),await this.initForReady()}}let Oy=null;const zI={requestModule:d=>(Oy||(Oy=new l3,Oy.setup()),Oy.requestModule(d))},no={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var XI=(d=>(d.FinishedSuccess="finished-success",d.FinishedError="finished-error",d.Running="running",d.Paused="paused",d.Stopped="stopped",d.NotStarted="not-started",d))(XI||{});const d3={...zI};class mn extends gc{constructor(r,a,o,p=null,e=d3){super();_(this,"project");_(this,"entryPoint");_(this,"state","not-started");_(this,"events",new gc);_(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=o,this.project=r,this.parentExecution=p,this.localTestValues=new vc(N.UUID.uuid(),this.project),this.resolvedValues=new vc(N.UUID.uuid(),this.project),this.persistedExecutionResults=new vc(N.UUID.uuid(),this.project),this.lastExecutionResults=new vc(N.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(r){this.hasEntity(r)&&(this.removeFromScheduledList(r),!this.skipped.includes(r)&&(this.skipped.push(r),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(r),vi.includes(r.type)&&nt(r).forEach(a=>this.skip(a))))}async schedule(r,a,o){if(this.hasExecuted(r))return null;if(Dt.includes(r.type))return this.executeBranch(r,o,a);if($i.includes(r.type)){if(r.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(r,o,a);this.scheduled.includes(r)||this.scheduled.push(r)}return null}mergeExernalValuesWithInternalInputs(r,a){const o=[];return[...ir,...Dt].includes(a.type)?o.push(...a.inputs):hr.includes(a.type)&&o.push(...a.outputs),o.map(e=>{var v;let y=r.find(E=>E.valueOwner.id===e.id);if(y)return y;if(!y&&Dt.includes(a.type)&&(y=r.find(E=>{var w;return((w=E.valueOwner.declaration)==null?void 0:w.id)===e.id})),y){const E=(v=y.value)==null?void 0:v.clone(null);return E==null||E.setStandaloneParent(e),{...y,valueOwner:e,value:E||null,inheritanceLink:{sources:[y],target:e}}}return un.includes(e.type)?py(e,this.valueResolutionContext):ll(e,this.valueResolutionContext)}).reduce((e,y)=>{const v=fn(y==null?void 0:y.valueOwner,this.project),E=y?[y]:[];return v.forEach(w=>{var V,B,F;if(w.id===(y==null?void 0:y.valueOwner.id))return;const A=dt(w.getDataType(null),w,this.project);A==null||A.metaSync({value:(V=y==null?void 0:y.value)==null?void 0:V.value},null),A==null||A.setValueAsTypeList(((B=y==null?void 0:y.value)==null?void 0:B.valueAsTypeList)||null),A==null||A.setValueAsTypeSingle(((F=y==null?void 0:y.value)==null?void 0:F.valueAsTypeSingle)||null);const $={...y,valueOwner:w,value:A};E.push($)}),[...e,...E]},[]).sort((e,y)=>e.valueOwner.index-y.valueOwner.index)}inheritValuesFromContext(r){this.localTestValues=r.localTestValues,this.resolvedValues=r.resolvedValues,this.persistedExecutionResults=r.persistedExecutionResults}async executeInternalCall(r,a,o,p={}){var y,v;const e={...no,...p};try{let E={value:H.Success,error:null,results:[]};if(a.sort((w,A)=>w.valueOwner.index-A.valueOwner.index),Object.values(Yr).includes(r.declaration.id)){const w=this.parentContext.requestModule(Cd+r.declaration.id).main;w?E=await w(r,a):Me.warn(`No implementation found for built-in function: ${r.declaration.id}`)}else{debugger;E=await this.executeDetachedFullFunctionDeclarationLogic(r.declaration,a,o,e);debugger;const w=r.outputs.map($=>{var q,ie,W,de;const V=[...$.declaration.getCounterparts(),$.declaration],B=E.results.find(Q=>V.some(X=>Q.valueOwner.id===(X==null?void 0:X.id))),F=$==null?void 0:$.getDataType(null),K=dt(F,$,o);return F!=null&&F.asType?Array.isArray((q=B==null?void 0:B.value)==null?void 0:q.valueAsType)?K==null||K.setValueAsTypeList((ie=B==null?void 0:B.value)==null?void 0:ie.valueAsTypeList):K==null||K.setValueAsTypeSingle(((W=B==null?void 0:B.value)==null?void 0:W.valueAsType)||null):K==null||K.metaSync({value:(de=B==null?void 0:B.value)==null?void 0:de.value},null),{valueOwner:$,type:Ae.ExecutionResult,inheritanceLink:null,value:K}});let A=null;debugger;if(E.error){Me.warn("Raw error executing entity: ",E.error);const $=(y=r.error)==null?void 0:y.getDataType(null),V=dt($||null,r.error,o);$!=null&&$.asType?V==null||V.setValueAsTypeSingle(E.error):V==null||V.metaSync({value:E.error},null),A={valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:V}}return{value:E.value,entity:r,error:A,results:w}}return{...E,entity:r}}catch(E){Me.warn("Internal call execution error: ",E);let w=null;if(r.error){const A=(v=r.error)==null?void 0:v.getDataType(null),$=dt(A,r.error,o);A!=null&&A.asType?$==null||$.setValueAsTypeSingle(E):$==null||$.metaSync({value:E},null),w={valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:$}}return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,entity:r,error:w,results:[]}}}static async executeOperation(r,a,o){var p,e;try{let y={value:H.Success,error:null,results:[]};a.sort((w,A)=>w.valueOwner.index-A.valueOwner.index),r.declaration.implementation&&(y=await r.declaration.implementation(r,a));const v=r.outputs.map((w,A)=>{const $=w==null?void 0:w.getDataType(null),V=dt($,w,o);return $!=null&&$.asType?V==null||V.setValueAsTypeSingle(y.results[A]):V==null||V.metaSync({value:y.results[A]},null),{valueOwner:w,type:Ae.ExecutionResult,inheritanceLink:null,value:V}});let E=null;if(y.error&&r.error){Me.warn("Raw error executing entity: ",y.error);const w=((p=r.error)==null?void 0:p.getDataType(null))||null,A=dt(w,r.error,o);w!=null&&w.asType?A==null||A.setValueAsTypeSingle(y.error):A==null||A.metaSync({value:y.error},null),E={valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:A}}return{value:y.value,entity:r,error:E,results:v}}catch(y){Me.warn("Operation execution error: ",y);let v=null;if(r.error){const E=(e=r.error)==null?void 0:e.getDataType(null),w=dt(E,r.error,o);E!=null&&E.asType?w==null||w.setValueAsTypeSingle(y):w==null||w.metaSync({value:y},null),v={valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:w}}return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,entity:r,error:v,results:[]}}}async executeSearch(r,a,o){var p;try{let e={value:H.Success,error:null,results:[]};const y=r.outputs[0];if(!y)return{value:H.Success,entity:r,error:null,results:[]};let v={value:null,valueOwner:y,type:Ae.ExecutionResult,inheritanceLink:null};const E=await this.parentContext.requestModule(Qe.SEARCH_NODE_IMPLEMENTATION).main(r,a),w=y==null?void 0:y.getDataType(null),A=dt(w,y,o);return A==null||A.metaSync({value:E.data},null),v.value=A,{value:e.value,entity:r,error:null,results:[v]}}catch(e){if(Me.warn(`Search node execution error: ${e}`),!r.error)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,entity:r,error:null,results:[]};const y=(p=r.error)==null?void 0:p.getDataType(null),v=dt(y,r.error,o);return v==null||v.metaSync({value:e},null),{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,entity:r,error:{valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:v},results:[]}}}async executeLoop(r,a,o,p={}){var y,v;const e={...no,...p};try{let E={value:H.Success,error:null,results:[]};const w=a.map(K=>{var q,ie;return((q=K==null?void 0:K.value)==null?void 0:q.valueAsType)||((ie=K==null?void 0:K.value)==null?void 0:ie.value)});let A={};r.getUniqueReturnDeclarations().forEach(K=>{const q=r.body.inputs.find(Q=>Y(Q,o)===Gi.fromReturnDeclarationToBodyArgumentDeclarationName(K)),ie=K==null?void 0:K.getDataType(null),W=dt(ie,q,o);ie!=null&&ie.asType?W==null||W.setValueAsTypeList([]):W==null||W.metaSync({value:[]},null),this.lastExecutionResults.writeValue(q,W);const de={value:W,valueOwner:q,type:Ae.ExecutionResult,inheritanceLink:null};A[q.id]=de});let V={value:H.Success,entity:r.body,error:null,results:[]};switch(r.declaration.id){case he.loop["counted-loop"].id:{const K=w[0];let q=1;for(;q<=K&&q<=50;){const ie=r.body.inputs.map(de=>{if(de===r.currentIterationNumberArgumentDeclaration){const Q=r.currentIterationNumberArgumentDeclaration.getDataType(null),ce=vl(Q),X=this.lastExecutionResults.readValue(de.id);if(X){X.metaSync({value:q},null),this.lastExecutionResults.writeValue(de,X);const ue={value:X,valueOwner:r.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null};return A[de.id]=ue,ue}const z={id:N.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:N.UUID.uuid(),createdAt:new Date().toISOString(),author:N.sessionAuthor,deleted:!1,previousVersion:null,value:q,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:de.toReference()},pe=dr(z,o);this.lastExecutionResults.writeValue(de,pe);const te={value:pe,valueOwner:r.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null};return A[de.id]=te,te}else return A[de.id]}).filter(de=>!!de),W=await this.executeFullFunctionDeclarationLogic(r.body,ie,e);if(V=W,V.results.forEach(de=>{var z,pe,te,ue;if(de.valueOwner.type!==f.ReturnDeclaration)return;const Q=r.body.inputs.find(Ie=>Y(Ie,o)===Gi.fromReturnDeclarationToBodyArgumentDeclarationName(de.valueOwner)),X=[...((pe=(z=A==null?void 0:A[Q.id])==null?void 0:z.value)==null?void 0:pe.value)||[],((te=de==null?void 0:de.value)==null?void 0:te.value)||null];(ue=A[Q.id].value)==null||ue.metaSync({value:X},null),this.lastExecutionResults.writeValue(Q,A[Q.id].value)}),[H.CaughtError,H.Break,H.Return].includes(W.value))break;q++}break}case he.loop["manual-flow-loop"].id:{let K=1;for(;K<=50;){const q=r.body.inputs.map(W=>{if(W===r.currentIterationNumberArgumentDeclaration){const de=this.lastExecutionResults.readValue(W.id);if(de){de.metaSync({value:K},null),this.lastExecutionResults.writeValue(W,de);const z={value:de,valueOwner:W,type:Ae.ExecutionResult,inheritanceLink:null};return A[W.id]=z,z}const Q=r.currentIterationNumberArgumentDeclaration.getDataType(null),ce=dt(Q,W,o);return ce==null||ce.metaSync({value:K},null),this.lastExecutionResults.writeValue(W,ce),{value:ce,valueOwner:W,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[W.id]}).filter(W=>!!W),ie=await this.executeFullFunctionDeclarationLogic(r.body,q,e);if(V=ie,V.results.forEach(W=>{var X,z,pe;if(W.valueOwner.type!==f.ReturnDeclaration)return;const de=r.body.inputs.find(te=>Y(te,o)===Gi.fromReturnDeclarationToBodyArgumentDeclarationName(W.valueOwner)),ce=[...(X=A[de.id].value)==null?void 0:X.value,((z=W.value)==null?void 0:z.value)||null];(pe=A[de.id].value)==null||pe.metaSync({value:ce},null),this.lastExecutionResults.writeValue(de,A[de.id].value)}),[H.CaughtError,H.Break,H.Return].includes(ie.value))break;K++}break}case he.loop["list-loop"].id:{const K=w[0];let q=1;const ie=K;for(let W=0;W<ie.length;W++){const de=ie[W],Q=r.body.inputs.map(X=>{if(X===r.currentIterationNumberArgumentDeclaration){const z=this.lastExecutionResults.readValue(X.id);if(z)return z.metaSync({value:q},null),this.lastExecutionResults.writeValue(X,z),{value:z,valueOwner:X,type:Ae.ExecutionResult,inheritanceLink:null};const pe=r.currentIterationNumberArgumentDeclaration.getDataType(null),te=dt(pe,X,o);return te==null||te.metaSync({value:q},null),this.lastExecutionResults.writeValue(X,te),{value:te,valueOwner:r.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(X===r.currentValueArgumentDeclaration){const z=r.currentValueArgumentDeclaration.getDataType(null),pe=vl(z),te=this.lastExecutionResults.readValue(X.id);if(te)return te.metaSync({value:de},null),this.lastExecutionResults.writeValue(X,te),{value:te,valueOwner:X,type:Ae.ExecutionResult,inheritanceLink:null};const ue={id:N.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:N.UUID.uuid(),createdAt:new Date().toISOString(),author:N.sessionAuthor,deleted:!1,previousVersion:null,value:de,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:pe,standaloneParent:X.toReference()},Ie=dr(ue,o);return this.lastExecutionResults.writeValue(X,Ie),{value:Ie,valueOwner:r.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[X.id]}).filter(X=>!!X),ce=await this.executeFullFunctionDeclarationLogic(r.body,Q,e);if(V=ce,V.results.forEach(X=>{var ue,Ie,Ue;if(X.valueOwner.type!==f.ReturnDeclaration)return;const z=r.body.inputs.find(Pe=>Y(Pe,o)===Gi.fromReturnDeclarationToBodyArgumentDeclarationName(X.valueOwner)),te=[...(ue=A[z.id].value)==null?void 0:ue.value,((Ie=X.value)==null?void 0:Ie.value)||null];(Ue=A[z.id].value)==null||Ue.metaSync({value:te},null),this.lastExecutionResults.writeValue(z,A[z.id].value)}),[H.CaughtError,H.Break,H.Return].includes(ce.value))break;q++}break}case he.loop["object-keys-loop"].id:{const K=w[0];let q=1;const ie=K?Object.keys(K):[];for(let W=0;W<ie.length;W++){const de=ie[W],Q=r.body.inputs.map(X=>{if(X===r.currentIterationNumberArgumentDeclaration){const z=this.lastExecutionResults.readValue(X.id);if(z)return z.metaSync({value:q},null),this.lastExecutionResults.writeValue(X,z),{value:z,valueOwner:X,type:Ae.ExecutionResult,inheritanceLink:null};const pe=r.currentIterationNumberArgumentDeclaration.getDataType(null),te=dt(pe,X,o);return te==null||te.metaSync({value:q},null),this.lastExecutionResults.writeValue(X,te),{value:te,valueOwner:r.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(X===r.currentValueArgumentDeclaration){const z=r.currentValueArgumentDeclaration.getDataType(null),pe=vl(z),te=this.lastExecutionResults.readValue(X.id);if(te)return te.metaSync({value:de},null),this.lastExecutionResults.writeValue(X,te),{value:te,valueOwner:X,type:Ae.ExecutionResult,inheritanceLink:null};const ue={id:N.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:N.UUID.uuid(),createdAt:new Date().toISOString(),author:N.sessionAuthor,deleted:!1,previousVersion:null,value:de,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:pe,standaloneParent:X.toReference()},Ie=dr(ue,o);return this.lastExecutionResults.writeValue(X,Ie),{value:Ie,valueOwner:r.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[X.id]}).filter(X=>!!X),ce=await this.executeFullFunctionDeclarationLogic(r.body,Q,e);if(V=ce,V.results.forEach(X=>{var ue,Ie,Ue;if(X.valueOwner.type!==f.ReturnDeclaration)return;const z=r.body.inputs.find(Pe=>Y(Pe,o)===Gi.fromReturnDeclarationToBodyArgumentDeclarationName(X.valueOwner)),te=[...(ue=A[z.id].value)==null?void 0:ue.value,((Ie=X.value)==null?void 0:Ie.value)||null];(Ue=A[z.id].value)==null||Ue.metaSync({value:te},null),this.lastExecutionResults.writeValue(z,A[z.id].value)}),[H.CaughtError,H.Break,H.Return].includes(ce.value))break;q++}break}case he.loop["object-values-loop"].id:{const K=w[0];let q=1;const ie=K?Object.values(K):[];for(let W=0;W<ie.length;W++){const de=ie[W],Q=r.body.inputs.map(X=>{if(X===r.currentIterationNumberArgumentDeclaration){const z=this.lastExecutionResults.readValue(X.id);if(z)return z.metaSync({value:q},null),this.lastExecutionResults.writeValue(X,z),{value:z,valueOwner:X,type:Ae.ExecutionResult,inheritanceLink:null};const pe=r.currentIterationNumberArgumentDeclaration.getDataType(null),te=dt(pe,X,o);return te==null||te.metaSync({value:q},null),this.lastExecutionResults.writeValue(X,te),{value:te,valueOwner:r.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(X===r.currentValueArgumentDeclaration){const z=r.currentValueArgumentDeclaration.getDataType(null),pe=vl(z),te=this.lastExecutionResults.readValue(X.id);if(te)return te.metaSync({value:de},null),this.lastExecutionResults.writeValue(X,te),{value:te,valueOwner:X,type:Ae.ExecutionResult,inheritanceLink:null};const ue={id:N.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:N.UUID.uuid(),createdAt:new Date().toISOString(),author:N.sessionAuthor,deleted:!1,previousVersion:null,value:de,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:pe,standaloneParent:X.toReference()},Ie=dr(ue,o);return this.lastExecutionResults.writeValue(X,Ie),{value:Ie,valueOwner:r.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[X.id]}).filter(X=>!!X),ce=await this.executeFullFunctionDeclarationLogic(r.body,Q,e);if(V=ce,V.results.forEach(X=>{var ue,Ie,Ue;if(X.valueOwner.type!==f.ReturnDeclaration)return;const z=r.body.inputs.find(Pe=>Y(Pe,o)===Gi.fromReturnDeclarationToBodyArgumentDeclarationName(X.valueOwner)),te=[...(ue=A[z.id].value)==null?void 0:ue.value,((Ie=X.value)==null?void 0:Ie.value)||null];(Ue=A[z.id].value)==null||Ue.metaSync({value:te},null),this.lastExecutionResults.writeValue(z,A[z.id].value)}),[H.CaughtError,H.Break,H.Return].includes(ce.value))break;q++}break}case he.loop["string-loop"].id:{const K=w[0];let q=1;const ie=K.split("");for(let W=0;W<ie.length;W++){const de=ie[W],Q=r.body.inputs.map(X=>{if(X===r.currentIterationNumberArgumentDeclaration){const z=this.lastExecutionResults.readValue(X.id);if(z)return z.metaSync({value:q},null),this.lastExecutionResults.writeValue(X,z),{value:z,valueOwner:X,type:Ae.ExecutionResult,inheritanceLink:null};const pe=r.currentIterationNumberArgumentDeclaration.getDataType(null),te=dt(pe,X,o);return te==null||te.metaSync({value:q},null),this.lastExecutionResults.writeValue(X,te),{value:te,valueOwner:r.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(X===r.currentValueArgumentDeclaration){const z=r.currentValueArgumentDeclaration.getDataType(null),pe=vl(z),te=this.lastExecutionResults.readValue(X.id);if(te)return te.metaSync({value:de},null),this.lastExecutionResults.writeValue(X,te),{value:te,valueOwner:X,type:Ae.ExecutionResult,inheritanceLink:null};const ue={id:N.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:N.UUID.uuid(),createdAt:new Date().toISOString(),author:N.sessionAuthor,deleted:!1,previousVersion:null,value:de,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:pe,standaloneParent:X.toReference()},Ie=dr(ue,o);return this.lastExecutionResults.writeValue(X,Ie),{value:Ie,valueOwner:r.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[X.id]}).filter(X=>!!X),ce=await this.executeFullFunctionDeclarationLogic(r.body,Q,e);if(V=ce,V.results.forEach(X=>{var ue,Ie,Ue;if(X.valueOwner.type!==f.ReturnDeclaration)return;const z=r.body.inputs.find(Pe=>Y(Pe,o)===Gi.fromReturnDeclarationToBodyArgumentDeclarationName(X.valueOwner)),te=[...(ue=A[z.id].value)==null?void 0:ue.value,((Ie=X.value)==null?void 0:Ie.value)||null];(Ue=A[z.id].value)==null||Ue.metaSync({value:te},null),this.lastExecutionResults.writeValue(z,A[z.id].value)}),[H.CaughtError,H.Break,H.Return].includes(ce.value))break;q++}break}}let B=[];r.body.inputs.forEach(K=>{var ie;const q=A[K.id];if(q){const W=(ie=q.value)==null?void 0:ie.clone(null),de=r.outputs.find(Q=>Q.declaration&&Gi.fromLoopOutputDeclarationToBodyArgumentDeclarationName(Q.declaration)===Y(K,o));if(!de)return;B.push({valueOwner:de,type:Ae.ExecutionResult,inheritanceLink:null,value:W})}}),E={value:[H.CaughtError,H.Return].includes(V.value)?V.value:H.Success,error:null,results:B};let F=null;if(E.error&&r.error){Me.warn("Raw error executing entity: ",E.error);const K=(y=r.error)==null?void 0:y.getDataType(null),q=dt(K||null,r.error,o);K!=null&&K.asType?q==null||q.setValueAsTypeSingle(E.error):q==null||q.metaSync({value:E.error},null),F={valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:q}}return{value:E.value,entity:r,error:F,results:E.results}}catch(E){if(Me.warn("Error executing loop: ",E),r.error){const w=(v=r.error)==null?void 0:v.getDataType(null),A=dt(w,r.error,o);return w!=null&&w.asType?A==null||A.setValueAsTypeSingle(E):A==null||A.metaSync({value:E},null),{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,entity:r,error:{valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:A},results:[]}}else return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,entity:r,error:null,results:[]}}}async executeFunctionCall(r,a,o,p={}){var y,v;const e={...no,...p};try{let E={value:H.Success,error:null,results:[]};E=await this.executeDetachedFullFunctionDeclarationLogic(r.declaration,a,o,e);const w=r.outputs.map($=>{var q,ie,W,de;const V=[...$.declaration.getCounterparts(),$.declaration],B=E.results.find(Q=>V.some(X=>Q.valueOwner.id===(X==null?void 0:X.id))),F=$==null?void 0:$.getDataType(null),K=dt(F,$,o);return F!=null&&F.asType?Array.isArray((q=B==null?void 0:B.value)==null?void 0:q.valueAsType)?K==null||K.setValueAsTypeList((ie=B==null?void 0:B.value)==null?void 0:ie.valueAsTypeList):K==null||K.setValueAsTypeSingle(((W=B==null?void 0:B.value)==null?void 0:W.valueAsType)||null):K==null||K.metaSync({value:(de=B==null?void 0:B.value)==null?void 0:de.value},null),{valueOwner:$,type:Ae.ExecutionResult,inheritanceLink:null,value:K}});let A=null;if(E.error&&r.error){Me.warn("Raw error executing entity: ",E.error);const $=(y=r.error)==null?void 0:y.getDataType(null),V=dt($||null,r.error,o);$!=null&&$.asType?V==null||V.setValueAsTypeSingle(E.error):V==null||V.metaSync({value:E.error},null),A={valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:V}}return{value:E.value,entity:r,error:A,results:w}}catch(E){if(!r.error)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,entity:r,error:null,results:[]};const w=(v=r.error)==null?void 0:v.getDataType(null),A=dt(w,r.error,o);return w!=null&&w.asType?A==null||A.setValueAsTypeSingle(E):A==null||A.metaSync({value:E},null),{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,entity:r,error:{valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:A},results:[]}}}async executeCondition(r,a){var p,e,y,v,E,w,A,$,V,B,F,K,q,ie,W,de,Q,ce,X,z,pe,te,ue,Ie,Ue,Pe,ge,$e,qe,xe,lt,Rt,ur,Ar,Mr,Qr,ci,Es,Bs,wn,Us,pi,Ts,Rn,ra,lf,wl,df;let o=!1;switch(r.declaration.id){case oi.Empty:{o=!((e=(p=a[0])==null?void 0:p.value)!=null&&e.value);break}case oi.NotEmpty:{o=!!((v=(y=a[0])==null?void 0:y.value)!=null&&v.value);break}case ut.Equal:{if([oe.String,oe.Number,oe.Boolean,oe.Null,oe.Enum,oe.Date,oe.UUID].includes((w=(E=a[0])==null?void 0:E.value)==null?void 0:w.name)){o=(($=(A=a[0])==null?void 0:A.value)==null?void 0:$.value)===((B=(V=a[1])==null?void 0:V.value)==null?void 0:B.value);break}if(((K=(F=a[0])==null?void 0:F.value)==null?void 0:K.name)===oe.KeyValue||((ie=(q=a[0])==null?void 0:q.value)==null?void 0:ie.name)===oe.Untyped){const ia=(de=(W=a[0])==null?void 0:W.value)==null?void 0:de.value,fi=(ce=(Q=a[1])==null?void 0:Q.value)==null?void 0:ce.value;o=JSON.stringify(ia)===JSON.stringify(fi);break}break}case ut.NotEqual:{if([oe.String,oe.Number,oe.Boolean,oe.Null,oe.Enum,oe.Date,oe.UUID].includes((z=(X=a[0])==null?void 0:X.value)==null?void 0:z.name)){o=((te=(pe=a[0])==null?void 0:pe.value)==null?void 0:te.value)!==((Ie=(ue=a[1])==null?void 0:ue.value)==null?void 0:Ie.value);break}if(((Pe=(Ue=a[0])==null?void 0:Ue.value)==null?void 0:Pe.name)===oe.Untyped||(($e=(ge=a[0])==null?void 0:ge.value)==null?void 0:$e.name)===oe.KeyValue){const ia=(xe=(qe=a[0])==null?void 0:qe.value)==null?void 0:xe.value,fi=(Rt=(lt=a[1])==null?void 0:lt.value)==null?void 0:Rt.value;o=JSON.stringify(ia)!==JSON.stringify(fi);break}break}case ut.MoreThanOrEqual:{o=((Ar=(ur=a[0])==null?void 0:ur.value)==null?void 0:Ar.value)>=((Qr=(Mr=a[1])==null?void 0:Mr.value)==null?void 0:Qr.value);break}case ut.MoreThan:{o=((Es=(ci=a[0])==null?void 0:ci.value)==null?void 0:Es.value)>((wn=(Bs=a[1])==null?void 0:Bs.value)==null?void 0:wn.value);break}case ut.LessThanOrEqual:{o=((pi=(Us=a[0])==null?void 0:Us.value)==null?void 0:pi.value)<=((Rn=(Ts=a[1])==null?void 0:Ts.value)==null?void 0:Rn.value);break}case ut.LessThan:{o=((lf=(ra=a[0])==null?void 0:ra.value)==null?void 0:lf.value)<((df=(wl=a[1])==null?void 0:wl.value)==null?void 0:df.value);break}case Kr.And:{o=(await Promise.all(r.andChildrenGroup.map(async fi=>{const zd=this.mergeExernalValuesWithInternalInputs(a,fi);return(await this.executeCondition(fi,zd)).value===H.Success}))).every(fi=>fi);break}case Kr.Or:{o=(await Promise.all(r.orChildrenGroup.map(async fi=>{const zd=this.mergeExernalValuesWithInternalInputs(a,fi);return(await this.executeCondition(fi,zd)).value===H.Success}))).some(fi=>fi);break}}return{value:o?H.Success:H.CaughtError,entity:r,error:null,results:[]}}async executeDetachedFullFunctionDeclarationLogic(r,a,o,p={}){const e={...no,...p,onBeforeEntityExecution:(E,w,A)=>{var $;return(($=p==null?void 0:p.onBeforeEntityExecution)==null?void 0:$.call(p,E,w,{...A,detached:!0}))||Promise.resolve()},onEntityExecuted:(E,w,A)=>{var $;return(($=p==null?void 0:p.onEntityExecuted)==null?void 0:$.call(p,E,w,{...A,detached:!0}))||Promise.resolve()}},y=new mn(o,[r,...Dm(r)],r,this,this.parentContext);return y.inheritValuesFromContext(this),await y.execute(e,a)}async executeFullFunctionDeclarationLogic(r,a,o={}){const p={...no,...o},e=Dm(r);e.forEach(A=>{this.addEntity(A)}),e.reduce((A,$)=>hr.includes($.type)?[...A,...$.outputs]:ir.includes($.type)&&$.type!==f.Condition?[...A,...$.outputs,...$.inputs]:$.type===f.Condition?[...A,...$.inputs]:A,[]).forEach(A=>{this.lastExecutionResults.removeValue(A.id)});const v=await this.executeBranch(r,p,a),w=r.getUniqueReturnDeclarations().reduce((A,$)=>{const V=v==null?void 0:v.results.find(B=>B.valueOwner.id===$.id);return V?[...A,V]:A},[]);return{...v||{},value:(v==null?void 0:v.value)||H.Success,entity:r,error:(v==null?void 0:v.error)||null,results:w}}static async executeEntryPointEntity(r,a){return{value:H.Success,entity:r,error:null,results:a}}static async executeVariable(r,a){return{value:H.Success,entity:r,error:null,results:[a]}}static async executeReturnStatement(r,a){return{value:r.throws?H.CaughtError:H.Return,entity:r,error:null,results:a}}static async executeContinueStatement(r,a){return{value:H.Continue,entity:r,error:null,results:a}}static async executeBreakStatement(r,a){return{value:H.Break,entity:r,error:null,results:a}}mergeValues(r,a){const o=[];for(let p=0;p<a.length;p++)r!=null&&r[p]?o.push(r[p]):o.push(a[p]);return o}async executeEntity(r,a=[],o={}){var y,v,E,w,A,$,V,B,F,K,q,ie,W,de,Q,ce,X;const p={...no,...o},e={detached:!1};switch(r.type){case f.Condition:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((y=p.onBeforeEntityExecution)==null?void 0:y.call(p,r,z,e)),this.executeCondition(r,z)}case f.InternalCall:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((v=p.onBeforeEntityExecution)==null?void 0:v.call(p,r,z,e)),this.executeInternalCall(r,z,this.project)}case f.Operation:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((E=p.onBeforeEntityExecution)==null?void 0:E.call(p,r,z,e)),mn.executeOperation(r,z,this.project)}case f.VariableInstance:case f.VariableDeclaration:{let z=py(r,this.valueResolutionContext);const pe=Vi(r),te=pe.getDataType(null);if(te!=null&&te.isObject()){let Ue={};if(((w=te==null?void 0:te.entity)==null?void 0:w.type)===f.DefinitionEntity&&(Ue={...Ue,...te.entity.getActiveRawDefaultValue()}),z!=null&&z.value)Tr((A=z==null?void 0:z.value)==null?void 0:A.value)&&(Ue={...Ue,...($=z==null?void 0:z.value)==null?void 0:$.value}),z==null||z.value.metaSync({value:Ue},null);else{const Pe=dt(te,r,this.project);Pe==null||Pe.metaSync({value:Ue},null),z={valueOwner:pe,type:Ae.ExecutionResult,inheritanceLink:null,value:Pe}}this.lastExecutionResults.writeValue(pe,z.value),pe.inputs.forEach(Pe=>{var ge;if(((ge=Pe.declaration)==null?void 0:ge.type)===f.Property&&Pe.declaration.static){const $e=this.lastExecutionResults.readValue(Pe.declaration.id),qe=Y(Pe,this.project),xe=xr(qe);if($e)$e.metaSync({value:Ue[xe]},null),this.lastExecutionResults.writeValue(Pe.declaration,$e);else{const lt=dt(Pe.getDataType(null),Pe,this.project);lt==null||lt.metaSync({value:Ue[xe]},null),this.lastExecutionResults.writeValue(Pe.declaration,lt)}}})}else this.lastExecutionResults.writeValue(pe,z==null?void 0:z.value);const ue=[],Ie=(V=z==null?void 0:z.value)!=null&&V.value&&Tr((B=z.value)==null?void 0:B.value)?((F=z.value)==null?void 0:F.value)||{}:{};return r.outputs.map(Ue=>{const Pe=xr(Y(Ue,this.project)),ge=Ie[Pe],$e=dt(Ue.getDataType(null),Ue,this.project);$e==null||$e.metaSync({value:ge},null);const qe={value:$e,valueOwner:Ue,type:Ae.ExecutionResult,inheritanceLink:z?{sources:[z],target:r}:null};ue.push(qe)}),z.type=Ae.ExecutionResult,{value:H.Success,entity:r,error:null,results:[z,...ue]}}case f.FunctionCall:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((K=p.onBeforeEntityExecution)==null?void 0:K.call(p,r,z,e)),this.executeFunctionCall(r,z,this.project)}case f.FunctionDeclaration:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((q=p.onBeforeEntityExecution)==null?void 0:q.call(p,r,z,e)),mn.executeEntryPointEntity(r,z)}case f.Search:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((ie=p.onBeforeEntityExecution)==null?void 0:ie.call(p,r,z,e)),this.executeSearch(r,z,this.project)}case f.Loop:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((W=p.onBeforeEntityExecution)==null?void 0:W.call(p,r,z,e)),this.executeLoop(r,z,this.project,p)}case f.ReturnStatement:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((de=p.onBeforeEntityExecution)==null?void 0:de.call(p,r,z,e)),mn.executeReturnStatement(r,z)}case f.ContinueStatement:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((Q=p.onBeforeEntityExecution)==null?void 0:Q.call(p,r,z,e)),mn.executeContinueStatement(r,z)}case f.BreakStatement:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((ce=p.onBeforeEntityExecution)==null?void 0:ce.call(p,r,z,e)),mn.executeBreakStatement(r,z)}case f.GlobalEvent:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((X=p.onBeforeEntityExecution)==null?void 0:X.call(p,r,z,e)),mn.executeEntryPointEntity(r,z)}default:throw new Error(`Entity type ${r==null?void 0:r.type} is not recognized for execution.`)}}storeLastExecutionValues(r){r.error&&r.error.valueOwner&&this.lastExecutionResults.writeValue(r.error.valueOwner,r.error.value),r.results.forEach(a=>{const o=fn(a.valueOwner,this.project);a.value?o.forEach(p=>{this.lastExecutionResults.writeValue(p,a.value)}):o.forEach(p=>{this.lastExecutionResults.removeValue(p.id)})})}async executeBranch(r,a={},o=[]){var E;const p={...no,...a},e={detached:!1};if(!this.hasEntity(r)||this.hasSkipped(r))return null;this.addToExecutingList(r),this.hasScheduled(r)&&this.removeScheduled(r);const v=await this.executeEntity(r,o,p);debugger;if(this.removeFromExecutingList(r),this.addToAlreadyExecutedList(r),this.storeLastExecutionValues(v),await((E=p.onEntityExecuted)==null?void 0:E.call(p,r,v,e)),v.value===H.Success){const w=(r.successCalls||r.calls||[]).filter(F=>this.hasEntity(F));(r.errorCalls||[]).forEach(F=>{this.skip(F)});let $=[];const V=(await Promise.all(w.map(F=>this.schedule(F,v.results,p)))).filter(F=>!!F),B=V.filter(F=>!!F).find(F=>F.value===H.CaughtError||F.value===H.Return||F.value===H.Break||F.value===H.Continue);return B||($=[...$,...V],v)}else if(v.value===H.CaughtError){const w=(r.errorCalls||[]).filter(F=>this.hasEntity(F));(r.successCalls||r.calls||[]).forEach(F=>{this.skip(F)});let $=[];const V=(await Promise.all(w.map(F=>this.schedule(F,v.results,p)))).filter(F=>!!F),B=V.filter(F=>!!F).find(F=>F.value===H.CaughtError||F.value===H.UnhandledError||F.value===H.Return||F.value===H.Break||F.value===H.Continue);return B||($=[...$,...V],v)}else{if(v.value===H.UnhandledError)return this.executing.forEach(w=>{this.skip(w)}),this.scheduled.forEach(w=>{this.skip(w)}),vi.includes(v.entity.type)&&nt(v.entity).forEach(w=>{this.skip(w)}),v;if(v.value===H.Return)return v;if(v.value===H.Break)return v;if(v.value===H.Continue)return v}return v}async execute(r={},a=[]){const o={...no,...r};this.state="running";const p=await this.executeBranch(this.entryPoint,o,a);return this.state="finished-success",p}addEntity(r){var a;this.entities.includes(r)||(this.entities.push(r),(a=this.onAddEntityCallback)==null||a.call(this,r))}addEntities(r){r.forEach(a=>this.addEntity(a))}removeEntity(r){var a;if(r!==this.entryPoint){const o=this.entities.indexOf(r);o>-1&&(this.entities.splice(o,1),(a=this.onRemoveEntityCallback)==null||a.call(this,r))}}hasEntity(r){var p,e,y;if(this.entities.includes(r))return!0;if(((p=r.parent)==null?void 0:p.type)===f.FunctionDeclaration&&((y=(e=r.parent)==null?void 0:e.parent)==null?void 0:y.type)===f.DefinitionEntity)return this.entities.includes(r.parent);const a=fr(r);if(!a)return!1;const o=a.type===f.Loop&&r.parent===a.body?a.body:null;return o?this.entities.includes(o)||this.entities.includes(a):this.entities.includes(a)}removeScheduled(r){const a=this.scheduled.indexOf(r);a>-1&&this.scheduled.splice(a,1)}hasScheduled(r){return!!this.scheduled.includes(r)}hasSkipped(r){return!!this.skipped.includes(r)}hasExecuted(r){return!!this.executed.includes(r)}hasEntityWithId(r){const a=this.project.get(r);return a?this.hasEntity(a):!1}onAddToSkippedList(r){this.onAddToSkippedListCallback=r}onAbortExecution(r){this.onAbortExecutionCallback=r}onAddEntity(r){this.onAddEntityCallback=r}onRemoveFromSkippedList(r){this.onRemoveFromSkippedListCallback=r}onRemoveEntity(r){this.onRemoveEntityCallback=r}addToExecutingList(r){this.executing.includes(r)||this.executing.push(r)}addToScheduledList(r){this.scheduled.includes(r)||this.scheduled.push(r)}removeFromScheduledList(r){const a=this.scheduled.indexOf(r);a>-1&&this.scheduled.splice(a,1)}removeFromExecutingList(r){var o;const a=this.executing.indexOf(r);a>-1&&(this.executing.splice(a,1),(o=this.onAbortExecutionCallback)==null||o.call(this,r))}removeFromAlreadyExecutedList(r){const a=this.executed.indexOf(r);a>-1&&this.executed.splice(a,1)}removeFromSkippedList(r){var o;const a=this.skipped.indexOf(r);a>-1&&(this.skipped.splice(a,1),(o=this.onRemoveFromSkippedListCallback)==null||o.call(this,r))}addToAlreadyExecutedList(r){this.executed.includes(r)||this.executed.push(r)}addToSkippedList(r){var a;this.skipped.includes(r)||(this.skipped.push(r),(a=this.onAddToSkippedListCallback)==null||a.call(this,r))}}function kme(d){var u,r;if(d.isList)return"list";if(((u=d.entity)==null?void 0:u.type)===f.DefinitionEntity)return"definition-entity";switch((r=d.entity)==null?void 0:r.name){case oe.Number:return"number";case oe.String:return"text";case oe.Boolean:return"boolean";case oe.UUID:return"uuid";case oe.Date:return"date-time";default:return"definition-entity"}}const Vs={[f.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[f.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[f.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[f.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[f.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[f.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[f.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[f.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[f.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[f.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[f.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[f.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[f.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[f.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[f.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[f.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[f.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[f.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[f.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[f.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[f.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[f.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[f.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[f.ReturnDeclaration]:{singular:"Output definition",plural:"Output definitions",shortSingular:"Output",shortPlural:"Outputs"},[f.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"},[f.DataType]:{singular:"Data type",plural:"Data types",shortSingular:"Data type",shortPlural:"Data types"},[f.LiteralValue]:{singular:"Literal value",plural:"Literal values",shortSingular:"Value",shortPlural:"Values"}};function QI(d){const u=Om(d);if(!u){const a=Zd(d);if(a.includes(Le.HTTP_ENDPOINT))return"HTTP endpoint";if(a.includes(Le.PERSISTED_ENTITY))return"Persisted entity";if(a.includes(Le.CRON_JOB))return"Scheduled execution";if(a.includes(Le.RELATIONAL_DATABASE))return"Relational database"}if(u){let a="Extension of "+Y(u,u.project)+" entity",o=Rd(a);const p=Zd(d);return p.includes(Le.HTTP_ENDPOINT)?"HTTP endpoint"+(o?", "+o:""):p.includes(Le.PERSISTED_ENTITY)?"Persisted entity"+(o?", "+o:""):p.includes(Le.CRON_JOB)?"Scheduled execution"+(o?", "+o:""):p.includes(Le.RELATIONAL_DATABASE)?"Relational database"+(o?", "+o:""):a}let r="";return d.abstract&&(r="Template "),d.static&&(r+=r?" single copy ":"Single copy "),r?r+"definition":"Definition"}function u3(d){return d.parent.type===f.DefinitionEntity||d.parent.type===f.InstalledProject?"Internal action of "+Y(d.parent,d.project):d.parent.type===f.Loop?"Action repeated on every iteration":"Internal action of entity"}function eA(d){return bb(d)?u3(d):"Custom trigger"}function qme(d){var u;switch(d.type){case f.DefinitionEntity:return QI(d);case f.FunctionDeclaration:return eA(d)}return(u=Vs[d.type])==null?void 0:u.singular}function Hme(d){var u;switch(d.type){case f.DefinitionEntity:return QI(d);case f.FunctionDeclaration:return eA(d)}return(u=Vs[d.type])==null?void 0:u.singular}const tA=4e4,c3=280,Zme=300,rA=65,Vd=32,Cy=39,p3=26,f3=49,$y=44,Jme=35,Py=52,iA=10,Ca=iA*2,Ny=38,Vy=90,sA=270,h3=tA/2+120,y3=tA/2+180;function m3(d){let r=Vd+$y+Ny+iA;const a=[...d.inputs];return a.length&&(r+=Ca,a.forEach(()=>{r+=p3})),{height:r,width:280}}function v3(d){let r=rA;const a=[];if([f.DefinitionEntity].includes(d.type)){const v=[...d.suggestedProperties||[],...d.properties||[]];v.length&&(r+=Ca,v.forEach(E=>{r+=E.static?f3:Cy}))}if([f.DefinitionEntity,f.InstalledProject,f.Loop].includes(d.type)){const v=[...(d==null?void 0:d.suggestedMethods)||[],...d.methods||[],...d.functions||[],...d.body?[d.body]:[]];v.length&&(r+=Ca,v.forEach(E=>{const w=m3(E);r+=w.height}))}ir.includes(d.type)?(Tt.includes(d.type)?a.push(...(d.usedInputs||[]).flatMap(v=>[v])||[]):a.push(...(d.inputs||[]).flatMap(v=>[v])||[]),d.error&&(r+=Py)):[f.ReturnStatement,f.BreakStatement,f.ContinueStatement].includes(d.type)?(a.push(...d.outputs||[]),d.throws&&(r+=Py)):d.type===f.Condition&&(a.push(d.inputs[0]),d.inputs[1]&&a.push(d.inputs[1]));const o=a.length;o&&(r+=o*Cy,r+=Ca);const p=[];if(d.type===f.FunctionDeclaration||d.type===f.GlobalEvent?p.push(...d.inputs||[]):ir.includes(d.type)&&(Tt.includes(d.type)?p.push(...d.usedOutputs||[]):p.push(...d.outputs||[])),Tt.includes(d.type)){d.readsValue&&(r+=Ca,r+=$y),d.writesValues.length&&(r+=Ca,r+=$y),d.internalCalls.length&&d.usedInternalCalls.forEach(()=>r+=Py+Ca);const v=d.getDataType(null);(!v||v.inferred)&&(r+=Ny)}const e=p.length;return e&&(r+=e*Cy,r+=Ca),[f.DefinitionEntity,f.FunctionDeclaration,f.ReturnStatement,f.BreakStatement,f.ContinueStatement].includes(d.type)&&(r+=Ny),{height:r,width:280}}function Cc(d){return`${d.split("-").map((a,o)=>o===0?a.charAt(0).toUpperCase()+a.slice(1):a.toLowerCase()).join(" ")}.`}function Wme(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 se.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case se.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 se.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 se.InternalCallDeclarationIsNotFunctionDeclaration:return"This internal call is not an action";case se.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case se.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case se.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case se.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 se.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case se.EmptyName:return"This entity has no name";case se.InvalidObjectStructure:return"This entity has an invalid structure";case se.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case se.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case se.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case se.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case se.MissingCaller:return"This action is missing a caller";case se.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case se.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case se.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case se.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case se.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case se.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case se.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case se.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case ta.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case ta.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case vs.UUIDMustBeString:return`UUID must be a string, eg: "${cl()}"`;case vs.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${cl()}"`;case vs.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${cl()}"`;case ki.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case ki.StringValueMustNotHaveDashes:return"This value must not contain dashes";case ki.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return Cc(d.code)}}function Yme(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 se.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case se.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case re.MissingMethodImplementation:return"Missing action";case re.MissingPropertyImplementation:return"Missing property";case se.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 se.InternalCallDeclarationIsNotFunctionDeclaration:return"Declaration not an action";case se.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case se.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case se.InternalCallParentMissingDataType:return"Parent has no data type";case se.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case se.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 se.EmptyName:return"Empty name";case se.InvalidObjectStructure:return"Invalid object structure";case se.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case se.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case se.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case se.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case se.MissingCaller:return"Missing caller";case se.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case se.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case se.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case se.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case se.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case se.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case se.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case se.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case ta.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case ta.StatusCodeMustBeNumber:return"HTTP status code must be a number";case vs.UUIDMustBeString:return"UUID must be a string";case vs.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case vs.UUIDMustBeValidFormat:return"UUID must be in a valid format";case ki.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case ki.StringValueMustNotHaveDashes:return"This value must not contain dashes";case ki.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return Cc(d.code)}}function zme(d){switch(d.code){case re.AbstractEntityWithNonAbstractMethods:return`${Y(d.entity,d.entity.project)} has non-template actions`;case re.AbstractEntityWithNonAbstractProperties:return`${Y(d.entity,d.entity.project)} has non-template properties`;case re.IncorrectEntityImplementation:return`${Y(d.entity,d.entity.project)} incorrectly implements template`;case re.IncorrectMethodImplementation:return`${Y(d.entity,d.entity.project)} incorrectly implements the template`;case re.IncorrectPropertyImplementation:return`${Y(d.entity,d.entity.project)} incorrectly implements the template`;case re.AbstractMethodInNonAbstractEntity:return`${Y(d.entity,d.entity.project)} can't be a template`;case re.AbstractPropertyInNonAbstractEntity:return`${Y(d.entity,d.entity.project)} can't be a template`;case se.MethodOverwritesOtherSiblingWithSameName:return`${Y(d.entity,d.entity.project)} overwrites action`;case se.PropertyOverwritesOtherSiblingWithSameName:return`${Y(d.entity,d.entity.project)} overwrites property`;case re.MissingMethodImplementation:return`${Y(d.entity,d.entity.project)} is missing action`;case re.MissingPropertyImplementation:return`${Y(d.entity,d.entity.project)} is missing property`;case se.NameNotUniqueInScope:return`${Y(d.entity,d.entity.project)} name is not unique`;case re.NoProperties:return`${Y(d.entity,d.entity.project)} has no properties`;case re.NonStaticPropertyInStaticEntity:return`${Y(d.entity,d.entity.project)} has non-static property`;case re.StaticEntityWithNonStaticProperties:return`${Y(d.entity,d.entity.project)} has non-static properties`;case re.ReadingFromIncompatibleType:return`${Y(d.entity,d.entity.project)} reads from different type`;case re.WritingToIncompatibleType:return`${Y(d.entity,d.entity.project)} writes to different type`;case re.ScopeWithoutLogic:return`${Y(d.entity,d.entity.project)} has no logic`;case re.NonStaticPropertyImplementsStatic:return`${Y(d.entity,d.entity.project)} has invalid static property`;case re.PropertyImplementsIncompatibleType:return`${Y(d.entity,d.entity.project)} has incompatible data type`;case re.PropertyImplementsNonAbstact:return`${Y(d.entity,d.entity.project)} has non-template property`;case re.StaticPropertyImplementsNonStatic:return`${Y(d.entity,d.entity.project)} has non-static property`;case re.VariableCallsOthersAndHasInternalCall:return`${Y(d.entity,d.entity.project)} has bad internal call`;case re.VariableHasInputsAndInternalCall:return`${Y(d.entity,d.entity.project)} has bad internal call`;case re.VariableHasOutputsAndInternalCall:return`${Y(d.entity,d.entity.project)} has bad internal call`;case re.VariableIsCalledAndHasInternalCall:return`${Y(d.entity,d.entity.project)} has bad internal call`;case se.InternalCallDeclarationIsNotFunctionDeclaration:return`${Y(d.entity,d.entity.project)} has declaration that is not an action`;case se.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${Y(d.entity,d.entity.project)} has declaration that is not found in parent`;case se.InternalCallParentDeclarationEntityInvalidType:return`${Y(d.entity,d.entity.project)} has invalid parent declaration type`;case se.InternalCallParentMissingDataType:return`${Y(d.entity,d.entity.project)}'s parent has no data type`;case se.InternalCallDeclarationNotInParentDatatypeEntity:return`${Y(d.entity,d.entity.project)} has declaration that is not in parent`;case se.UnreachableEntity:return`${Y(d.entity,d.entity.project)} is unreachable`;case re.DisconnectedCallableEntity:return`${Y(d.entity,d.entity.project)} is not executed by any entity`;case re.AbstractEntityImplements:return`${Y(d.entity,d.entity.project)} implements a non-template entity`;case re.AbstractExtendingNonAbstractEntity:return`${Y(d.entity,d.entity.project)} extends a non-template entity`;case re.InvalidPropertiesCombination:return`${Y(d.entity,d.entity.project)} has invalid properties combination`;case re.ExtendingNonInteractiveEntity:return`${Y(d.entity,d.entity.project)} extends a non-interactive entity`;case re.ExtendsIncompatibleEntities:return`${Y(d.entity,d.entity.project)} extends incompatible entities`;case re.ImplementingNonAbstractEntity:return`${Y(d.entity,d.entity.project)} implements a non-template entity`;case re.ImplementsIncompatibleEntities:return`${Y(d.entity,d.entity.project)} implements incompatible entities`;case re.LackingReturnStatementOnSomeBranches:return`${Y(d.entity,d.entity.project)} is missing termination on some branches`;case re.LastCalledEntityMustBeReturnEntity:return`${Y(d.entity,d.entity.project)}'s last called entity must be a termination node`;case re.MissingRequiredValue:return`${Y(d.entity,d.entity.project)} is missing a required value`;case re.NoPrimaryKeyProperty:return`${Y(d.entity,d.entity.project)} has no primary key property`;case re.NonAbstractExtendingAbstractEntity:return`${Y(d.entity,d.entity.project)} extends a template entity`;case re.NonStaticExtendingStaticEntity:return`${Y(d.entity,d.entity.project)} extends a static entity`;case re.NonStaticImplementingStaticEntity:return`${Y(d.entity,d.entity.project)} implements a static entity`;case re.StaticExtendingNonStaticEntity:return`${Y(d.entity,d.entity.project)} extends a non-static entity`;case re.StaticImplementingNonStaticEntity:return`${Y(d.entity,d.entity.project)} implements a non-static entity`;case re.VariableReadsValueAndInternalCall:return`${Y(d.entity,d.entity.project)} reads a value and has internal call`;case re.VariableWritesValuesAndInternalCall:return`${Y(d.entity,d.entity.project)} writes values and has internal call`;case se.EmptyName:return`${Vs[d.entity.type]} has no name`;case se.InvalidObjectStructure:return`${Y(d.entity,d.entity.project)} has invalid structure`;case se.LoopBodyFunctionOverwrite:return`${Y(d.entity,d.entity.project)}'s loop body action overwrites an action`;case se.MethodOverwritesBaseMethodWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites base action`;case se.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites another action with same implementation`;case se.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites another action with same implementation`;case se.MissingCaller:return`${Y(d.entity,d.entity.project)} is missing a caller`;case se.NameAsResolvedCodeNameNotUniqueInScope:return`${Y(d.entity,d.entity.project)} has a name not unique in the scope`;case se.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${Y(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case se.NameMustStartWithLetterOrUnderscore:return`${Y(d.entity,d.entity.project)} name must start with letter or underscore`;case se.NoOverlapWithImplementedSignature:return`${Y(d.entity,d.entity.project)} has no overlap with implemented signature`;case se.PropertyOverwritesBasePropertyWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites base property`;case se.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites another property with same implementation`;case se.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites another property with same implementation`;case se.ReaderWriterIncompatibleDataType:return`${Y(d.entity,d.entity.project)} has reader/writer with incompatible data type`;case ta.StatusCodeMustBeBetween100And599:return`${Y(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case ta.StatusCodeMustBeNumber:return`${Y(d.entity,d.entity.project)} HTTP status code must be a number`;case vs.UUIDMustBeString:return`${Y(d.entity,d.entity.project)} UUID must be a string`;case vs.UUIDMustNotContainSpaces:return`${Y(d.entity,d.entity.project)} UUID must not contain spaces`;case vs.UUIDMustBeValidFormat:return`${Y(d.entity,d.entity.project)} UUID must be in a valid format`;case ki.MustBeUniqueAmongSameEntities:return`${Y(d.entity,d.entity.project)} value must be unique among the same kind`;case ki.StringValueMustNotHaveDashes:return`${Y(d.entity,d.entity.project)} value must not contain dashes`;case ki.StringValueMustNotHaveSpaces:return`${Y(d.entity,d.entity.project)} value must not contain spaces`;default:return`${Y(d.entity,d.entity.project)} Error: ${Cc(d.code)}`}}function Xme(d){var u,r,a,o;switch(d.code){case re.AbstractEntityWithNonAbstractMethods:return`${Y(d.entity,d.entity.project)} has non-template actions`;case re.AbstractEntityWithNonAbstractProperties:return`${Y(d.entity,d.entity.project)} has non-template properties`;case re.IncorrectEntityImplementation:return`${Y(d.entity,d.entity.project)} incorrectly implements the template entity`;case re.IncorrectMethodImplementation:return`${Y(d.entity,d.entity.project)} incorrectly implements the template action it's based on`;case re.IncorrectPropertyImplementation:return`${Y(d.entity,d.entity.project)} incorrectly implements the template property it's based on`;case re.AbstractMethodInNonAbstractEntity:return`${Y(d.entity,d.entity.project)} is a template action in a non-template entity`;case re.AbstractPropertyInNonAbstractEntity:return`${Y(d.entity,d.entity.project)} is a template property in a non-template entity`;case se.MethodOverwritesOtherSiblingWithSameName:return`${Y(d.entity,d.entity.project)} overwrites an action in the template entity`;case se.PropertyOverwritesOtherSiblingWithSameName:return`${Y(d.entity,d.entity.project)} overwrites a property in the template entity`;case re.MissingMethodImplementation:return`${Y(d.entity,d.entity.project)} is missing an action implementation from the template entity`;case re.MissingPropertyImplementation:return`${Y(d.entity,d.entity.project)} is missing a property implementation from the template entity`;case se.NameNotUniqueInScope:return`${Y(d.entity,d.entity.project)} has a duplicate name in the same scope`;case re.NoProperties:return`${Y(d.entity,d.entity.project)} has no properties, so it doesn't do anything`;case re.NonStaticPropertyInStaticEntity:return`${Y(d.entity,d.entity.project)} has a non-static property in a static entity`;case re.StaticEntityWithNonStaticProperties:return`${Y(d.entity,d.entity.project)} has non-static properties in a static entity`;case re.ReadingFromIncompatibleType:return`${Y(d.entity,d.entity.project)} reads data from a value of a different data type`;case re.WritingToIncompatibleType:return`${Y(d.entity,d.entity.project)} writes data to a value of a different data type`;case re.ScopeWithoutLogic:return`${Y(d.entity,d.entity.project)} has no logic`;case re.NonStaticPropertyImplementsStatic:return`${Y(d.entity,d.entity.project)} has a static property in a non-static entity`;case re.PropertyImplementsIncompatibleType:return`${Y(d.entity,d.entity.project)} implements a property of a different data type`;case re.PropertyImplementsNonAbstact:return`${Y(d.entity,d.entity.project)} implements a non-template property`;case re.StaticPropertyImplementsNonStatic:return`${Y(d.entity,d.entity.project)} has a static property in a non-static entity`;case re.VariableCallsOthersAndHasInternalCall:return`${Y(d.entity,d.entity.project)} calls other entities while being used to execute internal logic`;case re.VariableHasInputsAndInternalCall:return`${Y(d.entity,d.entity.project)} has inputs while being used to execute internal logic`;case re.VariableHasOutputsAndInternalCall:return`${Y(d.entity,d.entity.project)} has outputs while being used to execute internal logic`;case re.VariableIsCalledAndHasInternalCall:return`${Y(d.entity,d.entity.project)} is called while being used to execute internal logic`;case se.InternalCallDeclarationIsNotFunctionDeclaration:return`${Y(d.entity,d.entity.project)} has a declaration that is not an action`;case se.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${Y(d.entity,d.entity.project)} has a declaration that is not found in ${(u=d.entity.parent.getDataType(null))!=null&&u.entity?Y((r=d.entity.parent.getDataType(null))==null?void 0:r.entity,d.entity.project):"the variable's data-type entity"}`;case se.InternalCallParentDeclarationEntityInvalidType:return`${Y(d.entity,d.entity.project)} is part of a variable whos data-type entity can't have actions`;case se.InternalCallParentMissingDataType:return`${Y(d.entity,d.entity.project)} is part of a variable with no data-type entity`;case se.InternalCallDeclarationNotInParentDatatypeEntity:return`${Y(d.entity,d.entity.project)} has a declaration doesn't belong to ${(a=d.entity.parent.getDataType(null))!=null&&a.entity?Y((o=d.entity.parent.getDataType(null))==null?void 0:o.entity,d.entity.project):"the variable's data-type entity"}`;case se.UnreachableEntity:return`${Y(d.entity,d.entity.project)} is unreachable`;case re.DisconnectedCallableEntity:return`${Y(d.entity,d.entity.project)} is disconnected and won't be executed by anything after publishing`;case re.AbstractEntityImplements:return`${Y(d.entity,d.entity.project)} implements a non-template entity`;case re.AbstractExtendingNonAbstractEntity:return`${Y(d.entity,d.entity.project)} extends a non-template entity`;case re.InvalidPropertiesCombination:return`${Y(d.entity,d.entity.project)} has an invalid combination of properties`;case re.ExtendingNonInteractiveEntity:return`${Y(d.entity,d.entity.project)} extends a non-interactive entity`;case re.ExtendsIncompatibleEntities:return`${Y(d.entity,d.entity.project)} extends incompatible entities`;case re.ImplementingNonAbstractEntity:return`${Y(d.entity,d.entity.project)} implements a non-template entity`;case re.ImplementsIncompatibleEntities:return`${Y(d.entity,d.entity.project)} implements incompatible entities`;case re.LackingReturnStatementOnSomeBranches:return`${Y(d.entity,d.entity.project)} has branches that don't terminate`;case re.LastCalledEntityMustBeReturnEntity:return`${Y(d.entity,d.entity.project)} must end with a termination node`;case re.MissingRequiredValue:return`${Y(d.entity,d.entity.project)} is missing a required value`;case re.NoPrimaryKeyProperty:return`${Y(d.entity,d.entity.project)} has no primary key property`;case re.NonAbstractExtendingAbstractEntity:return`${Y(d.entity,d.entity.project)} is a non-template entity extending a template entity`;case re.NonStaticExtendingStaticEntity:return`${Y(d.entity,d.entity.project)} is a non-static entity extending a static entity`;case re.NonStaticImplementingStaticEntity:return`${Y(d.entity,d.entity.project)} is a non-static entity implementing a static entity`;case re.StaticExtendingNonStaticEntity:return`${Y(d.entity,d.entity.project)} is a static entity extending a non-static entity`;case re.StaticImplementingNonStaticEntity:return`${Y(d.entity,d.entity.project)} is a static entity implementing a non-static entity`;case re.VariableReadsValueAndInternalCall:return`${Y(d.entity,d.entity.project)} reads a value and has an internal call`;case re.VariableWritesValuesAndInternalCall:return`${Y(d.entity,d.entity.project)} writes values and has an internal call`;case se.EmptyName:return`${Vs[d.entity.type]} has no name`;case se.InvalidObjectStructure:return`${Y(d.entity,d.entity.project)} has an invalid structure`;case se.LoopBodyFunctionOverwrite:return`${Y(d.entity,d.entity.project)}'s loop body action overwrites`;case se.MethodOverwritesBaseMethodWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites a base action with same implementation`;case se.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites another action with same implementation`;case se.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites another action with same implementation`;case se.MissingCaller:return`${Y(d.entity,d.entity.project)} is missing a caller`;case se.NameAsResolvedCodeNameNotUniqueInScope:return`${Y(d.entity,d.entity.project)} has a name that is not unique in the scope`;case se.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${Y(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case se.NameMustStartWithLetterOrUnderscore:return`${Y(d.entity,d.entity.project)} name must start with letter or underscore`;case se.NoOverlapWithImplementedSignature:return`${Y(d.entity,d.entity.project)} has no overlap with implemented signature`;case se.PropertyOverwritesBasePropertyWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites a base property with same implementation`;case se.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites another property with same implementation`;case se.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites another property with same implementation`;case se.ReaderWriterIncompatibleDataType:return`${Y(d.entity,d.entity.project)} has a reader/writer with incompatible data type`;case ta.StatusCodeMustBeBetween100And599:return`${Y(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case ta.StatusCodeMustBeNumber:return`${Y(d.entity,d.entity.project)} HTTP status code must be a number, between 100 and 599`;case vs.UUIDMustBeString:return`${Y(d.entity,d.entity.project)} UUID must be a string, eg: "${cl()}"`;case vs.UUIDMustNotContainSpaces:return`${Y(d.entity,d.entity.project)} UUID must not contain spaces, eg: "${cl()}"`;case vs.UUIDMustBeValidFormat:return`${Y(d.entity,d.entity.project)} UUID must be in a valid format. Eg: "${cl()}"`;case ki.MustBeUniqueAmongSameEntities:return`${Y(d.entity,d.entity.project)} value must be unique among the same kind`;case ki.StringValueMustNotHaveDashes:return`${Y(d.entity,d.entity.project)} value must not contain dashes`;case ki.StringValueMustNotHaveSpaces:return`${Y(d.entity,d.entity.project)} value must not contain spaces`;default:return`${Y(d.entity,d.entity.project)} Error: ${Cc(d.code)}`}}var nA=(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))(nA||{});const Qme=Object.values(nA);var aA=(d=>(d.NotPartOfOngoingTest="not-part-of-ongoing-test",d.CannotBeAddedToTest="cannot-be-added-to-test",d))(aA||{});const e0e=Object.values(aA);var oA=(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))(oA||{});const t0e=Object.values(oA);function r0e(d,u){const r=[...d,...u];return Array.from(new Set(r))}function i0e(d,u){const r=[...d,...u],a=Array.from(new Set(r));return{hasChanged:a.length!==d.length,reasons:a}}function s0e(d,u){const r=d.filter(o=>!u.includes(o));return{hasChanged:r.length!==d.length,reasons:r}}function n0e(d,u){return d.find(r=>r.entity.id===u)||null}function E3(d){return d.filter((u,r)=>d.indexOf(u)===r)}class bi{constructor(u,r,a=null,o){_(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=r,this.entity=u,this.calculationEntryPoint=a||this,this===this.calculationEntryPoint&&!o)throw new Error("Change set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(u,r,a){const o=h3-sA-c3,p=y3-Vy-rA;u.metaSync({x:u.x||o,y:u.y||p},r);const e=new bi(u,0,null,r);e._onlyEntities=a||[],e.ids=["0"];const y=[];e.next(E=>{y.push(...E)}),bi.recursivelyAssembleChildrenAreas(y),e.resolveChildrenOverlaps();const v=e.flattenChildEntities();return e._onlyEntities?v.filter(E=>(e._onlyEntities||[]).includes(E)):v}static recursivelyAssembleChildrenAreas(u){const r=[];u.forEach(a=>{a.next(o=>{r.push(...o)})}),r.length>0&&bi.recursivelyAssembleChildrenAreas(r)}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 r=this.children.find(o=>o.entity===u);return r||this.children.reduce((o,p)=>o||p.findAreaInChildrenFromEntity(u),null)}findAreaFromEntity(u){if(this.entity===u)return this;const r=this.calculationEntryPoint.children,a=r.find(p=>p.entity===u);return a||r.reduce((p,e)=>p||e.findAreaInChildrenFromEntity(u),null)}addParent(u){if(!this.parents.includes(u)){const r=bi.resolveIds(u,this.index);this.ids.push(...r),this.parents.push(u)}}static resolveIds(u,r){return u?u.ids.map(a=>`${a}-${r}`):[`${r}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const u=bn(this.entity,!0);if(this.entity.type===f.Project){const r=[],a=[],o=[];u.forEach(e=>{if(f.DefinitionEntity===e.type){a.push(e);return}else if(Dt.includes(e.type)){o.push(e);return}r.push(e)});const p=r.sort((e,y)=>{const v=!!Tm(e,y).length,E=bn(e),w=bn(y);return v?0:E.length&&!w.length?-1:!E.length&&w.length?1:0}).filter(e=>!Ao(e).length);this.childEntities=[...a,...o,...p]}else{const r=[],a=[],o=[],p=[],e=[];vi.includes(this.entity.type)&&bm(this.entity).forEach(E=>{if(Tt.includes(E.type)){o.push(E);return}const w=fr(E);r.push(w)}),Nr.includes(this.entity.type)&&a.push(...this.entity.detachedChildren);const y=u.filter(v=>{const E=r.includes(v);return E||o.includes(v)||a.includes(v)?!1:Tt.includes(v.type)?(o.push(v),!1):$i.includes(v.type)&&!E?(p.push(v),!1):v.type===f.DefinitionEntity?(e.push(v),!1):!0});r.sort((v,E)=>Il(v,E)?-1:0),p.sort((v,E)=>Il(v,E)?-1:0),o.sort((v,E)=>hb(v,E)?1:hb(E,v)?-1:0),this.childEntities=[...e,...r,...p,...y,...o,...a]}}calculateCardSize(){const u=v3(this.entity);this.entityCardWidth=u.width,this.entityCardHeight=u.height}static getBoundriesOfTwoAreas(u,r){return{top:Math.min(u.top,r.top),left:Math.min(u.left,r.left),bottom:Math.max(u.bottom,r.bottom),right:Math.max(u.right,r.right)}}static getBoundriedOfCombinedAreas(u,r){const a=u.filter(p=>!r.includes(p));return a.reduce((p,e)=>r.includes(e)?p:bi.getBoundriesOfTwoAreas(p,e.fullBranchArea),a[0].fullBranchArea)}getFullAreaUntilAny(u){const r=this.ownEntityPlusBufferArea;return this.children.filter(e=>!u.includes(e)).map(e=>e.getFullAreaUntilAny(u)).reduce((e,y)=>bi.getBoundriesOfTwoAreas(e,y),r)}getFullAreaUntilAreaOrAnyChildren(u){const r=[u,...u.flattenChildren()],a=this.ownEntityPlusBufferArea;return this.children.filter(e=>r.includes(e)).map(e=>e.getFullAreaUntil(u)).reduce((e,y)=>bi.getBoundriesOfTwoAreas(e,y),a)}getFullAreaUntil(u){const r=this.ownEntityPlusBufferArea;return this.children.filter(p=>p!==u).map(p=>p.getFullAreaUntil(u)).reduce((p,e)=>bi.getBoundriesOfTwoAreas(p,e),r)}get fullBranchArea(){const u=this.ownEntityPlusBufferArea;return this.children.map(o=>o.fullBranchArea).reduce((o,p)=>bi.getBoundriesOfTwoAreas(o,p),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+Vy,right:u.right+sA}}static filterOutRepeatedAreas(u){return u.filter((r,a)=>u.indexOf(r)===a)}getEarliestId(u,r){const a=u.split("-"),o=r.split("-");return a.length<o.length?u:a.length>o.length?r:a.reduce((e,y,v)=>y<o[v]?u:r,u)}getEarliestLevel(){return this.ids.reduce((a,o)=>this.getEarliestId(a,o),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((o,p)=>p.getEarliestLevel()>o.getEarliestLevel()?p:o,this.parents[0]).countColumns();return u+=a,u}getLatestId(u,r){if(u===r)return u;const a=u.split("-"),o=r.split("-");return a.length<o.length?r:a.length>o.length?u:a.reduce((e,y,v)=>y>o[v]?u:r,u)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((a,o)=>this.getLatestId(a,o),this.ids[0]).split("-").length}smoothPosition(){const u=this.flattenSiblings();if(!u.length&&this.parents.length<=1&&this.children.length){const r=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(a=>{a!==this.calculationEntryPoint&&a.shiftDownAlone(r)})}else if([...Dt].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const r=u.filter(a=>!this.parents.includes(a));r.length?r.every(o=>{const p=this.countColumns(),e=o.countColumns();return p>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():r.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(u,r){if(u.includes(this))return u;this.move(this.entity,{y:this.entity.y+r});let a=[...u,this];return this.children.forEach(o=>{if(bi.getEarliestParentInChain(o)!==this)return;const e=n0e(a,o.entity.id);a=bi.filterOutRepeatedAreas([...a]),e||(a=a.filter(v=>v!==o));const y=o.shiftDownUntilAny(a,r);a.push(...y)}),a}shiftRightUntilAny(u,r){u.includes(this)||(this.move(this.entity,{x:this.entity.x+r}),this.children.forEach(a=>{const o=bi.filterOutRepeatedAreas([...this.flattenSiblings(),...u]);bi.getEarliestParentInChain(a)===this&&a.shiftRightUntilAny(o,r)}))}shiftRight(u){this.move(this.entity,{x:this.entity.x+u}),this.children.forEach(r=>{const o=r.flattenSiblings().filter(p=>p!==r);r.shiftRightUntilAny(o,u)})}shiftDownAlone(u){this.move(this.entity,{y:this.entity.y+u})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const u=this.parents.reduce((o,p)=>{const e=p.ownEntityArea,y=e.top+Vd,v={top:y,left:e.left,bottom:y,right:e.right};return bi.getBoundriesOfTwoAreas(o,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-Vd;this.shiftDownAlone(a)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const u=this.children.reduce((o,p)=>{const e=p.ownEntityArea,y=e.top+Vd,v={top:y,left:e.left,bottom:y,right:e.right};return bi.getBoundriesOfTwoAreas(o,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-Vd;return this.shiftDownAlone(a),a}resolveChildrenOverlaps(){const u=this.flattenChildren();let r=[];u.forEach(a=>{const o=a.adjustVerticallyToAvoidOverlaps();r.push(...o)}),u.forEach(a=>{a.smoothPosition()})}static getEarliestParentInChain(u){let r=u.parents[0];return u.parents.length&&(r=u.parents.sort((a,o)=>{if(!a.ids.length)return-1;if(!o.ids.length)return 1;const p=a.ids.sort((y,v)=>y.length<v.length?-1:0),e=o.ids.sort((y,v)=>y.length<v.length?-1:0);return p[0].length-e[0].length})[0]),r}flattenEarlierSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((a,o)=>{if(u.has(o.entity.id))return a;u.add(o.entity.id);const e=o.children.slice(0,o.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,o)=>{if(u.has(o.entity.id))return a;u.add(o.entity.id);const e=o.children.filter(y=>y!==this).reduce((y,v)=>[...y,v,...v.flattenChildren(u)],[]);return[...a,...e]},[])}flattenChildren(u=new Set){return this.children.reduce((r,a)=>u.has(a.entity.id)?r:(u.add(a.entity.id),[...r,a,...a.flattenChildren(u)]),[])}flattenParents(u=new Set){return this.parents.reduce((a,o)=>u.has(o.entity.id)?a:(u.add(o.entity.id),[...a,o,...o.flattenParents(u)]),[])}getAreaIfRendered(u){return this.calculationEntryPoint.flattenChildren().find(o=>o.entity.id===u.id)||null}getLowerSiblings(){const u=this.parents.reduce((r,a)=>{const o=a.children.indexOf(this),p=a.children.slice(o+1);return[...r,...p]},[]);return E3(u)}getLowerAreas(){const u=this.getLowerSiblings(),r=this.parents.reduce((a,o)=>[...a,...o.getLowerAreas()],[]);return E3([...u,...r])}adjustVerticallyToAvoidOverlaps(u=[]){const a=bi.getEarliestParentInChain(this).children[this.index-1];if(!a)return u;const o=this.flattenEarlierSiblings(),p=this.flattenParents(),e=[...o,...p,a],E=R(e.flatMap(V=>Tm(this.entity,V.entity))).filter(V=>V.id!==this.entity.id).map(V=>this.findAreaFromEntity(V)).filter(V=>!!V),w=this.getFullAreaUntilAny(E),A=a.getFullAreaUntilAny(E),$=e.reduce((V,B)=>B===this||B.fullBranchArea.left!==w.left?V:Math.max(V,B.fullBranchArea.bottom),A.bottom);if(w.top<$){const V=$-w.top+Vy;return this.shiftDownUntilAny(u,V)}return u}move(u,r){(this.onlyEntities||[]).includes(u)&&u.metaSync(r,this.changeSet)}addChild(u){const r=this.childEntities[u];let a=null;r.x&&r.y?a=this.getAreaIfRendered(r):!r.x&&!r.y&&this.move(r,{x:this.entity.x,y:this.entity.y}),a||(a=new bi(r,u,this.calculationEntryPoint));const o=this.ownEntityPlusBufferArea;this.children.includes(a)||(this.children.push(a),a.addParent(this));const p=a.fullBranchArea;if(p.left<o.right){const e=o.right-p.left;a.shiftRight(e)}return a}flattenChildEntities(u=new Set){return this.children.reduce((r,a)=>u.has(a.entity.id)?r:(u.add(a.entity.id),[...r,a.entity,...a.flattenChildEntities(u)]),[])}next(u){const r=[];this.childEntities.forEach((a,o)=>{const p=this.addChild(o);p&&r.push(p)}),u(r)}}var $c=(d=>(d.Amazon="amazon",d.Google="google",d.Microsoft="microsoft",d))($c||{}),kr=(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))(kr||{}),lA=(d=>(d.Post="post",d.Get="get",d.Acknowledgement="acknowledgment",d.Progress="progress",d.Error="error",d.Complete="complete",d))(lA||{}),hl=(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))(hl||{}),dA=(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))(dA||{}),yt=(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))(yt||{}),vn=(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))(vn||{});kr.CloudHostedCodebase,kr.HttpApi,kr.RelationalDatabase,kr.CloudHostedCodebase,kr.CloudHostedCodebase,kr.RelationalDatabase,kr.CloudHostedCodebase,kr.CloudHostedCodebase;function T3(d){return`project-${d}-http-api`}function I3(d){return`entity-${d}-database`}class A3{constructor(u,r,a,o,p,e,y,v,E){_(this,"stepType");_(this,"id");_(this,"resourceType");_(this,"index");_(this,"dependency",[]);_(this,"lastEvent",null);_(this,"lasEventTimestamp",null);_(this,"status",hl.Queued);_(this,"publicationRun");_(this,"resource");this.stepType=u,this.id=r,this.resourceType=a,this.status=o,this.dependency=p,this.index=e,this.lasEventTimestamp=y,this.publicationRun=v,this.resource=E}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 r,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((r=u.resource)==null?void 0:r.details)}}var b3=(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))(b3||{});class uA{constructor(u,r,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=r,this.provider=a}setDetails(u){this.details=u}setStatus(u){this.status=u}setProvisionedBy(u){this.provisionedBy=u}}class cA extends uA{constructor(r,a,o,p){super(r,o,p);_(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 r,a;return this.resourceType===kr.HttpApi?this.resourceId=T3(this.publicationRun.project.id):this.resourceType===kr.RelationalDatabase&&(this.resourceId=I3((a=(r=Array.from(this.owners.values()))==null?void 0:r[0])==null?void 0:a.id)),this.resourceId}}class pA extends uA{constructor(r,a,o){super(r,a,o);_(this,"resourceType");_(this,"details",null);_(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceType===kr.CompiledLocalCodebase?this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`:this.resourceType===kr.CloudHostedCodebase&&(this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`),this.resourceId}}class a0e{constructor(u,r){_(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=r}get project(){return this.editor.project}getInfraTypes(u){return this.steps.filter(r=>u.includes(r.resourceType))}getStepsTypes(u){return this.steps.filter(r=>u.includes(r.stepType))}toIds(u){return u.map(r=>r.id)}getResourceForEntity(u){const r=Array.from(this.explicitResources.values()).find(a=>a.owners.has(u.id));return r||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(kr.CompiledLocalCodebase,new pA(this,kr.CompiledLocalCodebase,$c.Amazon)),this.implicitGlobalResources.set(kr.CloudHostedCodebase,new pA(this,kr.CloudHostedCodebase,$c.Amazon));const u=this.project.entities.filter(a=>es(a,Le.HTTP_ENDPOINT)),r=this.project.entities.filter(a=>es(a,Le.RELATIONAL_DATABASE));if(r.length&&r.forEach(a=>{const o=new cA(this,[a],kr.RelationalDatabase,$c.Amazon);this.explicitResources.set(o.resourceId,o)}),u.length){const a=new cA(this,u,kr.HttpApi,$c.Amazon);this.explicitResources.set(a.resourceId,a)}}setSteps(u,r){u.forEach(a=>{this.addStep(a,r)}),this.editor.events.emit(yt.ProjectPublishRequestAcknowledged,{})}addStep(u,r){const a=u.dependency||[];if(a.length){const p=a.filter(e=>!this.steps.find(y=>y.id===e));if(p.length)throw new Error(`Missing dependencies: ${p.join(", ")}`)}if(!u.resource)throw new Error(`Resource not found for step ${u.stepType} (${u.id})`);if(!this.steps.find(p=>p.id===u.id)){const p=this.implicitGlobalResources.get(u.resourceType)||this.explicitResources.get(u.resource.resourceId),e=new A3(u.stepType,u.id,u.resourceType,u.status,a,u.index,r,this,p);this.steps.push(e)}}onUpdate(u){var r;if(Me.log("onUpdate",u),(r=u.payload)!=null&&r.stepType){const a=this.steps.find(o=>{var p;return o.id===((p=u.payload)==null?void 0:p.id)});a&&L(u.emittedAt).isAfter(L(a.lasEventTimestamp))&&a.update(u.payload)}this.editor.events.emit("publication-updated",{}),u.type===lA.Error?(this.finalStatus=dA.Failed,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-error",u)):u.type===lA.Complete&&(this.finalStatus=dA.Success,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-completed",u))}}function o0e(d){switch(d){case vn.CodeCompilation:return"Code generation";case vn.RelationalDatabaseDeployment:return"Database creation";case vn.HttpApiDeployment:return"HTTP gateway creation";case vn.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case vn.BundleCodebase:return"Bundle code";case vn.MigrateRelationalDatabase:return"Database structure migration";case vn.BusinessLogicCodebaseDeployment:return"Update servers with new code";case vn.CodebaseCleanup:return"Code cleanup";case vn.HttpApiDeletion:return"HTTP gateway deletion";case vn.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function l0e(d){switch(d){case yt.DeploymentCompleted:return"Successfully published";case yt.DeploymentStarted:return"Publication started";case yt.DeploymentFailed:return"Publication failed";case yt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case yt.RequestPayloadValidationFailed:return"Request payload validation failed";case yt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case yt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case yt.RelationalDatabaseDeploymentStarted:return"Database creation started";case yt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case yt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case yt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case yt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case yt.RelationalDatabaseAlreadyExists:return"Database already exists";case yt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case yt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case yt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case yt.CreatingNewHttpApi:return"Creating new HTTP gateway";case yt.HttpApiAlreadyExists:return"HTTP gateway already exists";case yt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case yt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case yt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case yt.BundlingCodebaseForDownload:return"Bundling code for download";case yt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case yt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case yt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case yt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case yt.CodeCompilationStarted:return"Code generation started";case yt.CodeCompilationCompleted:return"Code generation completed";case yt.CodeCompilationFailed:return"Code generation failed";case yt.BundleCodebaseStarted:return"Code bundling started";case yt.BundleCodebaseCompleted:return"Code bundling completed";case yt.BundleCodebaseFailed:return"Code bundling failed";case yt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case yt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case yt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case yt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case yt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case yt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case yt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case yt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case yt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case yt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case yt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case yt.ProjectNotFound:return"Project not found";case yt.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case yt.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case yt.HttpApiDeletionStarted:return"HTTP gateway deletion started";case yt.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case yt.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case yt.RelationalDatabaseDeletionStarted:return"Database deletion started";case yt.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case yt.RelationalDatabaseDeletionFailed:return"Database deletion failed";case yt.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var w3=(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))(w3||{});function d0e(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 u0e(d){switch(d){case kr.RelationalDatabase:return"Relational database";case kr.HttpEndpoint:case kr.HttpApi:return"HTTP endpoints";case kr.ServerlessFunction:case kr.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function c0e(d){switch(d){case hl.Running:return"In progress";case hl.Failed:return"Failed";case hl.Success:return"Succeeded";case hl.Skipped:return"Skipped";case hl.Queued:default:return"Queued"}}function R3(d){var o;(o=d.dataType)==null||o.validate(),d.inputs.forEach(p=>p.validate()),d.outputs.forEach(p=>p.validate()),d.internalCalls.forEach(p=>p.validate());const r=[...Pa(d),...Eo(d),...g3(d),...Na(d),..._3(d)],a=rb(d);return r.push(...a),Er(d.errors,r)}function g3(d,u){const a=[...d.project.getVariableDeclarations()].filter(o=>o.id!==d.id);return Zp(d,[xr],a,u)}function _3(d){const u=[];if(d.parent!==d.project)return u;if(d.catchesError){const r=bt({id:`${d.id}--${se.GlobalVariableDeclarationCannotCatchError}`,message:`${Vs[d.type].singular} "${Y(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:Z.Error,code:se.GlobalVariableDeclarationCannotCatchError,entity:d});u.push(r.error)}if(d.errorCalls.length){const r=bt({id:`${d.id}--${se.GlobalVariableDeclarationCannotCallOnError}`,message:`${Vs[d.type].singular} "${Y(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:Z.Error,code:se.GlobalVariableDeclarationCannotCallOnError,entity:d});u.push(r.error)}if(d.calledBy.length){const r=bt({id:`${d.id}--${se.GlobalVariableDeclarationCannotBeCalled}`,message:`${Vs[d.type].singular} "${Y(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:Z.Error,code:se.GlobalVariableDeclarationCannotBeCalled,entity:d});u.push(r.error)}return[]}const p0e=Object.freeze(Object.defineProperty({__proto__:null,validate:R3,validateGlobalVariableDeclaration:_3,validateVariableDeclarationName:g3},Symbol.toStringTag,{value:"Module"}));function D3(d){d.inputs.forEach(o=>o.validate()),d.outputs.forEach(o=>o.validate()),d.internalCalls.forEach(o=>o.validate());const r=[...Pa(d),...Eo(d),...Na(d)],a=rb(d);return r.push(...a),Er(d.errors,r)}const f0e=Object.freeze(Object.defineProperty({__proto__:null,validate:D3},Symbol.toStringTag,{value:"Module"}));var fA=(d=>(d.Parent="parent",d.DataTypeEntity="data-type-entity",d.VarDeclaration="var-declaration",d))(fA||{});const xt=class xt extends Cr{constructor(r,a){super(r);_(this,"initialData");_(this,"id");_(this,"x");_(this,"y");_(this,"type",f.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=r,this.project=a,this.id=r.id,this.x=r.x,this.y=r.y,this.catchesError=r.catchesError||!1}static new(r=null){return{id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(r==null?void 0:r.timestamp)||L().toISOString(),author:(r==null?void 0:r.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.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(r,a){let o=a;if(r.parent){const V=J(r.parent);o=a.get(V)}const p=J(r.declaration),e=a.get(p),y=r.calledByEntry.map(V=>{const B=J(V);return a.get(B)}),v=r.calledBySuccess.map(V=>{const B=J(V);return a.get(B)}),E=r.calledByError.map(V=>{const B=J(V);return a.get(B)});let w=null;if(r.readsValue){const V=J(r.readsValue);w=a.get(V)}const A={id:r.id,version:N.UUID.uuid(),createdAt:L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.VariableInstance,catchesError:r.catchesError||!1,declaration:e.toReference(),calledByEntry:y,calledBySuccess:v,calledByError:E,defaultValue:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:w,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:o},$=ne(A,a);return $.setParent(o,null),$}static validateGenerationTarget(r,a){let o=JSON.parse(JSON.stringify(r));const p=[],e=ri(o,{parent:{list:!1,types:[...Nr,f.Project],optional:!0},declaration:{list:!1,types:[f.VariableDeclaration]}},a);return o=e.modifiedData,p.push(...e.errors,...Vr(o)),{errors:p,modifiedData:o}}get codeName(){var r;return(r=this.declaration)==null?void 0:r.codeName}get codeNativeValueValidation(){var r;return this._codeNativeValueValidation||((r=this.declaration)==null?void 0:r.codeNativeValueValidation)||null}validateGeneratedUpdate(r){const a=[];let o=JSON.parse(JSON.stringify(r));const p=Hp(o,this);return o=p.modifiedData,a.push(...p.errors),r.parent&&a.push(new ae({id:`${this.id}--${k.InvalidParentUpdate}`,code:k.InvalidParentUpdate,severity:Z.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.
84
+ `+p):a.stack=p}catch{}}throw a}}_request(u,r){typeof u=="string"?(r=r||{},r.url=u):r=u||{},r=fl(this.defaults,r);const{transitional:a,paramsSerializer:o,headers:p}=r;a!==void 0&&gy.assertOptions(a,{silentJSONParsing:Hn.transitional(Hn.boolean),forcedJSONParsing:Hn.transitional(Hn.boolean),clarifyTimeoutError:Hn.transitional(Hn.boolean)},!1),o!=null&&(Te.isFunction(o)?r.paramsSerializer={serialize:o}:gy.assertOptions(o,{encode:Hn.function,serialize:Hn.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),gy.assertOptions(r,{baseUrl:Hn.spelling("baseURL"),withXsrfToken:Hn.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let e=p&&Te.merge(p.common,p[r.method]);p&&Te.forEach(["delete","get","head","post","put","patch","common"],B=>{delete p[B]}),r.headers=yn.concat(e,p);const y=[];let v=!0;this.interceptors.request.forEach(function(F){typeof F.runWhen=="function"&&F.runWhen(r)===!1||(v=v&&F.synchronous,y.unshift(F.fulfilled,F.rejected))});const E=[];this.interceptors.response.forEach(function(F){E.push(F.fulfilled,F.rejected)});let w,A=0,$;if(!v){const B=[rj.bind(this),void 0];for(B.unshift.apply(B,y),B.push.apply(B,E),$=B.length,w=Promise.resolve(r);A<$;)w=w.then(B[A++],B[A++]);return w}$=y.length;let V=r;for(A=0;A<$;){const B=y[A++],F=y[A++];try{V=B(V)}catch(K){F.call(this,K);break}}try{w=rj.call(this,V)}catch(B){return Promise.reject(B)}for(A=0,$=E.length;A<$;)w=w.then(E[A++],E[A++]);return w}getUri(u){u=fl(this.defaults,u);const r=Zx(u.baseURL,u.url,u.allowAbsoluteUrls);return xx(r,u.params,u.paramsSerializer)}}Te.forEach(["delete","get","head","options"],function(u){_y.prototype[u]=function(r,a){return this.request(fl(a||{},{method:u,url:r,data:(a||{}).data}))}}),Te.forEach(["post","put","patch"],function(u){function r(a){return function(p,e,y){return this.request(fl(y||{},{method:u,headers:a?{"Content-Type":"multipart/form-data"}:{},url:p,data:e}))}}_y.prototype[u]=r(),_y.prototype[u+"Form"]=r(!0)});const Dy=_y;class JI{constructor(u){if(typeof u!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(p){r=p});const a=this;this.promise.then(o=>{if(!a._listeners)return;let p=a._listeners.length;for(;p-- >0;)a._listeners[p](o);a._listeners=null}),this.promise.then=o=>{let p;const e=new Promise(y=>{a.subscribe(y),p=y}).then(o);return e.cancel=function(){a.unsubscribe(p)},e},u(function(p,e,y){a.reason||(a.reason=new Nd(p,e,y),r(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 r=this._listeners.indexOf(u);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const u=new AbortController,r=a=>{u.abort(a)};return this.subscribe(r),u.signal.unsubscribe=()=>this.unsubscribe(r),u.signal}static source(){let u;return{token:new JI(function(o){u=o}),cancel:u}}}const Ume=JI;function xme(d){return function(r){return d.apply(null,r)}}function jme(d){return Te.isObject(d)&&d.isAxiosError===!0}const WI={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(WI).forEach(([d,u])=>{WI[u]=d});const Gme=WI;function nj(d){const u=new Dy(d),r=wx(Dy.prototype.request,u);return Te.extend(r,Dy.prototype,u,{allOwnKeys:!0}),Te.extend(r,u,null,{allOwnKeys:!0}),r.create=function(o){return nj(fl(d,o))},r}const di=nj(SI);di.Axios=Dy,di.CanceledError=Nd,di.CancelToken=Ume,di.isCancel=Kx,di.VERSION=ij,di.toFormData=Ey,di.AxiosError=Ot,di.Cancel=di.CanceledError,di.all=function(u){return Promise.all(u)},di.spread=xme,di.isAxiosError=jme,di.mergeConfig=fl,di.AxiosHeaders=yn,di.formToJSON=d=>Fx(Te.isHTMLForm(d)?new FormData(d):d),di.getAdapter=tj.getAdapter,di.HttpStatusCode=Gme,di.default=di;const Fme=di;class aj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ht.Addition);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const e=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)}).reduce((y,v)=>y+v,0);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class oj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ht.Subtraction);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const e=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)}).reduce((y,v)=>y-v,0);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class lj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ht.Multiplication);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const e=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)}).reduce((y,v)=>y*v,1);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class dj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ht.Division);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),[p,e]=o;if(e===0)throw new Error("Division by zero is not allowed");const y=p/e;return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class uj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ht.Remainder);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),[p,e]=o;if(e===0)throw new Error("Division by zero is not allowed");const y=p%e;return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class cj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ht.Exponentiation);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),[p,e]=o,y=Math.pow(p,e);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class pj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateRandomInteger);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1],y=uye(p,e);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class fj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateRandomFloat);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=Tx();return{value:H.Success,error:null,results:[o]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class hj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateRandomHexadecimal);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0],e=Ix(p);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class yj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateRandomBase62);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0],e=Ax(p);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class mj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateRandomBase64);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0],e=pye(p);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class vj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateRandomAlphanumeric);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0],e=fye(p);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Ej extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateIdentifier);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1],y=bx(p,e);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Tj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateRandomUUIDv4);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=cl();return{value:H.Success,error:null,results:[o]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Ij extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{Me.log("Initializing Random Generate Short Identifier Module");const a=r.find(o=>o.contextType===be.Logic);if(a){Me.log("Project state found, setting up operation");const o=a.get(_e.GenerateShortIdentifier);o?(Me.log("Operation found, setting autoexecutable and implementation"),o.autoexecutable=!0,o.implementation=this.module.main):Me.warn("Operation generate-short-identifier not found in project state")}else Me.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(r,a)=>{try{const o=hye();return{value:H.Success,error:null,results:[o]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Aj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(_e.GenerateHexadecimalToken);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=yye();return{value:H.Success,error:null,results:[o]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class bj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.Join);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],y=o.slice(1).join(p);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class wj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT,version:"1.0.0",description:"String split operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.Split);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1],y=p.split(e);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Rj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST,version:"1.0.0",description:"String delete last operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.DeleteLast);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const e=p.slice(0,-1);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class gj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST,version:"1.0.0",description:"String delete first operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.DeleteFirst);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const e=p.slice(1);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class _j extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.Reverse);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const e=p.split("").reverse().join("");return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Dj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.ToLowerCase);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const e=p.toLowerCase();return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Oj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.ToUpperCase);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const e=p.toUpperCase();return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Cj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.DeleteIndex);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};if(e<0||e>=p.length)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Index out of bounds",results:[]};const y=p.slice(0,e)+p.slice(e+1);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class $j extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.AddIndex);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(E=>{var w,A;return((w=E.value)==null?void 0:w.valueAsType)||((A=E.value)==null?void 0:A.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};if(e<0||e>p.length)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Index out of bounds",results:[]};const v=p.slice(0,e)+y+p.slice(e);return{value:H.Success,error:null,results:[v]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Pj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST,version:"1.0.0",description:"String replace first operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.ReplaceFirst);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(E=>{var w,A;return((w=E.value)==null?void 0:w.valueAsType)||((A=E.value)==null?void 0:A.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const v=p.replace(e,y);return{value:H.Success,error:null,results:[v]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Nj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST,version:"1.0.0",description:"String replace last operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.ReplaceLast);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(w=>{var A,$;return((A=w.value)==null?void 0:A.valueAsType)||(($=w.value)==null?void 0:$.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const v=p.lastIndexOf(e);if(v===-1)return{value:H.Success,error:null,results:[p]};const E=p.slice(0,v)+p.slice(v).replace(e,y);return{value:H.Success,error:null,results:[E]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Vj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.ReplaceIndex);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(E=>{var w,A;return((w=E.value)==null?void 0:w.valueAsType)||((A=E.value)==null?void 0:A.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};if(e<0||e>=p.length)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Index out of bounds",results:[]};const v=p.slice(0,e)+y+p.slice(e+1);return{value:H.Success,error:null,results:[v]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Lj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_SINGLE_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.ReplaceSingleMatch);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(E=>{var w,A;return((w=E.value)==null?void 0:w.valueAsType)||((A=E.value)==null?void 0:A.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const v=p.replace(e,y);return{value:H.Success,error:null,results:[v]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Mj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.ReplaceAllMatches);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(E=>{var w,A;return((w=E.value)==null?void 0:w.valueAsType)||((A=E.value)==null?void 0:A.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const v=p.split(e).join(y);return{value:H.Success,error:null,results:[v]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Bj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.GetIndexItem);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const y=p.charAt(e);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Uj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST,version:"1.0.0",description:"String get first operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.GetFirst);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const e=p.charAt(0);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class xj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST,version:"1.0.0",description:"String get last operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.GetLast);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const e=p.charAt(p.length-1);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class jj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.GetIndexOf);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const y=p.indexOf(e);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Gj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.Append);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const y=p+e;return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Fj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Ge.Prepend);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const y=e+p;return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Sj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.Join);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const y=p.join(e);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Kj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.Split);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No string provided or string is empty",results:[]};const y=p.split(e);return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class kj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.Reverse);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const e=p.slice().reverse();return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class qj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST,version:"1.0.0",description:"List delete last operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.DeleteLast);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const e=p.slice(0,-1);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Hj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST,version:"1.0.0",description:"List delete first operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.DeleteFirst);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const e=p.slice(1);return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Zj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.AddIndex);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(E=>{var w,A;return((w=E.value)==null?void 0:w.valueAsType)||((A=E.value)==null?void 0:A.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};if(e<0||e>p.length)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Index out of bounds",results:[]};const v=[...p.slice(0,e),y,...p.slice(e)];return{value:H.Success,error:null,results:[v]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Jj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.ReplaceIndex);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(E=>{var w,A;return((w=E.value)==null?void 0:w.valueAsType)||((A=E.value)==null?void 0:A.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};if(e<0||e>=p.length)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Index out of bounds",results:[]};const v=[...p];return v[e]=y,{value:H.Success,error:null,results:[v]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Wj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST,version:"1.0.0",description:"List replace first operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.ReplaceFirst);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(w=>{var A,$;return((A=w.value)==null?void 0:A.valueAsType)||(($=w.value)==null?void 0:$.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const v=p.indexOf(e);if(v===-1)return{value:H.Success,error:null,results:[p]};const E=[...p];return E[v]=y,{value:H.Success,error:null,results:[E]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Yj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST,version:"1.0.0",description:"List replace last operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.ReplaceLast);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(w=>{var A,$;return((A=w.value)==null?void 0:A.valueAsType)||(($=w.value)==null?void 0:$.value)}),p=o[0],e=o[1],y=o[2];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const v=p.lastIndexOf(e);if(v===-1)return{value:H.Success,error:null,results:[p]};const E=[...p];return E[v]=y,{value:H.Success,error:null,results:[E]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class zj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.GetIndexItem);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};if(e<0||e>=p.length)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Index out of bounds",results:[]};const y=p[e];return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Xj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.GetFirst);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const e=p[0];return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class Qj extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.GetLast);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const e=p[p.length-1];return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class e3 extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.Append);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const y=[...p,e];return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class t3 extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(Fe.Prepend);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[0],e=o[1];if(!p||p.length===0)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list provided or list is empty",results:[]};const y=[e,...p];return{value:H.Success,error:null,results:[y]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class r3 extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_PARALLEL,version:"1.0.0",description:"Execution parallel operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(tr.Parallel);o&&(o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(A=>{var $,V;return(($=A.value)==null?void 0:$.valueAsType)||((V=A.value)==null?void 0:V.value)})[0];if(!p)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list of action entities provided",results:[]};if(!Array.isArray(p))return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Invalid input value. Expected a list of action entities",results:[]};const y=this.extensionsRegistry.requestContexts(this,[be.Editor])[0],E=p.map(A=>{const $=new mn(y.logic,[A],A,null,this.extensionsRegistry);return $.inheritValuesFromContext(y),$}).map(A=>A.execute()),w=await Promise.all(E);return{value:H.Success,error:null,results:[w]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class i3 extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SEQUENTIAL,version:"1.0.0",description:"Execution sequential operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(tr.Sequential);o&&(o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)})[0];if(!p)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No list of action entities provided",results:[]};if(!Array.isArray(p))return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Invalid input value. Expected a list of action entities",results:[]};const e=[];for(let y=0;y<p.length;y++){const v=p[y],w=this.extensionsRegistry.requestContexts(this,[be.Editor])[0],A=new mn(w.logic,[v],v,null,this.extensionsRegistry);A.inheritValuesFromContext(w);const $=await A.execute();e.push($)}return{value:H.Success,error:null,results:[e]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class s3 extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(tr.Wait);o&&(o.implementation=this.module.main)}},main:async(r,a)=>{try{const p=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 p!="number"||p<0?{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Invalid wait time provided",results:[]}:(await new Promise(e=>setTimeout(e,p)),{value:H.Success,error:null,results:[]})}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class n3 extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CREATE_NEW_INSTANCE,version:"1.0.0",description:"Entity create new instance operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(pr.CreateNewInstance);o&&(o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(w=>{var A,$;return((A=w.value)==null?void 0:A.valueAsType)||(($=w.value)==null?void 0:$.value)}),p=o[0];if(!p)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No entity template provided",results:[]};if(!(p instanceof Qn))return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Invalid entity template value provided",results:[]};const e=o[1]||{},v=Li(p).map(w=>w.name);let E=e;if(v.includes(Le.PERSISTED_ENTITY)){const w=p.properties.find($=>{var V;return((V=$.implements)==null?void 0:V.id)===he["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id});if(!w)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"No database property found in entity",results:[]};if(!w.getDefaultValue())return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:"Database property has no database as entity as default value",results:[]}}return{value:H.Success,error:null,results:[E]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class a3 extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(pr.Validate);o&&(o.autoexecutable=!0,o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(y=>{var v,E;return((v=y.value)==null?void 0:v.valueAsType)||((E=y.value)==null?void 0:E.value)});Me.log("Inputs for entity validation: ",o);const e=rT(o[1]).safeParse(o[0]);return e.success?{value:H.Success,error:null,results:[o[0]]}:{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:e.error.errors,results:[]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class o3 extends rt{constructor(){super(...arguments);_(this,"manifest",{id:Qe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:We.High,permissions:[Xe.All],contexts:[be.Logic]});_(this,"module",{init:r=>{const a=r.find(o=>o.contextType===be.Logic);if(a){const o=a.get(yi.HttpRequest);o&&(o.implementation=this.module.main)}},main:async(r,a)=>{try{const o=a.map(v=>{var E,w;return((E=v.value)==null?void 0:E.valueAsType)||((w=v.value)==null?void 0:w.value)}),p=o[3]||{},e={method:o[0],url:o[1],params:o[2],headers:p,data:o[4]};Me.log("Axios request config: ",e);const y=await Fme(e);return{value:H.Success,error:null,results:[y.status,y.headers,y.data]}}catch(o){return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,error:o,results:[]}}}})}}class YI extends NI{constructor(u,r,a=r.projectId){super(u,be.Editor),this._editor=r,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,r){return this._editor.initTest(u,r)}removeTest(){return this._editor.removeTest()}async copyEntities(u){return this._editor.copyEntities(u)}resolveInitialChildrenPositions(u,r,a){return this._editor.resolveInitialChildrenPositions(u,r,a)}publish(){return this._editor.publish()}loadActivePublication(u){return this._editor.loadActivePublication(u)}requestActiveDynamicValue(u){return this._editor.requestActiveDynamicValue(u)}}function Sme(d,u){return u instanceof YI?u:new YI(d,u)}function Kme(d){d.register(new Ex(d)),d.register(new vx(d)),d.register(new fx(d)),d.register(new yx(d)),d.register(new mx(d)),d.register(new hx(d)),d.register(new aj(d)),d.register(new oj(d)),d.register(new lj(d)),d.register(new uj(d)),d.register(new dj(d)),d.register(new cj(d)),d.register(new pj(d)),d.register(new fj(d)),d.register(new hj(d)),d.register(new yj(d)),d.register(new mj(d)),d.register(new vj(d)),d.register(new Ej(d)),d.register(new Tj(d)),d.register(new Ij(d)),d.register(new Aj(d)),d.register(new bj(d)),d.register(new wj(d)),d.register(new Rj(d)),d.register(new gj(d)),d.register(new _j(d)),d.register(new Dj(d)),d.register(new Oj(d)),d.register(new Cj(d)),d.register(new $j(d)),d.register(new Pj(d)),d.register(new Nj(d)),d.register(new Vj(d)),d.register(new Lj(d)),d.register(new Mj(d)),d.register(new Bj(d)),d.register(new Uj(d)),d.register(new xj(d)),d.register(new jj(d)),d.register(new Gj(d)),d.register(new Fj(d)),d.register(new Sj(d)),d.register(new Kj(d)),d.register(new kj(d)),d.register(new qj(d)),d.register(new Hj(d)),d.register(new Zj(d)),d.register(new Jj(d)),d.register(new Wj(d)),d.register(new Yj(d)),d.register(new zj(d)),d.register(new Xj(d)),d.register(new Qj(d)),d.register(new e3(d)),d.register(new t3(d)),d.register(new r3(d)),d.register(new i3(d)),d.register(new s3(d)),d.register(new n3(d)),d.register(new a3(d)),d.register(new o3(d))}class l3{constructor(u=new gc){_(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,r)=>(u.manifest.initPriority||We.Normal)-(r.manifest.initPriority||We.Normal))}async setup(){Kme(this),Me.log("Initializing extensions without context..."),this.initForReady()}requestContext(u){switch(u){case be.Editor:return this.onResolveEditorContextCallback();case be.Logic:return this.onResolveProjectLogicContextCallback();case be.GUI:return this.onResolveGUIContextCallback();case be.Compile:return this.onResolveCompileContextCallback();default:throw new Error(`Unknown context type: ${u}`)}}requestContexts(u,r=[]){const a=[];r.length===0&&(r=u.manifest.contexts);for(const o of r){const p=this.requestContext(o);p&&a.push(p)}return a}requestModule(u){const r=this.extensionsRegistry.get(u);if(r){if(r.module)return r.module;throw new Error(`Module ${u} is not registered properly.`)}throw new Error(`Unknown module: ${u}`)}register(u){this.extensionsRegistry.set(u.manifest.id,u)}async initAll(){var u,r;for(const a of this.extensionInOrder)if(a.module.init&&!this.initialized.has(a.manifest.id)){const o=a.manifest.contexts.map(p=>this.requestContext(p)).filter(p=>p!==null);o.length&&(await((r=(u=a.module).init)==null?void 0:r.call(u,o)),this.initialized.add(a.manifest.id))}else!a.module.init&&!this.initialized.has(a.manifest.id)&&this.initialized.add(a.manifest.id)}async initForReady(){Me.log("Initializing extensions for ready contexts...");for(const u of this.extensionInOrder)if(u.module.init&&!this.initialized.has(u.manifest.id)){Me.log("Initializing "+u.manifest.id+" extension...");const r=this.requestContexts(u);u.manifest.contexts.every(o=>!!r.find(p=>p.contextType===o))?(await u.module.init(r),this.initialized.add(u.manifest.id)):Me.warn(`Skipping initialization of ${u.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${u.manifest.contexts.join(", ")}`,`Available contexts: ${r.map(o=>o.contextType).join(", ")}`)}else!u.module.init&&!this.initialized.has(u.manifest.id)?(Me.log("Set "+u.manifest.id+" extension as initialized by default..."),this.initialized.add(u.manifest.id)):Me.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,r){this.events.on(u,r)}emit(u,...r){this.events.emit(u,...r)}off(u,r){this.events.off(u,r)}emitAsync(u,...r){return this.events.emitAsync(u,...r)}emitAsyncAll(u,...r){return this.events.emitAsyncAll(u,...r)}emitAsyncAllSettled(u,...r){return this.events.emitAsyncAllSettled(u,...r)}emitAsyncSequentially(u,...r){return this.events.emitAsyncSequentially(u,...r)}emitAsyncSequentiallyAll(u,...r){return this.events.emitAsyncSequentiallyAll(u,...r)}emitAsyncSequentiallyAllSettled(u,...r){return this.events.emitAsyncSequentiallyAllSettled(u,...r)}async contextAvailable(u){if(this.initializedContexts.has(u)){Me.warn(`Context ${u} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(u),u){case be.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case be.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}Me.log(`Context ${u} is now available. Initializing extensions for this context...`),await this.initForReady()}}let Oy=null;const zI={requestModule:d=>(Oy||(Oy=new l3,Oy.setup()),Oy.requestModule(d))},no={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var XI=(d=>(d.FinishedSuccess="finished-success",d.FinishedError="finished-error",d.Running="running",d.Paused="paused",d.Stopped="stopped",d.NotStarted="not-started",d))(XI||{});const d3={...zI};class mn extends gc{constructor(r,a,o,p=null,e=d3){super();_(this,"project");_(this,"entryPoint");_(this,"state","not-started");_(this,"events",new gc);_(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=o,this.project=r,this.parentExecution=p,this.localTestValues=new vc(N.UUID.uuid(),this.project),this.resolvedValues=new vc(N.UUID.uuid(),this.project),this.persistedExecutionResults=new vc(N.UUID.uuid(),this.project),this.lastExecutionResults=new vc(N.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(r){this.hasEntity(r)&&(this.removeFromScheduledList(r),!this.skipped.includes(r)&&(this.skipped.push(r),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(r),vi.includes(r.type)&&nt(r).forEach(a=>this.skip(a))))}async schedule(r,a,o){if(this.hasExecuted(r))return null;if(Dt.includes(r.type))return this.executeBranch(r,o,a);if($i.includes(r.type)){if(r.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(r,o,a);this.scheduled.includes(r)||this.scheduled.push(r)}return null}mergeExernalValuesWithInternalInputs(r,a){const o=[];return[...ir,...Dt].includes(a.type)?o.push(...a.inputs):hr.includes(a.type)&&o.push(...a.outputs),o.map(e=>{var v;let y=r.find(E=>E.valueOwner.id===e.id);if(y)return y;if(!y&&Dt.includes(a.type)&&(y=r.find(E=>{var w;return((w=E.valueOwner.declaration)==null?void 0:w.id)===e.id})),y){const E=(v=y.value)==null?void 0:v.clone(null);return E==null||E.setStandaloneParent(e),{...y,valueOwner:e,value:E||null,inheritanceLink:{sources:[y],target:e}}}return un.includes(e.type)?py(e,this.valueResolutionContext):ll(e,this.valueResolutionContext)}).reduce((e,y)=>{const v=fn(y==null?void 0:y.valueOwner,this.project),E=y?[y]:[];return v.forEach(w=>{var V,B,F;if(w.id===(y==null?void 0:y.valueOwner.id))return;const A=dt(w.getDataType(null),w,this.project);A==null||A.metaSync({value:(V=y==null?void 0:y.value)==null?void 0:V.value},null),A==null||A.setValueAsTypeList(((B=y==null?void 0:y.value)==null?void 0:B.valueAsTypeList)||null),A==null||A.setValueAsTypeSingle(((F=y==null?void 0:y.value)==null?void 0:F.valueAsTypeSingle)||null);const $={...y,valueOwner:w,value:A};E.push($)}),[...e,...E]},[]).sort((e,y)=>e.valueOwner.index-y.valueOwner.index)}inheritValuesFromContext(r){this.localTestValues=r.localTestValues,this.resolvedValues=r.resolvedValues,this.persistedExecutionResults=r.persistedExecutionResults}async executeInternalCall(r,a,o,p={}){var y,v;const e={...no,...p};try{let E={value:H.Success,error:null,results:[]};if(a.sort((w,A)=>w.valueOwner.index-A.valueOwner.index),Object.values(Yr).includes(r.declaration.id)){const w=this.parentContext.requestModule(Cd+r.declaration.id).main;w?E=await w(r,a):Me.warn(`No implementation found for built-in function: ${r.declaration.id}`)}else{debugger;E=await this.executeDetachedFullFunctionDeclarationLogic(r.declaration,a,o,e);debugger;const w=r.outputs.map($=>{var q,ie,W,de;const V=[...$.declaration.getCounterparts(),$.declaration],B=E.results.find(Q=>V.some(X=>Q.valueOwner.id===(X==null?void 0:X.id))),F=$==null?void 0:$.getDataType(null),K=dt(F,$,o);return F!=null&&F.asType?Array.isArray((q=B==null?void 0:B.value)==null?void 0:q.valueAsType)?K==null||K.setValueAsTypeList((ie=B==null?void 0:B.value)==null?void 0:ie.valueAsTypeList):K==null||K.setValueAsTypeSingle(((W=B==null?void 0:B.value)==null?void 0:W.valueAsType)||null):K==null||K.metaSync({value:(de=B==null?void 0:B.value)==null?void 0:de.value},null),{valueOwner:$,type:Ae.ExecutionResult,inheritanceLink:null,value:K}});let A=null;debugger;if(E.error){Me.warn("Raw error executing entity: ",E.error);const $=(y=r.error)==null?void 0:y.getDataType(null),V=dt($||null,r.error,o);$!=null&&$.asType?V==null||V.setValueAsTypeSingle(E.error):V==null||V.metaSync({value:E.error},null),A={valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:V}}return{value:E.value,entity:r,error:A,results:w}}return{...E,entity:r}}catch(E){Me.warn("Internal call execution error: ",E);let w=null;if(r.error){const A=(v=r.error)==null?void 0:v.getDataType(null),$=dt(A,r.error,o);A!=null&&A.asType?$==null||$.setValueAsTypeSingle(E):$==null||$.metaSync({value:E},null),w={valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:$}}return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,entity:r,error:w,results:[]}}}static async executeOperation(r,a,o){var p,e;try{let y={value:H.Success,error:null,results:[]};a.sort((w,A)=>w.valueOwner.index-A.valueOwner.index),r.declaration.implementation&&(y=await r.declaration.implementation(r,a));const v=r.outputs.map((w,A)=>{const $=w==null?void 0:w.getDataType(null),V=dt($,w,o);return $!=null&&$.asType?V==null||V.setValueAsTypeSingle(y.results[A]):V==null||V.metaSync({value:y.results[A]},null),{valueOwner:w,type:Ae.ExecutionResult,inheritanceLink:null,value:V}});let E=null;if(y.error&&r.error){Me.warn("Raw error executing entity: ",y.error);const w=((p=r.error)==null?void 0:p.getDataType(null))||null,A=dt(w,r.error,o);w!=null&&w.asType?A==null||A.setValueAsTypeSingle(y.error):A==null||A.metaSync({value:y.error},null),E={valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:A}}return{value:y.value,entity:r,error:E,results:v}}catch(y){Me.warn("Operation execution error: ",y);let v=null;if(r.error){const E=(e=r.error)==null?void 0:e.getDataType(null),w=dt(E,r.error,o);E!=null&&E.asType?w==null||w.setValueAsTypeSingle(y):w==null||w.metaSync({value:y},null),v={valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:w}}return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,entity:r,error:v,results:[]}}}async executeSearch(r,a,o){var p;try{let e={value:H.Success,error:null,results:[]};const y=r.outputs[0];if(!y)return{value:H.Success,entity:r,error:null,results:[]};let v={value:null,valueOwner:y,type:Ae.ExecutionResult,inheritanceLink:null};const E=await this.parentContext.requestModule(Qe.SEARCH_NODE_IMPLEMENTATION).main(r,a),w=y==null?void 0:y.getDataType(null),A=dt(w,y,o);return A==null||A.metaSync({value:E.data},null),v.value=A,{value:e.value,entity:r,error:null,results:[v]}}catch(e){if(Me.warn(`Search node execution error: ${e}`),!r.error)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,entity:r,error:null,results:[]};const y=(p=r.error)==null?void 0:p.getDataType(null),v=dt(y,r.error,o);return v==null||v.metaSync({value:e},null),{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,entity:r,error:{valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:v},results:[]}}}async executeLoop(r,a,o,p={}){var y,v;const e={...no,...p};try{let E={value:H.Success,error:null,results:[]};const w=a.map(K=>{var q,ie;return((q=K==null?void 0:K.value)==null?void 0:q.valueAsType)||((ie=K==null?void 0:K.value)==null?void 0:ie.value)});let A={};r.getUniqueReturnDeclarations().forEach(K=>{const q=r.body.inputs.find(Q=>Y(Q,o)===Gi.fromReturnDeclarationToBodyArgumentDeclarationName(K)),ie=K==null?void 0:K.getDataType(null),W=dt(ie,q,o);ie!=null&&ie.asType?W==null||W.setValueAsTypeList([]):W==null||W.metaSync({value:[]},null),this.lastExecutionResults.writeValue(q,W);const de={value:W,valueOwner:q,type:Ae.ExecutionResult,inheritanceLink:null};A[q.id]=de});let V={value:H.Success,entity:r.body,error:null,results:[]};switch(r.declaration.id){case he.loop["counted-loop"].id:{const K=w[0];let q=1;for(;q<=K&&q<=50;){const ie=r.body.inputs.map(de=>{if(de===r.currentIterationNumberArgumentDeclaration){const Q=r.currentIterationNumberArgumentDeclaration.getDataType(null),ce=vl(Q),X=this.lastExecutionResults.readValue(de.id);if(X){X.metaSync({value:q},null),this.lastExecutionResults.writeValue(de,X);const ue={value:X,valueOwner:r.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null};return A[de.id]=ue,ue}const z={id:N.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:N.UUID.uuid(),createdAt:new Date().toISOString(),author:N.sessionAuthor,deleted:!1,previousVersion:null,value:q,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:de.toReference()},pe=dr(z,o);this.lastExecutionResults.writeValue(de,pe);const te={value:pe,valueOwner:r.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null};return A[de.id]=te,te}else return A[de.id]}).filter(de=>!!de),W=await this.executeFullFunctionDeclarationLogic(r.body,ie,e);if(V=W,V.results.forEach(de=>{var z,pe,te,ue;if(de.valueOwner.type!==f.ReturnDeclaration)return;const Q=r.body.inputs.find(Ie=>Y(Ie,o)===Gi.fromReturnDeclarationToBodyArgumentDeclarationName(de.valueOwner)),X=[...((pe=(z=A==null?void 0:A[Q.id])==null?void 0:z.value)==null?void 0:pe.value)||[],((te=de==null?void 0:de.value)==null?void 0:te.value)||null];(ue=A[Q.id].value)==null||ue.metaSync({value:X},null),this.lastExecutionResults.writeValue(Q,A[Q.id].value)}),[H.CaughtError,H.Break,H.Return].includes(W.value))break;q++}break}case he.loop["manual-flow-loop"].id:{let K=1;for(;K<=50;){const q=r.body.inputs.map(W=>{if(W===r.currentIterationNumberArgumentDeclaration){const de=this.lastExecutionResults.readValue(W.id);if(de){de.metaSync({value:K},null),this.lastExecutionResults.writeValue(W,de);const z={value:de,valueOwner:W,type:Ae.ExecutionResult,inheritanceLink:null};return A[W.id]=z,z}const Q=r.currentIterationNumberArgumentDeclaration.getDataType(null),ce=dt(Q,W,o);return ce==null||ce.metaSync({value:K},null),this.lastExecutionResults.writeValue(W,ce),{value:ce,valueOwner:W,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[W.id]}).filter(W=>!!W),ie=await this.executeFullFunctionDeclarationLogic(r.body,q,e);if(V=ie,V.results.forEach(W=>{var X,z,pe;if(W.valueOwner.type!==f.ReturnDeclaration)return;const de=r.body.inputs.find(te=>Y(te,o)===Gi.fromReturnDeclarationToBodyArgumentDeclarationName(W.valueOwner)),ce=[...(X=A[de.id].value)==null?void 0:X.value,((z=W.value)==null?void 0:z.value)||null];(pe=A[de.id].value)==null||pe.metaSync({value:ce},null),this.lastExecutionResults.writeValue(de,A[de.id].value)}),[H.CaughtError,H.Break,H.Return].includes(ie.value))break;K++}break}case he.loop["list-loop"].id:{const K=w[0];let q=1;const ie=K;for(let W=0;W<ie.length;W++){const de=ie[W],Q=r.body.inputs.map(X=>{if(X===r.currentIterationNumberArgumentDeclaration){const z=this.lastExecutionResults.readValue(X.id);if(z)return z.metaSync({value:q},null),this.lastExecutionResults.writeValue(X,z),{value:z,valueOwner:X,type:Ae.ExecutionResult,inheritanceLink:null};const pe=r.currentIterationNumberArgumentDeclaration.getDataType(null),te=dt(pe,X,o);return te==null||te.metaSync({value:q},null),this.lastExecutionResults.writeValue(X,te),{value:te,valueOwner:r.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(X===r.currentValueArgumentDeclaration){const z=r.currentValueArgumentDeclaration.getDataType(null),pe=vl(z),te=this.lastExecutionResults.readValue(X.id);if(te)return te.metaSync({value:de},null),this.lastExecutionResults.writeValue(X,te),{value:te,valueOwner:X,type:Ae.ExecutionResult,inheritanceLink:null};const ue={id:N.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:N.UUID.uuid(),createdAt:new Date().toISOString(),author:N.sessionAuthor,deleted:!1,previousVersion:null,value:de,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:pe,standaloneParent:X.toReference()},Ie=dr(ue,o);return this.lastExecutionResults.writeValue(X,Ie),{value:Ie,valueOwner:r.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[X.id]}).filter(X=>!!X),ce=await this.executeFullFunctionDeclarationLogic(r.body,Q,e);if(V=ce,V.results.forEach(X=>{var ue,Ie,Ue;if(X.valueOwner.type!==f.ReturnDeclaration)return;const z=r.body.inputs.find(Pe=>Y(Pe,o)===Gi.fromReturnDeclarationToBodyArgumentDeclarationName(X.valueOwner)),te=[...(ue=A[z.id].value)==null?void 0:ue.value,((Ie=X.value)==null?void 0:Ie.value)||null];(Ue=A[z.id].value)==null||Ue.metaSync({value:te},null),this.lastExecutionResults.writeValue(z,A[z.id].value)}),[H.CaughtError,H.Break,H.Return].includes(ce.value))break;q++}break}case he.loop["object-keys-loop"].id:{const K=w[0];let q=1;const ie=K?Object.keys(K):[];for(let W=0;W<ie.length;W++){const de=ie[W],Q=r.body.inputs.map(X=>{if(X===r.currentIterationNumberArgumentDeclaration){const z=this.lastExecutionResults.readValue(X.id);if(z)return z.metaSync({value:q},null),this.lastExecutionResults.writeValue(X,z),{value:z,valueOwner:X,type:Ae.ExecutionResult,inheritanceLink:null};const pe=r.currentIterationNumberArgumentDeclaration.getDataType(null),te=dt(pe,X,o);return te==null||te.metaSync({value:q},null),this.lastExecutionResults.writeValue(X,te),{value:te,valueOwner:r.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(X===r.currentValueArgumentDeclaration){const z=r.currentValueArgumentDeclaration.getDataType(null),pe=vl(z),te=this.lastExecutionResults.readValue(X.id);if(te)return te.metaSync({value:de},null),this.lastExecutionResults.writeValue(X,te),{value:te,valueOwner:X,type:Ae.ExecutionResult,inheritanceLink:null};const ue={id:N.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:N.UUID.uuid(),createdAt:new Date().toISOString(),author:N.sessionAuthor,deleted:!1,previousVersion:null,value:de,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:pe,standaloneParent:X.toReference()},Ie=dr(ue,o);return this.lastExecutionResults.writeValue(X,Ie),{value:Ie,valueOwner:r.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[X.id]}).filter(X=>!!X),ce=await this.executeFullFunctionDeclarationLogic(r.body,Q,e);if(V=ce,V.results.forEach(X=>{var ue,Ie,Ue;if(X.valueOwner.type!==f.ReturnDeclaration)return;const z=r.body.inputs.find(Pe=>Y(Pe,o)===Gi.fromReturnDeclarationToBodyArgumentDeclarationName(X.valueOwner)),te=[...(ue=A[z.id].value)==null?void 0:ue.value,((Ie=X.value)==null?void 0:Ie.value)||null];(Ue=A[z.id].value)==null||Ue.metaSync({value:te},null),this.lastExecutionResults.writeValue(z,A[z.id].value)}),[H.CaughtError,H.Break,H.Return].includes(ce.value))break;q++}break}case he.loop["object-values-loop"].id:{const K=w[0];let q=1;const ie=K?Object.values(K):[];for(let W=0;W<ie.length;W++){const de=ie[W],Q=r.body.inputs.map(X=>{if(X===r.currentIterationNumberArgumentDeclaration){const z=this.lastExecutionResults.readValue(X.id);if(z)return z.metaSync({value:q},null),this.lastExecutionResults.writeValue(X,z),{value:z,valueOwner:X,type:Ae.ExecutionResult,inheritanceLink:null};const pe=r.currentIterationNumberArgumentDeclaration.getDataType(null),te=dt(pe,X,o);return te==null||te.metaSync({value:q},null),this.lastExecutionResults.writeValue(X,te),{value:te,valueOwner:r.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(X===r.currentValueArgumentDeclaration){const z=r.currentValueArgumentDeclaration.getDataType(null),pe=vl(z),te=this.lastExecutionResults.readValue(X.id);if(te)return te.metaSync({value:de},null),this.lastExecutionResults.writeValue(X,te),{value:te,valueOwner:X,type:Ae.ExecutionResult,inheritanceLink:null};const ue={id:N.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:N.UUID.uuid(),createdAt:new Date().toISOString(),author:N.sessionAuthor,deleted:!1,previousVersion:null,value:de,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:pe,standaloneParent:X.toReference()},Ie=dr(ue,o);return this.lastExecutionResults.writeValue(X,Ie),{value:Ie,valueOwner:r.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[X.id]}).filter(X=>!!X),ce=await this.executeFullFunctionDeclarationLogic(r.body,Q,e);if(V=ce,V.results.forEach(X=>{var ue,Ie,Ue;if(X.valueOwner.type!==f.ReturnDeclaration)return;const z=r.body.inputs.find(Pe=>Y(Pe,o)===Gi.fromReturnDeclarationToBodyArgumentDeclarationName(X.valueOwner)),te=[...(ue=A[z.id].value)==null?void 0:ue.value,((Ie=X.value)==null?void 0:Ie.value)||null];(Ue=A[z.id].value)==null||Ue.metaSync({value:te},null),this.lastExecutionResults.writeValue(z,A[z.id].value)}),[H.CaughtError,H.Break,H.Return].includes(ce.value))break;q++}break}case he.loop["string-loop"].id:{const K=w[0];let q=1;const ie=K.split("");for(let W=0;W<ie.length;W++){const de=ie[W],Q=r.body.inputs.map(X=>{if(X===r.currentIterationNumberArgumentDeclaration){const z=this.lastExecutionResults.readValue(X.id);if(z)return z.metaSync({value:q},null),this.lastExecutionResults.writeValue(X,z),{value:z,valueOwner:X,type:Ae.ExecutionResult,inheritanceLink:null};const pe=r.currentIterationNumberArgumentDeclaration.getDataType(null),te=dt(pe,X,o);return te==null||te.metaSync({value:q},null),this.lastExecutionResults.writeValue(X,te),{value:te,valueOwner:r.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(X===r.currentValueArgumentDeclaration){const z=r.currentValueArgumentDeclaration.getDataType(null),pe=vl(z),te=this.lastExecutionResults.readValue(X.id);if(te)return te.metaSync({value:de},null),this.lastExecutionResults.writeValue(X,te),{value:te,valueOwner:X,type:Ae.ExecutionResult,inheritanceLink:null};const ue={id:N.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:N.UUID.uuid(),createdAt:new Date().toISOString(),author:N.sessionAuthor,deleted:!1,previousVersion:null,value:de,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:pe,standaloneParent:X.toReference()},Ie=dr(ue,o);return this.lastExecutionResults.writeValue(X,Ie),{value:Ie,valueOwner:r.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[X.id]}).filter(X=>!!X),ce=await this.executeFullFunctionDeclarationLogic(r.body,Q,e);if(V=ce,V.results.forEach(X=>{var ue,Ie,Ue;if(X.valueOwner.type!==f.ReturnDeclaration)return;const z=r.body.inputs.find(Pe=>Y(Pe,o)===Gi.fromReturnDeclarationToBodyArgumentDeclarationName(X.valueOwner)),te=[...(ue=A[z.id].value)==null?void 0:ue.value,((Ie=X.value)==null?void 0:Ie.value)||null];(Ue=A[z.id].value)==null||Ue.metaSync({value:te},null),this.lastExecutionResults.writeValue(z,A[z.id].value)}),[H.CaughtError,H.Break,H.Return].includes(ce.value))break;q++}break}}let B=[];r.body.inputs.forEach(K=>{var ie;const q=A[K.id];if(q){const W=(ie=q.value)==null?void 0:ie.clone(null),de=r.outputs.find(Q=>Q.declaration&&Gi.fromLoopOutputDeclarationToBodyArgumentDeclarationName(Q.declaration)===Y(K,o));if(!de)return;B.push({valueOwner:de,type:Ae.ExecutionResult,inheritanceLink:null,value:W})}}),E={value:[H.CaughtError,H.Return].includes(V.value)?V.value:H.Success,error:null,results:B};let F=null;if(E.error&&r.error){Me.warn("Raw error executing entity: ",E.error);const K=(y=r.error)==null?void 0:y.getDataType(null),q=dt(K||null,r.error,o);K!=null&&K.asType?q==null||q.setValueAsTypeSingle(E.error):q==null||q.metaSync({value:E.error},null),F={valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:q}}return{value:E.value,entity:r,error:F,results:E.results}}catch(E){if(Me.warn("Error executing loop: ",E),r.error){const w=(v=r.error)==null?void 0:v.getDataType(null),A=dt(w,r.error,o);return w!=null&&w.asType?A==null||A.setValueAsTypeSingle(E):A==null||A.metaSync({value:E},null),{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,entity:r,error:{valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:A},results:[]}}else return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,entity:r,error:null,results:[]}}}async executeFunctionCall(r,a,o,p={}){var y,v;const e={...no,...p};try{let E={value:H.Success,error:null,results:[]};E=await this.executeDetachedFullFunctionDeclarationLogic(r.declaration,a,o,e);const w=r.outputs.map($=>{var q,ie,W,de;const V=[...$.declaration.getCounterparts(),$.declaration],B=E.results.find(Q=>V.some(X=>Q.valueOwner.id===(X==null?void 0:X.id))),F=$==null?void 0:$.getDataType(null),K=dt(F,$,o);return F!=null&&F.asType?Array.isArray((q=B==null?void 0:B.value)==null?void 0:q.valueAsType)?K==null||K.setValueAsTypeList((ie=B==null?void 0:B.value)==null?void 0:ie.valueAsTypeList):K==null||K.setValueAsTypeSingle(((W=B==null?void 0:B.value)==null?void 0:W.valueAsType)||null):K==null||K.metaSync({value:(de=B==null?void 0:B.value)==null?void 0:de.value},null),{valueOwner:$,type:Ae.ExecutionResult,inheritanceLink:null,value:K}});let A=null;if(E.error&&r.error){Me.warn("Raw error executing entity: ",E.error);const $=(y=r.error)==null?void 0:y.getDataType(null),V=dt($||null,r.error,o);$!=null&&$.asType?V==null||V.setValueAsTypeSingle(E.error):V==null||V.metaSync({value:E.error},null),A={valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:V}}return{value:E.value,entity:r,error:A,results:w}}catch(E){if(!r.error)return{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,entity:r,error:null,results:[]};const w=(v=r.error)==null?void 0:v.getDataType(null),A=dt(w,r.error,o);return w!=null&&w.asType?A==null||A.setValueAsTypeSingle(E):A==null||A.metaSync({value:E},null),{value:r.catchesError||r.errorCalls.length?H.CaughtError:H.UnhandledError,entity:r,error:{valueOwner:r.error,type:Ae.ExecutionResult,inheritanceLink:null,value:A},results:[]}}}async executeCondition(r,a){var p,e,y,v,E,w,A,$,V,B,F,K,q,ie,W,de,Q,ce,X,z,pe,te,ue,Ie,Ue,Pe,ge,$e,qe,xe,lt,Rt,ur,Ar,Mr,Qr,ci,Es,Bs,wn,Us,pi,Ts,Rn,ra,lf,wl,df;let o=!1;switch(r.declaration.id){case oi.Empty:{o=!((e=(p=a[0])==null?void 0:p.value)!=null&&e.value);break}case oi.NotEmpty:{o=!!((v=(y=a[0])==null?void 0:y.value)!=null&&v.value);break}case ut.Equal:{if([oe.String,oe.Number,oe.Boolean,oe.Null,oe.Enum,oe.Date,oe.UUID].includes((w=(E=a[0])==null?void 0:E.value)==null?void 0:w.name)){o=(($=(A=a[0])==null?void 0:A.value)==null?void 0:$.value)===((B=(V=a[1])==null?void 0:V.value)==null?void 0:B.value);break}if(((K=(F=a[0])==null?void 0:F.value)==null?void 0:K.name)===oe.KeyValue||((ie=(q=a[0])==null?void 0:q.value)==null?void 0:ie.name)===oe.Untyped){const ia=(de=(W=a[0])==null?void 0:W.value)==null?void 0:de.value,fi=(ce=(Q=a[1])==null?void 0:Q.value)==null?void 0:ce.value;o=JSON.stringify(ia)===JSON.stringify(fi);break}break}case ut.NotEqual:{if([oe.String,oe.Number,oe.Boolean,oe.Null,oe.Enum,oe.Date,oe.UUID].includes((z=(X=a[0])==null?void 0:X.value)==null?void 0:z.name)){o=((te=(pe=a[0])==null?void 0:pe.value)==null?void 0:te.value)!==((Ie=(ue=a[1])==null?void 0:ue.value)==null?void 0:Ie.value);break}if(((Pe=(Ue=a[0])==null?void 0:Ue.value)==null?void 0:Pe.name)===oe.Untyped||(($e=(ge=a[0])==null?void 0:ge.value)==null?void 0:$e.name)===oe.KeyValue){const ia=(xe=(qe=a[0])==null?void 0:qe.value)==null?void 0:xe.value,fi=(Rt=(lt=a[1])==null?void 0:lt.value)==null?void 0:Rt.value;o=JSON.stringify(ia)!==JSON.stringify(fi);break}break}case ut.MoreThanOrEqual:{o=((Ar=(ur=a[0])==null?void 0:ur.value)==null?void 0:Ar.value)>=((Qr=(Mr=a[1])==null?void 0:Mr.value)==null?void 0:Qr.value);break}case ut.MoreThan:{o=((Es=(ci=a[0])==null?void 0:ci.value)==null?void 0:Es.value)>((wn=(Bs=a[1])==null?void 0:Bs.value)==null?void 0:wn.value);break}case ut.LessThanOrEqual:{o=((pi=(Us=a[0])==null?void 0:Us.value)==null?void 0:pi.value)<=((Rn=(Ts=a[1])==null?void 0:Ts.value)==null?void 0:Rn.value);break}case ut.LessThan:{o=((lf=(ra=a[0])==null?void 0:ra.value)==null?void 0:lf.value)<((df=(wl=a[1])==null?void 0:wl.value)==null?void 0:df.value);break}case Kr.And:{o=(await Promise.all(r.andChildrenGroup.map(async fi=>{const zd=this.mergeExernalValuesWithInternalInputs(a,fi);return(await this.executeCondition(fi,zd)).value===H.Success}))).every(fi=>fi);break}case Kr.Or:{o=(await Promise.all(r.orChildrenGroup.map(async fi=>{const zd=this.mergeExernalValuesWithInternalInputs(a,fi);return(await this.executeCondition(fi,zd)).value===H.Success}))).some(fi=>fi);break}}return{value:o?H.Success:H.CaughtError,entity:r,error:null,results:[]}}async executeDetachedFullFunctionDeclarationLogic(r,a,o,p={}){const e={...no,...p,onBeforeEntityExecution:(E,w,A)=>{var $;return(($=p==null?void 0:p.onBeforeEntityExecution)==null?void 0:$.call(p,E,w,{...A,detached:!0}))||Promise.resolve()},onEntityExecuted:(E,w,A)=>{var $;return(($=p==null?void 0:p.onEntityExecuted)==null?void 0:$.call(p,E,w,{...A,detached:!0}))||Promise.resolve()}},y=new mn(o,[r,...Dm(r)],r,this,this.parentContext);return y.inheritValuesFromContext(this),await y.execute(e,a)}async executeFullFunctionDeclarationLogic(r,a,o={}){const p={...no,...o},e=Dm(r);e.forEach(A=>{this.addEntity(A)}),e.reduce((A,$)=>hr.includes($.type)?[...A,...$.outputs]:ir.includes($.type)&&$.type!==f.Condition?[...A,...$.outputs,...$.inputs]:$.type===f.Condition?[...A,...$.inputs]:A,[]).forEach(A=>{this.lastExecutionResults.removeValue(A.id)});const v=await this.executeBranch(r,p,a),w=r.getUniqueReturnDeclarations().reduce((A,$)=>{const V=v==null?void 0:v.results.find(B=>B.valueOwner.id===$.id);return V?[...A,V]:A},[]);return{...v||{},value:(v==null?void 0:v.value)||H.Success,entity:r,error:(v==null?void 0:v.error)||null,results:w}}static async executeEntryPointEntity(r,a){return{value:H.Success,entity:r,error:null,results:a}}static async executeVariable(r,a){return{value:H.Success,entity:r,error:null,results:[a]}}static async executeReturnStatement(r,a){return{value:r.throws?H.CaughtError:H.Return,entity:r,error:null,results:a}}static async executeContinueStatement(r,a){return{value:H.Continue,entity:r,error:null,results:a}}static async executeBreakStatement(r,a){return{value:H.Break,entity:r,error:null,results:a}}mergeValues(r,a){const o=[];for(let p=0;p<a.length;p++)r!=null&&r[p]?o.push(r[p]):o.push(a[p]);return o}async executeEntity(r,a=[],o={}){var y,v,E,w,A,$,V,B,F,K,q,ie,W,de,Q,ce,X;const p={...no,...o},e={detached:!1};switch(r.type){case f.Condition:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((y=p.onBeforeEntityExecution)==null?void 0:y.call(p,r,z,e)),this.executeCondition(r,z)}case f.InternalCall:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((v=p.onBeforeEntityExecution)==null?void 0:v.call(p,r,z,e)),this.executeInternalCall(r,z,this.project)}case f.Operation:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((E=p.onBeforeEntityExecution)==null?void 0:E.call(p,r,z,e)),mn.executeOperation(r,z,this.project)}case f.VariableInstance:case f.VariableDeclaration:{let z=py(r,this.valueResolutionContext);const pe=Vi(r),te=pe.getDataType(null);if(te!=null&&te.isObject()){let Ue={};if(((w=te==null?void 0:te.entity)==null?void 0:w.type)===f.DefinitionEntity&&(Ue={...Ue,...te.entity.getActiveRawDefaultValue()}),z!=null&&z.value)Tr((A=z==null?void 0:z.value)==null?void 0:A.value)&&(Ue={...Ue,...($=z==null?void 0:z.value)==null?void 0:$.value}),z==null||z.value.metaSync({value:Ue},null);else{const Pe=dt(te,r,this.project);Pe==null||Pe.metaSync({value:Ue},null),z={valueOwner:pe,type:Ae.ExecutionResult,inheritanceLink:null,value:Pe}}this.lastExecutionResults.writeValue(pe,z.value),pe.inputs.forEach(Pe=>{var ge;if(((ge=Pe.declaration)==null?void 0:ge.type)===f.Property&&Pe.declaration.static){const $e=this.lastExecutionResults.readValue(Pe.declaration.id),qe=Y(Pe,this.project),xe=xr(qe);if($e)$e.metaSync({value:Ue[xe]},null),this.lastExecutionResults.writeValue(Pe.declaration,$e);else{const lt=dt(Pe.getDataType(null),Pe,this.project);lt==null||lt.metaSync({value:Ue[xe]},null),this.lastExecutionResults.writeValue(Pe.declaration,lt)}}})}else this.lastExecutionResults.writeValue(pe,z==null?void 0:z.value);const ue=[],Ie=(V=z==null?void 0:z.value)!=null&&V.value&&Tr((B=z.value)==null?void 0:B.value)?((F=z.value)==null?void 0:F.value)||{}:{};return r.outputs.map(Ue=>{const Pe=xr(Y(Ue,this.project)),ge=Ie[Pe],$e=dt(Ue.getDataType(null),Ue,this.project);$e==null||$e.metaSync({value:ge},null);const qe={value:$e,valueOwner:Ue,type:Ae.ExecutionResult,inheritanceLink:z?{sources:[z],target:r}:null};ue.push(qe)}),z.type=Ae.ExecutionResult,{value:H.Success,entity:r,error:null,results:[z,...ue]}}case f.FunctionCall:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((K=p.onBeforeEntityExecution)==null?void 0:K.call(p,r,z,e)),this.executeFunctionCall(r,z,this.project)}case f.FunctionDeclaration:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((q=p.onBeforeEntityExecution)==null?void 0:q.call(p,r,z,e)),mn.executeEntryPointEntity(r,z)}case f.Search:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((ie=p.onBeforeEntityExecution)==null?void 0:ie.call(p,r,z,e)),this.executeSearch(r,z,this.project)}case f.Loop:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((W=p.onBeforeEntityExecution)==null?void 0:W.call(p,r,z,e)),this.executeLoop(r,z,this.project,p)}case f.ReturnStatement:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((de=p.onBeforeEntityExecution)==null?void 0:de.call(p,r,z,e)),mn.executeReturnStatement(r,z)}case f.ContinueStatement:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((Q=p.onBeforeEntityExecution)==null?void 0:Q.call(p,r,z,e)),mn.executeContinueStatement(r,z)}case f.BreakStatement:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((ce=p.onBeforeEntityExecution)==null?void 0:ce.call(p,r,z,e)),mn.executeBreakStatement(r,z)}case f.GlobalEvent:{const z=this.mergeExernalValuesWithInternalInputs(a,r);return await((X=p.onBeforeEntityExecution)==null?void 0:X.call(p,r,z,e)),mn.executeEntryPointEntity(r,z)}default:throw new Error(`Entity type ${r==null?void 0:r.type} is not recognized for execution.`)}}storeLastExecutionValues(r){r.error&&r.error.valueOwner&&this.lastExecutionResults.writeValue(r.error.valueOwner,r.error.value),r.results.forEach(a=>{const o=fn(a.valueOwner,this.project);a.value?o.forEach(p=>{this.lastExecutionResults.writeValue(p,a.value)}):o.forEach(p=>{this.lastExecutionResults.removeValue(p.id)})})}async executeBranch(r,a={},o=[]){var E;const p={...no,...a},e={detached:!1};if(!this.hasEntity(r)||this.hasSkipped(r))return null;this.addToExecutingList(r),this.hasScheduled(r)&&this.removeScheduled(r);const v=await this.executeEntity(r,o,p);debugger;if(this.removeFromExecutingList(r),this.addToAlreadyExecutedList(r),this.storeLastExecutionValues(v),await((E=p.onEntityExecuted)==null?void 0:E.call(p,r,v,e)),v.value===H.Success){const w=(r.successCalls||r.calls||[]).filter(F=>this.hasEntity(F));(r.errorCalls||[]).forEach(F=>{this.skip(F)});let $=[];const V=(await Promise.all(w.map(F=>this.schedule(F,v.results,p)))).filter(F=>!!F),B=V.filter(F=>!!F).find(F=>F.value===H.CaughtError||F.value===H.Return||F.value===H.Break||F.value===H.Continue);return B||($=[...$,...V],v)}else if(v.value===H.CaughtError){const w=(r.errorCalls||[]).filter(F=>this.hasEntity(F));(r.successCalls||r.calls||[]).forEach(F=>{this.skip(F)});let $=[];const V=(await Promise.all(w.map(F=>this.schedule(F,v.results,p)))).filter(F=>!!F),B=V.filter(F=>!!F).find(F=>F.value===H.CaughtError||F.value===H.UnhandledError||F.value===H.Return||F.value===H.Break||F.value===H.Continue);return B||($=[...$,...V],v)}else{if(v.value===H.UnhandledError)return this.executing.forEach(w=>{this.skip(w)}),this.scheduled.forEach(w=>{this.skip(w)}),vi.includes(v.entity.type)&&nt(v.entity).forEach(w=>{this.skip(w)}),v;if(v.value===H.Return)return v;if(v.value===H.Break)return v;if(v.value===H.Continue)return v}return v}async execute(r={},a=[]){const o={...no,...r};this.state="running";const p=await this.executeBranch(this.entryPoint,o,a);return this.state="finished-success",p}addEntity(r){var a;this.entities.includes(r)||(this.entities.push(r),(a=this.onAddEntityCallback)==null||a.call(this,r))}addEntities(r){r.forEach(a=>this.addEntity(a))}removeEntity(r){var a;if(r!==this.entryPoint){const o=this.entities.indexOf(r);o>-1&&(this.entities.splice(o,1),(a=this.onRemoveEntityCallback)==null||a.call(this,r))}}hasEntity(r){var p,e,y;if(this.entities.includes(r))return!0;if(((p=r.parent)==null?void 0:p.type)===f.FunctionDeclaration&&((y=(e=r.parent)==null?void 0:e.parent)==null?void 0:y.type)===f.DefinitionEntity)return this.entities.includes(r.parent);const a=fr(r);if(!a)return!1;const o=a.type===f.Loop&&r.parent===a.body?a.body:null;return o?this.entities.includes(o)||this.entities.includes(a):this.entities.includes(a)}removeScheduled(r){const a=this.scheduled.indexOf(r);a>-1&&this.scheduled.splice(a,1)}hasScheduled(r){return!!this.scheduled.includes(r)}hasSkipped(r){return!!this.skipped.includes(r)}hasExecuted(r){return!!this.executed.includes(r)}hasEntityWithId(r){const a=this.project.get(r);return a?this.hasEntity(a):!1}onAddToSkippedList(r){this.onAddToSkippedListCallback=r}onAbortExecution(r){this.onAbortExecutionCallback=r}onAddEntity(r){this.onAddEntityCallback=r}onRemoveFromSkippedList(r){this.onRemoveFromSkippedListCallback=r}onRemoveEntity(r){this.onRemoveEntityCallback=r}addToExecutingList(r){this.executing.includes(r)||this.executing.push(r)}addToScheduledList(r){this.scheduled.includes(r)||this.scheduled.push(r)}removeFromScheduledList(r){const a=this.scheduled.indexOf(r);a>-1&&this.scheduled.splice(a,1)}removeFromExecutingList(r){var o;const a=this.executing.indexOf(r);a>-1&&(this.executing.splice(a,1),(o=this.onAbortExecutionCallback)==null||o.call(this,r))}removeFromAlreadyExecutedList(r){const a=this.executed.indexOf(r);a>-1&&this.executed.splice(a,1)}removeFromSkippedList(r){var o;const a=this.skipped.indexOf(r);a>-1&&(this.skipped.splice(a,1),(o=this.onRemoveFromSkippedListCallback)==null||o.call(this,r))}addToAlreadyExecutedList(r){this.executed.includes(r)||this.executed.push(r)}addToSkippedList(r){var a;this.skipped.includes(r)||(this.skipped.push(r),(a=this.onAddToSkippedListCallback)==null||a.call(this,r))}}function kme(d){var u,r;if(d.isList)return"list";if(((u=d.entity)==null?void 0:u.type)===f.DefinitionEntity)return"definition-entity";switch((r=d.entity)==null?void 0:r.name){case oe.Number:return"number";case oe.String:return"text";case oe.Boolean:return"boolean";case oe.UUID:return"uuid";case oe.Date:return"date-time";default:return"definition-entity"}}const Vs={[f.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[f.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[f.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[f.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[f.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[f.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[f.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[f.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[f.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[f.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[f.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[f.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[f.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[f.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[f.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[f.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[f.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[f.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[f.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[f.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[f.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[f.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[f.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[f.ReturnDeclaration]:{singular:"Output definition",plural:"Output definitions",shortSingular:"Output",shortPlural:"Outputs"},[f.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"},[f.DataType]:{singular:"Data type",plural:"Data types",shortSingular:"Data type",shortPlural:"Data types"},[f.LiteralValue]:{singular:"Literal value",plural:"Literal values",shortSingular:"Value",shortPlural:"Values"}};function QI(d){const u=Om(d);if(!u){const a=Zd(d);if(a.includes(Le.HTTP_ENDPOINT))return"HTTP endpoint";if(a.includes(Le.PERSISTED_ENTITY))return"Persisted entity";if(a.includes(Le.CRON_JOB))return"Scheduled execution";if(a.includes(Le.RELATIONAL_DATABASE))return"Relational database"}if(u){let a="Extension of "+Y(u,u.project)+" entity",o=Rd(a);const p=Zd(d);return p.includes(Le.HTTP_ENDPOINT)?"HTTP endpoint"+(o?", "+o:""):p.includes(Le.PERSISTED_ENTITY)?"Persisted entity"+(o?", "+o:""):p.includes(Le.CRON_JOB)?"Scheduled execution"+(o?", "+o:""):p.includes(Le.RELATIONAL_DATABASE)?"Relational database"+(o?", "+o:""):a}let r="";return d.abstract&&(r="Template "),d.static&&(r+=r?" single copy ":"Single copy "),r?r+"definition":"Definition"}function u3(d){return d.parent.type===f.DefinitionEntity||d.parent.type===f.InstalledProject?"Internal action of "+Y(d.parent,d.project):d.parent.type===f.Loop?"Action repeated on every iteration":"Internal action of entity"}function eA(d){return bb(d)?u3(d):"Custom trigger"}function qme(d){var u;switch(d.type){case f.DefinitionEntity:return QI(d);case f.FunctionDeclaration:return eA(d)}return(u=Vs[d.type])==null?void 0:u.singular}function Hme(d){var u;switch(d.type){case f.DefinitionEntity:return QI(d);case f.FunctionDeclaration:return eA(d)}return(u=Vs[d.type])==null?void 0:u.singular}const tA=4e4,c3=280,Zme=300,rA=65,Vd=32,Cy=39,p3=26,f3=49,$y=44,Jme=35,Py=52,iA=10,Ca=iA*2,Ny=38,Vy=90,sA=270,h3=tA/2+120,y3=tA/2+180;function m3(d){let r=Vd+$y+Ny+iA;const a=[...d.inputs];return a.length&&(r+=Ca,a.forEach(()=>{r+=p3})),{height:r,width:280}}function v3(d){let r=rA;const a=[];if([f.DefinitionEntity].includes(d.type)){const v=[...d.suggestedProperties||[],...d.properties||[]];v.length&&(r+=Ca,v.forEach(E=>{r+=E.static?f3:Cy}))}if([f.DefinitionEntity,f.InstalledProject,f.Loop].includes(d.type)){const v=[...(d==null?void 0:d.suggestedMethods)||[],...d.methods||[],...d.functions||[],...d.body?[d.body]:[]];v.length&&(r+=Ca,v.forEach(E=>{const w=m3(E);r+=w.height}))}ir.includes(d.type)?(Tt.includes(d.type)?a.push(...(d.usedInputs||[]).flatMap(v=>[v])||[]):a.push(...(d.inputs||[]).flatMap(v=>[v])||[]),d.error&&(r+=Py)):[f.ReturnStatement,f.BreakStatement,f.ContinueStatement].includes(d.type)?(a.push(...d.outputs||[]),d.throws&&(r+=Py)):d.type===f.Condition&&(a.push(d.inputs[0]),d.inputs[1]&&a.push(d.inputs[1]));const o=a.length;o&&(r+=o*Cy,r+=Ca);const p=[];if(d.type===f.FunctionDeclaration||d.type===f.GlobalEvent?p.push(...d.inputs||[]):ir.includes(d.type)&&(Tt.includes(d.type)?p.push(...d.usedOutputs||[]):p.push(...d.outputs||[])),Tt.includes(d.type)){d.readsValue&&(r+=Ca,r+=$y),d.writesValues.length&&(r+=Ca,r+=$y),d.internalCalls.length&&d.usedInternalCalls.forEach(()=>r+=Py+Ca);const v=d.getDataType(null);(!v||v.inferred)&&(r+=Ny)}const e=p.length;return e&&(r+=e*Cy,r+=Ca),[f.DefinitionEntity,f.FunctionDeclaration,f.ReturnStatement,f.BreakStatement,f.ContinueStatement].includes(d.type)&&(r+=Ny),{height:r,width:280}}function Cc(d){return`${d.split("-").map((a,o)=>o===0?a.charAt(0).toUpperCase()+a.slice(1):a.toLowerCase()).join(" ")}.`}function Wme(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 se.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case se.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 se.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 se.InternalCallDeclarationIsNotFunctionDeclaration:return"This internal call is not an action";case se.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case se.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case se.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case se.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 se.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case se.EmptyName:return"This entity has no name";case se.InvalidObjectStructure:return"This entity has an invalid structure";case se.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case se.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case se.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case se.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case se.MissingCaller:return"This action is missing a caller";case se.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case se.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case se.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case se.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case se.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case se.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case se.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case se.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case ta.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case ta.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case vs.UUIDMustBeString:return`UUID must be a string, eg: "${cl()}"`;case vs.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${cl()}"`;case vs.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${cl()}"`;case ki.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case ki.StringValueMustNotHaveDashes:return"This value must not contain dashes";case ki.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return Cc(d.code)}}function Yme(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 se.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case se.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case re.MissingMethodImplementation:return"Missing action";case re.MissingPropertyImplementation:return"Missing property";case se.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 se.InternalCallDeclarationIsNotFunctionDeclaration:return"Declaration not an action";case se.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case se.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case se.InternalCallParentMissingDataType:return"Parent has no data type";case se.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case se.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 se.EmptyName:return"Empty name";case se.InvalidObjectStructure:return"Invalid object structure";case se.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case se.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case se.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case se.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case se.MissingCaller:return"Missing caller";case se.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case se.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case se.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case se.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case se.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case se.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case se.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case se.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case ta.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case ta.StatusCodeMustBeNumber:return"HTTP status code must be a number";case vs.UUIDMustBeString:return"UUID must be a string";case vs.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case vs.UUIDMustBeValidFormat:return"UUID must be in a valid format";case ki.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case ki.StringValueMustNotHaveDashes:return"This value must not contain dashes";case ki.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return Cc(d.code)}}function zme(d){switch(d.code){case re.AbstractEntityWithNonAbstractMethods:return`${Y(d.entity,d.entity.project)} has non-template actions`;case re.AbstractEntityWithNonAbstractProperties:return`${Y(d.entity,d.entity.project)} has non-template properties`;case re.IncorrectEntityImplementation:return`${Y(d.entity,d.entity.project)} incorrectly implements template`;case re.IncorrectMethodImplementation:return`${Y(d.entity,d.entity.project)} incorrectly implements the template`;case re.IncorrectPropertyImplementation:return`${Y(d.entity,d.entity.project)} incorrectly implements the template`;case re.AbstractMethodInNonAbstractEntity:return`${Y(d.entity,d.entity.project)} can't be a template`;case re.AbstractPropertyInNonAbstractEntity:return`${Y(d.entity,d.entity.project)} can't be a template`;case se.MethodOverwritesOtherSiblingWithSameName:return`${Y(d.entity,d.entity.project)} overwrites action`;case se.PropertyOverwritesOtherSiblingWithSameName:return`${Y(d.entity,d.entity.project)} overwrites property`;case re.MissingMethodImplementation:return`${Y(d.entity,d.entity.project)} is missing action`;case re.MissingPropertyImplementation:return`${Y(d.entity,d.entity.project)} is missing property`;case se.NameNotUniqueInScope:return`${Y(d.entity,d.entity.project)} name is not unique`;case re.NoProperties:return`${Y(d.entity,d.entity.project)} has no properties`;case re.NonStaticPropertyInStaticEntity:return`${Y(d.entity,d.entity.project)} has non-static property`;case re.StaticEntityWithNonStaticProperties:return`${Y(d.entity,d.entity.project)} has non-static properties`;case re.ReadingFromIncompatibleType:return`${Y(d.entity,d.entity.project)} reads from different type`;case re.WritingToIncompatibleType:return`${Y(d.entity,d.entity.project)} writes to different type`;case re.ScopeWithoutLogic:return`${Y(d.entity,d.entity.project)} has no logic`;case re.NonStaticPropertyImplementsStatic:return`${Y(d.entity,d.entity.project)} has invalid static property`;case re.PropertyImplementsIncompatibleType:return`${Y(d.entity,d.entity.project)} has incompatible data type`;case re.PropertyImplementsNonAbstact:return`${Y(d.entity,d.entity.project)} has non-template property`;case re.StaticPropertyImplementsNonStatic:return`${Y(d.entity,d.entity.project)} has non-static property`;case re.VariableCallsOthersAndHasInternalCall:return`${Y(d.entity,d.entity.project)} has bad internal call`;case re.VariableHasInputsAndInternalCall:return`${Y(d.entity,d.entity.project)} has bad internal call`;case re.VariableHasOutputsAndInternalCall:return`${Y(d.entity,d.entity.project)} has bad internal call`;case re.VariableIsCalledAndHasInternalCall:return`${Y(d.entity,d.entity.project)} has bad internal call`;case se.InternalCallDeclarationIsNotFunctionDeclaration:return`${Y(d.entity,d.entity.project)} has declaration that is not an action`;case se.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${Y(d.entity,d.entity.project)} has declaration that is not found in parent`;case se.InternalCallParentDeclarationEntityInvalidType:return`${Y(d.entity,d.entity.project)} has invalid parent declaration type`;case se.InternalCallParentMissingDataType:return`${Y(d.entity,d.entity.project)}'s parent has no data type`;case se.InternalCallDeclarationNotInParentDatatypeEntity:return`${Y(d.entity,d.entity.project)} has declaration that is not in parent`;case se.UnreachableEntity:return`${Y(d.entity,d.entity.project)} is unreachable`;case re.DisconnectedCallableEntity:return`${Y(d.entity,d.entity.project)} is not executed by any entity`;case re.AbstractEntityImplements:return`${Y(d.entity,d.entity.project)} implements a non-template entity`;case re.AbstractExtendingNonAbstractEntity:return`${Y(d.entity,d.entity.project)} extends a non-template entity`;case re.InvalidPropertiesCombination:return`${Y(d.entity,d.entity.project)} has invalid properties combination`;case re.ExtendingNonInteractiveEntity:return`${Y(d.entity,d.entity.project)} extends a non-interactive entity`;case re.ExtendsIncompatibleEntities:return`${Y(d.entity,d.entity.project)} extends incompatible entities`;case re.ImplementingNonAbstractEntity:return`${Y(d.entity,d.entity.project)} implements a non-template entity`;case re.ImplementsIncompatibleEntities:return`${Y(d.entity,d.entity.project)} implements incompatible entities`;case re.LackingReturnStatementOnSomeBranches:return`${Y(d.entity,d.entity.project)} is missing termination on some branches`;case re.LastCalledEntityMustBeReturnEntity:return`${Y(d.entity,d.entity.project)}'s last called entity must be a termination node`;case re.MissingRequiredValue:return`${Y(d.entity,d.entity.project)} is missing a required value`;case re.NoPrimaryKeyProperty:return`${Y(d.entity,d.entity.project)} has no primary key property`;case re.NonAbstractExtendingAbstractEntity:return`${Y(d.entity,d.entity.project)} extends a template entity`;case re.NonStaticExtendingStaticEntity:return`${Y(d.entity,d.entity.project)} extends a static entity`;case re.NonStaticImplementingStaticEntity:return`${Y(d.entity,d.entity.project)} implements a static entity`;case re.StaticExtendingNonStaticEntity:return`${Y(d.entity,d.entity.project)} extends a non-static entity`;case re.StaticImplementingNonStaticEntity:return`${Y(d.entity,d.entity.project)} implements a non-static entity`;case re.VariableReadsValueAndInternalCall:return`${Y(d.entity,d.entity.project)} reads a value and has internal call`;case re.VariableWritesValuesAndInternalCall:return`${Y(d.entity,d.entity.project)} writes values and has internal call`;case se.EmptyName:return`${Vs[d.entity.type]} has no name`;case se.InvalidObjectStructure:return`${Y(d.entity,d.entity.project)} has invalid structure`;case se.LoopBodyFunctionOverwrite:return`${Y(d.entity,d.entity.project)}'s loop body action overwrites an action`;case se.MethodOverwritesBaseMethodWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites base action`;case se.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites another action with same implementation`;case se.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites another action with same implementation`;case se.MissingCaller:return`${Y(d.entity,d.entity.project)} is missing a caller`;case se.NameAsResolvedCodeNameNotUniqueInScope:return`${Y(d.entity,d.entity.project)} has a name not unique in the scope`;case se.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${Y(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case se.NameMustStartWithLetterOrUnderscore:return`${Y(d.entity,d.entity.project)} name must start with letter or underscore`;case se.NoOverlapWithImplementedSignature:return`${Y(d.entity,d.entity.project)} has no overlap with implemented signature`;case se.PropertyOverwritesBasePropertyWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites base property`;case se.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites another property with same implementation`;case se.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites another property with same implementation`;case se.ReaderWriterIncompatibleDataType:return`${Y(d.entity,d.entity.project)} has reader/writer with incompatible data type`;case ta.StatusCodeMustBeBetween100And599:return`${Y(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case ta.StatusCodeMustBeNumber:return`${Y(d.entity,d.entity.project)} HTTP status code must be a number`;case vs.UUIDMustBeString:return`${Y(d.entity,d.entity.project)} UUID must be a string`;case vs.UUIDMustNotContainSpaces:return`${Y(d.entity,d.entity.project)} UUID must not contain spaces`;case vs.UUIDMustBeValidFormat:return`${Y(d.entity,d.entity.project)} UUID must be in a valid format`;case ki.MustBeUniqueAmongSameEntities:return`${Y(d.entity,d.entity.project)} value must be unique among the same kind`;case ki.StringValueMustNotHaveDashes:return`${Y(d.entity,d.entity.project)} value must not contain dashes`;case ki.StringValueMustNotHaveSpaces:return`${Y(d.entity,d.entity.project)} value must not contain spaces`;default:return`${Y(d.entity,d.entity.project)} Error: ${Cc(d.code)}`}}function Xme(d){var u,r,a,o;switch(d.code){case re.AbstractEntityWithNonAbstractMethods:return`${Y(d.entity,d.entity.project)} has non-template actions`;case re.AbstractEntityWithNonAbstractProperties:return`${Y(d.entity,d.entity.project)} has non-template properties`;case re.IncorrectEntityImplementation:return`${Y(d.entity,d.entity.project)} incorrectly implements the template entity`;case re.IncorrectMethodImplementation:return`${Y(d.entity,d.entity.project)} incorrectly implements the template action it's based on`;case re.IncorrectPropertyImplementation:return`${Y(d.entity,d.entity.project)} incorrectly implements the template property it's based on`;case re.AbstractMethodInNonAbstractEntity:return`${Y(d.entity,d.entity.project)} is a template action in a non-template entity`;case re.AbstractPropertyInNonAbstractEntity:return`${Y(d.entity,d.entity.project)} is a template property in a non-template entity`;case se.MethodOverwritesOtherSiblingWithSameName:return`${Y(d.entity,d.entity.project)} overwrites an action in the template entity`;case se.PropertyOverwritesOtherSiblingWithSameName:return`${Y(d.entity,d.entity.project)} overwrites a property in the template entity`;case re.MissingMethodImplementation:return`${Y(d.entity,d.entity.project)} is missing an action implementation from the template entity`;case re.MissingPropertyImplementation:return`${Y(d.entity,d.entity.project)} is missing a property implementation from the template entity`;case se.NameNotUniqueInScope:return`${Y(d.entity,d.entity.project)} has a duplicate name in the same scope`;case re.NoProperties:return`${Y(d.entity,d.entity.project)} has no properties, so it doesn't do anything`;case re.NonStaticPropertyInStaticEntity:return`${Y(d.entity,d.entity.project)} has a non-static property in a static entity`;case re.StaticEntityWithNonStaticProperties:return`${Y(d.entity,d.entity.project)} has non-static properties in a static entity`;case re.ReadingFromIncompatibleType:return`${Y(d.entity,d.entity.project)} reads data from a value of a different data type`;case re.WritingToIncompatibleType:return`${Y(d.entity,d.entity.project)} writes data to a value of a different data type`;case re.ScopeWithoutLogic:return`${Y(d.entity,d.entity.project)} has no logic`;case re.NonStaticPropertyImplementsStatic:return`${Y(d.entity,d.entity.project)} has a static property in a non-static entity`;case re.PropertyImplementsIncompatibleType:return`${Y(d.entity,d.entity.project)} implements a property of a different data type`;case re.PropertyImplementsNonAbstact:return`${Y(d.entity,d.entity.project)} implements a non-template property`;case re.StaticPropertyImplementsNonStatic:return`${Y(d.entity,d.entity.project)} has a static property in a non-static entity`;case re.VariableCallsOthersAndHasInternalCall:return`${Y(d.entity,d.entity.project)} calls other entities while being used to execute internal logic`;case re.VariableHasInputsAndInternalCall:return`${Y(d.entity,d.entity.project)} has inputs while being used to execute internal logic`;case re.VariableHasOutputsAndInternalCall:return`${Y(d.entity,d.entity.project)} has outputs while being used to execute internal logic`;case re.VariableIsCalledAndHasInternalCall:return`${Y(d.entity,d.entity.project)} is called while being used to execute internal logic`;case se.InternalCallDeclarationIsNotFunctionDeclaration:return`${Y(d.entity,d.entity.project)} has a declaration that is not an action`;case se.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${Y(d.entity,d.entity.project)} has a declaration that is not found in ${(u=d.entity.parent.getDataType(null))!=null&&u.entity?Y((r=d.entity.parent.getDataType(null))==null?void 0:r.entity,d.entity.project):"the variable's data-type entity"}`;case se.InternalCallParentDeclarationEntityInvalidType:return`${Y(d.entity,d.entity.project)} is part of a variable whos data-type entity can't have actions`;case se.InternalCallParentMissingDataType:return`${Y(d.entity,d.entity.project)} is part of a variable with no data-type entity`;case se.InternalCallDeclarationNotInParentDatatypeEntity:return`${Y(d.entity,d.entity.project)} has a declaration doesn't belong to ${(a=d.entity.parent.getDataType(null))!=null&&a.entity?Y((o=d.entity.parent.getDataType(null))==null?void 0:o.entity,d.entity.project):"the variable's data-type entity"}`;case se.UnreachableEntity:return`${Y(d.entity,d.entity.project)} is unreachable`;case re.DisconnectedCallableEntity:return`${Y(d.entity,d.entity.project)} is disconnected and won't be executed by anything after publishing`;case re.AbstractEntityImplements:return`${Y(d.entity,d.entity.project)} implements a non-template entity`;case re.AbstractExtendingNonAbstractEntity:return`${Y(d.entity,d.entity.project)} extends a non-template entity`;case re.InvalidPropertiesCombination:return`${Y(d.entity,d.entity.project)} has an invalid combination of properties`;case re.ExtendingNonInteractiveEntity:return`${Y(d.entity,d.entity.project)} extends a non-interactive entity`;case re.ExtendsIncompatibleEntities:return`${Y(d.entity,d.entity.project)} extends incompatible entities`;case re.ImplementingNonAbstractEntity:return`${Y(d.entity,d.entity.project)} implements a non-template entity`;case re.ImplementsIncompatibleEntities:return`${Y(d.entity,d.entity.project)} implements incompatible entities`;case re.LackingReturnStatementOnSomeBranches:return`${Y(d.entity,d.entity.project)} has branches that don't terminate`;case re.LastCalledEntityMustBeReturnEntity:return`${Y(d.entity,d.entity.project)} must end with a termination node`;case re.MissingRequiredValue:return`${Y(d.entity,d.entity.project)} is missing a required value`;case re.NoPrimaryKeyProperty:return`${Y(d.entity,d.entity.project)} has no primary key property`;case re.NonAbstractExtendingAbstractEntity:return`${Y(d.entity,d.entity.project)} is a non-template entity extending a template entity`;case re.NonStaticExtendingStaticEntity:return`${Y(d.entity,d.entity.project)} is a non-static entity extending a static entity`;case re.NonStaticImplementingStaticEntity:return`${Y(d.entity,d.entity.project)} is a non-static entity implementing a static entity`;case re.StaticExtendingNonStaticEntity:return`${Y(d.entity,d.entity.project)} is a static entity extending a non-static entity`;case re.StaticImplementingNonStaticEntity:return`${Y(d.entity,d.entity.project)} is a static entity implementing a non-static entity`;case re.VariableReadsValueAndInternalCall:return`${Y(d.entity,d.entity.project)} reads a value and has an internal call`;case re.VariableWritesValuesAndInternalCall:return`${Y(d.entity,d.entity.project)} writes values and has an internal call`;case se.EmptyName:return`${Vs[d.entity.type]} has no name`;case se.InvalidObjectStructure:return`${Y(d.entity,d.entity.project)} has an invalid structure`;case se.LoopBodyFunctionOverwrite:return`${Y(d.entity,d.entity.project)}'s loop body action overwrites`;case se.MethodOverwritesBaseMethodWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites a base action with same implementation`;case se.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites another action with same implementation`;case se.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites another action with same implementation`;case se.MissingCaller:return`${Y(d.entity,d.entity.project)} is missing a caller`;case se.NameAsResolvedCodeNameNotUniqueInScope:return`${Y(d.entity,d.entity.project)} has a name that is not unique in the scope`;case se.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${Y(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case se.NameMustStartWithLetterOrUnderscore:return`${Y(d.entity,d.entity.project)} name must start with letter or underscore`;case se.NoOverlapWithImplementedSignature:return`${Y(d.entity,d.entity.project)} has no overlap with implemented signature`;case se.PropertyOverwritesBasePropertyWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites a base property with same implementation`;case se.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites another property with same implementation`;case se.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${Y(d.entity,d.entity.project)} overwrites another property with same implementation`;case se.ReaderWriterIncompatibleDataType:return`${Y(d.entity,d.entity.project)} has a reader/writer with incompatible data type`;case ta.StatusCodeMustBeBetween100And599:return`${Y(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case ta.StatusCodeMustBeNumber:return`${Y(d.entity,d.entity.project)} HTTP status code must be a number, between 100 and 599`;case vs.UUIDMustBeString:return`${Y(d.entity,d.entity.project)} UUID must be a string, eg: "${cl()}"`;case vs.UUIDMustNotContainSpaces:return`${Y(d.entity,d.entity.project)} UUID must not contain spaces, eg: "${cl()}"`;case vs.UUIDMustBeValidFormat:return`${Y(d.entity,d.entity.project)} UUID must be in a valid format. Eg: "${cl()}"`;case ki.MustBeUniqueAmongSameEntities:return`${Y(d.entity,d.entity.project)} value must be unique among the same kind`;case ki.StringValueMustNotHaveDashes:return`${Y(d.entity,d.entity.project)} value must not contain dashes`;case ki.StringValueMustNotHaveSpaces:return`${Y(d.entity,d.entity.project)} value must not contain spaces`;default:return`${Y(d.entity,d.entity.project)} Error: ${Cc(d.code)}`}}var nA=(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))(nA||{});const Qme=Object.values(nA);var aA=(d=>(d.NotPartOfOngoingTest="not-part-of-ongoing-test",d.CannotBeAddedToTest="cannot-be-added-to-test",d))(aA||{});const e0e=Object.values(aA);var oA=(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))(oA||{});const t0e=Object.values(oA);function r0e(d,u){const r=[...d,...u];return Array.from(new Set(r))}function i0e(d,u){const r=[...d,...u],a=Array.from(new Set(r));return{hasChanged:a.length!==d.length,reasons:a}}function s0e(d,u){const r=d.filter(o=>!u.includes(o));return{hasChanged:r.length!==d.length,reasons:r}}function n0e(d,u){return d.find(r=>r.entity.id===u)||null}function E3(d){return d.filter((u,r)=>d.indexOf(u)===r)}class bi{constructor(u,r,a=null,o){_(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=r,this.entity=u,this.calculationEntryPoint=a||this,this===this.calculationEntryPoint&&!o)throw new Error("Change set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(u,r,a){const o=h3-sA-c3,p=y3-Vy-rA;u.metaSync({x:u.x||o,y:u.y||p},r);const e=new bi(u,0,null,r);e._onlyEntities=a||[],e.ids=["0"];const y=[];e.next(E=>{y.push(...E)}),bi.recursivelyAssembleChildrenAreas(y),e.resolveChildrenOverlaps();const v=e.flattenChildEntities();return e._onlyEntities?v.filter(E=>(e._onlyEntities||[]).includes(E)):v}static recursivelyAssembleChildrenAreas(u){const r=[];u.forEach(a=>{a.next(o=>{r.push(...o)})}),r.length>0&&bi.recursivelyAssembleChildrenAreas(r)}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 r=this.children.find(o=>o.entity===u);return r||this.children.reduce((o,p)=>o||p.findAreaInChildrenFromEntity(u),null)}findAreaFromEntity(u){if(this.entity===u)return this;const r=this.calculationEntryPoint.children,a=r.find(p=>p.entity===u);return a||r.reduce((p,e)=>p||e.findAreaInChildrenFromEntity(u),null)}addParent(u){if(!this.parents.includes(u)){const r=bi.resolveIds(u,this.index);this.ids.push(...r),this.parents.push(u)}}static resolveIds(u,r){return u?u.ids.map(a=>`${a}-${r}`):[`${r}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const u=bn(this.entity,!0);if(this.entity.type===f.Project){const r=[],a=[],o=[];u.forEach(e=>{if(f.DefinitionEntity===e.type){a.push(e);return}else if(Dt.includes(e.type)){o.push(e);return}r.push(e)});const p=r.sort((e,y)=>{const v=!!Tm(e,y).length,E=bn(e),w=bn(y);return v?0:E.length&&!w.length?-1:!E.length&&w.length?1:0}).filter(e=>!Ao(e).length);this.childEntities=[...a,...o,...p]}else{const r=[],a=[],o=[],p=[],e=[];vi.includes(this.entity.type)&&bm(this.entity).forEach(E=>{if(Tt.includes(E.type)){o.push(E);return}const w=fr(E);r.push(w)}),Nr.includes(this.entity.type)&&a.push(...this.entity.detachedChildren);const y=u.filter(v=>{const E=r.includes(v);return E||o.includes(v)||a.includes(v)?!1:Tt.includes(v.type)?(o.push(v),!1):$i.includes(v.type)&&!E?(p.push(v),!1):v.type===f.DefinitionEntity?(e.push(v),!1):!0});r.sort((v,E)=>Il(v,E)?-1:0),p.sort((v,E)=>Il(v,E)?-1:0),o.sort((v,E)=>hb(v,E)?1:hb(E,v)?-1:0),this.childEntities=[...e,...r,...p,...y,...o,...a]}}calculateCardSize(){const u=v3(this.entity);this.entityCardWidth=u.width,this.entityCardHeight=u.height}static getBoundriesOfTwoAreas(u,r){return{top:Math.min(u.top,r.top),left:Math.min(u.left,r.left),bottom:Math.max(u.bottom,r.bottom),right:Math.max(u.right,r.right)}}static getBoundriedOfCombinedAreas(u,r){const a=u.filter(p=>!r.includes(p));return a.reduce((p,e)=>r.includes(e)?p:bi.getBoundriesOfTwoAreas(p,e.fullBranchArea),a[0].fullBranchArea)}getFullAreaUntilAny(u){const r=this.ownEntityPlusBufferArea;return this.children.filter(e=>!u.includes(e)).map(e=>e.getFullAreaUntilAny(u)).reduce((e,y)=>bi.getBoundriesOfTwoAreas(e,y),r)}getFullAreaUntilAreaOrAnyChildren(u){const r=[u,...u.flattenChildren()],a=this.ownEntityPlusBufferArea;return this.children.filter(e=>r.includes(e)).map(e=>e.getFullAreaUntil(u)).reduce((e,y)=>bi.getBoundriesOfTwoAreas(e,y),a)}getFullAreaUntil(u){const r=this.ownEntityPlusBufferArea;return this.children.filter(p=>p!==u).map(p=>p.getFullAreaUntil(u)).reduce((p,e)=>bi.getBoundriesOfTwoAreas(p,e),r)}get fullBranchArea(){const u=this.ownEntityPlusBufferArea;return this.children.map(o=>o.fullBranchArea).reduce((o,p)=>bi.getBoundriesOfTwoAreas(o,p),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+Vy,right:u.right+sA}}static filterOutRepeatedAreas(u){return u.filter((r,a)=>u.indexOf(r)===a)}getEarliestId(u,r){const a=u.split("-"),o=r.split("-");return a.length<o.length?u:a.length>o.length?r:a.reduce((e,y,v)=>y<o[v]?u:r,u)}getEarliestLevel(){return this.ids.reduce((a,o)=>this.getEarliestId(a,o),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((o,p)=>p.getEarliestLevel()>o.getEarliestLevel()?p:o,this.parents[0]).countColumns();return u+=a,u}getLatestId(u,r){if(u===r)return u;const a=u.split("-"),o=r.split("-");return a.length<o.length?r:a.length>o.length?u:a.reduce((e,y,v)=>y>o[v]?u:r,u)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((a,o)=>this.getLatestId(a,o),this.ids[0]).split("-").length}smoothPosition(){const u=this.flattenSiblings();if(!u.length&&this.parents.length<=1&&this.children.length){const r=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(a=>{a!==this.calculationEntryPoint&&a.shiftDownAlone(r)})}else if([...Dt].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const r=u.filter(a=>!this.parents.includes(a));r.length?r.every(o=>{const p=this.countColumns(),e=o.countColumns();return p>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():r.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(u,r){if(u.includes(this))return u;this.move(this.entity,{y:this.entity.y+r});let a=[...u,this];return this.children.forEach(o=>{if(bi.getEarliestParentInChain(o)!==this)return;const e=n0e(a,o.entity.id);a=bi.filterOutRepeatedAreas([...a]),e||(a=a.filter(v=>v!==o));const y=o.shiftDownUntilAny(a,r);a.push(...y)}),a}shiftRightUntilAny(u,r){u.includes(this)||(this.move(this.entity,{x:this.entity.x+r}),this.children.forEach(a=>{const o=bi.filterOutRepeatedAreas([...this.flattenSiblings(),...u]);bi.getEarliestParentInChain(a)===this&&a.shiftRightUntilAny(o,r)}))}shiftRight(u){this.move(this.entity,{x:this.entity.x+u}),this.children.forEach(r=>{const o=r.flattenSiblings().filter(p=>p!==r);r.shiftRightUntilAny(o,u)})}shiftDownAlone(u){this.move(this.entity,{y:this.entity.y+u})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const u=this.parents.reduce((o,p)=>{const e=p.ownEntityArea,y=e.top+Vd,v={top:y,left:e.left,bottom:y,right:e.right};return bi.getBoundriesOfTwoAreas(o,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-Vd;this.shiftDownAlone(a)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const u=this.children.reduce((o,p)=>{const e=p.ownEntityArea,y=e.top+Vd,v={top:y,left:e.left,bottom:y,right:e.right};return bi.getBoundriesOfTwoAreas(o,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-Vd;return this.shiftDownAlone(a),a}resolveChildrenOverlaps(){const u=this.flattenChildren();let r=[];u.forEach(a=>{const o=a.adjustVerticallyToAvoidOverlaps();r.push(...o)}),u.forEach(a=>{a.smoothPosition()})}static getEarliestParentInChain(u){let r=u.parents[0];return u.parents.length&&(r=u.parents.sort((a,o)=>{if(!a.ids.length)return-1;if(!o.ids.length)return 1;const p=a.ids.sort((y,v)=>y.length<v.length?-1:0),e=o.ids.sort((y,v)=>y.length<v.length?-1:0);return p[0].length-e[0].length})[0]),r}flattenEarlierSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((a,o)=>{if(u.has(o.entity.id))return a;u.add(o.entity.id);const e=o.children.slice(0,o.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,o)=>{if(u.has(o.entity.id))return a;u.add(o.entity.id);const e=o.children.filter(y=>y!==this).reduce((y,v)=>[...y,v,...v.flattenChildren(u)],[]);return[...a,...e]},[])}flattenChildren(u=new Set){return this.children.reduce((r,a)=>u.has(a.entity.id)?r:(u.add(a.entity.id),[...r,a,...a.flattenChildren(u)]),[])}flattenParents(u=new Set){return this.parents.reduce((a,o)=>u.has(o.entity.id)?a:(u.add(o.entity.id),[...a,o,...o.flattenParents(u)]),[])}getAreaIfRendered(u){return this.calculationEntryPoint.flattenChildren().find(o=>o.entity.id===u.id)||null}getLowerSiblings(){const u=this.parents.reduce((r,a)=>{const o=a.children.indexOf(this),p=a.children.slice(o+1);return[...r,...p]},[]);return E3(u)}getLowerAreas(){const u=this.getLowerSiblings(),r=this.parents.reduce((a,o)=>[...a,...o.getLowerAreas()],[]);return E3([...u,...r])}adjustVerticallyToAvoidOverlaps(u=[]){const a=bi.getEarliestParentInChain(this).children[this.index-1];if(!a)return u;const o=this.flattenEarlierSiblings(),p=this.flattenParents(),e=[...o,...p,a],E=R(e.flatMap(V=>Tm(this.entity,V.entity))).filter(V=>V.id!==this.entity.id).map(V=>this.findAreaFromEntity(V)).filter(V=>!!V),w=this.getFullAreaUntilAny(E),A=a.getFullAreaUntilAny(E),$=e.reduce((V,B)=>B===this||B.fullBranchArea.left!==w.left?V:Math.max(V,B.fullBranchArea.bottom),A.bottom);if(w.top<$){const V=$-w.top+Vy;return this.shiftDownUntilAny(u,V)}return u}move(u,r){(this.onlyEntities||[]).includes(u)&&u.metaSync(r,this.changeSet)}addChild(u){const r=this.childEntities[u];let a=null;r.x&&r.y?a=this.getAreaIfRendered(r):!r.x&&!r.y&&this.move(r,{x:this.entity.x,y:this.entity.y}),a||(a=new bi(r,u,this.calculationEntryPoint));const o=this.ownEntityPlusBufferArea;this.children.includes(a)||(this.children.push(a),a.addParent(this));const p=a.fullBranchArea;if(p.left<o.right){const e=o.right-p.left;a.shiftRight(e)}return a}flattenChildEntities(u=new Set){return this.children.reduce((r,a)=>u.has(a.entity.id)?r:(u.add(a.entity.id),[...r,a.entity,...a.flattenChildEntities(u)]),[])}next(u){const r=[];this.childEntities.forEach((a,o)=>{const p=this.addChild(o);p&&r.push(p)}),u(r)}}var $c=(d=>(d.Amazon="amazon",d.Google="google",d.Microsoft="microsoft",d))($c||{}),kr=(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))(kr||{}),lA=(d=>(d.Post="post",d.Get="get",d.Acknowledgement="acknowledgment",d.Progress="progress",d.Error="error",d.Complete="complete",d))(lA||{}),hl=(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))(hl||{}),dA=(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))(dA||{}),yt=(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))(yt||{}),vn=(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))(vn||{});kr.CloudHostedCodebase,kr.HttpApi,kr.RelationalDatabase,kr.CloudHostedCodebase,kr.CloudHostedCodebase,kr.RelationalDatabase,kr.CloudHostedCodebase,kr.CloudHostedCodebase;function T3(d){return`project-${d}-http-api`}function I3(d){return`entity-${d}-database`}class A3{constructor(u,r,a,o,p,e,y,v,E){_(this,"stepType");_(this,"id");_(this,"resourceType");_(this,"index");_(this,"dependency",[]);_(this,"lastEvent",null);_(this,"lasEventTimestamp",null);_(this,"status",hl.Queued);_(this,"publicationRun");_(this,"resource");this.stepType=u,this.id=r,this.resourceType=a,this.status=o,this.dependency=p,this.index=e,this.lasEventTimestamp=y,this.publicationRun=v,this.resource=E}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 r,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((r=u.resource)==null?void 0:r.details)}}var b3=(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))(b3||{});class uA{constructor(u,r,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=r,this.provider=a}setDetails(u){this.details=u}setStatus(u){this.status=u}setProvisionedBy(u){this.provisionedBy=u}}class cA extends uA{constructor(r,a,o,p){super(r,o,p);_(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 r,a;return this.resourceType===kr.HttpApi?this.resourceId=T3(this.publicationRun.project.id):this.resourceType===kr.RelationalDatabase&&(this.resourceId=I3((a=(r=Array.from(this.owners.values()))==null?void 0:r[0])==null?void 0:a.id)),this.resourceId}}class pA extends uA{constructor(r,a,o){super(r,a,o);_(this,"resourceType");_(this,"details",null);_(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceType===kr.CompiledLocalCodebase?this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`:this.resourceType===kr.CloudHostedCodebase&&(this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`),this.resourceId}}class a0e{constructor(u,r){_(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=r}get project(){return this.editor.project}getInfraTypes(u){return this.steps.filter(r=>u.includes(r.resourceType))}getStepsTypes(u){return this.steps.filter(r=>u.includes(r.stepType))}toIds(u){return u.map(r=>r.id)}getResourceForEntity(u){const r=Array.from(this.explicitResources.values()).find(a=>a.owners.has(u.id));return r||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(kr.CompiledLocalCodebase,new pA(this,kr.CompiledLocalCodebase,$c.Amazon)),this.implicitGlobalResources.set(kr.CloudHostedCodebase,new pA(this,kr.CloudHostedCodebase,$c.Amazon));const u=this.project.entities.filter(a=>es(a,Le.HTTP_ENDPOINT)),r=this.project.entities.filter(a=>es(a,Le.RELATIONAL_DATABASE));if(r.length&&r.forEach(a=>{const o=new cA(this,[a],kr.RelationalDatabase,$c.Amazon);this.explicitResources.set(o.resourceId,o)}),u.length){const a=new cA(this,u,kr.HttpApi,$c.Amazon);this.explicitResources.set(a.resourceId,a)}}setSteps(u,r){u.forEach(a=>{this.addStep(a,r)}),this.editor.events.emit(yt.ProjectPublishRequestAcknowledged,{})}addStep(u,r){const a=u.dependency||[];if(a.length){const p=a.filter(e=>!this.steps.find(y=>y.id===e));if(p.length)throw new Error(`Missing dependencies: ${p.join(", ")}`)}if(!u.resource)throw new Error(`Resource not found for step ${u.stepType} (${u.id})`);if(!this.steps.find(p=>p.id===u.id)){const p=this.implicitGlobalResources.get(u.resourceType)||this.explicitResources.get(u.resource.resourceId),e=new A3(u.stepType,u.id,u.resourceType,u.status,a,u.index,r,this,p);this.steps.push(e)}}onUpdate(u){var r;if(Me.log("onUpdate",u),(r=u.payload)!=null&&r.stepType){const a=this.steps.find(o=>{var p;return o.id===((p=u.payload)==null?void 0:p.id)});a&&L(u.emittedAt).isAfter(L(a.lasEventTimestamp))&&a.update(u.payload)}this.editor.events.emit("publication-updated",{}),u.type===lA.Error?(this.finalStatus=dA.Failed,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-error",u)):u.type===lA.Complete&&(this.finalStatus=dA.Success,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-completed",u))}}function o0e(d){switch(d){case vn.CodeCompilation:return"Code generation";case vn.RelationalDatabaseDeployment:return"Database creation";case vn.HttpApiDeployment:return"HTTP gateway creation";case vn.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case vn.BundleCodebase:return"Bundle code";case vn.MigrateRelationalDatabase:return"Database structure migration";case vn.BusinessLogicCodebaseDeployment:return"Update servers with new code";case vn.CodebaseCleanup:return"Code cleanup";case vn.HttpApiDeletion:return"HTTP gateway deletion";case vn.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function l0e(d){switch(d){case yt.DeploymentCompleted:return"Successfully published";case yt.DeploymentStarted:return"Publication started";case yt.DeploymentFailed:return"Publication failed";case yt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case yt.RequestPayloadValidationFailed:return"Request payload validation failed";case yt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case yt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case yt.RelationalDatabaseDeploymentStarted:return"Database creation started";case yt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case yt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case yt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case yt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case yt.RelationalDatabaseAlreadyExists:return"Database already exists";case yt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case yt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case yt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case yt.CreatingNewHttpApi:return"Creating new HTTP gateway";case yt.HttpApiAlreadyExists:return"HTTP gateway already exists";case yt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case yt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case yt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case yt.BundlingCodebaseForDownload:return"Bundling code for download";case yt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case yt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case yt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case yt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case yt.CodeCompilationStarted:return"Code generation started";case yt.CodeCompilationCompleted:return"Code generation completed";case yt.CodeCompilationFailed:return"Code generation failed";case yt.BundleCodebaseStarted:return"Code bundling started";case yt.BundleCodebaseCompleted:return"Code bundling completed";case yt.BundleCodebaseFailed:return"Code bundling failed";case yt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case yt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case yt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case yt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case yt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case yt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case yt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case yt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case yt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case yt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case yt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case yt.ProjectNotFound:return"Project not found";case yt.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case yt.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case yt.HttpApiDeletionStarted:return"HTTP gateway deletion started";case yt.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case yt.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case yt.RelationalDatabaseDeletionStarted:return"Database deletion started";case yt.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case yt.RelationalDatabaseDeletionFailed:return"Database deletion failed";case yt.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var w3=(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))(w3||{});function d0e(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 u0e(d){switch(d){case kr.RelationalDatabase:return"Relational database";case kr.HttpEndpoint:case kr.HttpApi:return"HTTP endpoints";case kr.ServerlessFunction:case kr.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function c0e(d){switch(d){case hl.Running:return"In progress";case hl.Failed:return"Failed";case hl.Success:return"Succeeded";case hl.Skipped:return"Skipped";case hl.Queued:default:return"Queued"}}function R3(d){var o;(o=d.dataType)==null||o.validate(),d.inputs.forEach(p=>p.validate()),d.outputs.forEach(p=>p.validate()),d.internalCalls.forEach(p=>p.validate());const r=[...Pa(d),...Eo(d),...g3(d),...Na(d),..._3(d)],a=rb(d);return r.push(...a),Er(d.errors,r)}function g3(d,u){const a=[...d.project.getVariableDeclarations()].filter(o=>o.id!==d.id);return Zp(d,[xr],a,u)}function _3(d){const u=[];if(d.parent!==d.project)return u;if(d.catchesError){const r=bt({id:`${d.id}--${se.GlobalVariableDeclarationCannotCatchError}`,message:`${Vs[d.type].singular} "${Y(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:Z.Error,code:se.GlobalVariableDeclarationCannotCatchError,entity:d});u.push(r.error)}if(d.errorCalls.length){const r=bt({id:`${d.id}--${se.GlobalVariableDeclarationCannotCallOnError}`,message:`${Vs[d.type].singular} "${Y(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:Z.Error,code:se.GlobalVariableDeclarationCannotCallOnError,entity:d});u.push(r.error)}if(d.calledBy.length){const r=bt({id:`${d.id}--${se.GlobalVariableDeclarationCannotBeCalled}`,message:`${Vs[d.type].singular} "${Y(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:Z.Error,code:se.GlobalVariableDeclarationCannotBeCalled,entity:d});u.push(r.error)}return[]}const p0e=Object.freeze(Object.defineProperty({__proto__:null,validate:R3,validateGlobalVariableDeclaration:_3,validateVariableDeclarationName:g3},Symbol.toStringTag,{value:"Module"}));function D3(d){d.inputs.forEach(o=>o.validate()),d.outputs.forEach(o=>o.validate()),d.internalCalls.forEach(o=>o.validate());const r=[...Pa(d),...Eo(d),...Na(d)],a=rb(d);return r.push(...a),Er(d.errors,r)}const f0e=Object.freeze(Object.defineProperty({__proto__:null,validate:D3},Symbol.toStringTag,{value:"Module"}));var fA=(d=>(d.Parent="parent",d.DataTypeEntity="data-type-entity",d.VarDeclaration="var-declaration",d))(fA||{});const xt=class xt extends Cr{constructor(r,a){super(r);_(this,"initialData");_(this,"id");_(this,"x");_(this,"y");_(this,"type",f.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=r,this.project=a,this.id=r.id,this.x=r.x,this.y=r.y,this.catchesError=r.catchesError||!1}static new(r=null){return{id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(r==null?void 0:r.timestamp)||L().toISOString(),author:(r==null?void 0:r.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.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(r,a){let o=a;if(r.parent){const V=J(r.parent);o=a.get(V)}const p=J(r.declaration),e=a.get(p),y=r.calledByEntry.map(V=>{const B=J(V);return a.get(B)}),v=r.calledBySuccess.map(V=>{const B=J(V);return a.get(B)}),E=r.calledByError.map(V=>{const B=J(V);return a.get(B)});let w=null;if(r.readsValue){const V=J(r.readsValue);w=a.get(V)}const A={id:r.id,version:N.UUID.uuid(),createdAt:L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.VariableInstance,catchesError:r.catchesError||!1,declaration:e.toReference(),calledByEntry:y,calledBySuccess:v,calledByError:E,defaultValue:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:w,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:o},$=ne(A,a);return $.setParent(o,null),$}static validateGenerationTarget(r,a){let o=JSON.parse(JSON.stringify(r));const p=[],e=ri(o,{parent:{list:!1,types:[...Nr,f.Project],optional:!0},declaration:{list:!1,types:[f.VariableDeclaration]}},a);return o=e.modifiedData,p.push(...e.errors,...Vr(o)),{errors:p,modifiedData:o}}get codeName(){var r;return(r=this.declaration)==null?void 0:r.codeName}get codeNativeValueValidation(){var r;return this._codeNativeValueValidation||((r=this.declaration)==null?void 0:r.codeNativeValueValidation)||null}validateGeneratedUpdate(r){const a=[];let o=JSON.parse(JSON.stringify(r));const p=Hp(o,this);return o=p.modifiedData,a.push(...p.errors),r.parent&&a.push(new ae({id:`${this.id}--${k.InvalidParentUpdate}`,code:k.InvalidParentUpdate,severity:Z.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.
85
85
  If an entity is called by another, they must be in the same scope, which means they have the same parent.
86
86
  Specifically for variables, their scope is also calculated from their value readers and value writters.
87
87
  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:o}}subscribeDependents(r){return r.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(r){return r.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(r=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-dependents"))){const a=[],o=[],p=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(r);a.push(...v.updated),o.push(...v.added),p.push(...v.removed),e.push(...v.affected)}),r==null||r.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}onDetachedDependencyRemoved(r,a,o){const p=[],e=[],y=[],v=[];if(a==="parent"){const{updated:E,added:w,removed:A}=this.remove({ignoreUpstream:!1},o);p.push(...E),e.push(...w),y.push(...A)}if(a==="var-declaration"){const{updated:E,added:w,removed:A}=this.remove({ignoreUpstream:!1},o);p.push(...E),e.push(...w),y.push(...A)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(r,a,o){const p=[],e=[],y=[],v=[];if(a==="parent"){const{updated:E,added:w,removed:A}=this.restore({},o);p.push(...E),e.push(...w),y.push(...A)}if(a==="var-declaration"){const{updated:E,added:w,removed:A}=this.restore({},o);p.push(...E),e.push(...w),y.push(...A)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){var r,a,o,p,e,y,v;return(a=(r=this.parent)==null?void 0:r.unsubscribeDependents)==null||a.call(r,[{entity:this,field:"parent"}]),(e=(p=(o=this.declaration.dataType)==null?void 0:o.entity)==null?void 0:p.unsubscribeDependents)==null||e.call(p,[{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 r,a,o,p;return(r=this.parent)==null||r.subscribeDependents([{entity:this,field:"parent"}]),(p=(o=(a=this.declaration.dataType)==null?void 0:a.entity)==null?void 0:o.subscribeDependents)==null||p.call(o,[{entity:this,field:"data-type-entity"}]),this.declaration.subscribeDependents([{entity:this,field:"var-declaration"}]),this}increaseVersion(r){if(r&&!L(r).isValid())throw new Error(`The shared timestamp '${r}' is not a valid ISO 8601 date string.`);return r&&L(r).isSame(L(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=L(r).toISOString()||L().toISOString(),this)}captureVersion(){var a;const r=((a=this.knownVersions)==null?void 0:a.get(this.version))||new xt(this,this.project);return r.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,r):new Map([[this.version,r]]),r.inputs=[...this.inputs],r.outputs=[...this.outputs],r.internalCalls=[...this.internalCalls],r.successCalls=[...this.successCalls],r.errorCalls=[...this.errorCalls],r.writesValues=[...this.writesValues],r.readsValue=this.readsValue,r.defaultValue=this.defaultValue,r.declaration=this.declaration,r.calledBySuccess=[...this.calledBySuccess],r.calledByError=[...this.calledByError],r.calledByEntry=[...this.calledByEntry],r.error=this.error,r.parent=this.parent,this}recursiveCaptureUpstreamVersions(r){const a=[],o=[],p=[],e=[];if(this.parent){this.parent.increaseVersion(r);const y=this.parent.recursiveCaptureUpstreamVersions(r);a.push(this.parent,...y.updated),o.push(...y.added),p.push(...y.removed)}return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}async restoreVersion(r){var v;const a=[],o=[],p=[],e=[];if(this.version===r)return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this};if(!this.knownVersions){const E=new Map;for(const[w,A]of this.knownVersions||new Map){if(E.set(w,A),A.activeVersion=!1,A.knownVersions)for(const[$,V]of A.knownVersions)E.set($,V);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(r);if(!y){const E=await this.APILoadVersion({},r);if(!E)throw new Error(`Version with id '${r}' for entity with id '${this.id}' not found.`);y=new xt(E,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:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}updateWithShallowTransfer(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"update-with-shallow-transfer"))){if(this.metaSync(r,a),this.version=r.version,this.createdAt=r.createdAt,this.author=r.author,this.deleted=r.deleted,this.previousVersion=r.previousVersion,this.unsubscribeFromDependencies(),r.parent){const o=J(r.parent),p=this.project.get(o),e=this.parent;if(e&&e.id!==(p==null?void 0:p.id)&&this.removeFromParent(a),p)this.setParent(p,a);else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${o}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(r.readsValue){const o=J(r.readsValue),p=this.project.get(o),e=this.readsValue;e&&e.id!==(p==null?void 0:p.id)&&this.removeValueWriter(a),p&&this.setValueWriter(p,a)}if(r.declaration){const o=J(r.declaration),p=this.project.get(o);p&&this.setDeclaration(p)}return r.calledByEntry.forEach(o=>{const p=J(o),e=this.project.get(p);e&&(this.addEntryCaller(e,a),e.addCall(this,a))}),[...this.calledByEntry].forEach(o=>{r.calledByEntry.find(e=>J(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),r.calledBySuccess.forEach(o=>{const p=J(o),e=this.project.get(p);e&&(this.addSuccessCaller(e,a),e.addSuccessCall(this,a))}),[...this.calledBySuccess].forEach(o=>{r.calledBySuccess.find(e=>J(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),r.calledByError.forEach(o=>{const p=J(o),e=this.project.get(p);e&&(this.addErrorCaller(e,a),e.addErrorCall(this,a))}),[...this.calledBySuccess].forEach(o=>{r.calledBySuccess.find(e=>J(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const r=[],a=[],o=[],p=[];if(this.initialData.parent){const e=J(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null),r.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=J(this.initialData.readsValue),y=this.project.get(e);y&&(this.setValueWriter(y,null),r.push(y))}if(this.initialData.declaration){const e=J(this.initialData.declaration),y=this.project.get(e);y&&(this.setDeclaration(y),r.push(y))}return this.initialData.calledByEntry.forEach(e=>{const y=J(e),v=this.project.get(y);v&&this.addEntryCaller(v,null)}),this.initialData.calledBySuccess.forEach(e=>{const y=J(e),v=this.project.get(y);v&&this.addSuccessCaller(v,null)}),this.initialData.calledByError.forEach(e=>{const y=J(e),v=this.project.get(y);v&&this.addErrorCaller(v,null)}),{updated:R(r),added:R(a),removed:R(o),affected:R(p),self:this}}afterAllChildrenInitialized(r=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"after-all-children-initialized"))){var ge;const a=[],o=[],p=[],e=[];if(this.initialized=!0,!this.declaration.dataType||(ge=this.declaration.dataType)!=null&&ge.inferred){const{added:$e,updated:qe,removed:xe,affected:lt}=this.declaration.inferDataTypeAndSyncInstancesInputsAndOutputs(r);o.push(...$e),a.push(...qe),p.push(...xe),e.push(...lt)}const{added:y,updated:v,removed:E,affected:w}=this.syncInputs(r);o.push(...y),a.push(...v),p.push(...E),e.push(...w);const{added:A,updated:$,removed:V,affected:B}=this.syncOutputs(r);o.push(...A),a.push(...$),p.push(...V),e.push(...B);const{added:F,updated:K,removed:q,affected:ie}=this.generateUnusedInternalCalls(r);o.push(...F),a.push(...K),p.push(...q),e.push(...ie);const{added:W,updated:de,removed:Q,affected:ce}=this.removeUnrecognizedInputs(r);o.push(...W),a.push(...de),p.push(...Q),e.push(...ce);const{added:X,updated:z,removed:pe,affected:te}=this.removeUnrecognizedOutputs(r);o.push(...X),a.push(...z),p.push(...pe),e.push(...te);const{added:ue,updated:Ie,removed:Ue,affected:Pe}=this.removeUnrecognizedInternalCalls(r);return o.push(...ue),a.push(...Ie),p.push(...Ue),e.push(...Pe),this.captureVersion(),r==null||r.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}addSelfToProject(r=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-self-to-project"))){const a=[this],o=[],p=[],e=[];return this.parent===this.project&&this.project.addVariableInstance(this),this.readsValue&&(this.readsValue.addValueReader(this,r),a.push(this.readsValue)),this.writesValues.forEach(y=>{y.setValueWriter(this,r),a.push(y)}),this.successCalls.forEach(y=>{y.addSuccessCaller(this,r),a.push(y)}),this.errorCalls.forEach(y=>{y.addErrorCaller(this,r),a.push(y)}),this.calledBySuccess.forEach(y=>{y.addSuccessCall(this,r),a.push(y)}),this.calledByError.forEach(y=>{y.addErrorCall(this,r),a.push(y)}),this.calledByEntry.forEach(y=>{y.addCall(this,r),a.push(y)}),this.subscribe(),this.subscribeToDependencies(),r==null||r.attemptAutoclose("add-self-to-project",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}get usedInputs(){return this.inputs.filter(r=>r.readsValue||r.defaultValue)}get unusedInputs(){return this.inputs.filter(r=>!r.readsValue&&!r.defaultValue)}get usedOutputs(){return this.outputs.filter(r=>r.writesValues.length)}get unusedOutputs(){return this.outputs.filter(r=>!r.writesValues.length)}get usedInternalCalls(){return this.internalCalls.filter(r=>!!r.calledBy.length)}get unusedInternalCalls(){const r=this.usedInternalCalls;return this.internalCalls.filter(o=>!(r.find(y=>y.id===o.id)||r.find(y=>y.declaration===o.declaration)))}removeInternalCall(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-variable-instance-internal-call"))){const o=this.internalCalls.findIndex(p=>p.id===r.id);return o>-1&&(this.internalCalls.splice(o,1),a&&(a==null||a.add(this,S.Affected))),a==null||a.attemptAutoclose("remove-variable-instance-internal-call",this.id),this}removeInput(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-input"))){const o=this.inputs.findIndex(p=>p.id===r.id);return o>-1&&(this.inputs.splice(o,1),a&&(a==null||a.add(this,S.Affected))),a==null||a.attemptAutoclose("remove-input",this.id),this}addInput(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-input"))){return this.inputs.includes(r)?(a==null||a.attemptAutoclose("add-input",this.id),this):(this.inputs.push(r),a==null||a.add(this,S.Affected),a==null||a.attemptAutoclose("add-input",this.id),this)}addOutput(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-output"))){return this.outputs.includes(r)?(a==null||a.attemptAutoclose("add-output",this.id),this):(this.outputs.push(r),a==null||a.add(this,S.Affected),a==null||a.attemptAutoclose("add-output",this.id),this)}removeOutput(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-output"))){const o=this.outputs.findIndex(p=>p.id===r.id);return o>-1&&(this.outputs.splice(o,1),a&&(a==null||a.add(this,S.Affected))),a==null||a.attemptAutoclose("remove-output",this.id),this}addSuccessCaller(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-success-caller")),o=!1){return this.calledBySuccess.find(p=>p.id===r.id)||(this.calledBySuccess.push(r),a==null||a.add(this,S.Updated),o&&Ze(this,a)),a==null||a.attemptAutoclose("add-success-caller",this.id),this}addErrorCaller(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-error-caller")),o=!1){return this.calledByError.find(p=>p.id===r.id)||(this.calledByError.push(r),a==null||a.add(this,S.Updated),o&&Ze(this,a)),a==null||a.attemptAutoclose("add-error-caller",this.id),this}addEntryCaller(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-entry-caller")),o=!1){return this.calledByEntry.find(p=>p.id===r.id)||(this.calledByEntry.push(r),a==null||a.add(this,S.Updated),o&&Ze(this,a)),a==null||a.attemptAutoclose("add-entry-caller",this.id),this}addErrorCall(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-error-call")),o=!1){return this.errorCalls.find(p=>p.id===r.id)||(this.errorCalls.push(r),o&&Ze(this,a),a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("add-error-call",this.id),this}addSuccessCall(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-success-call")),o=!1){return this.successCalls.find(p=>p.id===r.id)||(this.successCalls.push(r),o&&Ze(this,a),a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("add-success-call",this.id),this}removeCall(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-call")),o=!1){const p=this.successCalls.findIndex(y=>y.id===r.id);p>-1&&(this.successCalls.splice(p,1),a==null||a.add(this,S.Affected));const e=this.errorCalls.findIndex(y=>y.id===r.id);return e>-1&&(this.errorCalls.splice(e,1),a==null||a.add(this,S.Affected)),o&&Ze(this,a),a==null||a.attemptAutoclose("remove-call",this.id),this}removeCaller(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-caller")),o=!1){return this.calledBySuccess=this.calledBySuccess.filter(p=>p.id!==r.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),this.calledByError=this.calledByError.filter(p=>p.id!==r.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(p=>p.id!==r.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),o&&Ze(this,a),a==null||a.attemptAutoclose("remove-caller",this.id),this}addValueReader(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-value-reader"))){return this.writesValues.includes(r)?(a==null||a.attemptAutoclose("add-value-reader",this.id),this):(this.writesValues.push(r),a==null||a.add(this,S.Affected),this)}setParent(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-parent"))){var o;return((o=this.parent)==null?void 0:o.id)!==(r==null?void 0:r.id)&&(this.parent=r,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-parent",this.id),this}initChildren(r=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=ne(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(r)),this.initialData.declaration.type===f.GenericReference){const a=this.project.findSubscribedInstanceFromReference(this.initialData.declaration);if(!a)return this;this.declaration=a}else this.declaration=ne(this.initialData.declaration,this.project),this.declaration.initChildren(r);return nf.initWritesValues(this,this.parent),sf.initReadsValue(this),this.initialData.inputs.forEach(a=>{const o=ne(a,this.project);return o.setParent(this,null),o.initChildren(r),this.addInput(o,null),o}),this.initialData.outputs.forEach(a=>{const o=ne(a,this.project);return o.setParent(this,null),o.initChildren(r),this.addOutput(o,r),o}),this.successCalls=this.initialData.successCalls.map(a=>{const o=ne(a,this.project);if(o.addSuccessCaller(this),[f.BreakStatement,f.ContinueStatement].includes(o.type))o.setParent(this.parent.parent,null),o.initChildren(r);else if(o.type===f.ReturnStatement){const p=Jr(this,this.project);o.setParent(p,null),o.initChildren(r)}else o.type!==f.InternalCall&&(o.setParent(this.parent,null),o.initChildren(r));return o}),this.errorCalls=this.initialData.errorCalls.map(a=>{const o=ne(a,this.project);if(o.addErrorCaller(this),[f.BreakStatement,f.ContinueStatement].includes(o.type))o.setParent(this.parent.parent,null),o.initChildren(r);else if(o.type===f.ReturnStatement){const p=Jr(this,this.project);o.setParent(p,null),o.initChildren(r)}else o.type!==f.InternalCall&&(o.setParent(this.parent,null),o.initChildren(r));return o}),this.internalCalls=this.initialData.internalCalls.reduce((a,o)=>{if(o.type===f.GenericReference){const p=this.project.findSubscribedInstanceFromReference(o);if(!p)return a;const e=p;return e.setParent(this,null),[...a,e]}else{const p=ne(o,this.project);return p.setParent(this,null),p.initChildren(r),[...a,p]}},[]),this.initialData.error&&(this.error=ne(this.initialData.error,this.project),this.error.setParent(this,null),this.error.initChildren(r)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(r),r==null||r.attemptAutoclose("init-children",this.id),this}setValueWriter(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-value-writer"))){return this.readsValue!==r&&(this.readsValue=r,a==null||a.add(this,S.Updated)),a==null||a.attemptAutoclose("set-value-writer",this.id),this}removeValueWriter(r=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-value-writer"))){return this.readsValue&&(this.readsValue=null,r==null||r.add(this,S.Updated)),r==null||r.attemptAutoclose("remove-value-writer",this.id),this}removeValueReader(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-value-reader"))){return this.writesValues.includes(r)?(this.writesValues=this.writesValues.filter(o=>o.id!==r.id),a==null||a.add(this,S.Affected),this):(a==null||a.attemptAutoclose("remove-value-reader",this.id),this)}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"meta-sync"))){const o=Lr(this,r),p=this.toMeta();return this.x=r.x||p.x,this.y=r.y||p.y,this.catchesError=r.catchesError!==void 0?r.catchesError:this.catchesError,super.metaSync(r),r.deleted===!0&&!p.deleted?a==null||a.add(this,S.Removed):r.deleted===!1&&p.deleted?a==null||a.add(this,S.Added):o&&(a==null||a.add(this,S.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(r=ve,...a){return await xt.repository.APILoad(this.id,...a),this}async APICreate(r=ve,...a){return await xt.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(r=ve,...a){return await xt.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(r=ve,...a){return await xt.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(r=ve,...a){return await xt.repository.APIClone(this.id,...a),this}async APILoadVersion(r=ve,a,...o){return await xt.repository.APILoadVersion(this.id,a,...o)}removeFromParent(r=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-from-parent"))){const a=[],o=[],p=[],e=[];return this.parent.type===f.Project?(this.parent.removeVariableInstance(this),e.push(this.parent)):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),r==null||r.attemptAutoclose("remove-from-parent",this.id),{added:R(p),updated:R(a),removed:R(o),affected:R(e),self:this}}remove({ignoreUpstream:r}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-entity"))){const o=[],p=[],e=[],y=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(p.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:w,added:A}=v.entity.onDetachedDependencyRemoved(this,v.field,a);o.push(...E),p.push(...w),e.push(...A)}),this.defaultValue){const{updated:v,removed:E}=this.defaultValue.remove({ignoreUpstream:!0},a);o.push(...v),p.push(...E)}if(this.readsValue&&(o.push(this.readsValue),this.readsValue.removeValueReader(this,a)),this.writesValues.forEach(v=>{o.push(v),v.setValueWriter(null,a)}),this.inputs.forEach(v=>{const{updated:E,removed:w}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...w)}),this.outputs.forEach(v=>{const{updated:E,removed:w}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...w)}),this.successCalls.forEach(v=>{o.push(v),v.removeCaller(this,a)}),this.errorCalls.forEach(v=>{o.push(v),v.removeCaller(this,a)}),this.internalCalls.forEach(v=>{const{updated:E,removed:w}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...w)}),!r){const v=this.removeFromParent(a);e.push(...v.added),o.push(...v.updated),p.push(...v.removed),y.push(...v.affected),this.calledBy.forEach(E=>{o.push(E),E.removeCall(this,a)})}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:R(e),updated:R(o),removed:R(p),affected:R(y),self:this}}restore({}={},r=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"restore-entity"))){const a=[],o=[],p=[],e=[];if(r!=null&&r.hasAdded(this.id))return r==null||r.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},r),Object.values(this.detachedDependents).forEach(y=>{const{updated:v,removed:E,added:w}=y.entity.onDetachedDependencyRestored(this,y.field,r);o.push(...v),p.push(...E),a.push(...w)}),this.defaultValue){const{updated:y}=this.defaultValue.restore({},r);o.push(...y)}return this.readsValue&&(o.push(this.readsValue),this.readsValue.addValueReader(this,r)),this.writesValues.forEach(y=>{o.push(y),y.setValueWriter(this,r)}),this.inputs.forEach(y=>{const{updated:v}=y.restore({},r);o.push(...v)}),this.outputs.forEach(y=>{const{updated:v}=y.restore({},r);o.push(...v)}),this.successCalls.forEach(y=>{o.push(y),y.addSuccessCaller(this,r)}),this.errorCalls.forEach(y=>{o.push(y),y.addErrorCaller(this,r)}),this.internalCalls.forEach(y=>{const{updated:v}=y.restore({},r);o.push(...v)}),this.calledBySuccess.forEach(y=>{o.push(y),y.addSuccessCall(this,r)}),this.calledByError.forEach(y=>{o.push(y),y.addErrorCall(this,r)}),this.calledByEntry.forEach(y=>{o.push(y),y.addCall(this,r)}),r==null||r.attemptAutoclose("restore-entity",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this}}toFlat(r=new Set){var o,p;return r.has(this.id)?[]:(r.add(this.id),[this,...((o=this.defaultValue)==null?void 0:o.toFlat(r))||[],...this.writesValues.flatMap(e=>e.toFlat(r)),...((p=this.readsValue)==null?void 0:p.toFlat(r))||[],...this.successCalls.flatMap(e=>e.toFlat(r)),...this.errorCalls.flatMap(e=>e.toFlat(r)),...this.inputs.flatMap(e=>e.toFlat(r)),...this.outputs.flatMap(e=>e.toFlat(r)),...this.internalCalls.flatMap(e=>e.toFlat(r))])}toFlatIds(r=new Set){var o;return r.has(this.id)?[]:(r.add(this.id),[this.id,...((o=this.defaultValue)==null?void 0:o.toFlatIds(r))||[],...this.writesValues.flatMap(p=>p.toFlatIds(r)),...this.successCalls.flatMap(p=>p.toFlatIds(r)),...this.errorCalls.flatMap(p=>p.toFlatIds(r)),...this.inputs.flatMap(p=>p.toFlatIds(r)),...this.outputs.flatMap(p=>p.toFlatIds(r)),...this.internalCalls.flatMap(p=>p.toFlatIds(r))])}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}}toJSON(r=new Set){var a,o,p;return r.has(this.id)?this.toReference():(r.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,declaration:this.declaration.toJSON(r),defaultValue:((a=this.defaultValue)==null?void 0:a.toJSON(r))||null,readsValue:((o=this.readsValue)==null?void 0:o.toReference())||null,writesValues:this.writesValues.map(e=>e.toJSON(r)),inputs:this.inputs.map(e=>e.toJSON(r)),outputs:this.outputs.map(e=>e.toJSON(r)),successCalls:this.successCalls.map(e=>e.toJSON(r)),errorCalls:this.errorCalls.map(e=>e.toJSON(r)),internalCalls:this.internalCalls.map(e=>e.toJSON(r)),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:((p=this.error)==null?void 0:p.toJSON(r))||null,x:this.x,y:this.y})}toJSONClone(r=Se){var o,p,e,y,v,E,w,A;let a;return(o=r.seenEntityMaps)!=null&&o.has(this.id)?a=r.seenEntityMaps.get(this.id):(a=r.newId||jr(this,this.project,r.uuidStrategy),r.seenEntityMaps&&r.seenEntityMaps.set(this.id,a)),(p=r.seenEntities)!=null&&p.has(a)||(e=r.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:r.seenEntityMaps}):((y=r.seenEntities)==null||y.add(a),(v=r.seenEntities)==null||v.add(this.id),{id:a,version:N.UUID.uuid(),createdAt:r.timestamp||L().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,catchesError:this.catchesError,type:this.type,defaultValue:((E=this.defaultValue)==null?void 0:E.toJSONClone({...r,newId:null}))||null,declaration:this.declaration.toReference({seenEntityMaps:r.seenEntityMaps}),readsValue:((w=this.readsValue)==null?void 0:w.toReference({seenEntityMaps:r.seenEntityMaps}))||null,writesValues:this.writesValues.map($=>$.toJSONClone({...r,newId:null})),inputs:this.inputs.map($=>$.toJSONClone({...r,newId:null})),outputs:this.outputs.map($=>$.toJSONClone({...r,newId:null})),successCalls:this.successCalls.map($=>$.toJSONClone({...r,newId:null})),errorCalls:this.errorCalls.map($=>$.toJSONClone({...r,newId:null})),internalCalls:this.internalCalls.map($=>this.calledBy.length||this.readsValue?$.toJSONClone({...r,newId:null}):$.toReference({seenEntityMaps:r.seenEntityMaps})),calledBySuccess:this.calledBySuccess.map($=>$.toReference({seenEntityMaps:r.seenEntityMaps})),calledByError:this.calledByError.map($=>$.toReference({seenEntityMaps:r.seenEntityMaps})),calledByEntry:this.calledByEntry.map($=>$.toReference({seenEntityMaps:r.seenEntityMaps})),error:((A=this.error)==null?void 0:A.toJSONClone({...r,newId:null}))||null,parent:this.parent.toReference({seenEntityMaps:r.seenEntityMaps}),x:this.x,y:this.y})}toReference(r=Se){var o;let a=this.id;return(o=r.seenEntityMaps)!=null&&o.has(this.id)&&(a=r.seenEntityMaps.get(this.id)),{id:a+"--"+N.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(r=Se){var o,p,e,y,v;let a=this.id;return(o=r.seenEntityMaps)!=null&&o.has(this.id)&&(a=r.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,x:this.x,y:this.y,defaultValue:((p=this.defaultValue)==null?void 0:p.toReference(r))||null,declaration:((e=this.declaration)==null?void 0:e.toReference(r))||null,readsValue:((y=this.readsValue)==null?void 0:y.toReference(r))||null,writesValues:this.writesValues.map(E=>E.toReference(r)),inputs:this.inputs.map(E=>E.toReference(r)),outputs:this.outputs.map(E=>E.toReference(r)),successCalls:this.successCalls.map(E=>E.toReference(r)),errorCalls:this.errorCalls.map(E=>E.toReference(r)),calledBySuccess:this.calledBySuccess.map(E=>E.toReference(r)),calledByError:this.calledByError.map(E=>E.toReference(r)),calledByEntry:this.calledByEntry.map(E=>E.toReference(r)),internalCalls:this.internalCalls.map(E=>E.toReference(r)),error:((v=this.error)==null?void 0:v.toReference(r))||null,parent:this.parent.toReference(r)}}toFlatJSON(r=new Set){var o,p;return r.has(this.id)?[]:(r.add(this.id),[this.toShallowJSON(),...((o=this.defaultValue)==null?void 0:o.toFlatJSON(r))||[],...((p=this.declaration)==null?void 0:p.toFlatJSON(r))||[],...this.writesValues.flatMap(e=>e.toFlatJSON(r)),...this.successCalls.flatMap(e=>e.toFlatJSON(r)),...this.errorCalls.flatMap(e=>e.toFlatJSON(r)),...this.inputs.flatMap(e=>e.toFlatJSON(r)),...this.outputs.flatMap(e=>e.toFlatJSON(r)),...this.internalCalls.flatMap(e=>e.toFlatJSON(r)),...this.calledBy.flatMap(e=>e.toFlatJSON(r))])}toGenerationTarget(){const r=this.parent.type===f.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:r}}toFlatGenerationTarget(r=new Set){var o,p,e;return r.has(this.id)?[]:(r.add(this.id),[this.toGenerationTarget(),...((o=this.defaultValue)==null?void 0:o.toFlatGenerationTarget(r))||[],...((p=this.declaration)==null?void 0:p.toFlatGenerationTarget(r))||[],...((e=this.readsValue)==null?void 0:e.toFlatGenerationTarget(r))||[],...this.writesValues.flatMap(y=>y.toFlatGenerationTarget(r)),...this.successCalls.flatMap(y=>y.toFlatGenerationTarget(r)),...this.errorCalls.flatMap(y=>y.toFlatGenerationTarget(r)),...this.inputs.flatMap(y=>y.toFlatGenerationTarget(r)),...this.outputs.flatMap(y=>y.toFlatGenerationTarget(r)),...this.internalCalls.flatMap(y=>y.toFlatGenerationTarget(r))])}clearErrors(){var r;return this.errors=[],(r=this.defaultValue)==null||r.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 r=D3(this);return this.errors=r,{success:!0}}getErrors(){var a,o;return[...this.errors,...((a=this.defaultValue)==null?void 0:a.getErrors())||[],...this.inputs.flatMap(p=>p.getErrors()),...this.internalCalls.flatMap(p=>p.getErrors()),...this.outputs.flatMap(p=>p.getErrors()),...((o=this.readsValue)==null?void 0:o.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var r;return this.defaultValue||((r=this.declaration)==null?void 0:r.defaultValue)||null}setDefaultValue(r,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-default-value"))){const o=this.defaultValue;return(o==null?void 0:o.id)!==(r==null?void 0:r.id)&&(o==null||o.remove({ignoreUpstream:!0},a),this.defaultValue=r,a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("set-default-value",this.id),this}clone(r=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"clone-entity")),a=null,o=null,p=!0){var B,F,K,q;let e=Ur(a,this);const y=this.toJSON(),v=o||N.UUID.uuid();y.inputs=[],y.id=v,y.version=N.UUID.uuid(),y.createdAt=(r==null?void 0:r.timestamp)||L().toISOString(),y.author=(r==null?void 0:r.author)||"1",y.previousVersion=null,y.deleted=!1;const E=dr(y,e);a?E.setParent(a,null):E.setParent(this.parent,null),p&&E.subscribe(),E.initChildren(r),r==null||r.add(E,S.Added);const w=(B=this.defaultValue)==null?void 0:B.clone(r,E,N.UUID.uuid(),p);E.defaultValue=w||null;const A=(F=this.inputs)==null?void 0:F.map(ie=>ie.clone(r,E,N.UUID.uuid(),p));E.inputs=A;const $=(K=this.outputs)==null?void 0:K.map(ie=>ie.clone(r,E,N.UUID.uuid(),p));E.outputs=$;const V=(q=this.internalCalls)==null?void 0:q.map(ie=>ie.clone(r,E,N.UUID.uuid(),p));return E.internalCalls=V,r==null||r.attemptAutoclose("clone-entity",this.id),E}addInternalCall(r){return this.internalCalls.find(a=>a===r)||this.internalCalls.push(r),this}setDeclaration(r){return this.declaration!==r&&(this.declaration=r),this}removeUnrecognizedInputs(r=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-unrecognized-variable-instance-inputs"))){const a=[],o=[],p=[],e=[];return this.declaration.dataType&&!this.declaration.dataType.isObject()?[...this.inputs].forEach(y=>{const v=y.remove({ignoreUpstream:!1},r);p.push(...v.removed),a.push(...v.updated)}):this.declaration.dataType&&this.declaration.dataType.hasStrictObjectStructure()&&[...this.inputs].forEach(y=>{var E;if(!y.declaration){const w=y.remove({ignoreUpstream:!1},r);p.push(...w.removed),a.push(...w.updated);return}if(![...((E=this.declaration.dataType)==null?void 0:E.entity).allProperties].find(w=>y.declaration===w)){const w=y.remove({ignoreUpstream:!1},r);p.push(...w.removed),a.push(...w.updated)}}),r==null||r.attemptAutoclose("remove-unrecognized-variable-instance-inputs",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}removeUnrecognizedOutputs(r=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-unrecognized-variable-instance-outputs"))){const a=[],o=[],p=[],e=[];return this.declaration.dataType&&!this.declaration.dataType.isObject()?[...this.outputs].forEach(y=>{const v=y.remove({ignoreUpstream:!1},r);p.push(...v.removed),a.push(...v.updated)}):this.declaration.dataType&&this.declaration.dataType.hasStrictObjectStructure()&&[...this.outputs].forEach(y=>{var E;if(!y.declaration){const w=y.remove({ignoreUpstream:!1},r);p.push(...w.removed),a.push(...w.updated);return}if(![...((E=this.declaration.dataType)==null?void 0:E.entity).allProperties].find(w=>y.declaration===w)){const w=y.remove({ignoreUpstream:!1},r);p.push(...w.removed),a.push(...w.updated)}}),r==null||r.attemptAutoclose("remove-unrecognized-variable-instance-outputs",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}removeUnrecognizedInternalCalls(r=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-unrecognized-variable-declaration-internal-calls"))){var v;const a=[],o=[],p=[],e=[];if(!this.declaration.dataType||!this.declaration.dataType.entity||![f.DefinitionEntity,f.PrimitiveEntity,f.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type))[...this.internalCalls].forEach(E=>{const w=E.remove({ignoreUpstream:!1},r);p.push(...w.removed),a.push(...w.updated)});else if(this.declaration.dataType&&this.declaration.dataType.entity&&[f.DefinitionEntity,f.PrimitiveEntity,f.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)){const E=[...((v=this.declaration.dataType)==null?void 0:v.entity).allMethods];[...this.internalCalls].forEach(w=>{if(!w.declaration){const $=w.remove({ignoreUpstream:!1},r);p.push(...$.removed),a.push(...$.updated);return}if(!E.find($=>w.declaration===$)){const $=w.remove({ignoreUpstream:!1},r);p.push(...$.removed),a.push(...$.updated);return}})}return this.internalCalls.filter((E,w)=>{const A=this.internalCalls.findIndex(V=>V.declaration===E.declaration&&V!==E);if(A===-1)return!1;const $=this.internalCalls[A];return L($==null?void 0:$.createdAt).isSame(L(E.createdAt))?w>A:!!L($==null?void 0:$.createdAt).isAfter(E.createdAt)}).forEach(E=>{const w=E.remove({ignoreUpstream:!1},r);p.push(...w.removed),a.push(...w.updated)}),r==null||r.attemptAutoclose("remove-unrecognized-variable-declaration-internal-calls",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncInputs(r=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-variable-instance-inputs"))){const a=[],o=[],p=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity){if([f.DefinitionEntity,f.PrimitiveEntity,f.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList){const y=[...this.declaration.dataType.entity.properties];y.filter(A=>!A.getDataType(r)).forEach(A=>{const $=this.inputs.find(F=>Y(F,this.project)===Y(A,this.project));if(!$)return;const V=this.declaration.getMasterInputWithValueWritterFromAllInstances($);if(!V)return;const B=Tn(V);A.setDataType(B,r),$.setDeclaration(A,r)}),y.filter(A=>!this.inputs.find($=>{var V;return((V=$.declaration)==null?void 0:V.id)===A.id})).forEach(A=>{const $={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(r==null?void 0:r.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.InputMap,parent:this.toReference(),name:null,description:null,codeName:null,declaration:A,defaultValue:null,index:A.index,readsValue:null},V=ne($,this.project);return V.setParent(this,r),V.initChildren(r),r==null||r.add(V,S.Added),this.addInput(V,r),V}),this.inputs.filter(A=>!A.declaration).forEach(A=>{const $=y.find(V=>Y(V,this.project)===Y(A,this.project));$&&A.setDeclaration($,r)})}}else return r==null||r.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return r==null||r.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};return r==null||r.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this}}syncOutputs(r=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-variable-instance-outputs"))){const a=[],o=[],p=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity)[f.DefinitionEntity,f.PrimitiveEntity,f.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList&&[...this.declaration.dataType.entity.properties].filter(E=>!this.outputs.find(w=>w.declaration===E)).map(E=>{const w={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(r==null?void 0:r.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.OutputMap,parent:this.toReference(),defaultValue:null,declaration:E,index:E.index,writesValues:[]},A=ne(w,this.project);return A.setParent(this,r),A.initChildren(r),r==null||r.add(A,S.Added),this.addOutput(A,r),A});else return r==null||r.attemptAutoclose("sync-variable-instance-outputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return r==null||r.attemptAutoclose("sync-variable-instance-outputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};return r==null||r.attemptAutoclose("sync-variable-instance-outputs",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this}}generateUnusedInternalCalls(r=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"generate-unused-internal-calls"))){const a=[],o=[],p=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity)[f.DefinitionEntity,f.PrimitiveEntity,f.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList&&[...this.declaration.dataType.entity.getAllInteractiveMethods()].filter(E=>!this.internalCalls.find(A=>{var V,B,F,K,q;return(((V=A.declaration)==null?void 0:V.id)||((F=(B=A.initialData)==null?void 0:B.declaration)==null?void 0:F.entityId)||((q=(K=A.initialData)==null?void 0:K.declaration)==null?void 0:q.id))===E.id})).map(E=>{const w=E.createInternalCall(r,this);return r==null||r.add(w,S.Added),this.addInternalCall(w),w});else return r==null||r.attemptAutoclose("generate-unused-internal-calls",this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return r==null||r.attemptAutoclose("generate-unused-internal-calls",this.id),{added:[],updated:[],removed:[],affected:[],self:this};return r==null||r.attemptAutoclose("generate-unused-internal-calls",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this}}getDataType(r=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"get-data-type"))){var a;return((a=this.declaration)==null?void 0:a.getDataType(r))||null}getUnusedInputs(){return this.inputs.filter(r=>r.suggestion||!r.readsValue&&!r.defaultValue)}getUnusedOutputs(){return this.outputs.filter(r=>r.suggestion||!r.writesValues.length)}getUsedInputs(){return this.inputs.filter(r=>!r.suggestion&&(r.readsValue||r.defaultValue))}getUsedOutputs(){return this.outputs.filter(r=>!r.suggestion&&r.writesValues.length)}};_(xt,"repository",{APICreate:async(r,...a)=>r,APIUpdate:async(r,...a)=>r,APIDelete:async(r,...a)=>r,APIClone:async(r,...a)=>{},APILoad:async(r,...a)=>null,APILoadVersion:async(r,a,...o)=>null}),_(xt,"type",f.VariableInstance),_(xt,"USER_MANAGED_PARENT_TYPES",[...Nr,f.Project]),_(xt,"PARENT_TYPES",[...xt.USER_MANAGED_PARENT_TYPES]),_(xt,"MUTABLE_BASE_PROPERTIES",["catchesError"]),_(xt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),_(xt,"BASE_PROPERTIES",[...xt.MUTABLE_BASE_PROPERTIES,...xt.INMUTABLE_BASE_PROPERTIES]),_(xt,"MUTABLE_META_PROPERTIES",[...xt.MUTABLE_BASE_PROPERTIES,"x","y"]),_(xt,"INMUTABLE_META_PROPERTIES",[...xt.INMUTABLE_BASE_PROPERTIES]),_(xt,"META_PROPERTIES",[...xt.MUTABLE_META_PROPERTIES,...xt.INMUTABLE_META_PROPERTIES]),_(xt,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","readsValue"]),_(xt,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),_(xt,"UPSTREAM_PROPERTIES",[...xt.MUTABLE_UPSTREAM_PROPERTIES,...xt.INMUTABLE_UPSTREAM_PROPERTIES]),_(xt,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues","inputs","outputs","successCalls","errorCalls","internalCalls"]),_(xt,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),_(xt,"DOWNSTREAM_PROPERTIES",[...xt.MUTABLE_DOWNSTREAM_PROPERTIES,...xt.INMUTABLE_DOWNSTREAM_PROPERTIES]),_(xt,"PROPERTIES",[...xt.META_PROPERTIES,...xt.UPSTREAM_PROPERTIES,...xt.DOWNSTREAM_PROPERTIES]);let ao=xt;var O3=(d=>(d.Parent="parent",d.DataTypeEntity="variable-data-type-entity",d.DataType="variable-data-type",d))(O3||{});const jt=class jt extends Cr{constructor(r,a){super(r);_(this,"initialData");_(this,"id");_(this,"name");_(this,"codeName",null);_(this,"description",null);_(this,"required",!1);_(this,"constant",!1);_(this,"x");_(this,"y");_(this,"type",f.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=r,this.project=a,this.id=r.id,this.name=r.name,this.description=r.description,this.constant=r.constant,this.codeName=r.codeName,this.required=r.required,this.x=r.x,this.y=r.y,this.catchesError=r.catchesError||!1}static new(r=null){return{id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(r==null?void 0:r.timestamp)||L().toISOString(),author:(r==null?void 0:r.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.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(r,a){let o=a;if(r.parent){const A=J(r.parent);o=a.get(A)}const p=r.calledByEntry.map(A=>{const $=J(A);return a.get($)}),e=r.calledBySuccess.map(A=>{const $=J(A);return a.get($)}),y=r.calledByError.map(A=>{const $=J(A);return a.get($)});let v=null;if(r.readsValue){const A=J(r.readsValue);v=a.get(A)}const E={id:r.id,version:N.UUID.uuid(),createdAt:L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.VariableDeclaration,catchesError:r.catchesError||!1,name:r.name,defaultValue:null,codeName:r.codeName||null,description:r.description||null,constant:r.constant||!1,required:r.required||!1,calledByEntry:p,calledBySuccess:e,calledByError:y,dataType:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:v,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:o},w=ne(E,a);return w.setParent(o,null),w}static validateGenerationTarget(r,a){let o=JSON.parse(JSON.stringify(r));const p=[],e=ri(o,{parent:{list:!1,types:[...Nr,f.Project],optional:!0}},a);o=e.modifiedData;const y=Db(o,a);return p.push(...e.errors,...y,...Vr(o)),{errors:p,modifiedData:o}}get variableInstances(){const r=[];return Object.values(this.detachedDependents).forEach(a=>{a.field===fA.VarDeclaration&&!r.includes(a.entity)&&r.push(a.entity)}),r}validateGeneratedUpdate(r){const a=[];let o=JSON.parse(JSON.stringify(r));const p=Hp(o,this);return o=p.modifiedData,a.push(...p.errors),r.parent&&a.push(new ae({id:`${this.id}--${k.InvalidParentUpdate}`,code:k.InvalidParentUpdate,severity:Z.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.6487",
3
+ "version": "0.0.6488",
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",