@elyx-code/project-logic-tree 0.0.6842 → 0.0.6843
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.js +8 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -51,7 +51,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
|
|
|
51
51
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(p){return p instanceof this?p:new this(p)}static concat(p,...i){const r=new this(p);return i.forEach(a=>r.set(a)),r}static accessor(p){const r=(this[wU]=this[wU]={accessors:{}}).accessors,a=this.prototype;function c(e){const f=w0(e);r[f]||(jIi(a,e),r[f]=!0)}return qe.isArray(p)?p.forEach(c):c(p),this}}n1.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);qe.reduceDescriptors(n1.prototype,({value:l},p)=>{let i=p[0].toUpperCase()+p.slice(1);return{get:()=>l,set(r){this[i]=r}}});qe.freezeMethods(n1);const Gl=n1;function $O(l,p){const i=this||Gx,r=p||i,a=Gl.from(r.headers);let c=r.data;return qe.forEach(l,function(f){c=f.call(i,c,a.normalize(),p?p.status:void 0)}),a.normalize(),c}function o2e(l){return!!(l&&l.__CANCEL__)}function gm(l,p,i){fi.call(this,l??"canceled",fi.ERR_CANCELED,p,i),this.name="CanceledError"}qe.inherits(gm,fi,{__CANCEL__:!0});function d2e(l,p,i){const r=i.config.validateStatus;!i.status||!r||r(i.status)?l(i):p(new fi("Request failed with status code "+i.status,[fi.ERR_BAD_REQUEST,fi.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function UIi(l){const p=/^([-+\w]{1,25})(:?\/\/|:)/.exec(l);return p&&p[1]||""}function kIi(l,p){l=l||10;const i=new Array(l),r=new Array(l);let a=0,c=0,e;return p=p!==void 0?p:1e3,function(h){const m=Date.now(),E=r[c];e||(e=m),i[a]=h,r[a]=m;let b=c,g=0;for(;b!==a;)g+=i[b++],b=b%l;if(a=(a+1)%l,a===c&&(c=(c+1)%l),m-e<p)return;const _=E&&m-E;return _?Math.round(g*1e3/_):void 0}}function FIi(l,p){let i=0,r=1e3/p,a,c;const e=(m,E=Date.now())=>{i=E,a=null,c&&(clearTimeout(c),c=null),l(...m)};return[(...m)=>{const E=Date.now(),b=E-i;b>=r?e(m,E):(a=m,c||(c=setTimeout(()=>{c=null,e(a)},r-b)))},()=>a&&e(a)]}const yg=(l,p,i=3)=>{let r=0;const a=kIi(50,250);return FIi(c=>{const e=c.loaded,f=c.lengthComputable?c.total:void 0,h=e-r,m=a(h),E=e<=f;r=e;const b={loaded:e,total:f,progress:f?e/f:void 0,bytes:h,rate:m||void 0,estimated:m&&f&&E?(f-e)/m:void 0,event:c,lengthComputable:f!=null,[p?"download":"upload"]:!0};l(b)},i)},CU=(l,p)=>{const i=l!=null;return[r=>p[0]({lengthComputable:i,total:l,loaded:r}),p[1]]},OU=l=>(...p)=>qe.asap(()=>l(...p)),KIi=ca.hasStandardBrowserEnv?((l,p)=>i=>(i=new URL(i,ca.origin),l.protocol===i.protocol&&l.host===i.host&&(p||l.port===i.port)))(new URL(ca.origin),ca.navigator&&/(msie|trident)/i.test(ca.navigator.userAgent)):()=>!0,SIi=ca.hasStandardBrowserEnv?{write(l,p,i,r,a,c,e){if(typeof document>"u")return;const f=[`${l}=${encodeURIComponent(p)}`];qe.isNumber(i)&&f.push(`expires=${new Date(i).toUTCString()}`),qe.isString(r)&&f.push(`path=${r}`),qe.isString(a)&&f.push(`domain=${a}`),c===!0&&f.push("secure"),qe.isString(e)&&f.push(`SameSite=${e}`),document.cookie=f.join("; ")},read(l){if(typeof document>"u")return null;const p=document.cookie.match(new RegExp("(?:^|; )"+l+"=([^;]*)"));return p?decodeURIComponent(p[1]):null},remove(l){this.write(l,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function qIi(l){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(l)}function ZIi(l,p){return p?l.replace(/\/?\/$/,"")+"/"+p.replace(/^\/+/,""):l}function u2e(l,p,i){let r=!qIi(p);return l&&(r||i==!1)?ZIi(l,p):p}const _U=l=>l instanceof Gl?{...l}:l;function of(l,p){p=p||{};const i={};function r(m,E,b,g){return qe.isPlainObject(m)&&qe.isPlainObject(E)?qe.merge.call({caseless:g},m,E):qe.isPlainObject(E)?qe.merge({},E):qe.isArray(E)?E.slice():E}function a(m,E,b,g){if(qe.isUndefined(E)){if(!qe.isUndefined(m))return r(void 0,m,b,g)}else return r(m,E,b,g)}function c(m,E){if(!qe.isUndefined(E))return r(void 0,E)}function e(m,E){if(qe.isUndefined(E)){if(!qe.isUndefined(m))return r(void 0,m)}else return r(void 0,E)}function f(m,E,b){if(b in p)return r(m,E);if(b in l)return r(void 0,m)}const h={url:c,method:c,data:c,baseURL:e,transformRequest:e,transformResponse:e,paramsSerializer:e,timeout:e,timeoutMessage:e,withCredentials:e,withXSRFToken:e,adapter:e,responseType:e,xsrfCookieName:e,xsrfHeaderName:e,onUploadProgress:e,onDownloadProgress:e,decompress:e,maxContentLength:e,maxBodyLength:e,beforeRedirect:e,transport:e,httpAgent:e,httpsAgent:e,cancelToken:e,socketPath:e,responseEncoding:e,validateStatus:f,headers:(m,E,b)=>a(_U(m),_U(E),b,!0)};return qe.forEach(Object.keys({...l,...p}),function(E){const b=h[E]||a,g=b(l[E],p[E],E);qe.isUndefined(g)&&b!==f||(i[E]=g)}),i}const p2e=l=>{const p=of({},l);let{data:i,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:c,headers:e,auth:f}=p;if(p.headers=e=Gl.from(e),p.url=a2e(u2e(p.baseURL,p.url,p.allowAbsoluteUrls),l.params,l.paramsSerializer),f&&e.set("Authorization","Basic "+btoa((f.username||"")+":"+(f.password?unescape(encodeURIComponent(f.password)):""))),qe.isFormData(i)){if(ca.hasStandardBrowserEnv||ca.hasStandardBrowserWebWorkerEnv)e.setContentType(void 0);else if(qe.isFunction(i.getHeaders)){const h=i.getHeaders(),m=["content-type","content-length"];Object.entries(h).forEach(([E,b])=>{m.includes(E.toLowerCase())&&e.set(E,b)})}}if(ca.hasStandardBrowserEnv&&(r&&qe.isFunction(r)&&(r=r(p)),r||r!==!1&&KIi(p.url))){const h=a&&c&&SIi.read(c);h&&e.set(a,h)}return p},HIi=typeof XMLHttpRequest<"u",WIi=HIi&&function(l){return new Promise(function(i,r){const a=p2e(l);let c=a.data;const e=Gl.from(a.headers).normalize();let{responseType:f,onUploadProgress:h,onDownloadProgress:m}=a,E,b,g,_,$;function L(){_&&_(),$&&$(),a.cancelToken&&a.cancelToken.unsubscribe(E),a.signal&&a.signal.removeEventListener("abort",E)}let j=new XMLHttpRequest;j.open(a.method.toUpperCase(),a.url,!0),j.timeout=a.timeout;function k(){if(!j)return;const H=Gl.from("getAllResponseHeaders"in j&&j.getAllResponseHeaders()),ee={data:!f||f==="text"||f==="json"?j.responseText:j.response,status:j.status,statusText:j.statusText,headers:H,config:l,request:j};d2e(function(ae){i(ae),L()},function(ae){r(ae),L()},ee),j=null}"onloadend"in j?j.onloadend=k:j.onreadystatechange=function(){!j||j.readyState!==4||j.status===0&&!(j.responseURL&&j.responseURL.indexOf("file:")===0)||setTimeout(k)},j.onabort=function(){j&&(r(new fi("Request aborted",fi.ECONNABORTED,l,j)),j=null)},j.onerror=function(ie){const ee=ie&&ie.message?ie.message:"Network Error",ue=new fi(ee,fi.ERR_NETWORK,l,j);ue.event=ie||null,r(ue),j=null},j.ontimeout=function(){let ie=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const ee=a.transitional||s2e;a.timeoutErrorMessage&&(ie=a.timeoutErrorMessage),r(new fi(ie,ee.clarifyTimeoutError?fi.ETIMEDOUT:fi.ECONNABORTED,l,j)),j=null},c===void 0&&e.setContentType(null),"setRequestHeader"in j&&qe.forEach(e.toJSON(),function(ie,ee){j.setRequestHeader(ee,ie)}),qe.isUndefined(a.withCredentials)||(j.withCredentials=!!a.withCredentials),f&&f!=="json"&&(j.responseType=a.responseType),m&&([g,$]=yg(m,!0),j.addEventListener("progress",g)),h&&j.upload&&([b,_]=yg(h),j.upload.addEventListener("progress",b),j.upload.addEventListener("loadend",_)),(a.cancelToken||a.signal)&&(E=H=>{j&&(r(!H||H.type?new gm(null,l,j):H),j.abort(),j=null)},a.cancelToken&&a.cancelToken.subscribe(E),a.signal&&(a.signal.aborted?E():a.signal.addEventListener("abort",E)));const G=UIi(a.url);if(G&&ca.protocols.indexOf(G)===-1){r(new fi("Unsupported protocol "+G+":",fi.ERR_BAD_REQUEST,l));return}j.send(c||null)})},zIi=(l,p)=>{const{length:i}=l=l?l.filter(Boolean):[];if(p||i){let r=new AbortController,a;const c=function(m){if(!a){a=!0,f();const E=m instanceof Error?m:this.reason;r.abort(E instanceof fi?E:new gm(E instanceof Error?E.message:E))}};let e=p&&setTimeout(()=>{e=null,c(new fi(`timeout ${p} of ms exceeded`,fi.ETIMEDOUT))},p);const f=()=>{l&&(e&&clearTimeout(e),e=null,l.forEach(m=>{m.unsubscribe?m.unsubscribe(c):m.removeEventListener("abort",c)}),l=null)};l.forEach(m=>m.addEventListener("abort",c));const{signal:h}=r;return h.unsubscribe=()=>qe.asap(f),h}},YIi=zIi,JIi=function*(l,p){let i=l.byteLength;if(!p||i<p){yield l;return}let r=0,a;for(;r<i;)a=r+p,yield l.slice(r,a),r=a},XIi=async function*(l,p){for await(const i of QIi(l))yield*JIi(i,p)},QIi=async function*(l){if(l[Symbol.asyncIterator]){yield*l;return}const p=l.getReader();try{for(;;){const{done:i,value:r}=await p.read();if(i)break;yield r}}finally{await p.cancel()}},VU=(l,p,i,r)=>{const a=XIi(l,p);let c=0,e,f=h=>{e||(e=!0,r&&r(h))};return new ReadableStream({async pull(h){try{const{done:m,value:E}=await a.next();if(m){f(),h.close();return}let b=E.byteLength;if(i){let g=c+=b;i(g)}h.enqueue(new Uint8Array(E))}catch(m){throw f(m),m}},cancel(h){return f(h),a.return()}},{highWaterMark:2})},PU=64*1024,{isFunction:$A}=qe,eRi=(({Request:l,Response:p})=>({Request:l,Response:p}))(qe.global),{ReadableStream:NU,TextEncoder:xU}=qe.global,$U=(l,...p)=>{try{return!!l(...p)}catch{return!1}},tRi=l=>{l=qe.merge.call({skipUndefined:!0},eRi,l);const{fetch:p,Request:i,Response:r}=l,a=p?$A(p):typeof fetch=="function",c=$A(i),e=$A(r);if(!a)return!1;const f=a&&$A(NU),h=a&&(typeof xU=="function"?($=>L=>$.encode(L))(new xU):async $=>new Uint8Array(await new i($).arrayBuffer())),m=c&&f&&$U(()=>{let $=!1;const L=new i(ca.origin,{body:new NU,method:"POST",get duplex(){return $=!0,"half"}}).headers.has("Content-Type");return $&&!L}),E=e&&f&&$U(()=>qe.isReadableStream(new r("").body)),b={stream:E&&($=>$.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach($=>{!b[$]&&(b[$]=(L,j)=>{let k=L&&L[$];if(k)return k.call(L);throw new fi(`Response type '${$}' is not supported`,fi.ERR_NOT_SUPPORT,j)})});const g=async $=>{if($==null)return 0;if(qe.isBlob($))return $.size;if(qe.isSpecCompliantForm($))return(await new i(ca.origin,{method:"POST",body:$}).arrayBuffer()).byteLength;if(qe.isArrayBufferView($)||qe.isArrayBuffer($))return $.byteLength;if(qe.isURLSearchParams($)&&($=$+""),qe.isString($))return(await h($)).byteLength},_=async($,L)=>{const j=qe.toFiniteNumber($.getContentLength());return j??g(L)};return async $=>{let{url:L,method:j,data:k,signal:G,cancelToken:H,timeout:ie,onDownloadProgress:ee,onUploadProgress:ue,responseType:ae,headers:de,withCredentials:ce="same-origin",fetchOptions:ne}=p2e($),le=p||fetch;ae=ae?(ae+"").toLowerCase():"text";let Q=YIi([G,H&&H.toAbortSignal()],ie),oe=null;const Ee=Q&&Q.unsubscribe&&(()=>{Q.unsubscribe()});let Te;try{if(ue&&m&&j!=="get"&&j!=="head"&&(Te=await _(de,k))!==0){let Je=new i(L,{method:"POST",body:k,duplex:"half"}),rt;if(qe.isFormData(k)&&(rt=Je.headers.get("content-type"))&&de.setContentType(rt),Je.body){const[Rt,Et]=CU(Te,yg(OU(ue)));k=VU(Je.body,PU,Rt,Et)}}qe.isString(ce)||(ce=ce?"include":"omit");const Ve=c&&"credentials"in i.prototype,Le={...ne,signal:Q,method:j.toUpperCase(),headers:de.normalize().toJSON(),body:k,duplex:"half",credentials:Ve?ce:void 0};oe=c&&new i(L,Le);let $e=await(c?le(oe,ne):le(L,Le));const ke=E&&(ae==="stream"||ae==="response");if(E&&(ee||ke&&Ee)){const Je={};["status","statusText","headers"].forEach(Xt=>{Je[Xt]=$e[Xt]});const rt=qe.toFiniteNumber($e.headers.get("content-length")),[Rt,Et]=ee&&CU(rt,yg(OU(ee),!0))||[];$e=new r(VU($e.body,PU,Rt,()=>{Et&&Et(),Ee&&Ee()}),Je)}ae=ae||"text";let Ke=await b[qe.findKey(b,ae)||"text"]($e,$);return!ke&&Ee&&Ee(),await new Promise((Je,rt)=>{d2e(Je,rt,{data:Ke,headers:Gl.from($e.headers),status:$e.status,statusText:$e.statusText,config:$,request:oe})})}catch(Ve){throw Ee&&Ee(),Ve&&Ve.name==="TypeError"&&/Load failed|fetch/i.test(Ve.message)?Object.assign(new fi("Network Error",fi.ERR_NETWORK,$,oe),{cause:Ve.cause||Ve}):fi.from(Ve,Ve&&Ve.code,$,oe)}}},iRi=new Map,c2e=l=>{let p=l&&l.env||{};const{fetch:i,Request:r,Response:a}=p,c=[r,a,i];let e=c.length,f=e,h,m,E=iRi;for(;f--;)h=c[f],m=E.get(h),m===void 0&&E.set(h,m=f?new Map:tRi(p)),E=m;return m};c2e();const jx={http:TIi,xhr:WIi,fetch:{get:c2e}};qe.forEach(jx,(l,p)=>{if(l){try{Object.defineProperty(l,"name",{value:p})}catch{}Object.defineProperty(l,"adapterName",{value:p})}});const LU=l=>`- ${l}`,rRi=l=>qe.isFunction(l)||l===null||l===!1;function nRi(l,p){l=qe.isArray(l)?l:[l];const{length:i}=l;let r,a;const c={};for(let e=0;e<i;e++){r=l[e];let f;if(a=r,!rRi(r)&&(a=jx[(f=String(r)).toLowerCase()],a===void 0))throw new fi(`Unknown adapter '${f}'`);if(a&&(qe.isFunction(a)||(a=a.get(p))))break;c[f||"#"+e]=a}if(!a){const e=Object.entries(c).map(([h,m])=>`adapter ${h} `+(m===!1?"is not supported by the environment":"is not available in the build"));let f=i?e.length>1?`since :
|
|
52
52
|
`+e.map(LU).join(`
|
|
53
53
|
`):" "+LU(e[0]):"as no adapter specified";throw new fi("There is no suitable adapter to dispatch the request "+f,"ERR_NOT_SUPPORT")}return a}const f2e={getAdapter:nRi,adapters:jx};function LO(l){if(l.cancelToken&&l.cancelToken.throwIfRequested(),l.signal&&l.signal.aborted)throw new gm(null,l)}function BU(l){return LO(l),l.headers=Gl.from(l.headers),l.data=$O.call(l,l.transformRequest),["post","put","patch"].indexOf(l.method)!==-1&&l.headers.setContentType("application/x-www-form-urlencoded",!1),f2e.getAdapter(l.adapter||Gx.adapter,l)(l).then(function(r){return LO(l),r.data=$O.call(l,l.transformResponse,r),r.headers=Gl.from(r.headers),r},function(r){return o2e(r)||(LO(l),r&&r.response&&(r.response.data=$O.call(l,l.transformResponse,r.response),r.response.headers=Gl.from(r.response.headers))),Promise.reject(r)})}const y2e="1.13.2",a1={};["object","boolean","number","function","string","symbol"].forEach((l,p)=>{a1[l]=function(r){return typeof r===l||"a"+(p<1?"n ":" ")+l}});const MU={};a1.transitional=function(p,i,r){function a(c,e){return"[Axios v"+y2e+"] Transitional option '"+c+"'"+e+(r?". "+r:"")}return(c,e,f)=>{if(p===!1)throw new fi(a(e," has been removed"+(i?" in "+i:"")),fi.ERR_DEPRECATED);return i&&!MU[e]&&(MU[e]=!0,console.warn(a(e," has been deprecated since v"+i+" and will be removed in the near future"))),p?p(c,e,f):!0}};a1.spelling=function(p){return(i,r)=>(console.warn(`${r} is likely a misspelling of ${p}`),!0)};function aRi(l,p,i){if(typeof l!="object")throw new fi("options must be an object",fi.ERR_BAD_OPTION_VALUE);const r=Object.keys(l);let a=r.length;for(;a-- >0;){const c=r[a],e=p[c];if(e){const f=l[c],h=f===void 0||e(f,c,l);if(h!==!0)throw new fi("option "+c+" must be "+h,fi.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new fi("Unknown option "+c,fi.ERR_BAD_OPTION)}}const SA={assertOptions:aRi,validators:a1},jo=SA.validators;class hg{constructor(p){this.defaults=p||{},this.interceptors={request:new DU,response:new DU}}async request(p,i){try{return await this._request(p,i)}catch(r){if(r instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const c=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?c&&!String(r.stack).endsWith(c.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
54
|
-
`+c):r.stack=c}catch{}}throw r}}_request(p,i){typeof p=="string"?(i=i||{},i.url=p):i=p||{},i=of(this.defaults,i);const{transitional:r,paramsSerializer:a,headers:c}=i;r!==void 0&&SA.assertOptions(r,{silentJSONParsing:jo.transitional(jo.boolean),forcedJSONParsing:jo.transitional(jo.boolean),clarifyTimeoutError:jo.transitional(jo.boolean)},!1),a!=null&&(qe.isFunction(a)?i.paramsSerializer={serialize:a}:SA.assertOptions(a,{encode:jo.function,serialize:jo.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),SA.assertOptions(i,{baseUrl:jo.spelling("baseURL"),withXsrfToken:jo.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=c&&qe.merge(c.common,c[i.method]);c&&qe.forEach(["delete","get","head","post","put","patch","common"],$=>{delete c[$]}),i.headers=Gl.concat(e,c);const f=[];let h=!0;this.interceptors.request.forEach(function(L){typeof L.runWhen=="function"&&L.runWhen(i)===!1||(h=h&&L.synchronous,f.unshift(L.fulfilled,L.rejected))});const m=[];this.interceptors.response.forEach(function(L){m.push(L.fulfilled,L.rejected)});let E,b=0,g;if(!h){const $=[BU.bind(this),void 0];for($.unshift(...f),$.push(...m),g=$.length,E=Promise.resolve(i);b<g;)E=E.then($[b++],$[b++]);return E}g=f.length;let _=i;for(;b<g;){const $=f[b++],L=f[b++];try{_=$(_)}catch(j){L.call(this,j);break}}try{E=BU.call(this,_)}catch($){return Promise.reject($)}for(b=0,g=m.length;b<g;)E=E.then(m[b++],m[b++]);return E}getUri(p){p=of(this.defaults,p);const i=u2e(p.baseURL,p.url,p.allowAbsoluteUrls);return a2e(i,p.params,p.paramsSerializer)}}qe.forEach(["delete","get","head","options"],function(p){hg.prototype[p]=function(i,r){return this.request(of(r||{},{method:p,url:i,data:(r||{}).data}))}});qe.forEach(["post","put","patch"],function(p){function i(r){return function(c,e,f){return this.request(of(f||{},{method:p,headers:r?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}hg.prototype[p]=i(),hg.prototype[p+"Form"]=i(!0)});const qA=hg;class Ux{constructor(p){if(typeof p!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(c){i=c});const r=this;this.promise.then(a=>{if(!r._listeners)return;let c=r._listeners.length;for(;c-- >0;)r._listeners[c](a);r._listeners=null}),this.promise.then=a=>{let c;const e=new Promise(f=>{r.subscribe(f),c=f}).then(a);return e.cancel=function(){r.unsubscribe(c)},e},p(function(c,e,f){r.reason||(r.reason=new gm(c,e,f),i(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(p){if(this.reason){p(this.reason);return}this._listeners?this._listeners.push(p):this._listeners=[p]}unsubscribe(p){if(!this._listeners)return;const i=this._listeners.indexOf(p);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const p=new AbortController,i=r=>{p.abort(r)};return this.subscribe(i),p.signal.unsubscribe=()=>this.unsubscribe(i),p.signal}static source(){let p;return{token:new Ux(function(a){p=a}),cancel:p}}}const sRi=Ux;function lRi(l){return function(i){return l.apply(null,i)}}function oRi(l){return qe.isObject(l)&&l.isAxiosError===!0}const b_={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(b_).forEach(([l,p])=>{b_[p]=l});const dRi=b_;function h2e(l){const p=new qA(l),i=HLe(qA.prototype.request,p);return qe.extend(i,qA.prototype,p,{allOwnKeys:!0}),qe.extend(i,p,null,{allOwnKeys:!0}),i.create=function(a){return h2e(of(l,a))},i}const Nn=h2e(Gx);Nn.Axios=qA;Nn.CanceledError=gm;Nn.CancelToken=sRi;Nn.isCancel=o2e;Nn.VERSION=y2e;Nn.toFormData=r1;Nn.AxiosError=fi;Nn.Cancel=Nn.CanceledError;Nn.all=function(p){return Promise.all(p)};Nn.spread=lRi;Nn.isAxiosError=oRi;Nn.mergeConfig=of;Nn.AxiosHeaders=Gl;Nn.formToJSON=l=>l2e(qe.isHTMLForm(l)?new FormData(l):l);Nn.getAdapter=f2e.getAdapter;Nn.HttpStatusCode=dRi;Nn.default=Nn;const uRi=Nn;class m2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(na.HttpRequest);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[3]||{},e={method:a[0],url:a[1],params:a[2],headers:c,data:a[4]};z.Logger.log("Axios request config: ",e);const f=await uRi(e);return{value:U.Success,error:null,result:{status:f.status,headers:f.headers,data:f.data}}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class T2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(xe.Validate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)});z.Logger.log("Inputs for entity validation: ",a);const e=Y1(a[1]).safeParse(a[0]);return e.success?{value:U.Success,error:null,result:{data:a[0]}}:{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:e.error.errors,result:null}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}const Ba=l=>l.map(p=>{var i,r;return((i=p.value)==null?void 0:i.valueAsType)??((r=p.value)==null?void 0:r.value)});class v2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY,version:"1.0.0",description:"Entity read-key operation implementation module (top-level)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(xe.ReadKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ba(r),e=F_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class E2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY,version:"1.0.0",description:"Entity write-key operation implementation module (top-level, immutable)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(xe.WriteKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ba(r),f=K_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class b2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY,version:"1.0.0",description:"Entity delete-key operation implementation module (top-level, immutable)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(xe.DeleteKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ba(r),e=S_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class A2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY,version:"1.0.0",description:"Entity read-nested-key operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(xe.ReadNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ba(r),f=q_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class g2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY,version:"1.0.0",description:"Entity write-nested-key operation implementation module (immutable, no auto-create)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(xe.WriteNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ba(r),f=Z_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class I2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY,version:"1.0.0",description:"Entity write-safe-nested-key-recursively operation implementation module (immutable, auto-create)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(xe.WriteSafeNestedKeyRecursively);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ba(r),f=H_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class R2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY,version:"1.0.0",description:"Entity delete-nested-key operation implementation module (immutable)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(xe.DeleteNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ba(r),e=W_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class D2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY,version:"1.0.0",description:"Object has-key (top-level property present?)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(xe.HasKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ba(r),e=z_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class w2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object key-value-equals (top-level property strict equality)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(xe.KeyValueEquals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Ba(r),f=Y_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class C2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY,version:"1.0.0",description:"Object has-nested-key (path present?)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(xe.HasNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ba(r),e=J_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class O2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object nested-key-value-equals (path strict equality)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(xe.NestedKeyValueEquals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Ba(r),f=X_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class _2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE,version:"1.0.0",description:"Object is-instance-of-type (DefinitionEntity-based runtime check)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(xe.IsInstanceOfType);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m,E,b,g,_;try{const $=((c=(a=r[0])==null?void 0:a.value)==null?void 0:c.parent)||((f=(e=r[0])==null?void 0:e.value)==null?void 0:f.standaloneParent),L=(m=(h=r[0])==null?void 0:h.value)==null?void 0:m.value,j=(b=(E=r[1])==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle;if(!L)throw new TypeError("IsInstanceOfType expects a non-null input value.");if(!j)throw new TypeError("IsInstanceOfType expects a valid expectedType input.");if(!$)throw new TypeError("IsInstanceOfType cannot determine the value owner.");if(j.type!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType expects expectedType to be a DefinitionEntity.");const k=$.getDataType(null);if(((g=k==null?void 0:k.entity)==null?void 0:g.type)!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType cannot determine the data type of the input value.");let G=!1;return((_=k==null?void 0:k.entity)==null?void 0:_.id)!==(j==null?void 0:j.id)?G=!1:Y1(k==null?void 0:k.entity).safeParse(L).success?G=!0:G=!1,{value:U.Success,error:null,result:G}}catch($){return{value:U.UnhandledError,error:$,result:null}}}})}}class V2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE,version:"1.0.0",description:"Object merge operation implementation module (immutable, shallow merge with right-precedence)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic);if(!r)return;const a=r.get(xe.Merge);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Ba(r),c=Q_e(...a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class P2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS,version:"1.0.0",description:"Object keys operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic);if(!r)return;const a=r.get(xe.Keys);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ba(r),c=eVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class N2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES,version:"1.0.0",description:"Object values operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic);if(!r)return;const a=r.get(xe.Values);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ba(r),c=tVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class x2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES,version:"1.0.0",description:"Object entries operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic);if(!r)return;const a=r.get(xe.Entries);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ba(r),c=iVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}let As=null;try{As=require("crypto")}catch{}const DT=typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto:As&&As.webcrypto?As.webcrypto:null,ap=DT?DT.subtle:null;function jT(l){const p=new ArrayBuffer(l.byteLength);return new Uint8Array(p).set(l),p}function rn(l,p="utf8"){if(l instanceof Uint8Array)return l;const i=String(l);if(p==="utf8"){if(typeof TextEncoder<"u")return new TextEncoder().encode(i);if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"utf8"))}else if(p==="hex"){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"hex"))}else if(p==="base64"){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"base64"))}else if(p==="base64url"){const r=i.replace(/-/g,"+").replace(/_/g,"/").replace(/=+$/,"");if(typeof Buffer<"u")return new Uint8Array(Buffer.from(r,"base64"));const a=typeof atob=="function"?atob(r):"",c=new Uint8Array(a.length);for(let e=0;e<a.length;e++)c[e]=a.charCodeAt(e);return c}throw new Error(`Unsupported environment/encoding combo for toBytes(${p})`)}function bo(l,p="utf8"){if(p==="utf8"){if(typeof TextDecoder<"u")return new TextDecoder().decode(l);if(typeof Buffer<"u")return Buffer.from(l).toString("utf8")}else if(p==="hex"){if(typeof Buffer<"u")return Buffer.from(l).toString("hex")}else if(p==="base64"){if(typeof Buffer<"u")return Buffer.from(l).toString("base64")}else if(p==="base64url"&&typeof Buffer<"u")return Buffer.from(l).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");throw new Error(`Unsupported environment/encoding combo for fromBytes(${p})`)}const $2e=l=>rn(l,"base64"),L2e=(l,p)=>{const i=l instanceof Uint8Array?l:rn(String(l),p||"utf8");return bo(i,"base64")},dh=(l,p)=>{const i=l instanceof Uint8Array?l:rn(String(l),p||"utf8");return bo(i,"base64url")},df=l=>rn(l,"base64url"),B2e=(l,p)=>{const i=l instanceof Uint8Array?l:rn(String(l),p||"utf8");return bo(i,"hex")},M2e=l=>rn(l,"hex");function kx(l){if(DT&&DT.getRandomValues){const p=new Uint8Array(l);return DT.getRandomValues(p),p}if(As&&As.randomBytes)return new Uint8Array(As.randomBytes(l));throw new Error("Secure random not available")}function s1(l,p){if(!(l instanceof Uint8Array)||!(p instanceof Uint8Array)||l.length!==p.length)return!1;let i=0;for(let r=0;r<l.length;r++)i|=l[r]^p[r];return i===0}function G2e(l,p,i,r){if((typeof l!="string"||typeof p!="string")&&typeof l!="string"&&typeof p!="string")throw new Error("Invalid input types");const a=i??"utf8",c=r??"utf8",e=rn(l??"",a),f=rn(p??"",c);return s1(e,f)}async function j2e(l,p){if(ap){const i=await ap.digest({name:l},jT(p));return new Uint8Array(i)}if(As){const i=l.replace("SHA-","sha"),r=As.createHash(i);return r.update(Buffer.from(p)),new Uint8Array(r.digest())}throw new Error("Hash not available")}async function U2e(l,p,i,r){if(typeof p!="string")throw new Error("Invalid input type for data; expected string");const a=String(l??"SHA-256"),c=i??"utf8",e=r??"base64url",f=rn(p??"",c),h=await j2e(a,f);return bo(h,e)}async function l1(l,p,i){if(ap){const r=await ap.importKey("raw",jT(p),{name:"HMAC",hash:{name:l}},!1,["sign"]),a=await ap.sign("HMAC",r,jT(i));return new Uint8Array(a)}if(As){const r=`sha${l.split("-")[1]}`,a=As.createHmac(r,Buffer.from(p));return a.update(Buffer.from(i)),new Uint8Array(a.digest())}throw new Error("HMAC not available")}async function k2e(l,p,i,r,a,c){if(typeof l!="string"||typeof p!="string")throw new Error("Invalid input types for key or data; expected strings");const e=String(i??"SHA-256"),f=r??"utf8",h=a??"utf8",m=c??"base64url",E=rn(l??"",f),b=rn(p??"",h),g=await l1(e,E,b);return bo(g,m)}async function o1(l,p,{iterations:i,length:r,hashAlg:a="SHA-256"}){if(ap){const c=await ap.importKey("raw",jT(l),"PBKDF2",!1,["deriveBits"]),e=await ap.deriveBits({name:"PBKDF2",salt:jT(p),iterations:i,hash:a},c,r*8);return new Uint8Array(e)}if(As){const c=a==="SHA-512"?"sha512":"sha256";return await new Promise((e,f)=>{As.pbkdf2(Buffer.from(l),Buffer.from(p),i,r,c,(h,m)=>{h?f(h):e(new Uint8Array(m))})})}throw new Error("PBKDF2 not available")}async function F2e(l,p,i,r,a,c,e,f){if(typeof l!="string"||typeof p!="string")throw new Error("Invalid input types for password or salt; expected strings");const h=c??"utf8",m=e??"utf8",E=f??"base64url",b=Math.max(1,Number(i)||21e4),g=Math.max(1,Number(r)||32),_=a??"SHA-256",$=rn(l??"",h),L=rn(p??"",m),j=await o1($,L,{iterations:b,length:g,hashAlg:_});return bo(j,E)}async function K2e(l,p=kx(16),i=21e4,r=32,a="SHA-256"){const c=rn(l,"utf8"),e=await o1(c,p,{iterations:i,length:r,hashAlg:a}),f=dh(p),h=dh(e);return`pbkdf2$${a.toLowerCase()}$${i}$${f}$${h}`}async function S2e(l,p){const i=String(p).split("$");if(i.length!==5||i[0]!=="pbkdf2")return!1;const r=i[1].toLowerCase(),a=parseInt(i[2],10),c=df(i[3]),e=df(i[4]),f=r.includes("512")?"SHA-512":"SHA-256",h=await o1(rn(l,"utf8"),c,{iterations:a,length:e.length,hashAlg:f});return s1(h,e)}async function q2e(l,p,i,r,a,c){const e=p!=null?Math.max(1,Number(p)||0):void 0,f=i!=null?Math.max(1,Number(i)||0):void 0,h=r??void 0,m=c??"base64url",E=a!=null?rn(a,m):void 0;return await K2e(String(l??""),E,e,f,h)}function GU(l){return dh(rn(JSON.stringify(l),"utf8"))}function mg(l){try{return JSON.parse(bo(df(l),"utf8"))}catch{return null}}async function Z2e(l,p,{alg:i="HS256",includeIat:r=!0,expiresInSeconds:a,notBeforeSeconds:c,issuer:e,subject:f,audience:h,jwtid:m,header:E={}}={}){const b={alg:i,typ:"JWT",...E},g=Math.floor(Date.now()/1e3),_={...l||{}};r&&(_.iat=g),typeof a=="number"&&(_.exp=g+a),typeof c=="number"&&(_.nbf=g+c),e&&(_.iss=e),f&&(_.sub=f),h&&(_.aud=h),m&&(_.jti=m);const $=GU(b),L=GU(_),j=rn(`${$}.${L}`,"utf8"),G=await l1(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,j),H=dh(G);return`${$}.${L}.${H}`}async function H2e(l,p,i,r,a,c,e,f,h,m,E,b){if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(l!=null&&typeof l!="object")throw new Error("Invalid input type for payload; expected object");if(E!=null&&typeof E!="object")throw new Error("Invalid input type for header; expected object");if(m!=null&&typeof m!="string")throw new Error("Invalid input type for jwtid; expected string");if(e!=null&&typeof e!="string")throw new Error("Invalid input type for issuer; expected string");if(f!=null&&typeof f!="string")throw new Error("Invalid input type for subject; expected string");if(h!=null&&typeof h!="string"&&!Array.isArray(h))throw new Error("Invalid input type for audience; expected string or string[]");const _=rn(p??"",b??"utf8");return await Z2e(l??{},_,{alg:i??"HS256",includeIat:r==null?!0:!!r,expiresInSeconds:a!=null?Number(a):void 0,notBeforeSeconds:c!=null?Number(c):void 0,issuer:e??void 0,subject:f??void 0,audience:h??void 0,jwtid:m??void 0,header:E??void 0})}async function W2e(l,p,{alg:i="HS256",issuer:r,audience:a,maxAgeSeconds:c,clockSkewSeconds:e=60}={}){try{const[f,h,m]=String(l).split(".");if(!f||!h||!m)return{valid:!1,header:null,payload:null,reason:"Malformed"};const E=mg(f),b=mg(h);if(!E||!b)return{valid:!1,header:E,payload:b,reason:"Bad base64/json"};if(E.alg!==i)return{valid:!1,header:E,payload:b,reason:"Alg mismatch"};const g=rn(`${f}.${h}`,"utf8"),$=await l1(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,g),L=df(m);if(!s1($,L))return{valid:!1,header:E,payload:b,reason:"Bad signature"};const j=Math.floor(Date.now()/1e3),k=Math.max(0,Number(e)||0);if(b.nbf!=null&&j+k<Number(b.nbf))return{valid:!1,header:E,payload:b,reason:"Not before"};if(b.exp!=null&&j-k>=Number(b.exp))return{valid:!1,header:E,payload:b,reason:"Expired"};if(r&&b.iss!==r)return{valid:!1,header:E,payload:b,reason:"Issuer mismatch"};if(a){const G=b.aud;if(!(Array.isArray(G)?G.includes(a):G===a))return{valid:!1,header:E,payload:b,reason:"Audience mismatch"}}return c!=null&&b.iat!=null&&j-Number(b.iat)>Number(c)+k?{valid:!1,header:E,payload:b,reason:"MaxAge exceeded"}:{valid:!0,header:E,payload:b}}catch(f){return{valid:!1,header:null,payload:null,reason:String((f==null?void 0:f.message)??f)}}}async function z2e(l,p,i,r,a,c,e,f){if(typeof l!="string")throw new Error("Invalid input type for token; expected string");if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(typeof r!="string")throw new Error("Invalid input type for issuer; expected string");if(a!=null&&typeof a!="string")throw new Error("Invalid input type for audience; expected string");const m=rn(p??"",f??"utf8");return await W2e(String(l??""),m,{alg:i??"HS256",issuer:r??void 0,audience:a??void 0,maxAgeSeconds:c!=null?Number(c):void 0,clockSkewSeconds:e!=null?Number(e):void 0})}function Y2e(l){const[p,i,r]=String(l).split(".");return{header:p?mg(p):null,payload:i?mg(i):null,signature:r?df(r):new Uint8Array}}function J2e(l,p){if(!l)throw new Error("Token is required for decoding");if(typeof l!="string")throw new Error("Invalid input type for token; expected string");const i=p??"base64url",{header:r,payload:a,signature:c}=Y2e(String(l??"")),e=bo(c,i);return{header:r,payload:a,signature:e}}class X2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES,version:"1.0.0",description:"Randomness generate random bytes operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(it.GenerateRandomBytes);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(E=>{var b,g;return((b=E.value)==null?void 0:b.valueAsType)??((g=E.value)==null?void 0:g.value)}),e=Math.max(0,Number(a)||0),f=c??"base64url",h=kx(e),m=bo(h,f);return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Q2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateRandomInteger);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=D_e(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class eBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateRandomFloat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=zR();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class tBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateRandomHexadecimal);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=Tx(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class iBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateRandomBase62);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=vx(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class rBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateRandomBase64);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=C_e(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class nBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateRandomAlphanumeric);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=Ex(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class aBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateIdentifier);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=bx(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class sBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateRandomUUIDv4);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=np();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class lBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{z.Logger.log("Initializing Random Generate Short Identifier Module");const r=i.find(a=>a.contextType===te.Logic);if(r){z.Logger.log("Project state found, setting up operation");const a=r.get(it.GenerateShortIdentifier);a?(z.Logger.log("Operation found, setting autoexecutable and implementation"),a.autoexecutable=!0,a.implementation=this.module.main):z.Logger.warn("Operation generate-short-identifier not found in project state")}else z.Logger.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,r)=>{try{const a=O_e();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class oBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateHexadecimalToken);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=__e();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}function pRi(l){let p;if(l===null?p="null":Array.isArray(l)?p="array":p=typeof l,!["string","number","boolean","null","object","array"].includes(p))throw new TypeError("GetTypeOf cannot determine type of the given value.");return p}class dBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF,version:"1.0.0",description:"Data type get type of operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Xe.GetTypeOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)})[0];return{value:U.Success,error:null,result:pRi(c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class uBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING,version:"1.0.0",description:"Coerce any value to string via JS String(value)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.ToString);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=String(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class pBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER,version:"1.0.0",description:"Coerce to number via JS Number(value)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.ToNumber);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=Number(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class cBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES,version:"1.0.0",description:"Convert string/bytes-like to Uint8Array (utf8|hex|base64|base64url)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.ToBytes);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=rn(a,c||"utf8");return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class fBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING,version:"1.0.0",description:"Convert Uint8Array to string (utf8|hex|base64|base64url)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.FromBytesToString);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=bo(a,c||"utf8");return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class yBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64,version:"1.0.0",description:"Bytes -> base64 string (accepts string input by converting from utf8)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.EncodeBase64);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)});return{value:U.Success,error:null,result:L2e(a,c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class hBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64,version:"1.0.0",description:"base64 string -> bytes (Uint8Array)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.DecodeBase64);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=$2e(String(a));return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class mBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL,version:"1.0.0",description:"Bytes -> base64url string (accepts string input by converting from utf8)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.EncodeBase64Url);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=dh(a,c||"utf8");return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class TBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL,version:"1.0.0",description:"base64url string -> bytes (Uint8Array)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.DecodeBase64Url);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=df(String(a));return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class vBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX,version:"1.0.0",description:"Bytes -> hex string (accepts string input by converting from utf8)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.EncodeHex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=B2e(a,c||"utf8");return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class EBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX,version:"1.0.0",description:"hex string -> bytes (Uint8Array)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.DecodeHex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=M2e(String(a));return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class bBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH,version:"1.0.0",description:"Crypto: Hash (SHA-256/384/512)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(yi.Hash);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)});return{value:U.Success,error:null,result:U2e(a,c,e,f)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class ABe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC,version:"1.0.0",description:"Crypto: HMAC (SHA-256/384/512)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(yi.Hmac);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m]=r.map(E=>{var b,g;return((b=E.value)==null?void 0:b.valueAsType)??((g=E.value)==null?void 0:g.value)});return{value:U.Success,error:null,result:k2e(c,e,a,f,h,m)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class gBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL,version:"1.0.0",description:"Crypto: constant-time equality for byte sequences",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(yi.ConstantTimeEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)});return{value:U.Success,error:null,result:G2e(a,c,e,f)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class IBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2,version:"1.0.0",description:"Crypto: derive key with PBKDF2 (SHA-256/512)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(yi.DeriveKeyPBKDF2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m,E,b]=r.map(g=>{var _,$;return((_=g.value)==null?void 0:_.valueAsType)??(($=g.value)==null?void 0:$.value)});return{value:U.Success,error:null,result:F2e(a,c,e,f,h,m,E,b)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class RBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE,version:"1.0.0",description:"Json parse string into object operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(on.Parse);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{var a;try{const c=(a=r[0].value)==null?void 0:a.value;if(typeof c!="string")throw new Error(`Invalid input type for JSON.parse operation: expected string, got ${typeof c}`);const e=JSON.parse(c);return{value:U.Success,error:null,result:e}}catch(c){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:c,result:null}}}})}}class DBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY,version:"1.0.0",description:"Json stringify object into string operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(on.Stringify);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{var a,c;try{const e=(a=r[0].value)==null?void 0:a.value,f=(c=r[1].value)==null?void 0:c.value;if(!e||typeof e!="object"&&!Array.isArray(e))throw new Error(`Invalid input type for JSON.stringify operation: expected object or array, got ${typeof e}`);if(!f&&f!==0){const m=JSON.stringify(e);return{value:U.Success,error:null,result:m}}const h=JSON.stringify(e,null,f);return{value:U.Success,error:null,result:h}}catch(e){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:e,result:null}}}})}}class wBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC,version:"1.0.0",description:"JWT: build (HS256/384/512)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(dr.BuildJwtHmac);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m,E,b,g,_,$,L]=r.map(j=>{var k,G;return((k=j.value)==null?void 0:k.valueAsType)??((G=j.value)==null?void 0:G.value)});return{value:U.Success,error:null,result:await H2e(a,c,e,f,h,m,E,b,g,_,$,L)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class CBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC,version:"1.0.0",description:"JWT: verify (HS256/384/512)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(dr.VerifyJwtHmac);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m,E,b]=r.map(g=>{var _,$;return((_=g.value)==null?void 0:_.valueAsType)??(($=g.value)==null?void 0:$.value)});return{value:U.Success,error:null,result:await z2e(a,c,e,f,h,m,E,b)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class OBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE,version:"1.0.0",description:"JWT: decode (no verification)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(dr.DecodeJwt);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)});return{value:U.Success,error:null,result:J2e(a,c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class _Be extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2,version:"1.0.0",description:"Password: hash (PBKDF2) -> envelope string",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(dn.HashPasswordPBKDF2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m]=r.map(E=>{var b,g;return((b=E.value)==null?void 0:b.valueAsType)??((g=E.value)==null?void 0:g.value)});return{value:U.Success,error:null,result:await q2e(a,c,e,f,h,m)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class VBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2,version:"1.0.0",description:"Password: verify (PBKDF2) -> boolean",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(dn.VerifyPasswordPBKDF2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=await S2e(String(a??""),String(c??""));return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class A_ extends QR{constructor(p,i,r=i.projectId){super(p,te.Editor),this._editor=i,this.id=r}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 lastPublishedProjectState(){return this._editor.lastPublishedProjectState}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 livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(p){this._editor.undoableStackValueIndex=p}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}getRefreshToken(){return this._editor.getRefreshToken()}removeValueByOwnerId(p){return this._editor.removeValueByOwnerId(p)}removeValue(p){return this._editor.removeValue(p)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(p,i){return this._editor.initTest(p,i)}removeTest(p){return this._editor.removeTest(p)}async copyEntities(p,i={}){return this._editor.copyEntities(p,i)}resolveInitialChildrenPositions(p,i,r){return this._editor.resolveInitialChildrenPositions(p,i,r)}publish(){return this._editor.publish()}loadGivenPublication(p){return this._editor.loadGivenPublication(p)}validateProjectState(p){return this._editor.validateProjectState(p)}requestActiveDynamicValue(p,i=!1){return this._editor.requestActiveDynamicValue(p,i)}getValueTypePreference(p){return this._editor.getValueTypePreference(p)}setValueTypePreference(p,i){return this._editor.setValueTypePreference(p,i)}implementFeature(p){return this._editor.implementFeature(p)}}function cRi(l,p){return p instanceof A_?p:new A_(l,p)}class g_ extends QR{constructor(p,i){super(p,te.PublicationRun),this._publicationRun=i}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get projectVersion(){return this._publicationRun.projectVersion}get projectId(){return this._publicationRun.projectId}get triggeredBy(){return this._publicationRun.triggeredBy}get createdAt(){return this._publicationRun.createdAt}get updatedAt(){return this._publicationRun.updatedAt}get status(){return this._publicationRun.status}get steps(){return this._publicationRun.steps}get editor(){return this._publicationRun.editor}get explicitResources(){return this._publicationRun.explicitResources}get implicitGlobalResources(){return this._publicationRun.implicitGlobalResources}get finalGlobalEvent(){return this._publicationRun.finalGlobalEvent}get finalStatus(){return this._publicationRun.finalStatus}}function fRi(l,p){return p instanceof g_?p:new g_(l,p)}function yRi(l){l.register(new IVe(l)),l.register(new gVe(l)),l.register(new vVe(l)),l.register(new bVe(l)),l.register(new AVe(l)),l.register(new EVe(l)),l.register(new sLe(l)),l.register(new lLe(l)),l.register(new oLe(l)),l.register(new uLe(l)),l.register(new dLe(l)),l.register(new pLe(l)),l.register(new Q2e(l)),l.register(new eBe(l)),l.register(new tBe(l)),l.register(new iBe(l)),l.register(new rBe(l)),l.register(new nBe(l)),l.register(new aBe(l)),l.register(new sBe(l)),l.register(new lBe(l)),l.register(new oBe(l)),l.register(new a$e(l)),l.register(new s$e(l)),l.register(new l$e(l)),l.register(new o$e(l)),l.register(new d$e(l)),l.register(new u$e(l)),l.register(new p$e(l)),l.register(new c$e(l)),l.register(new f$e(l)),l.register(new y$e(l)),l.register(new h$e(l)),l.register(new m$e(l)),l.register(new T$e(l)),l.register(new v$e(l)),l.register(new E$e(l)),l.register(new b$e(l)),l.register(new A$e(l)),l.register(new g$e(l)),l.register(new I$e(l)),l.register(new w$e(l)),l.register(new C$e(l)),l.register(new O$e(l)),l.register(new Dxe(l)),l.register(new wxe(l)),l.register(new Cxe(l)),l.register(new Oxe(l)),l.register(new _xe(l)),l.register(new Vxe(l)),l.register(new Pxe(l)),l.register(new Nxe(l)),l.register(new xxe(l)),l.register(new Lxe(l)),l.register(new Bxe(l)),l.register(new Mxe(l)),l.register(new Gxe(l)),l.register(new jxe(l)),l.register(new FNe(l)),l.register(new KNe(l)),l.register(new SNe(l)),l.register(new T2e(l)),l.register(new m2e(l)),l.register(new kPe(l)),l.register(new FPe(l)),l.register(new KPe(l)),l.register(new SPe(l)),l.register(new qPe(l)),l.register(new ZPe(l)),l.register(new HPe(l)),l.register(new WPe(l)),l.register(new zPe(l)),l.register(new oNe(l)),l.register(new jNe(l)),l.register(new UNe(l)),l.register(new kNe(l)),l.register(new YPe(l)),l.register(new JPe(l)),l.register(new XPe(l)),l.register(new QPe(l)),l.register(new eNe(l)),l.register(new tNe(l)),l.register(new iNe(l)),l.register(new rNe(l)),l.register(new nNe(l)),l.register(new aNe(l)),l.register(new sNe(l)),l.register(new lNe(l)),l.register(new dNe(l)),l.register(new uNe(l)),l.register(new pNe(l)),l.register(new cNe(l)),l.register(new fNe(l)),l.register(new yNe(l)),l.register(new hNe(l)),l.register(new mNe(l)),l.register(new TNe(l)),l.register(new vNe(l)),l.register(new ENe(l)),l.register(new bNe(l)),l.register(new _Ne(l)),l.register(new VNe(l)),l.register(new PNe(l)),l.register(new ANe(l)),l.register(new gNe(l)),l.register(new INe(l)),l.register(new RNe(l)),l.register(new DNe(l)),l.register(new wNe(l)),l.register(new CNe(l)),l.register(new ONe(l)),l.register(new A2e(l)),l.register(new g2e(l)),l.register(new I2e(l)),l.register(new R2e(l)),l.register(new v2e(l)),l.register(new E2e(l)),l.register(new b2e(l)),l.register(new D2e(l)),l.register(new C2e(l)),l.register(new _2e(l)),l.register(new w2e(l)),l.register(new O2e(l)),l.register(new V2e(l)),l.register(new x2e(l)),l.register(new P2e(l)),l.register(new N2e(l)),l.register(new Uxe(l)),l.register(new Sxe(l)),l.register(new qxe(l)),l.register(new Wxe(l)),l.register(new zxe(l)),l.register(new Yxe(l)),l.register(new Jxe(l)),l.register(new Xxe(l)),l.register(new Qxe(l)),l.register(new e$e(l)),l.register(new t$e(l)),l.register(new Zxe(l)),l.register(new Hxe(l)),l.register(new Fxe(l)),l.register(new Kxe(l)),l.register(new kxe(l)),l.register(new $xe(l)),l.register(new r$e(l)),l.register(new n$e(l)),l.register(new i$e(l)),l.register(new fLe(l)),l.register(new MLe(l)),l.register(new BLe(l)),l.register(new GLe(l)),l.register(new jLe(l)),l.register(new mLe(l)),l.register(new TLe(l)),l.register(new ILe(l)),l.register(new ALe(l)),l.register(new $Le(l)),l.register(new OLe(l)),l.register(new VLe(l)),l.register(new NLe(l)),l.register(new PLe(l)),l.register(new gLe(l)),l.register(new DLe(l)),l.register(new wLe(l)),l.register(new RLe(l)),l.register(new cLe(l)),l.register(new vLe(l)),l.register(new _Le(l)),l.register(new FLe(l)),l.register(new m_(l)),l.register(new hLe(l)),l.register(new ELe(l)),l.register(new yLe(l)),l.register(new xLe(l)),l.register(new bLe(l)),l.register(new CLe(l)),l.register(new LLe(l)),l.register(new kLe(l)),l.register(new ULe(l)),l.register(new KLe(l)),l.register(new m_(l)),l.register(new qLe(l)),l.register(new SLe(l)),l.register(new ZLe(l)),l.register(new K$e(l)),l.register(new S$e(l)),l.register(new q$e(l)),l.register(new V$e(l)),l.register(new D$e(l)),l.register(new $$e(l)),l.register(new G$e(l)),l.register(new R$e(l)),l.register(new j$e(l)),l.register(new F$e(l)),l.register(new B$e(l)),l.register(new L$e(l)),l.register(new fg(l)),l.register(new Z$e(l)),l.register(new H$e(l)),l.register(new M$e(l)),l.register(new k$e(l)),l.register(new U$e(l)),l.register(new x$e(l)),l.register(new N$e(l)),l.register(new P$e(l)),l.register(new _$e(l)),l.register(new Y$e(l)),l.register(new z$e(l)),l.register(new J$e(l)),l.register(new W$e(l)),l.register(new LNe(l)),l.register(new NNe(l)),l.register(new $Ne(l)),l.register(new BNe(l)),l.register(new MNe(l)),l.register(new xNe(l)),l.register(new GNe(l)),l.register(new dBe(l)),l.register(new hBe(l)),l.register(new TBe(l)),l.register(new EBe(l)),l.register(new yBe(l)),l.register(new mBe(l)),l.register(new vBe(l)),l.register(new fBe(l)),l.register(new cBe(l)),l.register(new pBe(l)),l.register(new uBe(l)),l.register(new RBe(l)),l.register(new DBe(l)),l.register(new gBe(l)),l.register(new IBe(l)),l.register(new X2e(l)),l.register(new bBe(l)),l.register(new ABe(l)),l.register(new CBe(l)),l.register(new wBe(l)),l.register(new OBe(l)),l.register(new _Be(l)),l.register(new VBe(l)),l.register(new DVe(l)),l.register(new wVe(l)),l.register(new pg(l)),l.register(new cg(l))}class Fx{constructor(p=new z.Events("extensions-registry-fallback-events")){R(this,"extensionsRegistry",new Map);R(this,"initialized",new Set);R(this,"initializedContexts",new Set);R(this,"onResolveEditorContextCallback",()=>null);R(this,"onResolveProjectLogicContextCallback",()=>null);R(this,"onResolveEditorGUIContextCallback",()=>null);R(this,"onResolveGUIContextCallback",()=>null);R(this,"onResolveCompileContextCallback",()=>null);R(this,"onResolvePublicationRunContextCallback",()=>null);this.events=p,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(p){this.onResolveEditorContextCallback=p}onResolveProjectLogicContext(p){this.onResolveProjectLogicContextCallback=p}onResolveGUIContext(p){this.onResolveGUIContextCallback=p}onResolveEditorGUIContext(p){this.onResolveEditorGUIContextCallback=p}onResolveCompileContext(p){this.onResolveCompileContextCallback=p}onResolvePublicationRunContext(p){this.onResolvePublicationRunContextCallback=p}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((p,i)=>(p.manifest.initPriority||De.Normal)-(i.manifest.initPriority||De.Normal))}async setup(){yRi(this),z.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case te.Editor:return this.onResolveEditorContextCallback();case te.Logic:return this.onResolveProjectLogicContextCallback();case te.EditorGUI:return this.onResolveEditorGUIContextCallback();case te.Compile:return this.onResolveCompileContextCallback();case te.PublicationRun:return this.onResolvePublicationRunContextCallback();case te.GUI:return this.onResolveGUIContextCallback();case te.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${p}`)}}requestContexts(p,i=[]){const r=[];i.length===0&&(i=p.manifest.contexts);for(const a of i){const c=this.requestContext(a);c&&r.push(c)}return r}requestExtension(p){const i=this.extensionsRegistry.get(p);if(i)return i;throw new Error(`Unknown extension: ${p}`)}register(p){this.extensionsRegistry.set(p.manifest.id,p)}async initAll(){var p,i;for(const r of this.extensionInOrder)if(r.module.init&&!this.initialized.has(r.manifest.id)){const a=r.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);a.length&&(await((i=(p=r.module).init)==null?void 0:i.call(p,a)),this.initialized.add(r.manifest.id))}else!r.module.init&&!this.initialized.has(r.manifest.id)&&this.initialized.add(r.manifest.id)}async initForReady(){z.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder)if(p.module.init&&!this.initialized.has(p.manifest.id)){z.Logger.log("Initializing "+p.manifest.id+" extension...");const i=this.requestContexts(p);p.manifest.contexts.every(a=>!!i.find(c=>c.contextType===a))?(await p.module.init(i),this.initialized.add(p.manifest.id)):z.Logger.warn(`Skipping initialization of ${p.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${p.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(a=>a.contextType).join(", ")}`)}else!p.module.init&&!this.initialized.has(p.manifest.id)?(z.Logger.log("Set "+p.manifest.id+" extension as initialized by default..."),this.initialized.add(p.manifest.id)):z.Logger.log(`Skipping initialization of ${p.manifest.id} extension, already initialized or no init method defined.`)}async destroyAll(){for(const p of[...this.extensionInOrder].reverse())p.module.destroy&&await p.module.destroy();this.events.destroy()}on(p,i){this.events.on(p,i)}emit(p,...i){this.events.emit(p,...i)}off(p,i){this.events.off(p,i)}emitAsync(p,...i){return this.events.emitAsync(p,...i)}emitAsyncAll(p,...i){return this.events.emitAsyncAll(p,...i)}emitAsyncAllSettled(p,...i){return this.events.emitAsyncAllSettled(p,...i)}emitAsyncSequentially(p,...i){return this.events.emitAsyncSequentially(p,...i)}emitAsyncSequentiallyAll(p,...i){return this.events.emitAsyncSequentiallyAll(p,...i)}emitAsyncSequentiallyAllSettled(p,...i){return this.events.emitAsyncSequentiallyAllSettled(p,...i)}async contextAvailable(p){if(this.initializedContexts.has(p)){z.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case te.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case te.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}z.Logger.log(`Context ${p} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(p){return window.localStorage.getItem("dynamic-value-type-preference--"+p)||null}setValueTypePreference(p,i){window.localStorage.setItem("dynamic-value-type-preference--"+p,(i==null?void 0:i.toString())||""),this.emit(p,{})}}let LA=null;const Kx={requestExtension:l=>(LA||(LA=new Fx,LA.setup()),LA.requestExtension(l))},Zu={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var Sx=(l=>(l.FinishedSuccess="finished-success",l.FinishedError="finished-error",l.Running="running",l.Paused="paused",l.Stopped="stopped",l.NotStarted="not-started",l))(Sx||{});const PBe={...Kx,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class ip extends z.Events{constructor(i,r,a,c=null,e=PBe){super();R(this,"project");R(this,"entryPoint");R(this,"state","not-started");R(this,"events",new z.Events("fe-exec-inst-events"));R(this,"entities",[]);R(this,"parentExecution",null);R(this,"executing",[]);R(this,"executed",[]);R(this,"skipped",[]);R(this,"scheduled",[]);R(this,"localTestValues");R(this,"resolvedValues");R(this,"persistedExecutionResults");R(this,"lastExecutionResults");R(this,"onAddToSkippedListCallback",null);R(this,"onRemoveFromSkippedListCallback",null);R(this,"onAddEntityCallback",null);R(this,"onRemoveEntityCallback",null);R(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=r,this.entryPoint=a,this.project=i,this.parentExecution=c,this.localTestValues=new mT(N.UUID.uuid(),this.project),this.resolvedValues=new mT(N.UUID.uuid(),this.project),this.persistedExecutionResults=new mT(N.UUID.uuid(),this.project),this.lastExecutionResults=new mT(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,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}skip(i){this.hasEntity(i)&&(this.removeFromScheduledList(i),!this.skipped.includes(i)&&(this.skipped.push(i),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(i),hr.includes(i.type)&&yt(i).forEach(r=>this.skip(r))))}async schedule(i,r,a){if(this.hasExecuted(i))return null;if(Ft.includes(i.type))return this.executeBranch(i,a,r);if(Pr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,a,r);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,r){const a=[];return[...Nt,...Ft].includes(r.type)?a.push(...r.inputs):Dt.includes(r.type)&&a.push(...r.outputs),a.map(e=>{var h;let f=i.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&Ft.includes(r.type)&&(f=i.find(m=>{var E;return((E=m.valueOwner.declaration)==null?void 0:E.id)===e.id})),f){const m=(h=f.value)==null?void 0:h.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return pn.includes(e.type)?Fo(e,this.valueResolutionContext):lf(e,this.valueResolutionContext)}).reduce((e,f)=>{const h=Jo(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return h.forEach(E=>{var _,$,L;if(E.id===(f==null?void 0:f.valueOwner.id))return;const b=xt(E.getDataType(null),E,this.project);b==null||b.metaSync({value:(_=f==null?void 0:f.value)==null?void 0:_.value},null),b==null||b.setValueAsTypeList((($=f==null?void 0:f.value)==null?void 0:$.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((L=f==null?void 0:f.value)==null?void 0:L.valueAsTypeSingle)||null);const g={...f,valueOwner:E,value:b};m.push(g)}),[...e,...m]},[]).sort((e,f)=>e.valueOwner.index-f.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,r,a,c={}){var f,h;const e={...Zu,...c};try{let m={value:U.Success,error:null,result:null};if(r.sort((E,b)=>E.valueOwner.index-b.valueOwner.index),Object.values(Vr).includes(i.declaration.id)){const E=this.parentContext.requestExtension(Wy+i.declaration.id).module.main;E?m=await E(i,r):z.Logger.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{m=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);let E=null;if(m.error){z.Logger.warn("Raw error executing entity: ",m.error);const b=(f=i.error)==null?void 0:f.getDataType(null),g=xt(b||null,i.error,a);b!=null&&b.asType?g==null||g.setValueAsTypeSingle(m.error):g==null||g.metaSync({value:m.error},null),E={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:g}}return{value:m.value,entity:i,error:E,result:{value:m.result||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}return{...m,entity:i}}catch(m){z.Logger.warn("Internal call execution error: ",m);let E=null;if(i.error){const b=(h=i.error)==null?void 0:h.getDataType(null),g=xt(b,i.error,a);b!=null&&b.asType?g==null||g.setValueAsTypeSingle(m):g==null||g.metaSync({value:m},null),E={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:g}}return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:E,result:null}}}static async executeOperation(i,r,a){var c,e;try{let f={value:U.Success,error:null,result:null};r.sort((b,g)=>b.valueOwner.index-g.valueOwner.index),i.declaration.implementation&&(f=await i.declaration.implementation(i,r));let h=null;if(f.error&&i.error){z.Logger.warn("Raw error executing entity: ",f.error);const b=((c=i.error)==null?void 0:c.getDataType(null))||null,g=xt(b,i.error,a);b!=null&&b.asType?g==null||g.setValueAsTypeSingle(f.error):g==null||g.metaSync({value:f.error},null),h={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:g}}const m=i==null?void 0:i.getDataType(null),E=xt(m,i,a);return m!=null&&m.asType?E==null||E.setValueAsTypeSingle(f.result):E==null||E.metaSync({value:f.result},null),{value:f.value,entity:i,error:h,result:{value:E||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(f){z.Logger.warn("Operation execution error: ",f);let h=null;if(i.error){const m=(e=i.error)==null?void 0:e.getDataType(null),E=xt(m,i.error,a);m!=null&&m.asType?E==null||E.setValueAsTypeSingle(f):E==null||E.metaSync({value:f},null),h={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:E}}return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:h,result:null}}}async executeSearch(i,r,a){var c;try{let e={value:U.Success,error:null,result:null};const f=await(await this.parentContext.requestExtension(Oe.SEARCH_NODE_IMPLEMENTATION)).module.main(i,r),h=i==null?void 0:i.getDataType(null),m=xt(h,i,a);return m==null||m.metaSync({value:f},null),f.error?{value:U.UnhandledError,entity:i,error:{valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:m},result:null}:{value:e.value,entity:i,error:null,result:{value:m,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(e){if(z.Logger.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null};const f=(c=i.error)==null?void 0:c.getDataType(null),h=xt(f,i.error,a);return h==null||h.metaSync({value:e},null),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:h},result:null}}}async executeLoop(i,r,a,c={}){var f,h,m,E,b,g;const e={...Zu,...c};try{let _={value:U.Success,error:null,result:null};const $=r.map(ie=>{var ee,ue;return((ee=ie==null?void 0:ie.value)==null?void 0:ee.valueAsType)||((ue=ie==null?void 0:ie.value)==null?void 0:ue.value)});let L={};i.getUniqueInputMaps().forEach(ie=>{const ee=i.body.inputs.find(ce=>se(ce,a)===se(ie,a)),ue=ie==null?void 0:ie.getDataType(null),ae=xt(ue,ee,a);ue!=null&&ue.asType?ae==null||ae.setValueAsTypeList([]):ae==null||ae.metaSync({value:[]},null),this.lastExecutionResults.writeValue(ee,ae);const de={value:ae,valueOwner:ee,type:Me.ExecutionResult,inheritanceLink:null};L[ee.id]=de});let k={value:U.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case re.loop["counted-loop"].id:{const ie=$[0];let ee=1;for(;ee<=ie&&ee<=50;){const ue=i.body.inputs.map(ae=>{if(ae===i.currentIterationNumberArgumentDeclaration){const de=i.currentIterationNumberArgumentDeclaration.getDataType(null),ce=Wc(de),ne=this.lastExecutionResults.readValue(ae.id);if(ne){ne.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ae,ne);const Ee={value:ne,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null};return L[ae.id]=Ee,Ee}const le={id:N.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:N.UUID.uuid(),createdAt:new Date().toISOString(),author:N.sessionAuthor,deleted:!1,previousVersion:null,value:ee,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:ae.toReference()},Q=Yi(le,a);this.lastExecutionResults.writeValue(ae,Q);const oe={value:Q,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null};return L[ae.id]=oe,oe}else return L[ae.id]}).filter(ae=>!!ae);if(k=await this.executeFullFunctionDeclarationLogic(i.body,ue,e),(k.results||[]).forEach(ae=>{var le,Q,oe,Ee;if(ae.valueOwner.type!==d.InputMap||Dt.includes(ae.valueOwner.parent.type))return;const de=i.body.inputs.find(Te=>se(Te,a)===se(ae.valueOwner,a)),ne=[...((Q=(le=L==null?void 0:L[de.id])==null?void 0:le.value)==null?void 0:Q.value)||[],((oe=ae==null?void 0:ae.value)==null?void 0:oe.value)||null];(Ee=L[de.id].value)==null||Ee.metaSync({value:ne},null),this.lastExecutionResults.writeValue(de,L[de.id].value)}),[U.CaughtError,U.Break,U.Return].includes(k.value))break;ee++}break}case re.loop["manual-flow-loop"].id:{let ie=1;for(;ie<=50;){const ee=i.body.inputs.map(ue=>{if(ue===i.currentIterationNumberArgumentDeclaration){const ae=this.lastExecutionResults.readValue(ue.id);if(ae){ae.metaSync({value:ie},null),this.lastExecutionResults.writeValue(ue,ae);const le={value:ae,valueOwner:ue,type:Me.ExecutionResult,inheritanceLink:null};return L[ue.id]=le,le}const de=i.currentIterationNumberArgumentDeclaration.getDataType(null),ce=xt(de,ue,a);return ce==null||ce.metaSync({value:ie},null),this.lastExecutionResults.writeValue(ue,ce),{value:ce,valueOwner:ue,type:Me.ExecutionResult,inheritanceLink:null}}else return L[ue.id]}).filter(ue=>!!ue);if(k=await this.executeFullFunctionDeclarationLogic(i.body,ee,e),(k.results||[]).forEach(ue=>{var ne,le,Q;if(ue.valueOwner.type!==d.InputMap||Dt.includes(ue.valueOwner.parent.type))return;const ae=i.body.inputs.find(oe=>se(oe,a)===se(ue.valueOwner,a)),ce=[...(ne=L[ae.id].value)==null?void 0:ne.value,((le=ue.value)==null?void 0:le.value)||null];(Q=L[ae.id].value)==null||Q.metaSync({value:ce},null),this.lastExecutionResults.writeValue(ae,L[ae.id].value)}),[U.CaughtError,U.Break,U.Return].includes(k.value))break;ie++}break}case re.loop["list-loop"].id:{const ie=$[0];let ee=1;const ue=ie;for(let ae=0;ae<ue.length;ae++){const de=ue[ae],ce=i.body.inputs.map(ne=>{if(ne===i.currentIterationNumberArgumentDeclaration){const le=this.lastExecutionResults.readValue(ne.id);if(le)return le.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ne,le),{value:le,valueOwner:ne,type:Me.ExecutionResult,inheritanceLink:null};const Q=i.currentIterationNumberArgumentDeclaration.getDataType(null),oe=xt(Q,ne,a);return oe==null||oe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ne,oe),{value:oe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(ne===i.currentValueArgumentDeclaration){const le=i.currentValueArgumentDeclaration.getDataType(null),Q=Wc(le),oe=this.lastExecutionResults.readValue(ne.id);if(oe)return oe.metaSync({value:de},null),this.lastExecutionResults.writeValue(ne,oe),{value:oe,valueOwner:ne,type:Me.ExecutionResult,inheritanceLink:null};const Ee={id:N.UUID.uuid(),deletable:!0,editable:!0,type:d.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:Q,standaloneParent:ne.toReference()},Te=Yi(Ee,a);return this.lastExecutionResults.writeValue(ne,Te),{value:Te,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return L[ne.id]}).filter(ne=>!!ne);if(k=await this.executeFullFunctionDeclarationLogic(i.body,ce,e),(k.results||[]).forEach(ne=>{var Ee,Te,Ve;if(ne.valueOwner.type!==d.InputMap||Dt.includes(ne.valueOwner.parent.type))return;const le=i.body.inputs.find(Le=>se(Le,a)===se(ne.valueOwner,a)),oe=[...(Ee=L[le.id].value)==null?void 0:Ee.value,((Te=ne.value)==null?void 0:Te.value)||null];(Ve=L[le.id].value)==null||Ve.metaSync({value:oe},null),this.lastExecutionResults.writeValue(le,L[le.id].value)}),[U.CaughtError,U.Break,U.Return].includes(k.value))break;ee++}break}case re.loop["object-keys-loop"].id:{const ie=$[0];let ee=1;const ue=ie?Object.keys(ie):[];for(let ae=0;ae<ue.length;ae++){const de=ue[ae],ce=i.body.inputs.map(ne=>{if(ne===i.currentIterationNumberArgumentDeclaration){const le=this.lastExecutionResults.readValue(ne.id);if(le)return le.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ne,le),{value:le,valueOwner:ne,type:Me.ExecutionResult,inheritanceLink:null};const Q=i.currentIterationNumberArgumentDeclaration.getDataType(null),oe=xt(Q,ne,a);return oe==null||oe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ne,oe),{value:oe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(ne===i.currentValueArgumentDeclaration){const le=i.currentValueArgumentDeclaration.getDataType(null),Q=Wc(le),oe=this.lastExecutionResults.readValue(ne.id);if(oe)return oe.metaSync({value:de},null),this.lastExecutionResults.writeValue(ne,oe),{value:oe,valueOwner:ne,type:Me.ExecutionResult,inheritanceLink:null};const Ee={id:N.UUID.uuid(),deletable:!0,editable:!0,type:d.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:Q,standaloneParent:ne.toReference()},Te=Yi(Ee,a);return this.lastExecutionResults.writeValue(ne,Te),{value:Te,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return L[ne.id]}).filter(ne=>!!ne);if(k=await this.executeFullFunctionDeclarationLogic(i.body,ce,e),(k.results||[]).forEach(ne=>{var Ee,Te,Ve;if(ne.valueOwner.type!==d.InputMap||Dt.includes(ne.valueOwner.parent.type))return;const le=i.body.inputs.find(Le=>se(Le,a)===se(ne.valueOwner,a)),oe=[...(Ee=L[le.id].value)==null?void 0:Ee.value,((Te=ne.value)==null?void 0:Te.value)||null];(Ve=L[le.id].value)==null||Ve.metaSync({value:oe},null),this.lastExecutionResults.writeValue(le,L[le.id].value)}),[U.CaughtError,U.Break,U.Return].includes(k.value))break;ee++}break}case re.loop["object-values-loop"].id:{const ie=$[0];let ee=1;const ue=ie?Object.values(ie):[];for(let ae=0;ae<ue.length;ae++){const de=ue[ae],ce=i.body.inputs.map(ne=>{if(ne===i.currentIterationNumberArgumentDeclaration){const le=this.lastExecutionResults.readValue(ne.id);if(le)return le.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ne,le),{value:le,valueOwner:ne,type:Me.ExecutionResult,inheritanceLink:null};const Q=i.currentIterationNumberArgumentDeclaration.getDataType(null),oe=xt(Q,ne,a);return oe==null||oe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ne,oe),{value:oe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(ne===i.currentValueArgumentDeclaration){const le=i.currentValueArgumentDeclaration.getDataType(null),Q=Wc(le),oe=this.lastExecutionResults.readValue(ne.id);if(oe)return oe.metaSync({value:de},null),this.lastExecutionResults.writeValue(ne,oe),{value:oe,valueOwner:ne,type:Me.ExecutionResult,inheritanceLink:null};const Ee={id:N.UUID.uuid(),deletable:!0,editable:!0,type:d.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:Q,standaloneParent:ne.toReference()},Te=Yi(Ee,a);return this.lastExecutionResults.writeValue(ne,Te),{value:Te,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return L[ne.id]}).filter(ne=>!!ne);if(k=await this.executeFullFunctionDeclarationLogic(i.body,ce,e),(k.results||[]).forEach(ne=>{var Ee,Te,Ve;if(ne.valueOwner.type!==d.InputMap||Dt.includes(ne.valueOwner.parent.type))return;const le=i.body.inputs.find(Le=>se(Le,a)===se(ne.valueOwner,a)),oe=[...(Ee=L[le.id].value)==null?void 0:Ee.value,((Te=ne.value)==null?void 0:Te.value)||null];(Ve=L[le.id].value)==null||Ve.metaSync({value:oe},null),this.lastExecutionResults.writeValue(le,L[le.id].value)}),[U.CaughtError,U.Break,U.Return].includes(k.value))break;ee++}break}case re.loop["string-loop"].id:{const ie=$[0];let ee=1;const ue=ie.split("");for(let ae=0;ae<ue.length;ae++){const de=ue[ae],ce=i.body.inputs.map(ne=>{if(ne===i.currentIterationNumberArgumentDeclaration){const le=this.lastExecutionResults.readValue(ne.id);if(le)return le.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ne,le),{value:le,valueOwner:ne,type:Me.ExecutionResult,inheritanceLink:null};const Q=i.currentIterationNumberArgumentDeclaration.getDataType(null),oe=xt(Q,ne,a);return oe==null||oe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ne,oe),{value:oe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(ne===i.currentValueArgumentDeclaration){const le=i.currentValueArgumentDeclaration.getDataType(null),Q=Wc(le),oe=this.lastExecutionResults.readValue(ne.id);if(oe)return oe.metaSync({value:de},null),this.lastExecutionResults.writeValue(ne,oe),{value:oe,valueOwner:ne,type:Me.ExecutionResult,inheritanceLink:null};const Ee={id:N.UUID.uuid(),deletable:!0,editable:!0,type:d.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:Q,standaloneParent:ne.toReference()},Te=Yi(Ee,a);return this.lastExecutionResults.writeValue(ne,Te),{value:Te,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return L[ne.id]}).filter(ne=>!!ne);if(k=await this.executeFullFunctionDeclarationLogic(i.body,ce,e),(k.results||[]).forEach(ne=>{var Ee,Te,Ve;if(ne.valueOwner.type!==d.InputMap||Dt.includes(ne.valueOwner.parent.type))return;const le=i.body.inputs.find(Le=>se(Le,a)===se(ne.valueOwner,a)),oe=[...(Ee=L[le.id].value)==null?void 0:Ee.value,((Te=ne.value)==null?void 0:Te.value)||null];(Ve=L[le.id].value)==null||Ve.metaSync({value:oe},null),this.lastExecutionResults.writeValue(le,L[le.id].value)}),[U.CaughtError,U.Break,U.Return].includes(k.value))break;ee++}break}}if(_={value:[U.CaughtError,U.Return].includes(k.value)?k.value:U.Success,error:((h=(f=k.error)==null?void 0:f.value)==null?void 0:h.value)||null,result:((E=(m=k==null?void 0:k.result)==null?void 0:m.value)==null?void 0:E.value)||null},_.error&&i.error){const ie=(b=i.error)==null?void 0:b.getDataType(null),ee=xt(ie||null,i.error,a);ie!=null&&ie.asType?ee==null||ee.setValueAsTypeSingle(_.error):ee==null||ee.metaSync({value:_.error},null);const ue={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:ee};return{value:_.value,entity:i,error:ue,result:null}}const G=i==null?void 0:i.getDataType(null),H=xt(G,i,a);return G!=null&&G.asType?H==null||H.setValueAsTypeSingle(_.result):H==null||H.metaSync({value:_.result},null),{value:_.value,entity:i,error:null,result:{value:H||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(_){if(z.Logger.warn("Error executing loop: ",_),i.error){const $=(g=i.error)==null?void 0:g.getDataType(null),L=xt($,i.error,a);return $!=null&&$.asType?L==null||L.setValueAsTypeSingle(_):L==null||L.metaSync({value:_},null),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:L},result:null}}else return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,r,a,c={}){var f,h,m,E,b,g,_,$,L,j,k,G,H,ie,ee,ue,ae,de,ce,ne,le,Q,oe,Ee,Te,Ve;const e={...Zu,...c};try{const Le=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);let $e=null;if(Le.error&&i.error){z.Logger.warn("Raw error executing entity: ",Le.error);const rt=(f=i.error)==null?void 0:f.getDataType(null),Rt=xt(rt||null,i.error,a);rt!=null&&rt.asType?(m=(h=Le.error)==null?void 0:h.value)!=null&&m.valueAsTypeSingle?Rt==null||Rt.setValueAsTypeSingle((b=(E=Le.error)==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle):(_=(g=Le.error)==null?void 0:g.value)!=null&&_.valueAsTypeList&&Array.isArray((L=($=Le.error)==null?void 0:$.value)==null?void 0:L.valueAsTypeList)&&(Rt==null||Rt.setValueAsTypeList((k=(j=Le.error)==null?void 0:j.value)==null?void 0:k.valueAsTypeList)):Rt==null||Rt.metaSync({value:(H=(G=Le.error)==null?void 0:G.value)==null?void 0:H.value},null),$e={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:Rt}}let ke=U.Success;Le.value===U.UnhandledError&&(i.catchesError||i.errorCalls.length?ke=U.CaughtError:ke=U.UnhandledError);const Ke=i==null?void 0:i.getDataType(null),Je=xt(Ke,i,a);return Ke!=null&&Ke.asType?(ee=(ie=Le.result)==null?void 0:ie.value)!=null&&ee.valueAsTypeSingle?Je==null||Je.setValueAsTypeSingle((ae=(ue=Le.result)==null?void 0:ue.value)==null?void 0:ae.valueAsTypeSingle):(ce=(de=Le.result)==null?void 0:de.value)!=null&&ce.valueAsTypeList&&Array.isArray((le=(ne=Le.result)==null?void 0:ne.value)==null?void 0:le.valueAsTypeList)&&(Je==null||Je.setValueAsTypeList((oe=(Q=Le.result)==null?void 0:Q.value)==null?void 0:oe.valueAsTypeList)):Je==null||Je.metaSync({value:((Te=(Ee=Le.result)==null?void 0:Ee.value)==null?void 0:Te.value)||null},null),{value:ke,entity:i,error:$e,result:{value:Je||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(Le){if(!i.error)return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null};const $e=(Ve=i.error)==null?void 0:Ve.getDataType(null),ke=xt($e,i.error,a);return $e!=null&&$e.asType?ke==null||ke.setValueAsTypeSingle(Le):ke==null||ke.metaSync({value:Le},null),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:ke},result:null}}}async executeCondition(i,r){var c,e,f,h;let a=!1;switch(i.declaration.id){case un.BooleanIsTrue:{const m=(e=(c=r[0])==null?void 0:c.value)==null?void 0:e.value;if(typeof m!="boolean")throw new TypeError("BooleanIsTrue expects a boolean input.");a=m===!0;break}case un.BooleanIsFalse:{const m=(h=(f=r[0])==null?void 0:f.value)==null?void 0:h.value;if(typeof m!="boolean")throw new TypeError("BooleanIsFalse expects a boolean input.");a=m===!1;break}case Ir.And:{a=(await Promise.all(i.andChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(r,E);return(await this.executeCondition(E,b)).value===U.Success}))).every(E=>E);break}case Ir.Or:{a=(await Promise.all(i.orChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(r,E);return(await this.executeCondition(E,b)).value===U.Success}))).some(E=>E);break}default:throw new Error(`Condition declaration ${i.declaration.name} does not have an implementation.`)}return{value:a?U.Success:U.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,r,a,c={}){const e={...Zu,...c,onBeforeEntityExecution:(m,E,b)=>{var g;return((g=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:g.call(c,m,E,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(m,E,b)=>{var g;return((g=c==null?void 0:c.onEntityExecuted)==null?void 0:g.call(c,m,E,{...b,detached:!0}))||Promise.resolve()}},f=new ip(a,[i,...Bg(i)],i,this,this.parentContext);return f.inheritValuesFromContext(this),await f.execute(e,r)}async executeFullFunctionDeclarationLogic(i,r,a={}){const c={...Zu,...a},e=Bg(i);e.forEach(m=>{this.addEntity(m)}),e.reduce((m,E)=>Dt.includes(E.type)?[...m,...E.outputs]:Nt.includes(E.type)&&E.type!==d.Condition?[...m,...E.outputs,...E.inputs]:E.type===d.Condition?[...m,...E.inputs]:m,[]).forEach(m=>{this.lastExecutionResults.removeValue(m.id)});const h=await this.executeBranch(i,c,r);return{...h||{},value:(h==null?void 0:h.value)||U.Success,entity:i,error:(h==null?void 0:h.error)||null,result:(h==null?void 0:h.result)||null}}static async executeEntryPointEntity(i,r){return{value:U.Success,entity:i,error:null,result:null}}async executeReturnStatement(i,r){var f,h,m,E,b,g,_;if((f=i.throws)!=null&&f.readsValue){const $=Fo(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let a=Fo(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)gr((m=a==null?void 0:a.value)==null?void 0:m.value)&&($={...$,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:$},null);else{const L=xt(c,i,this.project);L==null||L.metaSync({value:$},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(L=>{var j,k;if(((j=L.declaration)==null?void 0:j.type)===d.Property&&L.declaration.static){const G=this.lastExecutionResults.readValue(L.declaration.id),H=se(L,this.project),ie=L.codeName||((k=L.declaration)==null?void 0:k.codeName)||ir(H);if(G)G.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(L.declaration,G);else{const ee=xt(L.getDataType(null),L,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(L.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&gr((g=a.value)==null?void 0:g.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map($=>{var G;const L=$.codeName||((G=$.declaration)==null?void 0:G.codeName)||ir(se($,this.project)),j=e[L],k=xt($.getDataType(null),$,this.project);k==null||k.metaSync({value:j},null),Me.ExecutionResult}),a.type=Me.ExecutionResult,{value:U.Return,entity:i,error:null,result:a}}async executeContinueStatement(i,r){var f,h,m,E,b,g,_;if((f=i.throws)!=null&&f.readsValue){const $=Fo(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let a=Fo(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)gr((m=a==null?void 0:a.value)==null?void 0:m.value)&&($={...$,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:$},null);else{const L=xt(c,i,this.project);L==null||L.metaSync({value:$},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(L=>{var j,k;if(((j=L.declaration)==null?void 0:j.type)===d.Property&&L.declaration.static){const G=this.lastExecutionResults.readValue(L.declaration.id),H=se(L,this.project),ie=L.codeName||((k=L.declaration)==null?void 0:k.codeName)||ir(H);if(G)G.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(L.declaration,G);else{const ee=xt(L.getDataType(null),L,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(L.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&gr((g=a.value)==null?void 0:g.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map($=>{var G;const L=$.codeName||((G=$.declaration)==null?void 0:G.codeName)||ir(se($,this.project)),j=e[L],k=xt($.getDataType(null),$,this.project);k==null||k.metaSync({value:j},null),Me.ExecutionResult}),a.type=Me.ExecutionResult,{value:U.Continue,entity:i,error:null,result:a}}async executeBreakStatement(i,r){var f,h,m,E,b,g,_;if((f=i.throws)!=null&&f.readsValue){const $=Fo(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let a=Fo(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)gr((m=a==null?void 0:a.value)==null?void 0:m.value)&&($={...$,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:$},null);else{const L=xt(c,i,this.project);L==null||L.metaSync({value:$},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(L=>{var j,k;if(((j=L.declaration)==null?void 0:j.type)===d.Property&&L.declaration.static){const G=this.lastExecutionResults.readValue(L.declaration.id),H=se(L,this.project),ie=L.codeName||((k=L.declaration)==null?void 0:k.codeName)||ir(H);if(G)G.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(L.declaration,G);else{const ee=xt(L.getDataType(null),L,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(L.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&gr((g=a.value)==null?void 0:g.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map($=>{var G;const L=$.codeName||((G=$.declaration)==null?void 0:G.codeName)||ir(se($,this.project)),j=e[L],k=xt($.getDataType(null),$,this.project);k==null||k.metaSync({value:j},null),Me.ExecutionResult}),a.type=Me.ExecutionResult,{value:U.Break,entity:i,error:null,result:a}}async executeVariable(i,r){var h,m,E,b,g,_;let a=Fo(i,this.valueResolutionContext);const c=yr(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let $={};if(((h=e==null?void 0:e.entity)==null?void 0:h.type)===d.DefinitionEntity&&($={...$,...e.entity.getActiveRawDefaultValue()}),a!=null&&a.value)gr((m=a==null?void 0:a.value)==null?void 0:m.value)&&($={...$,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:$},null);else{const L=xt(e,i,this.project);L==null||L.metaSync({value:$},null),a={valueOwner:c,type:Me.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(c,a.value),c.inputs.forEach(L=>{var j,k;if(((j=L.declaration)==null?void 0:j.type)===d.Property&&L.declaration.static){const G=this.lastExecutionResults.readValue(L.declaration.id),H=se(L,this.project),ie=L.codeName||((k=L.declaration)==null?void 0:k.codeName)||ir(H);if(G)G.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(L.declaration,G);else{const ee=xt(L.getDataType(null),L,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(L.declaration,ee)}}})}else this.lastExecutionResults.writeValue(c,a==null?void 0:a.value);const f=(b=a==null?void 0:a.value)!=null&&b.value&&gr((g=a.value)==null?void 0:g.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map($=>{var G;const L=$.codeName||((G=$.declaration)==null?void 0:G.codeName)||ir(se($,this.project)),j=f[L],k=xt($.getDataType(null),$,this.project);k==null||k.metaSync({value:j},null),Me.ExecutionResult}),a.type=Me.ExecutionResult,{value:U.Success,entity:i,error:null,result:a}}mergeValues(i,r){const a=[];for(let c=0;c<r.length;c++)i!=null&&i[c]?a.push(i[c]):a.push(r[c]);return a}async executeEntity(i,r=[],a={}){var f,h,m,E,b,g,_,$,L,j,k;const c={...Zu,...a},e={detached:!1};switch(i.type){case d.Condition:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((f=c.onBeforeEntityExecution)==null?void 0:f.call(c,i,G,e)),this.executeCondition(i,G)}case d.InternalCall:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((h=c.onBeforeEntityExecution)==null?void 0:h.call(c,i,G,e)),this.executeInternalCall(i,G,this.project)}case d.Operation:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((m=c.onBeforeEntityExecution)==null?void 0:m.call(c,i,G,e)),ip.executeOperation(i,G,this.project)}case d.VariableInstance:case d.VariableDeclaration:return this.executeVariable(i,r);case d.FunctionCall:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((E=c.onBeforeEntityExecution)==null?void 0:E.call(c,i,G,e)),this.executeFunctionCall(i,G,this.project)}case d.FunctionDeclaration:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((b=c.onBeforeEntityExecution)==null?void 0:b.call(c,i,G,e)),ip.executeEntryPointEntity(i,G)}case d.Search:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((g=c.onBeforeEntityExecution)==null?void 0:g.call(c,i,G,e)),this.executeSearch(i,G,this.project)}case d.Loop:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((_=c.onBeforeEntityExecution)==null?void 0:_.call(c,i,G,e)),this.executeLoop(i,G,this.project,c)}case d.ReturnStatement:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await(($=c.onBeforeEntityExecution)==null?void 0:$.call(c,i,G,e)),this.executeReturnStatement(i,G)}case d.ContinueStatement:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((L=c.onBeforeEntityExecution)==null?void 0:L.call(c,i,G,e)),this.executeContinueStatement(i,G)}case d.BreakStatement:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((j=c.onBeforeEntityExecution)==null?void 0:j.call(c,i,G,e)),this.executeBreakStatement(i,G)}case d.GlobalEvent:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((k=c.onBeforeEntityExecution)==null?void 0:k.call(c,i,G,e)),ip.executeEntryPointEntity(i,G)}default:throw new Error(`Entity type ${i==null?void 0:i.type} is not recognized for execution.`)}}storeLastExecutionValues(i){var a,c,e;if(i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value),!i.result||!((a=i.result)!=null&&a.valueOwner))return;const r=Jo((c=i.result)==null?void 0:c.valueOwner,this.project);(e=i.result)!=null&&e.value?r.forEach(f=>{var h;this.lastExecutionResults.writeValue(f,(h=i.result)==null?void 0:h.value)}):r.forEach(f=>{this.lastExecutionResults.removeValue(f.id)})}async executeBranch(i,r={},a=[]){var m;const c={...Zu,...r},e={detached:!1};if(!this.hasEntity(i)||this.hasSkipped(i))return null;this.addToExecutingList(i),this.hasScheduled(i)&&this.removeScheduled(i);const h=await this.executeEntity(i,a,c);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(h),await((m=c.onEntityExecuted)==null?void 0:m.call(c,i,h,e)),h.value===U.Success){const E=(i.successCalls||i.calls||[]).filter(L=>this.hasEntity(L));(i.errorCalls||[]).forEach(L=>{this.skip(L)});let g=[];const _=(await Promise.all(E.map(L=>this.schedule(L,[],c)))).filter(L=>!!L),$=_.filter(L=>!!L).find(L=>L.value===U.CaughtError||L.value===U.Return||L.value===U.Break||L.value===U.Continue);return $||(g=[...g,..._],h)}else if(h.value===U.CaughtError||h.value===U.ConditionNotMet){const E=(i.errorCalls||[]).filter(L=>this.hasEntity(L));(i.successCalls||i.calls||[]).forEach(L=>{this.skip(L)});let g=[];const _=(await Promise.all(E.map(L=>this.schedule(L,[],c)))).filter(L=>!!L),$=_.filter(L=>!!L).find(L=>L.value===U.CaughtError||L.value===U.UnhandledError||L.value===U.Return||L.value===U.Break||L.value===U.Continue);return $||(g=[...g,..._],h)}else{if(h.value===U.UnhandledError)return this.executing.forEach(E=>{this.skip(E)}),this.scheduled.forEach(E=>{this.skip(E)}),hr.includes(h.entity.type)&&yt(h.entity).forEach(E=>{this.skip(E)}),h;if(h.value===U.Return)return h;if(h.value===U.Break)return h;if(h.value===U.Continue)return h}return h}async execute(i={},r=[]){const a={...Zu,...i};this.state="running";const c=await this.executeBranch(this.entryPoint,a,r);return this.state="finished-success",c}addEntity(i){var r;this.entities.includes(i)||(this.entities.push(i),(r=this.onAddEntityCallback)==null||r.call(this,i,{}))}async addEntityAsync(i,r={}){var a;this.entities.includes(i)||(this.entities.push(i),await((a=this.onAddEntityCallback)==null?void 0:a.call(this,i,r)))}addEntities(i){i.forEach(r=>this.addEntity(r))}async addEntitiesAsync(i,r={}){const a=z.YieldTracker.from(r),c=[];for(const e of i)c.push(this.addEntityAsync(e,r)),await a.tick();await Promise.all(c)}removeEntity(i){var r;if(i!==this.entryPoint){const a=this.entities.indexOf(i);a>-1&&(this.entities.splice(a,1),(r=this.onRemoveEntityCallback)==null||r.call(this,i,{}))}}hasEntity(i){var c,e,f;if(this.entities.includes(i))return!0;if(((c=i.parent)==null?void 0:c.type)===d.FunctionDeclaration&&((f=(e=i.parent)==null?void 0:e.parent)==null?void 0:f.type)===d.DefinitionEntity)return this.entities.includes(i.parent);const r=ht(i);if(!r)return!1;const a=r.type===d.Loop&&i.parent===r.body?r.body:null;return a?this.entities.includes(a)||this.entities.includes(r):this.entities.includes(r)}removeScheduled(i){const r=this.scheduled.indexOf(i);r>-1&&this.scheduled.splice(r,1)}hasScheduled(i){return!!this.scheduled.includes(i)}hasSkipped(i){return!!this.skipped.includes(i)}hasExecuted(i){return!!this.executed.includes(i)}hasEntityWithId(i){const r=this.project.get(i);return r?this.hasEntity(r):!1}onAddToSkippedList(i){this.onAddToSkippedListCallback=i}onAbortExecution(i){this.onAbortExecutionCallback=i}onAddEntity(i){this.onAddEntityCallback=i}onRemoveFromSkippedList(i){this.onRemoveFromSkippedListCallback=i}onRemoveEntity(i){this.onRemoveEntityCallback=i}addToExecutingList(i){this.executing.includes(i)||this.executing.push(i)}addToScheduledList(i){this.scheduled.includes(i)||this.scheduled.push(i)}removeFromScheduledList(i){const r=this.scheduled.indexOf(i);r>-1&&this.scheduled.splice(r,1)}removeFromExecutingList(i){var a;const r=this.executing.indexOf(i);r>-1&&(this.executing.splice(r,1),(a=this.onAbortExecutionCallback)==null||a.call(this,i,{}))}removeFromAlreadyExecutedList(i){const r=this.executed.indexOf(i);r>-1&&this.executed.splice(r,1)}removeFromSkippedList(i){var a;const r=this.skipped.indexOf(i);r>-1&&(this.skipped.splice(r,1),(a=this.onRemoveFromSkippedListCallback)==null||a.call(this,i,{}))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var r;this.skipped.includes(i)||(this.skipped.push(i),(r=this.onAddToSkippedListCallback)==null||r.call(this,i,{}))}getValueTypePreference(i){return this.parentContext.getValueTypePreference(i)||null}setValueTypePreference(i,r){this.parentContext.setValueTypePreference(i,r),this.emit(i,{})}}function hRi(l){var p,i;if(l.isList)return"list";if(((p=l.entity)==null?void 0:p.type)===d.DefinitionEntity)return"definition-entity";switch((i=l.entity)==null?void 0:i.name){case ye.Number:return"number";case ye.String:return"text";case ye.Boolean:return"boolean";case ye.UUID:return"uuid";case ye.Date:return"date-time";default:return"definition-entity"}}const Wa={[d.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[d.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[d.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[d.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[d.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[d.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[d.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[d.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[d.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[d.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[d.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[d.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[d.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[d.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[d.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[d.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[d.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[d.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[d.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[d.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[d.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[d.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[d.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[d.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"},[d.DataType]:{singular:"Data type",plural:"Data types",shortSingular:"Data type",shortPlural:"Data types"},[d.LiteralValue]:{singular:"Literal value",plural:"Literal values",shortSingular:"Value",shortPlural:"Values"}};function qx(l){const p=Z1(l);if(!p){const r=vh(l);if(r.includes(Ie.HTTP_ENDPOINT))return"HTTP endpoint";if(r.includes(Ie.PERSISTED_ENTITY))return"Persisted entity";if(r.includes(Ie.CRON_JOB))return"Scheduled execution";if(r.includes(Ie.RELATIONAL_DATABASE))return"Relational database"}if(p){let r="Extension of "+se(p,p.project)+" entity",a=Yo(r);const c=vh(l);return c.includes(Ie.HTTP_ENDPOINT)?"HTTP endpoint"+(a?", "+a:""):c.includes(Ie.PERSISTED_ENTITY)?"Persisted entity"+(a?", "+a:""):c.includes(Ie.CRON_JOB)?"Scheduled execution"+(a?", "+a:""):c.includes(Ie.RELATIONAL_DATABASE)?"Relational database"+(a?", "+a:""):r}let i="";return l.abstract&&(i="Template "),l.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function NBe(l){return l.parent.type===d.DefinitionEntity||l.parent.type===d.InstalledProject?"Internal action of "+se(l.parent,l.project):l.parent.type===d.Loop?"Action repeated on every iteration":"Internal action of entity"}function Zx(l){return cL(l)?NBe(l):"Custom trigger"}function mRi(l){var p;switch(l.type){case d.DefinitionEntity:return qx(l);case d.FunctionDeclaration:return Zx(l)}return(p=Wa[l.type])==null?void 0:p.singular}function TRi(l){var p;switch(l.type){case d.DefinitionEntity:return qx(l);case d.FunctionDeclaration:return Zx(l)}return(p=Wa[l.type])==null?void 0:p.singular}const Hx=4e4,Wx=280,vRi=300,zx=65,zy=32,Xy=39,xBe=26,$Be=49,Tg=44,ERi=35,ZA=52,Yx=10,Ko=Yx*2,vg=38,HA=90,Eg=270,LBe=Hx/2+120,BBe=Hx/2+180;function Jx(l){let i=zy+Tg+vg+Yx;const r=[...l.inputs];return r.length&&(i+=Ko,r.forEach(()=>{i+=xBe})),{height:i,width:280}}function MBe(l){let i=zx;const r=[];if([d.DefinitionEntity].includes(l.type)){const h=[...l.suggestedProperties||[],...l.properties||[]];h.length&&(i+=Ko,h.forEach(m=>{i+=m.static?$Be:Xy}))}if([d.DefinitionEntity,d.InstalledProject,d.Loop].includes(l.type)){const h=[...(l==null?void 0:l.suggestedMethods)||[],...l.methods||[],...l.functions||[],...l.body?[l.body]:[]];h.length&&(i+=Ko,h.forEach(m=>{const E=Jx(m);i+=E.height}))}Nt.includes(l.type)?(_t.includes(l.type)?r.push(...(l.usedInputs||[]).flatMap(h=>[h])||[]):r.push(...(l.inputs||[]).flatMap(h=>[h])||[]),l.error&&(i+=ZA)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(l.type)?(r.push(...l.outputs||[]),l.throws&&(i+=ZA)):l.type===d.Condition&&(r.push(l.inputs[0]),l.inputs[1]&&r.push(l.inputs[1]));const a=r.length;a&&(i+=a*Xy,i+=Ko);const c=[];if(l.type===d.FunctionDeclaration||l.type===d.GlobalEvent?c.push(...l.inputs||[]):Nt.includes(l.type)&&(_t.includes(l.type)?c.push(...l.usedOutputs||[]):c.push(...l.outputs||[])),_t.includes(l.type)){l.readsValue&&(i+=Ko,i+=Tg),l.writesValues.length&&(i+=Ko,i+=Tg),l.internalCalls.length&&l.usedInternalCalls.forEach(()=>i+=ZA+Ko);const h=l.getDataType(null);(!h||h.inferred)&&(i+=vg)}const e=c.length;return e&&(i+=e*Xy,i+=Ko),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(l.type)&&(i+=vg),{height:i,width:280}}function GBe(l){let p=0;if(l.parent.type!==d.DefinitionEntity)return{offset:p};const i=l.parent,r=i.methods.findIndex(c=>c.id===l.id);return i.methods.slice(0,r).forEach(c=>{const e=Jx(c);p+=e.height}),(i.properties.length||i.suggestedProperties.length)&&(p+=Ko,i.suggestedProperties.forEach(()=>{p+=Xy}),i.properties.forEach(()=>{p+=Xy})),{offset:p}}function lE(l){return`${l.split("-").map((r,a)=>a===0?r.charAt(0).toUpperCase()+r.slice(1):r.toLowerCase()).join(" ")}.`}function bRi(l){switch(l.code){case be.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case be.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case be.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case be.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case be.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case be.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case be.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case we.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case we.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case be.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case be.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case we.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case be.NoProperties:return"This entity has no properties, so it doesn't do anything";case be.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case be.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case be.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case be.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case be.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case be.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case be.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case be.PropertyImplementsNonAbstact:return"This property implements a non-template property";case be.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case be.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case be.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case be.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case be.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case we.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case we.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case we.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case we.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case we.UnreachableEntity:return"This entity is unreachable";case be.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case be.AbstractEntityImplements:return"This template entity implements a non-template entity";case be.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case be.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case be.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case be.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case be.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case be.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case be.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case be.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case be.MissingRequiredValue:return"This action is missing a required value";case be.NoPrimaryKeyProperty:return"This entity has no primary key property";case be.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case be.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case be.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case be.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case be.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case be.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case be.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case we.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case we.EmptyName:return"This entity has no name";case we.InvalidObjectStructure:return"This entity has an invalid structure";case we.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case we.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case we.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case we.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case we.MissingCaller:return"This action is missing a caller";case we.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case we.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case we.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case we.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case we.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case we.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case we.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case we.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case id.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case id.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case Ya.UUIDMustBeString:return`UUID must be a string, eg: "${np()}"`;case Ya.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${np()}"`;case Ya.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${np()}"`;case ya.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case ya.StringValueMustNotHaveDashes:return"This value must not contain dashes";case ya.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return lE(l.code)}}function ARi(l){switch(l.code){case be.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case be.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case be.IncorrectEntityImplementation:return"Incorrect implementation";case be.IncorrectMethodImplementation:return"Incorrect action implementation";case be.IncorrectPropertyImplementation:return"Incorrect property implementation";case be.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case be.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case we.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case we.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case be.MissingMethodImplementation:return"Missing action";case be.MissingPropertyImplementation:return"Missing property";case we.NameNotUniqueInScope:return"Duplicate name";case be.NoProperties:return"No properties";case be.NonStaticPropertyInStaticEntity:return"Non-static property";case be.StaticEntityWithNonStaticProperties:return"Non-static properties";case be.ReadingFromIncompatibleType:return"Read from different type";case be.WritingToIncompatibleType:return"Write to different type";case be.ScopeWithoutLogic:return"No logic";case be.NonStaticPropertyImplementsStatic:return"Invalid static property";case be.PropertyImplementsIncompatibleType:return"Incompatible data type";case be.PropertyImplementsNonAbstact:return"Non-template property";case be.StaticPropertyImplementsNonStatic:return"Non-static property";case be.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case be.VariableHasInputsAndInternalCall:return"Bad internal call";case be.VariableHasOutputsAndInternalCall:return"Bad internal call";case be.VariableIsCalledAndHasInternalCall:return"Bad internal call";case we.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case we.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case we.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case we.InternalCallParentMissingDataType:return"Parent has no data type";case we.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case we.UnreachableEntity:return"Unreachable entity";case be.DisconnectedCallableEntity:return"Disconnected entity";case be.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case be.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case be.InvalidPropertiesCombination:return"Invalid properties combination";case be.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case be.ExtendsIncompatibleEntities:return"Extends incompatible entities";case be.ImplementingNonAbstractEntity:return"Implementing non-template entity";case be.ImplementsIncompatibleEntities:return"Implements incompatible entities";case be.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case be.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case be.MissingRequiredValue:return"Missing required value";case be.NoPrimaryKeyProperty:return"No primary key property";case be.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case be.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case be.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case be.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case be.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case be.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case be.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case we.EmptyName:return"Empty name";case we.InvalidObjectStructure:return"Invalid object structure";case we.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case we.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case we.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case we.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case we.MissingCaller:return"Missing caller";case we.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case we.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case we.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case we.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case we.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case we.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case we.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case we.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case id.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case id.StatusCodeMustBeNumber:return"HTTP status code must be a number";case Ya.UUIDMustBeString:return"UUID must be a string";case Ya.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case Ya.UUIDMustBeValidFormat:return"UUID must be in a valid format";case ya.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case ya.StringValueMustNotHaveDashes:return"This value must not contain dashes";case ya.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return lE(l.code)}}function gRi(l){switch(l.code){case be.AbstractEntityWithNonAbstractMethods:return`${se(l.entity,l.entity.project)} has non-template actions`;case be.AbstractEntityWithNonAbstractProperties:return`${se(l.entity,l.entity.project)} has non-template properties`;case be.IncorrectEntityImplementation:return`${se(l.entity,l.entity.project)} incorrectly implements template`;case be.IncorrectMethodImplementation:return`${se(l.entity,l.entity.project)} incorrectly implements the template`;case be.IncorrectPropertyImplementation:return`${se(l.entity,l.entity.project)} incorrectly implements the template`;case be.AbstractMethodInNonAbstractEntity:return`${se(l.entity,l.entity.project)} can't be a template`;case be.AbstractPropertyInNonAbstractEntity:return`${se(l.entity,l.entity.project)} can't be a template`;case we.MethodOverwritesOtherSiblingWithSameName:return`${se(l.entity,l.entity.project)} overwrites action`;case we.PropertyOverwritesOtherSiblingWithSameName:return`${se(l.entity,l.entity.project)} overwrites property`;case be.MissingMethodImplementation:return`${se(l.entity,l.entity.project)} is missing action`;case be.MissingPropertyImplementation:return`${se(l.entity,l.entity.project)} is missing property`;case we.NameNotUniqueInScope:return`${se(l.entity,l.entity.project)} name is not unique`;case be.NoProperties:return`${se(l.entity,l.entity.project)} has no properties`;case be.NonStaticPropertyInStaticEntity:return`${se(l.entity,l.entity.project)} has non-static property`;case be.StaticEntityWithNonStaticProperties:return`${se(l.entity,l.entity.project)} has non-static properties`;case be.ReadingFromIncompatibleType:return`${se(l.entity,l.entity.project)} reads from different type`;case be.WritingToIncompatibleType:return`${se(l.entity,l.entity.project)} writes to different type`;case be.ScopeWithoutLogic:return`${se(l.entity,l.entity.project)} has no logic`;case be.NonStaticPropertyImplementsStatic:return`${se(l.entity,l.entity.project)} has invalid static property`;case be.PropertyImplementsIncompatibleType:return`${se(l.entity,l.entity.project)} has incompatible data type`;case be.PropertyImplementsNonAbstact:return`${se(l.entity,l.entity.project)} has non-template property`;case be.StaticPropertyImplementsNonStatic:return`${se(l.entity,l.entity.project)} has non-static property`;case be.VariableCallsOthersAndHasInternalCall:return`${se(l.entity,l.entity.project)} has bad internal call`;case be.VariableHasInputsAndInternalCall:return`${se(l.entity,l.entity.project)} has bad internal call`;case be.VariableHasOutputsAndInternalCall:return`${se(l.entity,l.entity.project)} has bad internal call`;case be.VariableIsCalledAndHasInternalCall:return`${se(l.entity,l.entity.project)} has bad internal call`;case we.InternalCallDeclarationIsInvalidType:return`${se(l.entity,l.entity.project)} has declaration that is not an action`;case we.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${se(l.entity,l.entity.project)} has declaration that is not found in parent`;case we.InternalCallParentDeclarationEntityInvalidType:return`${se(l.entity,l.entity.project)} has invalid parent declaration type`;case we.InternalCallParentMissingDataType:return`${se(l.entity,l.entity.project)}'s parent has no data type`;case we.InternalCallDeclarationNotInParentDatatypeEntity:return`${se(l.entity,l.entity.project)} has declaration that is not in parent`;case we.UnreachableEntity:return`${se(l.entity,l.entity.project)} is unreachable`;case be.DisconnectedCallableEntity:return`${se(l.entity,l.entity.project)} is not executed by any entity`;case be.AbstractEntityImplements:return`${se(l.entity,l.entity.project)} implements a non-template entity`;case be.AbstractExtendingNonAbstractEntity:return`${se(l.entity,l.entity.project)} extends a non-template entity`;case be.InvalidPropertiesCombination:return`${se(l.entity,l.entity.project)} has invalid properties combination`;case be.ExtendingNonInteractiveEntity:return`${se(l.entity,l.entity.project)} extends a non-interactive entity`;case be.ExtendsIncompatibleEntities:return`${se(l.entity,l.entity.project)} extends incompatible entities`;case be.ImplementingNonAbstractEntity:return`${se(l.entity,l.entity.project)} implements a non-template entity`;case be.ImplementsIncompatibleEntities:return`${se(l.entity,l.entity.project)} implements incompatible entities`;case be.LackingReturnStatementOnSomeBranches:return`${se(l.entity,l.entity.project)} is missing termination on some branches`;case be.LastCalledEntityMustBeReturnEntity:return`${se(l.entity,l.entity.project)}'s last called entity must be a termination node`;case be.MissingRequiredValue:return`${se(l.entity,l.entity.project)} is missing a required value`;case be.NoPrimaryKeyProperty:return`${se(l.entity,l.entity.project)} has no primary key property`;case be.NonAbstractExtendingAbstractEntity:return`${se(l.entity,l.entity.project)} extends a template entity`;case be.NonStaticExtendingStaticEntity:return`${se(l.entity,l.entity.project)} extends a static entity`;case be.NonStaticImplementingStaticEntity:return`${se(l.entity,l.entity.project)} implements a static entity`;case be.StaticExtendingNonStaticEntity:return`${se(l.entity,l.entity.project)} extends a non-static entity`;case be.StaticImplementingNonStaticEntity:return`${se(l.entity,l.entity.project)} implements a non-static entity`;case be.VariableReadsValueAndInternalCall:return`${se(l.entity,l.entity.project)} reads a value and has internal call`;case be.VariableWritesValuesAndInternalCall:return`${se(l.entity,l.entity.project)} writes values and has internal call`;case we.EmptyName:return`${Wa[l.entity.type]} has no name`;case we.InvalidObjectStructure:return`${se(l.entity,l.entity.project)} has invalid structure`;case we.LoopBodyFunctionOverwrite:return`${se(l.entity,l.entity.project)}'s loop body action overwrites an action`;case we.MethodOverwritesBaseMethodWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites base action`;case we.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites another action with same implementation`;case we.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites another action with same implementation`;case we.MissingCaller:return`${se(l.entity,l.entity.project)} is missing a caller`;case we.NameAsResolvedCodeNameNotUniqueInScope:return`${se(l.entity,l.entity.project)} has a name not unique in the scope`;case we.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${se(l.entity,l.entity.project)} name can only contain letters, numbers, underscores and spaces`;case we.NameMustStartWithLetterOrUnderscore:return`${se(l.entity,l.entity.project)} name must start with letter or underscore`;case we.NoOverlapWithImplementedSignature:return`${se(l.entity,l.entity.project)} has no overlap with implemented signature`;case we.PropertyOverwritesBasePropertyWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites base property`;case we.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites another property with same implementation`;case we.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites another property with same implementation`;case we.ReaderWriterIncompatibleDataType:return`${se(l.entity,l.entity.project)} has reader/writer with incompatible data type`;case id.StatusCodeMustBeBetween100And599:return`${se(l.entity,l.entity.project)} HTTP status code must be between 100 and 599`;case id.StatusCodeMustBeNumber:return`${se(l.entity,l.entity.project)} HTTP status code must be a number`;case Ya.UUIDMustBeString:return`${se(l.entity,l.entity.project)} UUID must be a string`;case Ya.UUIDMustNotContainSpaces:return`${se(l.entity,l.entity.project)} UUID must not contain spaces`;case Ya.UUIDMustBeValidFormat:return`${se(l.entity,l.entity.project)} UUID must be in a valid format`;case ya.MustBeUniqueAmongSameEntities:return`${se(l.entity,l.entity.project)} value must be unique among the same kind`;case ya.StringValueMustNotHaveDashes:return`${se(l.entity,l.entity.project)} value must not contain dashes`;case ya.StringValueMustNotHaveSpaces:return`${se(l.entity,l.entity.project)} value must not contain spaces`;default:return`${se(l.entity,l.entity.project)} Error: ${lE(l.code)}`}}function IRi(l){var p,i,r,a;switch(l.code){case be.AbstractEntityWithNonAbstractMethods:return`${se(l.entity,l.entity.project)} has non-template actions`;case be.AbstractEntityWithNonAbstractProperties:return`${se(l.entity,l.entity.project)} has non-template properties`;case be.IncorrectEntityImplementation:return`${se(l.entity,l.entity.project)} incorrectly implements the template entity`;case be.IncorrectMethodImplementation:return`${se(l.entity,l.entity.project)} incorrectly implements the template action it's based on`;case be.IncorrectPropertyImplementation:return`${se(l.entity,l.entity.project)} incorrectly implements the template property it's based on`;case be.AbstractMethodInNonAbstractEntity:return`${se(l.entity,l.entity.project)} is a template action in a non-template entity`;case be.AbstractPropertyInNonAbstractEntity:return`${se(l.entity,l.entity.project)} is a template property in a non-template entity`;case we.MethodOverwritesOtherSiblingWithSameName:return`${se(l.entity,l.entity.project)} overwrites an action in the template entity`;case we.PropertyOverwritesOtherSiblingWithSameName:return`${se(l.entity,l.entity.project)} overwrites a property in the template entity`;case be.MissingMethodImplementation:return`${se(l.entity,l.entity.project)} is missing an action implementation from the template entity`;case be.MissingPropertyImplementation:return`${se(l.entity,l.entity.project)} is missing a property implementation from the template entity`;case we.NameNotUniqueInScope:return`${se(l.entity,l.entity.project)} has a duplicate name in the same scope`;case be.NoProperties:return`${se(l.entity,l.entity.project)} has no properties, so it doesn't do anything`;case be.NonStaticPropertyInStaticEntity:return`${se(l.entity,l.entity.project)} has a non-static property in a static entity`;case be.StaticEntityWithNonStaticProperties:return`${se(l.entity,l.entity.project)} has non-static properties in a static entity`;case be.ReadingFromIncompatibleType:return`${se(l.entity,l.entity.project)} reads data from a value of a different data type`;case be.WritingToIncompatibleType:return`${se(l.entity,l.entity.project)} writes data to a value of a different data type`;case be.ScopeWithoutLogic:return`${se(l.entity,l.entity.project)} has no logic`;case be.NonStaticPropertyImplementsStatic:return`${se(l.entity,l.entity.project)} has a static property in a non-static entity`;case be.PropertyImplementsIncompatibleType:return`${se(l.entity,l.entity.project)} implements a property of a different data type`;case be.PropertyImplementsNonAbstact:return`${se(l.entity,l.entity.project)} implements a non-template property`;case be.StaticPropertyImplementsNonStatic:return`${se(l.entity,l.entity.project)} has a static property in a non-static entity`;case be.VariableCallsOthersAndHasInternalCall:return`${se(l.entity,l.entity.project)} calls other entities while being used to execute internal logic`;case be.VariableHasInputsAndInternalCall:return`${se(l.entity,l.entity.project)} has inputs while being used to execute internal logic`;case be.VariableHasOutputsAndInternalCall:return`${se(l.entity,l.entity.project)} has outputs while being used to execute internal logic`;case be.VariableIsCalledAndHasInternalCall:return`${se(l.entity,l.entity.project)} is called while being used to execute internal logic`;case we.InternalCallDeclarationIsInvalidType:return`${se(l.entity,l.entity.project)} has a declaration that is not an action`;case we.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${se(l.entity,l.entity.project)} has a declaration that is not found in ${(p=l.entity.parent.getDataType(null))!=null&&p.entity?se((i=l.entity.parent.getDataType(null))==null?void 0:i.entity,l.entity.project):"the variable's data-type entity"}`;case we.InternalCallParentDeclarationEntityInvalidType:return`${se(l.entity,l.entity.project)} is part of a variable whos data-type entity can't have actions`;case we.InternalCallParentMissingDataType:return`${se(l.entity,l.entity.project)} is part of a variable with no data-type entity`;case we.InternalCallDeclarationNotInParentDatatypeEntity:return`${se(l.entity,l.entity.project)} has a declaration doesn't belong to ${(r=l.entity.parent.getDataType(null))!=null&&r.entity?se((a=l.entity.parent.getDataType(null))==null?void 0:a.entity,l.entity.project):"the variable's data-type entity"}`;case we.UnreachableEntity:return`${se(l.entity,l.entity.project)} is unreachable`;case be.DisconnectedCallableEntity:return`${se(l.entity,l.entity.project)} is disconnected and won't be executed by anything after publishing`;case be.AbstractEntityImplements:return`${se(l.entity,l.entity.project)} implements a non-template entity`;case be.AbstractExtendingNonAbstractEntity:return`${se(l.entity,l.entity.project)} extends a non-template entity`;case be.InvalidPropertiesCombination:return`${se(l.entity,l.entity.project)} has an invalid combination of properties`;case be.ExtendingNonInteractiveEntity:return`${se(l.entity,l.entity.project)} extends a non-interactive entity`;case be.ExtendsIncompatibleEntities:return`${se(l.entity,l.entity.project)} extends incompatible entities`;case be.ImplementingNonAbstractEntity:return`${se(l.entity,l.entity.project)} implements a non-template entity`;case be.ImplementsIncompatibleEntities:return`${se(l.entity,l.entity.project)} implements incompatible entities`;case be.LackingReturnStatementOnSomeBranches:return`${se(l.entity,l.entity.project)} has branches that don't terminate`;case be.LastCalledEntityMustBeReturnEntity:return`${se(l.entity,l.entity.project)} must end with a termination node`;case be.MissingRequiredValue:return`${se(l.entity,l.entity.project)} is missing a required value`;case be.NoPrimaryKeyProperty:return`${se(l.entity,l.entity.project)} has no primary key property`;case be.NonAbstractExtendingAbstractEntity:return`${se(l.entity,l.entity.project)} is a non-template entity extending a template entity`;case be.NonStaticExtendingStaticEntity:return`${se(l.entity,l.entity.project)} is a non-static entity extending a static entity`;case be.NonStaticImplementingStaticEntity:return`${se(l.entity,l.entity.project)} is a non-static entity implementing a static entity`;case be.StaticExtendingNonStaticEntity:return`${se(l.entity,l.entity.project)} is a static entity extending a non-static entity`;case be.StaticImplementingNonStaticEntity:return`${se(l.entity,l.entity.project)} is a static entity implementing a non-static entity`;case be.VariableReadsValueAndInternalCall:return`${se(l.entity,l.entity.project)} reads a value and has an internal call`;case be.VariableWritesValuesAndInternalCall:return`${se(l.entity,l.entity.project)} writes values and has an internal call`;case we.EmptyName:return`${Wa[l.entity.type]} has no name`;case we.InvalidObjectStructure:return`${se(l.entity,l.entity.project)} has an invalid structure`;case we.LoopBodyFunctionOverwrite:return`${se(l.entity,l.entity.project)}'s loop body action overwrites`;case we.MethodOverwritesBaseMethodWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites a base action with same implementation`;case we.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites another action with same implementation`;case we.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites another action with same implementation`;case we.MissingCaller:return`${se(l.entity,l.entity.project)} is missing a caller`;case we.NameAsResolvedCodeNameNotUniqueInScope:return`${se(l.entity,l.entity.project)} has a name that is not unique in the scope`;case we.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${se(l.entity,l.entity.project)} name can only contain letters, numbers, underscores and spaces`;case we.NameMustStartWithLetterOrUnderscore:return`${se(l.entity,l.entity.project)} name must start with letter or underscore`;case we.NoOverlapWithImplementedSignature:return`${se(l.entity,l.entity.project)} has no overlap with implemented signature`;case we.PropertyOverwritesBasePropertyWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites a base property with same implementation`;case we.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites another property with same implementation`;case we.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites another property with same implementation`;case we.ReaderWriterIncompatibleDataType:return`${se(l.entity,l.entity.project)} has a reader/writer with incompatible data type`;case id.StatusCodeMustBeBetween100And599:return`${se(l.entity,l.entity.project)} HTTP status code must be between 100 and 599`;case id.StatusCodeMustBeNumber:return`${se(l.entity,l.entity.project)} HTTP status code must be a number, between 100 and 599`;case Ya.UUIDMustBeString:return`${se(l.entity,l.entity.project)} UUID must be a string, eg: "${np()}"`;case Ya.UUIDMustNotContainSpaces:return`${se(l.entity,l.entity.project)} UUID must not contain spaces, eg: "${np()}"`;case Ya.UUIDMustBeValidFormat:return`${se(l.entity,l.entity.project)} UUID must be in a valid format. Eg: "${np()}"`;case ya.MustBeUniqueAmongSameEntities:return`${se(l.entity,l.entity.project)} value must be unique among the same kind`;case ya.StringValueMustNotHaveDashes:return`${se(l.entity,l.entity.project)} value must not contain dashes`;case ya.StringValueMustNotHaveSpaces:return`${se(l.entity,l.entity.project)} value must not contain spaces`;default:return`${se(l.entity,l.entity.project)} Error: ${lE(l.code)}`}}function Xx(l){const p=(l||"").startsWith("error-caller-only--");switch(p?l.replace("error-caller-only--",""):l){case ai.CallIsInHigherScope:return"In a higher scope";case ai.CallIsInLowerScope:return"In a lower scope";case ai.CallerIsInHigherScope:return"Caller is in a higher scope";case ai.CallerIsInLowerScope:return"Caller is in a lower scope";case ai.CannotBeCalledByChildren:return"Cannot be called by children";case ai.CannotCallAncestor:return"Cannot call ancestor";case ai.CannotConnectToItself:return"Cannot connect to itself";case ai.CannotReadMoreThanOneValue:return"Cannot read more than one value";case ai.CannotReadValueFromChildren:return"Cannot read value from entities executed after itself";case ai.CannotWriteValueToAncestor:return"Cannot write value to ancestor";case zT.Suggestion:return"Suggestion";case ai.ContinueOrBreakStatementCalledFromOutsideLoop:return"Cannot be called from outside loop";case ai.DataTypesNotCompatible:return"Data types not compatible";case ai.ElementInLoopBodyCallingOutsideLoop:return"Cannot call outside loop";case ai.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees:return"Error cannot be connected to success branch";case ai.ExecutionsAlreadyConnected:return"Executions already connected";case ai.IsNotValueReadingEntity:return"Is not a value reading entity";case ai.IsNotValueWrittingEntity:return"Is not a value writting entity";case ai.NotInScope:return"Not in a compatible scope";case ai.OtherIncompatibleScopeReason:return"Incompatible scope";case ai.SiblingInternalCallAlreadyUsedInParentVariable:return"Internal call already used in parent variable";case ai.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees:return"Success cannot be connected to error branch";case ai.ValuesAlreadyConnected:return"Values already connected";case ai.CannotInteractWithInputInVariableWithInternalCalls:return"Cannot interact with input in variable with internal calls";case ai.CannotInteractWithOutputInVariableWithInternalCalls:return"Cannot interact with output in variable with internal calls";case zT.CanvasGloballyDisabled:return"Canvas is globally disabled";case ai.PropertyIsConstantItsValueCantBeReset:return"Property is constant, its value can't be reset";case ai.CannotWriteValueOfGlobalVariableDeclaration:return"Cannot write value of global variable declaration";case ai.CannotReSetValueOfConstantVariable:return"Cannot re-set value of constant variable";case ai.CannotConnectToOwnNode:return"It is part of the same node";case ai.CalledByErrorMustBePassThroughCallable:return"Called by error must be pass-through callable";case ai.CannotChangeScopeBecauseItCallsOtherEntities:return"Cannot change scope because it calls other entities in its current scope";case ai.CannotChangeScopeBecauseItIsCalledByOtherEntities:return"Cannot change scope because it is called by other entities in its current scope";case ai.VariableDeclarationCannotBeMovedToLowerScopeBecauseInstancesUsage:return"Variable declaration cannot be moved to lower scope because its instances are used in the current or different incompatible lower scope";case ai.CalledBySourceMustBeCallerEntity:return"Not a caller type";case ai.CalledByErrorCannotBeConnectedToEntitiesCalledByOwnSuccessBranch:return"Already connected to the success branch from a common origin caller";case ai.CalledBySuccessCannotBeConnectedToEntitiesCalledByOwnErrorBranch:return"Already connected to the error branch from a common origin caller";case ai.RedundantCall:return"Redundant call. Already connected further down the execution path";case ai.CannotBeCalledBeforeDeclaration:return"Cannot be called before declaration";case ai.CannotBeCalledInParallelBranchToDeclaration:return"Cannot be called in parallel branch to declaration";case ai.CannotBeHigherScopeThanDeclaration:return"Cannot be in a higher scope than declaration";case ai.CannotCallGlobalVariableDeclaration:return"Cannot call global variable declaration";case ai.EntityAlreadyCalledBySuccessCannotBeConnectedToUnrelatedErrorBranch:return p?"Cannot connect error: Already connected to a success branch from a common origin caller":"Already connected to a success branch from a common origin caller";default:return Lf(l||"")}}function RRi(l,p){const i=[...l,...p],r=Array.from(new Set(i));return{hasChanged:r.length!==l.length,reasons:r}}function DRi(l,p){const i=l.filter(a=>!p.includes(a));return{hasChanged:i.length!==l.length,reasons:i}}function wRi(l,p){return l.find(i=>i.entity.id===p)||null}function jU(l){return l.filter((p,i)=>l.indexOf(p)===i)}class En{constructor(p,i,r=null,a){R(this,"ids",[]);R(this,"entity");R(this,"entityCardHeight");R(this,"entityCardWidth");R(this,"index");R(this,"childEntities",[]);R(this,"children",[]);R(this,"parents",[]);R(this,"calculationEntryPoint");R(this,"_onlyEntities",null);R(this,"_changeSet",null);if(this.index=i,this.entity=p,this.calculationEntryPoint=r||this,this._changeSet=a||null,this===this.calculationEntryPoint&&!a)throw new Error("Change-set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(p,i,r){const a=LBe-Eg-Wx,c=BBe-HA-zx;p.type===d.Project?(p.x=a,p.y=c):p.metaSync({x:p.x||a,y:p.y||c},i);const e=new En(p,0,null,i);e.calculationEntryPoint=e,e._onlyEntities=r||[],e.ids=["0"];const f=[];e.next(m=>{f.push(...m)}),En.recursivelyAssembleChildrenAreas(f),e.resolveChildrenOverlaps();const h=e.flattenChildEntities();return e._onlyEntities?h.filter(m=>{var E;return(E=e._onlyEntities)==null?void 0:E.includes(m)}):h}static recursivelyAssembleChildrenAreas(p){const i=[];p.forEach(r=>{r.next(a=>{i.push(...a)})}),i.length>0&&En.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities||[]}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(p){this.calculationEntryPoint._changeSet=p}findAreaInChildrenFromEntity(p){if(this.entity===p)return this;const i=this.children.find(a=>a.entity===p);return i||this.children.reduce((a,c)=>a||c.findAreaInChildrenFromEntity(p),null)}findAreaFromEntity(p){if(this.entity===p)return this;const i=this.calculationEntryPoint.children,r=i.find(c=>c.entity===p);return r||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(p),null)}addParent(p){if(!this.parents.includes(p)){const i=En.resolveIds(p,this.index);this.ids.push(...i),this.parents.push(p)}}static resolveIds(p,i){return p?p.ids.map(r=>`${r}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const p=kl(this.entity,!0);if(this.entity.type===d.Project){const i=[],r=[],a=[];p.forEach(e=>{if(d.DefinitionEntity===e.type){r.push(e);return}else if(Ft.includes(e.type)){a.push(e);return}i.push(e)});const c=i.sort((e,f)=>{const h=!!Ng(e,f).length,m=kl(e),E=kl(f);return h?0:m.length&&!E.length?-1:!m.length&&E.length?1:0}).filter(e=>!Ac(e).length);this.childEntities=[...r,...a,...c]}else{const i=[],r=[],a=[],c=[],e=[];hr.includes(this.entity.type)&&K1(this.entity).forEach(m=>{if(_t.includes(m.type)){a.push(m);return}const E=ht(m);i.push(E)}),vr.includes(this.entity.type)&&r.push(...this.entity.detachedChildren);const f=p.filter(h=>{const m=i.includes(h);return m||a.includes(h)||r.includes(h)?!1:_t.includes(h.type)?(a.push(h),!1):Pr.includes(h.type)&&!m?(c.push(h),!1):h.type===d.DefinitionEntity?(e.push(h),!1):!0});i.sort((h,m)=>Ml(h,m)?-1:0),c.sort((h,m)=>Ml(h,m)?-1:0),a.sort((h,m)=>W_(h,m)?1:W_(m,h)?-1:0),this.childEntities=[...e,...i,...c,...f,...a,...r]}}calculateCardSize(){const p=MBe(this.entity);this.entityCardWidth=p.width,this.entityCardHeight=p.height}static getBoundriesOfTwoAreas(p,i){return{top:Math.min(p.top,i.top),left:Math.min(p.left,i.left),bottom:Math.max(p.bottom,i.bottom),right:Math.max(p.right,i.right)}}static getBoundriedOfCombinedAreas(p,i){const r=p.filter(c=>!i.includes(c));return r.reduce((c,e)=>i.includes(e)?c:En.getBoundriesOfTwoAreas(c,e.fullBranchArea),r[0].fullBranchArea)}getFullAreaUntilAny(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!p.includes(e)).map(e=>e.getFullAreaUntilAny(p)).reduce((e,f)=>En.getBoundriesOfTwoAreas(e,f),i)}getFullAreaUntilAreaOrAnyChildren(p){const i=[p,...p.flattenChildren()],r=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(p)).reduce((e,f)=>En.getBoundriesOfTwoAreas(e,f),r)}getFullAreaUntil(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==p).map(c=>c.getFullAreaUntil(p)).reduce((c,e)=>En.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const p=this.ownEntityPlusBufferArea;return this.children.map(a=>a.fullBranchArea).reduce((a,c)=>En.getBoundriesOfTwoAreas(a,c),p)}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 p=this.ownEntityArea;return{top:p.top,left:p.left,bottom:p.bottom+HA,right:p.right+Eg}}static filterOutRepeatedAreas(p){return p.filter((i,r)=>p.indexOf(i)===r)}getEarliestId(p,i){const r=p.split("-"),a=i.split("-");return r.length<a.length?p:r.length>a.length?i:r.reduce((e,f,h)=>f<a[h]?p:i,p)}getEarliestLevel(){return this.ids.reduce((r,a)=>this.getEarliestId(r,a),this.ids[0]).split("-").length}countColumns(){let p=0;if(this!==this.calculationEntryPoint)p++;else return p;if(!this.parents.length)return p;const r=this.parents.reduce((a,c)=>c.getEarliestLevel()>a.getEarliestLevel()?c:a,this.parents[0]).countColumns();return p+=r,p}getLatestId(p,i){if(p===i)return p;const r=p.split("-"),a=i.split("-");return r.length<a.length?i:r.length>a.length?p:r.reduce((e,f,h)=>f>a[h]?p:i,p)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((r,a)=>this.getLatestId(r,a),this.ids[0]).split("-").length}smoothPosition(){const p=this.flattenSiblings();if(!p.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(r=>{r!==this.calculationEntryPoint&&r.shiftDownAlone(i)})}else if([...Ft].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=p.filter(r=>!this.parents.includes(r));i.length?i.every(a=>{const c=this.countColumns(),e=a.countColumns();return c>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(p,i){if(p.includes(this))return p;this.move(this.entity,{y:this.entity.y+i});let r=[...p,this];return this.children.forEach(a=>{if(En.getEarliestParentInChain(a)!==this)return;const e=wRi(r,a.entity.id);r=En.filterOutRepeatedAreas([...r]),e||(r=r.filter(h=>h!==a));const f=a.shiftDownUntilAny(r,i);r.push(...f)}),r}shiftRightUntilAny(p,i){p.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(r=>{const a=En.filterOutRepeatedAreas([...this.flattenSiblings(),...p]);En.getEarliestParentInChain(r)===this&&r.shiftRightUntilAny(a,i)}))}shiftRight(p){this.move(this.entity,{x:this.entity.x+p}),this.children.forEach(i=>{const a=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(a,p)})}shiftDownAlone(p){this.move(this.entity,{y:this.entity.y+p})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const p=this.parents.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+zy,h={top:f,left:e.left,bottom:f,right:e.right};return En.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(p.bottom-p.top)/2-zy;this.shiftDownAlone(r)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const p=this.children.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+zy,h={top:f,left:e.left,bottom:f,right:e.right};return En.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(p.bottom-p.top)/2-zy;return this.shiftDownAlone(r),r}resolveChildrenOverlaps(){const p=this.flattenChildren();let i=[];p.forEach(r=>{const a=r.adjustVerticallyToAvoidOverlaps();i.push(...a)}),p.forEach(r=>{r.smoothPosition()})}static getEarliestParentInChain(p){let i=p.parents[0];return p.parents.length&&(i=p.parents.sort((r,a)=>{if(!r.ids.length)return-1;if(!a.ids.length)return 1;const c=r.ids.sort((f,h)=>f.length<h.length?-1:0),e=a.ids.sort((f,h)=>f.length<h.length?-1:0);return c[0].length-e[0].length})[0]),i}flattenEarlierSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((r,a)=>{if(p.has(a.entity.id))return r;p.add(a.entity.id);const e=a.children.slice(0,a.children.indexOf(this)).reduce((f,h)=>[...f,h,...h.flattenChildren(p)],[]);return[...r,...e]},[])}flattenSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((r,a)=>{if(p.has(a.entity.id))return r;p.add(a.entity.id);const e=a.children.filter(f=>f!==this).reduce((f,h)=>[...f,h,...h.flattenChildren(p)],[]);return[...r,...e]},[])}flattenChildren(p=new Set){return this.children.reduce((i,r)=>p.has(r.entity.id)?i:(p.add(r.entity.id),[...i,r,...r.flattenChildren(p)]),[])}flattenParents(p=new Set){return this.parents.reduce((r,a)=>p.has(a.entity.id)?r:(p.add(a.entity.id),[...r,a,...a.flattenParents(p)]),[])}getAreaIfRendered(p){return this.calculationEntryPoint.flattenChildren().find(a=>a.entity.id===p.id)||null}getLowerSiblings(){const p=this.parents.reduce((i,r)=>{const a=r.children.indexOf(this),c=r.children.slice(a+1);return[...i,...c]},[]);return jU(p)}getLowerAreas(){const p=this.getLowerSiblings(),i=this.parents.reduce((r,a)=>[...r,...a.getLowerAreas()],[]);return jU([...p,...i])}adjustVerticallyToAvoidOverlaps(p=[]){const r=En.getEarliestParentInChain(this).children[this.index-1];if(!r)return p;const a=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...a,...c,r],m=C(e.flatMap(_=>Ng(this.entity,_.entity))).filter(_=>_.id!==this.entity.id).map(_=>this.findAreaFromEntity(_)).filter(_=>!!_),E=this.getFullAreaUntilAny(m),b=r.getFullAreaUntilAny(m),g=e.reduce((_,$)=>$===this||$.fullBranchArea.left!==E.left?_:Math.max(_,$.fullBranchArea.bottom),b.bottom);if(E.top<g){const _=g-E.top+HA;return this.shiftDownUntilAny(p,_)}return p}move(p,i){this.onlyEntities.includes(p)&&p.metaSync(i,this.changeSet)}addChild(p){const i=this.childEntities[p];let r=null;i.x&&i.y?r=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),r||(r=new En(i,p,this.calculationEntryPoint));const a=this.ownEntityPlusBufferArea;this.children.includes(r)||(this.children.push(r),r.addParent(this));const c=r.fullBranchArea;if(c.left<a.right){const e=a.right-c.left;r.shiftRight(e)}return r}flattenChildEntities(p=new Set){return this.children.reduce((i,r)=>p.has(r.entity.id)?i:(p.add(r.entity.id),[...i,r.entity,...r.flattenChildEntities(p)]),[])}next(p){const i=[];this.childEntities.forEach((r,a)=>{const c=this.addChild(a);c&&i.push(c)}),p(i)}}async function CRi(l,p,i={}){var f;const r=z.YieldTracker.from(i),a=[],c=[];for(const h of l.instancesList){if(!cf.includes(h.type)||((f=ht(h))==null?void 0:f.id)!==h.id)continue;let m=Zt(h,l);if(!m){console.log("No top scope owner for instance: ",h," in project: ",l);continue}if(!(Ft.includes(m.type)&&m.collapsed&&m.id!==h.id)){for(;m.parent&&m.parent!==l;)m=m.parent,Ft.includes(m.type)&&m.collapsed&&(m.id,h.id);i.forceAll?(h.x=0,h.y=0,c.push(h)):!h.x||!h.y?c.push(h):a.push(h),await r.tick()}}console.log("Layout generation - calculating positions for entities without coordinates... FORCE: ",i.forceAll||!1),console.log(`
|
|
54
|
+
`+c):r.stack=c}catch{}}throw r}}_request(p,i){typeof p=="string"?(i=i||{},i.url=p):i=p||{},i=of(this.defaults,i);const{transitional:r,paramsSerializer:a,headers:c}=i;r!==void 0&&SA.assertOptions(r,{silentJSONParsing:jo.transitional(jo.boolean),forcedJSONParsing:jo.transitional(jo.boolean),clarifyTimeoutError:jo.transitional(jo.boolean)},!1),a!=null&&(qe.isFunction(a)?i.paramsSerializer={serialize:a}:SA.assertOptions(a,{encode:jo.function,serialize:jo.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),SA.assertOptions(i,{baseUrl:jo.spelling("baseURL"),withXsrfToken:jo.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=c&&qe.merge(c.common,c[i.method]);c&&qe.forEach(["delete","get","head","post","put","patch","common"],$=>{delete c[$]}),i.headers=Gl.concat(e,c);const f=[];let h=!0;this.interceptors.request.forEach(function(L){typeof L.runWhen=="function"&&L.runWhen(i)===!1||(h=h&&L.synchronous,f.unshift(L.fulfilled,L.rejected))});const m=[];this.interceptors.response.forEach(function(L){m.push(L.fulfilled,L.rejected)});let E,b=0,g;if(!h){const $=[BU.bind(this),void 0];for($.unshift(...f),$.push(...m),g=$.length,E=Promise.resolve(i);b<g;)E=E.then($[b++],$[b++]);return E}g=f.length;let _=i;for(;b<g;){const $=f[b++],L=f[b++];try{_=$(_)}catch(j){L.call(this,j);break}}try{E=BU.call(this,_)}catch($){return Promise.reject($)}for(b=0,g=m.length;b<g;)E=E.then(m[b++],m[b++]);return E}getUri(p){p=of(this.defaults,p);const i=u2e(p.baseURL,p.url,p.allowAbsoluteUrls);return a2e(i,p.params,p.paramsSerializer)}}qe.forEach(["delete","get","head","options"],function(p){hg.prototype[p]=function(i,r){return this.request(of(r||{},{method:p,url:i,data:(r||{}).data}))}});qe.forEach(["post","put","patch"],function(p){function i(r){return function(c,e,f){return this.request(of(f||{},{method:p,headers:r?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}hg.prototype[p]=i(),hg.prototype[p+"Form"]=i(!0)});const qA=hg;class Ux{constructor(p){if(typeof p!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(c){i=c});const r=this;this.promise.then(a=>{if(!r._listeners)return;let c=r._listeners.length;for(;c-- >0;)r._listeners[c](a);r._listeners=null}),this.promise.then=a=>{let c;const e=new Promise(f=>{r.subscribe(f),c=f}).then(a);return e.cancel=function(){r.unsubscribe(c)},e},p(function(c,e,f){r.reason||(r.reason=new gm(c,e,f),i(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(p){if(this.reason){p(this.reason);return}this._listeners?this._listeners.push(p):this._listeners=[p]}unsubscribe(p){if(!this._listeners)return;const i=this._listeners.indexOf(p);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const p=new AbortController,i=r=>{p.abort(r)};return this.subscribe(i),p.signal.unsubscribe=()=>this.unsubscribe(i),p.signal}static source(){let p;return{token:new Ux(function(a){p=a}),cancel:p}}}const sRi=Ux;function lRi(l){return function(i){return l.apply(null,i)}}function oRi(l){return qe.isObject(l)&&l.isAxiosError===!0}const b_={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(b_).forEach(([l,p])=>{b_[p]=l});const dRi=b_;function h2e(l){const p=new qA(l),i=HLe(qA.prototype.request,p);return qe.extend(i,qA.prototype,p,{allOwnKeys:!0}),qe.extend(i,p,null,{allOwnKeys:!0}),i.create=function(a){return h2e(of(l,a))},i}const Nn=h2e(Gx);Nn.Axios=qA;Nn.CanceledError=gm;Nn.CancelToken=sRi;Nn.isCancel=o2e;Nn.VERSION=y2e;Nn.toFormData=r1;Nn.AxiosError=fi;Nn.Cancel=Nn.CanceledError;Nn.all=function(p){return Promise.all(p)};Nn.spread=lRi;Nn.isAxiosError=oRi;Nn.mergeConfig=of;Nn.AxiosHeaders=Gl;Nn.formToJSON=l=>l2e(qe.isHTMLForm(l)?new FormData(l):l);Nn.getAdapter=f2e.getAdapter;Nn.HttpStatusCode=dRi;Nn.default=Nn;const uRi=Nn;class m2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(na.HttpRequest);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[3]||{},e={method:a[0],url:a[1],params:a[2],headers:c,data:a[4]};z.Logger.log("Axios request config: ",e);const f=await uRi(e);return{value:U.Success,error:null,result:{status:f.status,headers:f.headers,data:f.data}}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class T2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(xe.Validate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)});z.Logger.log("Inputs for entity validation: ",a);const e=Y1(a[1]).safeParse(a[0]);return e.success?{value:U.Success,error:null,result:{data:a[0]}}:{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:e.error.errors,result:null}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}const Ba=l=>l.map(p=>{var i,r;return((i=p.value)==null?void 0:i.valueAsType)??((r=p.value)==null?void 0:r.value)});class v2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY,version:"1.0.0",description:"Entity read-key operation implementation module (top-level)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(xe.ReadKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ba(r),e=F_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class E2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY,version:"1.0.0",description:"Entity write-key operation implementation module (top-level, immutable)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(xe.WriteKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ba(r),f=K_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class b2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY,version:"1.0.0",description:"Entity delete-key operation implementation module (top-level, immutable)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(xe.DeleteKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ba(r),e=S_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class A2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY,version:"1.0.0",description:"Entity read-nested-key operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(xe.ReadNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ba(r),f=q_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class g2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY,version:"1.0.0",description:"Entity write-nested-key operation implementation module (immutable, no auto-create)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(xe.WriteNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ba(r),f=Z_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class I2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY,version:"1.0.0",description:"Entity write-safe-nested-key-recursively operation implementation module (immutable, auto-create)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(xe.WriteSafeNestedKeyRecursively);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ba(r),f=H_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class R2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY,version:"1.0.0",description:"Entity delete-nested-key operation implementation module (immutable)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(xe.DeleteNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ba(r),e=W_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class D2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY,version:"1.0.0",description:"Object has-key (top-level property present?)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(xe.HasKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ba(r),e=z_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class w2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object key-value-equals (top-level property strict equality)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(xe.KeyValueEquals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Ba(r),f=Y_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class C2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY,version:"1.0.0",description:"Object has-nested-key (path present?)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(xe.HasNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ba(r),e=J_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class O2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object nested-key-value-equals (path strict equality)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(xe.NestedKeyValueEquals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Ba(r),f=X_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class _2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE,version:"1.0.0",description:"Object is-instance-of-type (DefinitionEntity-based runtime check)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(xe.IsInstanceOfType);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m,E,b,g,_;try{const $=((c=(a=r[0])==null?void 0:a.value)==null?void 0:c.parent)||((f=(e=r[0])==null?void 0:e.value)==null?void 0:f.standaloneParent),L=(m=(h=r[0])==null?void 0:h.value)==null?void 0:m.value,j=(b=(E=r[1])==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle;if(!L)throw new TypeError("IsInstanceOfType expects a non-null input value.");if(!j)throw new TypeError("IsInstanceOfType expects a valid expectedType input.");if(!$)throw new TypeError("IsInstanceOfType cannot determine the value owner.");if(j.type!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType expects expectedType to be a DefinitionEntity.");const k=$.getDataType(null);if(((g=k==null?void 0:k.entity)==null?void 0:g.type)!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType cannot determine the data type of the input value.");let G=!1;return((_=k==null?void 0:k.entity)==null?void 0:_.id)!==(j==null?void 0:j.id)?G=!1:Y1(k==null?void 0:k.entity).safeParse(L).success?G=!0:G=!1,{value:U.Success,error:null,result:G}}catch($){return{value:U.UnhandledError,error:$,result:null}}}})}}class V2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE,version:"1.0.0",description:"Object merge operation implementation module (immutable, shallow merge with right-precedence)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic);if(!r)return;const a=r.get(xe.Merge);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Ba(r),c=Q_e(...a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class P2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS,version:"1.0.0",description:"Object keys operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic);if(!r)return;const a=r.get(xe.Keys);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ba(r),c=eVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class N2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES,version:"1.0.0",description:"Object values operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic);if(!r)return;const a=r.get(xe.Values);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ba(r),c=tVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class x2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES,version:"1.0.0",description:"Object entries operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic);if(!r)return;const a=r.get(xe.Entries);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ba(r),c=iVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}let As=null;try{As=require("crypto")}catch{}const DT=typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto:As&&As.webcrypto?As.webcrypto:null,ap=DT?DT.subtle:null;function jT(l){const p=new ArrayBuffer(l.byteLength);return new Uint8Array(p).set(l),p}function rn(l,p="utf8"){if(l instanceof Uint8Array)return l;const i=String(l);if(p==="utf8"){if(typeof TextEncoder<"u")return new TextEncoder().encode(i);if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"utf8"))}else if(p==="hex"){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"hex"))}else if(p==="base64"){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"base64"))}else if(p==="base64url"){const r=i.replace(/-/g,"+").replace(/_/g,"/").replace(/=+$/,"");if(typeof Buffer<"u")return new Uint8Array(Buffer.from(r,"base64"));const a=typeof atob=="function"?atob(r):"",c=new Uint8Array(a.length);for(let e=0;e<a.length;e++)c[e]=a.charCodeAt(e);return c}throw new Error(`Unsupported environment/encoding combo for toBytes(${p})`)}function bo(l,p="utf8"){if(p==="utf8"){if(typeof TextDecoder<"u")return new TextDecoder().decode(l);if(typeof Buffer<"u")return Buffer.from(l).toString("utf8")}else if(p==="hex"){if(typeof Buffer<"u")return Buffer.from(l).toString("hex")}else if(p==="base64"){if(typeof Buffer<"u")return Buffer.from(l).toString("base64")}else if(p==="base64url"&&typeof Buffer<"u")return Buffer.from(l).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");throw new Error(`Unsupported environment/encoding combo for fromBytes(${p})`)}const $2e=l=>rn(l,"base64"),L2e=(l,p)=>{const i=l instanceof Uint8Array?l:rn(String(l),p||"utf8");return bo(i,"base64")},dh=(l,p)=>{const i=l instanceof Uint8Array?l:rn(String(l),p||"utf8");return bo(i,"base64url")},df=l=>rn(l,"base64url"),B2e=(l,p)=>{const i=l instanceof Uint8Array?l:rn(String(l),p||"utf8");return bo(i,"hex")},M2e=l=>rn(l,"hex");function kx(l){if(DT&&DT.getRandomValues){const p=new Uint8Array(l);return DT.getRandomValues(p),p}if(As&&As.randomBytes)return new Uint8Array(As.randomBytes(l));throw new Error("Secure random not available")}function s1(l,p){if(!(l instanceof Uint8Array)||!(p instanceof Uint8Array)||l.length!==p.length)return!1;let i=0;for(let r=0;r<l.length;r++)i|=l[r]^p[r];return i===0}function G2e(l,p,i,r){if((typeof l!="string"||typeof p!="string")&&typeof l!="string"&&typeof p!="string")throw new Error("Invalid input types");const a=i??"utf8",c=r??"utf8",e=rn(l??"",a),f=rn(p??"",c);return s1(e,f)}async function j2e(l,p){if(ap){const i=await ap.digest({name:l},jT(p));return new Uint8Array(i)}if(As){const i=l.replace("SHA-","sha"),r=As.createHash(i);return r.update(Buffer.from(p)),new Uint8Array(r.digest())}throw new Error("Hash not available")}async function U2e(l,p,i,r){if(typeof p!="string")throw new Error("Invalid input type for data; expected string");const a=String(l??"SHA-256"),c=i??"utf8",e=r??"base64url",f=rn(p??"",c),h=await j2e(a,f);return bo(h,e)}async function l1(l,p,i){if(ap){const r=await ap.importKey("raw",jT(p),{name:"HMAC",hash:{name:l}},!1,["sign"]),a=await ap.sign("HMAC",r,jT(i));return new Uint8Array(a)}if(As){const r=`sha${l.split("-")[1]}`,a=As.createHmac(r,Buffer.from(p));return a.update(Buffer.from(i)),new Uint8Array(a.digest())}throw new Error("HMAC not available")}async function k2e(l,p,i,r,a,c){if(typeof l!="string"||typeof p!="string")throw new Error("Invalid input types for key or data; expected strings");const e=String(i??"SHA-256"),f=r??"utf8",h=a??"utf8",m=c??"base64url",E=rn(l??"",f),b=rn(p??"",h),g=await l1(e,E,b);return bo(g,m)}async function o1(l,p,{iterations:i,length:r,hashAlg:a="SHA-256"}){if(ap){const c=await ap.importKey("raw",jT(l),"PBKDF2",!1,["deriveBits"]),e=await ap.deriveBits({name:"PBKDF2",salt:jT(p),iterations:i,hash:a},c,r*8);return new Uint8Array(e)}if(As){const c=a==="SHA-512"?"sha512":"sha256";return await new Promise((e,f)=>{As.pbkdf2(Buffer.from(l),Buffer.from(p),i,r,c,(h,m)=>{h?f(h):e(new Uint8Array(m))})})}throw new Error("PBKDF2 not available")}async function F2e(l,p,i,r,a,c,e,f){if(typeof l!="string"||typeof p!="string")throw new Error("Invalid input types for password or salt; expected strings");const h=c??"utf8",m=e??"utf8",E=f??"base64url",b=Math.max(1,Number(i)||21e4),g=Math.max(1,Number(r)||32),_=a??"SHA-256",$=rn(l??"",h),L=rn(p??"",m),j=await o1($,L,{iterations:b,length:g,hashAlg:_});return bo(j,E)}async function K2e(l,p=kx(16),i=21e4,r=32,a="SHA-256"){const c=rn(l,"utf8"),e=await o1(c,p,{iterations:i,length:r,hashAlg:a}),f=dh(p),h=dh(e);return`pbkdf2$${a.toLowerCase()}$${i}$${f}$${h}`}async function S2e(l,p){const i=String(p).split("$");if(i.length!==5||i[0]!=="pbkdf2")return!1;const r=i[1].toLowerCase(),a=parseInt(i[2],10),c=df(i[3]),e=df(i[4]),f=r.includes("512")?"SHA-512":"SHA-256",h=await o1(rn(l,"utf8"),c,{iterations:a,length:e.length,hashAlg:f});return s1(h,e)}async function q2e(l,p,i,r,a,c){const e=p!=null?Math.max(1,Number(p)||0):void 0,f=i!=null?Math.max(1,Number(i)||0):void 0,h=r??void 0,m=c??"base64url",E=a!=null?rn(a,m):void 0;return await K2e(String(l??""),E,e,f,h)}function GU(l){return dh(rn(JSON.stringify(l),"utf8"))}function mg(l){try{return JSON.parse(bo(df(l),"utf8"))}catch{return null}}async function Z2e(l,p,{alg:i="HS256",includeIat:r=!0,expiresInSeconds:a,notBeforeSeconds:c,issuer:e,subject:f,audience:h,jwtid:m,header:E={}}={}){const b={alg:i,typ:"JWT",...E},g=Math.floor(Date.now()/1e3),_={...l||{}};r&&(_.iat=g),typeof a=="number"&&(_.exp=g+a),typeof c=="number"&&(_.nbf=g+c),e&&(_.iss=e),f&&(_.sub=f),h&&(_.aud=h),m&&(_.jti=m);const $=GU(b),L=GU(_),j=rn(`${$}.${L}`,"utf8"),G=await l1(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,j),H=dh(G);return`${$}.${L}.${H}`}async function H2e(l,p,i,r,a,c,e,f,h,m,E,b){if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(l!=null&&typeof l!="object")throw new Error("Invalid input type for payload; expected object");if(E!=null&&typeof E!="object")throw new Error("Invalid input type for header; expected object");if(m!=null&&typeof m!="string")throw new Error("Invalid input type for jwtid; expected string");if(e!=null&&typeof e!="string")throw new Error("Invalid input type for issuer; expected string");if(f!=null&&typeof f!="string")throw new Error("Invalid input type for subject; expected string");if(h!=null&&typeof h!="string"&&!Array.isArray(h))throw new Error("Invalid input type for audience; expected string or string[]");const _=rn(p??"",b??"utf8");return await Z2e(l??{},_,{alg:i??"HS256",includeIat:r==null?!0:!!r,expiresInSeconds:a!=null?Number(a):void 0,notBeforeSeconds:c!=null?Number(c):void 0,issuer:e??void 0,subject:f??void 0,audience:h??void 0,jwtid:m??void 0,header:E??void 0})}async function W2e(l,p,{alg:i="HS256",issuer:r,audience:a,maxAgeSeconds:c,clockSkewSeconds:e=60}={}){try{const[f,h,m]=String(l).split(".");if(!f||!h||!m)return{valid:!1,header:null,payload:null,reason:"Malformed"};const E=mg(f),b=mg(h);if(!E||!b)return{valid:!1,header:E,payload:b,reason:"Bad base64/json"};if(E.alg!==i)return{valid:!1,header:E,payload:b,reason:"Alg mismatch"};const g=rn(`${f}.${h}`,"utf8"),$=await l1(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,g),L=df(m);if(!s1($,L))return{valid:!1,header:E,payload:b,reason:"Bad signature"};const j=Math.floor(Date.now()/1e3),k=Math.max(0,Number(e)||0);if(b.nbf!=null&&j+k<Number(b.nbf))return{valid:!1,header:E,payload:b,reason:"Not before"};if(b.exp!=null&&j-k>=Number(b.exp))return{valid:!1,header:E,payload:b,reason:"Expired"};if(r&&b.iss!==r)return{valid:!1,header:E,payload:b,reason:"Issuer mismatch"};if(a){const G=b.aud;if(!(Array.isArray(G)?G.includes(a):G===a))return{valid:!1,header:E,payload:b,reason:"Audience mismatch"}}return c!=null&&b.iat!=null&&j-Number(b.iat)>Number(c)+k?{valid:!1,header:E,payload:b,reason:"MaxAge exceeded"}:{valid:!0,header:E,payload:b}}catch(f){return{valid:!1,header:null,payload:null,reason:String((f==null?void 0:f.message)??f)}}}async function z2e(l,p,i,r,a,c,e,f){if(typeof l!="string")throw new Error("Invalid input type for token; expected string");if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(typeof r!="string")throw new Error("Invalid input type for issuer; expected string");if(a!=null&&typeof a!="string")throw new Error("Invalid input type for audience; expected string");const m=rn(p??"",f??"utf8");return await W2e(String(l??""),m,{alg:i??"HS256",issuer:r??void 0,audience:a??void 0,maxAgeSeconds:c!=null?Number(c):void 0,clockSkewSeconds:e!=null?Number(e):void 0})}function Y2e(l){const[p,i,r]=String(l).split(".");return{header:p?mg(p):null,payload:i?mg(i):null,signature:r?df(r):new Uint8Array}}function J2e(l,p){if(!l)throw new Error("Token is required for decoding");if(typeof l!="string")throw new Error("Invalid input type for token; expected string");const i=p??"base64url",{header:r,payload:a,signature:c}=Y2e(String(l??"")),e=bo(c,i);return{header:r,payload:a,signature:e}}class X2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES,version:"1.0.0",description:"Randomness generate random bytes operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(it.GenerateRandomBytes);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(E=>{var b,g;return((b=E.value)==null?void 0:b.valueAsType)??((g=E.value)==null?void 0:g.value)}),e=Math.max(0,Number(a)||0),f=c??"base64url",h=kx(e),m=bo(h,f);return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Q2e extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateRandomInteger);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=D_e(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class eBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateRandomFloat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=zR();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class tBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateRandomHexadecimal);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=Tx(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class iBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateRandomBase62);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=vx(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class rBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateRandomBase64);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=C_e(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class nBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateRandomAlphanumeric);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=Ex(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class aBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateIdentifier);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=bx(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class sBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateRandomUUIDv4);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=np();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class lBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{z.Logger.log("Initializing Random Generate Short Identifier Module");const r=i.find(a=>a.contextType===te.Logic);if(r){z.Logger.log("Project state found, setting up operation");const a=r.get(it.GenerateShortIdentifier);a?(z.Logger.log("Operation found, setting autoexecutable and implementation"),a.autoexecutable=!0,a.implementation=this.module.main):z.Logger.warn("Operation generate-short-identifier not found in project state")}else z.Logger.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,r)=>{try{const a=O_e();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class oBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(it.GenerateHexadecimalToken);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=__e();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}function pRi(l){let p;if(l===null?p="null":Array.isArray(l)?p="array":p=typeof l,!["string","number","boolean","null","object","array"].includes(p))throw new TypeError("GetTypeOf cannot determine type of the given value.");return p}class dBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF,version:"1.0.0",description:"Data type get type of operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(Xe.GetTypeOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)})[0];return{value:U.Success,error:null,result:pRi(c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class uBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING,version:"1.0.0",description:"Coerce any value to string via JS String(value)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.ToString);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=String(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class pBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER,version:"1.0.0",description:"Coerce to number via JS Number(value)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.ToNumber);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=Number(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class cBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES,version:"1.0.0",description:"Convert string/bytes-like to Uint8Array (utf8|hex|base64|base64url)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.ToBytes);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=rn(a,c||"utf8");return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class fBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING,version:"1.0.0",description:"Convert Uint8Array to string (utf8|hex|base64|base64url)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.FromBytesToString);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=bo(a,c||"utf8");return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class yBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64,version:"1.0.0",description:"Bytes -> base64 string (accepts string input by converting from utf8)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.EncodeBase64);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)});return{value:U.Success,error:null,result:L2e(a,c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class hBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64,version:"1.0.0",description:"base64 string -> bytes (Uint8Array)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.DecodeBase64);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=$2e(String(a));return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class mBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL,version:"1.0.0",description:"Bytes -> base64url string (accepts string input by converting from utf8)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.EncodeBase64Url);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=dh(a,c||"utf8");return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class TBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL,version:"1.0.0",description:"base64url string -> bytes (Uint8Array)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.DecodeBase64Url);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=df(String(a));return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class vBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX,version:"1.0.0",description:"Bytes -> hex string (accepts string input by converting from utf8)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.EncodeHex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=B2e(a,c||"utf8");return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class EBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX,version:"1.0.0",description:"hex string -> bytes (Uint8Array)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(Xe.DecodeHex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=M2e(String(a));return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class bBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH,version:"1.0.0",description:"Crypto: Hash (SHA-256/384/512)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(yi.Hash);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)});return{value:U.Success,error:null,result:U2e(a,c,e,f)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class ABe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC,version:"1.0.0",description:"Crypto: HMAC (SHA-256/384/512)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(yi.Hmac);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m]=r.map(E=>{var b,g;return((b=E.value)==null?void 0:b.valueAsType)??((g=E.value)==null?void 0:g.value)});return{value:U.Success,error:null,result:k2e(c,e,a,f,h,m)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class gBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL,version:"1.0.0",description:"Crypto: constant-time equality for byte sequences",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(yi.ConstantTimeEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)});return{value:U.Success,error:null,result:G2e(a,c,e,f)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class IBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2,version:"1.0.0",description:"Crypto: derive key with PBKDF2 (SHA-256/512)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(yi.DeriveKeyPBKDF2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m,E,b]=r.map(g=>{var _,$;return((_=g.value)==null?void 0:_.valueAsType)??(($=g.value)==null?void 0:$.value)});return{value:U.Success,error:null,result:F2e(a,c,e,f,h,m,E,b)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class RBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE,version:"1.0.0",description:"Json parse string into object operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(on.Parse);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{var a;try{const c=(a=r[0].value)==null?void 0:a.value;if(typeof c!="string")throw new Error(`Invalid input type for JSON.parse operation: expected string, got ${typeof c}`);const e=JSON.parse(c);return{value:U.Success,error:null,result:e}}catch(c){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:c,result:null}}}})}}class DBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY,version:"1.0.0",description:"Json stringify object into string operation implementation module",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===te.Logic);if(r){const a=r.get(on.Stringify);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{var a,c;try{const e=(a=r[0].value)==null?void 0:a.value,f=(c=r[1].value)==null?void 0:c.value;if(!e||typeof e!="object"&&!Array.isArray(e))throw new Error(`Invalid input type for JSON.stringify operation: expected object or array, got ${typeof e}`);if(!f&&f!==0){const m=JSON.stringify(e);return{value:U.Success,error:null,result:m}}const h=JSON.stringify(e,null,f);return{value:U.Success,error:null,result:h}}catch(e){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:e,result:null}}}})}}class wBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC,version:"1.0.0",description:"JWT: build (HS256/384/512)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(dr.BuildJwtHmac);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m,E,b,g,_,$,L]=r.map(j=>{var k,G;return((k=j.value)==null?void 0:k.valueAsType)??((G=j.value)==null?void 0:G.value)});return{value:U.Success,error:null,result:await H2e(a,c,e,f,h,m,E,b,g,_,$,L)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class CBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC,version:"1.0.0",description:"JWT: verify (HS256/384/512)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(dr.VerifyJwtHmac);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m,E,b]=r.map(g=>{var _,$;return((_=g.value)==null?void 0:_.valueAsType)??(($=g.value)==null?void 0:$.value)});return{value:U.Success,error:null,result:await z2e(a,c,e,f,h,m,E,b)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class OBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE,version:"1.0.0",description:"JWT: decode (no verification)",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(dr.DecodeJwt);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)});return{value:U.Success,error:null,result:J2e(a,c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class _Be extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2,version:"1.0.0",description:"Password: hash (PBKDF2) -> envelope string",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(dn.HashPasswordPBKDF2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m]=r.map(E=>{var b,g;return((b=E.value)==null?void 0:b.valueAsType)??((g=E.value)==null?void 0:g.value)});return{value:U.Success,error:null,result:await q2e(a,c,e,f,h,m)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class VBe extends _e{constructor(){super(...arguments);R(this,"manifest",{id:Oe.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2,version:"1.0.0",description:"Password: verify (PBKDF2) -> boolean",initPriority:De.High,permissions:[Ce.All],contexts:[te.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===te.Logic),a=r==null?void 0:r.get(dn.VerifyPasswordPBKDF2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=await S2e(String(a??""),String(c??""));return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class A_ extends QR{constructor(p,i,r=i.projectId){super(p,te.Editor),this._editor=i,this.id=r}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 lastPublishedProjectState(){return this._editor.lastPublishedProjectState}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 livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(p){this._editor.undoableStackValueIndex=p}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}getRefreshToken(){return this._editor.getRefreshToken()}removeValueByOwnerId(p){return this._editor.removeValueByOwnerId(p)}removeValue(p){return this._editor.removeValue(p)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(p,i){return this._editor.initTest(p,i)}removeTest(p){return this._editor.removeTest(p)}async copyEntities(p,i={}){return this._editor.copyEntities(p,i)}resolveInitialChildrenPositions(p,i,r){return this._editor.resolveInitialChildrenPositions(p,i,r)}publish(){return this._editor.publish()}loadGivenPublication(p){return this._editor.loadGivenPublication(p)}validateProjectState(p){return this._editor.validateProjectState(p)}requestActiveDynamicValue(p,i=!1){return this._editor.requestActiveDynamicValue(p,i)}getValueTypePreference(p){return this._editor.getValueTypePreference(p)}setValueTypePreference(p,i){return this._editor.setValueTypePreference(p,i)}implementFeature(p){return this._editor.implementFeature(p)}}function cRi(l,p){return p instanceof A_?p:new A_(l,p)}class g_ extends QR{constructor(p,i){super(p,te.PublicationRun),this._publicationRun=i}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get projectVersion(){return this._publicationRun.projectVersion}get projectId(){return this._publicationRun.projectId}get triggeredBy(){return this._publicationRun.triggeredBy}get createdAt(){return this._publicationRun.createdAt}get updatedAt(){return this._publicationRun.updatedAt}get status(){return this._publicationRun.status}get steps(){return this._publicationRun.steps}get editor(){return this._publicationRun.editor}get explicitResources(){return this._publicationRun.explicitResources}get implicitGlobalResources(){return this._publicationRun.implicitGlobalResources}get finalGlobalEvent(){return this._publicationRun.finalGlobalEvent}get finalStatus(){return this._publicationRun.finalStatus}}function fRi(l,p){return p instanceof g_?p:new g_(l,p)}function yRi(l){l.register(new IVe(l)),l.register(new gVe(l)),l.register(new vVe(l)),l.register(new bVe(l)),l.register(new AVe(l)),l.register(new EVe(l)),l.register(new sLe(l)),l.register(new lLe(l)),l.register(new oLe(l)),l.register(new uLe(l)),l.register(new dLe(l)),l.register(new pLe(l)),l.register(new Q2e(l)),l.register(new eBe(l)),l.register(new tBe(l)),l.register(new iBe(l)),l.register(new rBe(l)),l.register(new nBe(l)),l.register(new aBe(l)),l.register(new sBe(l)),l.register(new lBe(l)),l.register(new oBe(l)),l.register(new a$e(l)),l.register(new s$e(l)),l.register(new l$e(l)),l.register(new o$e(l)),l.register(new d$e(l)),l.register(new u$e(l)),l.register(new p$e(l)),l.register(new c$e(l)),l.register(new f$e(l)),l.register(new y$e(l)),l.register(new h$e(l)),l.register(new m$e(l)),l.register(new T$e(l)),l.register(new v$e(l)),l.register(new E$e(l)),l.register(new b$e(l)),l.register(new A$e(l)),l.register(new g$e(l)),l.register(new I$e(l)),l.register(new w$e(l)),l.register(new C$e(l)),l.register(new O$e(l)),l.register(new Dxe(l)),l.register(new wxe(l)),l.register(new Cxe(l)),l.register(new Oxe(l)),l.register(new _xe(l)),l.register(new Vxe(l)),l.register(new Pxe(l)),l.register(new Nxe(l)),l.register(new xxe(l)),l.register(new Lxe(l)),l.register(new Bxe(l)),l.register(new Mxe(l)),l.register(new Gxe(l)),l.register(new jxe(l)),l.register(new FNe(l)),l.register(new KNe(l)),l.register(new SNe(l)),l.register(new T2e(l)),l.register(new m2e(l)),l.register(new kPe(l)),l.register(new FPe(l)),l.register(new KPe(l)),l.register(new SPe(l)),l.register(new qPe(l)),l.register(new ZPe(l)),l.register(new HPe(l)),l.register(new WPe(l)),l.register(new zPe(l)),l.register(new oNe(l)),l.register(new jNe(l)),l.register(new UNe(l)),l.register(new kNe(l)),l.register(new YPe(l)),l.register(new JPe(l)),l.register(new XPe(l)),l.register(new QPe(l)),l.register(new eNe(l)),l.register(new tNe(l)),l.register(new iNe(l)),l.register(new rNe(l)),l.register(new nNe(l)),l.register(new aNe(l)),l.register(new sNe(l)),l.register(new lNe(l)),l.register(new dNe(l)),l.register(new uNe(l)),l.register(new pNe(l)),l.register(new cNe(l)),l.register(new fNe(l)),l.register(new yNe(l)),l.register(new hNe(l)),l.register(new mNe(l)),l.register(new TNe(l)),l.register(new vNe(l)),l.register(new ENe(l)),l.register(new bNe(l)),l.register(new _Ne(l)),l.register(new VNe(l)),l.register(new PNe(l)),l.register(new ANe(l)),l.register(new gNe(l)),l.register(new INe(l)),l.register(new RNe(l)),l.register(new DNe(l)),l.register(new wNe(l)),l.register(new CNe(l)),l.register(new ONe(l)),l.register(new A2e(l)),l.register(new g2e(l)),l.register(new I2e(l)),l.register(new R2e(l)),l.register(new v2e(l)),l.register(new E2e(l)),l.register(new b2e(l)),l.register(new D2e(l)),l.register(new C2e(l)),l.register(new _2e(l)),l.register(new w2e(l)),l.register(new O2e(l)),l.register(new V2e(l)),l.register(new x2e(l)),l.register(new P2e(l)),l.register(new N2e(l)),l.register(new Uxe(l)),l.register(new Sxe(l)),l.register(new qxe(l)),l.register(new Wxe(l)),l.register(new zxe(l)),l.register(new Yxe(l)),l.register(new Jxe(l)),l.register(new Xxe(l)),l.register(new Qxe(l)),l.register(new e$e(l)),l.register(new t$e(l)),l.register(new Zxe(l)),l.register(new Hxe(l)),l.register(new Fxe(l)),l.register(new Kxe(l)),l.register(new kxe(l)),l.register(new $xe(l)),l.register(new r$e(l)),l.register(new n$e(l)),l.register(new i$e(l)),l.register(new fLe(l)),l.register(new MLe(l)),l.register(new BLe(l)),l.register(new GLe(l)),l.register(new jLe(l)),l.register(new mLe(l)),l.register(new TLe(l)),l.register(new ILe(l)),l.register(new ALe(l)),l.register(new $Le(l)),l.register(new OLe(l)),l.register(new VLe(l)),l.register(new NLe(l)),l.register(new PLe(l)),l.register(new gLe(l)),l.register(new DLe(l)),l.register(new wLe(l)),l.register(new RLe(l)),l.register(new cLe(l)),l.register(new vLe(l)),l.register(new _Le(l)),l.register(new FLe(l)),l.register(new m_(l)),l.register(new hLe(l)),l.register(new ELe(l)),l.register(new yLe(l)),l.register(new xLe(l)),l.register(new bLe(l)),l.register(new CLe(l)),l.register(new LLe(l)),l.register(new kLe(l)),l.register(new ULe(l)),l.register(new KLe(l)),l.register(new m_(l)),l.register(new qLe(l)),l.register(new SLe(l)),l.register(new ZLe(l)),l.register(new K$e(l)),l.register(new S$e(l)),l.register(new q$e(l)),l.register(new V$e(l)),l.register(new D$e(l)),l.register(new $$e(l)),l.register(new G$e(l)),l.register(new R$e(l)),l.register(new j$e(l)),l.register(new F$e(l)),l.register(new B$e(l)),l.register(new L$e(l)),l.register(new fg(l)),l.register(new Z$e(l)),l.register(new H$e(l)),l.register(new M$e(l)),l.register(new k$e(l)),l.register(new U$e(l)),l.register(new x$e(l)),l.register(new N$e(l)),l.register(new P$e(l)),l.register(new _$e(l)),l.register(new Y$e(l)),l.register(new z$e(l)),l.register(new J$e(l)),l.register(new W$e(l)),l.register(new LNe(l)),l.register(new NNe(l)),l.register(new $Ne(l)),l.register(new BNe(l)),l.register(new MNe(l)),l.register(new xNe(l)),l.register(new GNe(l)),l.register(new dBe(l)),l.register(new hBe(l)),l.register(new TBe(l)),l.register(new EBe(l)),l.register(new yBe(l)),l.register(new mBe(l)),l.register(new vBe(l)),l.register(new fBe(l)),l.register(new cBe(l)),l.register(new pBe(l)),l.register(new uBe(l)),l.register(new RBe(l)),l.register(new DBe(l)),l.register(new gBe(l)),l.register(new IBe(l)),l.register(new X2e(l)),l.register(new bBe(l)),l.register(new ABe(l)),l.register(new CBe(l)),l.register(new wBe(l)),l.register(new OBe(l)),l.register(new _Be(l)),l.register(new VBe(l)),l.register(new DVe(l)),l.register(new wVe(l)),l.register(new pg(l)),l.register(new cg(l))}class Fx{constructor(p=new z.Events("extensions-registry-fallback-events")){R(this,"extensionsRegistry",new Map);R(this,"initialized",new Set);R(this,"initializedContexts",new Set);R(this,"onResolveEditorContextCallback",()=>null);R(this,"onResolveProjectLogicContextCallback",()=>null);R(this,"onResolveEditorGUIContextCallback",()=>null);R(this,"onResolveGUIContextCallback",()=>null);R(this,"onResolveCompileContextCallback",()=>null);R(this,"onResolvePublicationRunContextCallback",()=>null);this.events=p,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(p){this.onResolveEditorContextCallback=p}onResolveProjectLogicContext(p){this.onResolveProjectLogicContextCallback=p}onResolveGUIContext(p){this.onResolveGUIContextCallback=p}onResolveEditorGUIContext(p){this.onResolveEditorGUIContextCallback=p}onResolveCompileContext(p){this.onResolveCompileContextCallback=p}onResolvePublicationRunContext(p){this.onResolvePublicationRunContextCallback=p}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((p,i)=>(p.manifest.initPriority||De.Normal)-(i.manifest.initPriority||De.Normal))}async setup(){yRi(this),z.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case te.Editor:return this.onResolveEditorContextCallback();case te.Logic:return this.onResolveProjectLogicContextCallback();case te.EditorGUI:return this.onResolveEditorGUIContextCallback();case te.Compile:return this.onResolveCompileContextCallback();case te.PublicationRun:return this.onResolvePublicationRunContextCallback();case te.GUI:return this.onResolveGUIContextCallback();case te.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${p}`)}}requestContexts(p,i=[]){const r=[];i.length===0&&(i=p.manifest.contexts);for(const a of i){const c=this.requestContext(a);c&&r.push(c)}return r}requestExtension(p){const i=this.extensionsRegistry.get(p);if(i)return i;throw new Error(`Unknown extension: ${p}`)}register(p){this.extensionsRegistry.set(p.manifest.id,p)}async initAll(){var p,i;for(const r of this.extensionInOrder)if(r.module.init&&!this.initialized.has(r.manifest.id)){const a=r.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);a.length&&(await((i=(p=r.module).init)==null?void 0:i.call(p,a)),this.initialized.add(r.manifest.id))}else!r.module.init&&!this.initialized.has(r.manifest.id)&&this.initialized.add(r.manifest.id)}async initForReady(){z.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder)if(p.module.init&&!this.initialized.has(p.manifest.id)){z.Logger.log("Initializing "+p.manifest.id+" extension...");const i=this.requestContexts(p);p.manifest.contexts.every(a=>!!i.find(c=>c.contextType===a))?(await p.module.init(i),this.initialized.add(p.manifest.id)):z.Logger.warn(`Skipping initialization of ${p.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${p.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(a=>a.contextType).join(", ")}`)}else!p.module.init&&!this.initialized.has(p.manifest.id)?(z.Logger.log("Set "+p.manifest.id+" extension as initialized by default..."),this.initialized.add(p.manifest.id)):z.Logger.log(`Skipping initialization of ${p.manifest.id} extension, already initialized or no init method defined.`)}async destroyAll(){for(const p of[...this.extensionInOrder].reverse())p.module.destroy&&await p.module.destroy();this.events.destroy()}on(p,i){this.events.on(p,i)}emit(p,...i){this.events.emit(p,...i)}off(p,i){this.events.off(p,i)}emitAsync(p,...i){return this.events.emitAsync(p,...i)}emitAsyncAll(p,...i){return this.events.emitAsyncAll(p,...i)}emitAsyncAllSettled(p,...i){return this.events.emitAsyncAllSettled(p,...i)}emitAsyncSequentially(p,...i){return this.events.emitAsyncSequentially(p,...i)}emitAsyncSequentiallyAll(p,...i){return this.events.emitAsyncSequentiallyAll(p,...i)}emitAsyncSequentiallyAllSettled(p,...i){return this.events.emitAsyncSequentiallyAllSettled(p,...i)}async contextAvailable(p){if(this.initializedContexts.has(p)){z.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case te.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case te.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}z.Logger.log(`Context ${p} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(p){return window.localStorage.getItem("dynamic-value-type-preference--"+p)||null}setValueTypePreference(p,i){window.localStorage.setItem("dynamic-value-type-preference--"+p,(i==null?void 0:i.toString())||""),this.emit(p,{})}}let LA=null;const Kx={requestExtension:l=>(LA||(LA=new Fx,LA.setup()),LA.requestExtension(l))},Zu={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var Sx=(l=>(l.FinishedSuccess="finished-success",l.FinishedError="finished-error",l.Running="running",l.Paused="paused",l.Stopped="stopped",l.NotStarted="not-started",l))(Sx||{});const PBe={...Kx,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class ip extends z.Events{constructor(i,r,a,c=null,e=PBe){super();R(this,"project");R(this,"entryPoint");R(this,"state","not-started");R(this,"events",new z.Events("fe-exec-inst-events"));R(this,"entities",[]);R(this,"parentExecution",null);R(this,"executing",[]);R(this,"executed",[]);R(this,"skipped",[]);R(this,"scheduled",[]);R(this,"localTestValues");R(this,"resolvedValues");R(this,"persistedExecutionResults");R(this,"lastExecutionResults");R(this,"onAddToSkippedListCallback",null);R(this,"onRemoveFromSkippedListCallback",null);R(this,"onAddEntityCallback",null);R(this,"onRemoveEntityCallback",null);R(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=r,this.entryPoint=a,this.project=i,this.parentExecution=c,this.localTestValues=new mT(N.UUID.uuid(),this.project),this.resolvedValues=new mT(N.UUID.uuid(),this.project),this.persistedExecutionResults=new mT(N.UUID.uuid(),this.project),this.lastExecutionResults=new mT(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,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}skip(i){this.hasEntity(i)&&(this.removeFromScheduledList(i),!this.skipped.includes(i)&&(this.skipped.push(i),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(i),hr.includes(i.type)&&yt(i).forEach(r=>this.skip(r))))}async schedule(i,r,a){if(this.hasExecuted(i))return null;if(Ft.includes(i.type))return this.executeBranch(i,a,r);if(Pr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,a,r);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,r){const a=[];return[...Nt,...Ft].includes(r.type)?a.push(...r.inputs):Dt.includes(r.type)&&a.push(...r.outputs),a.map(e=>{var h;let f=i.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&Ft.includes(r.type)&&(f=i.find(m=>{var E;return((E=m.valueOwner.declaration)==null?void 0:E.id)===e.id})),f){const m=(h=f.value)==null?void 0:h.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return pn.includes(e.type)?Fo(e,this.valueResolutionContext):lf(e,this.valueResolutionContext)}).reduce((e,f)=>{const h=Jo(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return h.forEach(E=>{var _,$,L;if(E.id===(f==null?void 0:f.valueOwner.id))return;const b=xt(E.getDataType(null),E,this.project);b==null||b.metaSync({value:(_=f==null?void 0:f.value)==null?void 0:_.value},null),b==null||b.setValueAsTypeList((($=f==null?void 0:f.value)==null?void 0:$.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((L=f==null?void 0:f.value)==null?void 0:L.valueAsTypeSingle)||null);const g={...f,valueOwner:E,value:b};m.push(g)}),[...e,...m]},[]).sort((e,f)=>e.valueOwner.index-f.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,r,a,c={}){var f,h;const e={...Zu,...c};try{let m={value:U.Success,error:null,result:null};if(r.sort((E,b)=>E.valueOwner.index-b.valueOwner.index),Object.values(Vr).includes(i.declaration.id)){const E=this.parentContext.requestExtension(Wy+i.declaration.id).module.main;E?m=await E(i,r):z.Logger.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{m=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);let E=null;if(m.error){z.Logger.warn("Raw error executing entity: ",m.error);const b=(f=i.error)==null?void 0:f.getDataType(null),g=xt(b||null,i.error,a);b!=null&&b.asType?g==null||g.setValueAsTypeSingle(m.error):g==null||g.metaSync({value:m.error},null),E={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:g}}return{value:m.value,entity:i,error:E,result:{value:m.result||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}return{...m,entity:i}}catch(m){z.Logger.warn("Internal call execution error: ",m);let E=null;if(i.error){const b=(h=i.error)==null?void 0:h.getDataType(null),g=xt(b,i.error,a);b!=null&&b.asType?g==null||g.setValueAsTypeSingle(m):g==null||g.metaSync({value:m},null),E={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:g}}return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:E,result:null}}}static async executeOperation(i,r,a){var c,e;try{let f={value:U.Success,error:null,result:null};r.sort((b,g)=>b.valueOwner.index-g.valueOwner.index),i.declaration.implementation&&(f=await i.declaration.implementation(i,r));let h=null;if(f.error&&i.error){z.Logger.warn("Raw error executing entity: ",f.error);const b=((c=i.error)==null?void 0:c.getDataType(null))||null,g=xt(b,i.error,a);b!=null&&b.asType?g==null||g.setValueAsTypeSingle(f.error):g==null||g.metaSync({value:f.error},null),h={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:g}}const m=i==null?void 0:i.getDataType(null),E=xt(m,i,a);return m!=null&&m.asType?E==null||E.setValueAsTypeSingle(f.result):E==null||E.metaSync({value:f.result},null),{value:f.value,entity:i,error:h,result:{value:E||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(f){z.Logger.warn("Operation execution error: ",f);let h=null;if(i.error){const m=(e=i.error)==null?void 0:e.getDataType(null),E=xt(m,i.error,a);m!=null&&m.asType?E==null||E.setValueAsTypeSingle(f):E==null||E.metaSync({value:f},null),h={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:E}}return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:h,result:null}}}async executeSearch(i,r,a){var c;try{let e={value:U.Success,error:null,result:null};const f=await(await this.parentContext.requestExtension(Oe.SEARCH_NODE_IMPLEMENTATION)).module.main(i,r),h=i==null?void 0:i.getDataType(null),m=xt(h,i,a);return m==null||m.metaSync({value:f},null),f.error?{value:U.UnhandledError,entity:i,error:{valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:m},result:null}:{value:e.value,entity:i,error:null,result:{value:m,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(e){if(z.Logger.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null};const f=(c=i.error)==null?void 0:c.getDataType(null),h=xt(f,i.error,a);return h==null||h.metaSync({value:e},null),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:h},result:null}}}async executeLoop(i,r,a,c={}){var f,h,m,E,b,g;const e={...Zu,...c};try{let _={value:U.Success,error:null,result:null};const $=r.map(ie=>{var ee,ue;return((ee=ie==null?void 0:ie.value)==null?void 0:ee.valueAsType)||((ue=ie==null?void 0:ie.value)==null?void 0:ue.value)});let L={};i.getUniqueInputMaps().forEach(ie=>{const ee=i.body.inputs.find(ce=>se(ce,a)===se(ie,a)),ue=ie==null?void 0:ie.getDataType(null),ae=xt(ue,ee,a);ue!=null&&ue.asType?ae==null||ae.setValueAsTypeList([]):ae==null||ae.metaSync({value:[]},null),this.lastExecutionResults.writeValue(ee,ae);const de={value:ae,valueOwner:ee,type:Me.ExecutionResult,inheritanceLink:null};L[ee.id]=de});let k={value:U.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case re.loop["counted-loop"].id:{const ie=$[0];let ee=1;for(;ee<=ie&&ee<=50;){const ue=i.body.inputs.map(ae=>{if(ae===i.currentIterationNumberArgumentDeclaration){const de=i.currentIterationNumberArgumentDeclaration.getDataType(null),ce=Wc(de),ne=this.lastExecutionResults.readValue(ae.id);if(ne){ne.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ae,ne);const Ee={value:ne,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null};return L[ae.id]=Ee,Ee}const le={id:N.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:N.UUID.uuid(),createdAt:new Date().toISOString(),author:N.sessionAuthor,deleted:!1,previousVersion:null,value:ee,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:ae.toReference()},Q=Yi(le,a);this.lastExecutionResults.writeValue(ae,Q);const oe={value:Q,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null};return L[ae.id]=oe,oe}else return L[ae.id]}).filter(ae=>!!ae);if(k=await this.executeFullFunctionDeclarationLogic(i.body,ue,e),(k.results||[]).forEach(ae=>{var le,Q,oe,Ee;if(ae.valueOwner.type!==d.InputMap||Dt.includes(ae.valueOwner.parent.type))return;const de=i.body.inputs.find(Te=>se(Te,a)===se(ae.valueOwner,a)),ne=[...((Q=(le=L==null?void 0:L[de.id])==null?void 0:le.value)==null?void 0:Q.value)||[],((oe=ae==null?void 0:ae.value)==null?void 0:oe.value)||null];(Ee=L[de.id].value)==null||Ee.metaSync({value:ne},null),this.lastExecutionResults.writeValue(de,L[de.id].value)}),[U.CaughtError,U.Break,U.Return].includes(k.value))break;ee++}break}case re.loop["manual-flow-loop"].id:{let ie=1;for(;ie<=50;){const ee=i.body.inputs.map(ue=>{if(ue===i.currentIterationNumberArgumentDeclaration){const ae=this.lastExecutionResults.readValue(ue.id);if(ae){ae.metaSync({value:ie},null),this.lastExecutionResults.writeValue(ue,ae);const le={value:ae,valueOwner:ue,type:Me.ExecutionResult,inheritanceLink:null};return L[ue.id]=le,le}const de=i.currentIterationNumberArgumentDeclaration.getDataType(null),ce=xt(de,ue,a);return ce==null||ce.metaSync({value:ie},null),this.lastExecutionResults.writeValue(ue,ce),{value:ce,valueOwner:ue,type:Me.ExecutionResult,inheritanceLink:null}}else return L[ue.id]}).filter(ue=>!!ue);if(k=await this.executeFullFunctionDeclarationLogic(i.body,ee,e),(k.results||[]).forEach(ue=>{var ne,le,Q;if(ue.valueOwner.type!==d.InputMap||Dt.includes(ue.valueOwner.parent.type))return;const ae=i.body.inputs.find(oe=>se(oe,a)===se(ue.valueOwner,a)),ce=[...(ne=L[ae.id].value)==null?void 0:ne.value,((le=ue.value)==null?void 0:le.value)||null];(Q=L[ae.id].value)==null||Q.metaSync({value:ce},null),this.lastExecutionResults.writeValue(ae,L[ae.id].value)}),[U.CaughtError,U.Break,U.Return].includes(k.value))break;ie++}break}case re.loop["list-loop"].id:{const ie=$[0];let ee=1;const ue=ie;for(let ae=0;ae<ue.length;ae++){const de=ue[ae],ce=i.body.inputs.map(ne=>{if(ne===i.currentIterationNumberArgumentDeclaration){const le=this.lastExecutionResults.readValue(ne.id);if(le)return le.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ne,le),{value:le,valueOwner:ne,type:Me.ExecutionResult,inheritanceLink:null};const Q=i.currentIterationNumberArgumentDeclaration.getDataType(null),oe=xt(Q,ne,a);return oe==null||oe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ne,oe),{value:oe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(ne===i.currentValueArgumentDeclaration){const le=i.currentValueArgumentDeclaration.getDataType(null),Q=Wc(le),oe=this.lastExecutionResults.readValue(ne.id);if(oe)return oe.metaSync({value:de},null),this.lastExecutionResults.writeValue(ne,oe),{value:oe,valueOwner:ne,type:Me.ExecutionResult,inheritanceLink:null};const Ee={id:N.UUID.uuid(),deletable:!0,editable:!0,type:d.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:Q,standaloneParent:ne.toReference()},Te=Yi(Ee,a);return this.lastExecutionResults.writeValue(ne,Te),{value:Te,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return L[ne.id]}).filter(ne=>!!ne);if(k=await this.executeFullFunctionDeclarationLogic(i.body,ce,e),(k.results||[]).forEach(ne=>{var Ee,Te,Ve;if(ne.valueOwner.type!==d.InputMap||Dt.includes(ne.valueOwner.parent.type))return;const le=i.body.inputs.find(Le=>se(Le,a)===se(ne.valueOwner,a)),oe=[...(Ee=L[le.id].value)==null?void 0:Ee.value,((Te=ne.value)==null?void 0:Te.value)||null];(Ve=L[le.id].value)==null||Ve.metaSync({value:oe},null),this.lastExecutionResults.writeValue(le,L[le.id].value)}),[U.CaughtError,U.Break,U.Return].includes(k.value))break;ee++}break}case re.loop["object-keys-loop"].id:{const ie=$[0];let ee=1;const ue=ie?Object.keys(ie):[];for(let ae=0;ae<ue.length;ae++){const de=ue[ae],ce=i.body.inputs.map(ne=>{if(ne===i.currentIterationNumberArgumentDeclaration){const le=this.lastExecutionResults.readValue(ne.id);if(le)return le.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ne,le),{value:le,valueOwner:ne,type:Me.ExecutionResult,inheritanceLink:null};const Q=i.currentIterationNumberArgumentDeclaration.getDataType(null),oe=xt(Q,ne,a);return oe==null||oe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ne,oe),{value:oe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(ne===i.currentValueArgumentDeclaration){const le=i.currentValueArgumentDeclaration.getDataType(null),Q=Wc(le),oe=this.lastExecutionResults.readValue(ne.id);if(oe)return oe.metaSync({value:de},null),this.lastExecutionResults.writeValue(ne,oe),{value:oe,valueOwner:ne,type:Me.ExecutionResult,inheritanceLink:null};const Ee={id:N.UUID.uuid(),deletable:!0,editable:!0,type:d.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:Q,standaloneParent:ne.toReference()},Te=Yi(Ee,a);return this.lastExecutionResults.writeValue(ne,Te),{value:Te,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return L[ne.id]}).filter(ne=>!!ne);if(k=await this.executeFullFunctionDeclarationLogic(i.body,ce,e),(k.results||[]).forEach(ne=>{var Ee,Te,Ve;if(ne.valueOwner.type!==d.InputMap||Dt.includes(ne.valueOwner.parent.type))return;const le=i.body.inputs.find(Le=>se(Le,a)===se(ne.valueOwner,a)),oe=[...(Ee=L[le.id].value)==null?void 0:Ee.value,((Te=ne.value)==null?void 0:Te.value)||null];(Ve=L[le.id].value)==null||Ve.metaSync({value:oe},null),this.lastExecutionResults.writeValue(le,L[le.id].value)}),[U.CaughtError,U.Break,U.Return].includes(k.value))break;ee++}break}case re.loop["object-values-loop"].id:{const ie=$[0];let ee=1;const ue=ie?Object.values(ie):[];for(let ae=0;ae<ue.length;ae++){const de=ue[ae],ce=i.body.inputs.map(ne=>{if(ne===i.currentIterationNumberArgumentDeclaration){const le=this.lastExecutionResults.readValue(ne.id);if(le)return le.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ne,le),{value:le,valueOwner:ne,type:Me.ExecutionResult,inheritanceLink:null};const Q=i.currentIterationNumberArgumentDeclaration.getDataType(null),oe=xt(Q,ne,a);return oe==null||oe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ne,oe),{value:oe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(ne===i.currentValueArgumentDeclaration){const le=i.currentValueArgumentDeclaration.getDataType(null),Q=Wc(le),oe=this.lastExecutionResults.readValue(ne.id);if(oe)return oe.metaSync({value:de},null),this.lastExecutionResults.writeValue(ne,oe),{value:oe,valueOwner:ne,type:Me.ExecutionResult,inheritanceLink:null};const Ee={id:N.UUID.uuid(),deletable:!0,editable:!0,type:d.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:Q,standaloneParent:ne.toReference()},Te=Yi(Ee,a);return this.lastExecutionResults.writeValue(ne,Te),{value:Te,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return L[ne.id]}).filter(ne=>!!ne);if(k=await this.executeFullFunctionDeclarationLogic(i.body,ce,e),(k.results||[]).forEach(ne=>{var Ee,Te,Ve;if(ne.valueOwner.type!==d.InputMap||Dt.includes(ne.valueOwner.parent.type))return;const le=i.body.inputs.find(Le=>se(Le,a)===se(ne.valueOwner,a)),oe=[...(Ee=L[le.id].value)==null?void 0:Ee.value,((Te=ne.value)==null?void 0:Te.value)||null];(Ve=L[le.id].value)==null||Ve.metaSync({value:oe},null),this.lastExecutionResults.writeValue(le,L[le.id].value)}),[U.CaughtError,U.Break,U.Return].includes(k.value))break;ee++}break}case re.loop["string-loop"].id:{const ie=$[0];let ee=1;const ue=ie.split("");for(let ae=0;ae<ue.length;ae++){const de=ue[ae],ce=i.body.inputs.map(ne=>{if(ne===i.currentIterationNumberArgumentDeclaration){const le=this.lastExecutionResults.readValue(ne.id);if(le)return le.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ne,le),{value:le,valueOwner:ne,type:Me.ExecutionResult,inheritanceLink:null};const Q=i.currentIterationNumberArgumentDeclaration.getDataType(null),oe=xt(Q,ne,a);return oe==null||oe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ne,oe),{value:oe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(ne===i.currentValueArgumentDeclaration){const le=i.currentValueArgumentDeclaration.getDataType(null),Q=Wc(le),oe=this.lastExecutionResults.readValue(ne.id);if(oe)return oe.metaSync({value:de},null),this.lastExecutionResults.writeValue(ne,oe),{value:oe,valueOwner:ne,type:Me.ExecutionResult,inheritanceLink:null};const Ee={id:N.UUID.uuid(),deletable:!0,editable:!0,type:d.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:Q,standaloneParent:ne.toReference()},Te=Yi(Ee,a);return this.lastExecutionResults.writeValue(ne,Te),{value:Te,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return L[ne.id]}).filter(ne=>!!ne);if(k=await this.executeFullFunctionDeclarationLogic(i.body,ce,e),(k.results||[]).forEach(ne=>{var Ee,Te,Ve;if(ne.valueOwner.type!==d.InputMap||Dt.includes(ne.valueOwner.parent.type))return;const le=i.body.inputs.find(Le=>se(Le,a)===se(ne.valueOwner,a)),oe=[...(Ee=L[le.id].value)==null?void 0:Ee.value,((Te=ne.value)==null?void 0:Te.value)||null];(Ve=L[le.id].value)==null||Ve.metaSync({value:oe},null),this.lastExecutionResults.writeValue(le,L[le.id].value)}),[U.CaughtError,U.Break,U.Return].includes(k.value))break;ee++}break}}if(_={value:[U.CaughtError,U.Return].includes(k.value)?k.value:U.Success,error:((h=(f=k.error)==null?void 0:f.value)==null?void 0:h.value)||null,result:((E=(m=k==null?void 0:k.result)==null?void 0:m.value)==null?void 0:E.value)||null},_.error&&i.error){const ie=(b=i.error)==null?void 0:b.getDataType(null),ee=xt(ie||null,i.error,a);ie!=null&&ie.asType?ee==null||ee.setValueAsTypeSingle(_.error):ee==null||ee.metaSync({value:_.error},null);const ue={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:ee};return{value:_.value,entity:i,error:ue,result:null}}const G=i==null?void 0:i.getDataType(null),H=xt(G,i,a);return G!=null&&G.asType?H==null||H.setValueAsTypeSingle(_.result):H==null||H.metaSync({value:_.result},null),{value:_.value,entity:i,error:null,result:{value:H||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(_){if(z.Logger.warn("Error executing loop: ",_),i.error){const $=(g=i.error)==null?void 0:g.getDataType(null),L=xt($,i.error,a);return $!=null&&$.asType?L==null||L.setValueAsTypeSingle(_):L==null||L.metaSync({value:_},null),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:L},result:null}}else return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,r,a,c={}){var f,h,m,E,b,g,_,$,L,j,k,G,H,ie,ee,ue,ae,de,ce,ne,le,Q,oe,Ee,Te,Ve;const e={...Zu,...c};try{const Le=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);let $e=null;if(Le.error&&i.error){z.Logger.warn("Raw error executing entity: ",Le.error);const rt=(f=i.error)==null?void 0:f.getDataType(null),Rt=xt(rt||null,i.error,a);rt!=null&&rt.asType?(m=(h=Le.error)==null?void 0:h.value)!=null&&m.valueAsTypeSingle?Rt==null||Rt.setValueAsTypeSingle((b=(E=Le.error)==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle):(_=(g=Le.error)==null?void 0:g.value)!=null&&_.valueAsTypeList&&Array.isArray((L=($=Le.error)==null?void 0:$.value)==null?void 0:L.valueAsTypeList)&&(Rt==null||Rt.setValueAsTypeList((k=(j=Le.error)==null?void 0:j.value)==null?void 0:k.valueAsTypeList)):Rt==null||Rt.metaSync({value:(H=(G=Le.error)==null?void 0:G.value)==null?void 0:H.value},null),$e={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:Rt}}let ke=U.Success;Le.value===U.UnhandledError&&(i.catchesError||i.errorCalls.length?ke=U.CaughtError:ke=U.UnhandledError);const Ke=i==null?void 0:i.getDataType(null),Je=xt(Ke,i,a);return Ke!=null&&Ke.asType?(ee=(ie=Le.result)==null?void 0:ie.value)!=null&&ee.valueAsTypeSingle?Je==null||Je.setValueAsTypeSingle((ae=(ue=Le.result)==null?void 0:ue.value)==null?void 0:ae.valueAsTypeSingle):(ce=(de=Le.result)==null?void 0:de.value)!=null&&ce.valueAsTypeList&&Array.isArray((le=(ne=Le.result)==null?void 0:ne.value)==null?void 0:le.valueAsTypeList)&&(Je==null||Je.setValueAsTypeList((oe=(Q=Le.result)==null?void 0:Q.value)==null?void 0:oe.valueAsTypeList)):Je==null||Je.metaSync({value:((Te=(Ee=Le.result)==null?void 0:Ee.value)==null?void 0:Te.value)||null},null),{value:ke,entity:i,error:$e,result:{value:Je||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(Le){if(!i.error)return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null};const $e=(Ve=i.error)==null?void 0:Ve.getDataType(null),ke=xt($e,i.error,a);return $e!=null&&$e.asType?ke==null||ke.setValueAsTypeSingle(Le):ke==null||ke.metaSync({value:Le},null),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:ke},result:null}}}async executeCondition(i,r){var c,e,f,h;let a=!1;switch(i.declaration.id){case un.BooleanIsTrue:{const m=(e=(c=r[0])==null?void 0:c.value)==null?void 0:e.value;if(typeof m!="boolean")throw new TypeError("BooleanIsTrue expects a boolean input.");a=m===!0;break}case un.BooleanIsFalse:{const m=(h=(f=r[0])==null?void 0:f.value)==null?void 0:h.value;if(typeof m!="boolean")throw new TypeError("BooleanIsFalse expects a boolean input.");a=m===!1;break}case Ir.And:{a=(await Promise.all(i.andChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(r,E);return(await this.executeCondition(E,b)).value===U.Success}))).every(E=>E);break}case Ir.Or:{a=(await Promise.all(i.orChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(r,E);return(await this.executeCondition(E,b)).value===U.Success}))).some(E=>E);break}default:throw new Error(`Condition declaration ${i.declaration.name} does not have an implementation.`)}return{value:a?U.Success:U.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,r,a,c={}){const e={...Zu,...c,onBeforeEntityExecution:(m,E,b)=>{var g;return((g=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:g.call(c,m,E,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(m,E,b)=>{var g;return((g=c==null?void 0:c.onEntityExecuted)==null?void 0:g.call(c,m,E,{...b,detached:!0}))||Promise.resolve()}},f=new ip(a,[i,...Bg(i)],i,this,this.parentContext);return f.inheritValuesFromContext(this),await f.execute(e,r)}async executeFullFunctionDeclarationLogic(i,r,a={}){const c={...Zu,...a},e=Bg(i);e.forEach(m=>{this.addEntity(m)}),e.reduce((m,E)=>Dt.includes(E.type)?[...m,...E.outputs]:Nt.includes(E.type)&&E.type!==d.Condition?[...m,...E.outputs,...E.inputs]:E.type===d.Condition?[...m,...E.inputs]:m,[]).forEach(m=>{this.lastExecutionResults.removeValue(m.id)});const h=await this.executeBranch(i,c,r);return{...h||{},value:(h==null?void 0:h.value)||U.Success,entity:i,error:(h==null?void 0:h.error)||null,result:(h==null?void 0:h.result)||null}}static async executeEntryPointEntity(i,r){return{value:U.Success,entity:i,error:null,result:null}}async executeReturnStatement(i,r){var f,h,m,E,b,g,_;if((f=i.throws)!=null&&f.readsValue){const $=Fo(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let a=Fo(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)gr((m=a==null?void 0:a.value)==null?void 0:m.value)&&($={...$,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:$},null);else{const L=xt(c,i,this.project);L==null||L.metaSync({value:$},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(L=>{var j,k;if(((j=L.declaration)==null?void 0:j.type)===d.Property&&L.declaration.static){const G=this.lastExecutionResults.readValue(L.declaration.id),H=se(L,this.project),ie=L.codeName||((k=L.declaration)==null?void 0:k.codeName)||ir(H);if(G)G.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(L.declaration,G);else{const ee=xt(L.getDataType(null),L,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(L.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&gr((g=a.value)==null?void 0:g.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map($=>{var G;const L=$.codeName||((G=$.declaration)==null?void 0:G.codeName)||ir(se($,this.project)),j=e[L],k=xt($.getDataType(null),$,this.project);k==null||k.metaSync({value:j},null),Me.ExecutionResult}),a.type=Me.ExecutionResult,{value:U.Return,entity:i,error:null,result:a}}async executeContinueStatement(i,r){var f,h,m,E,b,g,_;if((f=i.throws)!=null&&f.readsValue){const $=Fo(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let a=Fo(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)gr((m=a==null?void 0:a.value)==null?void 0:m.value)&&($={...$,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:$},null);else{const L=xt(c,i,this.project);L==null||L.metaSync({value:$},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(L=>{var j,k;if(((j=L.declaration)==null?void 0:j.type)===d.Property&&L.declaration.static){const G=this.lastExecutionResults.readValue(L.declaration.id),H=se(L,this.project),ie=L.codeName||((k=L.declaration)==null?void 0:k.codeName)||ir(H);if(G)G.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(L.declaration,G);else{const ee=xt(L.getDataType(null),L,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(L.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&gr((g=a.value)==null?void 0:g.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map($=>{var G;const L=$.codeName||((G=$.declaration)==null?void 0:G.codeName)||ir(se($,this.project)),j=e[L],k=xt($.getDataType(null),$,this.project);k==null||k.metaSync({value:j},null),Me.ExecutionResult}),a.type=Me.ExecutionResult,{value:U.Continue,entity:i,error:null,result:a}}async executeBreakStatement(i,r){var f,h,m,E,b,g,_;if((f=i.throws)!=null&&f.readsValue){const $=Fo(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let a=Fo(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)gr((m=a==null?void 0:a.value)==null?void 0:m.value)&&($={...$,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:$},null);else{const L=xt(c,i,this.project);L==null||L.metaSync({value:$},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(L=>{var j,k;if(((j=L.declaration)==null?void 0:j.type)===d.Property&&L.declaration.static){const G=this.lastExecutionResults.readValue(L.declaration.id),H=se(L,this.project),ie=L.codeName||((k=L.declaration)==null?void 0:k.codeName)||ir(H);if(G)G.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(L.declaration,G);else{const ee=xt(L.getDataType(null),L,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(L.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&gr((g=a.value)==null?void 0:g.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map($=>{var G;const L=$.codeName||((G=$.declaration)==null?void 0:G.codeName)||ir(se($,this.project)),j=e[L],k=xt($.getDataType(null),$,this.project);k==null||k.metaSync({value:j},null),Me.ExecutionResult}),a.type=Me.ExecutionResult,{value:U.Break,entity:i,error:null,result:a}}async executeVariable(i,r){var h,m,E,b,g,_;let a=Fo(i,this.valueResolutionContext);const c=yr(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let $={};if(((h=e==null?void 0:e.entity)==null?void 0:h.type)===d.DefinitionEntity&&($={...$,...e.entity.getActiveRawDefaultValue()}),a!=null&&a.value)gr((m=a==null?void 0:a.value)==null?void 0:m.value)&&($={...$,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:$},null);else{const L=xt(e,i,this.project);L==null||L.metaSync({value:$},null),a={valueOwner:c,type:Me.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(c,a.value),c.inputs.forEach(L=>{var j,k;if(((j=L.declaration)==null?void 0:j.type)===d.Property&&L.declaration.static){const G=this.lastExecutionResults.readValue(L.declaration.id),H=se(L,this.project),ie=L.codeName||((k=L.declaration)==null?void 0:k.codeName)||ir(H);if(G)G.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(L.declaration,G);else{const ee=xt(L.getDataType(null),L,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(L.declaration,ee)}}})}else this.lastExecutionResults.writeValue(c,a==null?void 0:a.value);const f=(b=a==null?void 0:a.value)!=null&&b.value&&gr((g=a.value)==null?void 0:g.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map($=>{var G;const L=$.codeName||((G=$.declaration)==null?void 0:G.codeName)||ir(se($,this.project)),j=f[L],k=xt($.getDataType(null),$,this.project);k==null||k.metaSync({value:j},null),Me.ExecutionResult}),a.type=Me.ExecutionResult,{value:U.Success,entity:i,error:null,result:a}}mergeValues(i,r){const a=[];for(let c=0;c<r.length;c++)i!=null&&i[c]?a.push(i[c]):a.push(r[c]);return a}async executeEntity(i,r=[],a={}){var f,h,m,E,b,g,_,$,L,j,k;const c={...Zu,...a},e={detached:!1};switch(i.type){case d.Condition:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((f=c.onBeforeEntityExecution)==null?void 0:f.call(c,i,G,e)),this.executeCondition(i,G)}case d.InternalCall:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((h=c.onBeforeEntityExecution)==null?void 0:h.call(c,i,G,e)),this.executeInternalCall(i,G,this.project)}case d.Operation:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((m=c.onBeforeEntityExecution)==null?void 0:m.call(c,i,G,e)),ip.executeOperation(i,G,this.project)}case d.VariableInstance:case d.VariableDeclaration:return this.executeVariable(i,r);case d.FunctionCall:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((E=c.onBeforeEntityExecution)==null?void 0:E.call(c,i,G,e)),this.executeFunctionCall(i,G,this.project)}case d.FunctionDeclaration:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((b=c.onBeforeEntityExecution)==null?void 0:b.call(c,i,G,e)),ip.executeEntryPointEntity(i,G)}case d.Search:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((g=c.onBeforeEntityExecution)==null?void 0:g.call(c,i,G,e)),this.executeSearch(i,G,this.project)}case d.Loop:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((_=c.onBeforeEntityExecution)==null?void 0:_.call(c,i,G,e)),this.executeLoop(i,G,this.project,c)}case d.ReturnStatement:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await(($=c.onBeforeEntityExecution)==null?void 0:$.call(c,i,G,e)),this.executeReturnStatement(i,G)}case d.ContinueStatement:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((L=c.onBeforeEntityExecution)==null?void 0:L.call(c,i,G,e)),this.executeContinueStatement(i,G)}case d.BreakStatement:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((j=c.onBeforeEntityExecution)==null?void 0:j.call(c,i,G,e)),this.executeBreakStatement(i,G)}case d.GlobalEvent:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((k=c.onBeforeEntityExecution)==null?void 0:k.call(c,i,G,e)),ip.executeEntryPointEntity(i,G)}default:throw new Error(`Entity type ${i==null?void 0:i.type} is not recognized for execution.`)}}storeLastExecutionValues(i){var a,c,e;if(i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value),!i.result||!((a=i.result)!=null&&a.valueOwner))return;const r=Jo((c=i.result)==null?void 0:c.valueOwner,this.project);(e=i.result)!=null&&e.value?r.forEach(f=>{var h;this.lastExecutionResults.writeValue(f,(h=i.result)==null?void 0:h.value)}):r.forEach(f=>{this.lastExecutionResults.removeValue(f.id)})}async executeBranch(i,r={},a=[]){var m;const c={...Zu,...r},e={detached:!1};if(!this.hasEntity(i)||this.hasSkipped(i))return null;this.addToExecutingList(i),this.hasScheduled(i)&&this.removeScheduled(i);const h=await this.executeEntity(i,a,c);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(h),await((m=c.onEntityExecuted)==null?void 0:m.call(c,i,h,e)),h.value===U.Success){const E=(i.successCalls||i.calls||[]).filter(L=>this.hasEntity(L));(i.errorCalls||[]).forEach(L=>{this.skip(L)});let g=[];const _=(await Promise.all(E.map(L=>this.schedule(L,[],c)))).filter(L=>!!L),$=_.filter(L=>!!L).find(L=>L.value===U.CaughtError||L.value===U.Return||L.value===U.Break||L.value===U.Continue);return $||(g=[...g,..._],h)}else if(h.value===U.CaughtError||h.value===U.ConditionNotMet){const E=(i.errorCalls||[]).filter(L=>this.hasEntity(L));(i.successCalls||i.calls||[]).forEach(L=>{this.skip(L)});let g=[];const _=(await Promise.all(E.map(L=>this.schedule(L,[],c)))).filter(L=>!!L),$=_.filter(L=>!!L).find(L=>L.value===U.CaughtError||L.value===U.UnhandledError||L.value===U.Return||L.value===U.Break||L.value===U.Continue);return $||(g=[...g,..._],h)}else{if(h.value===U.UnhandledError)return this.executing.forEach(E=>{this.skip(E)}),this.scheduled.forEach(E=>{this.skip(E)}),hr.includes(h.entity.type)&&yt(h.entity).forEach(E=>{this.skip(E)}),h;if(h.value===U.Return)return h;if(h.value===U.Break)return h;if(h.value===U.Continue)return h}return h}async execute(i={},r=[]){const a={...Zu,...i};this.state="running";const c=await this.executeBranch(this.entryPoint,a,r);return this.state="finished-success",c}addEntity(i){var r;this.entities.includes(i)||(this.entities.push(i),(r=this.onAddEntityCallback)==null||r.call(this,i,{}))}async addEntityAsync(i,r={}){var a;this.entities.includes(i)||(this.entities.push(i),await((a=this.onAddEntityCallback)==null?void 0:a.call(this,i,r)))}addEntities(i){i.forEach(r=>this.addEntity(r))}async addEntitiesAsync(i,r={}){const a=z.YieldTracker.from(r),c=[];for(const e of i)c.push(this.addEntityAsync(e,r)),await a.tick();await Promise.all(c)}removeEntity(i){var r;if(i!==this.entryPoint){const a=this.entities.indexOf(i);a>-1&&(this.entities.splice(a,1),(r=this.onRemoveEntityCallback)==null||r.call(this,i,{}))}}hasEntity(i){var c,e,f;if(this.entities.includes(i))return!0;if(((c=i.parent)==null?void 0:c.type)===d.FunctionDeclaration&&((f=(e=i.parent)==null?void 0:e.parent)==null?void 0:f.type)===d.DefinitionEntity)return this.entities.includes(i.parent);const r=ht(i);if(!r)return!1;const a=r.type===d.Loop&&i.parent===r.body?r.body:null;return a?this.entities.includes(a)||this.entities.includes(r):this.entities.includes(r)}removeScheduled(i){const r=this.scheduled.indexOf(i);r>-1&&this.scheduled.splice(r,1)}hasScheduled(i){return!!this.scheduled.includes(i)}hasSkipped(i){return!!this.skipped.includes(i)}hasExecuted(i){return!!this.executed.includes(i)}hasEntityWithId(i){const r=this.project.get(i);return r?this.hasEntity(r):!1}onAddToSkippedList(i){this.onAddToSkippedListCallback=i}onAbortExecution(i){this.onAbortExecutionCallback=i}onAddEntity(i){this.onAddEntityCallback=i}onRemoveFromSkippedList(i){this.onRemoveFromSkippedListCallback=i}onRemoveEntity(i){this.onRemoveEntityCallback=i}addToExecutingList(i){this.executing.includes(i)||this.executing.push(i)}addToScheduledList(i){this.scheduled.includes(i)||this.scheduled.push(i)}removeFromScheduledList(i){const r=this.scheduled.indexOf(i);r>-1&&this.scheduled.splice(r,1)}removeFromExecutingList(i){var a;const r=this.executing.indexOf(i);r>-1&&(this.executing.splice(r,1),(a=this.onAbortExecutionCallback)==null||a.call(this,i,{}))}removeFromAlreadyExecutedList(i){const r=this.executed.indexOf(i);r>-1&&this.executed.splice(r,1)}removeFromSkippedList(i){var a;const r=this.skipped.indexOf(i);r>-1&&(this.skipped.splice(r,1),(a=this.onRemoveFromSkippedListCallback)==null||a.call(this,i,{}))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var r;this.skipped.includes(i)||(this.skipped.push(i),(r=this.onAddToSkippedListCallback)==null||r.call(this,i,{}))}getValueTypePreference(i){return this.parentContext.getValueTypePreference(i)||null}setValueTypePreference(i,r){this.parentContext.setValueTypePreference(i,r),this.emit(i,{})}}function hRi(l){var p,i;if(l.isList)return"list";if(((p=l.entity)==null?void 0:p.type)===d.DefinitionEntity)return"definition-entity";switch((i=l.entity)==null?void 0:i.name){case ye.Number:return"number";case ye.String:return"text";case ye.Boolean:return"boolean";case ye.UUID:return"uuid";case ye.Date:return"date-time";default:return"definition-entity"}}const Wa={[d.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[d.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[d.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[d.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[d.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[d.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[d.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[d.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[d.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[d.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[d.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[d.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[d.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[d.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[d.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[d.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[d.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[d.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[d.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[d.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[d.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[d.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[d.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[d.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"},[d.DataType]:{singular:"Data type",plural:"Data types",shortSingular:"Data type",shortPlural:"Data types"},[d.LiteralValue]:{singular:"Literal value",plural:"Literal values",shortSingular:"Value",shortPlural:"Values"}};function qx(l){const p=Z1(l);if(!p){const r=vh(l);if(r.includes(Ie.HTTP_ENDPOINT))return"HTTP endpoint";if(r.includes(Ie.PERSISTED_ENTITY))return"Persisted entity";if(r.includes(Ie.CRON_JOB))return"Scheduled execution";if(r.includes(Ie.RELATIONAL_DATABASE))return"Relational database"}if(p){let r="Extension of "+se(p,p.project)+" entity",a=Yo(r);const c=vh(l);return c.includes(Ie.HTTP_ENDPOINT)?"HTTP endpoint"+(a?", "+a:""):c.includes(Ie.PERSISTED_ENTITY)?"Persisted entity"+(a?", "+a:""):c.includes(Ie.CRON_JOB)?"Scheduled execution"+(a?", "+a:""):c.includes(Ie.RELATIONAL_DATABASE)?"Relational database"+(a?", "+a:""):r}let i="";return l.abstract&&(i="Template "),l.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function NBe(l){return l.parent.type===d.DefinitionEntity||l.parent.type===d.InstalledProject?"Internal action of "+se(l.parent,l.project):l.parent.type===d.Loop?"Action repeated on every iteration":"Internal action of entity"}function Zx(l){return cL(l)?NBe(l):"Custom trigger"}function mRi(l){var p;switch(l.type){case d.DefinitionEntity:return qx(l);case d.FunctionDeclaration:return Zx(l)}return(p=Wa[l.type])==null?void 0:p.singular}function TRi(l){var p;switch(l.type){case d.DefinitionEntity:return qx(l);case d.FunctionDeclaration:return Zx(l)}return(p=Wa[l.type])==null?void 0:p.singular}const Hx=4e4,Wx=280,vRi=300,zx=65,zy=32,Xy=39,xBe=26,$Be=49,Tg=44,ERi=35,ZA=52,Yx=10,Ko=Yx*2,vg=38,HA=90,Eg=270,LBe=Hx/2+120,BBe=Hx/2+180;function Jx(l){let i=zy+Tg+vg+Yx;const r=[...l.inputs];return r.length&&(i+=Ko,r.forEach(()=>{i+=xBe})),{height:i,width:280}}function MBe(l){let i=zx;const r=[];if([d.DefinitionEntity].includes(l.type)){const h=[...l.suggestedProperties||[],...l.properties||[]];h.length&&(i+=Ko,h.forEach(m=>{i+=m.static?$Be:Xy}))}if([d.DefinitionEntity,d.InstalledProject,d.Loop].includes(l.type)){const h=[...(l==null?void 0:l.suggestedMethods)||[],...l.methods||[],...l.functions||[],...l.body?[l.body]:[]];h.length&&(i+=Ko,h.forEach(m=>{const E=Jx(m);i+=E.height}))}Nt.includes(l.type)?(_t.includes(l.type)?r.push(...(l.usedInputs||[]).flatMap(h=>[h])||[]):r.push(...(l.inputs||[]).flatMap(h=>[h])||[]),l.error&&(i+=ZA)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(l.type)?(r.push(...l.outputs||[]),l.throws&&(i+=ZA)):l.type===d.Condition&&(r.push(l.inputs[0]),l.inputs[1]&&r.push(l.inputs[1]));const a=r.length;a&&(i+=a*Xy,i+=Ko);const c=[];if(l.type===d.FunctionDeclaration||l.type===d.GlobalEvent?c.push(...l.inputs||[]):Nt.includes(l.type)&&(_t.includes(l.type)?c.push(...l.usedOutputs||[]):c.push(...l.outputs||[])),_t.includes(l.type)){l.readsValue&&(i+=Ko,i+=Tg),l.writesValues.length&&(i+=Ko,i+=Tg),l.internalCalls.length&&l.usedInternalCalls.forEach(()=>i+=ZA+Ko);const h=l.getDataType(null);(!h||h.inferred)&&(i+=vg)}const e=c.length;return e&&(i+=e*Xy,i+=Ko),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(l.type)&&(i+=vg),{height:i,width:280}}function GBe(l){let p=0;if(l.parent.type!==d.DefinitionEntity)return{offset:p};const i=l.parent,r=i.methods.findIndex(c=>c.id===l.id);return i.methods.slice(0,r).forEach(c=>{const e=Jx(c);p+=e.height}),(i.properties.length||i.suggestedProperties.length)&&(p+=Ko,i.suggestedProperties.forEach(()=>{p+=Xy}),i.properties.forEach(()=>{p+=Xy})),{offset:p}}function lE(l){return`${l.split("-").map((r,a)=>a===0?r.charAt(0).toUpperCase()+r.slice(1):r.toLowerCase()).join(" ")}.`}function bRi(l){switch(l.code){case be.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case be.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case be.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case be.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case be.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case be.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case be.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case we.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case we.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case be.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case be.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case we.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case be.NoProperties:return"This entity has no properties, so it doesn't do anything";case be.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case be.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case be.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case be.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case be.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case be.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case be.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case be.PropertyImplementsNonAbstact:return"This property implements a non-template property";case be.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case be.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case be.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case be.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case be.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case we.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case we.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case we.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case we.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case we.UnreachableEntity:return"This entity is unreachable";case be.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case be.AbstractEntityImplements:return"This template entity implements a non-template entity";case be.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case be.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case be.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case be.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case be.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case be.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case be.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case be.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case be.MissingRequiredValue:return"This action is missing a required value";case be.NoPrimaryKeyProperty:return"This entity has no primary key property";case be.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case be.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case be.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case be.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case be.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case be.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case be.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case we.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case we.EmptyName:return"This entity has no name";case we.InvalidObjectStructure:return"This entity has an invalid structure";case we.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case we.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case we.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case we.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case we.MissingCaller:return"This action is missing a caller";case we.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case we.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case we.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case we.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case we.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case we.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case we.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case we.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case id.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case id.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case Ya.UUIDMustBeString:return`UUID must be a string, eg: "${np()}"`;case Ya.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${np()}"`;case Ya.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${np()}"`;case ya.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case ya.StringValueMustNotHaveDashes:return"This value must not contain dashes";case ya.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return lE(l.code)}}function ARi(l){switch(l.code){case be.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case be.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case be.IncorrectEntityImplementation:return"Incorrect implementation";case be.IncorrectMethodImplementation:return"Incorrect action implementation";case be.IncorrectPropertyImplementation:return"Incorrect property implementation";case be.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case be.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case we.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case we.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case be.MissingMethodImplementation:return"Missing action";case be.MissingPropertyImplementation:return"Missing property";case we.NameNotUniqueInScope:return"Duplicate name";case be.NoProperties:return"No properties";case be.NonStaticPropertyInStaticEntity:return"Non-static property";case be.StaticEntityWithNonStaticProperties:return"Non-static properties";case be.ReadingFromIncompatibleType:return"Read from different type";case be.WritingToIncompatibleType:return"Write to different type";case be.ScopeWithoutLogic:return"No logic";case be.NonStaticPropertyImplementsStatic:return"Invalid static property";case be.PropertyImplementsIncompatibleType:return"Incompatible data type";case be.PropertyImplementsNonAbstact:return"Non-template property";case be.StaticPropertyImplementsNonStatic:return"Non-static property";case be.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case be.VariableHasInputsAndInternalCall:return"Bad internal call";case be.VariableHasOutputsAndInternalCall:return"Bad internal call";case be.VariableIsCalledAndHasInternalCall:return"Bad internal call";case we.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case we.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case we.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case we.InternalCallParentMissingDataType:return"Parent has no data type";case we.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case we.UnreachableEntity:return"Unreachable entity";case be.DisconnectedCallableEntity:return"Disconnected entity";case be.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case be.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case be.InvalidPropertiesCombination:return"Invalid properties combination";case be.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case be.ExtendsIncompatibleEntities:return"Extends incompatible entities";case be.ImplementingNonAbstractEntity:return"Implementing non-template entity";case be.ImplementsIncompatibleEntities:return"Implements incompatible entities";case be.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case be.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case be.MissingRequiredValue:return"Missing required value";case be.NoPrimaryKeyProperty:return"No primary key property";case be.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case be.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case be.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case be.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case be.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case be.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case be.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case we.EmptyName:return"Empty name";case we.InvalidObjectStructure:return"Invalid object structure";case we.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case we.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case we.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case we.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case we.MissingCaller:return"Missing caller";case we.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case we.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case we.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case we.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case we.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case we.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case we.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case we.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case id.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case id.StatusCodeMustBeNumber:return"HTTP status code must be a number";case Ya.UUIDMustBeString:return"UUID must be a string";case Ya.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case Ya.UUIDMustBeValidFormat:return"UUID must be in a valid format";case ya.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case ya.StringValueMustNotHaveDashes:return"This value must not contain dashes";case ya.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return lE(l.code)}}function gRi(l){switch(l.code){case be.AbstractEntityWithNonAbstractMethods:return`${se(l.entity,l.entity.project)} has non-template actions`;case be.AbstractEntityWithNonAbstractProperties:return`${se(l.entity,l.entity.project)} has non-template properties`;case be.IncorrectEntityImplementation:return`${se(l.entity,l.entity.project)} incorrectly implements template`;case be.IncorrectMethodImplementation:return`${se(l.entity,l.entity.project)} incorrectly implements the template`;case be.IncorrectPropertyImplementation:return`${se(l.entity,l.entity.project)} incorrectly implements the template`;case be.AbstractMethodInNonAbstractEntity:return`${se(l.entity,l.entity.project)} can't be a template`;case be.AbstractPropertyInNonAbstractEntity:return`${se(l.entity,l.entity.project)} can't be a template`;case we.MethodOverwritesOtherSiblingWithSameName:return`${se(l.entity,l.entity.project)} overwrites action`;case we.PropertyOverwritesOtherSiblingWithSameName:return`${se(l.entity,l.entity.project)} overwrites property`;case be.MissingMethodImplementation:return`${se(l.entity,l.entity.project)} is missing action`;case be.MissingPropertyImplementation:return`${se(l.entity,l.entity.project)} is missing property`;case we.NameNotUniqueInScope:return`${se(l.entity,l.entity.project)} name is not unique`;case be.NoProperties:return`${se(l.entity,l.entity.project)} has no properties`;case be.NonStaticPropertyInStaticEntity:return`${se(l.entity,l.entity.project)} has non-static property`;case be.StaticEntityWithNonStaticProperties:return`${se(l.entity,l.entity.project)} has non-static properties`;case be.ReadingFromIncompatibleType:return`${se(l.entity,l.entity.project)} reads from different type`;case be.WritingToIncompatibleType:return`${se(l.entity,l.entity.project)} writes to different type`;case be.ScopeWithoutLogic:return`${se(l.entity,l.entity.project)} has no logic`;case be.NonStaticPropertyImplementsStatic:return`${se(l.entity,l.entity.project)} has invalid static property`;case be.PropertyImplementsIncompatibleType:return`${se(l.entity,l.entity.project)} has incompatible data type`;case be.PropertyImplementsNonAbstact:return`${se(l.entity,l.entity.project)} has non-template property`;case be.StaticPropertyImplementsNonStatic:return`${se(l.entity,l.entity.project)} has non-static property`;case be.VariableCallsOthersAndHasInternalCall:return`${se(l.entity,l.entity.project)} has bad internal call`;case be.VariableHasInputsAndInternalCall:return`${se(l.entity,l.entity.project)} has bad internal call`;case be.VariableHasOutputsAndInternalCall:return`${se(l.entity,l.entity.project)} has bad internal call`;case be.VariableIsCalledAndHasInternalCall:return`${se(l.entity,l.entity.project)} has bad internal call`;case we.InternalCallDeclarationIsInvalidType:return`${se(l.entity,l.entity.project)} has declaration that is not an action`;case we.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${se(l.entity,l.entity.project)} has declaration that is not found in parent`;case we.InternalCallParentDeclarationEntityInvalidType:return`${se(l.entity,l.entity.project)} has invalid parent declaration type`;case we.InternalCallParentMissingDataType:return`${se(l.entity,l.entity.project)}'s parent has no data type`;case we.InternalCallDeclarationNotInParentDatatypeEntity:return`${se(l.entity,l.entity.project)} has declaration that is not in parent`;case we.UnreachableEntity:return`${se(l.entity,l.entity.project)} is unreachable`;case be.DisconnectedCallableEntity:return`${se(l.entity,l.entity.project)} is not executed by any entity`;case be.AbstractEntityImplements:return`${se(l.entity,l.entity.project)} implements a non-template entity`;case be.AbstractExtendingNonAbstractEntity:return`${se(l.entity,l.entity.project)} extends a non-template entity`;case be.InvalidPropertiesCombination:return`${se(l.entity,l.entity.project)} has invalid properties combination`;case be.ExtendingNonInteractiveEntity:return`${se(l.entity,l.entity.project)} extends a non-interactive entity`;case be.ExtendsIncompatibleEntities:return`${se(l.entity,l.entity.project)} extends incompatible entities`;case be.ImplementingNonAbstractEntity:return`${se(l.entity,l.entity.project)} implements a non-template entity`;case be.ImplementsIncompatibleEntities:return`${se(l.entity,l.entity.project)} implements incompatible entities`;case be.LackingReturnStatementOnSomeBranches:return`${se(l.entity,l.entity.project)} is missing termination on some branches`;case be.LastCalledEntityMustBeReturnEntity:return`${se(l.entity,l.entity.project)}'s last called entity must be a termination node`;case be.MissingRequiredValue:return`${se(l.entity,l.entity.project)} is missing a required value`;case be.NoPrimaryKeyProperty:return`${se(l.entity,l.entity.project)} has no primary key property`;case be.NonAbstractExtendingAbstractEntity:return`${se(l.entity,l.entity.project)} extends a template entity`;case be.NonStaticExtendingStaticEntity:return`${se(l.entity,l.entity.project)} extends a static entity`;case be.NonStaticImplementingStaticEntity:return`${se(l.entity,l.entity.project)} implements a static entity`;case be.StaticExtendingNonStaticEntity:return`${se(l.entity,l.entity.project)} extends a non-static entity`;case be.StaticImplementingNonStaticEntity:return`${se(l.entity,l.entity.project)} implements a non-static entity`;case be.VariableReadsValueAndInternalCall:return`${se(l.entity,l.entity.project)} reads a value and has internal call`;case be.VariableWritesValuesAndInternalCall:return`${se(l.entity,l.entity.project)} writes values and has internal call`;case we.EmptyName:return`${Wa[l.entity.type]} has no name`;case we.InvalidObjectStructure:return`${se(l.entity,l.entity.project)} has invalid structure`;case we.LoopBodyFunctionOverwrite:return`${se(l.entity,l.entity.project)}'s loop body action overwrites an action`;case we.MethodOverwritesBaseMethodWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites base action`;case we.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites another action with same implementation`;case we.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites another action with same implementation`;case we.MissingCaller:return`${se(l.entity,l.entity.project)} is missing a caller`;case we.NameAsResolvedCodeNameNotUniqueInScope:return`${se(l.entity,l.entity.project)} has a name not unique in the scope`;case we.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${se(l.entity,l.entity.project)} name can only contain letters, numbers, underscores and spaces`;case we.NameMustStartWithLetterOrUnderscore:return`${se(l.entity,l.entity.project)} name must start with letter or underscore`;case we.NoOverlapWithImplementedSignature:return`${se(l.entity,l.entity.project)} has no overlap with implemented signature`;case we.PropertyOverwritesBasePropertyWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites base property`;case we.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites another property with same implementation`;case we.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites another property with same implementation`;case we.ReaderWriterIncompatibleDataType:return`${se(l.entity,l.entity.project)} has reader/writer with incompatible data type`;case id.StatusCodeMustBeBetween100And599:return`${se(l.entity,l.entity.project)} HTTP status code must be between 100 and 599`;case id.StatusCodeMustBeNumber:return`${se(l.entity,l.entity.project)} HTTP status code must be a number`;case Ya.UUIDMustBeString:return`${se(l.entity,l.entity.project)} UUID must be a string`;case Ya.UUIDMustNotContainSpaces:return`${se(l.entity,l.entity.project)} UUID must not contain spaces`;case Ya.UUIDMustBeValidFormat:return`${se(l.entity,l.entity.project)} UUID must be in a valid format`;case ya.MustBeUniqueAmongSameEntities:return`${se(l.entity,l.entity.project)} value must be unique among the same kind`;case ya.StringValueMustNotHaveDashes:return`${se(l.entity,l.entity.project)} value must not contain dashes`;case ya.StringValueMustNotHaveSpaces:return`${se(l.entity,l.entity.project)} value must not contain spaces`;default:return`${se(l.entity,l.entity.project)} Error: ${lE(l.code)}`}}function IRi(l){var p,i,r,a;switch(l.code){case be.AbstractEntityWithNonAbstractMethods:return`${se(l.entity,l.entity.project)} has non-template actions`;case be.AbstractEntityWithNonAbstractProperties:return`${se(l.entity,l.entity.project)} has non-template properties`;case be.IncorrectEntityImplementation:return`${se(l.entity,l.entity.project)} incorrectly implements the template entity`;case be.IncorrectMethodImplementation:return`${se(l.entity,l.entity.project)} incorrectly implements the template action it's based on`;case be.IncorrectPropertyImplementation:return`${se(l.entity,l.entity.project)} incorrectly implements the template property it's based on`;case be.AbstractMethodInNonAbstractEntity:return`${se(l.entity,l.entity.project)} is a template action in a non-template entity`;case be.AbstractPropertyInNonAbstractEntity:return`${se(l.entity,l.entity.project)} is a template property in a non-template entity`;case we.MethodOverwritesOtherSiblingWithSameName:return`${se(l.entity,l.entity.project)} overwrites an action in the template entity`;case we.PropertyOverwritesOtherSiblingWithSameName:return`${se(l.entity,l.entity.project)} overwrites a property in the template entity`;case be.MissingMethodImplementation:return`${se(l.entity,l.entity.project)} is missing an action implementation from the template entity`;case be.MissingPropertyImplementation:return`${se(l.entity,l.entity.project)} is missing a property implementation from the template entity`;case we.NameNotUniqueInScope:return`${se(l.entity,l.entity.project)} has a duplicate name in the same scope`;case be.NoProperties:return`${se(l.entity,l.entity.project)} has no properties, so it doesn't do anything`;case be.NonStaticPropertyInStaticEntity:return`${se(l.entity,l.entity.project)} has a non-static property in a static entity`;case be.StaticEntityWithNonStaticProperties:return`${se(l.entity,l.entity.project)} has non-static properties in a static entity`;case be.ReadingFromIncompatibleType:return`${se(l.entity,l.entity.project)} reads data from a value of a different data type`;case be.WritingToIncompatibleType:return`${se(l.entity,l.entity.project)} writes data to a value of a different data type`;case be.ScopeWithoutLogic:return`${se(l.entity,l.entity.project)} has no logic`;case be.NonStaticPropertyImplementsStatic:return`${se(l.entity,l.entity.project)} has a static property in a non-static entity`;case be.PropertyImplementsIncompatibleType:return`${se(l.entity,l.entity.project)} implements a property of a different data type`;case be.PropertyImplementsNonAbstact:return`${se(l.entity,l.entity.project)} implements a non-template property`;case be.StaticPropertyImplementsNonStatic:return`${se(l.entity,l.entity.project)} has a static property in a non-static entity`;case be.VariableCallsOthersAndHasInternalCall:return`${se(l.entity,l.entity.project)} calls other entities while being used to execute internal logic`;case be.VariableHasInputsAndInternalCall:return`${se(l.entity,l.entity.project)} has inputs while being used to execute internal logic`;case be.VariableHasOutputsAndInternalCall:return`${se(l.entity,l.entity.project)} has outputs while being used to execute internal logic`;case be.VariableIsCalledAndHasInternalCall:return`${se(l.entity,l.entity.project)} is called while being used to execute internal logic`;case we.InternalCallDeclarationIsInvalidType:return`${se(l.entity,l.entity.project)} has a declaration that is not an action`;case we.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${se(l.entity,l.entity.project)} has a declaration that is not found in ${(p=l.entity.parent.getDataType(null))!=null&&p.entity?se((i=l.entity.parent.getDataType(null))==null?void 0:i.entity,l.entity.project):"the variable's data-type entity"}`;case we.InternalCallParentDeclarationEntityInvalidType:return`${se(l.entity,l.entity.project)} is part of a variable whos data-type entity can't have actions`;case we.InternalCallParentMissingDataType:return`${se(l.entity,l.entity.project)} is part of a variable with no data-type entity`;case we.InternalCallDeclarationNotInParentDatatypeEntity:return`${se(l.entity,l.entity.project)} has a declaration doesn't belong to ${(r=l.entity.parent.getDataType(null))!=null&&r.entity?se((a=l.entity.parent.getDataType(null))==null?void 0:a.entity,l.entity.project):"the variable's data-type entity"}`;case we.UnreachableEntity:return`${se(l.entity,l.entity.project)} is unreachable`;case be.DisconnectedCallableEntity:return`${se(l.entity,l.entity.project)} is disconnected and won't be executed by anything after publishing`;case be.AbstractEntityImplements:return`${se(l.entity,l.entity.project)} implements a non-template entity`;case be.AbstractExtendingNonAbstractEntity:return`${se(l.entity,l.entity.project)} extends a non-template entity`;case be.InvalidPropertiesCombination:return`${se(l.entity,l.entity.project)} has an invalid combination of properties`;case be.ExtendingNonInteractiveEntity:return`${se(l.entity,l.entity.project)} extends a non-interactive entity`;case be.ExtendsIncompatibleEntities:return`${se(l.entity,l.entity.project)} extends incompatible entities`;case be.ImplementingNonAbstractEntity:return`${se(l.entity,l.entity.project)} implements a non-template entity`;case be.ImplementsIncompatibleEntities:return`${se(l.entity,l.entity.project)} implements incompatible entities`;case be.LackingReturnStatementOnSomeBranches:return`${se(l.entity,l.entity.project)} has branches that don't terminate`;case be.LastCalledEntityMustBeReturnEntity:return`${se(l.entity,l.entity.project)} must end with a termination node`;case be.MissingRequiredValue:return`${se(l.entity,l.entity.project)} is missing a required value`;case be.NoPrimaryKeyProperty:return`${se(l.entity,l.entity.project)} has no primary key property`;case be.NonAbstractExtendingAbstractEntity:return`${se(l.entity,l.entity.project)} is a non-template entity extending a template entity`;case be.NonStaticExtendingStaticEntity:return`${se(l.entity,l.entity.project)} is a non-static entity extending a static entity`;case be.NonStaticImplementingStaticEntity:return`${se(l.entity,l.entity.project)} is a non-static entity implementing a static entity`;case be.StaticExtendingNonStaticEntity:return`${se(l.entity,l.entity.project)} is a static entity extending a non-static entity`;case be.StaticImplementingNonStaticEntity:return`${se(l.entity,l.entity.project)} is a static entity implementing a non-static entity`;case be.VariableReadsValueAndInternalCall:return`${se(l.entity,l.entity.project)} reads a value and has an internal call`;case be.VariableWritesValuesAndInternalCall:return`${se(l.entity,l.entity.project)} writes values and has an internal call`;case we.EmptyName:return`${Wa[l.entity.type]} has no name`;case we.InvalidObjectStructure:return`${se(l.entity,l.entity.project)} has an invalid structure`;case we.LoopBodyFunctionOverwrite:return`${se(l.entity,l.entity.project)}'s loop body action overwrites`;case we.MethodOverwritesBaseMethodWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites a base action with same implementation`;case we.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites another action with same implementation`;case we.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites another action with same implementation`;case we.MissingCaller:return`${se(l.entity,l.entity.project)} is missing a caller`;case we.NameAsResolvedCodeNameNotUniqueInScope:return`${se(l.entity,l.entity.project)} has a name that is not unique in the scope`;case we.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${se(l.entity,l.entity.project)} name can only contain letters, numbers, underscores and spaces`;case we.NameMustStartWithLetterOrUnderscore:return`${se(l.entity,l.entity.project)} name must start with letter or underscore`;case we.NoOverlapWithImplementedSignature:return`${se(l.entity,l.entity.project)} has no overlap with implemented signature`;case we.PropertyOverwritesBasePropertyWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites a base property with same implementation`;case we.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites another property with same implementation`;case we.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${se(l.entity,l.entity.project)} overwrites another property with same implementation`;case we.ReaderWriterIncompatibleDataType:return`${se(l.entity,l.entity.project)} has a reader/writer with incompatible data type`;case id.StatusCodeMustBeBetween100And599:return`${se(l.entity,l.entity.project)} HTTP status code must be between 100 and 599`;case id.StatusCodeMustBeNumber:return`${se(l.entity,l.entity.project)} HTTP status code must be a number, between 100 and 599`;case Ya.UUIDMustBeString:return`${se(l.entity,l.entity.project)} UUID must be a string, eg: "${np()}"`;case Ya.UUIDMustNotContainSpaces:return`${se(l.entity,l.entity.project)} UUID must not contain spaces, eg: "${np()}"`;case Ya.UUIDMustBeValidFormat:return`${se(l.entity,l.entity.project)} UUID must be in a valid format. Eg: "${np()}"`;case ya.MustBeUniqueAmongSameEntities:return`${se(l.entity,l.entity.project)} value must be unique among the same kind`;case ya.StringValueMustNotHaveDashes:return`${se(l.entity,l.entity.project)} value must not contain dashes`;case ya.StringValueMustNotHaveSpaces:return`${se(l.entity,l.entity.project)} value must not contain spaces`;default:return`${se(l.entity,l.entity.project)} Error: ${lE(l.code)}`}}function Xx(l){const p=(l||"").startsWith("error-caller-only--");switch(p?l.replace("error-caller-only--",""):l){case ai.CallIsInHigherScope:return"In a higher scope";case ai.CallIsInLowerScope:return"In a lower scope";case ai.CallerIsInHigherScope:return"Caller is in a higher scope";case ai.CallerIsInLowerScope:return"Caller is in a lower scope";case ai.CannotBeCalledByChildren:return"Cannot be called by children";case ai.CannotCallAncestor:return"Cannot call ancestor";case ai.CannotConnectToItself:return"Cannot connect to itself";case ai.CannotReadMoreThanOneValue:return"Cannot read more than one value";case ai.CannotReadValueFromChildren:return"Cannot read value from entities executed after itself";case ai.CannotWriteValueToAncestor:return"Cannot write value to ancestor";case zT.Suggestion:return"Suggestion";case ai.ContinueOrBreakStatementCalledFromOutsideLoop:return"Cannot be called from outside loop";case ai.DataTypesNotCompatible:return"Data types not compatible";case ai.ElementInLoopBodyCallingOutsideLoop:return"Cannot call outside loop";case ai.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees:return"Error cannot be connected to success branch";case ai.ExecutionsAlreadyConnected:return"Executions already connected";case ai.IsNotValueReadingEntity:return"Is not a value reading entity";case ai.IsNotValueWrittingEntity:return"Is not a value writting entity";case ai.NotInScope:return"Not in a compatible scope";case ai.OtherIncompatibleScopeReason:return"Incompatible scope";case ai.SiblingInternalCallAlreadyUsedInParentVariable:return"Internal call already used in parent variable";case ai.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees:return"Success cannot be connected to error branch";case ai.ValuesAlreadyConnected:return"Values already connected";case ai.CannotInteractWithInputInVariableWithInternalCalls:return"Cannot interact with input in variable with internal calls";case ai.CannotInteractWithOutputInVariableWithInternalCalls:return"Cannot interact with output in variable with internal calls";case zT.CanvasGloballyDisabled:return"Canvas is globally disabled";case ai.PropertyIsConstantItsValueCantBeReset:return"Property is constant, its value can't be reset";case ai.CannotWriteValueOfGlobalVariableDeclaration:return"Cannot write value of global variable declaration";case ai.CannotReSetValueOfConstantVariable:return"Cannot re-set value of constant variable";case ai.CannotConnectToOwnNode:return"It is part of the same node";case ai.CalledByErrorMustBePassThroughCallable:return"Called by error must be pass-through callable";case ai.CannotChangeScopeBecauseItCallsOtherEntities:return"Cannot change scope because it calls other entities in its current scope";case ai.CannotChangeScopeBecauseItIsCalledByOtherEntities:return"Cannot change scope because it is called by other entities in its current scope";case ai.VariableDeclarationCannotBeMovedToLowerScopeBecauseInstancesUsage:return"Variable declaration cannot be moved to lower scope because its instances are used in the current or different incompatible lower scope";case ai.CalledBySourceMustBeCallerEntity:return"Not a caller type";case ai.CalledByErrorCannotBeConnectedToEntitiesCalledByOwnSuccessBranch:return"Already connected to the success branch from a common origin caller";case ai.CalledBySuccessCannotBeConnectedToEntitiesCalledByOwnErrorBranch:return"Already connected to the error branch from a common origin caller";case ai.RedundantCall:return"Redundant call. Already connected further down the execution path";case ai.CannotBeCalledBeforeDeclaration:return"Cannot be called before declaration";case ai.CannotBeCalledInParallelBranchToDeclaration:return"Cannot be called in parallel branch to declaration";case ai.CannotBeHigherScopeThanDeclaration:return"Cannot be in a higher scope than declaration";case ai.CannotCallGlobalVariableDeclaration:return"Cannot call global variable declaration";case ai.EntityAlreadyCalledBySuccessCannotBeConnectedToUnrelatedErrorBranch:return p?"Cannot connect error: Already connected to a success branch from a common origin caller":"Already connected to a success branch from a common origin caller";default:return Lf(l||"")}}function RRi(l,p){const i=[...l,...p],r=Array.from(new Set(i));return{hasChanged:r.length!==l.length,reasons:r}}function DRi(l,p){const i=l.filter(a=>!p.includes(a));return{hasChanged:i.length!==l.length,reasons:i}}function wRi(l,p){return l.find(i=>i.entity.id===p)||null}function jU(l){return l.filter((p,i)=>l.indexOf(p)===i)}class En{constructor(p,i,r=null,a){R(this,"ids",[]);R(this,"entity");R(this,"entityCardHeight");R(this,"entityCardWidth");R(this,"index");R(this,"childEntities",[]);R(this,"children",[]);R(this,"parents",[]);R(this,"calculationEntryPoint");R(this,"_onlyEntities",null);R(this,"_changeSet",null);if(this.index=i,this.entity=p,this.calculationEntryPoint=r||this,this._changeSet=a||null,this===this.calculationEntryPoint&&!a)throw new Error("Change-set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(p,i,r){const a=LBe-Eg-Wx,c=BBe-HA-zx;p.type===d.Project?(p.x=a,p.y=c):p.metaSync({x:p.x||a,y:p.y||c},i);const e=new En(p,0,null,i);e.calculationEntryPoint=e,e._onlyEntities=r||[],e.ids=["0"];const f=[];e.next(m=>{f.push(...m)}),En.recursivelyAssembleChildrenAreas(f),e.resolveChildrenOverlaps();const h=e.flattenChildEntities();return e._onlyEntities?h.filter(m=>{var E;return(E=e._onlyEntities)==null?void 0:E.includes(m)}):h}static recursivelyAssembleChildrenAreas(p){const i=[];p.forEach(r=>{r.next(a=>{i.push(...a)})}),i.length>0&&En.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities||[]}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(p){this.calculationEntryPoint._changeSet=p}findAreaInChildrenFromEntity(p){if(this.entity===p)return this;const i=this.children.find(a=>a.entity===p);return i||this.children.reduce((a,c)=>a||c.findAreaInChildrenFromEntity(p),null)}findAreaFromEntity(p){if(this.entity===p)return this;const i=this.calculationEntryPoint.children,r=i.find(c=>c.entity===p);return r||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(p),null)}addParent(p){if(!this.parents.includes(p)){const i=En.resolveIds(p,this.index);this.ids.push(...i),this.parents.push(p)}}static resolveIds(p,i){return p?p.ids.map(r=>`${r}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const p=kl(this.entity,!0);if(this.entity.type===d.Project){const i=[],r=[],a=[];p.forEach(e=>{if(d.DefinitionEntity===e.type){r.push(e);return}else if(Ft.includes(e.type)){a.push(e);return}i.push(e)});const c=i.sort((e,f)=>{const h=!!Ng(e,f).length,m=kl(e),E=kl(f);return h?0:m.length&&!E.length?-1:!m.length&&E.length?1:0}).filter(e=>!Ac(e).length);this.childEntities=[...r,...a,...c]}else{const i=[],r=[],a=[],c=[],e=[];hr.includes(this.entity.type)&&K1(this.entity).forEach(m=>{if(_t.includes(m.type)){a.push(m);return}const E=ht(m);i.push(E)}),vr.includes(this.entity.type)&&r.push(...this.entity.detachedChildren);const f=p.filter(h=>{const m=i.includes(h);return m||a.includes(h)||r.includes(h)?!1:_t.includes(h.type)?(a.push(h),!1):Pr.includes(h.type)&&!m?(c.push(h),!1):h.type===d.DefinitionEntity?(e.push(h),!1):!0});i.sort((h,m)=>Ml(h,m)?-1:0),c.sort((h,m)=>Ml(h,m)?-1:0),a.sort((h,m)=>W_(h,m)?1:W_(m,h)?-1:0),this.childEntities=[...e,...i,...c,...f,...a,...r]}}calculateCardSize(){const p=MBe(this.entity);this.entityCardWidth=p.width,this.entityCardHeight=p.height}static getBoundriesOfTwoAreas(p,i){return{top:Math.min(p.top,i.top),left:Math.min(p.left,i.left),bottom:Math.max(p.bottom,i.bottom),right:Math.max(p.right,i.right)}}static getBoundriedOfCombinedAreas(p,i){const r=p.filter(c=>!i.includes(c));return r.reduce((c,e)=>i.includes(e)?c:En.getBoundriesOfTwoAreas(c,e.fullBranchArea),r[0].fullBranchArea)}getFullAreaUntilAny(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!p.includes(e)).map(e=>e.getFullAreaUntilAny(p)).reduce((e,f)=>En.getBoundriesOfTwoAreas(e,f),i)}getFullAreaUntilAreaOrAnyChildren(p){const i=[p,...p.flattenChildren()],r=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(p)).reduce((e,f)=>En.getBoundriesOfTwoAreas(e,f),r)}getFullAreaUntil(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==p).map(c=>c.getFullAreaUntil(p)).reduce((c,e)=>En.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const p=this.ownEntityPlusBufferArea;return this.children.map(a=>a.fullBranchArea).reduce((a,c)=>En.getBoundriesOfTwoAreas(a,c),p)}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 p=this.ownEntityArea;return{top:p.top,left:p.left,bottom:p.bottom+HA,right:p.right+Eg}}static filterOutRepeatedAreas(p){return p.filter((i,r)=>p.indexOf(i)===r)}getEarliestId(p,i){const r=p.split("-"),a=i.split("-");return r.length<a.length?p:r.length>a.length?i:r.reduce((e,f,h)=>f<a[h]?p:i,p)}getEarliestLevel(){return this.ids.reduce((r,a)=>this.getEarliestId(r,a),this.ids[0]).split("-").length}countColumns(){let p=0;if(this!==this.calculationEntryPoint)p++;else return p;if(!this.parents.length)return p;const r=this.parents.reduce((a,c)=>c.getEarliestLevel()>a.getEarliestLevel()?c:a,this.parents[0]).countColumns();return p+=r,p}getLatestId(p,i){if(p===i)return p;const r=p.split("-"),a=i.split("-");return r.length<a.length?i:r.length>a.length?p:r.reduce((e,f,h)=>f>a[h]?p:i,p)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((r,a)=>this.getLatestId(r,a),this.ids[0]).split("-").length}smoothPosition(){const p=this.flattenSiblings();if(!p.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(r=>{r!==this.calculationEntryPoint&&r.shiftDownAlone(i)})}else if([...Ft].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=p.filter(r=>!this.parents.includes(r));i.length?i.every(a=>{const c=this.countColumns(),e=a.countColumns();return c>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(p,i){if(p.includes(this))return p;this.move(this.entity,{y:this.entity.y+i});let r=[...p,this];return this.children.forEach(a=>{if(En.getEarliestParentInChain(a)!==this)return;const e=wRi(r,a.entity.id);r=En.filterOutRepeatedAreas([...r]),e||(r=r.filter(h=>h!==a));const f=a.shiftDownUntilAny(r,i);r.push(...f)}),r}shiftRightUntilAny(p,i){p.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(r=>{const a=En.filterOutRepeatedAreas([...this.flattenSiblings(),...p]);En.getEarliestParentInChain(r)===this&&r.shiftRightUntilAny(a,i)}))}shiftRight(p){this.move(this.entity,{x:this.entity.x+p}),this.children.forEach(i=>{const a=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(a,p)})}shiftDownAlone(p){this.move(this.entity,{y:this.entity.y+p})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const p=this.parents.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+zy,h={top:f,left:e.left,bottom:f,right:e.right};return En.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(p.bottom-p.top)/2-zy;this.shiftDownAlone(r)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const p=this.children.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+zy,h={top:f,left:e.left,bottom:f,right:e.right};return En.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(p.bottom-p.top)/2-zy;return this.shiftDownAlone(r),r}resolveChildrenOverlaps(){const p=this.flattenChildren();let i=[];p.forEach(r=>{const a=r.adjustVerticallyToAvoidOverlaps();i.push(...a)}),p.forEach(r=>{r.smoothPosition()})}static getEarliestParentInChain(p){let i=p.parents[0];return p.parents.length&&(i=p.parents.sort((r,a)=>{if(!r.ids.length)return-1;if(!a.ids.length)return 1;const c=r.ids.sort((f,h)=>f.length<h.length?-1:0),e=a.ids.sort((f,h)=>f.length<h.length?-1:0);return c[0].length-e[0].length})[0]),i}flattenEarlierSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((r,a)=>{if(p.has(a.entity.id))return r;p.add(a.entity.id);const e=a.children.slice(0,a.children.indexOf(this)).reduce((f,h)=>[...f,h,...h.flattenChildren(p)],[]);return[...r,...e]},[])}flattenSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((r,a)=>{if(p.has(a.entity.id))return r;p.add(a.entity.id);const e=a.children.filter(f=>f!==this).reduce((f,h)=>[...f,h,...h.flattenChildren(p)],[]);return[...r,...e]},[])}flattenChildren(p=new Set){return this.children.reduce((i,r)=>p.has(r.entity.id)?i:(p.add(r.entity.id),[...i,r,...r.flattenChildren(p)]),[])}flattenParents(p=new Set){return this.parents.reduce((r,a)=>p.has(a.entity.id)?r:(p.add(a.entity.id),[...r,a,...a.flattenParents(p)]),[])}getAreaIfRendered(p){return this.calculationEntryPoint.flattenChildren().find(a=>a.entity.id===p.id)||null}getLowerSiblings(){const p=this.parents.reduce((i,r)=>{const a=r.children.indexOf(this),c=r.children.slice(a+1);return[...i,...c]},[]);return jU(p)}getLowerAreas(){const p=this.getLowerSiblings(),i=this.parents.reduce((r,a)=>[...r,...a.getLowerAreas()],[]);return jU([...p,...i])}adjustVerticallyToAvoidOverlaps(p=[]){const r=En.getEarliestParentInChain(this).children[this.index-1];if(!r)return p;const a=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...a,...c,r],m=C(e.flatMap(_=>Ng(this.entity,_.entity))).filter(_=>_.id!==this.entity.id).map(_=>this.findAreaFromEntity(_)).filter(_=>!!_),E=this.getFullAreaUntilAny(m),b=r.getFullAreaUntilAny(m),g=e.reduce((_,$)=>$===this||$.fullBranchArea.left!==E.left?_:Math.max(_,$.fullBranchArea.bottom),b.bottom);if(E.top<g){const _=g-E.top+HA;return this.shiftDownUntilAny(p,_)}return p}move(p,i){if(this.onlyEntities.includes(p)){if(!this.changeSet)throw new Error("Change set is not defined for this area, cannot move entity");p.metaSync(i,this.changeSet)}}addChild(p){const i=this.childEntities[p];let r=null;i.x&&i.y?r=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),r||(r=new En(i,p,this.calculationEntryPoint));const a=this.ownEntityPlusBufferArea;this.children.includes(r)||(this.children.push(r),r.addParent(this));const c=r.fullBranchArea;if(c.left<a.right){const e=a.right-c.left;r.shiftRight(e)}return r}flattenChildEntities(p=new Set){return this.children.reduce((i,r)=>p.has(r.entity.id)?i:(p.add(r.entity.id),[...i,r.entity,...r.flattenChildEntities(p)]),[])}next(p){const i=[];this.childEntities.forEach((r,a)=>{const c=this.addChild(a);c&&i.push(c)}),p(i)}}async function CRi(l,p,i={}){var f;const r=z.YieldTracker.from(i),a=[],c=[];for(const h of l.instancesList){if(!cf.includes(h.type)||((f=ht(h))==null?void 0:f.id)!==h.id)continue;let m=Zt(h,l);if(!m){console.log("No top scope owner for instance: ",h," in project: ",l);continue}if(!(Ft.includes(m.type)&&m.collapsed&&m.id!==h.id)){for(;m.parent&&m.parent!==l;)m=m.parent,Ft.includes(m.type)&&m.collapsed&&(m.id,h.id);i.forceAll?(h.x=0,h.y=0,c.push(h)):!h.x||!h.y?c.push(h):a.push(h),await r.tick()}}console.log("Layout generation - calculating positions for entities without coordinates... FORCE: ",i.forceAll||!1),console.log(`
|
|
55
55
|
- ${c.map((h,m)=>`${m+1}. ${h.x}, ${h.y} | ${h.type} (${h.id}) ${se(h,h.project)}`).join(`
|
|
56
56
|
- `)}`);const e=await kd([...a,...En.autoGenerateLayout(l,p,c)]);return console.log(`After move:
|
|
57
57
|
- ${c.map((h,m)=>`${m+1}. ${h.x}, ${h.y} | ${h.type} (${h.id}) ${se(h,h.project)}`).join(`
|
|
@@ -481,7 +481,7 @@ parent: `+((de=(ae=G.parent)==null?void 0:ae.parent)==null?void 0:de.id)+" - "+(
|
|
|
481
481
|
parent: "`+((de=(ae=G.parent)==null?void 0:ae.parent)==null?void 0:de.name)+'" ('+((ne=(ce=G.parent)==null?void 0:ce.parent)==null?void 0:ne.id)+")":"(not found) "+G.type+" "+G.id})),z.Logger.log("-----------------"),z.Logger.log("Old properties: ",Vn(i).map(G=>G.name+" ("+G.id+")")),z.Logger.log("New properties: ",Vn(p).map(G=>G.name+" ("+G.id+")"));const b=f.methods.find(G=>{var H;return((H=G.implements)==null?void 0:H.id)===re["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.methods.up.id}),g=f.methods.find(G=>{var H;return((H=G.implements)==null?void 0:H.id)===re["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.methods.down.id});z.Logger.log(`
|
|
482
482
|
Up inputs: `,b==null?void 0:b.inputs.map(G=>G.name+" ("+G.id+")")),z.Logger.log("Up method return statements:",b==null?void 0:b.returnStatements[0].outputs.map(G=>se(G,l)+" ("+G.id+")")),z.Logger.log(`
|
|
483
483
|
Down inputs: `,g==null?void 0:g.inputs.map(G=>G.name+" ("+G.id+")")),z.Logger.log("Down method return statements:",g==null?void 0:g.returnStatements[0].outputs.map(G=>se(G,l)+" ("+G.id+")"));const _=LFe(r.listAdded.map(G=>l.get(G.id))),$=a.x||0,L=a.y||0,j=600;return _.forEach((G,H)=>{var ae;const ie=(G.x===0?p.x+j*(H+1):G.x)+$,ee=p.y-800;let ue=(G.y===0?ee:G.y)+L;G.type===d.ReturnStatement&&((ae=G.parent)==null?void 0:ae.id)===E.id&&(ue+=800+70),G.metaSync({x:ie,y:ue},r)}),(k=h.defaultValue)==null||k.metaSync({editable:!1,deletable:!1},r),h.metaSync({editable:!1,deletable:!1},r),f}function aVi(l,p,i,r={}){const{updatedEntityVersion:a,newestOpenRowTransformer:c,lastPublishedEntityVersion:e}=p;return c?(X$(l,c,a,e,i),{rowTransformer:c}):{rowTransformer:Zke(l,a,e,i,r)}}function Hke(l,p={}){var h,m,E,b,g,_,$,L,j,k;const i={startEntity:l,visitedIds:new Set,order:new Map,lines:[],options:{indentSize:p.indentSize??2,maxDepth:p.maxDepth??50}};if(!Sg.includes(l.type))return`Error: Entity ${l.id} is not an executable entity. Found type: ${l.type}`;let r=l,a="",c="";if(l.type===d.FunctionDeclaration)if(((h=l.parent)==null?void 0:h.type)===d.DefinitionEntity)if(Wi(l.parent,Ie.CRON_JOB)){a="Cron Job ",r=l.parent;const G=(m=l.parent.properties)==null?void 0:m.find(ie=>{var ee;return!!((ee=ie.implements)!=null&&ee.find(ue=>ue.id===re["built-in-base-entity"].BUILT_IN_CRON_JOB_ENTITY.properties.expression.id))}),H=(E=G==null?void 0:G.defaultValue)==null?void 0:E.value;H&&(c+=` [Schedule: ${H}] `)}else if(Wi(l.parent,Ie.HTTP_ENDPOINT)){a="HTTP Endpoint ",r=l.parent;const G=(b=l.parent.properties)==null?void 0:b.find(ue=>{var ae;return!!((ae=ue.implements)!=null&&ae.find(de=>de.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id))}),H=(g=G==null?void 0:G.defaultValue)==null?void 0:g.value;H&&(c+=` [${H.toUpperCase()}]`);const ie=(_=l.parent.properties)==null?void 0:_.find(ue=>{var ae;return!!((ae=ue.implements)!=null&&ae.find(de=>de.id===re["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id))}),ee=($=ie==null?void 0:ie.defaultValue)==null?void 0:$.value;ee&&(c+=` ${ee} `)}else Wi(l.parent,Ie.SQL_ROW_TRANSFORMER)&&(a="SQL Row Transformer (SQL migration)",r=l.parent,((L=l.implements)==null?void 0:L.id)===re["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.methods.up.id?c=" - UP method":((j=l.implements)==null?void 0:j.id)===re["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.methods.down.id&&(c=" - DOWN method"));else((k=l.parent)==null?void 0:k.type)===d.Loop&&(a="body of Loop ",r=l.parent);i.lines.push(`CONTEXT: Logic Flow for ${a}"${se(r,r.project)}" (${r.id})${c}`),i.lines.push("");const e=new cn;return[l,...yt(l)].forEach(G=>{e.flatRecord[G.id]=G,e.order.push(G.id)}),e.orderEntities(),e.visit(G=>{i.order.set(G.id,i.order.size+1)}),zu(l,0,0,i,{onPrefix:p.onPrefix,onMissingValue:p.onMissingValue}),i.lines.join(`
|
|
484
|
-
`)}function zu(l,p,i,r,a={}){var b;if(p>r.options.maxDepth){ii(r,p,i,"... [MAX DEPTH REACHED]");return}let c=p,e=i;const f=[..."calls"in l&&Array.isArray(l.calls)?l.calls:[],..."successCalls"in l&&Array.isArray(l.successCalls)?l.successCalls:[],..."errorCalls"in l&&Array.isArray(l.errorCalls)?l.errorCalls:[]],h=f.length>0,m="errorCalls"in l&&Array.isArray(l.errorCalls)&&l.errorCalls.length>0,E="successCalls"in l&&Array.isArray(l.successCalls)&&l.successCalls.length>0;if(r.visitedIds.add(l.id),Z_(l,c,e,r,a),l.type===d.InternalCall){const g=se(l.parent,l.project),_=l.parent.id,$=l.parent.type,L=`${$?`${$} `:""}"${g}" (${_})`;ii(r,c+1,e+1,`Part of state instance of parent: ${L}`)}if(lp.includes(l.type)&&ii(r,c+1,h?e+1:e,`Error handling: ${l.catchesError?"YES (catches)":"NO (can throw)"}`),H_(l,c+1,h?e+1:e,r,a),oVi(l,c+1,h?e+1:e,r,a),l.type===d.Loop&&(ii(r,c+1,e+1,"LOOP BODY:"),l.body?zu(l.body,c+1,e+1,r,{onPrefix:a.onPrefix,onMissingValue:a.onMissingValue}):ii(r,c+1,e+1,"(Empty Body)")),((b=r.startEntity)==null?void 0:b.id)===l.id&&!f.length&&(ii(r,c,e," │ "),ii(r,c,e," ▼"),ii(r,c,e,"(Empty Logic Flow. No calls yet)")),"calls"in l&&Array.isArray(l.calls)&&l.calls.length>0){const g=l.calls,$=g.length>1?"PARALLEL ":"";g.forEach((L,j)=>{const k=j===g.length-1&&!m&&!E;let G=k?" └──> ":" ├──> ";const ie=`CALL #${r.order.get(L.id)||0} `;if(r.visitedIds.has(L.id)){ii(r,c,e," │ ");const ee=se(L,L.project);ii(r,c,e,`${G}${$}${ie}[MERGE/JOIN] Connects to (already rendered) Node: "${ee}" (${L.id})`);return}if(k)G=" ▼",ii(r,c,e," │ "),ii(r,c,e,G),zu(L,c,e,r,{onPrefix:a.onPrefix,onMissingValue:a.onMissingValue});else{ii(r,c,e," │ ");const ue=`${gT(c,e)}${G}${$}${ie}`;zu(L,c+1,e+1,r,{externalPrefix:ue,onPrefix:a.onPrefix,onMissingValue:a.onMissingValue})}})}if("errorCalls"in l&&Array.isArray(l.errorCalls)&&l.errorCalls.length>0){const g=l.errorCalls,$=g.length>1?"PARALLEL ":"";let L="ON ERROR";l.type===d.Condition&&(L="IF FALSE"),l.errorCalls.forEach((j,k)=>{const G=k===g.length-1&&!E;let H=G?" └──> ":" ├──> ";const ee=`CALL #${r.order.get(j.id)||0} `;if(r.visitedIds.has(j.id)){ii(r,c,e," │ ");const ue=se(j,j.project);ii(r,c,e,`${H}${$}${ee}${L} [MERGE/JOIN] Connects to existing Node (already rendered): "${ue}" (${j.id})`);return}if(G)H=" ▼",ii(r,c,e," │ "),ii(r,c,e,H),zu(j,c,e,r,{onPrefix:a.onPrefix,onMissingValue:a.onMissingValue});else{ii(r,c,e," │ ");const ae=`${gT(c,e)}${H}${$}${ee}${L} `;zu(j,c+1,e+1,r,{externalPrefix:ae,onPrefix:a.onPrefix,onMissingValue:a.onMissingValue})}})}if("successCalls"in l&&Array.isArray(l.successCalls)&&l.successCalls.length>0){const g=l.successCalls,$=g.length>1?"PARALLEL ":"";let L="ON SUCCESS";l.type===d.Condition&&(L="IF TRUE"),g.forEach((j,k)=>{const G=k===g.length-1;let H=G?" └──> ":" ├──> ";const ee=`CALL #${r.order.get(j.id)||0} `;if(r.visitedIds.has(j.id)){const ue=se(j,j.project);ii(r,c,e," │ "),ii(r,c,e,`${H}${$}${ee}${L} [MERGE/JOIN] Connects to existing Node (already rendered): "${ue}" (${j.id})`);return}if(G){H=" ▼",ii(r,c,e," │ "),ii(r,c,e,H);const ae=`${gT(c,e)}${$}${ee}${L} `;zu(j,c,e,r,{externalPrefix:ae,onPrefix:a.onPrefix,onMissingValue:a.onMissingValue})}else{ii(r,c,e," │ ");const ae=`${gT(c,e)}${H}${$}${ee}${L} `;zu(j,c+1,e+1,r,{externalPrefix:ae,onPrefix:a.onPrefix,onMissingValue:a.onMissingValue})}})}}function gT(l,p){let i="";for(let r=0;r<l;r++)r<p?i+=" │ ":i+=" ";return i}function ii(l,p,i,r){l.lines.push(`${gT(p,i)}${r}`)}function sVi(l,p){l.lines.push(p)}function lVi(l,p,i,r,a={}){var c,e;((c=l.declaration)==null?void 0:c.id)===re.condition["condition-group-and"].id?(ii(r,p,i,"NESTED AND (all conditions must be true)"),(l.andChildrenGroup||[]).forEach((f,h)=>{Z_(f,p+1,i,r,{onPrefix:a.onPrefix}),H_(f,p+1,i,r,a),h===(l.andChildrenGroup||[]).length-1||ii(r,p,i,"AND")})):((e=l.declaration)==null?void 0:e.id)===re.condition["condition-group-or"].id&&(ii(r,p,i,"NESTED OR (at least one condition must be true)"),(l.orChildrenGroup||[]).forEach((f,h)=>{Z_(f,p+1,i,r,{onPrefix:a.onPrefix}),H_(f,p+1,i,r,a),h===(l.orChildrenGroup||[]).length-1||ii(r,p,i,"OR")}))}function Z_(l,p,i,r,a={}){var E,b;const c=se(l,l.project);let e=Wa[l.type].shortSingular;switch(l.type){case d.FunctionDeclaration:e="Function Entry";break;case d.GlobalEvent:e="Function Entry";break;case d.Operation:e="Operation";break;case d.Condition:e="Condition";break;case d.Loop:e="Loop";break;case d.ReturnStatement:e="Return";break;case d.ContinueStatement:e="Continue";break;case d.BreakStatement:e="Break";break;case d.FunctionCall:e="Function Call";break;case d.InternalCall:e="Instance method Call";break;case d.VariableDeclaration:e="Variable Declaration";break;case d.VariableInstance:e="Variable Instance";break;case d.Search:e="DB Search";break}const h=`${a.onPrefix?a.onPrefix(l):""}[${e}] "${c}" (${l.id})`;let m=!1;if(Pr.includes(l.type)&&(l.calledByEntry.some(g=>g.calls.length>1)&&(m=!0),l.calledBySuccess.some(g=>g.successCalls.length>1)&&(m=!0),l.calledByError.some(g=>g.errorCalls.length>1)&&(m=!0)),typeof a.externalPrefix=="string")sVi(r,a.externalPrefix+h);else{const g=r.order.get(l.id)||0;let _=`${m?"PARALLEL ":""}CALL #${g} `;(l.type===d.Condition&&((E=l.parent)==null?void 0:E.type)===d.Condition||l.type===d.FunctionDeclaration&&((b=l.parent)==null?void 0:b.type)===d.Loop)&&(_=""),ii(r,p,i,`${_}${h}`)}if("description"in l&&l.description){const g=l.description.replace(/[\r\n]+/g," ").substring(0,100),_=l.description.length>100;g&&ii(r,p+1,i+1,`NOTE: "${g}${_?"...":""}"`)}l.type===d.Search&&"query"in l?ii(r,p+1,i+1,`QUERY: \`${(l.query||"").replace("{{::","{{::input-map-value:")}\``):l.type===d.Condition&&(l.declaration.id===re.condition["condition-group-and"].id||l.declaration.id===re.condition["condition-group-or"].id)&&lVi(l,p+1,i+1,r)}function H_(l,p,i,r,a={}){const c=a.onPrefix?a.onPrefix(l):"";if(Ft.includes(l.type)){l.inputs.length>0&&(ii(r,p,i,"INPUTS:"),l.inputs.forEach(E=>{const b=a.onPrefix?a.onPrefix(E):"",g=se(E,E.project),_=Xu(E,{prefix:`- ${b}"${g}" (${E.id}) Default value:`});ii(r,p+1,i,_),E.writesValues.length&&(ii(r,p+2,i,"WRITES:"),E.writesValues.forEach($=>{const L=se($,l.project);let j="";if($.type===d.InputMap){const k=$.parent,G=se(k,l.project);j=`${$.type}: "${L}" (${$.id}) of ${k.type}: "${G}"`}else j=`${$.type}: "${L}" (${$.id})`;ii(r,p+3,i,`-> ${j}`)}))}));return}if(pn.includes(l.type)&&(!Dt.includes(l.type)||!l.throws)){const m=Xu(l,{prefix:`${c}Main value assignment <-`});ii(r,p,i,m)}if(Dt.includes(l.type)){const m=l;if(m.throws){const E=a.onPrefix?a.onPrefix(l):"",b=Xu(m.throws,{prefix:`${E}"${se(m.throws,m.throws.project)}" (${m.throws.id}) THROWS ERROR value <-`});ii(r,p,i,b)}}const e=[];if(Nt.includes(l.type))e.push(...l.inputs||[]);else if(Dt.includes(l.type)){const m=l;e.push(...m.outputs||[])}e.sort((m,E)=>m.index-E.index);const f=e.filter(m=>ZT(m)),h=e.filter(m=>(!!m.readsValue||!!m.defaultValue)&&!ZT(m));if(h.length>0){let m="INPUTS";[..._t,...Dt].includes(l.type)&&(m="PROPERTIES ASSIGNED"),ii(r,p,i,`${m}:`),h.forEach(E=>{const b=a.onPrefix?a.onPrefix(E):"",g=Xu(E,{prefix:`${b}<-`});ii(r,p,i,` - "${se(E,E.project)}" (${E.id}) ${g}`)})}f.length>0&&(h.length||ii(r,p,i,"INPUTS:"),f.forEach(m=>{const E=a.onPrefix?a.onPrefix(m):"",b=Xu(m,{prefix:`${E}<-`,onMissingValue:a.onMissingValue,onPrefix:a.onPrefix});ii(r,p,i,` - "${se(m,m.project)}" (${m.id}) ${b}`)}))}function oVi(l,p,i,r,a={}){var c;if(Ki.includes(l.type)&&l.writesValues.length){let e="Writes values to";Nt.includes(l.type)?e="OUTPUT Full returned value read by":_t.includes(l.type)&&(e="OUTPUT Main (full) value written to"),ii(r,p,i,`${e}:`),l.writesValues.forEach(f=>{const h=se(f,l.project);let m="";if(f.type===d.InputMap){const E=f.parent,b=se(E,l.project);m=`${f.type}: "${h}" (${f.id}) of ${E.type}: "${b}"`}else m=`${f.type}: "${h}" (${f.id})`;ii(r,p+1,i,`-> ${m}`)})}lp.includes(l.type)&&(l.error&&(((c=l.error)==null?void 0:c.writesValues)||[]).length>0&&(ii(r,p,i,"CAUGHT ERROR value read by:"),l.error.writesValues.forEach(f=>{const h=se(f,l.project);let m="";if(f.type===d.InputMap){const E=f.parent,b=se(E,l.project);m=`${f.type}: "${h}" (${f.id}) of ${E.type}: "${b}"`}else m=`${f.type}: "${h}" (${f.id})`;ii(r,p+2,i,`-> ${m}`)})),l.outputs.length&&l.outputs.some(e=>e.writesValues.length>0)&&(ii(r,p,i,"DESTRUCT RETURNED PROPERTIES (from main outputted value):"),l.outputs.forEach(e=>{if(e.writesValues.length===0)return;const f=a.onPrefix?a.onPrefix(e):"",h=se(e,e.project);ii(r,p+1,i,`- ${f}"${h}" (${e.id}) WRITES:`),e.writesValues.forEach(m=>{const E=se(m,l.project);let b="";if(m.type===d.InputMap){const g=m.parent,_=se(g,l.project);b=`${m.type}: "${E}" (${m.id}) of ${g.type}: "${_}"`}else b=`${m.type}: "${E}" (${m.id})`;ii(r,p+2,i,`-> ${b}`)})})))}function dVi(l,p={nested:!1,omitTopLevelType:!1,firstLabel:"name",omitIdsFor:[],omitTypesFor:[],metadataIndent:1,ownMetadataIndent:1,omitFields:[],onlyFields:[]},i={}){const r={nested:p.nested??!1,omitTopLevelType:p.omitTopLevelType??!1,firstLabel:p.firstLabel??"name",omitIdsFor:p.omitIdsFor??[],omitTypesFor:p.omitTypesFor??[],metadataIndent:p.metadataIndent??1,omitFields:p.omitFields??[],onlyFields:p.onlyFields??[]},a=[...l.entities.reduce((f,h)=>{const m=h.methods.filter(E=>!E.extends);return[...f,...m]},[]),...l.functions,...l.events];let c="";const e=ei(l,{...r,nested:!0,omitTopLevelType:!1,firstLabel:r.firstLabel,omitIdsFor:r.omitIdsFor,omitTypesFor:r.omitTypesFor,metadataIndent:r.metadataIndent,omitFields:r.omitFields,onlyFields:r.onlyFields,onPrefix:p.onPrefix});if(c+=v1(e,i),a.length>0){const f=i.newLinesBetweenItems??3;c+=`
|
|
484
|
+
`)}function zu(l,p,i,r,a={}){var b;if(p>r.options.maxDepth){ii(r,p,i,"... [MAX DEPTH REACHED]");return}let c=p,e=i;const f=[..."calls"in l&&Array.isArray(l.calls)?l.calls:[],..."successCalls"in l&&Array.isArray(l.successCalls)?l.successCalls:[],..."errorCalls"in l&&Array.isArray(l.errorCalls)?l.errorCalls:[]],h=f.length>0,m="errorCalls"in l&&Array.isArray(l.errorCalls)&&l.errorCalls.length>0,E="successCalls"in l&&Array.isArray(l.successCalls)&&l.successCalls.length>0;if(r.visitedIds.add(l.id),Z_(l,c,e,r,a),l.type===d.InternalCall){const g=se(l.parent,l.project),_=l.parent.id,$=l.parent.type,L=`${$?`${$} `:""}"${g}" (${_})`;ii(r,c+1,h?e+1:e,`Part of state instance of parent: ${L}`)}if(lp.includes(l.type)&&ii(r,c+1,h?e+1:e,`Error handling: ${l.catchesError?"YES (catches)":"NO (can throw)"}`),H_(l,c+1,h?e+1:e,r,a),oVi(l,c+1,h?e+1:e,r,a),l.type===d.Loop&&(ii(r,c+1,e+1,"LOOP BODY:"),l.body?zu(l.body,c+1,e+1,r,{onPrefix:a.onPrefix,onMissingValue:a.onMissingValue}):ii(r,c+1,e+1,"(Empty Body)")),((b=r.startEntity)==null?void 0:b.id)===l.id&&!f.length&&(ii(r,c,e," │ "),ii(r,c,e," ▼"),ii(r,c,e,"(Empty Logic Flow. No calls yet)")),"calls"in l&&Array.isArray(l.calls)&&l.calls.length>0){const g=l.calls,$=g.length>1?"PARALLEL ":"";g.forEach((L,j)=>{const k=j===g.length-1&&!m&&!E;let G=k?" └──> ":" ├──> ";const ie=`CALL #${r.order.get(L.id)||0} `;if(r.visitedIds.has(L.id)){ii(r,c,e," │ ");const ee=se(L,L.project);ii(r,c,e,`${G}${$}${ie}[MERGE/JOIN] Connects to (already rendered) Node: "${ee}" (${L.id})`);return}if(k)G=" ▼",ii(r,c,e," │ "),ii(r,c,e,G),zu(L,c,e,r,{onPrefix:a.onPrefix,onMissingValue:a.onMissingValue});else{ii(r,c,e," │ ");const ue=`${gT(c,e)}${G}${$}${ie}`;zu(L,c+1,e+1,r,{externalPrefix:ue,onPrefix:a.onPrefix,onMissingValue:a.onMissingValue})}})}if("errorCalls"in l&&Array.isArray(l.errorCalls)&&l.errorCalls.length>0){const g=l.errorCalls,$=g.length>1?"PARALLEL ":"";let L="ON ERROR";l.type===d.Condition&&(L="IF FALSE"),l.errorCalls.forEach((j,k)=>{const G=k===g.length-1&&!E;let H=G?" └──> ":" ├──> ";const ee=`CALL #${r.order.get(j.id)||0} `;if(r.visitedIds.has(j.id)){ii(r,c,e," │ ");const ue=se(j,j.project);ii(r,c,e,`${H}${$}${ee}${L} [MERGE/JOIN] Connects to existing Node (already rendered): "${ue}" (${j.id})`);return}if(G)H=" ▼",ii(r,c,e," │ "),ii(r,c,e,H),zu(j,c,e,r,{onPrefix:a.onPrefix,onMissingValue:a.onMissingValue});else{ii(r,c,e," │ ");const ae=`${gT(c,e)}${H}${$}${ee}${L} `;zu(j,c+1,e+1,r,{externalPrefix:ae,onPrefix:a.onPrefix,onMissingValue:a.onMissingValue})}})}if("successCalls"in l&&Array.isArray(l.successCalls)&&l.successCalls.length>0){const g=l.successCalls,$=g.length>1?"PARALLEL ":"";let L="ON SUCCESS";l.type===d.Condition&&(L="IF TRUE"),g.forEach((j,k)=>{const G=k===g.length-1;let H=G?" └──> ":" ├──> ";const ee=`CALL #${r.order.get(j.id)||0} `;if(r.visitedIds.has(j.id)){const ue=se(j,j.project);ii(r,c,e," │ "),ii(r,c,e,`${H}${$}${ee}${L} [MERGE/JOIN] Connects to existing Node (already rendered): "${ue}" (${j.id})`);return}if(G){H=" ▼",ii(r,c,e," │ "),ii(r,c,e,H);const ae=`${gT(c,e)}${$}${ee}${L} `;zu(j,c,e,r,{externalPrefix:ae,onPrefix:a.onPrefix,onMissingValue:a.onMissingValue})}else{ii(r,c,e," │ ");const ae=`${gT(c,e)}${H}${$}${ee}${L} `;zu(j,c+1,e+1,r,{externalPrefix:ae,onPrefix:a.onPrefix,onMissingValue:a.onMissingValue})}})}}function gT(l,p){let i="";for(let r=0;r<l;r++)r<p?i+=" │ ":i+=" ";return i}function ii(l,p,i,r){l.lines.push(`${gT(p,i)}${r}`)}function sVi(l,p){l.lines.push(p)}function lVi(l,p,i,r,a={}){var c,e;((c=l.declaration)==null?void 0:c.id)===re.condition["condition-group-and"].id?(ii(r,p,i,"NESTED AND (all conditions must be true)"),(l.andChildrenGroup||[]).forEach((f,h)=>{Z_(f,p+1,i,r,{onPrefix:a.onPrefix}),H_(f,p+1,i,r,a),h===(l.andChildrenGroup||[]).length-1||ii(r,p,i,"AND")})):((e=l.declaration)==null?void 0:e.id)===re.condition["condition-group-or"].id&&(ii(r,p,i,"NESTED OR (at least one condition must be true)"),(l.orChildrenGroup||[]).forEach((f,h)=>{Z_(f,p+1,i,r,{onPrefix:a.onPrefix}),H_(f,p+1,i,r,a),h===(l.orChildrenGroup||[]).length-1||ii(r,p,i,"OR")}))}function Z_(l,p,i,r,a={}){var E,b;const c=se(l,l.project);let e=Wa[l.type].shortSingular;switch(l.type){case d.FunctionDeclaration:e="Function Entry";break;case d.GlobalEvent:e="Function Entry";break;case d.Operation:e="Operation";break;case d.Condition:e="Condition";break;case d.Loop:e="Loop";break;case d.ReturnStatement:e="Return";break;case d.ContinueStatement:e="Continue";break;case d.BreakStatement:e="Break";break;case d.FunctionCall:e="Function Call";break;case d.InternalCall:e="Instance method Call";break;case d.VariableDeclaration:e="Variable Declaration";break;case d.VariableInstance:e="Variable Instance";break;case d.Search:e="DB Search";break}const h=`${a.onPrefix?a.onPrefix(l):""}[${e}] "${c}" (${l.id})`;let m=!1;if(Pr.includes(l.type)&&(l.calledByEntry.some(g=>g.calls.length>1)&&(m=!0),l.calledBySuccess.some(g=>g.successCalls.length>1)&&(m=!0),l.calledByError.some(g=>g.errorCalls.length>1)&&(m=!0)),typeof a.externalPrefix=="string")sVi(r,a.externalPrefix+h);else{const g=r.order.get(l.id)||0;let _=`${m?"PARALLEL ":""}CALL #${g} `;(l.type===d.Condition&&((E=l.parent)==null?void 0:E.type)===d.Condition||l.type===d.FunctionDeclaration&&((b=l.parent)==null?void 0:b.type)===d.Loop)&&(_=""),ii(r,p,i,`${_}${h}`)}if("description"in l&&l.description){const g=l.description.replace(/[\r\n]+/g," ").substring(0,100),_=l.description.length>100;g&&ii(r,p+1,i+1,`NOTE: "${g}${_?"...":""}"`)}l.type===d.Search&&"query"in l?ii(r,p+1,i+1,`QUERY: \`${(l.query||"").replace("{{::","{{::input-map-value:")}\``):l.type===d.Condition&&(l.declaration.id===re.condition["condition-group-and"].id||l.declaration.id===re.condition["condition-group-or"].id)&&lVi(l,p+1,i+1,r)}function H_(l,p,i,r,a={}){const c=a.onPrefix?a.onPrefix(l):"";if(Ft.includes(l.type)){l.inputs.length>0&&(ii(r,p,i,"INPUTS:"),l.inputs.forEach(E=>{const b=a.onPrefix?a.onPrefix(E):"",g=se(E,E.project),_=Xu(E,{prefix:`- ${b}"${g}" (${E.id}) Default value:`});ii(r,p+1,i,_),E.writesValues.length&&(ii(r,p+2,i,"WRITES:"),E.writesValues.forEach($=>{const L=se($,l.project);let j="";if($.type===d.InputMap){const k=$.parent,G=se(k,l.project);j=`${$.type}: "${L}" (${$.id}) of ${k.type}: "${G}"`}else j=`${$.type}: "${L}" (${$.id})`;ii(r,p+3,i,`-> ${j}`)}))}));return}if(pn.includes(l.type)&&(!Dt.includes(l.type)||!l.throws)){const m=Xu(l,{prefix:`${c}Main value assignment <-`});ii(r,p,i,m)}if(Dt.includes(l.type)){const m=l;if(m.throws){const E=a.onPrefix?a.onPrefix(l):"",b=Xu(m.throws,{prefix:`${E}"${se(m.throws,m.throws.project)}" (${m.throws.id}) THROWS ERROR value <-`});ii(r,p,i,b)}}const e=[];if(Nt.includes(l.type))e.push(...l.inputs||[]);else if(Dt.includes(l.type)){const m=l;e.push(...m.outputs||[])}e.sort((m,E)=>m.index-E.index);const f=e.filter(m=>ZT(m)),h=e.filter(m=>(!!m.readsValue||!!m.defaultValue)&&!ZT(m));if(h.length>0){let m="INPUTS";[..._t,...Dt].includes(l.type)&&(m="PROPERTIES ASSIGNED"),ii(r,p,i,`${m}:`),h.forEach(E=>{const b=a.onPrefix?a.onPrefix(E):"",g=Xu(E,{prefix:`${b}<-`});ii(r,p,i,` - "${se(E,E.project)}" (${E.id}) ${g}`)})}f.length>0&&(h.length||ii(r,p,i,"INPUTS:"),f.forEach(m=>{const E=a.onPrefix?a.onPrefix(m):"",b=Xu(m,{prefix:`${E}<-`,onMissingValue:a.onMissingValue,onPrefix:a.onPrefix});ii(r,p,i,` - "${se(m,m.project)}" (${m.id}) ${b}`)}))}function oVi(l,p,i,r,a={}){var c;if(Ki.includes(l.type)&&l.writesValues.length){let e="Writes values to";Nt.includes(l.type)?e="OUTPUT Full returned value read by":_t.includes(l.type)&&(e="OUTPUT Main (full) value written to"),ii(r,p,i,`${e}:`),l.writesValues.forEach(f=>{const h=se(f,l.project);let m="";if(f.type===d.InputMap){const E=f.parent,b=se(E,l.project);m=`${f.type}: "${h}" (${f.id}) of ${E.type}: "${b}"`}else m=`${f.type}: "${h}" (${f.id})`;ii(r,p+1,i,`-> ${m}`)})}lp.includes(l.type)&&(l.error&&(((c=l.error)==null?void 0:c.writesValues)||[]).length>0&&(ii(r,p,i,"CAUGHT ERROR value read by:"),l.error.writesValues.forEach(f=>{const h=se(f,l.project);let m="";if(f.type===d.InputMap){const E=f.parent,b=se(E,l.project);m=`${f.type}: "${h}" (${f.id}) of ${E.type}: "${b}"`}else m=`${f.type}: "${h}" (${f.id})`;ii(r,p+2,i,`-> ${m}`)})),l.outputs.length&&l.outputs.some(e=>e.writesValues.length>0)&&(ii(r,p,i,"DESTRUCT RETURNED PROPERTIES (from main outputted value):"),l.outputs.forEach(e=>{if(e.writesValues.length===0)return;const f=a.onPrefix?a.onPrefix(e):"",h=se(e,e.project);ii(r,p+1,i,`- ${f}"${h}" (${e.id}) WRITES:`),e.writesValues.forEach(m=>{const E=se(m,l.project);let b="";if(m.type===d.InputMap){const g=m.parent,_=se(g,l.project);b=`${m.type}: "${E}" (${m.id}) of ${g.type}: "${_}"`}else b=`${m.type}: "${E}" (${m.id})`;ii(r,p+2,i,`-> ${b}`)})})))}function dVi(l,p={nested:!1,omitTopLevelType:!1,firstLabel:"name",omitIdsFor:[],omitTypesFor:[],metadataIndent:1,ownMetadataIndent:1,omitFields:[],onlyFields:[]},i={}){const r={nested:p.nested??!1,omitTopLevelType:p.omitTopLevelType??!1,firstLabel:p.firstLabel??"name",omitIdsFor:p.omitIdsFor??[],omitTypesFor:p.omitTypesFor??[],metadataIndent:p.metadataIndent??1,omitFields:p.omitFields??[],onlyFields:p.onlyFields??[]},a=[...l.entities.reduce((f,h)=>{const m=h.methods.filter(E=>!E.extends);return[...f,...m]},[]),...l.functions,...l.events];let c="";const e=ei(l,{...r,nested:!0,omitTopLevelType:!1,firstLabel:r.firstLabel,omitIdsFor:r.omitIdsFor,omitTypesFor:r.omitTypesFor,metadataIndent:r.metadataIndent,omitFields:r.omitFields,onlyFields:r.onlyFields,onPrefix:p.onPrefix});if(c+=v1(e,i),a.length>0){const f=i.newLinesBetweenItems??3;c+=`
|
|
485
485
|
`.repeat(f),c+=`GLOBAL ENTRY POINTS CALL-STACKS:
|
|
486
486
|
|
|
487
487
|
`;for(let h=0;h<a.length;h++){const m=a[h],E=Hke(m,{onPrefix:p.onPrefix});c+=E,h<a.length-1&&(c+=`
|
package/dist/index.js
CHANGED
|
@@ -125746,7 +125746,13 @@ class wn {
|
|
|
125746
125746
|
return p;
|
|
125747
125747
|
}
|
|
125748
125748
|
move(p, i) {
|
|
125749
|
-
this.onlyEntities.includes(p)
|
|
125749
|
+
if (this.onlyEntities.includes(p)) {
|
|
125750
|
+
if (!this.changeSet)
|
|
125751
|
+
throw new Error(
|
|
125752
|
+
"Change set is not defined for this area, cannot move entity"
|
|
125753
|
+
);
|
|
125754
|
+
p.metaSync(i, this.changeSet);
|
|
125755
|
+
}
|
|
125750
125756
|
}
|
|
125751
125757
|
// Create new areas for the children of this area
|
|
125752
125758
|
addChild(p) {
|
|
@@ -190854,7 +190860,7 @@ function Ou(l, p, i, r, a = {}) {
|
|
|
190854
190860
|
ri(
|
|
190855
190861
|
r,
|
|
190856
190862
|
c + 1,
|
|
190857
|
-
e + 1,
|
|
190863
|
+
h ? e + 1 : e,
|
|
190858
190864
|
`Part of state instance of parent: ${L}`
|
|
190859
190865
|
);
|
|
190860
190866
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elyx-code/project-logic-tree",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6843",
|
|
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",
|