@elyx-code/project-logic-tree 0.0.6869 → 0.0.6870

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -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[Ck]=this[Ck]={accessors:{}}).accessors,a=this.prototype;function c(e){const f=P0(e);r[f]||(vgi(a,e),r[f]=!0)}return qe.isArray(p)?p.forEach(c):c(p),this}}d1.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);qe.reduceDescriptors(d1.prototype,({value:l},p)=>{let i=p[0].toUpperCase()+p.slice(1);return{get:()=>l,set(r){this[i]=r}}});qe.freezeMethods(d1);const Sl=d1;function jO(l,p){const i=this||Fx,r=p||i,a=Sl.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 SLe(l){return!!(l&&l.__CANCEL__)}function Cm(l,p,i){Pi.call(this,l??"canceled",Pi.ERR_CANCELED,p,i),this.name="CanceledError"}qe.inherits(Cm,Pi,{__CANCEL__:!0});function ZLe(l,p,i){const r=i.config.validateStatus;!i.status||!r||r(i.status)?l(i):p(new Pi("Request failed with status code "+i.status,[Pi.ERR_BAD_REQUEST,Pi.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function Egi(l){const p=/^([-+\w]{1,25})(:?\/\/|:)/.exec(l);return p&&p[1]||""}function bgi(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,A=0;for(;b!==a;)A+=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(A*1e3/_):void 0}}function Agi(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 AI=(l,p,i=3)=>{let r=0;const a=bgi(50,250);return Agi(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)},Ok=(l,p)=>{const i=l!=null;return[r=>p[0]({lengthComputable:i,total:l,loaded:r}),p[1]]},_k=l=>(...p)=>qe.asap(()=>l(...p)),Igi=ha.hasStandardBrowserEnv?((l,p)=>i=>(i=new URL(i,ha.origin),l.protocol===i.protocol&&l.host===i.host&&(p||l.port===i.port)))(new URL(ha.origin),ha.navigator&&/(msie|trident)/i.test(ha.navigator.userAgent)):()=>!0,ggi=ha.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 Rgi(l){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(l)}function Dgi(l,p){return p?l.replace(/\/?\/$/,"")+"/"+p.replace(/^\/+/,""):l}function HLe(l,p,i){let r=!Rgi(p);return l&&(r||i==!1)?Dgi(l,p):p}const Vk=l=>l instanceof Sl?{...l}:l;function ff(l,p){p=p||{};const i={};function r(m,E,b,A){return qe.isPlainObject(m)&&qe.isPlainObject(E)?qe.merge.call({caseless:A},m,E):qe.isPlainObject(E)?qe.merge({},E):qe.isArray(E)?E.slice():E}function a(m,E,b,A){if(qe.isUndefined(E)){if(!qe.isUndefined(m))return r(void 0,m,b,A)}else return r(m,E,b,A)}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(Vk(m),Vk(E),b,!0)};return qe.forEach(Object.keys({...l,...p}),function(E){const b=h[E]||a,A=b(l[E],p[E],E);qe.isUndefined(A)&&b!==f||(i[E]=A)}),i}const WLe=l=>{const p=ff({},l);let{data:i,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:c,headers:e,auth:f}=p;if(p.headers=e=Sl.from(e),p.url=FLe(HLe(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(ha.hasStandardBrowserEnv||ha.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(ha.hasStandardBrowserEnv&&(r&&qe.isFunction(r)&&(r=r(p)),r||r!==!1&&Igi(p.url))){const h=a&&c&&ggi.read(c);h&&e.set(a,h)}return p},wgi=typeof XMLHttpRequest<"u",Cgi=wgi&&function(l){return new Promise(function(i,r){const a=WLe(l);let c=a.data;const e=Sl.from(a.headers).normalize();let{responseType:f,onUploadProgress:h,onDownloadProgress:m}=a,E,b,A,_,N;function P(){_&&_(),N&&N(),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 M(){if(!j)return;const S=Sl.from("getAllResponseHeaders"in j&&j.getAllResponseHeaders()),ee={data:!f||f==="text"||f==="json"?j.responseText:j.response,status:j.status,statusText:j.statusText,headers:S,config:l,request:j};ZLe(function(ie){i(ie),P()},function(ie){r(ie),P()},ee),j=null}"onloadend"in j?j.onloadend=M:j.onreadystatechange=function(){!j||j.readyState!==4||j.status===0&&!(j.responseURL&&j.responseURL.indexOf("file:")===0)||setTimeout(M)},j.onabort=function(){j&&(r(new Pi("Request aborted",Pi.ECONNABORTED,l,j)),j=null)},j.onerror=function(re){const ee=re&&re.message?re.message:"Network Error",ue=new Pi(ee,Pi.ERR_NETWORK,l,j);ue.event=re||null,r(ue),j=null},j.ontimeout=function(){let re=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const ee=a.transitional||KLe;a.timeoutErrorMessage&&(re=a.timeoutErrorMessage),r(new Pi(re,ee.clarifyTimeoutError?Pi.ETIMEDOUT:Pi.ECONNABORTED,l,j)),j=null},c===void 0&&e.setContentType(null),"setRequestHeader"in j&&qe.forEach(e.toJSON(),function(re,ee){j.setRequestHeader(ee,re)}),qe.isUndefined(a.withCredentials)||(j.withCredentials=!!a.withCredentials),f&&f!=="json"&&(j.responseType=a.responseType),m&&([A,N]=AI(m,!0),j.addEventListener("progress",A)),h&&j.upload&&([b,_]=AI(h),j.upload.addEventListener("progress",b),j.upload.addEventListener("loadend",_)),(a.cancelToken||a.signal)&&(E=S=>{j&&(r(!S||S.type?new Cm(null,l,j):S),j.abort(),j=null)},a.cancelToken&&a.cancelToken.subscribe(E),a.signal&&(a.signal.aborted?E():a.signal.addEventListener("abort",E)));const G=Egi(a.url);if(G&&ha.protocols.indexOf(G)===-1){r(new Pi("Unsupported protocol "+G+":",Pi.ERR_BAD_REQUEST,l));return}j.send(c||null)})},Ogi=(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 Pi?E:new Cm(E instanceof Error?E.message:E))}};let e=p&&setTimeout(()=>{e=null,c(new Pi(`timeout ${p} of ms exceeded`,Pi.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}},_gi=Ogi,Vgi=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},Pgi=async function*(l,p){for await(const i of Ngi(l))yield*Vgi(i,p)},Ngi=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()}},Pk=(l,p,i,r)=>{const a=Pgi(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 A=c+=b;i(A)}h.enqueue(new Uint8Array(E))}catch(m){throw f(m),m}},cancel(h){return f(h),a.return()}},{highWaterMark:2})},Nk=64*1024,{isFunction:UA}=qe,xgi=(({Request:l,Response:p})=>({Request:l,Response:p}))(qe.global),{ReadableStream:xk,TextEncoder:$k}=qe.global,Lk=(l,...p)=>{try{return!!l(...p)}catch{return!1}},$gi=l=>{l=qe.merge.call({skipUndefined:!0},xgi,l);const{fetch:p,Request:i,Response:r}=l,a=p?UA(p):typeof fetch=="function",c=UA(i),e=UA(r);if(!a)return!1;const f=a&&UA(xk),h=a&&(typeof $k=="function"?(N=>P=>N.encode(P))(new $k):async N=>new Uint8Array(await new i(N).arrayBuffer())),m=c&&f&&Lk(()=>{let N=!1;const P=new i(ha.origin,{body:new xk,method:"POST",get duplex(){return N=!0,"half"}}).headers.has("Content-Type");return N&&!P}),E=e&&f&&Lk(()=>qe.isReadableStream(new r("").body)),b={stream:E&&(N=>N.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(N=>{!b[N]&&(b[N]=(P,j)=>{let M=P&&P[N];if(M)return M.call(P);throw new Pi(`Response type '${N}' is not supported`,Pi.ERR_NOT_SUPPORT,j)})});const A=async N=>{if(N==null)return 0;if(qe.isBlob(N))return N.size;if(qe.isSpecCompliantForm(N))return(await new i(ha.origin,{method:"POST",body:N}).arrayBuffer()).byteLength;if(qe.isArrayBufferView(N)||qe.isArrayBuffer(N))return N.byteLength;if(qe.isURLSearchParams(N)&&(N=N+""),qe.isString(N))return(await h(N)).byteLength},_=async(N,P)=>{const j=qe.toFiniteNumber(N.getContentLength());return j??A(P)};return async N=>{let{url:P,method:j,data:M,signal:G,cancelToken:S,timeout:re,onDownloadProgress:ee,onUploadProgress:ue,responseType:ie,headers:se,withCredentials:de="same-origin",fetchOptions:z}=WLe(N),X=p||fetch;ie=ie?(ie+"").toLowerCase():"text";let ce=_gi([G,S&&S.toAbortSignal()],re),oe=null;const me=ce&&ce.unsubscribe&&(()=>{ce.unsubscribe()});let ve;try{if(ue&&m&&j!=="get"&&j!=="head"&&(ve=await _(se,M))!==0){let et=new i(P,{method:"POST",body:M,duplex:"half"}),Ze;if(qe.isFormData(M)&&(Ze=et.headers.get("content-type"))&&se.setContentType(Ze),et.body){const[Xe,Dt]=Ok(ve,AI(_k(ue)));M=Pk(et.body,Nk,Xe,Dt)}}qe.isString(de)||(de=de?"include":"omit");const we=c&&"credentials"in i.prototype,Re={...z,signal:ce,method:j.toUpperCase(),headers:se.normalize().toJSON(),body:M,duplex:"half",credentials:we?de:void 0};oe=c&&new i(P,Re);let xe=await(c?X(oe,z):X(P,Re));const je=E&&(ie==="stream"||ie==="response");if(E&&(ee||je&&me)){const et={};["status","statusText","headers"].forEach(Mt=>{et[Mt]=xe[Mt]});const Ze=qe.toFiniteNumber(xe.headers.get("content-length")),[Xe,Dt]=ee&&Ok(Ze,AI(_k(ee),!0))||[];xe=new r(Pk(xe.body,Nk,Xe,()=>{Dt&&Dt(),me&&me()}),et)}ie=ie||"text";let Se=await b[qe.findKey(b,ie)||"text"](xe,N);return!je&&me&&me(),await new Promise((et,Ze)=>{ZLe(et,Ze,{data:Se,headers:Sl.from(xe.headers),status:xe.status,statusText:xe.statusText,config:N,request:oe})})}catch(we){throw me&&me(),we&&we.name==="TypeError"&&/Load failed|fetch/i.test(we.message)?Object.assign(new Pi("Network Error",Pi.ERR_NETWORK,N,oe),{cause:we.cause||we}):Pi.from(we,we&&we.code,N,oe)}}},Lgi=new Map,zLe=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=Lgi;for(;f--;)h=c[f],m=E.get(h),m===void 0&&E.set(h,m=f?new Map:$gi(p)),E=m;return m};zLe();const Kx={http:YIi,xhr:Cgi,fetch:{get:zLe}};qe.forEach(Kx,(l,p)=>{if(l){try{Object.defineProperty(l,"name",{value:p})}catch{}Object.defineProperty(l,"adapterName",{value:p})}});const Bk=l=>`- ${l}`,Bgi=l=>qe.isFunction(l)||l===null||l===!1;function Mgi(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,!Bgi(r)&&(a=Kx[(f=String(r)).toLowerCase()],a===void 0))throw new Pi(`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(Bk).join(`
53
53
  `):" "+Bk(e[0]):"as no adapter specified";throw new Pi("There is no suitable adapter to dispatch the request "+f,"ERR_NOT_SUPPORT")}return a}const YLe={getAdapter:Mgi,adapters:Kx};function kO(l){if(l.cancelToken&&l.cancelToken.throwIfRequested(),l.signal&&l.signal.aborted)throw new Cm(null,l)}function Mk(l){return kO(l),l.headers=Sl.from(l.headers),l.data=jO.call(l,l.transformRequest),["post","put","patch"].indexOf(l.method)!==-1&&l.headers.setContentType("application/x-www-form-urlencoded",!1),YLe.getAdapter(l.adapter||Fx.adapter,l)(l).then(function(r){return kO(l),r.data=jO.call(l,l.transformResponse,r),r.headers=Sl.from(r.headers),r},function(r){return SLe(r)||(kO(l),r&&r.response&&(r.response.data=jO.call(l,l.transformResponse,r.response),r.response.headers=Sl.from(r.response.headers))),Promise.reject(r)})}const JLe="1.13.2",u1={};["object","boolean","number","function","string","symbol"].forEach((l,p)=>{u1[l]=function(r){return typeof r===l||"a"+(p<1?"n ":" ")+l}});const Gk={};u1.transitional=function(p,i,r){function a(c,e){return"[Axios v"+JLe+"] Transitional option '"+c+"'"+e+(r?". "+r:"")}return(c,e,f)=>{if(p===!1)throw new Pi(a(e," has been removed"+(i?" in "+i:"")),Pi.ERR_DEPRECATED);return i&&!Gk[e]&&(Gk[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}};u1.spelling=function(p){return(i,r)=>(console.warn(`${r} is likely a misspelling of ${p}`),!0)};function Ggi(l,p,i){if(typeof l!="object")throw new Pi("options must be an object",Pi.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 Pi("option "+c+" must be "+h,Pi.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new Pi("Unknown option "+c,Pi.ERR_BAD_OPTION)}}const JA={assertOptions:Ggi,validators:u1},qo=JA.validators;class II{constructor(p){this.defaults=p||{},this.interceptors={request:new wk,response:new wk}}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=ff(this.defaults,i);const{transitional:r,paramsSerializer:a,headers:c}=i;r!==void 0&&JA.assertOptions(r,{silentJSONParsing:qo.transitional(qo.boolean),forcedJSONParsing:qo.transitional(qo.boolean),clarifyTimeoutError:qo.transitional(qo.boolean)},!1),a!=null&&(qe.isFunction(a)?i.paramsSerializer={serialize:a}:JA.assertOptions(a,{encode:qo.function,serialize:qo.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),JA.assertOptions(i,{baseUrl:qo.spelling("baseURL"),withXsrfToken:qo.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"],N=>{delete c[N]}),i.headers=Sl.concat(e,c);const f=[];let h=!0;this.interceptors.request.forEach(function(P){typeof P.runWhen=="function"&&P.runWhen(i)===!1||(h=h&&P.synchronous,f.unshift(P.fulfilled,P.rejected))});const m=[];this.interceptors.response.forEach(function(P){m.push(P.fulfilled,P.rejected)});let E,b=0,A;if(!h){const N=[Mk.bind(this),void 0];for(N.unshift(...f),N.push(...m),A=N.length,E=Promise.resolve(i);b<A;)E=E.then(N[b++],N[b++]);return E}A=f.length;let _=i;for(;b<A;){const N=f[b++],P=f[b++];try{_=N(_)}catch(j){P.call(this,j);break}}try{E=Mk.call(this,_)}catch(N){return Promise.reject(N)}for(b=0,A=m.length;b<A;)E=E.then(m[b++],m[b++]);return E}getUri(p){p=ff(this.defaults,p);const i=HLe(p.baseURL,p.url,p.allowAbsoluteUrls);return FLe(i,p.params,p.paramsSerializer)}}qe.forEach(["delete","get","head","options"],function(p){II.prototype[p]=function(i,r){return this.request(ff(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(ff(f||{},{method:p,headers:r?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}II.prototype[p]=i(),II.prototype[p+"Form"]=i(!0)});const QA=II;class qx{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 Cm(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 qx(function(a){p=a}),cancel:p}}}const jgi=qx;function kgi(l){return function(i){return l.apply(null,i)}}function Ugi(l){return qe.isObject(l)&&l.isAxiosError===!0}const w_={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(w_).forEach(([l,p])=>{w_[p]=l});const Fgi=w_;function QLe(l){const p=new QA(l),i=VLe(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 QLe(ff(l,a))},i}const Ln=QLe(Fx);Ln.Axios=QA;Ln.CanceledError=Cm;Ln.CancelToken=jgi;Ln.isCancel=SLe;Ln.VERSION=JLe;Ln.toFormData=o1;Ln.AxiosError=Pi;Ln.Cancel=Ln.CanceledError;Ln.all=function(p){return Promise.all(p)};Ln.spread=kgi;Ln.isAxiosError=Ugi;Ln.mergeConfig=ff;Ln.AxiosHeaders=Sl;Ln.formToJSON=l=>qLe(qe.isHTMLForm(l)?new FormData(l):l);Ln.getAdapter=YLe.getAdapter;Ln.HttpStatusCode=Fgi;Ln.default=Ln;const Kgi=Ln;class XLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(la.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]};Y.Logger.log("Axios request config: ",e);const f=await Kgi(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 e2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.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)});Y.Logger.log("Inputs for entity validation: ",a);const e=tD(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 Ua=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 t2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY,version:"1.0.0",description:"Entity read-key operation implementation module (top-level)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.ReadKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ua(r),e=C_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class i2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY,version:"1.0.0",description:"Entity write-key operation implementation module (top-level, immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.WriteKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ua(r),f=O_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 Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY,version:"1.0.0",description:"Entity delete-key operation implementation module (top-level, immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.DeleteKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ua(r),e=__e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class n2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY,version:"1.0.0",description:"Entity read-nested-key operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.ReadNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ua(r),f=V_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class a2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.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:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.WriteNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ua(r),f=P_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class s2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.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:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.WriteSafeNestedKeyRecursively);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ua(r),f=N_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class l2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY,version:"1.0.0",description:"Entity delete-nested-key operation implementation module (immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.DeleteNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ua(r),e=x_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class o2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY,version:"1.0.0",description:"Object has-key (top-level property present?)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.HasKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ua(r),e=$_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class d2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object key-value-equals (top-level property strict equality)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.KeyValueEquals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Ua(r),f=L_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class u2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY,version:"1.0.0",description:"Object has-nested-key (path present?)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.HasNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ua(r),e=B_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class p2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object nested-key-value-equals (path strict equality)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.NestedKeyValueEquals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Ua(r),f=M_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 Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE,version:"1.0.0",description:"Object is-instance-of-type (DefinitionEntity-based runtime check)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.IsInstanceOfType);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m,E,b,A,_;try{const N=((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),P=(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(!P)throw new TypeError("IsInstanceOfType expects a non-null input value.");if(!j)throw new TypeError("IsInstanceOfType expects a valid expectedType input.");if(!N)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 M=N.getDataType(null);if(((A=M==null?void 0:M.entity)==null?void 0:A.type)!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType cannot determine the data type of the input value.");let G=!1;return((_=M==null?void 0:M.entity)==null?void 0:_.id)!==(j==null?void 0:j.id)?G=!1:tD(M==null?void 0:M.entity).safeParse(P).success?G=!0:G=!1,{value:U.Success,error:null,result:G}}catch(N){return{value:U.UnhandledError,error:N,result:null}}}})}}class f2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE,version:"1.0.0",description:"Object merge operation implementation module (immutable, shallow merge with right-precedence)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Le.Merge);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Ua(r),c=G_e(...a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class y2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS,version:"1.0.0",description:"Object keys operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Le.Keys);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ua(r),c=j_e(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class h2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES,version:"1.0.0",description:"Object values operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Le.Values);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ua(r),c=k_e(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class m2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES,version:"1.0.0",description:"Object entries operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Le.Entries);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ua(r),c=U_e(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}let _s=null;try{_s=require("crypto")}catch{}const VT=typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto:_s&&_s.webcrypto?_s.webcrypto:null,sp=VT?VT.subtle:null;function KT(l){const p=new ArrayBuffer(l.byteLength);return new Uint8Array(p).set(l),p}function dn(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 Co(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 T2e=l=>dn(l,"base64"),v2e=(l,p)=>{const i=l instanceof Uint8Array?l:dn(String(l),p||"utf8");return Co(i,"base64")},hh=(l,p)=>{const i=l instanceof Uint8Array?l:dn(String(l),p||"utf8");return Co(i,"base64url")},yf=l=>dn(l,"base64url"),E2e=(l,p)=>{const i=l instanceof Uint8Array?l:dn(String(l),p||"utf8");return Co(i,"hex")},b2e=l=>dn(l,"hex");function Sx(l){if(VT&&VT.getRandomValues){const p=new Uint8Array(l);return VT.getRandomValues(p),p}if(_s&&_s.randomBytes)return new Uint8Array(_s.randomBytes(l));throw new Error("Secure random not available")}function p1(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 A2e(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=dn(l??"",a),f=dn(p??"",c);return p1(e,f)}async function I2e(l,p){if(sp){const i=await sp.digest({name:l},KT(p));return new Uint8Array(i)}if(_s){const i=l.replace("SHA-","sha"),r=_s.createHash(i);return r.update(Buffer.from(p)),new Uint8Array(r.digest())}throw new Error("Hash not available")}async function g2e(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=dn(p??"",c),h=await I2e(a,f);return Co(h,e)}async function c1(l,p,i){if(sp){const r=await sp.importKey("raw",KT(p),{name:"HMAC",hash:{name:l}},!1,["sign"]),a=await sp.sign("HMAC",r,KT(i));return new Uint8Array(a)}if(_s){const r=`sha${l.split("-")[1]}`,a=_s.createHmac(r,Buffer.from(p));return a.update(Buffer.from(i)),new Uint8Array(a.digest())}throw new Error("HMAC not available")}async function R2e(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=dn(l??"",f),b=dn(p??"",h),A=await c1(e,E,b);return Co(A,m)}async function f1(l,p,{iterations:i,length:r,hashAlg:a="SHA-256"}){if(sp){const c=await sp.importKey("raw",KT(l),"PBKDF2",!1,["deriveBits"]),e=await sp.deriveBits({name:"PBKDF2",salt:KT(p),iterations:i,hash:a},c,r*8);return new Uint8Array(e)}if(_s){const c=a==="SHA-512"?"sha512":"sha256";return await new Promise((e,f)=>{_s.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 D2e(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),A=Math.max(1,Number(r)||32),_=a??"SHA-256",N=dn(l??"",h),P=dn(p??"",m),j=await f1(N,P,{iterations:b,length:A,hashAlg:_});return Co(j,E)}async function w2e(l,p=Sx(16),i=21e4,r=32,a="SHA-256"){const c=dn(l,"utf8"),e=await f1(c,p,{iterations:i,length:r,hashAlg:a}),f=hh(p),h=hh(e);return`pbkdf2$${a.toLowerCase()}$${i}$${f}$${h}`}async function C2e(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=yf(i[3]),e=yf(i[4]),f=r.includes("512")?"SHA-512":"SHA-256",h=await f1(dn(l,"utf8"),c,{iterations:a,length:e.length,hashAlg:f});return p1(h,e)}async function O2e(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?dn(a,m):void 0;return await w2e(String(l??""),E,e,f,h)}function jk(l){return hh(dn(JSON.stringify(l),"utf8"))}function gI(l){try{return JSON.parse(Co(yf(l),"utf8"))}catch{return null}}async function _2e(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},A=Math.floor(Date.now()/1e3),_={...l||{}};r&&(_.iat=A),typeof a=="number"&&(_.exp=A+a),typeof c=="number"&&(_.nbf=A+c),e&&(_.iss=e),f&&(_.sub=f),h&&(_.aud=h),m&&(_.jti=m);const N=jk(b),P=jk(_),j=dn(`${N}.${P}`,"utf8"),G=await c1(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,j),S=hh(G);return`${N}.${P}.${S}`}async function V2e(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 _=dn(p??"",b??"utf8");return await _2e(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 P2e(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=gI(f),b=gI(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 A=dn(`${f}.${h}`,"utf8"),N=await c1(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,A),P=yf(m);if(!p1(N,P))return{valid:!1,header:E,payload:b,reason:"Bad signature"};const j=Math.floor(Date.now()/1e3),M=Math.max(0,Number(e)||0);if(b.nbf!=null&&j+M<Number(b.nbf))return{valid:!1,header:E,payload:b,reason:"Not before"};if(b.exp!=null&&j-M>=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)+M?{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 N2e(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=dn(p??"",f??"utf8");return await P2e(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 x2e(l){const[p,i,r]=String(l).split(".");return{header:p?gI(p):null,payload:i?gI(i):null,signature:r?yf(r):new Uint8Array}}function $2e(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}=x2e(String(l??"")),e=Co(c,i);return{header:r,payload:a,signature:e}}class L2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES,version:"1.0.0",description:"Randomness generate random bytes operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(nt.GenerateRandomBytes);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)}),e=Math.max(0,Number(a)||0),f=c??"base64url",h=Sx(e),m=Co(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 B2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.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=c_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 M2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomFloat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=e1();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 G2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.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=Ax(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 j2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.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=Ix(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 k2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.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=y_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 U2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.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=gx(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 F2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.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=Rx(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 K2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomUUIDv4);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=ap();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 q2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{Y.Logger.log("Initializing Random Generate Short Identifier Module");const r=i.find(a=>a.contextType===ae.Logic);if(r){Y.Logger.log("Project state found, setting up operation");const a=r.get(nt.GenerateShortIdentifier);a?(Y.Logger.log("Operation found, setting autoexecutable and implementation"),a.autoexecutable=!0,a.implementation=this.module.main):Y.Logger.warn("Operation generate-short-identifier not found in project state")}else Y.Logger.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,r)=>{try{const a=h_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 S2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateHexadecimalToken);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=m_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 qgi(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 Z2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF,version:"1.0.0",description:"Data type get type of operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Qe.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:qgi(c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class H2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING,version:"1.0.0",description:"Coerce any value to string via JS String(value)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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 W2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER,version:"1.0.0",description:"Coerce to number via JS Number(value)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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 z2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES,version:"1.0.0",description:"Convert string/bytes-like to Uint8Array (utf8|hex|base64|base64url)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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=dn(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 Y2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING,version:"1.0.0",description:"Convert Uint8Array to string (utf8|hex|base64|base64url)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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=Co(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 J2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64,version:"1.0.0",description:"Bytes -> base64 string (accepts string input by converting from utf8)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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:v2e(a,c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Q2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64,version:"1.0.0",description:"base64 string -> bytes (Uint8Array)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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=T2e(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 X2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL,version:"1.0.0",description:"Bytes -> base64url string (accepts string input by converting from utf8)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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=hh(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 Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL,version:"1.0.0",description:"base64url string -> bytes (Uint8Array)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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=yf(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 tBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX,version:"1.0.0",description:"Bytes -> hex string (accepts string input by converting from utf8)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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=E2e(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 iBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX,version:"1.0.0",description:"hex string -> bytes (Uint8Array)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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=b2e(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 rBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH,version:"1.0.0",description:"Crypto: Hash (SHA-256/384/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Ni.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:g2e(a,c,e,f)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class nBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC,version:"1.0.0",description:"Crypto: HMAC (SHA-256/384/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Ni.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,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)});return{value:U.Success,error:null,result:R2e(c,e,a,f,h,m)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class aBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL,version:"1.0.0",description:"Crypto: constant-time equality for byte sequences",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Ni.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:A2e(a,c,e,f)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class sBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2,version:"1.0.0",description:"Crypto: derive key with PBKDF2 (SHA-256/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Ni.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(A=>{var _,N;return((_=A.value)==null?void 0:_.valueAsType)??((N=A.value)==null?void 0:N.value)});return{value:U.Success,error:null,result:D2e(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 lBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE,version:"1.0.0",description:"Json parse string into object operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fn.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 oBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY,version:"1.0.0",description:"Json stringify object into string operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fn.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 dBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC,version:"1.0.0",description:"JWT: build (HS256/384/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ur.BuildJwtHmac);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m,E,b,A,_,N,P]=r.map(j=>{var M,G;return((M=j.value)==null?void 0:M.valueAsType)??((G=j.value)==null?void 0:G.value)});return{value:U.Success,error:null,result:await V2e(a,c,e,f,h,m,E,b,A,_,N,P)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class uBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC,version:"1.0.0",description:"JWT: verify (HS256/384/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ur.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(A=>{var _,N;return((_=A.value)==null?void 0:_.valueAsType)??((N=A.value)==null?void 0:N.value)});return{value:U.Success,error:null,result:await N2e(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 pBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE,version:"1.0.0",description:"JWT: decode (no verification)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ur.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:$2e(a,c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class cBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2,version:"1.0.0",description:"Password: hash (PBKDF2) -> envelope string",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(yn.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,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)});return{value:U.Success,error:null,result:await O2e(a,c,e,f,h,m)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class fBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2,version:"1.0.0",description:"Password: verify (PBKDF2) -> boolean",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(yn.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 C2e(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 C_ extends n1{constructor(p,i,r=i.projectId){super(p,ae.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 Sgi(l,p){return p instanceof C_?p:new C_(l,p)}class O_ extends n1{constructor(p,i){super(p,ae.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 Zgi(l,p){return p instanceof O_?p:new O_(l,p)}function Hgi(l){l.register(new oVe(l)),l.register(new lVe(l)),l.register(new rVe(l)),l.register(new aVe(l)),l.register(new sVe(l)),l.register(new nVe(l)),l.register(new K$e(l)),l.register(new q$e(l)),l.register(new S$e(l)),l.register(new H$e(l)),l.register(new Z$e(l)),l.register(new W$e(l)),l.register(new B2e(l)),l.register(new M2e(l)),l.register(new G2e(l)),l.register(new j2e(l)),l.register(new k2e(l)),l.register(new U2e(l)),l.register(new F2e(l)),l.register(new K2e(l)),l.register(new q2e(l)),l.register(new S2e(l)),l.register(new Fxe(l)),l.register(new Kxe(l)),l.register(new qxe(l)),l.register(new Sxe(l)),l.register(new Zxe(l)),l.register(new Hxe(l)),l.register(new Wxe(l)),l.register(new zxe(l)),l.register(new Yxe(l)),l.register(new Jxe(l)),l.register(new Qxe(l)),l.register(new Xxe(l)),l.register(new e$e(l)),l.register(new t$e(l)),l.register(new i$e(l)),l.register(new r$e(l)),l.register(new n$e(l)),l.register(new a$e(l)),l.register(new s$e(l)),l.register(new d$e(l)),l.register(new u$e(l)),l.register(new p$e(l)),l.register(new oxe(l)),l.register(new dxe(l)),l.register(new uxe(l)),l.register(new pxe(l)),l.register(new cxe(l)),l.register(new fxe(l)),l.register(new yxe(l)),l.register(new hxe(l)),l.register(new mxe(l)),l.register(new vxe(l)),l.register(new Exe(l)),l.register(new bxe(l)),l.register(new Axe(l)),l.register(new Ixe(l)),l.register(new CNe(l)),l.register(new e2e(l)),l.register(new XLe(l)),l.register(new wPe(l)),l.register(new CPe(l)),l.register(new OPe(l)),l.register(new _Pe(l)),l.register(new VPe(l)),l.register(new PPe(l)),l.register(new NPe(l)),l.register(new xPe(l)),l.register(new $Pe(l)),l.register(new HPe(l)),l.register(new RNe(l)),l.register(new DNe(l)),l.register(new wNe(l)),l.register(new LPe(l)),l.register(new BPe(l)),l.register(new MPe(l)),l.register(new GPe(l)),l.register(new jPe(l)),l.register(new kPe(l)),l.register(new UPe(l)),l.register(new FPe(l)),l.register(new KPe(l)),l.register(new qPe(l)),l.register(new SPe(l)),l.register(new ZPe(l)),l.register(new WPe(l)),l.register(new zPe(l)),l.register(new YPe(l)),l.register(new JPe(l)),l.register(new QPe(l)),l.register(new XPe(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 yNe(l)),l.register(new hNe(l)),l.register(new mNe(l)),l.register(new sNe(l)),l.register(new lNe(l)),l.register(new oNe(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 n2e(l)),l.register(new a2e(l)),l.register(new s2e(l)),l.register(new l2e(l)),l.register(new t2e(l)),l.register(new i2e(l)),l.register(new r2e(l)),l.register(new o2e(l)),l.register(new u2e(l)),l.register(new c2e(l)),l.register(new d2e(l)),l.register(new p2e(l)),l.register(new f2e(l)),l.register(new m2e(l)),l.register(new y2e(l)),l.register(new h2e(l)),l.register(new gxe(l)),l.register(new Cxe(l)),l.register(new Oxe(l)),l.register(new Pxe(l)),l.register(new Nxe(l)),l.register(new xxe(l)),l.register(new $xe(l)),l.register(new Lxe(l)),l.register(new Bxe(l)),l.register(new Mxe(l)),l.register(new Gxe(l)),l.register(new _xe(l)),l.register(new Vxe(l)),l.register(new Dxe(l)),l.register(new wxe(l)),l.register(new Rxe(l)),l.register(new Txe(l)),l.register(new kxe(l)),l.register(new Uxe(l)),l.register(new jxe(l)),l.register(new Y$e(l)),l.register(new bLe(l)),l.register(new ELe(l)),l.register(new ALe(l)),l.register(new ILe(l)),l.register(new X$e(l)),l.register(new eLe(l)),l.register(new sLe(l)),l.register(new nLe(l)),l.register(new TLe(l)),l.register(new pLe(l)),l.register(new fLe(l)),l.register(new hLe(l)),l.register(new yLe(l)),l.register(new aLe(l)),l.register(new oLe(l)),l.register(new dLe(l)),l.register(new lLe(l)),l.register(new z$e(l)),l.register(new tLe(l)),l.register(new cLe(l)),l.register(new DLe(l)),l.register(new I_(l)),l.register(new Q$e(l)),l.register(new iLe(l)),l.register(new J$e(l)),l.register(new mLe(l)),l.register(new rLe(l)),l.register(new uLe(l)),l.register(new vLe(l)),l.register(new RLe(l)),l.register(new gLe(l)),l.register(new wLe(l)),l.register(new I_(l)),l.register(new OLe(l)),l.register(new CLe(l)),l.register(new _Le(l)),l.register(new w$e(l)),l.register(new C$e(l)),l.register(new O$e(l)),l.register(new f$e(l)),l.register(new o$e(l)),l.register(new T$e(l)),l.register(new A$e(l)),l.register(new l$e(l)),l.register(new I$e(l)),l.register(new D$e(l)),l.register(new E$e(l)),l.register(new v$e(l)),l.register(new bI(l)),l.register(new _$e(l)),l.register(new V$e(l)),l.register(new b$e(l)),l.register(new R$e(l)),l.register(new g$e(l)),l.register(new m$e(l)),l.register(new h$e(l)),l.register(new y$e(l)),l.register(new c$e(l)),l.register(new x$e(l)),l.register(new N$e(l)),l.register(new $$e(l)),l.register(new P$e(l)),l.register(new bNe(l)),l.register(new TNe(l)),l.register(new ENe(l)),l.register(new ANe(l)),l.register(new INe(l)),l.register(new vNe(l)),l.register(new gNe(l)),l.register(new Z2e(l)),l.register(new Q2e(l)),l.register(new eBe(l)),l.register(new iBe(l)),l.register(new J2e(l)),l.register(new X2e(l)),l.register(new tBe(l)),l.register(new Y2e(l)),l.register(new z2e(l)),l.register(new W2e(l)),l.register(new H2e(l)),l.register(new lBe(l)),l.register(new oBe(l)),l.register(new aBe(l)),l.register(new sBe(l)),l.register(new L2e(l)),l.register(new rBe(l)),l.register(new nBe(l)),l.register(new uBe(l)),l.register(new dBe(l)),l.register(new pBe(l)),l.register(new cBe(l)),l.register(new fBe(l)),l.register(new uVe(l)),l.register(new pVe(l)),l.register(new vI(l)),l.register(new EI(l))}class Zx{constructor(p=new Y.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||Oe.Normal)-(i.manifest.initPriority||Oe.Normal))}async setup(){Hgi(this),Y.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case ae.Editor:return this.onResolveEditorContextCallback();case ae.Logic:return this.onResolveProjectLogicContextCallback();case ae.EditorGUI:return this.onResolveEditorGUIContextCallback();case ae.Compile:return this.onResolveCompileContextCallback();case ae.PublicationRun:return this.onResolvePublicationRunContextCallback();case ae.GUI:return this.onResolveGUIContextCallback();case ae.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${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(){Y.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder)if(p.module.init&&!this.initialized.has(p.manifest.id)){Y.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)):Y.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)?(Y.Logger.log("Set "+p.manifest.id+" extension as initialized by default..."),this.initialized.add(p.manifest.id)):Y.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)){Y.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case ae.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case ae.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}Y.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 FA=null;const Hx={requestExtension:l=>(FA||(FA=new Zx,FA.setup()),FA.requestExtension(l))},Hu={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var Wx=(l=>(l.FinishedSuccess="finished-success",l.FinishedError="finished-error",l.Running="running",l.Paused="paused",l.Stopped="stopped",l.NotStarted="not-started",l))(Wx||{});const yBe={...Hx,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class Xy extends Y.Events{constructor(i,r,a,c=null,e=yBe){super();R(this,"project");R(this,"entryPoint");R(this,"state","not-started");R(this,"events",new Y.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 AT(x.UUID.uuid(),this.project),this.resolvedValues=new AT(x.UUID.uuid(),this.project),this.persistedExecutionResults=new AT(x.UUID.uuid(),this.project),this.lastExecutionResults=new AT(x.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),Wi.includes(i.type)&&pt(i).forEach(r=>this.skip(r))))}async schedule(i,r,a){if(this.hasExecuted(i))return null;if(Bt.includes(i.type))return this.executeBranch(i,a,r);if(er.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[...wt,...Bt].includes(r.type)?a.push(...r.inputs):At.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&&Bt.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 Sr.includes(e.type)?Ho(e,this.valueResolutionContext):cf(e,this.valueResolutionContext)}).reduce((e,f)=>{const h=Xo(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return h.forEach(E=>{var _,N,P;if(E.id===(f==null?void 0:f.valueOwner.id))return;const b=Nt(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(((N=f==null?void 0:f.value)==null?void 0:N.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((P=f==null?void 0:f.value)==null?void 0:P.valueAsTypeSingle)||null);const A={...f,valueOwner:E,value:b};m.push(A)}),[...e,...m]},[]).sort((e,f)=>e.valueOwner.index-f.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,r,a,c={}){var f,h;const e={...Hu,...c};try{let m={value:U.Success,error:null,result:null};if(r.sort((E,b)=>E.valueOwner.index-b.valueOwner.index),Object.values(Nr).includes(i.declaration.id)){const E=this.parentContext.requestExtension(Qy+i.declaration.id).module.main;E?m=await E(i,r):Y.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){Y.Logger.warn("Raw error executing entity: ",m.error);const b=(f=i.error)==null?void 0:f.getDataType(null),A=Nt(b||null,i.error,a);b!=null&&b.asType?A==null||A.setValueAsTypeSingle(m.error):A==null||A.metaSync({value:m.error},null),E={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:A}}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){Y.Logger.warn("Internal call execution error: ",m);let E=null;if(i.error){const b=(h=i.error)==null?void 0:h.getDataType(null),A=Nt(b,i.error,a);b!=null&&b.asType?A==null||A.setValueAsTypeSingle(m):A==null||A.metaSync({value:m},null),E={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:A}}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,A)=>b.valueOwner.index-A.valueOwner.index),i.declaration.implementation&&(f=await i.declaration.implementation(i,r));let h=null;if(f.error&&i.error){Y.Logger.warn("Raw error executing entity: ",f.error);const b=((c=i.error)==null?void 0:c.getDataType(null))||null,A=Nt(b,i.error,a);b!=null&&b.asType?A==null||A.setValueAsTypeSingle(f.error):A==null||A.metaSync({value:f.error},null),h={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:A}}const m=i==null?void 0:i.getDataType(null),E=Nt(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){Y.Logger.warn("Operation execution error: ",f);let h=null;if(i.error){const m=(e=i.error)==null?void 0:e.getDataType(null),E=Nt(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(Ve.SEARCH_NODE_IMPLEMENTATION)).module.main(i,r),h=i==null?void 0:i.getDataType(null),m=Nt(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(Y.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=Nt(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,A;const e={...Hu,...c};try{let _={value:U.Success,error:null,result:null};const N=r.map(re=>{var ee,ue;return((ee=re==null?void 0:re.value)==null?void 0:ee.valueAsType)||((ue=re==null?void 0:re.value)==null?void 0:ue.value)});let P={};i.getUniqueInputMaps().forEach(re=>{const ee=i.body.inputs.find(de=>le(de,a)===le(re,a)),ue=re==null?void 0:re.getDataType(null),ie=Nt(ue,ee,a);ue!=null&&ue.asType?ie==null||ie.setValueAsTypeList([]):ie==null||ie.metaSync({value:[]},null),this.lastExecutionResults.writeValue(ee,ie);const se={value:ie,valueOwner:ee,type:Me.ExecutionResult,inheritanceLink:null};P[ee.id]=se});let M={value:U.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case ne.loop["counted-loop"].id:{const re=N[0];let ee=1;for(;ee<=re&&ee<=50;){const ue=i.body.inputs.map(ie=>{if(ie===i.currentIterationNumberArgumentDeclaration){const se=i.currentIterationNumberArgumentDeclaration.getDataType(null),de=Qc(se),z=this.lastExecutionResults.readValue(ie.id);if(z){z.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ie,z);const me={value:z,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null};return P[ie.id]=me,me}const X={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:ee,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:de,standaloneParent:ie.toReference()},ce=tr(X,a);this.lastExecutionResults.writeValue(ie,ce);const oe={value:ce,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null};return P[ie.id]=oe,oe}else return P[ie.id]}).filter(ie=>!!ie);if(M=await this.executeFullFunctionDeclarationLogic(i.body,ue,e),(M.results||[]).forEach(ie=>{var X,ce,oe,me;if(ie.valueOwner.type!==d.InputMap||At.includes(ie.valueOwner.parent.type))return;const se=i.body.inputs.find(ve=>le(ve,a)===le(ie.valueOwner,a)),z=[...((ce=(X=P==null?void 0:P[se.id])==null?void 0:X.value)==null?void 0:ce.value)||[],((oe=ie==null?void 0:ie.value)==null?void 0:oe.value)||null];(me=P[se.id].value)==null||me.metaSync({value:z},null),this.lastExecutionResults.writeValue(se,P[se.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}case ne.loop["manual-flow-loop"].id:{let re=1;for(;re<=50;){const ee=i.body.inputs.map(ue=>{if(ue===i.currentIterationNumberArgumentDeclaration){const ie=this.lastExecutionResults.readValue(ue.id);if(ie){ie.metaSync({value:re},null),this.lastExecutionResults.writeValue(ue,ie);const X={value:ie,valueOwner:ue,type:Me.ExecutionResult,inheritanceLink:null};return P[ue.id]=X,X}const se=i.currentIterationNumberArgumentDeclaration.getDataType(null),de=Nt(se,ue,a);return de==null||de.metaSync({value:re},null),this.lastExecutionResults.writeValue(ue,de),{value:de,valueOwner:ue,type:Me.ExecutionResult,inheritanceLink:null}}else return P[ue.id]}).filter(ue=>!!ue);if(M=await this.executeFullFunctionDeclarationLogic(i.body,ee,e),(M.results||[]).forEach(ue=>{var z,X,ce;if(ue.valueOwner.type!==d.InputMap||At.includes(ue.valueOwner.parent.type))return;const ie=i.body.inputs.find(oe=>le(oe,a)===le(ue.valueOwner,a)),de=[...(z=P[ie.id].value)==null?void 0:z.value,((X=ue.value)==null?void 0:X.value)||null];(ce=P[ie.id].value)==null||ce.metaSync({value:de},null),this.lastExecutionResults.writeValue(ie,P[ie.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;re++}break}case ne.loop["list-loop"].id:{const re=N[0];let ee=1;const ue=re;for(let ie=0;ie<ue.length;ie++){const se=ue[ie],de=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const X=this.lastExecutionResults.readValue(z.id);if(X)return X.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,X),{value:X,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),oe=Nt(ce,z,a);return oe==null||oe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,oe),{value:oe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const X=i.currentValueArgumentDeclaration.getDataType(null),ce=Qc(X),oe=this.lastExecutionResults.readValue(z.id);if(oe)return oe.metaSync({value:se},null),this.lastExecutionResults.writeValue(z,oe),{value:oe,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const me={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:se,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:z.toReference()},ve=tr(me,a);return this.lastExecutionResults.writeValue(z,ve),{value:ve,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return P[z.id]}).filter(z=>!!z);if(M=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(M.results||[]).forEach(z=>{var me,ve,we;if(z.valueOwner.type!==d.InputMap||At.includes(z.valueOwner.parent.type))return;const X=i.body.inputs.find(Re=>le(Re,a)===le(z.valueOwner,a)),oe=[...(me=P[X.id].value)==null?void 0:me.value,((ve=z.value)==null?void 0:ve.value)||null];(we=P[X.id].value)==null||we.metaSync({value:oe},null),this.lastExecutionResults.writeValue(X,P[X.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}case ne.loop["object-keys-loop"].id:{const re=N[0];let ee=1;const ue=re?Object.keys(re):[];for(let ie=0;ie<ue.length;ie++){const se=ue[ie],de=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const X=this.lastExecutionResults.readValue(z.id);if(X)return X.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,X),{value:X,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),oe=Nt(ce,z,a);return oe==null||oe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,oe),{value:oe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const X=i.currentValueArgumentDeclaration.getDataType(null),ce=Qc(X),oe=this.lastExecutionResults.readValue(z.id);if(oe)return oe.metaSync({value:se},null),this.lastExecutionResults.writeValue(z,oe),{value:oe,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const me={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:se,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:z.toReference()},ve=tr(me,a);return this.lastExecutionResults.writeValue(z,ve),{value:ve,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return P[z.id]}).filter(z=>!!z);if(M=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(M.results||[]).forEach(z=>{var me,ve,we;if(z.valueOwner.type!==d.InputMap||At.includes(z.valueOwner.parent.type))return;const X=i.body.inputs.find(Re=>le(Re,a)===le(z.valueOwner,a)),oe=[...(me=P[X.id].value)==null?void 0:me.value,((ve=z.value)==null?void 0:ve.value)||null];(we=P[X.id].value)==null||we.metaSync({value:oe},null),this.lastExecutionResults.writeValue(X,P[X.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}case ne.loop["object-values-loop"].id:{const re=N[0];let ee=1;const ue=re?Object.values(re):[];for(let ie=0;ie<ue.length;ie++){const se=ue[ie],de=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const X=this.lastExecutionResults.readValue(z.id);if(X)return X.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,X),{value:X,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),oe=Nt(ce,z,a);return oe==null||oe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,oe),{value:oe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const X=i.currentValueArgumentDeclaration.getDataType(null),ce=Qc(X),oe=this.lastExecutionResults.readValue(z.id);if(oe)return oe.metaSync({value:se},null),this.lastExecutionResults.writeValue(z,oe),{value:oe,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const me={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:se,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:z.toReference()},ve=tr(me,a);return this.lastExecutionResults.writeValue(z,ve),{value:ve,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return P[z.id]}).filter(z=>!!z);if(M=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(M.results||[]).forEach(z=>{var me,ve,we;if(z.valueOwner.type!==d.InputMap||At.includes(z.valueOwner.parent.type))return;const X=i.body.inputs.find(Re=>le(Re,a)===le(z.valueOwner,a)),oe=[...(me=P[X.id].value)==null?void 0:me.value,((ve=z.value)==null?void 0:ve.value)||null];(we=P[X.id].value)==null||we.metaSync({value:oe},null),this.lastExecutionResults.writeValue(X,P[X.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}case ne.loop["string-loop"].id:{const re=N[0];let ee=1;const ue=re.split("");for(let ie=0;ie<ue.length;ie++){const se=ue[ie],de=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const X=this.lastExecutionResults.readValue(z.id);if(X)return X.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,X),{value:X,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),oe=Nt(ce,z,a);return oe==null||oe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,oe),{value:oe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const X=i.currentValueArgumentDeclaration.getDataType(null),ce=Qc(X),oe=this.lastExecutionResults.readValue(z.id);if(oe)return oe.metaSync({value:se},null),this.lastExecutionResults.writeValue(z,oe),{value:oe,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const me={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:se,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:z.toReference()},ve=tr(me,a);return this.lastExecutionResults.writeValue(z,ve),{value:ve,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return P[z.id]}).filter(z=>!!z);if(M=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(M.results||[]).forEach(z=>{var me,ve,we;if(z.valueOwner.type!==d.InputMap||At.includes(z.valueOwner.parent.type))return;const X=i.body.inputs.find(Re=>le(Re,a)===le(z.valueOwner,a)),oe=[...(me=P[X.id].value)==null?void 0:me.value,((ve=z.value)==null?void 0:ve.value)||null];(we=P[X.id].value)==null||we.metaSync({value:oe},null),this.lastExecutionResults.writeValue(X,P[X.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}}if(_={value:[U.CaughtError,U.Return].includes(M.value)?M.value:U.Success,error:((h=(f=M.error)==null?void 0:f.value)==null?void 0:h.value)||null,result:((E=(m=M==null?void 0:M.result)==null?void 0:m.value)==null?void 0:E.value)||null},_.error&&i.error){const re=(b=i.error)==null?void 0:b.getDataType(null),ee=Nt(re||null,i.error,a);re!=null&&re.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),S=Nt(G,i,a);return G!=null&&G.asType?S==null||S.setValueAsTypeSingle(_.result):S==null||S.metaSync({value:_.result},null),{value:_.value,entity:i,error:null,result:{value:S||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(_){if(Y.Logger.warn("Error executing loop: ",_),i.error){const N=(A=i.error)==null?void 0:A.getDataType(null),P=Nt(N,i.error,a);return N!=null&&N.asType?P==null||P.setValueAsTypeSingle(_):P==null||P.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:P},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,A,_,N,P,j,M,G,S,re,ee,ue,ie,se,de,z,X,ce,oe,me,ve,we;const e={...Hu,...c};try{const Re=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);let xe=null;if(Re.error&&i.error){Y.Logger.warn("Raw error executing entity: ",Re.error);const Ze=(f=i.error)==null?void 0:f.getDataType(null),Xe=Nt(Ze||null,i.error,a);Ze!=null&&Ze.asType?(m=(h=Re.error)==null?void 0:h.value)!=null&&m.valueAsTypeSingle?Xe==null||Xe.setValueAsTypeSingle((b=(E=Re.error)==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle):(_=(A=Re.error)==null?void 0:A.value)!=null&&_.valueAsTypeList&&Array.isArray((P=(N=Re.error)==null?void 0:N.value)==null?void 0:P.valueAsTypeList)&&(Xe==null||Xe.setValueAsTypeList((M=(j=Re.error)==null?void 0:j.value)==null?void 0:M.valueAsTypeList)):Xe==null||Xe.metaSync({value:(S=(G=Re.error)==null?void 0:G.value)==null?void 0:S.value},null),xe={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:Xe}}let je=U.Success;Re.value===U.UnhandledError&&(i.catchesError||i.errorCalls.length?je=U.CaughtError:je=U.UnhandledError);const Se=i==null?void 0:i.getDataType(null),et=Nt(Se,i,a);return Se!=null&&Se.asType?(ee=(re=Re.result)==null?void 0:re.value)!=null&&ee.valueAsTypeSingle?et==null||et.setValueAsTypeSingle((ie=(ue=Re.result)==null?void 0:ue.value)==null?void 0:ie.valueAsTypeSingle):(de=(se=Re.result)==null?void 0:se.value)!=null&&de.valueAsTypeList&&Array.isArray((X=(z=Re.result)==null?void 0:z.value)==null?void 0:X.valueAsTypeList)&&(et==null||et.setValueAsTypeList((oe=(ce=Re.result)==null?void 0:ce.value)==null?void 0:oe.valueAsTypeList)):et==null||et.metaSync({value:((ve=(me=Re.result)==null?void 0:me.value)==null?void 0:ve.value)||null},null),{value:je,entity:i,error:xe,result:{value:et||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(Re){if(!i.error)return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null};const xe=(we=i.error)==null?void 0:we.getDataType(null),je=Nt(xe,i.error,a);return xe!=null&&xe.asType?je==null||je.setValueAsTypeSingle(Re):je==null||je.metaSync({value:Re},null),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:je},result:null}}}async executeCondition(i,r){var c,e,f,h;let a=!1;switch(i.declaration.id){case hn.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 hn.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 Rr.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 Rr.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={...Hu,...c,onBeforeEntityExecution:(m,E,b)=>{var A;return((A=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:A.call(c,m,E,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(m,E,b)=>{var A;return((A=c==null?void 0:c.onEntityExecuted)==null?void 0:A.call(c,m,E,{...b,detached:!0}))||Promise.resolve()}},f=new Xy(a,[i,...UI(i)],i,this,this.parentContext);return f.inheritValuesFromContext(this),await f.execute(e,r)}async executeFullFunctionDeclarationLogic(i,r,a={}){const c={...Hu,...a},e=UI(i);e.forEach(m=>{this.addEntity(m)}),e.reduce((m,E)=>At.includes(E.type)?[...m,...E.outputs]:wt.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,A,_;if((f=i.throws)!=null&&f.readsValue){const N=Ho(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(N==null?void 0:N.value)||null},result:null}}let a=Ho(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let N={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(N={...N,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)gr((m=a==null?void 0:a.value)==null?void 0:m.value)&&(N={...N,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:N},null);else{const P=Nt(c,i,this.project);P==null||P.metaSync({value:N},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:P}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(P=>{var j,M;if(((j=P.declaration)==null?void 0:j.type)===d.Property&&P.declaration.static){const G=this.lastExecutionResults.readValue(P.declaration.id),S=le(P,this.project),re=P.codeName||((M=P.declaration)==null?void 0:M.codeName)||Qi(S);if(G)G.metaSync({value:N[re]},null),this.lastExecutionResults.writeValue(P.declaration,G);else{const ee=Nt(P.getDataType(null),P,this.project);ee==null||ee.metaSync({value:N[re]},null),this.lastExecutionResults.writeValue(P.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((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(N=>{var G;const P=N.codeName||((G=N.declaration)==null?void 0:G.codeName)||Qi(le(N,this.project)),j=e[P],M=Nt(N.getDataType(null),N,this.project);M==null||M.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,A,_;if((f=i.throws)!=null&&f.readsValue){const N=Ho(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(N==null?void 0:N.value)||null},result:null}}let a=Ho(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let N={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(N={...N,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)gr((m=a==null?void 0:a.value)==null?void 0:m.value)&&(N={...N,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:N},null);else{const P=Nt(c,i,this.project);P==null||P.metaSync({value:N},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:P}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(P=>{var j,M;if(((j=P.declaration)==null?void 0:j.type)===d.Property&&P.declaration.static){const G=this.lastExecutionResults.readValue(P.declaration.id),S=le(P,this.project),re=P.codeName||((M=P.declaration)==null?void 0:M.codeName)||Qi(S);if(G)G.metaSync({value:N[re]},null),this.lastExecutionResults.writeValue(P.declaration,G);else{const ee=Nt(P.getDataType(null),P,this.project);ee==null||ee.metaSync({value:N[re]},null),this.lastExecutionResults.writeValue(P.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((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(N=>{var G;const P=N.codeName||((G=N.declaration)==null?void 0:G.codeName)||Qi(le(N,this.project)),j=e[P],M=Nt(N.getDataType(null),N,this.project);M==null||M.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,A,_;if((f=i.throws)!=null&&f.readsValue){const N=Ho(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(N==null?void 0:N.value)||null},result:null}}let a=Ho(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let N={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(N={...N,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)gr((m=a==null?void 0:a.value)==null?void 0:m.value)&&(N={...N,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:N},null);else{const P=Nt(c,i,this.project);P==null||P.metaSync({value:N},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:P}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(P=>{var j,M;if(((j=P.declaration)==null?void 0:j.type)===d.Property&&P.declaration.static){const G=this.lastExecutionResults.readValue(P.declaration.id),S=le(P,this.project),re=P.codeName||((M=P.declaration)==null?void 0:M.codeName)||Qi(S);if(G)G.metaSync({value:N[re]},null),this.lastExecutionResults.writeValue(P.declaration,G);else{const ee=Nt(P.getDataType(null),P,this.project);ee==null||ee.metaSync({value:N[re]},null),this.lastExecutionResults.writeValue(P.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((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(N=>{var G;const P=N.codeName||((G=N.declaration)==null?void 0:G.codeName)||Qi(le(N,this.project)),j=e[P],M=Nt(N.getDataType(null),N,this.project);M==null||M.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,A,_;let a=Ho(i,this.valueResolutionContext);const c=Tr(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let N={};if(((h=e==null?void 0:e.entity)==null?void 0:h.type)===d.DefinitionEntity&&(N={...N,...e.entity.getActiveRawDefaultValue()}),a!=null&&a.value)gr((m=a==null?void 0:a.value)==null?void 0:m.value)&&(N={...N,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:N},null);else{const P=Nt(e,i,this.project);P==null||P.metaSync({value:N},null),a={valueOwner:c,type:Me.ExecutionResult,inheritanceLink:null,value:P}}this.lastExecutionResults.writeValue(c,a.value),c.inputs.forEach(P=>{var j,M;if(((j=P.declaration)==null?void 0:j.type)===d.Property&&P.declaration.static){const G=this.lastExecutionResults.readValue(P.declaration.id),S=le(P,this.project),re=P.codeName||((M=P.declaration)==null?void 0:M.codeName)||Qi(S);if(G)G.metaSync({value:N[re]},null),this.lastExecutionResults.writeValue(P.declaration,G);else{const ee=Nt(P.getDataType(null),P,this.project);ee==null||ee.metaSync({value:N[re]},null),this.lastExecutionResults.writeValue(P.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((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(N=>{var G;const P=N.codeName||((G=N.declaration)==null?void 0:G.codeName)||Qi(le(N,this.project)),j=f[P],M=Nt(N.getDataType(null),N,this.project);M==null||M.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,A,_,N,P,j,M;const c={...Hu,...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)),Xy.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)),Xy.executeEntryPointEntity(i,G)}case d.Search:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((A=c.onBeforeEntityExecution)==null?void 0:A.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((N=c.onBeforeEntityExecution)==null?void 0:N.call(c,i,G,e)),this.executeReturnStatement(i,G)}case d.ContinueStatement:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((P=c.onBeforeEntityExecution)==null?void 0:P.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((M=c.onBeforeEntityExecution)==null?void 0:M.call(c,i,G,e)),Xy.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=Xo((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={...Hu,...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(P=>this.hasEntity(P));(i.errorCalls||[]).forEach(P=>{this.skip(P)});let A=[];const _=(await Promise.all(E.map(P=>this.schedule(P,[],c)))).filter(P=>!!P),N=_.filter(P=>!!P).find(P=>P.value===U.CaughtError||P.value===U.Return||P.value===U.Break||P.value===U.Continue);return N||(A=[...A,..._],h)}else if(h.value===U.CaughtError||h.value===U.ConditionNotMet){const E=(i.errorCalls||[]).filter(P=>this.hasEntity(P));(i.successCalls||i.calls||[]).forEach(P=>{this.skip(P)});let A=[];const _=(await Promise.all(E.map(P=>this.schedule(P,[],c)))).filter(P=>!!P),N=_.filter(P=>!!P).find(P=>P.value===U.CaughtError||P.value===U.UnhandledError||P.value===U.Return||P.value===U.Break||P.value===U.Continue);return N||(A=[...A,..._],h)}else{if(h.value===U.UnhandledError)return this.executing.forEach(E=>{this.skip(E)}),this.scheduled.forEach(E=>{this.skip(E)}),Wi.includes(h.entity.type)&&pt(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={...Hu,...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=Y.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=yt(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 Wgi(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 Xa={[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 zx(l){const p=J1(l);if(!p){const r=gh(l);if(r.includes(ge.HTTP_ENDPOINT))return"HTTP endpoint";if(r.includes(ge.PERSISTED_ENTITY))return"Persisted entity";if(r.includes(ge.CRON_JOB))return"Scheduled execution";if(r.includes(ge.RELATIONAL_DATABASE))return"Relational database"}if(p){let r="Extension of "+le(p,p.project)+" entity",a=Os(r);const c=gh(l);return c.includes(ge.HTTP_ENDPOINT)?"HTTP endpoint"+(a?", "+a:""):c.includes(ge.PERSISTED_ENTITY)?"Persisted entity"+(a?", "+a:""):c.includes(ge.CRON_JOB)?"Scheduled execution"+(a?", "+a:""):c.includes(ge.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 hBe(l){return l.parent.type===d.DefinitionEntity||l.parent.type===d.InstalledProject?"Internal action of "+le(l.parent,l.project):l.parent.type===d.Loop?"Action repeated on every iteration":"Internal action of entity"}function Yx(l){return hL(l)?hBe(l):"Custom trigger"}function zgi(l){var p;switch(l.type){case d.DefinitionEntity:return zx(l);case d.FunctionDeclaration:return Yx(l)}return(p=Xa[l.type])==null?void 0:p.singular}function Ygi(l){var p;switch(l.type){case d.DefinitionEntity:return zx(l);case d.FunctionDeclaration:return Yx(l)}return(p=Xa[l.type])==null?void 0:p.singular}const Jx=4e4,Qx=280,Jgi=300,Xx=65,nf=32,ih=39,qT=26,mBe=49,ST=44,Qgi=35,XA=52,y1=10,Va=y1*2,ip=38,eI=90,RI=270,TBe=Jx/2+120,vBe=Jx/2+180;function e$(l){let i=nf+ST+ip+y1;const r=[...l.inputs];return r.length&&(i+=Va,r.forEach(()=>{i+=qT})),{height:i,width:280}}function ZT(l){var a,c;let i=nf+ST+ip+y1;const r=[...l.inputs];return r.length&&(i+=Va,r.forEach(()=>{i+=qT})),l.andChildrenGroup&&(i+=Va,l.andChildrenGroup.forEach(e=>{i+=ZT(e).height})),l.orChildrenGroup&&(i+=Va,l.orChildrenGroup.forEach(e=>{i+=ZT(e).height})),(((a=l.declaration)==null?void 0:a.id)===ne.condition["condition-group-and"].id||((c=l.declaration)==null?void 0:c.id)===ne.condition["condition-group-or"].id)&&(i+=ip),{height:i,width:280}}function EBe(l){var h,m;let i=Xx;const r=[];if([d.DefinitionEntity].includes(l.type)){const E=[...l.suggestedProperties||[],...l.properties||[]];E.length&&(i+=Va,E.forEach(b=>{i+=b.static?mBe:ih}))}if([d.DefinitionEntity,d.InstalledProject,d.Loop].includes(l.type)){const E=[...(l==null?void 0:l.suggestedMethods)||[],...l.methods||[],...l.functions||[],...l.body?[l.body]:[]];E.length&&(i+=Va,E.forEach(b=>{const A=e$(b);i+=A.height}))}wt.includes(l.type)?(r.push(...(l.inputs||[]).flatMap(E=>[E])||[]),i+=Va,i+=ST,l.error&&(i+=XA)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(l.type)?(r.push(...l.outputs||[]),l.throws&&(i+=XA)):l.type===d.Condition&&(r.push(l.inputs[0]),l.inputs[1]&&r.push(l.inputs[1]),(((h=l.declaration)==null?void 0:h.id)===ne.condition["condition-group-and"].id||((m=l.declaration)==null?void 0:m.id)===ne.condition["condition-group-or"].id)&&(i+=ip),l.andChildrenGroup&&(i+=Va,l.andChildrenGroup.forEach(E=>{i+=ZT(E).height})),l.orChildrenGroup&&(i+=Va,l.orChildrenGroup.forEach(E=>{i+=ZT(E).height})));const a=r.length;a&&(i+=a*ih,i+=Va);const c=[];if(l.type===d.FunctionDeclaration||l.type===d.GlobalEvent?c.push(...l.inputs||[]):wt.includes(l.type)&&c.push(...l.outputs||[]),xt.includes(l.type)){i+=Va,i+=ST,l.usedInternalCalls.length&&l.usedInternalCalls.forEach(b=>{i+=XA+Va,i+=b.inputs.length*qT,i+=b.outputs.length*qT});const E=l.getDataType(null);(!E||E.canModifyObjectStructure())&&(i+=ip)}l.type===d.Search&&(i+=ip);const e=c.length;return e&&(i+=e*ih,i+=Va),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(l.type)&&(i+=ip),{height:i,width:280}}function bBe(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=e$(c);p+=e.height}),(i.properties.length||i.suggestedProperties.length)&&(p+=Va,i.suggestedProperties.forEach(()=>{p+=ih}),i.properties.forEach(()=>{p+=ih})),{offset:p}}function cE(l){return`${l.split("-").map((r,a)=>a===0?r.charAt(0).toUpperCase()+r.slice(1):r.toLowerCase()).join(" ")}.`}function Xgi(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 Ce.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case Ce.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 Ce.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 Ce.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case Ce.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case Ce.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case Ce.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 Ce.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case Ce.EmptyName:return"This entity has no name";case Ce.InvalidObjectStructure:return"This entity has an invalid structure";case Ce.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case Ce.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case Ce.MissingCaller:return"This action is missing a caller";case Ce.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case Ce.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case Ce.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case Ce.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case ad.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case ad.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case ts.UUIDMustBeString:return`UUID must be a string, eg: "${ap()}"`;case ts.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${ap()}"`;case ts.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${ap()}"`;case Ta.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case Ta.StringValueMustNotHaveDashes:return"This value must not contain dashes";case Ta.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return cE(l.code)}}function eRi(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 Ce.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case Ce.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case be.MissingMethodImplementation:return"Missing action";case be.MissingPropertyImplementation:return"Missing property";case Ce.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 Ce.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case Ce.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case Ce.InternalCallParentMissingDataType:return"Parent has no data type";case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case Ce.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 Ce.EmptyName:return"Empty name";case Ce.InvalidObjectStructure:return"Invalid object structure";case Ce.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case Ce.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ce.MissingCaller:return"Missing caller";case Ce.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case Ce.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case Ce.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ce.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case ad.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case ad.StatusCodeMustBeNumber:return"HTTP status code must be a number";case ts.UUIDMustBeString:return"UUID must be a string";case ts.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case ts.UUIDMustBeValidFormat:return"UUID must be in a valid format";case Ta.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case Ta.StringValueMustNotHaveDashes:return"This value must not contain dashes";case Ta.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return cE(l.code)}}function tRi(l){switch(l.code){case be.AbstractEntityWithNonAbstractMethods:return`${le(l.entity,l.entity.project)} has non-template actions`;case be.AbstractEntityWithNonAbstractProperties:return`${le(l.entity,l.entity.project)} has non-template properties`;case be.IncorrectEntityImplementation:return`${le(l.entity,l.entity.project)} incorrectly implements template`;case be.IncorrectMethodImplementation:return`${le(l.entity,l.entity.project)} incorrectly implements the template`;case be.IncorrectPropertyImplementation:return`${le(l.entity,l.entity.project)} incorrectly implements the template`;case be.AbstractMethodInNonAbstractEntity:return`${le(l.entity,l.entity.project)} can't be a template`;case be.AbstractPropertyInNonAbstractEntity:return`${le(l.entity,l.entity.project)} can't be a template`;case Ce.MethodOverwritesOtherSiblingWithSameName:return`${le(l.entity,l.entity.project)} overwrites action`;case Ce.PropertyOverwritesOtherSiblingWithSameName:return`${le(l.entity,l.entity.project)} overwrites property`;case be.MissingMethodImplementation:return`${le(l.entity,l.entity.project)} is missing action`;case be.MissingPropertyImplementation:return`${le(l.entity,l.entity.project)} is missing property`;case Ce.NameNotUniqueInScope:return`${le(l.entity,l.entity.project)} name is not unique`;case be.NoProperties:return`${le(l.entity,l.entity.project)} has no properties`;case be.NonStaticPropertyInStaticEntity:return`${le(l.entity,l.entity.project)} has non-static property`;case be.StaticEntityWithNonStaticProperties:return`${le(l.entity,l.entity.project)} has non-static properties`;case be.ReadingFromIncompatibleType:return`${le(l.entity,l.entity.project)} reads from different type`;case be.WritingToIncompatibleType:return`${le(l.entity,l.entity.project)} writes to different type`;case be.ScopeWithoutLogic:return`${le(l.entity,l.entity.project)} has no logic`;case be.NonStaticPropertyImplementsStatic:return`${le(l.entity,l.entity.project)} has invalid static property`;case be.PropertyImplementsIncompatibleType:return`${le(l.entity,l.entity.project)} has incompatible data type`;case be.PropertyImplementsNonAbstact:return`${le(l.entity,l.entity.project)} has non-template property`;case be.StaticPropertyImplementsNonStatic:return`${le(l.entity,l.entity.project)} has non-static property`;case be.VariableCallsOthersAndHasInternalCall:return`${le(l.entity,l.entity.project)} has bad internal call`;case be.VariableHasInputsAndInternalCall:return`${le(l.entity,l.entity.project)} has bad internal call`;case be.VariableHasOutputsAndInternalCall:return`${le(l.entity,l.entity.project)} has bad internal call`;case be.VariableIsCalledAndHasInternalCall:return`${le(l.entity,l.entity.project)} has bad internal call`;case Ce.InternalCallDeclarationIsInvalidType:return`${le(l.entity,l.entity.project)} has declaration that is not an action`;case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${le(l.entity,l.entity.project)} has declaration that is not found in parent`;case Ce.InternalCallParentDeclarationEntityInvalidType:return`${le(l.entity,l.entity.project)} has invalid parent declaration type`;case Ce.InternalCallParentMissingDataType:return`${le(l.entity,l.entity.project)}'s parent has no data type`;case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return`${le(l.entity,l.entity.project)} has declaration that is not in parent`;case Ce.UnreachableEntity:return`${le(l.entity,l.entity.project)} is unreachable`;case be.DisconnectedCallableEntity:return`${le(l.entity,l.entity.project)} is not executed by any entity`;case be.AbstractEntityImplements:return`${le(l.entity,l.entity.project)} implements a non-template entity`;case be.AbstractExtendingNonAbstractEntity:return`${le(l.entity,l.entity.project)} extends a non-template entity`;case be.InvalidPropertiesCombination:return`${le(l.entity,l.entity.project)} has invalid properties combination`;case be.ExtendingNonInteractiveEntity:return`${le(l.entity,l.entity.project)} extends a non-interactive entity`;case be.ExtendsIncompatibleEntities:return`${le(l.entity,l.entity.project)} extends incompatible entities`;case be.ImplementingNonAbstractEntity:return`${le(l.entity,l.entity.project)} implements a non-template entity`;case be.ImplementsIncompatibleEntities:return`${le(l.entity,l.entity.project)} implements incompatible entities`;case be.LackingReturnStatementOnSomeBranches:return`${le(l.entity,l.entity.project)} is missing termination on some branches`;case be.LastCalledEntityMustBeReturnEntity:return`${le(l.entity,l.entity.project)}'s last called entity must be a termination node`;case be.MissingRequiredValue:return`${le(l.entity,l.entity.project)} is missing a required value`;case be.NoPrimaryKeyProperty:return`${le(l.entity,l.entity.project)} has no primary key property`;case be.NonAbstractExtendingAbstractEntity:return`${le(l.entity,l.entity.project)} extends a template entity`;case be.NonStaticExtendingStaticEntity:return`${le(l.entity,l.entity.project)} extends a static entity`;case be.NonStaticImplementingStaticEntity:return`${le(l.entity,l.entity.project)} implements a static entity`;case be.StaticExtendingNonStaticEntity:return`${le(l.entity,l.entity.project)} extends a non-static entity`;case be.StaticImplementingNonStaticEntity:return`${le(l.entity,l.entity.project)} implements a non-static entity`;case be.VariableReadsValueAndInternalCall:return`${le(l.entity,l.entity.project)} reads a value and has internal call`;case be.VariableWritesValuesAndInternalCall:return`${le(l.entity,l.entity.project)} writes values and has internal call`;case Ce.EmptyName:return`${Xa[l.entity.type]} has no name`;case Ce.InvalidObjectStructure:return`${le(l.entity,l.entity.project)} has invalid structure`;case Ce.LoopBodyFunctionOverwrite:return`${le(l.entity,l.entity.project)}'s loop body action overwrites an action`;case Ce.MethodOverwritesBaseMethodWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites base action`;case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites another action with same implementation`;case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites another action with same implementation`;case Ce.MissingCaller:return`${le(l.entity,l.entity.project)} is missing a caller`;case Ce.NameAsResolvedCodeNameNotUniqueInScope:return`${le(l.entity,l.entity.project)} has a name not unique in the scope`;case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${le(l.entity,l.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ce.NameMustStartWithLetterOrUnderscore:return`${le(l.entity,l.entity.project)} name must start with letter or underscore`;case Ce.NoOverlapWithImplementedSignature:return`${le(l.entity,l.entity.project)} has no overlap with implemented signature`;case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites base property`;case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites another property with same implementation`;case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites another property with same implementation`;case Ce.ReaderWriterIncompatibleDataType:return`${le(l.entity,l.entity.project)} has reader/writer with incompatible data type`;case ad.StatusCodeMustBeBetween100And599:return`${le(l.entity,l.entity.project)} HTTP status code must be between 100 and 599`;case ad.StatusCodeMustBeNumber:return`${le(l.entity,l.entity.project)} HTTP status code must be a number`;case ts.UUIDMustBeString:return`${le(l.entity,l.entity.project)} UUID must be a string`;case ts.UUIDMustNotContainSpaces:return`${le(l.entity,l.entity.project)} UUID must not contain spaces`;case ts.UUIDMustBeValidFormat:return`${le(l.entity,l.entity.project)} UUID must be in a valid format`;case Ta.MustBeUniqueAmongSameEntities:return`${le(l.entity,l.entity.project)} value must be unique among the same kind`;case Ta.StringValueMustNotHaveDashes:return`${le(l.entity,l.entity.project)} value must not contain dashes`;case Ta.StringValueMustNotHaveSpaces:return`${le(l.entity,l.entity.project)} value must not contain spaces`;default:return`${le(l.entity,l.entity.project)} Error: ${cE(l.code)}`}}function iRi(l){var p,i,r,a;switch(l.code){case be.AbstractEntityWithNonAbstractMethods:return`${le(l.entity,l.entity.project)} has non-template actions`;case be.AbstractEntityWithNonAbstractProperties:return`${le(l.entity,l.entity.project)} has non-template properties`;case be.IncorrectEntityImplementation:return`${le(l.entity,l.entity.project)} incorrectly implements the template entity`;case be.IncorrectMethodImplementation:return`${le(l.entity,l.entity.project)} incorrectly implements the template action it's based on`;case be.IncorrectPropertyImplementation:return`${le(l.entity,l.entity.project)} incorrectly implements the template property it's based on`;case be.AbstractMethodInNonAbstractEntity:return`${le(l.entity,l.entity.project)} is a template action in a non-template entity`;case be.AbstractPropertyInNonAbstractEntity:return`${le(l.entity,l.entity.project)} is a template property in a non-template entity`;case Ce.MethodOverwritesOtherSiblingWithSameName:return`${le(l.entity,l.entity.project)} overwrites an action in the template entity`;case Ce.PropertyOverwritesOtherSiblingWithSameName:return`${le(l.entity,l.entity.project)} overwrites a property in the template entity`;case be.MissingMethodImplementation:return`${le(l.entity,l.entity.project)} is missing an action implementation from the template entity`;case be.MissingPropertyImplementation:return`${le(l.entity,l.entity.project)} is missing a property implementation from the template entity`;case Ce.NameNotUniqueInScope:return`${le(l.entity,l.entity.project)} has a duplicate name in the same scope`;case be.NoProperties:return`${le(l.entity,l.entity.project)} has no properties, so it doesn't do anything`;case be.NonStaticPropertyInStaticEntity:return`${le(l.entity,l.entity.project)} has a non-static property in a static entity`;case be.StaticEntityWithNonStaticProperties:return`${le(l.entity,l.entity.project)} has non-static properties in a static entity`;case be.ReadingFromIncompatibleType:return`${le(l.entity,l.entity.project)} reads data from a value of a different data type`;case be.WritingToIncompatibleType:return`${le(l.entity,l.entity.project)} writes data to a value of a different data type`;case be.ScopeWithoutLogic:return`${le(l.entity,l.entity.project)} has no logic`;case be.NonStaticPropertyImplementsStatic:return`${le(l.entity,l.entity.project)} has a static property in a non-static entity`;case be.PropertyImplementsIncompatibleType:return`${le(l.entity,l.entity.project)} implements a property of a different data type`;case be.PropertyImplementsNonAbstact:return`${le(l.entity,l.entity.project)} implements a non-template property`;case be.StaticPropertyImplementsNonStatic:return`${le(l.entity,l.entity.project)} has a static property in a non-static entity`;case be.VariableCallsOthersAndHasInternalCall:return`${le(l.entity,l.entity.project)} calls other entities while being used to execute internal logic`;case be.VariableHasInputsAndInternalCall:return`${le(l.entity,l.entity.project)} has inputs while being used to execute internal logic`;case be.VariableHasOutputsAndInternalCall:return`${le(l.entity,l.entity.project)} has outputs while being used to execute internal logic`;case be.VariableIsCalledAndHasInternalCall:return`${le(l.entity,l.entity.project)} is called while being used to execute internal logic`;case Ce.InternalCallDeclarationIsInvalidType:return`${le(l.entity,l.entity.project)} has a declaration that is not an action`;case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${le(l.entity,l.entity.project)} has a declaration that is not found in ${(p=l.entity.parent.getDataType(null))!=null&&p.entity?le((i=l.entity.parent.getDataType(null))==null?void 0:i.entity,l.entity.project):"the variable's data-type entity"}`;case Ce.InternalCallParentDeclarationEntityInvalidType:return`${le(l.entity,l.entity.project)} is part of a variable whos data-type entity can't have actions`;case Ce.InternalCallParentMissingDataType:return`${le(l.entity,l.entity.project)} is part of a variable with no data-type entity`;case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return`${le(l.entity,l.entity.project)} has a declaration doesn't belong to ${(r=l.entity.parent.getDataType(null))!=null&&r.entity?le((a=l.entity.parent.getDataType(null))==null?void 0:a.entity,l.entity.project):"the variable's data-type entity"}`;case Ce.UnreachableEntity:return`${le(l.entity,l.entity.project)} is unreachable`;case be.DisconnectedCallableEntity:return`${le(l.entity,l.entity.project)} is disconnected and won't be executed by anything after publishing`;case be.AbstractEntityImplements:return`${le(l.entity,l.entity.project)} implements a non-template entity`;case be.AbstractExtendingNonAbstractEntity:return`${le(l.entity,l.entity.project)} extends a non-template entity`;case be.InvalidPropertiesCombination:return`${le(l.entity,l.entity.project)} has an invalid combination of properties`;case be.ExtendingNonInteractiveEntity:return`${le(l.entity,l.entity.project)} extends a non-interactive entity`;case be.ExtendsIncompatibleEntities:return`${le(l.entity,l.entity.project)} extends incompatible entities`;case be.ImplementingNonAbstractEntity:return`${le(l.entity,l.entity.project)} implements a non-template entity`;case be.ImplementsIncompatibleEntities:return`${le(l.entity,l.entity.project)} implements incompatible entities`;case be.LackingReturnStatementOnSomeBranches:return`${le(l.entity,l.entity.project)} has branches that don't terminate`;case be.LastCalledEntityMustBeReturnEntity:return`${le(l.entity,l.entity.project)} must end with a termination node`;case be.MissingRequiredValue:return`${le(l.entity,l.entity.project)} is missing a required value`;case be.NoPrimaryKeyProperty:return`${le(l.entity,l.entity.project)} has no primary key property`;case be.NonAbstractExtendingAbstractEntity:return`${le(l.entity,l.entity.project)} is a non-template entity extending a template entity`;case be.NonStaticExtendingStaticEntity:return`${le(l.entity,l.entity.project)} is a non-static entity extending a static entity`;case be.NonStaticImplementingStaticEntity:return`${le(l.entity,l.entity.project)} is a non-static entity implementing a static entity`;case be.StaticExtendingNonStaticEntity:return`${le(l.entity,l.entity.project)} is a static entity extending a non-static entity`;case be.StaticImplementingNonStaticEntity:return`${le(l.entity,l.entity.project)} is a static entity implementing a non-static entity`;case be.VariableReadsValueAndInternalCall:return`${le(l.entity,l.entity.project)} reads a value and has an internal call`;case be.VariableWritesValuesAndInternalCall:return`${le(l.entity,l.entity.project)} writes values and has an internal call`;case Ce.EmptyName:return`${Xa[l.entity.type]} has no name`;case Ce.InvalidObjectStructure:return`${le(l.entity,l.entity.project)} has an invalid structure`;case Ce.LoopBodyFunctionOverwrite:return`${le(l.entity,l.entity.project)}'s loop body action overwrites`;case Ce.MethodOverwritesBaseMethodWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites a base action with same implementation`;case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites another action with same implementation`;case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites another action with same implementation`;case Ce.MissingCaller:return`${le(l.entity,l.entity.project)} is missing a caller`;case Ce.NameAsResolvedCodeNameNotUniqueInScope:return`${le(l.entity,l.entity.project)} has a name that is not unique in the scope`;case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${le(l.entity,l.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ce.NameMustStartWithLetterOrUnderscore:return`${le(l.entity,l.entity.project)} name must start with letter or underscore`;case Ce.NoOverlapWithImplementedSignature:return`${le(l.entity,l.entity.project)} has no overlap with implemented signature`;case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites a base property with same implementation`;case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites another property with same implementation`;case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites another property with same implementation`;case Ce.ReaderWriterIncompatibleDataType:return`${le(l.entity,l.entity.project)} has a reader/writer with incompatible data type`;case ad.StatusCodeMustBeBetween100And599:return`${le(l.entity,l.entity.project)} HTTP status code must be between 100 and 599`;case ad.StatusCodeMustBeNumber:return`${le(l.entity,l.entity.project)} HTTP status code must be a number, between 100 and 599`;case ts.UUIDMustBeString:return`${le(l.entity,l.entity.project)} UUID must be a string, eg: "${ap()}"`;case ts.UUIDMustNotContainSpaces:return`${le(l.entity,l.entity.project)} UUID must not contain spaces, eg: "${ap()}"`;case ts.UUIDMustBeValidFormat:return`${le(l.entity,l.entity.project)} UUID must be in a valid format. Eg: "${ap()}"`;case Ta.MustBeUniqueAmongSameEntities:return`${le(l.entity,l.entity.project)} value must be unique among the same kind`;case Ta.StringValueMustNotHaveDashes:return`${le(l.entity,l.entity.project)} value must not contain dashes`;case Ta.StringValueMustNotHaveSpaces:return`${le(l.entity,l.entity.project)} value must not contain spaces`;default:return`${le(l.entity,l.entity.project)} Error: ${cE(l.code)}`}}function fE(l){const p=(l||"").startsWith("error-caller-only--");switch(p?l.replace("error-caller-only--",""):l){case Wt.CallIsInHigherScope:return"In a higher scope";case Wt.CallIsInLowerScope:return"In a lower scope";case Wt.CallerIsInHigherScope:return"Caller is in a higher scope";case Wt.CallerIsInLowerScope:return"Caller is in a lower scope";case Wt.CannotBeCalledByChildren:return"Cannot be called by children";case Wt.CannotCallAncestor:return"Cannot call ancestor";case Wt.CannotConnectToItself:return"Cannot connect to itself";case Wt.CannotReadMoreThanOneValue:return"Cannot read more than one value";case Wt.CannotReadValueFromChildren:return"Cannot read value from entities executed after itself";case Wt.CannotWriteValueToAncestor:return"Cannot write value to ancestor";case tv.Suggestion:return"Suggestion";case Wt.ContinueOrBreakStatementCalledFromOutsideLoop:return"Cannot be called from outside loop";case Wt.DataTypesNotCompatible:return"Data types not compatible";case Wt.ElementInLoopBodyCallingOutsideLoop:return"Cannot call outside loop";case Wt.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees:return"Error cannot be connected to success branch";case Wt.ExecutionsAlreadyConnected:return"Executions already connected";case Wt.IsNotValueReadingEntity:return"Is not a value reading entity";case Wt.IsNotValueWritingEntity:return"Is not a value writing entity";case Wt.NotInScope:return"Not in a compatible scope";case Wt.OtherIncompatibleScopeReason:return"Incompatible scope";case Wt.SiblingInternalCallAlreadyUsedInParentVariable:return"Internal call already used in parent variable";case Wt.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees:return"Success cannot be connected to error branch";case Wt.ValuesAlreadyConnected:return"Values already connected";case Wt.CannotInteractWithInputInVariableWithInternalCalls:return"Cannot interact with input in variable with internal calls";case Wt.CannotInteractWithOutputInVariableWithInternalCalls:return"Cannot interact with output in variable with internal calls";case tv.CanvasGloballyDisabled:return"Canvas is globally disabled";case Wt.PropertyIsConstantItsValueCantBeReset:return"Property is constant, its value can't be reset";case Wt.CannotWriteValueOfGlobalVariableDeclaration:return"Cannot write value of global variable declaration";case Wt.CannotReSetValueOfConstantVariable:return"Cannot re-set value of constant variable";case Wt.CannotConnectToOwnNode:return"It is part of the same node";case Wt.CalledByErrorMustBePassThroughCallable:return"Called by error must be pass-through callable";case Wt.CannotChangeScopeBecauseItCallsOtherEntities:return"Cannot change scope because it calls other entities in its current scope";case Wt.CannotChangeScopeBecauseItIsAlreadyCalledByOtherEntitiesInDifferentScope:return"Cannot change scope because it is already called by other entities in different scope";case Wt.VariableDeclarationCannotBeMovedToLowerScopeBecauseInstancesUsage:return"Variable declaration cannot be moved to lower scope because its instances are used in the current or different incompatible lower scope";case Wt.CalledBySourceMustBeCallerEntity:return"Not a caller type";case Wt.CalledByErrorCannotBeConnectedToEntitiesCalledByOwnSuccessBranch:return"Already connected to the success branch from a common origin caller";case Wt.CalledBySuccessCannotBeConnectedToEntitiesCalledByOwnErrorBranch:return"Already connected to the error branch from a common origin caller";case Wt.RedundantCall:return"Redundant call. Already connected further down the execution path";case Wt.CannotBeCalledBeforeDeclaration:return"Cannot be called before declaration";case Wt.CannotBeCalledInParallelBranchToDeclaration:return"Cannot be called in parallel branch to declaration";case Wt.CannotBeHigherScopeThanDeclaration:return"Cannot be in a higher scope than declaration";case Wt.CannotCallGlobalVariableDeclaration:return"Cannot call global variable declaration";case Wt.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";case Wt.CannotInteractWithInputInGlobalVariableDeclaration:return"Cannot interact with input in global variable declaration";case Wt.IsNotCallableEntity:return"Is not a callable node type";case Wt.IsNotCallerEntity:return"Is not a caller node type";case Wt.IsNotPassThroughCallableEntity:return"Is not a pass-through callable node type that has an error branch";case Wt.NotAConnectableEntityType:return"Not a connectable node type";case Wt.WouldMakeAnEarlierNodeBeCalledBeforeItsDeclaration:return"Would make an earlier node be called before its declaration";default:return Ac(l||"")}}function rRi(l,p){const i=[...l,...p],r=Array.from(new Set(i));return{hasChanged:r.length!==l.length,reasons:r}}function nRi(l,p){const i=l.filter(a=>!p.includes(a));return{hasChanged:i.length!==l.length,reasons:i}}function aRi(l,p){return l.find(i=>i.entity.id===p)||null}function kk(l){return l.filter((p,i)=>l.indexOf(p)===i)}class Xr{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=TBe-RI-Qx,c=vBe-eI-Xx;p.type===d.Project?(p.x=a,p.y=c):p.metaSync({x:p.x||a,y:p.y||c},i);const e=new Xr(p,0,null,i);e.calculationEntryPoint=e,e._onlyEntities=r||[],e.ids=["0"];const f=[];e.next(m=>{f.push(...m)}),Xr.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&&Xr.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=Xr.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=Wl(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(Bt.includes(e.type)){a.push(e);return}i.push(e)});const c=i.sort((e,f)=>{const h=!!MI(e,f).length,m=Wl(e),E=Wl(f);return h?0:m.length&&!E.length?-1:!m.length&&E.length?1:0}).filter(e=>!Dc(e).length);this.childEntities=[...r,...a,...c]}else{const i=[],r=[],a=[],c=[],e=[];Wi.includes(this.entity.type)&&W1(this.entity).forEach(m=>{if(xt.includes(m.type)){a.push(m);return}const E=yt(m);i.push(E)}),Er.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:xt.includes(h.type)?(a.push(h),!1):er.includes(h.type)&&!m?(c.push(h),!1):h.type===d.DefinitionEntity?(e.push(h),!1):!0});i.sort((h,m)=>ql(h,m)?-1:0),c.sort((h,m)=>ql(h,m)?-1:0),a.sort((h,m)=>iV(h,m)?1:iV(m,h)?-1:0),this.childEntities=[...e,...i,...c,...f,...a,...r]}}calculateCardSize(){const p=EBe(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:Xr.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)=>Xr.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)=>Xr.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)=>Xr.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const p=this.ownEntityPlusBufferArea;return this.children.map(a=>a.fullBranchArea).reduce((a,c)=>Xr.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+eI,right:p.right+RI}}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([...Bt].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(Xr.getEarliestParentInChain(a)!==this)return;const e=aRi(r,a.entity.id);r=Xr.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=Xr.filterOutRepeatedAreas([...this.flattenSiblings(),...p]);Xr.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+nf,h={top:f,left:e.left,bottom:f,right:e.right};return Xr.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(p.bottom-p.top)/2-nf;this.shiftDownAlone(r)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const p=this.children.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+nf,h={top:f,left:e.left,bottom:f,right:e.right};return Xr.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(p.bottom-p.top)/2-nf;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 kk(p)}getLowerAreas(){const p=this.getLowerSiblings(),i=this.parents.reduce((r,a)=>[...r,...a.getLowerAreas()],[]);return kk([...p,...i])}adjustVerticallyToAvoidOverlaps(p=[]){const r=Xr.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(_=>MI(this.entity,_.entity))).filter(_=>_.id!==this.entity.id).map(_=>this.findAreaFromEntity(_)).filter(_=>!!_),E=this.getFullAreaUntilAny(m),b=r.getFullAreaUntilAny(m),A=e.reduce((_,N)=>N===this||N.fullBranchArea.left!==E.left?_:Math.max(_,N.fullBranchArea.bottom),b.bottom);if(E.top<A){const _=A-E.top+eI;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 Xr(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 sRi(l,p,i={}){var c;const r=Y.YieldTracker.from(i),a=[];console.log("Generating layout for project...");for(const e of l.instancesList){if(l.diggestedBuiltInBaseEntitiesIds.has(e.id)||!Tf.includes(e.type)||((c=yt(e))==null?void 0:c.id)!==e.id)continue;let f=Gt(e,l);if(!f){console.log("No top scope owner for instance: ",e," in project: ",l);continue}if(!(Bt.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==l;)f=f.parent,Bt.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,p==null||p.add(e,W.Updated),a.push(e),await r.tick()}}Xr.autoGenerateLayout(l,p,a)}async function lRi(l,p,i={}){const r=Y.YieldTracker.from(i),a=[],c=[l,...pt(l)].map(e=>yt(e)).filter(Boolean);for(const e of c){if(l.project.diggestedBuiltInBaseEntitiesIds.has(e.id))continue;let f=Gt(e,l.project);if(f&&!(Bt.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==l.project;)f=f.parent,Bt.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,p==null||p.add(e,W.Updated),a.push(e),await r.tick()}}Xr.autoGenerateLayout(l.project,p,a)}async function oRi(l,p,i={}){const r=Y.YieldTracker.from(i),a=[],c=new Set;hFe(p,{shallowMissingActivesError:!0,excludeAffected:!0}).forEach(m=>{var b;if((!m.x||!m.y)&&!c.has(m.id)&&!l.diggestedBuiltInBaseEntitiesIds.has(m.id)&&(a.push(m),c.add(m.id)),Jl(m,l)){const A=yt(m);A&&!c.has(A.id)&&!l.diggestedBuiltInBaseEntitiesIds.has(A.id)&&(a.push(A),c.add(A.id))}if(Wi.includes(m.type)){const A=m;[A,...pt(A)].forEach(N=>{const P=yt(N);P&&!c.has(P.id)&&!l.diggestedBuiltInBaseEntitiesIds.has(P.id)&&(a.push(P),c.add(P.id))})}m.type===d.DefinitionEntity&&m.methods.forEach(A=>{pt(A).forEach(N=>{const P=yt(N);P&&!c.has(P.id)&&!l.diggestedBuiltInBaseEntitiesIds.has(P.id)&&(a.push(P),c.add(P.id))})}),((b=m.parent)==null?void 0:b.type)===d.Project&&(a.push(m),c.add(m.id),Wi.includes(m.type)&&pt(m).forEach(N=>{const P=yt(N);P&&!c.has(P.id)&&!l.diggestedBuiltInBaseEntitiesIds.has(P.id)&&(a.push(P),c.add(P.id))}))});let f=[];for(const m of a)l.diggestedBuiltInBaseEntitiesIds.has(m.id)||(m.x=0,m.y=0,p==null||p.add(m,W.Updated),f.push(m),await r.tick());f=C(f),Xr.autoGenerateLayout(l,p,f);const h=C([...f,...l.variableDeclarations,...l.variableInstances,...l.loops,...l.conditions,...l.operations,...l.searches]).filter(m=>m.x===0||m.y===0);Xr.autoGenerateLayout(l,p,h)}var gT=(l=>(l.Amazon="amazon",l.Google="google",l.Microsoft="microsoft",l))(gT||{}),_r=(l=>(l.RelationalDatabase="relational-database",l.CompiledLocalCodebase="compiled-local-codebase",l.CloudHostedCodebase="cloud-hosted-codebase",l.HttpApi="http-api",l.HttpEndpoint="http-endpoint",l.ServerlessFunction="serverless-function",l.CronJob="cron-job",l))(_r||{}),__=(l=>(l.Post="post",l.Get="get",l.Acknowledgement="acknowledgment",l.Progress="progress",l.Error="error",l.Complete="complete",l))(__||{}),Xc=(l=>(l.Queued="queued",l.Running="running",l.Success="success",l.Failed="failed",l.CleanedUp="cleaned-up",l.Skipped="skipped",l.AbortedByUser="aborted-by-user",l.UnrecoverableFailure="unrecoverable-failure",l.Reverted="reverted",l.UnpublishingStarted="unpublishing-started",l.Unpublished="unpublished",l))(Xc||{}),V_=(l=>(l.Queued="queued",l.Running="running",l.Success="success",l.Failed="failed",l.CleanedUp="cleaned-up",l.UnrecoverableFailure="unrecoverable-failure",l.Reverted="reverted",l.UnpublishingStarted="unpublishing-started",l.Unpublished="unpublished",l))(V_||{}),Kt=(l=>(l.ProjectNotFound="project-not-found",l.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",l.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",l.DeploymentCompleted="deployment-completed",l.DeploymentStarted="deployment-started",l.DeploymentFailed="deployment-failed",l.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",l.RequestPayloadValidationFailed="request-payload-validation-failed",l.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",l.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",l.ProjectAlreadyBeingPublished="project-already-being-published",l.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",l.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",l.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",l.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",l.CreatingNewRelationalDatabase="creating-new-relational-database",l.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",l.RelationalDatabaseAlreadyExists="relational-database-already-exists",l.RelationalDatabaseDeletionStarted="relational-database-deletion-started",l.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",l.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",l.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",l.HttpApiDeploymentStarted="http-api-deployment-started",l.HttpApiDeploymentCompleted="http-api-deployment-completed",l.HttpApiDeploymentFailed="http-api-deployment-failed",l.CreatingNewHttpApi="creating-new-http-api",l.HttpApiAlreadyExists="http-api-already-exists",l.HttpApiDeletionStarted="http-api-deletion-started",l.HttpApiDeletionCompleted="http-api-deletion-completed",l.HttpApiDeletionFailed="http-api-deletion-failed",l.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",l.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",l.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",l.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",l.BundlingCodebaseForDownload="bundling-codebase-for-download",l.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",l.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",l.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",l.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",l.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",l.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",l.CodeCompilationStarted="code-compilation-started",l.CodeCompilationCompleted="code-compilation-completed",l.CodeCompilationFailed="code-compilation-failed",l.BundleCodebaseStarted="bundle-codebase-started",l.BundleCodebaseCompleted="bundle-codebase-completed",l.BundleCodebaseFailed="bundle-codebase-failed",l.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",l.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",l.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",l.MigrateRelationalDatabaseStarted="migrate-relational-database-started",l.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",l.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",l.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",l.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",l.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",l.ExecutePublicationCompletedEventTimedOut="execute-publication-completed-event-timed-out",l))(Kt||{}),Ul=(l=>(l.CodeCompilation="code-compilation",l.RelationalDatabaseDeployment="relational-database-deployment",l.RelationalDatabaseDeletion="relational-database-deletion",l.HttpApiDeployment="http-api-deployment",l.HttpApiDeletion="http-api-deletion",l.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",l.BundleCodebase="bundle-codebase",l.MigrateRelationalDatabase="migrate-relational-database",l.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",l.ExecutePublicationCompletedEvent="execute-publication-completed-event",l.CodebaseCleanup="codebase-cleanup",l))(Ul||{});_r.CloudHostedCodebase,_r.HttpApi,_r.RelationalDatabase,_r.CloudHostedCodebase,_r.CloudHostedCodebase,_r.RelationalDatabase,_r.CloudHostedCodebase,_r.CloudHostedCodebase;function ABe(l){return`project-${l}-http-api`}function h1(l){return`entity-${l}-database`}class IBe{constructor(p,i,r,a,c,e,f,h,m){R(this,"stepType");R(this,"id");R(this,"resourceType");R(this,"index");R(this,"dependency",[]);R(this,"lastEvent",null);R(this,"lastEventTimestamp",null);R(this,"status",Xc.Queued);R(this,"publicationRun");R(this,"resource");this.stepType=p,this.id=i,this.resourceType=r,this.status=a,this.dependency=c,this.index=e,this.lastEventTimestamp=f,this.publicationRun=h,this.resource=m}toJSON(){return{stepType:this.stepType,id:this.id,resourceType:this.resourceType,index:this.index,status:this.status,dependency:this.dependency,lastEvent:this.lastEvent,resource:{resourceId:this.resource.resourceId,resourceType:this.resource.resourceType,provider:this.resource.provider,details:this.resource.details,status:this.resource.status,name:this.resource.name}}}async update(p){var i,r;this.status=p.status,this.dependency=p.dependency,this.index=p.index,this.stepType=p.stepType,this.resourceType=p.resourceType,this.lastEvent=p.lastEvent,this.id=p.id,(r=this.resource)==null||r.setDetails((i=p.resource)==null?void 0:i.details)}}var gBe=(l=>(l.Ready="ready",l.Provisioning="provisioning",l.Queued="queued",l.ProvisioningFailed="provisioning-failed",l.Deleting="deleting",l.DeletingFailed="deleting-failed",l.Deleted="deleted",l))(gBe||{});class Ff{constructor(p,i,r){R(this,"provisionedBy");R(this,"publicationRun");R(this,"resourceType");R(this,"provider");R(this,"resourceId");R(this,"details",null);R(this,"name",null);R(this,"status","queued");this.publicationRun=p,this.resourceType=i,this.provider=r}setDetails(p){this.details=p}setStatus(p){this.status=p}setProvisionedBy(p){this.provisionedBy=p}}class dRi extends Ff{constructor(i,r,a){super(i,_r.HttpEndpoint,a);R(this,"resourceType",_r.HttpEndpoint);R(this,"owners",new Map);R(this,"details",null);R(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=h1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class uRi extends Ff{constructor(i,r,a){super(i,_r.ServerlessFunction,a);R(this,"resourceType",_r.ServerlessFunction);R(this,"owners",new Map);R(this,"details",null);R(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=h1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class RBe extends Ff{constructor(i,r,a){super(i,_r.HttpApi,a);R(this,"resourceType",_r.HttpApi);R(this,"owners",new Map);R(this,"details",null);R(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=ABe(this.publicationRun.project.id),this.resourceId}}class DBe extends Ff{constructor(i,r,a){super(i,_r.RelationalDatabase,a);R(this,"resourceType",_r.RelationalDatabase);R(this,"owners",new Map);R(this,"details",null);R(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=h1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class wBe extends Ff{constructor(i,r){super(i,_r.CloudHostedCodebase,r);R(this,"resourceType",_r.CloudHostedCodebase);R(this,"details",null);R(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class CBe extends Ff{constructor(i,r){super(i,_r.CompiledLocalCodebase,r);R(this,"resourceType",_r.CompiledLocalCodebase);R(this,"details",null);R(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`,this.resourceId}}class pRi{constructor(p,i){R(this,"id");R(this,"projectAutoIncrementPublicationCount");R(this,"projectPublishedSemanticVersion");R(this,"projectVersion");R(this,"projectId");R(this,"triggeredBy");R(this,"createdAt");R(this,"updatedAt");R(this,"status");R(this,"steps",[]);R(this,"editor");R(this,"explicitResources",new Map);R(this,"implicitGlobalResources",new Map);R(this,"finalGlobalEvent",null);R(this,"finalStatus",null);R(this,"contextType",ae.PublicationRun);R(this,"extensionsRegistry");this.id=p.id,this.projectAutoIncrementPublicationCount=p.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=p.projectPublishedSemanticVersion,this.projectVersion=p.projectVersion,this.projectId=p.projectId,this.triggeredBy=p.triggeredBy,this.createdAt=p.createdAt,this.updatedAt=p.updatedAt,this.status=p.status,this.editor=i,this.initRegistry()}get off(){return this.extensionsRegistry.off}get on(){return this.extensionsRegistry.on}get emit(){return this.extensionsRegistry.emit}get emitAsync(){return this.extensionsRegistry.emitAsync}get emitAsyncAll(){return this.extensionsRegistry.emitAsyncAll}get emitAsyncAllSettled(){return this.extensionsRegistry.emitAsyncAllSettled}get emitAsyncSequentially(){return this.extensionsRegistry.emitAsyncSequentially}get emitAsyncSequentiallyAll(){return this.extensionsRegistry.emitAsyncSequentiallyAll}get emitAsyncSequentiallyAllSettled(){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled}get project(){return this.editor.project}getInfraTypes(p){return this.steps.filter(i=>p.includes(i.resourceType))}getStepsTypes(p){return this.steps.filter(i=>p.includes(i.stepType))}toIds(p){return p.map(i=>i.id)}getResourceForEntity(p){const i=Array.from(this.explicitResources.values()).find(r=>r.owners.has(p.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(_r.CompiledLocalCodebase,new CBe(this,gT.Amazon)),this.implicitGlobalResources.set(_r.CloudHostedCodebase,new wBe(this,gT.Amazon));const p=this.project.entities.filter(r=>si(r,ge.HTTP_ENDPOINT)),i=this.project.entities.filter(r=>si(r,ge.RELATIONAL_DATABASE));if(i.length&&i.forEach(r=>{const a=new DBe(this,[r],gT.Amazon);this.explicitResources.set(a.resourceId,a)}),p.length){const r=new RBe(this,p,gT.Amazon);this.explicitResources.set(r.resourceId,r)}}setSteps(p,i){p.forEach(r=>{this.addStep(r,i)}),this.editor.events.emit(Kt.ProjectPublishRequestAcknowledged,{})}addStep(p,i){const r=p.dependency||[];if(r.length){const c=r.filter(e=>!this.steps.find(f=>f.id===e));if(c.length)throw new Error(`Missing dependencies: ${c.join(", ")}`)}if(!this.steps.find(c=>c.id===p.id)){const c=new IBe(p.stepType,p.id,p.resourceType,p.status,r,p.index,i,this,null);this.steps.push(c)}}onUpdate(p){var i;if(Y.Logger.log("onUpdate",p),(i=p.payload)!=null&&i.stepType){const r=this.steps.find(a=>{var c;return a.id===((c=p.payload)==null?void 0:c.id)});r&&B(p.emittedAt).isAfter(B(r.lastEventTimestamp))&&r.update(p.payload)}this.editor.events.emit("publication-updated",{}),p.type===__.Error?(this.finalStatus=V_.Failed,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-error",p)):p.type===__.Complete&&(this.finalStatus=V_.Success,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-completed",p))}requestExtension(p){return this.extensionsRegistry.requestExtension(p)}async initRegistry(){return this.extensionsRegistry=new Zx(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(ae.PublicationRun),this.extensionsRegistry}}function cRi(l){switch(l){case Ul.CodeCompilation:return"Code generation";case Ul.RelationalDatabaseDeployment:return"Database creation";case Ul.HttpApiDeployment:return"HTTP gateway creation";case Ul.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case Ul.BundleCodebase:return"Bundle code";case Ul.MigrateRelationalDatabase:return"Database structure migration";case Ul.BusinessLogicCodebaseDeployment:return"Update servers with new code";case Ul.CodebaseCleanup:return"Code cleanup";case Ul.HttpApiDeletion:return"HTTP gateway deletion";case Ul.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function fRi(l){switch(l){case Kt.DeploymentCompleted:return"Successfully published";case Kt.DeploymentStarted:return"Publication started";case Kt.DeploymentFailed:return"Publication failed";case Kt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case Kt.RequestPayloadValidationFailed:return"Request payload validation failed";case Kt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case Kt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case Kt.RelationalDatabaseDeploymentStarted:return"Database creation started";case Kt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case Kt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case Kt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case Kt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case Kt.RelationalDatabaseAlreadyExists:return"Database already exists";case Kt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case Kt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case Kt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case Kt.CreatingNewHttpApi:return"Creating new HTTP gateway";case Kt.HttpApiAlreadyExists:return"HTTP gateway already exists";case Kt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case Kt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case Kt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case Kt.BundlingCodebaseForDownload:return"Bundling code for download";case Kt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case Kt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case Kt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case Kt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case Kt.CodeCompilationStarted:return"Code generation started";case Kt.CodeCompilationCompleted:return"Code generation completed";case Kt.CodeCompilationFailed:return"Code generation failed";case Kt.BundleCodebaseStarted:return"Code bundling started";case Kt.BundleCodebaseCompleted:return"Code bundling completed";case Kt.BundleCodebaseFailed:return"Code bundling failed";case Kt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case Kt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case Kt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case Kt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case Kt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case Kt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case Kt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case Kt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case Kt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case Kt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case Kt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case Kt.ProjectNotFound:return"Project not found";case Kt.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case Kt.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case Kt.HttpApiDeletionStarted:return"HTTP gateway deletion started";case Kt.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case Kt.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case Kt.RelationalDatabaseDeletionStarted:return"Database deletion started";case Kt.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case Kt.RelationalDatabaseDeletionFailed:return"Database deletion failed";case Kt.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var OBe=(l=>(l.NO_LOGIC="NO_LOGIC",l.NO_NAME="NO_NAME",l.NO_CHANGES="NO_CHANGES",l.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",l))(OBe||{});function yRi(l){switch(l){case"NO_LOGIC":return"This project has no logic";case"NO_NAME":return"This project has no name";case"NO_CHANGES":return"This version has already been published";case"PROJECT_PUBLICATION_ALREADY_ONGOING":return"This project is already being published";default:return"Publishing is currently not available. Try again later"}}function hRi(l){switch(l){case _r.RelationalDatabase:return"Relational database";case _r.HttpEndpoint:case _r.HttpApi:return"HTTP endpoints";case _r.ServerlessFunction:case _r.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function mRi(l){switch(l){case Xc.Running:return"In progress";case Xc.Failed:return"Failed";case Xc.Success:return"Succeeded";case Xc.Skipped:return"Skipped";case Xc.Queued:default:return"Queued"}}function _Be(l){var r;if(!si(l,ge.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=ne["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(l.type===d.BuiltInBaseEntity?si(l,ge.EXTERNAL_INTEGRATION_CONNECTION)&&(p=P_(l.name)):l.type===d.DefinitionEntity&&l.implements.forEach(a=>{if(si(a,ge.EXTERNAL_INTEGRATION_CONNECTION)){const c=P_(a==null?void 0:a.name);if(c)return p=c,!0}}),!p){const a=l.properties.find(c=>!!c.implements.find(e=>e.id===i)||!!c.implements.find(e=>{var f;return((f=e.extends)==null?void 0:f.id)===i}));p=(r=a==null?void 0:a.getDefaultValue())==null?void 0:r.value}return p}function TRi(l){return h0e[l]}function P_(l){return l.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?l.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function VBe(l){if(l.type!==d.ActionDescriptor&&l.type!==d.Operation)throw new Error("Only ActionDescriptorState or OperationState can be used to resolve an external integration ID");if(l.type===d.ActionDescriptor){const p=l;if(p.id.startsWith("external-integration--"))return p.id.split("--")[1]}if(l.type===d.Operation){const p=l.declaration;if(Object.values(fi).includes(p.id))return p.id.split("--")[1]||null}return null}function vRi(l){if(!l)throw new Error("The integrationName parameter is required to resolve the base built-in name.");return Object.values(ge).find(i=>!!(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")&&i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===l.toLowerCase()))||null}function ERi(l){return l.type===d.BuiltInBaseEntity||l.type===d.DefinitionEntity?_Be(l):l.type===d.ActionDescriptor||l.type===d.Operation?VBe(l):null}function PBe(l){var a,c,e;if(!si(l,ge.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=aFe(l,ge.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const r=ne["built-in-base-entity"][i.id].properties.connectionId.id;if(l.type===d.BuiltInBaseEntity){if(si(l,ge.EXTERNAL_INTEGRATION_CONNECTION)){const f=l.properties.find(h=>{var m;return((m=h.extends)==null?void 0:m.id)===r});f&&(p=(a=f.getDefaultValue())==null?void 0:a.value)}}else if(l.type===d.DefinitionEntity){const f=l.properties.find(h=>!!h.implements.find(m=>m.id===r)||!!h.implements.find(m=>{var E;return((E=m.extends)==null?void 0:E.id)===r}));if(!f&&((c=l.extends)==null?void 0:c.type)===d.DefinitionEntity)return PBe(l.extends);p=(e=f==null?void 0:f.getDefaultValue())==null?void 0:e.value}return p}async function NBe(l,p={}){var f;const i=Y.YieldTracker.from(p),a=[...ca(l),...vs(l),...t$(l),...fa(l),...i$(l)],c=xE(l);a.push(...c);const e=qt(l.errors,a);await i.tick();for(const h of l.inputs)await h.validateAsync({tracker:i});for(const h of l.outputs)await h.validateAsync({tracker:i});for(const h of l.internalCalls)await h.validateAsync({tracker:i});return await((f=l.dataType)==null?void 0:f.validateAsync({tracker:i})),e}function xBe(l){var a;(a=l.dataType)==null||a.validate(),l.inputs.forEach(c=>c.validate()),l.outputs.forEach(c=>c.validate()),l.internalCalls.forEach(c=>c.validate());const i=[...ca(l),...vs(l),...t$(l),...fa(l),...i$(l)],r=xE(l);return i.push(...r),qt(l.errors,i)}function t$(l,p){const r=[...l.project.getVariableDeclarations()].filter(a=>a.id!==l.id);return LE(l,[Qi],r,p)}function i$(l){const p=[];if(l.parent!==l.project)return p;if(l.catchesError){const i=It({id:`${l.id}--${Ce.GlobalVariableDeclarationCannotCatchError}`,message:`${Xa[l.type].singular} "${le(l,l.project)}" with id "${l.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:Te.Error,code:Ce.GlobalVariableDeclarationCannotCatchError,entity:l});p.push(i.error)}if(l.errorCalls.length){const i=It({id:`${l.id}--${Ce.GlobalVariableDeclarationCannotCallOnError}`,message:`${Xa[l.type].singular} "${le(l,l.project)}" with id "${l.id}" cannot call other entities from its error branch because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:Te.Error,code:Ce.GlobalVariableDeclarationCannotCallOnError,entity:l});p.push(i.error)}if(l.calledBy.length){const i=It({id:`${l.id}--${Ce.GlobalVariableDeclarationCannotBeCalled}`,message:`${Xa[l.type].singular} "${le(l,l.project)}" with id "${l.id}" cannot be called because it is globally declared. Global variable declarations must be self initialized when the project is loaded, and not be called for initialization.`,severity:Te.Error,code:Ce.GlobalVariableDeclarationCannotBeCalled,entity:l});p.push(i.error)}return[]}const bRi=Object.freeze(Object.defineProperty({__proto__:null,validate:xBe,validateAsync:NBe,validateGlobalVariableDeclaration:i$,validateVariableDeclarationName:t$},Symbol.toStringTag,{value:"Module"}));async function $Be(l,p={}){const i=Y.YieldTracker.from(p),a=[...ca(l),...vs(l),...fa(l),...Wo(l),...BBe(l)],c=xE(l);a.push(...c);const e=qt(l.errors,a);await i.tick();for(const f of l.inputs)await f.validateAsync({tracker:i});for(const f of l.outputs)await f.validateAsync({tracker:i});for(const f of l.internalCalls)await f.validateAsync({tracker:i});return e}function LBe(l){l.inputs.forEach(a=>a.validate()),l.outputs.forEach(a=>a.validate()),l.internalCalls.forEach(a=>a.validate());const i=[...ca(l),...vs(l),...fa(l)],r=xE(l);return i.push(...r),qt(l.errors,i)}function BBe(l){const p=[],i=l.declaration.constant;if(i&&l.readsValue){const r=It({id:`${l.id}--${be.ValueReadingOverridesConstantVariable}`,message:`The '${l.type}' entity "${le(l,l.project)}" with id "${l.id}" is a constant variable whose value cannot be overriden, but reads a value.`,severity:Te.Error,code:be.ValueReadingOverridesConstantVariable,entity:l});p.push(r.error)}if(i&&l.defaultValue){const r=It({id:`${l.id}--${be.DefaultValueOverridesConstantVariable}`,message:`The '${l.type}' entity "${le(l,l.project)}" with id "${l.id}" is a constant variable whose value cannot be overridden, but has a 'defaultValue'.`,severity:Te.Error,code:be.DefaultValueOverridesConstantVariable,entity:l});p.push(r.error)}return p}function Wo(l){var h;const p=[],i=l.declaration;if((i==null?void 0:i.id)===((h=l.parent)==null?void 0:h.id)||!l.calledBy.length&&l.successCalls.length&&l.errorCalls.length)return p;const r=pt(l),a=pt(i);!!r.find(m=>m.id===i.id)&&p.push(It({id:`${l.id}--${be.CalledBeforeDeclaration}`,code:be.CalledBeforeDeclaration,severity:Te.Error,message:`Entity of type "${l.type}" with id "${l.id}" is called before its 'variable-declaration' '${i.name}' with id "${i.id}".
54
+ `+c):r.stack=c}catch{}}throw r}}_request(p,i){typeof p=="string"?(i=i||{},i.url=p):i=p||{},i=ff(this.defaults,i);const{transitional:r,paramsSerializer:a,headers:c}=i;r!==void 0&&JA.assertOptions(r,{silentJSONParsing:qo.transitional(qo.boolean),forcedJSONParsing:qo.transitional(qo.boolean),clarifyTimeoutError:qo.transitional(qo.boolean)},!1),a!=null&&(qe.isFunction(a)?i.paramsSerializer={serialize:a}:JA.assertOptions(a,{encode:qo.function,serialize:qo.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),JA.assertOptions(i,{baseUrl:qo.spelling("baseURL"),withXsrfToken:qo.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"],N=>{delete c[N]}),i.headers=Sl.concat(e,c);const f=[];let h=!0;this.interceptors.request.forEach(function(P){typeof P.runWhen=="function"&&P.runWhen(i)===!1||(h=h&&P.synchronous,f.unshift(P.fulfilled,P.rejected))});const m=[];this.interceptors.response.forEach(function(P){m.push(P.fulfilled,P.rejected)});let E,b=0,A;if(!h){const N=[Mk.bind(this),void 0];for(N.unshift(...f),N.push(...m),A=N.length,E=Promise.resolve(i);b<A;)E=E.then(N[b++],N[b++]);return E}A=f.length;let _=i;for(;b<A;){const N=f[b++],P=f[b++];try{_=N(_)}catch(j){P.call(this,j);break}}try{E=Mk.call(this,_)}catch(N){return Promise.reject(N)}for(b=0,A=m.length;b<A;)E=E.then(m[b++],m[b++]);return E}getUri(p){p=ff(this.defaults,p);const i=HLe(p.baseURL,p.url,p.allowAbsoluteUrls);return FLe(i,p.params,p.paramsSerializer)}}qe.forEach(["delete","get","head","options"],function(p){II.prototype[p]=function(i,r){return this.request(ff(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(ff(f||{},{method:p,headers:r?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}II.prototype[p]=i(),II.prototype[p+"Form"]=i(!0)});const QA=II;class qx{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 Cm(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 qx(function(a){p=a}),cancel:p}}}const jgi=qx;function kgi(l){return function(i){return l.apply(null,i)}}function Ugi(l){return qe.isObject(l)&&l.isAxiosError===!0}const w_={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(w_).forEach(([l,p])=>{w_[p]=l});const Fgi=w_;function QLe(l){const p=new QA(l),i=VLe(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 QLe(ff(l,a))},i}const Ln=QLe(Fx);Ln.Axios=QA;Ln.CanceledError=Cm;Ln.CancelToken=jgi;Ln.isCancel=SLe;Ln.VERSION=JLe;Ln.toFormData=o1;Ln.AxiosError=Pi;Ln.Cancel=Ln.CanceledError;Ln.all=function(p){return Promise.all(p)};Ln.spread=kgi;Ln.isAxiosError=Ugi;Ln.mergeConfig=ff;Ln.AxiosHeaders=Sl;Ln.formToJSON=l=>qLe(qe.isHTMLForm(l)?new FormData(l):l);Ln.getAdapter=YLe.getAdapter;Ln.HttpStatusCode=Fgi;Ln.default=Ln;const Kgi=Ln;class XLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(la.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]};Y.Logger.log("Axios request config: ",e);const f=await Kgi(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 e2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.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)});Y.Logger.log("Inputs for entity validation: ",a);const e=tD(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 Ua=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 t2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY,version:"1.0.0",description:"Entity read-key operation implementation module (top-level)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.ReadKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ua(r),e=C_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class i2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY,version:"1.0.0",description:"Entity write-key operation implementation module (top-level, immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.WriteKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ua(r),f=O_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 Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY,version:"1.0.0",description:"Entity delete-key operation implementation module (top-level, immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.DeleteKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ua(r),e=__e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class n2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY,version:"1.0.0",description:"Entity read-nested-key operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.ReadNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ua(r),f=V_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class a2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.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:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.WriteNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ua(r),f=P_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class s2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.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:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.WriteSafeNestedKeyRecursively);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ua(r),f=N_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class l2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY,version:"1.0.0",description:"Entity delete-nested-key operation implementation module (immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.DeleteNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ua(r),e=x_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class o2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY,version:"1.0.0",description:"Object has-key (top-level property present?)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.HasKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ua(r),e=$_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class d2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object key-value-equals (top-level property strict equality)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.KeyValueEquals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Ua(r),f=L_e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class u2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY,version:"1.0.0",description:"Object has-nested-key (path present?)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.HasNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ua(r),e=B_e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class p2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object nested-key-value-equals (path strict equality)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.NestedKeyValueEquals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Ua(r),f=M_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 Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE,version:"1.0.0",description:"Object is-instance-of-type (DefinitionEntity-based runtime check)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.IsInstanceOfType);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m,E,b,A,_;try{const N=((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),P=(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(!P)throw new TypeError("IsInstanceOfType expects a non-null input value.");if(!j)throw new TypeError("IsInstanceOfType expects a valid expectedType input.");if(!N)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 M=N.getDataType(null);if(((A=M==null?void 0:M.entity)==null?void 0:A.type)!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType cannot determine the data type of the input value.");let G=!1;return((_=M==null?void 0:M.entity)==null?void 0:_.id)!==(j==null?void 0:j.id)?G=!1:tD(M==null?void 0:M.entity).safeParse(P).success?G=!0:G=!1,{value:U.Success,error:null,result:G}}catch(N){return{value:U.UnhandledError,error:N,result:null}}}})}}class f2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE,version:"1.0.0",description:"Object merge operation implementation module (immutable, shallow merge with right-precedence)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Le.Merge);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Ua(r),c=G_e(...a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class y2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS,version:"1.0.0",description:"Object keys operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Le.Keys);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ua(r),c=j_e(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class h2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES,version:"1.0.0",description:"Object values operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Le.Values);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ua(r),c=k_e(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class m2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES,version:"1.0.0",description:"Object entries operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Le.Entries);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ua(r),c=U_e(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}let _s=null;try{_s=require("crypto")}catch{}const VT=typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto:_s&&_s.webcrypto?_s.webcrypto:null,sp=VT?VT.subtle:null;function KT(l){const p=new ArrayBuffer(l.byteLength);return new Uint8Array(p).set(l),p}function dn(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 Co(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 T2e=l=>dn(l,"base64"),v2e=(l,p)=>{const i=l instanceof Uint8Array?l:dn(String(l),p||"utf8");return Co(i,"base64")},hh=(l,p)=>{const i=l instanceof Uint8Array?l:dn(String(l),p||"utf8");return Co(i,"base64url")},yf=l=>dn(l,"base64url"),E2e=(l,p)=>{const i=l instanceof Uint8Array?l:dn(String(l),p||"utf8");return Co(i,"hex")},b2e=l=>dn(l,"hex");function Sx(l){if(VT&&VT.getRandomValues){const p=new Uint8Array(l);return VT.getRandomValues(p),p}if(_s&&_s.randomBytes)return new Uint8Array(_s.randomBytes(l));throw new Error("Secure random not available")}function p1(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 A2e(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=dn(l??"",a),f=dn(p??"",c);return p1(e,f)}async function I2e(l,p){if(sp){const i=await sp.digest({name:l},KT(p));return new Uint8Array(i)}if(_s){const i=l.replace("SHA-","sha"),r=_s.createHash(i);return r.update(Buffer.from(p)),new Uint8Array(r.digest())}throw new Error("Hash not available")}async function g2e(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=dn(p??"",c),h=await I2e(a,f);return Co(h,e)}async function c1(l,p,i){if(sp){const r=await sp.importKey("raw",KT(p),{name:"HMAC",hash:{name:l}},!1,["sign"]),a=await sp.sign("HMAC",r,KT(i));return new Uint8Array(a)}if(_s){const r=`sha${l.split("-")[1]}`,a=_s.createHmac(r,Buffer.from(p));return a.update(Buffer.from(i)),new Uint8Array(a.digest())}throw new Error("HMAC not available")}async function R2e(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=dn(l??"",f),b=dn(p??"",h),A=await c1(e,E,b);return Co(A,m)}async function f1(l,p,{iterations:i,length:r,hashAlg:a="SHA-256"}){if(sp){const c=await sp.importKey("raw",KT(l),"PBKDF2",!1,["deriveBits"]),e=await sp.deriveBits({name:"PBKDF2",salt:KT(p),iterations:i,hash:a},c,r*8);return new Uint8Array(e)}if(_s){const c=a==="SHA-512"?"sha512":"sha256";return await new Promise((e,f)=>{_s.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 D2e(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),A=Math.max(1,Number(r)||32),_=a??"SHA-256",N=dn(l??"",h),P=dn(p??"",m),j=await f1(N,P,{iterations:b,length:A,hashAlg:_});return Co(j,E)}async function w2e(l,p=Sx(16),i=21e4,r=32,a="SHA-256"){const c=dn(l,"utf8"),e=await f1(c,p,{iterations:i,length:r,hashAlg:a}),f=hh(p),h=hh(e);return`pbkdf2$${a.toLowerCase()}$${i}$${f}$${h}`}async function C2e(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=yf(i[3]),e=yf(i[4]),f=r.includes("512")?"SHA-512":"SHA-256",h=await f1(dn(l,"utf8"),c,{iterations:a,length:e.length,hashAlg:f});return p1(h,e)}async function O2e(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?dn(a,m):void 0;return await w2e(String(l??""),E,e,f,h)}function jk(l){return hh(dn(JSON.stringify(l),"utf8"))}function gI(l){try{return JSON.parse(Co(yf(l),"utf8"))}catch{return null}}async function _2e(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},A=Math.floor(Date.now()/1e3),_={...l||{}};r&&(_.iat=A),typeof a=="number"&&(_.exp=A+a),typeof c=="number"&&(_.nbf=A+c),e&&(_.iss=e),f&&(_.sub=f),h&&(_.aud=h),m&&(_.jti=m);const N=jk(b),P=jk(_),j=dn(`${N}.${P}`,"utf8"),G=await c1(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,j),S=hh(G);return`${N}.${P}.${S}`}async function V2e(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 _=dn(p??"",b??"utf8");return await _2e(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 P2e(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=gI(f),b=gI(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 A=dn(`${f}.${h}`,"utf8"),N=await c1(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,A),P=yf(m);if(!p1(N,P))return{valid:!1,header:E,payload:b,reason:"Bad signature"};const j=Math.floor(Date.now()/1e3),M=Math.max(0,Number(e)||0);if(b.nbf!=null&&j+M<Number(b.nbf))return{valid:!1,header:E,payload:b,reason:"Not before"};if(b.exp!=null&&j-M>=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)+M?{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 N2e(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=dn(p??"",f??"utf8");return await P2e(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 x2e(l){const[p,i,r]=String(l).split(".");return{header:p?gI(p):null,payload:i?gI(i):null,signature:r?yf(r):new Uint8Array}}function $2e(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}=x2e(String(l??"")),e=Co(c,i);return{header:r,payload:a,signature:e}}class L2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES,version:"1.0.0",description:"Randomness generate random bytes operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(nt.GenerateRandomBytes);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)}),e=Math.max(0,Number(a)||0),f=c??"base64url",h=Sx(e),m=Co(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 B2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.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=c_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 M2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomFloat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=e1();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 G2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.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=Ax(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 j2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.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=Ix(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 k2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.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=y_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 U2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.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=gx(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 F2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.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=Rx(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 K2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomUUIDv4);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=ap();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 q2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{Y.Logger.log("Initializing Random Generate Short Identifier Module");const r=i.find(a=>a.contextType===ae.Logic);if(r){Y.Logger.log("Project state found, setting up operation");const a=r.get(nt.GenerateShortIdentifier);a?(Y.Logger.log("Operation found, setting autoexecutable and implementation"),a.autoexecutable=!0,a.implementation=this.module.main):Y.Logger.warn("Operation generate-short-identifier not found in project state")}else Y.Logger.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,r)=>{try{const a=h_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 S2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateHexadecimalToken);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=m_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 qgi(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 Z2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF,version:"1.0.0",description:"Data type get type of operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Qe.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:qgi(c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class H2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING,version:"1.0.0",description:"Coerce any value to string via JS String(value)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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 W2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER,version:"1.0.0",description:"Coerce to number via JS Number(value)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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 z2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES,version:"1.0.0",description:"Convert string/bytes-like to Uint8Array (utf8|hex|base64|base64url)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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=dn(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 Y2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING,version:"1.0.0",description:"Convert Uint8Array to string (utf8|hex|base64|base64url)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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=Co(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 J2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64,version:"1.0.0",description:"Bytes -> base64 string (accepts string input by converting from utf8)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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:v2e(a,c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Q2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64,version:"1.0.0",description:"base64 string -> bytes (Uint8Array)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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=T2e(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 X2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL,version:"1.0.0",description:"Bytes -> base64url string (accepts string input by converting from utf8)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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=hh(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 Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL,version:"1.0.0",description:"base64url string -> bytes (Uint8Array)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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=yf(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 tBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX,version:"1.0.0",description:"Bytes -> hex string (accepts string input by converting from utf8)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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=E2e(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 iBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX,version:"1.0.0",description:"hex string -> bytes (Uint8Array)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Qe.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=b2e(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 rBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH,version:"1.0.0",description:"Crypto: Hash (SHA-256/384/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Ni.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:g2e(a,c,e,f)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class nBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC,version:"1.0.0",description:"Crypto: HMAC (SHA-256/384/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Ni.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,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)});return{value:U.Success,error:null,result:R2e(c,e,a,f,h,m)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class aBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL,version:"1.0.0",description:"Crypto: constant-time equality for byte sequences",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Ni.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:A2e(a,c,e,f)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class sBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2,version:"1.0.0",description:"Crypto: derive key with PBKDF2 (SHA-256/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Ni.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(A=>{var _,N;return((_=A.value)==null?void 0:_.valueAsType)??((N=A.value)==null?void 0:N.value)});return{value:U.Success,error:null,result:D2e(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 lBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE,version:"1.0.0",description:"Json parse string into object operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fn.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 oBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY,version:"1.0.0",description:"Json stringify object into string operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fn.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 dBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC,version:"1.0.0",description:"JWT: build (HS256/384/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ur.BuildJwtHmac);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m,E,b,A,_,N,P]=r.map(j=>{var M,G;return((M=j.value)==null?void 0:M.valueAsType)??((G=j.value)==null?void 0:G.value)});return{value:U.Success,error:null,result:await V2e(a,c,e,f,h,m,E,b,A,_,N,P)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class uBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC,version:"1.0.0",description:"JWT: verify (HS256/384/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ur.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(A=>{var _,N;return((_=A.value)==null?void 0:_.valueAsType)??((N=A.value)==null?void 0:N.value)});return{value:U.Success,error:null,result:await N2e(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 pBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE,version:"1.0.0",description:"JWT: decode (no verification)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(ur.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:$2e(a,c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class cBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2,version:"1.0.0",description:"Password: hash (PBKDF2) -> envelope string",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(yn.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,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)});return{value:U.Success,error:null,result:await O2e(a,c,e,f,h,m)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class fBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2,version:"1.0.0",description:"Password: verify (PBKDF2) -> boolean",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(yn.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 C2e(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 C_ extends n1{constructor(p,i,r=i.projectId){super(p,ae.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 Sgi(l,p){return p instanceof C_?p:new C_(l,p)}class O_ extends n1{constructor(p,i){super(p,ae.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 Zgi(l,p){return p instanceof O_?p:new O_(l,p)}function Hgi(l){l.register(new oVe(l)),l.register(new lVe(l)),l.register(new rVe(l)),l.register(new aVe(l)),l.register(new sVe(l)),l.register(new nVe(l)),l.register(new K$e(l)),l.register(new q$e(l)),l.register(new S$e(l)),l.register(new H$e(l)),l.register(new Z$e(l)),l.register(new W$e(l)),l.register(new B2e(l)),l.register(new M2e(l)),l.register(new G2e(l)),l.register(new j2e(l)),l.register(new k2e(l)),l.register(new U2e(l)),l.register(new F2e(l)),l.register(new K2e(l)),l.register(new q2e(l)),l.register(new S2e(l)),l.register(new Fxe(l)),l.register(new Kxe(l)),l.register(new qxe(l)),l.register(new Sxe(l)),l.register(new Zxe(l)),l.register(new Hxe(l)),l.register(new Wxe(l)),l.register(new zxe(l)),l.register(new Yxe(l)),l.register(new Jxe(l)),l.register(new Qxe(l)),l.register(new Xxe(l)),l.register(new e$e(l)),l.register(new t$e(l)),l.register(new i$e(l)),l.register(new r$e(l)),l.register(new n$e(l)),l.register(new a$e(l)),l.register(new s$e(l)),l.register(new d$e(l)),l.register(new u$e(l)),l.register(new p$e(l)),l.register(new oxe(l)),l.register(new dxe(l)),l.register(new uxe(l)),l.register(new pxe(l)),l.register(new cxe(l)),l.register(new fxe(l)),l.register(new yxe(l)),l.register(new hxe(l)),l.register(new mxe(l)),l.register(new vxe(l)),l.register(new Exe(l)),l.register(new bxe(l)),l.register(new Axe(l)),l.register(new Ixe(l)),l.register(new CNe(l)),l.register(new e2e(l)),l.register(new XLe(l)),l.register(new wPe(l)),l.register(new CPe(l)),l.register(new OPe(l)),l.register(new _Pe(l)),l.register(new VPe(l)),l.register(new PPe(l)),l.register(new NPe(l)),l.register(new xPe(l)),l.register(new $Pe(l)),l.register(new HPe(l)),l.register(new RNe(l)),l.register(new DNe(l)),l.register(new wNe(l)),l.register(new LPe(l)),l.register(new BPe(l)),l.register(new MPe(l)),l.register(new GPe(l)),l.register(new jPe(l)),l.register(new kPe(l)),l.register(new UPe(l)),l.register(new FPe(l)),l.register(new KPe(l)),l.register(new qPe(l)),l.register(new SPe(l)),l.register(new ZPe(l)),l.register(new WPe(l)),l.register(new zPe(l)),l.register(new YPe(l)),l.register(new JPe(l)),l.register(new QPe(l)),l.register(new XPe(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 yNe(l)),l.register(new hNe(l)),l.register(new mNe(l)),l.register(new sNe(l)),l.register(new lNe(l)),l.register(new oNe(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 n2e(l)),l.register(new a2e(l)),l.register(new s2e(l)),l.register(new l2e(l)),l.register(new t2e(l)),l.register(new i2e(l)),l.register(new r2e(l)),l.register(new o2e(l)),l.register(new u2e(l)),l.register(new c2e(l)),l.register(new d2e(l)),l.register(new p2e(l)),l.register(new f2e(l)),l.register(new m2e(l)),l.register(new y2e(l)),l.register(new h2e(l)),l.register(new gxe(l)),l.register(new Cxe(l)),l.register(new Oxe(l)),l.register(new Pxe(l)),l.register(new Nxe(l)),l.register(new xxe(l)),l.register(new $xe(l)),l.register(new Lxe(l)),l.register(new Bxe(l)),l.register(new Mxe(l)),l.register(new Gxe(l)),l.register(new _xe(l)),l.register(new Vxe(l)),l.register(new Dxe(l)),l.register(new wxe(l)),l.register(new Rxe(l)),l.register(new Txe(l)),l.register(new kxe(l)),l.register(new Uxe(l)),l.register(new jxe(l)),l.register(new Y$e(l)),l.register(new bLe(l)),l.register(new ELe(l)),l.register(new ALe(l)),l.register(new ILe(l)),l.register(new X$e(l)),l.register(new eLe(l)),l.register(new sLe(l)),l.register(new nLe(l)),l.register(new TLe(l)),l.register(new pLe(l)),l.register(new fLe(l)),l.register(new hLe(l)),l.register(new yLe(l)),l.register(new aLe(l)),l.register(new oLe(l)),l.register(new dLe(l)),l.register(new lLe(l)),l.register(new z$e(l)),l.register(new tLe(l)),l.register(new cLe(l)),l.register(new DLe(l)),l.register(new I_(l)),l.register(new Q$e(l)),l.register(new iLe(l)),l.register(new J$e(l)),l.register(new mLe(l)),l.register(new rLe(l)),l.register(new uLe(l)),l.register(new vLe(l)),l.register(new RLe(l)),l.register(new gLe(l)),l.register(new wLe(l)),l.register(new I_(l)),l.register(new OLe(l)),l.register(new CLe(l)),l.register(new _Le(l)),l.register(new w$e(l)),l.register(new C$e(l)),l.register(new O$e(l)),l.register(new f$e(l)),l.register(new o$e(l)),l.register(new T$e(l)),l.register(new A$e(l)),l.register(new l$e(l)),l.register(new I$e(l)),l.register(new D$e(l)),l.register(new E$e(l)),l.register(new v$e(l)),l.register(new bI(l)),l.register(new _$e(l)),l.register(new V$e(l)),l.register(new b$e(l)),l.register(new R$e(l)),l.register(new g$e(l)),l.register(new m$e(l)),l.register(new h$e(l)),l.register(new y$e(l)),l.register(new c$e(l)),l.register(new x$e(l)),l.register(new N$e(l)),l.register(new $$e(l)),l.register(new P$e(l)),l.register(new bNe(l)),l.register(new TNe(l)),l.register(new ENe(l)),l.register(new ANe(l)),l.register(new INe(l)),l.register(new vNe(l)),l.register(new gNe(l)),l.register(new Z2e(l)),l.register(new Q2e(l)),l.register(new eBe(l)),l.register(new iBe(l)),l.register(new J2e(l)),l.register(new X2e(l)),l.register(new tBe(l)),l.register(new Y2e(l)),l.register(new z2e(l)),l.register(new W2e(l)),l.register(new H2e(l)),l.register(new lBe(l)),l.register(new oBe(l)),l.register(new aBe(l)),l.register(new sBe(l)),l.register(new L2e(l)),l.register(new rBe(l)),l.register(new nBe(l)),l.register(new uBe(l)),l.register(new dBe(l)),l.register(new pBe(l)),l.register(new cBe(l)),l.register(new fBe(l)),l.register(new uVe(l)),l.register(new pVe(l)),l.register(new vI(l)),l.register(new EI(l))}class Zx{constructor(p=new Y.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||Oe.Normal)-(i.manifest.initPriority||Oe.Normal))}async setup(){Hgi(this),Y.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case ae.Editor:return this.onResolveEditorContextCallback();case ae.Logic:return this.onResolveProjectLogicContextCallback();case ae.EditorGUI:return this.onResolveEditorGUIContextCallback();case ae.Compile:return this.onResolveCompileContextCallback();case ae.PublicationRun:return this.onResolvePublicationRunContextCallback();case ae.GUI:return this.onResolveGUIContextCallback();case ae.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${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(){Y.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder)if(p.module.init&&!this.initialized.has(p.manifest.id)){Y.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)):Y.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)?(Y.Logger.log("Set "+p.manifest.id+" extension as initialized by default..."),this.initialized.add(p.manifest.id)):Y.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)){Y.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case ae.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case ae.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}Y.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 FA=null;const Hx={requestExtension:l=>(FA||(FA=new Zx,FA.setup()),FA.requestExtension(l))},Hu={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var Wx=(l=>(l.FinishedSuccess="finished-success",l.FinishedError="finished-error",l.Running="running",l.Paused="paused",l.Stopped="stopped",l.NotStarted="not-started",l))(Wx||{});const yBe={...Hx,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class Xy extends Y.Events{constructor(i,r,a,c=null,e=yBe){super();R(this,"project");R(this,"entryPoint");R(this,"state","not-started");R(this,"events",new Y.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 AT(x.UUID.uuid(),this.project),this.resolvedValues=new AT(x.UUID.uuid(),this.project),this.persistedExecutionResults=new AT(x.UUID.uuid(),this.project),this.lastExecutionResults=new AT(x.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),Wi.includes(i.type)&&pt(i).forEach(r=>this.skip(r))))}async schedule(i,r,a){if(this.hasExecuted(i))return null;if(Bt.includes(i.type))return this.executeBranch(i,a,r);if(er.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[...wt,...Bt].includes(r.type)?a.push(...r.inputs):At.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&&Bt.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 Sr.includes(e.type)?Ho(e,this.valueResolutionContext):cf(e,this.valueResolutionContext)}).reduce((e,f)=>{const h=Xo(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return h.forEach(E=>{var _,N,P;if(E.id===(f==null?void 0:f.valueOwner.id))return;const b=Nt(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(((N=f==null?void 0:f.value)==null?void 0:N.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((P=f==null?void 0:f.value)==null?void 0:P.valueAsTypeSingle)||null);const A={...f,valueOwner:E,value:b};m.push(A)}),[...e,...m]},[]).sort((e,f)=>e.valueOwner.index-f.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,r,a,c={}){var f,h;const e={...Hu,...c};try{let m={value:U.Success,error:null,result:null};if(r.sort((E,b)=>E.valueOwner.index-b.valueOwner.index),Object.values(Nr).includes(i.declaration.id)){const E=this.parentContext.requestExtension(Qy+i.declaration.id).module.main;E?m=await E(i,r):Y.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){Y.Logger.warn("Raw error executing entity: ",m.error);const b=(f=i.error)==null?void 0:f.getDataType(null),A=Nt(b||null,i.error,a);b!=null&&b.asType?A==null||A.setValueAsTypeSingle(m.error):A==null||A.metaSync({value:m.error},null),E={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:A}}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){Y.Logger.warn("Internal call execution error: ",m);let E=null;if(i.error){const b=(h=i.error)==null?void 0:h.getDataType(null),A=Nt(b,i.error,a);b!=null&&b.asType?A==null||A.setValueAsTypeSingle(m):A==null||A.metaSync({value:m},null),E={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:A}}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,A)=>b.valueOwner.index-A.valueOwner.index),i.declaration.implementation&&(f=await i.declaration.implementation(i,r));let h=null;if(f.error&&i.error){Y.Logger.warn("Raw error executing entity: ",f.error);const b=((c=i.error)==null?void 0:c.getDataType(null))||null,A=Nt(b,i.error,a);b!=null&&b.asType?A==null||A.setValueAsTypeSingle(f.error):A==null||A.metaSync({value:f.error},null),h={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:A}}const m=i==null?void 0:i.getDataType(null),E=Nt(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){Y.Logger.warn("Operation execution error: ",f);let h=null;if(i.error){const m=(e=i.error)==null?void 0:e.getDataType(null),E=Nt(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(Ve.SEARCH_NODE_IMPLEMENTATION)).module.main(i,r),h=i==null?void 0:i.getDataType(null),m=Nt(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(Y.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=Nt(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,A;const e={...Hu,...c};try{let _={value:U.Success,error:null,result:null};const N=r.map(re=>{var ee,ue;return((ee=re==null?void 0:re.value)==null?void 0:ee.valueAsType)||((ue=re==null?void 0:re.value)==null?void 0:ue.value)});let P={};i.getUniqueInputMaps().forEach(re=>{const ee=i.body.inputs.find(de=>le(de,a)===le(re,a)),ue=re==null?void 0:re.getDataType(null),ie=Nt(ue,ee,a);ue!=null&&ue.asType?ie==null||ie.setValueAsTypeList([]):ie==null||ie.metaSync({value:[]},null),this.lastExecutionResults.writeValue(ee,ie);const se={value:ie,valueOwner:ee,type:Me.ExecutionResult,inheritanceLink:null};P[ee.id]=se});let M={value:U.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case ne.loop["counted-loop"].id:{const re=N[0];let ee=1;for(;ee<=re&&ee<=50;){const ue=i.body.inputs.map(ie=>{if(ie===i.currentIterationNumberArgumentDeclaration){const se=i.currentIterationNumberArgumentDeclaration.getDataType(null),de=Qc(se),z=this.lastExecutionResults.readValue(ie.id);if(z){z.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ie,z);const me={value:z,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null};return P[ie.id]=me,me}const X={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:ee,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:de,standaloneParent:ie.toReference()},ce=tr(X,a);this.lastExecutionResults.writeValue(ie,ce);const oe={value:ce,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null};return P[ie.id]=oe,oe}else return P[ie.id]}).filter(ie=>!!ie);if(M=await this.executeFullFunctionDeclarationLogic(i.body,ue,e),(M.results||[]).forEach(ie=>{var X,ce,oe,me;if(ie.valueOwner.type!==d.InputMap||At.includes(ie.valueOwner.parent.type))return;const se=i.body.inputs.find(ve=>le(ve,a)===le(ie.valueOwner,a)),z=[...((ce=(X=P==null?void 0:P[se.id])==null?void 0:X.value)==null?void 0:ce.value)||[],((oe=ie==null?void 0:ie.value)==null?void 0:oe.value)||null];(me=P[se.id].value)==null||me.metaSync({value:z},null),this.lastExecutionResults.writeValue(se,P[se.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}case ne.loop["manual-flow-loop"].id:{let re=1;for(;re<=50;){const ee=i.body.inputs.map(ue=>{if(ue===i.currentIterationNumberArgumentDeclaration){const ie=this.lastExecutionResults.readValue(ue.id);if(ie){ie.metaSync({value:re},null),this.lastExecutionResults.writeValue(ue,ie);const X={value:ie,valueOwner:ue,type:Me.ExecutionResult,inheritanceLink:null};return P[ue.id]=X,X}const se=i.currentIterationNumberArgumentDeclaration.getDataType(null),de=Nt(se,ue,a);return de==null||de.metaSync({value:re},null),this.lastExecutionResults.writeValue(ue,de),{value:de,valueOwner:ue,type:Me.ExecutionResult,inheritanceLink:null}}else return P[ue.id]}).filter(ue=>!!ue);if(M=await this.executeFullFunctionDeclarationLogic(i.body,ee,e),(M.results||[]).forEach(ue=>{var z,X,ce;if(ue.valueOwner.type!==d.InputMap||At.includes(ue.valueOwner.parent.type))return;const ie=i.body.inputs.find(oe=>le(oe,a)===le(ue.valueOwner,a)),de=[...(z=P[ie.id].value)==null?void 0:z.value,((X=ue.value)==null?void 0:X.value)||null];(ce=P[ie.id].value)==null||ce.metaSync({value:de},null),this.lastExecutionResults.writeValue(ie,P[ie.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;re++}break}case ne.loop["list-loop"].id:{const re=N[0];let ee=1;const ue=re;for(let ie=0;ie<ue.length;ie++){const se=ue[ie],de=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const X=this.lastExecutionResults.readValue(z.id);if(X)return X.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,X),{value:X,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),oe=Nt(ce,z,a);return oe==null||oe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,oe),{value:oe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const X=i.currentValueArgumentDeclaration.getDataType(null),ce=Qc(X),oe=this.lastExecutionResults.readValue(z.id);if(oe)return oe.metaSync({value:se},null),this.lastExecutionResults.writeValue(z,oe),{value:oe,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const me={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:se,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:z.toReference()},ve=tr(me,a);return this.lastExecutionResults.writeValue(z,ve),{value:ve,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return P[z.id]}).filter(z=>!!z);if(M=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(M.results||[]).forEach(z=>{var me,ve,we;if(z.valueOwner.type!==d.InputMap||At.includes(z.valueOwner.parent.type))return;const X=i.body.inputs.find(Re=>le(Re,a)===le(z.valueOwner,a)),oe=[...(me=P[X.id].value)==null?void 0:me.value,((ve=z.value)==null?void 0:ve.value)||null];(we=P[X.id].value)==null||we.metaSync({value:oe},null),this.lastExecutionResults.writeValue(X,P[X.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}case ne.loop["object-keys-loop"].id:{const re=N[0];let ee=1;const ue=re?Object.keys(re):[];for(let ie=0;ie<ue.length;ie++){const se=ue[ie],de=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const X=this.lastExecutionResults.readValue(z.id);if(X)return X.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,X),{value:X,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),oe=Nt(ce,z,a);return oe==null||oe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,oe),{value:oe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const X=i.currentValueArgumentDeclaration.getDataType(null),ce=Qc(X),oe=this.lastExecutionResults.readValue(z.id);if(oe)return oe.metaSync({value:se},null),this.lastExecutionResults.writeValue(z,oe),{value:oe,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const me={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:se,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:z.toReference()},ve=tr(me,a);return this.lastExecutionResults.writeValue(z,ve),{value:ve,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return P[z.id]}).filter(z=>!!z);if(M=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(M.results||[]).forEach(z=>{var me,ve,we;if(z.valueOwner.type!==d.InputMap||At.includes(z.valueOwner.parent.type))return;const X=i.body.inputs.find(Re=>le(Re,a)===le(z.valueOwner,a)),oe=[...(me=P[X.id].value)==null?void 0:me.value,((ve=z.value)==null?void 0:ve.value)||null];(we=P[X.id].value)==null||we.metaSync({value:oe},null),this.lastExecutionResults.writeValue(X,P[X.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}case ne.loop["object-values-loop"].id:{const re=N[0];let ee=1;const ue=re?Object.values(re):[];for(let ie=0;ie<ue.length;ie++){const se=ue[ie],de=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const X=this.lastExecutionResults.readValue(z.id);if(X)return X.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,X),{value:X,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),oe=Nt(ce,z,a);return oe==null||oe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,oe),{value:oe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const X=i.currentValueArgumentDeclaration.getDataType(null),ce=Qc(X),oe=this.lastExecutionResults.readValue(z.id);if(oe)return oe.metaSync({value:se},null),this.lastExecutionResults.writeValue(z,oe),{value:oe,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const me={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:se,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:z.toReference()},ve=tr(me,a);return this.lastExecutionResults.writeValue(z,ve),{value:ve,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return P[z.id]}).filter(z=>!!z);if(M=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(M.results||[]).forEach(z=>{var me,ve,we;if(z.valueOwner.type!==d.InputMap||At.includes(z.valueOwner.parent.type))return;const X=i.body.inputs.find(Re=>le(Re,a)===le(z.valueOwner,a)),oe=[...(me=P[X.id].value)==null?void 0:me.value,((ve=z.value)==null?void 0:ve.value)||null];(we=P[X.id].value)==null||we.metaSync({value:oe},null),this.lastExecutionResults.writeValue(X,P[X.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}case ne.loop["string-loop"].id:{const re=N[0];let ee=1;const ue=re.split("");for(let ie=0;ie<ue.length;ie++){const se=ue[ie],de=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const X=this.lastExecutionResults.readValue(z.id);if(X)return X.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,X),{value:X,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),oe=Nt(ce,z,a);return oe==null||oe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,oe),{value:oe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const X=i.currentValueArgumentDeclaration.getDataType(null),ce=Qc(X),oe=this.lastExecutionResults.readValue(z.id);if(oe)return oe.metaSync({value:se},null),this.lastExecutionResults.writeValue(z,oe),{value:oe,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const me={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:se,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:z.toReference()},ve=tr(me,a);return this.lastExecutionResults.writeValue(z,ve),{value:ve,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return P[z.id]}).filter(z=>!!z);if(M=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(M.results||[]).forEach(z=>{var me,ve,we;if(z.valueOwner.type!==d.InputMap||At.includes(z.valueOwner.parent.type))return;const X=i.body.inputs.find(Re=>le(Re,a)===le(z.valueOwner,a)),oe=[...(me=P[X.id].value)==null?void 0:me.value,((ve=z.value)==null?void 0:ve.value)||null];(we=P[X.id].value)==null||we.metaSync({value:oe},null),this.lastExecutionResults.writeValue(X,P[X.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}}if(_={value:[U.CaughtError,U.Return].includes(M.value)?M.value:U.Success,error:((h=(f=M.error)==null?void 0:f.value)==null?void 0:h.value)||null,result:((E=(m=M==null?void 0:M.result)==null?void 0:m.value)==null?void 0:E.value)||null},_.error&&i.error){const re=(b=i.error)==null?void 0:b.getDataType(null),ee=Nt(re||null,i.error,a);re!=null&&re.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),S=Nt(G,i,a);return G!=null&&G.asType?S==null||S.setValueAsTypeSingle(_.result):S==null||S.metaSync({value:_.result},null),{value:_.value,entity:i,error:null,result:{value:S||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(_){if(Y.Logger.warn("Error executing loop: ",_),i.error){const N=(A=i.error)==null?void 0:A.getDataType(null),P=Nt(N,i.error,a);return N!=null&&N.asType?P==null||P.setValueAsTypeSingle(_):P==null||P.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:P},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,A,_,N,P,j,M,G,S,re,ee,ue,ie,se,de,z,X,ce,oe,me,ve,we;const e={...Hu,...c};try{const Re=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);let xe=null;if(Re.error&&i.error){Y.Logger.warn("Raw error executing entity: ",Re.error);const Ze=(f=i.error)==null?void 0:f.getDataType(null),Xe=Nt(Ze||null,i.error,a);Ze!=null&&Ze.asType?(m=(h=Re.error)==null?void 0:h.value)!=null&&m.valueAsTypeSingle?Xe==null||Xe.setValueAsTypeSingle((b=(E=Re.error)==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle):(_=(A=Re.error)==null?void 0:A.value)!=null&&_.valueAsTypeList&&Array.isArray((P=(N=Re.error)==null?void 0:N.value)==null?void 0:P.valueAsTypeList)&&(Xe==null||Xe.setValueAsTypeList((M=(j=Re.error)==null?void 0:j.value)==null?void 0:M.valueAsTypeList)):Xe==null||Xe.metaSync({value:(S=(G=Re.error)==null?void 0:G.value)==null?void 0:S.value},null),xe={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:Xe}}let je=U.Success;Re.value===U.UnhandledError&&(i.catchesError||i.errorCalls.length?je=U.CaughtError:je=U.UnhandledError);const Se=i==null?void 0:i.getDataType(null),et=Nt(Se,i,a);return Se!=null&&Se.asType?(ee=(re=Re.result)==null?void 0:re.value)!=null&&ee.valueAsTypeSingle?et==null||et.setValueAsTypeSingle((ie=(ue=Re.result)==null?void 0:ue.value)==null?void 0:ie.valueAsTypeSingle):(de=(se=Re.result)==null?void 0:se.value)!=null&&de.valueAsTypeList&&Array.isArray((X=(z=Re.result)==null?void 0:z.value)==null?void 0:X.valueAsTypeList)&&(et==null||et.setValueAsTypeList((oe=(ce=Re.result)==null?void 0:ce.value)==null?void 0:oe.valueAsTypeList)):et==null||et.metaSync({value:((ve=(me=Re.result)==null?void 0:me.value)==null?void 0:ve.value)||null},null),{value:je,entity:i,error:xe,result:{value:et||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(Re){if(!i.error)return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null};const xe=(we=i.error)==null?void 0:we.getDataType(null),je=Nt(xe,i.error,a);return xe!=null&&xe.asType?je==null||je.setValueAsTypeSingle(Re):je==null||je.metaSync({value:Re},null),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:je},result:null}}}async executeCondition(i,r){var c,e,f,h;let a=!1;switch(i.declaration.id){case hn.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 hn.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 Rr.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 Rr.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={...Hu,...c,onBeforeEntityExecution:(m,E,b)=>{var A;return((A=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:A.call(c,m,E,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(m,E,b)=>{var A;return((A=c==null?void 0:c.onEntityExecuted)==null?void 0:A.call(c,m,E,{...b,detached:!0}))||Promise.resolve()}},f=new Xy(a,[i,...UI(i)],i,this,this.parentContext);return f.inheritValuesFromContext(this),await f.execute(e,r)}async executeFullFunctionDeclarationLogic(i,r,a={}){const c={...Hu,...a},e=UI(i);e.forEach(m=>{this.addEntity(m)}),e.reduce((m,E)=>At.includes(E.type)?[...m,...E.outputs]:wt.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,A,_;if((f=i.throws)!=null&&f.readsValue){const N=Ho(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(N==null?void 0:N.value)||null},result:null}}let a=Ho(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let N={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(N={...N,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)gr((m=a==null?void 0:a.value)==null?void 0:m.value)&&(N={...N,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:N},null);else{const P=Nt(c,i,this.project);P==null||P.metaSync({value:N},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:P}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(P=>{var j,M;if(((j=P.declaration)==null?void 0:j.type)===d.Property&&P.declaration.static){const G=this.lastExecutionResults.readValue(P.declaration.id),S=le(P,this.project),re=P.codeName||((M=P.declaration)==null?void 0:M.codeName)||Qi(S);if(G)G.metaSync({value:N[re]},null),this.lastExecutionResults.writeValue(P.declaration,G);else{const ee=Nt(P.getDataType(null),P,this.project);ee==null||ee.metaSync({value:N[re]},null),this.lastExecutionResults.writeValue(P.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((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(N=>{var G;const P=N.codeName||((G=N.declaration)==null?void 0:G.codeName)||Qi(le(N,this.project)),j=e[P],M=Nt(N.getDataType(null),N,this.project);M==null||M.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,A,_;if((f=i.throws)!=null&&f.readsValue){const N=Ho(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(N==null?void 0:N.value)||null},result:null}}let a=Ho(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let N={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(N={...N,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)gr((m=a==null?void 0:a.value)==null?void 0:m.value)&&(N={...N,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:N},null);else{const P=Nt(c,i,this.project);P==null||P.metaSync({value:N},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:P}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(P=>{var j,M;if(((j=P.declaration)==null?void 0:j.type)===d.Property&&P.declaration.static){const G=this.lastExecutionResults.readValue(P.declaration.id),S=le(P,this.project),re=P.codeName||((M=P.declaration)==null?void 0:M.codeName)||Qi(S);if(G)G.metaSync({value:N[re]},null),this.lastExecutionResults.writeValue(P.declaration,G);else{const ee=Nt(P.getDataType(null),P,this.project);ee==null||ee.metaSync({value:N[re]},null),this.lastExecutionResults.writeValue(P.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((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(N=>{var G;const P=N.codeName||((G=N.declaration)==null?void 0:G.codeName)||Qi(le(N,this.project)),j=e[P],M=Nt(N.getDataType(null),N,this.project);M==null||M.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,A,_;if((f=i.throws)!=null&&f.readsValue){const N=Ho(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(N==null?void 0:N.value)||null},result:null}}let a=Ho(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let N={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(N={...N,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)gr((m=a==null?void 0:a.value)==null?void 0:m.value)&&(N={...N,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:N},null);else{const P=Nt(c,i,this.project);P==null||P.metaSync({value:N},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:P}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(P=>{var j,M;if(((j=P.declaration)==null?void 0:j.type)===d.Property&&P.declaration.static){const G=this.lastExecutionResults.readValue(P.declaration.id),S=le(P,this.project),re=P.codeName||((M=P.declaration)==null?void 0:M.codeName)||Qi(S);if(G)G.metaSync({value:N[re]},null),this.lastExecutionResults.writeValue(P.declaration,G);else{const ee=Nt(P.getDataType(null),P,this.project);ee==null||ee.metaSync({value:N[re]},null),this.lastExecutionResults.writeValue(P.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((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(N=>{var G;const P=N.codeName||((G=N.declaration)==null?void 0:G.codeName)||Qi(le(N,this.project)),j=e[P],M=Nt(N.getDataType(null),N,this.project);M==null||M.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,A,_;let a=Ho(i,this.valueResolutionContext);const c=Tr(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let N={};if(((h=e==null?void 0:e.entity)==null?void 0:h.type)===d.DefinitionEntity&&(N={...N,...e.entity.getActiveRawDefaultValue()}),a!=null&&a.value)gr((m=a==null?void 0:a.value)==null?void 0:m.value)&&(N={...N,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:N},null);else{const P=Nt(e,i,this.project);P==null||P.metaSync({value:N},null),a={valueOwner:c,type:Me.ExecutionResult,inheritanceLink:null,value:P}}this.lastExecutionResults.writeValue(c,a.value),c.inputs.forEach(P=>{var j,M;if(((j=P.declaration)==null?void 0:j.type)===d.Property&&P.declaration.static){const G=this.lastExecutionResults.readValue(P.declaration.id),S=le(P,this.project),re=P.codeName||((M=P.declaration)==null?void 0:M.codeName)||Qi(S);if(G)G.metaSync({value:N[re]},null),this.lastExecutionResults.writeValue(P.declaration,G);else{const ee=Nt(P.getDataType(null),P,this.project);ee==null||ee.metaSync({value:N[re]},null),this.lastExecutionResults.writeValue(P.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((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(N=>{var G;const P=N.codeName||((G=N.declaration)==null?void 0:G.codeName)||Qi(le(N,this.project)),j=f[P],M=Nt(N.getDataType(null),N,this.project);M==null||M.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,A,_,N,P,j,M;const c={...Hu,...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)),Xy.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)),Xy.executeEntryPointEntity(i,G)}case d.Search:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((A=c.onBeforeEntityExecution)==null?void 0:A.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((N=c.onBeforeEntityExecution)==null?void 0:N.call(c,i,G,e)),this.executeReturnStatement(i,G)}case d.ContinueStatement:{const G=this.mergeExernalValuesWithInternalInputs(r,i);return await((P=c.onBeforeEntityExecution)==null?void 0:P.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((M=c.onBeforeEntityExecution)==null?void 0:M.call(c,i,G,e)),Xy.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=Xo((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={...Hu,...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(P=>this.hasEntity(P));(i.errorCalls||[]).forEach(P=>{this.skip(P)});let A=[];const _=(await Promise.all(E.map(P=>this.schedule(P,[],c)))).filter(P=>!!P),N=_.filter(P=>!!P).find(P=>P.value===U.CaughtError||P.value===U.Return||P.value===U.Break||P.value===U.Continue);return N||(A=[...A,..._],h)}else if(h.value===U.CaughtError||h.value===U.ConditionNotMet){const E=(i.errorCalls||[]).filter(P=>this.hasEntity(P));(i.successCalls||i.calls||[]).forEach(P=>{this.skip(P)});let A=[];const _=(await Promise.all(E.map(P=>this.schedule(P,[],c)))).filter(P=>!!P),N=_.filter(P=>!!P).find(P=>P.value===U.CaughtError||P.value===U.UnhandledError||P.value===U.Return||P.value===U.Break||P.value===U.Continue);return N||(A=[...A,..._],h)}else{if(h.value===U.UnhandledError)return this.executing.forEach(E=>{this.skip(E)}),this.scheduled.forEach(E=>{this.skip(E)}),Wi.includes(h.entity.type)&&pt(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={...Hu,...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=Y.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=yt(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 Wgi(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 Xa={[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 zx(l){const p=J1(l);if(!p){const r=gh(l);if(r.includes(ge.HTTP_ENDPOINT))return"HTTP endpoint";if(r.includes(ge.PERSISTED_ENTITY))return"Persisted entity";if(r.includes(ge.CRON_JOB))return"Scheduled execution";if(r.includes(ge.RELATIONAL_DATABASE))return"Relational database"}if(p){let r="Extension of "+le(p,p.project)+" entity",a=Os(r);const c=gh(l);return c.includes(ge.HTTP_ENDPOINT)?"HTTP endpoint"+(a?", "+a:""):c.includes(ge.PERSISTED_ENTITY)?"Persisted entity"+(a?", "+a:""):c.includes(ge.CRON_JOB)?"Scheduled execution"+(a?", "+a:""):c.includes(ge.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 hBe(l){return l.parent.type===d.DefinitionEntity||l.parent.type===d.InstalledProject?"Internal action of "+le(l.parent,l.project):l.parent.type===d.Loop?"Action repeated on every iteration":"Internal action of entity"}function Yx(l){return hL(l)?hBe(l):"Custom trigger"}function zgi(l){var p;switch(l.type){case d.DefinitionEntity:return zx(l);case d.FunctionDeclaration:return Yx(l)}return(p=Xa[l.type])==null?void 0:p.singular}function Ygi(l){var p;switch(l.type){case d.DefinitionEntity:return zx(l);case d.FunctionDeclaration:return Yx(l)}return(p=Xa[l.type])==null?void 0:p.singular}const Jx=4e4,Qx=280,Jgi=300,Xx=65,nf=32,ih=39,qT=26,mBe=49,ST=44,Qgi=35,XA=52,y1=10,Va=y1*2,ip=38,eI=90,RI=270,TBe=Jx/2+120,vBe=Jx/2+180;function e$(l){let i=nf+ST+ip+y1;const r=[...l.inputs];return r.length&&(i+=Va,r.forEach(()=>{i+=qT})),{height:i,width:280}}function ZT(l){var a,c;let i=nf+ST+ip+y1;const r=[...l.inputs];return r.length&&(i+=Va,r.forEach(()=>{i+=qT})),l.andChildrenGroup&&(i+=Va,l.andChildrenGroup.forEach(e=>{i+=ZT(e).height})),l.orChildrenGroup&&(i+=Va,l.orChildrenGroup.forEach(e=>{i+=ZT(e).height})),(((a=l.declaration)==null?void 0:a.id)===ne.condition["condition-group-and"].id||((c=l.declaration)==null?void 0:c.id)===ne.condition["condition-group-or"].id)&&(i+=ip),{height:i,width:280}}function EBe(l){var h,m;let i=Xx;const r=[];if([d.DefinitionEntity].includes(l.type)){const E=[...l.suggestedProperties||[],...l.properties||[]];E.length&&(i+=Va,E.forEach(b=>{i+=b.static?mBe:ih}))}if([d.DefinitionEntity,d.InstalledProject,d.Loop].includes(l.type)){const E=[...(l==null?void 0:l.suggestedMethods)||[],...l.methods||[],...l.functions||[],...l.body?[l.body]:[]];E.length&&(i+=Va,E.forEach(b=>{const A=e$(b);i+=A.height}))}wt.includes(l.type)?(r.push(...(l.inputs||[]).flatMap(E=>[E])||[]),i+=Va,i+=ST,l.error&&(i+=XA)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(l.type)?(r.push(...l.outputs||[]),l.throws&&(i+=XA)):l.type===d.Condition&&(r.push(l.inputs[0]),l.inputs[1]&&r.push(l.inputs[1]),(((h=l.declaration)==null?void 0:h.id)===ne.condition["condition-group-and"].id||((m=l.declaration)==null?void 0:m.id)===ne.condition["condition-group-or"].id)&&(i+=ip),l.andChildrenGroup&&(i+=Va,l.andChildrenGroup.forEach(E=>{i+=ZT(E).height})),l.orChildrenGroup&&(i+=Va,l.orChildrenGroup.forEach(E=>{i+=ZT(E).height})));const a=r.length;a&&(i+=a*ih,i+=Va);const c=[];if(l.type===d.FunctionDeclaration||l.type===d.GlobalEvent?c.push(...l.inputs||[]):wt.includes(l.type)&&c.push(...l.outputs||[]),xt.includes(l.type)){i+=Va,i+=ST,l.usedInternalCalls.length&&l.usedInternalCalls.forEach(b=>{i+=XA+Va,i+=b.inputs.length*qT,i+=b.outputs.length*qT});const E=l.getDataType(null);(!E||E.canModifyObjectStructure())&&(i+=ip)}l.type===d.Search&&(i+=ip);const e=c.length;return e&&(i+=e*ih,i+=Va),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(l.type)&&(i+=ip),{height:i,width:280}}function bBe(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=e$(c);p+=e.height}),(i.properties.length||i.suggestedProperties.length)&&(p+=Va,i.suggestedProperties.forEach(()=>{p+=ih}),i.properties.forEach(()=>{p+=ih})),{offset:p}}function cE(l){return`${l.split("-").map((r,a)=>a===0?r.charAt(0).toUpperCase()+r.slice(1):r.toLowerCase()).join(" ")}.`}function Xgi(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 Ce.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case Ce.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 Ce.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 Ce.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case Ce.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case Ce.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case Ce.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 Ce.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case Ce.EmptyName:return"This entity has no name";case Ce.InvalidObjectStructure:return"This entity has an invalid structure";case Ce.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case Ce.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case Ce.MissingCaller:return"This action is missing a caller";case Ce.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case Ce.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case Ce.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case Ce.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case ad.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case ad.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case ts.UUIDMustBeString:return`UUID must be a string, eg: "${ap()}"`;case ts.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${ap()}"`;case ts.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${ap()}"`;case Ta.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case Ta.StringValueMustNotHaveDashes:return"This value must not contain dashes";case Ta.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return cE(l.code)}}function eRi(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 Ce.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case Ce.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case be.MissingMethodImplementation:return"Missing action";case be.MissingPropertyImplementation:return"Missing property";case Ce.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 Ce.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case Ce.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case Ce.InternalCallParentMissingDataType:return"Parent has no data type";case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case Ce.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 Ce.EmptyName:return"Empty name";case Ce.InvalidObjectStructure:return"Invalid object structure";case Ce.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case Ce.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ce.MissingCaller:return"Missing caller";case Ce.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case Ce.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case Ce.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ce.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case ad.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case ad.StatusCodeMustBeNumber:return"HTTP status code must be a number";case ts.UUIDMustBeString:return"UUID must be a string";case ts.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case ts.UUIDMustBeValidFormat:return"UUID must be in a valid format";case Ta.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case Ta.StringValueMustNotHaveDashes:return"This value must not contain dashes";case Ta.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return cE(l.code)}}function tRi(l){switch(l.code){case be.AbstractEntityWithNonAbstractMethods:return`${le(l.entity,l.entity.project)} has non-template actions`;case be.AbstractEntityWithNonAbstractProperties:return`${le(l.entity,l.entity.project)} has non-template properties`;case be.IncorrectEntityImplementation:return`${le(l.entity,l.entity.project)} incorrectly implements template`;case be.IncorrectMethodImplementation:return`${le(l.entity,l.entity.project)} incorrectly implements the template`;case be.IncorrectPropertyImplementation:return`${le(l.entity,l.entity.project)} incorrectly implements the template`;case be.AbstractMethodInNonAbstractEntity:return`${le(l.entity,l.entity.project)} can't be a template`;case be.AbstractPropertyInNonAbstractEntity:return`${le(l.entity,l.entity.project)} can't be a template`;case Ce.MethodOverwritesOtherSiblingWithSameName:return`${le(l.entity,l.entity.project)} overwrites action`;case Ce.PropertyOverwritesOtherSiblingWithSameName:return`${le(l.entity,l.entity.project)} overwrites property`;case be.MissingMethodImplementation:return`${le(l.entity,l.entity.project)} is missing action`;case be.MissingPropertyImplementation:return`${le(l.entity,l.entity.project)} is missing property`;case Ce.NameNotUniqueInScope:return`${le(l.entity,l.entity.project)} name is not unique`;case be.NoProperties:return`${le(l.entity,l.entity.project)} has no properties`;case be.NonStaticPropertyInStaticEntity:return`${le(l.entity,l.entity.project)} has non-static property`;case be.StaticEntityWithNonStaticProperties:return`${le(l.entity,l.entity.project)} has non-static properties`;case be.ReadingFromIncompatibleType:return`${le(l.entity,l.entity.project)} reads from different type`;case be.WritingToIncompatibleType:return`${le(l.entity,l.entity.project)} writes to different type`;case be.ScopeWithoutLogic:return`${le(l.entity,l.entity.project)} has no logic`;case be.NonStaticPropertyImplementsStatic:return`${le(l.entity,l.entity.project)} has invalid static property`;case be.PropertyImplementsIncompatibleType:return`${le(l.entity,l.entity.project)} has incompatible data type`;case be.PropertyImplementsNonAbstact:return`${le(l.entity,l.entity.project)} has non-template property`;case be.StaticPropertyImplementsNonStatic:return`${le(l.entity,l.entity.project)} has non-static property`;case be.VariableCallsOthersAndHasInternalCall:return`${le(l.entity,l.entity.project)} has bad internal call`;case be.VariableHasInputsAndInternalCall:return`${le(l.entity,l.entity.project)} has bad internal call`;case be.VariableHasOutputsAndInternalCall:return`${le(l.entity,l.entity.project)} has bad internal call`;case be.VariableIsCalledAndHasInternalCall:return`${le(l.entity,l.entity.project)} has bad internal call`;case Ce.InternalCallDeclarationIsInvalidType:return`${le(l.entity,l.entity.project)} has declaration that is not an action`;case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${le(l.entity,l.entity.project)} has declaration that is not found in parent`;case Ce.InternalCallParentDeclarationEntityInvalidType:return`${le(l.entity,l.entity.project)} has invalid parent declaration type`;case Ce.InternalCallParentMissingDataType:return`${le(l.entity,l.entity.project)}'s parent has no data type`;case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return`${le(l.entity,l.entity.project)} has declaration that is not in parent`;case Ce.UnreachableEntity:return`${le(l.entity,l.entity.project)} is unreachable`;case be.DisconnectedCallableEntity:return`${le(l.entity,l.entity.project)} is not executed by any entity`;case be.AbstractEntityImplements:return`${le(l.entity,l.entity.project)} implements a non-template entity`;case be.AbstractExtendingNonAbstractEntity:return`${le(l.entity,l.entity.project)} extends a non-template entity`;case be.InvalidPropertiesCombination:return`${le(l.entity,l.entity.project)} has invalid properties combination`;case be.ExtendingNonInteractiveEntity:return`${le(l.entity,l.entity.project)} extends a non-interactive entity`;case be.ExtendsIncompatibleEntities:return`${le(l.entity,l.entity.project)} extends incompatible entities`;case be.ImplementingNonAbstractEntity:return`${le(l.entity,l.entity.project)} implements a non-template entity`;case be.ImplementsIncompatibleEntities:return`${le(l.entity,l.entity.project)} implements incompatible entities`;case be.LackingReturnStatementOnSomeBranches:return`${le(l.entity,l.entity.project)} is missing termination on some branches`;case be.LastCalledEntityMustBeReturnEntity:return`${le(l.entity,l.entity.project)}'s last called entity must be a termination node`;case be.MissingRequiredValue:return`${le(l.entity,l.entity.project)} is missing a required value`;case be.NoPrimaryKeyProperty:return`${le(l.entity,l.entity.project)} has no primary key property`;case be.NonAbstractExtendingAbstractEntity:return`${le(l.entity,l.entity.project)} extends a template entity`;case be.NonStaticExtendingStaticEntity:return`${le(l.entity,l.entity.project)} extends a static entity`;case be.NonStaticImplementingStaticEntity:return`${le(l.entity,l.entity.project)} implements a static entity`;case be.StaticExtendingNonStaticEntity:return`${le(l.entity,l.entity.project)} extends a non-static entity`;case be.StaticImplementingNonStaticEntity:return`${le(l.entity,l.entity.project)} implements a non-static entity`;case be.VariableReadsValueAndInternalCall:return`${le(l.entity,l.entity.project)} reads a value and has internal call`;case be.VariableWritesValuesAndInternalCall:return`${le(l.entity,l.entity.project)} writes values and has internal call`;case Ce.EmptyName:return`${Xa[l.entity.type]} has no name`;case Ce.InvalidObjectStructure:return`${le(l.entity,l.entity.project)} has invalid structure`;case Ce.LoopBodyFunctionOverwrite:return`${le(l.entity,l.entity.project)}'s loop body action overwrites an action`;case Ce.MethodOverwritesBaseMethodWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites base action`;case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites another action with same implementation`;case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites another action with same implementation`;case Ce.MissingCaller:return`${le(l.entity,l.entity.project)} is missing a caller`;case Ce.NameAsResolvedCodeNameNotUniqueInScope:return`${le(l.entity,l.entity.project)} has a name not unique in the scope`;case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${le(l.entity,l.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ce.NameMustStartWithLetterOrUnderscore:return`${le(l.entity,l.entity.project)} name must start with letter or underscore`;case Ce.NoOverlapWithImplementedSignature:return`${le(l.entity,l.entity.project)} has no overlap with implemented signature`;case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites base property`;case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites another property with same implementation`;case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites another property with same implementation`;case Ce.ReaderWriterIncompatibleDataType:return`${le(l.entity,l.entity.project)} has reader/writer with incompatible data type`;case ad.StatusCodeMustBeBetween100And599:return`${le(l.entity,l.entity.project)} HTTP status code must be between 100 and 599`;case ad.StatusCodeMustBeNumber:return`${le(l.entity,l.entity.project)} HTTP status code must be a number`;case ts.UUIDMustBeString:return`${le(l.entity,l.entity.project)} UUID must be a string`;case ts.UUIDMustNotContainSpaces:return`${le(l.entity,l.entity.project)} UUID must not contain spaces`;case ts.UUIDMustBeValidFormat:return`${le(l.entity,l.entity.project)} UUID must be in a valid format`;case Ta.MustBeUniqueAmongSameEntities:return`${le(l.entity,l.entity.project)} value must be unique among the same kind`;case Ta.StringValueMustNotHaveDashes:return`${le(l.entity,l.entity.project)} value must not contain dashes`;case Ta.StringValueMustNotHaveSpaces:return`${le(l.entity,l.entity.project)} value must not contain spaces`;default:return`${le(l.entity,l.entity.project)} Error: ${cE(l.code)}`}}function iRi(l){var p,i,r,a;switch(l.code){case be.AbstractEntityWithNonAbstractMethods:return`${le(l.entity,l.entity.project)} has non-template actions`;case be.AbstractEntityWithNonAbstractProperties:return`${le(l.entity,l.entity.project)} has non-template properties`;case be.IncorrectEntityImplementation:return`${le(l.entity,l.entity.project)} incorrectly implements the template entity`;case be.IncorrectMethodImplementation:return`${le(l.entity,l.entity.project)} incorrectly implements the template action it's based on`;case be.IncorrectPropertyImplementation:return`${le(l.entity,l.entity.project)} incorrectly implements the template property it's based on`;case be.AbstractMethodInNonAbstractEntity:return`${le(l.entity,l.entity.project)} is a template action in a non-template entity`;case be.AbstractPropertyInNonAbstractEntity:return`${le(l.entity,l.entity.project)} is a template property in a non-template entity`;case Ce.MethodOverwritesOtherSiblingWithSameName:return`${le(l.entity,l.entity.project)} overwrites an action in the template entity`;case Ce.PropertyOverwritesOtherSiblingWithSameName:return`${le(l.entity,l.entity.project)} overwrites a property in the template entity`;case be.MissingMethodImplementation:return`${le(l.entity,l.entity.project)} is missing an action implementation from the template entity`;case be.MissingPropertyImplementation:return`${le(l.entity,l.entity.project)} is missing a property implementation from the template entity`;case Ce.NameNotUniqueInScope:return`${le(l.entity,l.entity.project)} has a duplicate name in the same scope`;case be.NoProperties:return`${le(l.entity,l.entity.project)} has no properties, so it doesn't do anything`;case be.NonStaticPropertyInStaticEntity:return`${le(l.entity,l.entity.project)} has a non-static property in a static entity`;case be.StaticEntityWithNonStaticProperties:return`${le(l.entity,l.entity.project)} has non-static properties in a static entity`;case be.ReadingFromIncompatibleType:return`${le(l.entity,l.entity.project)} reads data from a value of a different data type`;case be.WritingToIncompatibleType:return`${le(l.entity,l.entity.project)} writes data to a value of a different data type`;case be.ScopeWithoutLogic:return`${le(l.entity,l.entity.project)} has no logic`;case be.NonStaticPropertyImplementsStatic:return`${le(l.entity,l.entity.project)} has a static property in a non-static entity`;case be.PropertyImplementsIncompatibleType:return`${le(l.entity,l.entity.project)} implements a property of a different data type`;case be.PropertyImplementsNonAbstact:return`${le(l.entity,l.entity.project)} implements a non-template property`;case be.StaticPropertyImplementsNonStatic:return`${le(l.entity,l.entity.project)} has a static property in a non-static entity`;case be.VariableCallsOthersAndHasInternalCall:return`${le(l.entity,l.entity.project)} calls other entities while being used to execute internal logic`;case be.VariableHasInputsAndInternalCall:return`${le(l.entity,l.entity.project)} has inputs while being used to execute internal logic`;case be.VariableHasOutputsAndInternalCall:return`${le(l.entity,l.entity.project)} has outputs while being used to execute internal logic`;case be.VariableIsCalledAndHasInternalCall:return`${le(l.entity,l.entity.project)} is called while being used to execute internal logic`;case Ce.InternalCallDeclarationIsInvalidType:return`${le(l.entity,l.entity.project)} has a declaration that is not an action`;case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${le(l.entity,l.entity.project)} has a declaration that is not found in ${(p=l.entity.parent.getDataType(null))!=null&&p.entity?le((i=l.entity.parent.getDataType(null))==null?void 0:i.entity,l.entity.project):"the variable's data-type entity"}`;case Ce.InternalCallParentDeclarationEntityInvalidType:return`${le(l.entity,l.entity.project)} is part of a variable whos data-type entity can't have actions`;case Ce.InternalCallParentMissingDataType:return`${le(l.entity,l.entity.project)} is part of a variable with no data-type entity`;case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return`${le(l.entity,l.entity.project)} has a declaration doesn't belong to ${(r=l.entity.parent.getDataType(null))!=null&&r.entity?le((a=l.entity.parent.getDataType(null))==null?void 0:a.entity,l.entity.project):"the variable's data-type entity"}`;case Ce.UnreachableEntity:return`${le(l.entity,l.entity.project)} is unreachable`;case be.DisconnectedCallableEntity:return`${le(l.entity,l.entity.project)} is disconnected and won't be executed by anything after publishing`;case be.AbstractEntityImplements:return`${le(l.entity,l.entity.project)} implements a non-template entity`;case be.AbstractExtendingNonAbstractEntity:return`${le(l.entity,l.entity.project)} extends a non-template entity`;case be.InvalidPropertiesCombination:return`${le(l.entity,l.entity.project)} has an invalid combination of properties`;case be.ExtendingNonInteractiveEntity:return`${le(l.entity,l.entity.project)} extends a non-interactive entity`;case be.ExtendsIncompatibleEntities:return`${le(l.entity,l.entity.project)} extends incompatible entities`;case be.ImplementingNonAbstractEntity:return`${le(l.entity,l.entity.project)} implements a non-template entity`;case be.ImplementsIncompatibleEntities:return`${le(l.entity,l.entity.project)} implements incompatible entities`;case be.LackingReturnStatementOnSomeBranches:return`${le(l.entity,l.entity.project)} has branches that don't terminate`;case be.LastCalledEntityMustBeReturnEntity:return`${le(l.entity,l.entity.project)} must end with a termination node`;case be.MissingRequiredValue:return`${le(l.entity,l.entity.project)} is missing a required value`;case be.NoPrimaryKeyProperty:return`${le(l.entity,l.entity.project)} has no primary key property`;case be.NonAbstractExtendingAbstractEntity:return`${le(l.entity,l.entity.project)} is a non-template entity extending a template entity`;case be.NonStaticExtendingStaticEntity:return`${le(l.entity,l.entity.project)} is a non-static entity extending a static entity`;case be.NonStaticImplementingStaticEntity:return`${le(l.entity,l.entity.project)} is a non-static entity implementing a static entity`;case be.StaticExtendingNonStaticEntity:return`${le(l.entity,l.entity.project)} is a static entity extending a non-static entity`;case be.StaticImplementingNonStaticEntity:return`${le(l.entity,l.entity.project)} is a static entity implementing a non-static entity`;case be.VariableReadsValueAndInternalCall:return`${le(l.entity,l.entity.project)} reads a value and has an internal call`;case be.VariableWritesValuesAndInternalCall:return`${le(l.entity,l.entity.project)} writes values and has an internal call`;case Ce.EmptyName:return`${Xa[l.entity.type]} has no name`;case Ce.InvalidObjectStructure:return`${le(l.entity,l.entity.project)} has an invalid structure`;case Ce.LoopBodyFunctionOverwrite:return`${le(l.entity,l.entity.project)}'s loop body action overwrites`;case Ce.MethodOverwritesBaseMethodWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites a base action with same implementation`;case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites another action with same implementation`;case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites another action with same implementation`;case Ce.MissingCaller:return`${le(l.entity,l.entity.project)} is missing a caller`;case Ce.NameAsResolvedCodeNameNotUniqueInScope:return`${le(l.entity,l.entity.project)} has a name that is not unique in the scope`;case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${le(l.entity,l.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ce.NameMustStartWithLetterOrUnderscore:return`${le(l.entity,l.entity.project)} name must start with letter or underscore`;case Ce.NoOverlapWithImplementedSignature:return`${le(l.entity,l.entity.project)} has no overlap with implemented signature`;case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites a base property with same implementation`;case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites another property with same implementation`;case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${le(l.entity,l.entity.project)} overwrites another property with same implementation`;case Ce.ReaderWriterIncompatibleDataType:return`${le(l.entity,l.entity.project)} has a reader/writer with incompatible data type`;case ad.StatusCodeMustBeBetween100And599:return`${le(l.entity,l.entity.project)} HTTP status code must be between 100 and 599`;case ad.StatusCodeMustBeNumber:return`${le(l.entity,l.entity.project)} HTTP status code must be a number, between 100 and 599`;case ts.UUIDMustBeString:return`${le(l.entity,l.entity.project)} UUID must be a string, eg: "${ap()}"`;case ts.UUIDMustNotContainSpaces:return`${le(l.entity,l.entity.project)} UUID must not contain spaces, eg: "${ap()}"`;case ts.UUIDMustBeValidFormat:return`${le(l.entity,l.entity.project)} UUID must be in a valid format. Eg: "${ap()}"`;case Ta.MustBeUniqueAmongSameEntities:return`${le(l.entity,l.entity.project)} value must be unique among the same kind`;case Ta.StringValueMustNotHaveDashes:return`${le(l.entity,l.entity.project)} value must not contain dashes`;case Ta.StringValueMustNotHaveSpaces:return`${le(l.entity,l.entity.project)} value must not contain spaces`;default:return`${le(l.entity,l.entity.project)} Error: ${cE(l.code)}`}}function fE(l){const p=(l||"").startsWith("error-caller-only--");switch(p?l.replace("error-caller-only--",""):l){case Wt.CallIsInHigherScope:return"In a higher scope";case Wt.CallIsInLowerScope:return"In a lower scope";case Wt.CallerIsInHigherScope:return"Caller is in a higher scope";case Wt.CallerIsInLowerScope:return"Caller is in a lower scope";case Wt.CannotBeCalledByChildren:return"Cannot be called by children";case Wt.CannotCallAncestor:return"Cannot call ancestor";case Wt.CannotConnectToItself:return"Cannot connect to itself";case Wt.CannotReadMoreThanOneValue:return"Cannot read more than one value";case Wt.CannotReadValueFromChildren:return"Cannot read value from entities executed after itself";case Wt.CannotWriteValueToAncestor:return"Cannot write value to ancestor";case tv.Suggestion:return"Suggestion";case Wt.ContinueOrBreakStatementCalledFromOutsideLoop:return"Cannot be called from outside loop";case Wt.DataTypesNotCompatible:return"Data types not compatible";case Wt.ElementInLoopBodyCallingOutsideLoop:return"Cannot call outside loop";case Wt.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees:return"Error cannot be connected to success branch";case Wt.ExecutionsAlreadyConnected:return"Executions already connected";case Wt.IsNotValueReadingEntity:return"Is not a value reading entity";case Wt.IsNotValueWritingEntity:return"Is not a value writing entity";case Wt.NotInScope:return"Not in a compatible scope";case Wt.OtherIncompatibleScopeReason:return"Incompatible scope";case Wt.SiblingInternalCallAlreadyUsedInParentVariable:return"Internal call already used in parent variable";case Wt.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees:return"Success cannot be connected to error branch";case Wt.ValuesAlreadyConnected:return"Values already connected";case Wt.CannotInteractWithInputInVariableWithInternalCalls:return"Cannot interact with input in variable with internal calls";case Wt.CannotInteractWithOutputInVariableWithInternalCalls:return"Cannot interact with output in variable with internal calls";case tv.CanvasGloballyDisabled:return"Canvas is globally disabled";case Wt.PropertyIsConstantItsValueCantBeReset:return"Property is constant, its value can't be reset";case Wt.CannotWriteValueOfGlobalVariableDeclaration:return"Cannot write value of global variable declaration";case Wt.CannotReSetValueOfConstantVariable:return"Cannot re-set value of constant variable";case Wt.CannotConnectToOwnNode:return"It is part of the same node";case Wt.CalledByErrorMustBePassThroughCallable:return"Called by error must be pass-through callable";case Wt.CannotChangeScopeBecauseItCallsOtherEntities:return"Cannot change scope because it calls other entities in its current scope";case Wt.CannotChangeScopeBecauseItIsAlreadyCalledByOtherEntitiesInDifferentScope:return"Cannot change scope because it is already called by other entities in different scope";case Wt.VariableDeclarationCannotBeMovedToLowerScopeBecauseInstancesUsage:return"Variable declaration cannot be moved to lower scope because its instances are used in the current or different incompatible lower scope";case Wt.CalledBySourceMustBeCallerEntity:return"Not a caller type";case Wt.CalledByErrorCannotBeConnectedToEntitiesCalledByOwnSuccessBranch:return"Already connected to the success branch from a common origin caller";case Wt.CalledBySuccessCannotBeConnectedToEntitiesCalledByOwnErrorBranch:return"Already connected to the error branch from a common origin caller";case Wt.RedundantCall:return"Redundant call. Already connected further down the execution path";case Wt.CannotBeCalledBeforeDeclaration:return"Cannot be called before declaration";case Wt.CannotBeCalledInParallelBranchToDeclaration:return"Cannot be called in parallel branch to declaration";case Wt.CannotBeHigherScopeThanDeclaration:return"Cannot be in a higher scope than declaration";case Wt.CannotCallGlobalVariableDeclaration:return"Cannot call global variable declaration";case Wt.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";case Wt.CannotInteractWithInputInGlobalVariableDeclaration:return"Cannot interact with input in global variable declaration";case Wt.IsNotCallableEntity:return"Is not a callable node type";case Wt.IsNotCallerEntity:return"Is not a caller node type";case Wt.IsNotPassThroughCallableEntity:return"Is not a pass-through callable node type that has an error branch";case Wt.NotAConnectableEntityType:return"Not a connectable node type";case Wt.WouldMakeAnEarlierNodeBeCalledBeforeItsDeclaration:return"Would make an earlier node be called before its declaration";default:return Ac(l||"")}}function rRi(l,p){const i=[...l,...p],r=Array.from(new Set(i));return{hasChanged:r.length!==l.length,reasons:r}}function nRi(l,p){const i=l.filter(a=>!p.includes(a));return{hasChanged:i.length!==l.length,reasons:i}}function aRi(l,p){return l.find(i=>i.entity.id===p)||null}function kk(l){return l.filter((p,i)=>l.indexOf(p)===i)}class Xr{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=TBe-RI-Qx,c=vBe-eI-Xx;p.type===d.Project?(p.x=a,p.y=c):p.metaSync({x:p.x||a,y:p.y||c},i);const e=new Xr(p,0,null,i);e.calculationEntryPoint=e,e._onlyEntities=r||[],e.ids=["0"];const f=[];e.next(m=>{f.push(...m)}),Xr.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&&Xr.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=Xr.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=Wl(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(Bt.includes(e.type)){a.push(e);return}i.push(e)});const c=i.sort((e,f)=>{const h=!!MI(e,f).length,m=Wl(e),E=Wl(f);return h?0:m.length&&!E.length?-1:!m.length&&E.length?1:0}).filter(e=>!Dc(e).length);this.childEntities=[...r,...a,...c]}else{const i=[],r=[],a=[],c=[],e=[];Wi.includes(this.entity.type)&&W1(this.entity).forEach(m=>{if(xt.includes(m.type)){a.push(m);return}const E=yt(m);i.push(E)}),Er.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:xt.includes(h.type)?(a.push(h),!1):er.includes(h.type)&&!m?(c.push(h),!1):h.type===d.DefinitionEntity?(e.push(h),!1):!0});i.sort((h,m)=>ql(h,m)?-1:0),c.sort((h,m)=>ql(h,m)?-1:0),a.sort((h,m)=>iV(h,m)?1:iV(m,h)?-1:0),this.childEntities=[...e,...i,...c,...f,...a,...r]}}calculateCardSize(){const p=EBe(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:Xr.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)=>Xr.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)=>Xr.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)=>Xr.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const p=this.ownEntityPlusBufferArea;return this.children.map(a=>a.fullBranchArea).reduce((a,c)=>Xr.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+eI,right:p.right+RI}}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([...Bt].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(Xr.getEarliestParentInChain(a)!==this)return;const e=aRi(r,a.entity.id);r=Xr.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=Xr.filterOutRepeatedAreas([...this.flattenSiblings(),...p]);Xr.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+nf,h={top:f,left:e.left,bottom:f,right:e.right};return Xr.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(p.bottom-p.top)/2-nf;this.shiftDownAlone(r)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const p=this.children.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+nf,h={top:f,left:e.left,bottom:f,right:e.right};return Xr.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(p.bottom-p.top)/2-nf;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 kk(p)}getLowerAreas(){const p=this.getLowerSiblings(),i=this.parents.reduce((r,a)=>[...r,...a.getLowerAreas()],[]);return kk([...p,...i])}adjustVerticallyToAvoidOverlaps(p=[]){const r=Xr.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(_=>MI(this.entity,_.entity))).filter(_=>_.id!==this.entity.id).map(_=>this.findAreaFromEntity(_)).filter(_=>!!_),E=this.getFullAreaUntilAny(m),b=r.getFullAreaUntilAny(m),A=e.reduce((_,N)=>N===this||N.fullBranchArea.left!==E.left?_:Math.max(_,N.fullBranchArea.bottom),b.bottom);if(E.top<A){const _=A-E.top+eI;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 Xr(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 sRi(l,p,i={}){var c;const r=Y.YieldTracker.from(i),a=[];console.log("Generating layout for project...");for(const e of l.instancesList){if(l.diggestedBuiltInBaseEntitiesIds.has(e.id)||!Tf.includes(e.type)||((c=yt(e))==null?void 0:c.id)!==e.id)continue;let f=Gt(e,l);if(!f){console.log("No top scope owner for instance: ",e," in project: ",l);continue}if(!(Bt.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==l;)f=f.parent,Bt.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,p==null||p.add(e,W.Updated),a.push(e),await r.tick()}}Xr.autoGenerateLayout(l,p,a)}async function lRi(l,p,i={}){const r=Y.YieldTracker.from(i),a=[],c=[l,...pt(l)].map(e=>yt(e)).filter(Boolean);for(const e of c){if(l.project.diggestedBuiltInBaseEntitiesIds.has(e.id))continue;let f=Gt(e,l.project);if(f&&!(Bt.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==l.project;)f=f.parent,Bt.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,p==null||p.add(e,W.Updated),a.push(e),await r.tick()}}Xr.autoGenerateLayout(l.project,p,a)}async function oRi(l,p,i={}){const r=Y.YieldTracker.from(i),a=[],c=new Set;hFe(p,{shallowMissingActivesError:!0,excludeAffected:!0}).forEach(m=>{var b;if((!m.x||!m.y)&&!c.has(m.id)&&!l.diggestedBuiltInBaseEntitiesIds.has(m.id)&&(a.push(m),c.add(m.id)),Jl(m,l)){const A=yt(m);A&&!c.has(A.id)&&!l.diggestedBuiltInBaseEntitiesIds.has(A.id)&&(a.push(A),c.add(A.id))}if(Wi.includes(m.type)){const A=m;[A,...pt(A)].forEach(N=>{const P=yt(N);P&&!c.has(P.id)&&!l.diggestedBuiltInBaseEntitiesIds.has(P.id)&&(a.push(P),c.add(P.id))})}m.type===d.DefinitionEntity&&m.methods.forEach(A=>{pt(A).forEach(N=>{const P=yt(N);P&&!c.has(P.id)&&!l.diggestedBuiltInBaseEntitiesIds.has(P.id)&&(a.push(P),c.add(P.id))})}),((b=m.parent)==null?void 0:b.type)===d.Project&&(a.push(m),c.add(m.id),Wi.includes(m.type)&&pt(m).forEach(N=>{const P=yt(N);P&&!c.has(P.id)&&!l.diggestedBuiltInBaseEntitiesIds.has(P.id)&&(a.push(P),c.add(P.id))}))});let f=[];for(const m of a)l.diggestedBuiltInBaseEntitiesIds.has(m.id)||(m.x=0,m.y=0,p==null||p.add(m,W.Updated),f.push(m),await r.tick());f=C(f),Xr.autoGenerateLayout(l,p,f);const h=C([...f,...l.variableDeclarations,...l.variableInstances,...l.loops,...l.conditions,...l.operations,...l.searches]).filter(m=>m.x===0||m.y===0);Xr.autoGenerateLayout(l,p,h)}var gT=(l=>(l.Amazon="amazon",l.Google="google",l.Microsoft="microsoft",l))(gT||{}),_r=(l=>(l.RelationalDatabase="relational-database",l.CompiledLocalCodebase="compiled-local-codebase",l.CloudHostedCodebase="cloud-hosted-codebase",l.HttpApi="http-api",l.HttpEndpoint="http-endpoint",l.ServerlessFunction="serverless-function",l.CronJob="cron-job",l.AWSTenantAccount="aws-tenant-account",l))(_r||{}),__=(l=>(l.Post="post",l.Get="get",l.Acknowledgement="acknowledgment",l.Progress="progress",l.Error="error",l.Complete="complete",l))(__||{}),Xc=(l=>(l.Queued="queued",l.Running="running",l.Success="success",l.Failed="failed",l.CleanedUp="cleaned-up",l.Skipped="skipped",l.AbortedByUser="aborted-by-user",l.UnrecoverableFailure="unrecoverable-failure",l.Reverted="reverted",l.UnpublishingStarted="unpublishing-started",l.Unpublished="unpublished",l))(Xc||{}),V_=(l=>(l.Queued="queued",l.Running="running",l.Success="success",l.Failed="failed",l.CleanedUp="cleaned-up",l.UnrecoverableFailure="unrecoverable-failure",l.Reverted="reverted",l.UnpublishingStarted="unpublishing-started",l.Unpublished="unpublished",l))(V_||{}),Kt=(l=>(l.ProjectNotFound="project-not-found",l.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",l.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",l.DeploymentCompleted="deployment-completed",l.DeploymentStarted="deployment-started",l.DeploymentFailed="deployment-failed",l.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",l.RequestPayloadValidationFailed="request-payload-validation-failed",l.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",l.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",l.ProjectAlreadyBeingPublished="project-already-being-published",l.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",l.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",l.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",l.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",l.CreatingNewRelationalDatabase="creating-new-relational-database",l.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",l.RelationalDatabaseAlreadyExists="relational-database-already-exists",l.RelationalDatabaseDeletionStarted="relational-database-deletion-started",l.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",l.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",l.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",l.HttpApiDeploymentStarted="http-api-deployment-started",l.HttpApiDeploymentCompleted="http-api-deployment-completed",l.HttpApiDeploymentFailed="http-api-deployment-failed",l.CreatingNewHttpApi="creating-new-http-api",l.HttpApiAlreadyExists="http-api-already-exists",l.HttpApiDeletionStarted="http-api-deletion-started",l.HttpApiDeletionCompleted="http-api-deletion-completed",l.HttpApiDeletionFailed="http-api-deletion-failed",l.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",l.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",l.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",l.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",l.BundlingCodebaseForDownload="bundling-codebase-for-download",l.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",l.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",l.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",l.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",l.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",l.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",l.CodeCompilationStarted="code-compilation-started",l.CodeCompilationCompleted="code-compilation-completed",l.CodeCompilationFailed="code-compilation-failed",l.BundleCodebaseStarted="bundle-codebase-started",l.BundleCodebaseCompleted="bundle-codebase-completed",l.BundleCodebaseFailed="bundle-codebase-failed",l.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",l.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",l.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",l.MigrateRelationalDatabaseStarted="migrate-relational-database-started",l.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",l.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",l.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",l.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",l.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",l.ExecutePublicationCompletedEventTimedOut="execute-publication-completed-event-timed-out",l.AWSTenantAccountProvisioningStarted="aws-tenant-account-provisioning-started",l.AWSTenantAccountProvisioningCompleted="aws-tenant-account-provisioning-completed",l.AWSTenantAccountProvisioningFailed="aws-tenant-account-provisioning-failed",l))(Kt||{}),Ul=(l=>(l.CodeCompilation="code-compilation",l.RelationalDatabaseDeployment="relational-database-deployment",l.RelationalDatabaseDeletion="relational-database-deletion",l.HttpApiDeployment="http-api-deployment",l.HttpApiDeletion="http-api-deletion",l.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",l.BundleCodebase="bundle-codebase",l.MigrateRelationalDatabase="migrate-relational-database",l.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",l.ExecutePublicationCompletedEvent="execute-publication-completed-event",l.CodebaseCleanup="codebase-cleanup",l.AWSTenantAccountProvisioning="aws-tenant-account-provisioning",l))(Ul||{});_r.CloudHostedCodebase,_r.HttpApi,_r.RelationalDatabase,_r.CloudHostedCodebase,_r.CloudHostedCodebase,_r.RelationalDatabase,_r.CloudHostedCodebase,_r.CloudHostedCodebase;function ABe(l){return`project-${l}-http-api`}function h1(l){return`entity-${l}-database`}class IBe{constructor(p,i,r,a,c,e,f,h,m){R(this,"stepType");R(this,"id");R(this,"resourceType");R(this,"index");R(this,"dependency",[]);R(this,"lastEvent",null);R(this,"lastEventTimestamp",null);R(this,"status",Xc.Queued);R(this,"publicationRun");R(this,"resource");this.stepType=p,this.id=i,this.resourceType=r,this.status=a,this.dependency=c,this.index=e,this.lastEventTimestamp=f,this.publicationRun=h,this.resource=m}toJSON(){return{stepType:this.stepType,id:this.id,resourceType:this.resourceType,index:this.index,status:this.status,dependency:this.dependency,lastEvent:this.lastEvent,resource:{resourceId:this.resource.resourceId,resourceType:this.resource.resourceType,provider:this.resource.provider,details:this.resource.details,status:this.resource.status,name:this.resource.name}}}async update(p){var i,r;this.status=p.status,this.dependency=p.dependency,this.index=p.index,this.stepType=p.stepType,this.resourceType=p.resourceType,this.lastEvent=p.lastEvent,this.id=p.id,(r=this.resource)==null||r.setDetails((i=p.resource)==null?void 0:i.details)}}var gBe=(l=>(l.Ready="ready",l.Provisioning="provisioning",l.Queued="queued",l.ProvisioningFailed="provisioning-failed",l.Deleting="deleting",l.DeletingFailed="deleting-failed",l.Deleted="deleted",l))(gBe||{});class Ff{constructor(p,i,r){R(this,"provisionedBy");R(this,"publicationRun");R(this,"resourceType");R(this,"provider");R(this,"resourceId");R(this,"details",null);R(this,"name",null);R(this,"status","queued");this.publicationRun=p,this.resourceType=i,this.provider=r}setDetails(p){this.details=p}setStatus(p){this.status=p}setProvisionedBy(p){this.provisionedBy=p}}class dRi extends Ff{constructor(i,r,a){super(i,_r.HttpEndpoint,a);R(this,"resourceType",_r.HttpEndpoint);R(this,"owners",new Map);R(this,"details",null);R(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=h1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class uRi extends Ff{constructor(i,r,a){super(i,_r.ServerlessFunction,a);R(this,"resourceType",_r.ServerlessFunction);R(this,"owners",new Map);R(this,"details",null);R(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=h1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class RBe extends Ff{constructor(i,r,a){super(i,_r.HttpApi,a);R(this,"resourceType",_r.HttpApi);R(this,"owners",new Map);R(this,"details",null);R(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=ABe(this.publicationRun.project.id),this.resourceId}}class DBe extends Ff{constructor(i,r,a){super(i,_r.RelationalDatabase,a);R(this,"resourceType",_r.RelationalDatabase);R(this,"owners",new Map);R(this,"details",null);R(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=h1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class wBe extends Ff{constructor(i,r){super(i,_r.CloudHostedCodebase,r);R(this,"resourceType",_r.CloudHostedCodebase);R(this,"details",null);R(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class CBe extends Ff{constructor(i,r){super(i,_r.CompiledLocalCodebase,r);R(this,"resourceType",_r.CompiledLocalCodebase);R(this,"details",null);R(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`,this.resourceId}}class pRi{constructor(p,i){R(this,"id");R(this,"projectAutoIncrementPublicationCount");R(this,"projectPublishedSemanticVersion");R(this,"projectVersion");R(this,"projectId");R(this,"triggeredBy");R(this,"createdAt");R(this,"updatedAt");R(this,"status");R(this,"steps",[]);R(this,"editor");R(this,"explicitResources",new Map);R(this,"implicitGlobalResources",new Map);R(this,"finalGlobalEvent",null);R(this,"finalStatus",null);R(this,"contextType",ae.PublicationRun);R(this,"extensionsRegistry");this.id=p.id,this.projectAutoIncrementPublicationCount=p.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=p.projectPublishedSemanticVersion,this.projectVersion=p.projectVersion,this.projectId=p.projectId,this.triggeredBy=p.triggeredBy,this.createdAt=p.createdAt,this.updatedAt=p.updatedAt,this.status=p.status,this.editor=i,this.initRegistry()}get off(){return this.extensionsRegistry.off}get on(){return this.extensionsRegistry.on}get emit(){return this.extensionsRegistry.emit}get emitAsync(){return this.extensionsRegistry.emitAsync}get emitAsyncAll(){return this.extensionsRegistry.emitAsyncAll}get emitAsyncAllSettled(){return this.extensionsRegistry.emitAsyncAllSettled}get emitAsyncSequentially(){return this.extensionsRegistry.emitAsyncSequentially}get emitAsyncSequentiallyAll(){return this.extensionsRegistry.emitAsyncSequentiallyAll}get emitAsyncSequentiallyAllSettled(){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled}get project(){return this.editor.project}getInfraTypes(p){return this.steps.filter(i=>p.includes(i.resourceType))}getStepsTypes(p){return this.steps.filter(i=>p.includes(i.stepType))}toIds(p){return p.map(i=>i.id)}getResourceForEntity(p){const i=Array.from(this.explicitResources.values()).find(r=>r.owners.has(p.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(_r.CompiledLocalCodebase,new CBe(this,gT.Amazon)),this.implicitGlobalResources.set(_r.CloudHostedCodebase,new wBe(this,gT.Amazon));const p=this.project.entities.filter(r=>si(r,ge.HTTP_ENDPOINT)),i=this.project.entities.filter(r=>si(r,ge.RELATIONAL_DATABASE));if(i.length&&i.forEach(r=>{const a=new DBe(this,[r],gT.Amazon);this.explicitResources.set(a.resourceId,a)}),p.length){const r=new RBe(this,p,gT.Amazon);this.explicitResources.set(r.resourceId,r)}}setSteps(p,i){p.forEach(r=>{this.addStep(r,i)}),this.editor.events.emit(Kt.ProjectPublishRequestAcknowledged,{})}addStep(p,i){const r=p.dependency||[];if(r.length){const c=r.filter(e=>!this.steps.find(f=>f.id===e));if(c.length)throw new Error(`Missing dependencies: ${c.join(", ")}`)}if(!this.steps.find(c=>c.id===p.id)){const c=new IBe(p.stepType,p.id,p.resourceType,p.status,r,p.index,i,this,null);this.steps.push(c)}}onUpdate(p){var i;if(Y.Logger.log("onUpdate",p),(i=p.payload)!=null&&i.stepType){const r=this.steps.find(a=>{var c;return a.id===((c=p.payload)==null?void 0:c.id)});r&&B(p.emittedAt).isAfter(B(r.lastEventTimestamp))&&r.update(p.payload)}this.editor.events.emit("publication-updated",{}),p.type===__.Error?(this.finalStatus=V_.Failed,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-error",p)):p.type===__.Complete&&(this.finalStatus=V_.Success,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-completed",p))}requestExtension(p){return this.extensionsRegistry.requestExtension(p)}async initRegistry(){return this.extensionsRegistry=new Zx(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(ae.PublicationRun),this.extensionsRegistry}}function cRi(l){switch(l){case Ul.CodeCompilation:return"Code generation";case Ul.RelationalDatabaseDeployment:return"Database creation";case Ul.HttpApiDeployment:return"HTTP gateway creation";case Ul.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case Ul.BundleCodebase:return"Bundle code";case Ul.MigrateRelationalDatabase:return"Database structure migration";case Ul.BusinessLogicCodebaseDeployment:return"Update servers with new code";case Ul.CodebaseCleanup:return"Code cleanup";case Ul.HttpApiDeletion:return"HTTP gateway deletion";case Ul.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function fRi(l){switch(l){case Kt.DeploymentCompleted:return"Successfully published";case Kt.DeploymentStarted:return"Publication started";case Kt.DeploymentFailed:return"Publication failed";case Kt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case Kt.RequestPayloadValidationFailed:return"Request payload validation failed";case Kt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case Kt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case Kt.RelationalDatabaseDeploymentStarted:return"Database creation started";case Kt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case Kt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case Kt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case Kt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case Kt.RelationalDatabaseAlreadyExists:return"Database already exists";case Kt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case Kt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case Kt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case Kt.CreatingNewHttpApi:return"Creating new HTTP gateway";case Kt.HttpApiAlreadyExists:return"HTTP gateway already exists";case Kt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case Kt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case Kt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case Kt.BundlingCodebaseForDownload:return"Bundling code for download";case Kt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case Kt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case Kt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case Kt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case Kt.CodeCompilationStarted:return"Code generation started";case Kt.CodeCompilationCompleted:return"Code generation completed";case Kt.CodeCompilationFailed:return"Code generation failed";case Kt.BundleCodebaseStarted:return"Code bundling started";case Kt.BundleCodebaseCompleted:return"Code bundling completed";case Kt.BundleCodebaseFailed:return"Code bundling failed";case Kt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case Kt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case Kt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case Kt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case Kt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case Kt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case Kt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case Kt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case Kt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case Kt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case Kt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case Kt.ProjectNotFound:return"Project not found";case Kt.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case Kt.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case Kt.HttpApiDeletionStarted:return"HTTP gateway deletion started";case Kt.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case Kt.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case Kt.RelationalDatabaseDeletionStarted:return"Database deletion started";case Kt.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case Kt.RelationalDatabaseDeletionFailed:return"Database deletion failed";case Kt.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var OBe=(l=>(l.NO_LOGIC="NO_LOGIC",l.NO_NAME="NO_NAME",l.NO_CHANGES="NO_CHANGES",l.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",l))(OBe||{});function yRi(l){switch(l){case"NO_LOGIC":return"This project has no logic";case"NO_NAME":return"This project has no name";case"NO_CHANGES":return"This version has already been published";case"PROJECT_PUBLICATION_ALREADY_ONGOING":return"This project is already being published";default:return"Publishing is currently not available. Try again later"}}function hRi(l){switch(l){case _r.RelationalDatabase:return"Relational database";case _r.HttpEndpoint:case _r.HttpApi:return"HTTP endpoints";case _r.ServerlessFunction:case _r.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function mRi(l){switch(l){case Xc.Running:return"In progress";case Xc.Failed:return"Failed";case Xc.Success:return"Succeeded";case Xc.Skipped:return"Skipped";case Xc.Queued:default:return"Queued"}}function _Be(l){var r;if(!si(l,ge.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=ne["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(l.type===d.BuiltInBaseEntity?si(l,ge.EXTERNAL_INTEGRATION_CONNECTION)&&(p=P_(l.name)):l.type===d.DefinitionEntity&&l.implements.forEach(a=>{if(si(a,ge.EXTERNAL_INTEGRATION_CONNECTION)){const c=P_(a==null?void 0:a.name);if(c)return p=c,!0}}),!p){const a=l.properties.find(c=>!!c.implements.find(e=>e.id===i)||!!c.implements.find(e=>{var f;return((f=e.extends)==null?void 0:f.id)===i}));p=(r=a==null?void 0:a.getDefaultValue())==null?void 0:r.value}return p}function TRi(l){return h0e[l]}function P_(l){return l.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?l.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function VBe(l){if(l.type!==d.ActionDescriptor&&l.type!==d.Operation)throw new Error("Only ActionDescriptorState or OperationState can be used to resolve an external integration ID");if(l.type===d.ActionDescriptor){const p=l;if(p.id.startsWith("external-integration--"))return p.id.split("--")[1]}if(l.type===d.Operation){const p=l.declaration;if(Object.values(fi).includes(p.id))return p.id.split("--")[1]||null}return null}function vRi(l){if(!l)throw new Error("The integrationName parameter is required to resolve the base built-in name.");return Object.values(ge).find(i=>!!(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")&&i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===l.toLowerCase()))||null}function ERi(l){return l.type===d.BuiltInBaseEntity||l.type===d.DefinitionEntity?_Be(l):l.type===d.ActionDescriptor||l.type===d.Operation?VBe(l):null}function PBe(l){var a,c,e;if(!si(l,ge.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=aFe(l,ge.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const r=ne["built-in-base-entity"][i.id].properties.connectionId.id;if(l.type===d.BuiltInBaseEntity){if(si(l,ge.EXTERNAL_INTEGRATION_CONNECTION)){const f=l.properties.find(h=>{var m;return((m=h.extends)==null?void 0:m.id)===r});f&&(p=(a=f.getDefaultValue())==null?void 0:a.value)}}else if(l.type===d.DefinitionEntity){const f=l.properties.find(h=>!!h.implements.find(m=>m.id===r)||!!h.implements.find(m=>{var E;return((E=m.extends)==null?void 0:E.id)===r}));if(!f&&((c=l.extends)==null?void 0:c.type)===d.DefinitionEntity)return PBe(l.extends);p=(e=f==null?void 0:f.getDefaultValue())==null?void 0:e.value}return p}async function NBe(l,p={}){var f;const i=Y.YieldTracker.from(p),a=[...ca(l),...vs(l),...t$(l),...fa(l),...i$(l)],c=xE(l);a.push(...c);const e=qt(l.errors,a);await i.tick();for(const h of l.inputs)await h.validateAsync({tracker:i});for(const h of l.outputs)await h.validateAsync({tracker:i});for(const h of l.internalCalls)await h.validateAsync({tracker:i});return await((f=l.dataType)==null?void 0:f.validateAsync({tracker:i})),e}function xBe(l){var a;(a=l.dataType)==null||a.validate(),l.inputs.forEach(c=>c.validate()),l.outputs.forEach(c=>c.validate()),l.internalCalls.forEach(c=>c.validate());const i=[...ca(l),...vs(l),...t$(l),...fa(l),...i$(l)],r=xE(l);return i.push(...r),qt(l.errors,i)}function t$(l,p){const r=[...l.project.getVariableDeclarations()].filter(a=>a.id!==l.id);return LE(l,[Qi],r,p)}function i$(l){const p=[];if(l.parent!==l.project)return p;if(l.catchesError){const i=It({id:`${l.id}--${Ce.GlobalVariableDeclarationCannotCatchError}`,message:`${Xa[l.type].singular} "${le(l,l.project)}" with id "${l.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:Te.Error,code:Ce.GlobalVariableDeclarationCannotCatchError,entity:l});p.push(i.error)}if(l.errorCalls.length){const i=It({id:`${l.id}--${Ce.GlobalVariableDeclarationCannotCallOnError}`,message:`${Xa[l.type].singular} "${le(l,l.project)}" with id "${l.id}" cannot call other entities from its error branch because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:Te.Error,code:Ce.GlobalVariableDeclarationCannotCallOnError,entity:l});p.push(i.error)}if(l.calledBy.length){const i=It({id:`${l.id}--${Ce.GlobalVariableDeclarationCannotBeCalled}`,message:`${Xa[l.type].singular} "${le(l,l.project)}" with id "${l.id}" cannot be called because it is globally declared. Global variable declarations must be self initialized when the project is loaded, and not be called for initialization.`,severity:Te.Error,code:Ce.GlobalVariableDeclarationCannotBeCalled,entity:l});p.push(i.error)}return[]}const bRi=Object.freeze(Object.defineProperty({__proto__:null,validate:xBe,validateAsync:NBe,validateGlobalVariableDeclaration:i$,validateVariableDeclarationName:t$},Symbol.toStringTag,{value:"Module"}));async function $Be(l,p={}){const i=Y.YieldTracker.from(p),a=[...ca(l),...vs(l),...fa(l),...Wo(l),...BBe(l)],c=xE(l);a.push(...c);const e=qt(l.errors,a);await i.tick();for(const f of l.inputs)await f.validateAsync({tracker:i});for(const f of l.outputs)await f.validateAsync({tracker:i});for(const f of l.internalCalls)await f.validateAsync({tracker:i});return e}function LBe(l){l.inputs.forEach(a=>a.validate()),l.outputs.forEach(a=>a.validate()),l.internalCalls.forEach(a=>a.validate());const i=[...ca(l),...vs(l),...fa(l)],r=xE(l);return i.push(...r),qt(l.errors,i)}function BBe(l){const p=[],i=l.declaration.constant;if(i&&l.readsValue){const r=It({id:`${l.id}--${be.ValueReadingOverridesConstantVariable}`,message:`The '${l.type}' entity "${le(l,l.project)}" with id "${l.id}" is a constant variable whose value cannot be overriden, but reads a value.`,severity:Te.Error,code:be.ValueReadingOverridesConstantVariable,entity:l});p.push(r.error)}if(i&&l.defaultValue){const r=It({id:`${l.id}--${be.DefaultValueOverridesConstantVariable}`,message:`The '${l.type}' entity "${le(l,l.project)}" with id "${l.id}" is a constant variable whose value cannot be overridden, but has a 'defaultValue'.`,severity:Te.Error,code:be.DefaultValueOverridesConstantVariable,entity:l});p.push(r.error)}return p}function Wo(l){var h;const p=[],i=l.declaration;if((i==null?void 0:i.id)===((h=l.parent)==null?void 0:h.id)||!l.calledBy.length&&l.successCalls.length&&l.errorCalls.length)return p;const r=pt(l),a=pt(i);!!r.find(m=>m.id===i.id)&&p.push(It({id:`${l.id}--${be.CalledBeforeDeclaration}`,code:be.CalledBeforeDeclaration,severity:Te.Error,message:`Entity of type "${l.type}" with id "${l.id}" is called before its 'variable-declaration' '${i.name}' with id "${i.id}".
55
55
  The 'variable-declaration' must be called before any internal call that references it can be called.`,entity:l}).error);const e=Gt(i,l.project),f=Gt(l,l.project);if((e==null?void 0:e.type)!==d.Project&&e&&f){const m=!!a.find(E=>E.id===l.id);if((e==null?void 0:e.id)===(f==null?void 0:f.id))m||p.push(It({id:`${l.id}--${be.CalledInParallelBranchToDeclaration}`,code:be.CalledInParallelBranchToDeclaration,severity:Te.Error,message:`Entity of type "${l.type}" with id "${l.id}" is called in a parallel branch to its 'variable-declaration' '${i.name}' with id "${i.id}".
56
56
  The 'variable-declaration' must be called in a different branch that executes before any internal call that references it can be called.`,entity:l}).error);else if(Na(f,e,l.project))p.push(It({id:`${l.id}--${be.HigherScopeThanDeclaration}`,code:be.HigherScopeThanDeclaration,severity:Te.Error,message:`Entity of type "${l.type}" with id "${l.id}" is called in a higher scope than its 'variable-declaration' '${i.name}' with id "${i.id}".
57
57
  The 'variable-declaration' must be called in the same scope or in a higher scope than any internal call that references it.`,entity:l}).error);else if(Na(e,f,l.project)){let E=f;for(;E.id!==e.id&&E.id!==l.project.id;){const A=Gt(E,l.project);if(A.id===e.id)break;E=A}const b=Bm(E);if(b){const _=!!pt(b).find(P=>P.id===i.id),N=!!a.find(P=>P.id===b.id);_?p.push(It({id:`${l.id}--${be.CalledBeforeDeclaration}`,code:be.CalledBeforeDeclaration,severity:Te.Error,message:`Entity of type "${l.type}" with id "${l.id}" is called before its 'variable-declaration' '${i.name}' with id "${i.id}".
package/dist/index.js CHANGED
@@ -126010,7 +126010,7 @@ async function K3i(l, p, i = {}) {
126010
126010
  ]).filter((m) => m.x === 0 || m.y === 0);
126011
126011
  sn.autoGenerateLayout(l, p, h);
126012
126012
  }
126013
- var Ym = /* @__PURE__ */ ((l) => (l.Amazon = "amazon", l.Google = "google", l.Microsoft = "microsoft", l))(Ym || {}), _r = /* @__PURE__ */ ((l) => (l.RelationalDatabase = "relational-database", l.CompiledLocalCodebase = "compiled-local-codebase", l.CloudHostedCodebase = "cloud-hosted-codebase", l.HttpApi = "http-api", l.HttpEndpoint = "http-endpoint", l.ServerlessFunction = "serverless-function", l.CronJob = "cron-job", l))(_r || {}), HD = /* @__PURE__ */ ((l) => (l.Post = "post", l.Get = "get", l.Acknowledgement = "acknowledgment", l.Progress = "progress", l.Error = "error", l.Complete = "complete", l))(HD || {}), Ic = /* @__PURE__ */ ((l) => (l.Queued = "queued", l.Running = "running", l.Success = "success", l.Failed = "failed", l.CleanedUp = "cleaned-up", l.Skipped = "skipped", l.AbortedByUser = "aborted-by-user", l.UnrecoverableFailure = "unrecoverable-failure", l.Reverted = "reverted", l.UnpublishingStarted = "unpublishing-started", l.Unpublished = "unpublished", l))(Ic || {}), zD = /* @__PURE__ */ ((l) => (l.Queued = "queued", l.Running = "running", l.Success = "success", l.Failed = "failed", l.CleanedUp = "cleaned-up", l.UnrecoverableFailure = "unrecoverable-failure", l.Reverted = "reverted", l.UnpublishingStarted = "unpublishing-started", l.Unpublished = "unpublished", l))(zD || {}), Kt = /* @__PURE__ */ ((l) => (l.ProjectNotFound = "project-not-found", l.ProjectPublishRequestAcknowledged = "project-publish-request-acknowledged", l.PublicationStepFailedReasonUnknown = "publication-step-failed-reason-unknown", l.DeploymentCompleted = "deployment-completed", l.DeploymentStarted = "deployment-started", l.DeploymentFailed = "deployment-failed", l.AllInfrastructureSuccessfullyProvisioned = "all-infrastucture-successfully-provisioned", l.RequestPayloadValidationFailed = "request-payload-validation-failed", l.ProjectStateValidationFailedMissingName = "project-state-validation-failed-missing-name", l.ProjectStateValidationFailedMissingAnyFunctionality = "project-state-validation-failed-missing-any-functionality", l.ProjectAlreadyBeingPublished = "project-already-being-published", l.BillingSubscriptionUpdateFailed = "billing-subscription-update-failed", l.RelationalDatabaseDeploymentStarted = "relational-database-deployment-started", l.RelationalDatabaseDeploymentCompleted = "relational-database-deployment-completed", l.RelationalDatabaseDeploymentFailed = "relational-database-deployment-failed", l.CreatingNewRelationalDatabase = "creating-new-relational-database", l.WaitingForPreviousRelationalDatabaseDeployment = "waiting-for-previous-relationa-database-deployment", l.RelationalDatabaseAlreadyExists = "relational-database-already-exists", l.RelationalDatabaseDeletionStarted = "relational-database-deletion-started", l.RelationalDatabaseDeletionCompleted = "relational-database-deletion-completed", l.RelationalDatabaseDeletionFailed = "relational-database-deletion-failed", l.WaitingForPreviousRelationalDatabaseDeletion = "waiting-for-previous-relationa-database-deletion", l.HttpApiDeploymentStarted = "http-api-deployment-started", l.HttpApiDeploymentCompleted = "http-api-deployment-completed", l.HttpApiDeploymentFailed = "http-api-deployment-failed", l.CreatingNewHttpApi = "creating-new-http-api", l.HttpApiAlreadyExists = "http-api-already-exists", l.HttpApiDeletionStarted = "http-api-deletion-started", l.HttpApiDeletionCompleted = "http-api-deletion-completed", l.HttpApiDeletionFailed = "http-api-deletion-failed", l.WaitingForPreviousHttpApiDeletion = "waiting-for-previous-http-api-deletion", l.BusinessLogicCodebaseDeploymentStarted = "business-logic-codebase-deployment-started", l.BusinessLogicCodebaseDeploymentCompleted = "business-logic-codebase-deployment-completed", l.BusinessLogicCodebaseDeploymentFailed = "business-logic-codebase-deployment-failed", l.BundlingCodebaseForDownload = "bundling-codebase-for-download", l.UploadingCodebaseToCloudStorage = "uploading-codebase-to-cloud-storage", l.UploadingCodebaseToCloudStorageCompleted = "uploading-codebase-to-cloud-storage-completed", l.UploadingCodebaseToCloudStorageFailed = "uploading-codebase-to-cloud-storage-failed", l.InfrastructureValuesCodebaseInterpolationStarted = "infrastructure-values-codebase-interpolation-started", l.InfrastructureValuesCodebaseInterpolationCompleted = "infrastructure-values-codebase-interpolation-completed", l.InfrastructureValuesCodebaseInterpolationFailed = "infrastructure-values-codebase-interpolation-failed", l.CodeCompilationStarted = "code-compilation-started", l.CodeCompilationCompleted = "code-compilation-completed", l.CodeCompilationFailed = "code-compilation-failed", l.BundleCodebaseStarted = "bundle-codebase-started", l.BundleCodebaseCompleted = "bundle-codebase-completed", l.BundleCodebaseFailed = "bundle-codebase-failed", l.InstallingCodebaseDependenciesStarted = "installing-codebase-dependencies-started", l.InstallingCodebaseDependenciesCompleted = "installing-codebase-dependencies-completed", l.InstallingCodebaseDependenciesFailed = "installing-codebase-dependencies-failed", l.MigrateRelationalDatabaseStarted = "migrate-relational-database-started", l.MigrateRelationalDatabaseCompleted = "migrate-relational-database-completed", l.MigrateRelationalDatabaseFailed = "migrate-relational-database-failed", l.ExecutePublicationCompletedEventStarted = "execute-publication-completed-event-started", l.ExecutePublicationCompletedEventCompleted = "execute-publication-completed-event-completed", l.ExecutePublicationCompletedEventFailed = "execute-publication-completed-event-failed", l.ExecutePublicationCompletedEventTimedOut = "execute-publication-completed-event-timed-out", l))(Kt || {}), Ll = /* @__PURE__ */ ((l) => (l.CodeCompilation = "code-compilation", l.RelationalDatabaseDeployment = "relational-database-deployment", l.RelationalDatabaseDeletion = "relational-database-deletion", l.HttpApiDeployment = "http-api-deployment", l.HttpApiDeletion = "http-api-deletion", l.InfrastructureValuesCodebaseInterpolation = "infrastructure-values-codebase-interpolation", l.BundleCodebase = "bundle-codebase", l.MigrateRelationalDatabase = "migrate-relational-database", l.BusinessLogicCodebaseDeployment = "business-logic-codebase-deployment", l.ExecutePublicationCompletedEvent = "execute-publication-completed-event", l.CodebaseCleanup = "codebase-cleanup", l))(Ll || {});
126013
+ var Ym = /* @__PURE__ */ ((l) => (l.Amazon = "amazon", l.Google = "google", l.Microsoft = "microsoft", l))(Ym || {}), _r = /* @__PURE__ */ ((l) => (l.RelationalDatabase = "relational-database", l.CompiledLocalCodebase = "compiled-local-codebase", l.CloudHostedCodebase = "cloud-hosted-codebase", l.HttpApi = "http-api", l.HttpEndpoint = "http-endpoint", l.ServerlessFunction = "serverless-function", l.CronJob = "cron-job", l.AWSTenantAccount = "aws-tenant-account", l))(_r || {}), HD = /* @__PURE__ */ ((l) => (l.Post = "post", l.Get = "get", l.Acknowledgement = "acknowledgment", l.Progress = "progress", l.Error = "error", l.Complete = "complete", l))(HD || {}), Ic = /* @__PURE__ */ ((l) => (l.Queued = "queued", l.Running = "running", l.Success = "success", l.Failed = "failed", l.CleanedUp = "cleaned-up", l.Skipped = "skipped", l.AbortedByUser = "aborted-by-user", l.UnrecoverableFailure = "unrecoverable-failure", l.Reverted = "reverted", l.UnpublishingStarted = "unpublishing-started", l.Unpublished = "unpublished", l))(Ic || {}), zD = /* @__PURE__ */ ((l) => (l.Queued = "queued", l.Running = "running", l.Success = "success", l.Failed = "failed", l.CleanedUp = "cleaned-up", l.UnrecoverableFailure = "unrecoverable-failure", l.Reverted = "reverted", l.UnpublishingStarted = "unpublishing-started", l.Unpublished = "unpublished", l))(zD || {}), Kt = /* @__PURE__ */ ((l) => (l.ProjectNotFound = "project-not-found", l.ProjectPublishRequestAcknowledged = "project-publish-request-acknowledged", l.PublicationStepFailedReasonUnknown = "publication-step-failed-reason-unknown", l.DeploymentCompleted = "deployment-completed", l.DeploymentStarted = "deployment-started", l.DeploymentFailed = "deployment-failed", l.AllInfrastructureSuccessfullyProvisioned = "all-infrastucture-successfully-provisioned", l.RequestPayloadValidationFailed = "request-payload-validation-failed", l.ProjectStateValidationFailedMissingName = "project-state-validation-failed-missing-name", l.ProjectStateValidationFailedMissingAnyFunctionality = "project-state-validation-failed-missing-any-functionality", l.ProjectAlreadyBeingPublished = "project-already-being-published", l.BillingSubscriptionUpdateFailed = "billing-subscription-update-failed", l.RelationalDatabaseDeploymentStarted = "relational-database-deployment-started", l.RelationalDatabaseDeploymentCompleted = "relational-database-deployment-completed", l.RelationalDatabaseDeploymentFailed = "relational-database-deployment-failed", l.CreatingNewRelationalDatabase = "creating-new-relational-database", l.WaitingForPreviousRelationalDatabaseDeployment = "waiting-for-previous-relationa-database-deployment", l.RelationalDatabaseAlreadyExists = "relational-database-already-exists", l.RelationalDatabaseDeletionStarted = "relational-database-deletion-started", l.RelationalDatabaseDeletionCompleted = "relational-database-deletion-completed", l.RelationalDatabaseDeletionFailed = "relational-database-deletion-failed", l.WaitingForPreviousRelationalDatabaseDeletion = "waiting-for-previous-relationa-database-deletion", l.HttpApiDeploymentStarted = "http-api-deployment-started", l.HttpApiDeploymentCompleted = "http-api-deployment-completed", l.HttpApiDeploymentFailed = "http-api-deployment-failed", l.CreatingNewHttpApi = "creating-new-http-api", l.HttpApiAlreadyExists = "http-api-already-exists", l.HttpApiDeletionStarted = "http-api-deletion-started", l.HttpApiDeletionCompleted = "http-api-deletion-completed", l.HttpApiDeletionFailed = "http-api-deletion-failed", l.WaitingForPreviousHttpApiDeletion = "waiting-for-previous-http-api-deletion", l.BusinessLogicCodebaseDeploymentStarted = "business-logic-codebase-deployment-started", l.BusinessLogicCodebaseDeploymentCompleted = "business-logic-codebase-deployment-completed", l.BusinessLogicCodebaseDeploymentFailed = "business-logic-codebase-deployment-failed", l.BundlingCodebaseForDownload = "bundling-codebase-for-download", l.UploadingCodebaseToCloudStorage = "uploading-codebase-to-cloud-storage", l.UploadingCodebaseToCloudStorageCompleted = "uploading-codebase-to-cloud-storage-completed", l.UploadingCodebaseToCloudStorageFailed = "uploading-codebase-to-cloud-storage-failed", l.InfrastructureValuesCodebaseInterpolationStarted = "infrastructure-values-codebase-interpolation-started", l.InfrastructureValuesCodebaseInterpolationCompleted = "infrastructure-values-codebase-interpolation-completed", l.InfrastructureValuesCodebaseInterpolationFailed = "infrastructure-values-codebase-interpolation-failed", l.CodeCompilationStarted = "code-compilation-started", l.CodeCompilationCompleted = "code-compilation-completed", l.CodeCompilationFailed = "code-compilation-failed", l.BundleCodebaseStarted = "bundle-codebase-started", l.BundleCodebaseCompleted = "bundle-codebase-completed", l.BundleCodebaseFailed = "bundle-codebase-failed", l.InstallingCodebaseDependenciesStarted = "installing-codebase-dependencies-started", l.InstallingCodebaseDependenciesCompleted = "installing-codebase-dependencies-completed", l.InstallingCodebaseDependenciesFailed = "installing-codebase-dependencies-failed", l.MigrateRelationalDatabaseStarted = "migrate-relational-database-started", l.MigrateRelationalDatabaseCompleted = "migrate-relational-database-completed", l.MigrateRelationalDatabaseFailed = "migrate-relational-database-failed", l.ExecutePublicationCompletedEventStarted = "execute-publication-completed-event-started", l.ExecutePublicationCompletedEventCompleted = "execute-publication-completed-event-completed", l.ExecutePublicationCompletedEventFailed = "execute-publication-completed-event-failed", l.ExecutePublicationCompletedEventTimedOut = "execute-publication-completed-event-timed-out", l.AWSTenantAccountProvisioningStarted = "aws-tenant-account-provisioning-started", l.AWSTenantAccountProvisioningCompleted = "aws-tenant-account-provisioning-completed", l.AWSTenantAccountProvisioningFailed = "aws-tenant-account-provisioning-failed", l))(Kt || {}), Ll = /* @__PURE__ */ ((l) => (l.CodeCompilation = "code-compilation", l.RelationalDatabaseDeployment = "relational-database-deployment", l.RelationalDatabaseDeletion = "relational-database-deletion", l.HttpApiDeployment = "http-api-deployment", l.HttpApiDeletion = "http-api-deletion", l.InfrastructureValuesCodebaseInterpolation = "infrastructure-values-codebase-interpolation", l.BundleCodebase = "bundle-codebase", l.MigrateRelationalDatabase = "migrate-relational-database", l.BusinessLogicCodebaseDeployment = "business-logic-codebase-deployment", l.ExecutePublicationCompletedEvent = "execute-publication-completed-event", l.CodebaseCleanup = "codebase-cleanup", l.AWSTenantAccountProvisioning = "aws-tenant-account-provisioning", l))(Ll || {});
126014
126014
  _r.CloudHostedCodebase, _r.HttpApi, _r.RelationalDatabase, _r.CloudHostedCodebase, _r.CloudHostedCodebase, _r.RelationalDatabase, _r.CloudHostedCodebase, _r.CloudHostedCodebase;
126015
126015
  function xvi(l) {
126016
126016
  return `project-${l}-http-api`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6869",
3
+ "version": "0.0.6870",
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",
@@ -38,7 +38,7 @@
38
38
  "log:project": "tsx --tsconfig tsconfig.scripts.json scripts/describe-project.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@elyx-code/definitions": "^0.0.7998",
41
+ "@elyx-code/definitions": "^0.0.79991",
42
42
  "axios": "^1.9.0",
43
43
  "dayjs": "^1.11.13",
44
44
  "sql-parser-cst": "^0.33.1",
@@ -85,5 +85,8 @@
85
85
  "bugs": {
86
86
  "url": "https://github.com/elyx-code/project-logic-tree/issues"
87
87
  },
88
+ "engines": {
89
+ "node": ">=20.0.0"
90
+ },
88
91
  "homepage": "https://github.com/elyx-code/project-logic-tree#readme"
89
92
  }