@elyx-code/project-logic-tree 0.0.6965 → 0.0.6966
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 +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -51,7 +51,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
|
|
|
51
51
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(p){return p instanceof this?p:new this(p)}static concat(p,...i){const r=new this(p);return i.forEach(a=>r.set(a)),r}static accessor(p){const r=(this[eU]=this[eU]={accessors:{}}).accessors,a=this.prototype;function c(e){const f=q0(e);r[f]||(QRi(a,e),r[f]=!0)}return He.isArray(p)?p.forEach(c):c(p),this}}O1.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);He.reduceDescriptors(O1.prototype,({value:s},p)=>{let i=p[0].toUpperCase()+p.slice(1);return{get:()=>s,set(r){this[i]=r}}});He.freezeMethods(O1);const so=O1;function a_(s,p){const i=this||c$,r=p||i,a=so.from(r.headers);let c=r.data;return He.forEach(s,function(f){c=f.call(i,c,a.normalize(),p?p.status:void 0)}),a.normalize(),c}function YBe(s){return!!(s&&s.__CANCEL__)}class XRi extends ar{constructor(p,i,r){super(p??"canceled",ar.ERR_CANCELED,i,r),this.name="CanceledError",this.__CANCEL__=!0}}const OE=XRi;function JBe(s,p,i){const r=i.config.validateStatus;!i.status||!r||r(i.status)?s(i):p(new ar("Request failed with status code "+i.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function e1i(s){const p=/^([-+\w]{1,25})(:?\/\/|:)/.exec(s);return p&&p[1]||""}function t1i(s,p){s=s||10;const i=new Array(s),r=new Array(s);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%s;if(a=(a+1)%s,a===c&&(c=(c+1)%s),m-e<p)return;const _=E&&m-E;return _?Math.round(A*1e3/_):void 0}}function i1i(s,p){let i=0,r=1e3/p,a,c;const e=(m,E=Date.now())=>{i=E,a=null,c&&(clearTimeout(c),c=null),s(...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 Gg=(s,p,i=3)=>{let r=0;const a=t1i(50,250);return i1i(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};s(b)},i)},tU=(s,p)=>{const i=s!=null;return[r=>p[0]({lengthComputable:i,total:s,loaded:r}),p[1]]},iU=s=>(...p)=>He.asap(()=>s(...p)),r1i=Da.hasStandardBrowserEnv?((s,p)=>i=>(i=new URL(i,Da.origin),s.protocol===i.protocol&&s.host===i.host&&(p||s.port===i.port)))(new URL(Da.origin),Da.navigator&&/(msie|trident)/i.test(Da.navigator.userAgent)):()=>!0,n1i=Da.hasStandardBrowserEnv?{write(s,p,i,r,a,c,e){if(typeof document>"u")return;const f=[`${s}=${encodeURIComponent(p)}`];He.isNumber(i)&&f.push(`expires=${new Date(i).toUTCString()}`),He.isString(r)&&f.push(`path=${r}`),He.isString(a)&&f.push(`domain=${a}`),c===!0&&f.push("secure"),He.isString(e)&&f.push(`SameSite=${e}`),document.cookie=f.join("; ")},read(s){if(typeof document>"u")return null;const p=document.cookie.match(new RegExp("(?:^|; )"+s+"=([^;]*)"));return p?decodeURIComponent(p[1]):null},remove(s){this.write(s,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function a1i(s){return typeof s!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s)}function s1i(s,p){return p?s.replace(/\/?\/$/,"")+"/"+p.replace(/^\/+/,""):s}function QBe(s,p,i){let r=!a1i(p);return s&&(r||i==!1)?s1i(s,p):p}const rU=s=>s instanceof so?{...s}:s;function Cf(s,p){p=p||{};const i={};function r(m,E,b,A){return He.isPlainObject(m)&&He.isPlainObject(E)?He.merge.call({caseless:A},m,E):He.isPlainObject(E)?He.merge({},E):He.isArray(E)?E.slice():E}function a(m,E,b,A){if(He.isUndefined(E)){if(!He.isUndefined(m))return r(void 0,m,b,A)}else return r(m,E,b,A)}function c(m,E){if(!He.isUndefined(E))return r(void 0,E)}function e(m,E){if(He.isUndefined(E)){if(!He.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 s)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(rU(m),rU(E),b,!0)};return He.forEach(Object.keys({...s,...p}),function(E){if(E==="__proto__"||E==="constructor"||E==="prototype")return;const b=He.hasOwnProp(h,E)?h[E]:a,A=b(s[E],p[E],E);He.isUndefined(A)&&b!==f||(i[E]=A)}),i}const XBe=s=>{const p=Cf({},s);let{data:i,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:c,headers:e,auth:f}=p;if(p.headers=e=so.from(e),p.url=WBe(QBe(p.baseURL,p.url,p.allowAbsoluteUrls),s.params,s.paramsSerializer),f&&e.set("Authorization","Basic "+btoa((f.username||"")+":"+(f.password?unescape(encodeURIComponent(f.password)):""))),He.isFormData(i)){if(Da.hasStandardBrowserEnv||Da.hasStandardBrowserWebWorkerEnv)e.setContentType(void 0);else if(He.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(Da.hasStandardBrowserEnv&&(r&&He.isFunction(r)&&(r=r(p)),r||r!==!1&&r1i(p.url))){const h=a&&c&&n1i.read(c);h&&e.set(a,h)}return p},l1i=typeof XMLHttpRequest<"u",o1i=l1i&&function(s){return new Promise(function(i,r){const a=XBe(s);let c=a.data;const e=so.from(a.headers).normalize();let{responseType:f,onUploadProgress:h,onDownloadProgress:m}=a,E,b,A,_,P;function V(){_&&_(),P&&P(),a.cancelToken&&a.cancelToken.unsubscribe(E),a.signal&&a.signal.removeEventListener("abort",E)}let M=new XMLHttpRequest;M.open(a.method.toUpperCase(),a.url,!0),M.timeout=a.timeout;function G(){if(!M)return;const q=so.from("getAllResponseHeaders"in M&&M.getAllResponseHeaders()),Y={data:!f||f==="text"||f==="json"?M.responseText:M.response,status:M.status,statusText:M.statusText,headers:q,config:s,request:M};JBe(function(te){i(te),V()},function(te){r(te),V()},Y),M=null}"onloadend"in M?M.onloadend=G:M.onreadystatechange=function(){!M||M.readyState!==4||M.status===0&&!(M.responseURL&&M.responseURL.indexOf("file:")===0)||setTimeout(G)},M.onabort=function(){M&&(r(new ar("Request aborted",ar.ECONNABORTED,s,M)),M=null)},M.onerror=function(ne){const Y=ne&&ne.message?ne.message:"Network Error",ae=new ar(Y,ar.ERR_NETWORK,s,M);ae.event=ne||null,r(ae),M=null},M.ontimeout=function(){let ne=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const Y=a.transitional||d$;a.timeoutErrorMessage&&(ne=a.timeoutErrorMessage),r(new ar(ne,Y.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,s,M)),M=null},c===void 0&&e.setContentType(null),"setRequestHeader"in M&&He.forEach(e.toJSON(),function(ne,Y){M.setRequestHeader(Y,ne)}),He.isUndefined(a.withCredentials)||(M.withCredentials=!!a.withCredentials),f&&f!=="json"&&(M.responseType=a.responseType),m&&([A,P]=Gg(m,!0),M.addEventListener("progress",A)),h&&M.upload&&([b,_]=Gg(h),M.upload.addEventListener("progress",b),M.upload.addEventListener("loadend",_)),(a.cancelToken||a.signal)&&(E=q=>{M&&(r(!q||q.type?new OE(null,s,M):q),M.abort(),M=null)},a.cancelToken&&a.cancelToken.subscribe(E),a.signal&&(a.signal.aborted?E():a.signal.addEventListener("abort",E)));const k=e1i(a.url);if(k&&Da.protocols.indexOf(k)===-1){r(new ar("Unsupported protocol "+k+":",ar.ERR_BAD_REQUEST,s));return}M.send(c||null)})},d1i=(s,p)=>{const{length:i}=s=s?s.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 ar?E:new OE(E instanceof Error?E.message:E))}};let e=p&&setTimeout(()=>{e=null,c(new ar(`timeout of ${p}ms exceeded`,ar.ETIMEDOUT))},p);const f=()=>{s&&(e&&clearTimeout(e),e=null,s.forEach(m=>{m.unsubscribe?m.unsubscribe(c):m.removeEventListener("abort",c)}),s=null)};s.forEach(m=>m.addEventListener("abort",c));const{signal:h}=r;return h.unsubscribe=()=>He.asap(f),h}},u1i=d1i,p1i=function*(s,p){let i=s.byteLength;if(!p||i<p){yield s;return}let r=0,a;for(;r<i;)a=r+p,yield s.slice(r,a),r=a},c1i=async function*(s,p){for await(const i of f1i(s))yield*p1i(i,p)},f1i=async function*(s){if(s[Symbol.asyncIterator]){yield*s;return}const p=s.getReader();try{for(;;){const{done:i,value:r}=await p.read();if(i)break;yield r}}finally{await p.cancel()}},nU=(s,p,i,r)=>{const a=c1i(s,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})},aU=64*1024,{isFunction:ag}=He,y1i=(({Request:s,Response:p})=>({Request:s,Response:p}))(He.global),{ReadableStream:sU,TextEncoder:lU}=He.global,oU=(s,...p)=>{try{return!!s(...p)}catch{return!1}},h1i=s=>{s=He.merge.call({skipUndefined:!0},y1i,s);const{fetch:p,Request:i,Response:r}=s,a=p?ag(p):typeof fetch=="function",c=ag(i),e=ag(r);if(!a)return!1;const f=a&&ag(sU),h=a&&(typeof lU=="function"?(P=>V=>P.encode(V))(new lU):async P=>new Uint8Array(await new i(P).arrayBuffer())),m=c&&f&&oU(()=>{let P=!1;const V=new i(Da.origin,{body:new sU,method:"POST",get duplex(){return P=!0,"half"}}).headers.has("Content-Type");return P&&!V}),E=e&&f&&oU(()=>He.isReadableStream(new r("").body)),b={stream:E&&(P=>P.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(P=>{!b[P]&&(b[P]=(V,M)=>{let G=V&&V[P];if(G)return G.call(V);throw new ar(`Response type '${P}' is not supported`,ar.ERR_NOT_SUPPORT,M)})});const A=async P=>{if(P==null)return 0;if(He.isBlob(P))return P.size;if(He.isSpecCompliantForm(P))return(await new i(Da.origin,{method:"POST",body:P}).arrayBuffer()).byteLength;if(He.isArrayBufferView(P)||He.isArrayBuffer(P))return P.byteLength;if(He.isURLSearchParams(P)&&(P=P+""),He.isString(P))return(await h(P)).byteLength},_=async(P,V)=>{const M=He.toFiniteNumber(P.getContentLength());return M??A(V)};return async P=>{let{url:V,method:M,data:G,signal:k,cancelToken:q,timeout:ne,onDownloadProgress:Y,onUploadProgress:ae,responseType:te,headers:le,withCredentials:de="same-origin",fetchOptions:z}=XBe(P),Q=p||fetch;te=te?(te+"").toLowerCase():"text";let ue=u1i([k,q&&q.toAbortSignal()],ne),pe=null;const ye=ue&&ue.unsubscribe&&(()=>{ue.unsubscribe()});let he;try{if(ae&&m&&M!=="get"&&M!=="head"&&(he=await _(le,G))!==0){let Se=new i(V,{method:"POST",body:G,duplex:"half"}),Ke;if(He.isFormData(G)&&(Ke=Se.headers.get("content-type"))&&le.setContentType(Ke),Se.body){const[Xe,Tt]=tU(he,Gg(iU(ae)));G=nU(Se.body,aU,Xe,Tt)}}He.isString(de)||(de=de?"include":"omit");const ge=c&&"credentials"in i.prototype,Re={...z,signal:ue,method:M.toUpperCase(),headers:le.normalize().toJSON(),body:G,duplex:"half",credentials:ge?de:void 0};pe=c&&new i(V,Re);let $e=await(c?Q(pe,z):Q(V,Re));const Be=E&&(te==="stream"||te==="response");if(E&&(Y||Be&&ye)){const Se={};["status","statusText","headers"].forEach(pt=>{Se[pt]=$e[pt]});const Ke=He.toFiniteNumber($e.headers.get("content-length")),[Xe,Tt]=Y&&tU(Ke,Gg(iU(Y),!0))||[];$e=new r(nU($e.body,aU,Xe,()=>{Tt&&Tt(),ye&&ye()}),Se)}te=te||"text";let ke=await b[He.findKey(b,te)||"text"]($e,P);return!Be&&ye&&ye(),await new Promise((Se,Ke)=>{JBe(Se,Ke,{data:ke,headers:so.from($e.headers),status:$e.status,statusText:$e.statusText,config:P,request:pe})})}catch(ge){throw ye&&ye(),ge&&ge.name==="TypeError"&&/Load failed|fetch/i.test(ge.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,P,pe,ge&&ge.response),{cause:ge.cause||ge}):ar.from(ge,ge&&ge.code,P,pe,ge&&ge.response)}}},m1i=new Map,e2e=s=>{let p=s&&s.env||{};const{fetch:i,Request:r,Response:a}=p,c=[r,a,i];let e=c.length,f=e,h,m,E=m1i;for(;f--;)h=c[f],m=E.get(h),m===void 0&&E.set(h,m=f?new Map:h1i(p)),E=m;return m};e2e();const f$={http:VRi,xhr:o1i,fetch:{get:e2e}};He.forEach(f$,(s,p)=>{if(s){try{Object.defineProperty(s,"name",{value:p})}catch{}Object.defineProperty(s,"adapterName",{value:p})}});const dU=s=>`- ${s}`,T1i=s=>He.isFunction(s)||s===null||s===!1;function v1i(s,p){s=He.isArray(s)?s:[s];const{length:i}=s;let r,a;const c={};for(let e=0;e<i;e++){r=s[e];let f;if(a=r,!T1i(r)&&(a=f$[(f=String(r)).toLowerCase()],a===void 0))throw new ar(`Unknown adapter '${f}'`);if(a&&(He.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(dU).join(`
|
|
53
53
|
`):" "+dU(e[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+f,"ERR_NOT_SUPPORT")}return a}const t2e={getAdapter:v1i,adapters:f$};function s_(s){if(s.cancelToken&&s.cancelToken.throwIfRequested(),s.signal&&s.signal.aborted)throw new OE(null,s)}function uU(s){return s_(s),s.headers=so.from(s.headers),s.data=a_.call(s,s.transformRequest),["post","put","patch"].indexOf(s.method)!==-1&&s.headers.setContentType("application/x-www-form-urlencoded",!1),t2e.getAdapter(s.adapter||c$.adapter,s)(s).then(function(r){return s_(s),r.data=a_.call(s,s.transformResponse,r),r.headers=so.from(r.headers),r},function(r){return YBe(r)||(s_(s),r&&r.response&&(r.response.data=a_.call(s,s.transformResponse,r.response),r.response.headers=so.from(r.response.headers))),Promise.reject(r)})}const i2e="1.13.6",_1={};["object","boolean","number","function","string","symbol"].forEach((s,p)=>{_1[s]=function(r){return typeof r===s||"a"+(p<1?"n ":" ")+s}});const pU={};_1.transitional=function(p,i,r){function a(c,e){return"[Axios v"+i2e+"] Transitional option '"+c+"'"+e+(r?". "+r:"")}return(c,e,f)=>{if(p===!1)throw new ar(a(e," has been removed"+(i?" in "+i:"")),ar.ERR_DEPRECATED);return i&&!pU[e]&&(pU[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}};_1.spelling=function(p){return(i,r)=>(console.warn(`${r} is likely a misspelling of ${p}`),!0)};function E1i(s,p,i){if(typeof s!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const r=Object.keys(s);let a=r.length;for(;a-- >0;){const c=r[a],e=p[c];if(e){const f=s[c],h=f===void 0||e(f,c,s);if(h!==!0)throw new ar("option "+c+" must be "+h,ar.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new ar("Unknown option "+c,ar.ERR_BAD_OPTION)}}const mg={assertOptions:E1i,validators:_1},ml=mg.validators;class kg{constructor(p){this.defaults=p||{},this.interceptors={request:new Xj,response:new Xj}}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=Cf(this.defaults,i);const{transitional:r,paramsSerializer:a,headers:c}=i;r!==void 0&&mg.assertOptions(r,{silentJSONParsing:ml.transitional(ml.boolean),forcedJSONParsing:ml.transitional(ml.boolean),clarifyTimeoutError:ml.transitional(ml.boolean),legacyInterceptorReqResOrdering:ml.transitional(ml.boolean)},!1),a!=null&&(He.isFunction(a)?i.paramsSerializer={serialize:a}:mg.assertOptions(a,{encode:ml.function,serialize:ml.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),mg.assertOptions(i,{baseUrl:ml.spelling("baseURL"),withXsrfToken:ml.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=c&&He.merge(c.common,c[i.method]);c&&He.forEach(["delete","get","head","post","put","patch","common"],P=>{delete c[P]}),i.headers=so.concat(e,c);const f=[];let h=!0;this.interceptors.request.forEach(function(V){if(typeof V.runWhen=="function"&&V.runWhen(i)===!1)return;h=h&&V.synchronous;const M=i.transitional||d$;M&&M.legacyInterceptorReqResOrdering?f.unshift(V.fulfilled,V.rejected):f.push(V.fulfilled,V.rejected)});const m=[];this.interceptors.response.forEach(function(V){m.push(V.fulfilled,V.rejected)});let E,b=0,A;if(!h){const P=[uU.bind(this),void 0];for(P.unshift(...f),P.push(...m),A=P.length,E=Promise.resolve(i);b<A;)E=E.then(P[b++],P[b++]);return E}A=f.length;let _=i;for(;b<A;){const P=f[b++],V=f[b++];try{_=P(_)}catch(M){V.call(this,M);break}}try{E=uU.call(this,_)}catch(P){return Promise.reject(P)}for(b=0,A=m.length;b<A;)E=E.then(m[b++],m[b++]);return E}getUri(p){p=Cf(this.defaults,p);const i=QBe(p.baseURL,p.url,p.allowAbsoluteUrls);return WBe(i,p.params,p.paramsSerializer)}}He.forEach(["delete","get","head","options"],function(p){kg.prototype[p]=function(i,r){return this.request(Cf(r||{},{method:p,url:i,data:(r||{}).data}))}});He.forEach(["post","put","patch"],function(p){function i(r){return function(c,e,f){return this.request(Cf(f||{},{method:p,headers:r?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}kg.prototype[p]=i(),kg.prototype[p+"Form"]=i(!0)});const Tg=kg;class y${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 OE(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 y$(function(a){p=a}),cancel:p}}}const b1i=y$;function A1i(s){return function(i){return s.apply(null,i)}}function g1i(s){return He.isObject(s)&&s.isAxiosError===!0}const H_={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(H_).forEach(([s,p])=>{H_[p]=s});const I1i=H_;function r2e(s){const p=new Tg(s),i=GBe(Tg.prototype.request,p);return He.extend(i,Tg.prototype,p,{allOwnKeys:!0}),He.extend(i,p,null,{allOwnKeys:!0}),i.create=function(a){return r2e(Cf(s,a))},i}const Kn=r2e(c$);Kn.Axios=Tg;Kn.CanceledError=OE;Kn.CancelToken=b1i;Kn.isCancel=YBe;Kn.VERSION=i2e;Kn.toFormData=C1;Kn.AxiosError=ar;Kn.Cancel=Kn.CanceledError;Kn.all=function(p){return Promise.all(p)};Kn.spread=A1i;Kn.isAxiosError=g1i;Kn.mergeConfig=Cf;Kn.AxiosHeaders=so;Kn.formToJSON=s=>zBe(He.isHTMLForm(s)?new FormData(s):s);Kn.getAdapter=t2e.getAdapter;Kn.HttpStatusCode=I1i;Kn.default=Kn;const n2e=Kn;class a2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(En.HttpRequest);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e,f,h;try{const m=r.find(Y=>{var ae,te;return((te=(ae=Y.valueOwner)==null?void 0:ae.declaration)==null?void 0:te.id)===re.operation[En.HttpRequest].inputs.method.id}),E=((a=m==null?void 0:m.value)==null?void 0:a.value)||"",b=r.find(Y=>{var ae,te;return((te=(ae=Y.valueOwner)==null?void 0:ae.declaration)==null?void 0:te.id)===re.operation[En.HttpRequest].inputs.url.id}),A=((c=b==null?void 0:b.value)==null?void 0:c.value)||"",_=r.find(Y=>{var ae,te;return((te=(ae=Y.valueOwner)==null?void 0:ae.declaration)==null?void 0:te.id)===re.operation[En.HttpRequest].inputs.query.id}),P=((e=_==null?void 0:_.value)==null?void 0:e.value)||"",V=r.find(Y=>{var ae,te;return((te=(ae=Y.valueOwner)==null?void 0:ae.declaration)==null?void 0:te.id)===re.operation[En.HttpRequest].inputs.body.id}),M=((f=V==null?void 0:V.value)==null?void 0:f.value)||"",G=r.find(Y=>{var ae,te;return((te=(ae=Y.valueOwner)==null?void 0:ae.declaration)==null?void 0:te.id)===re.operation[En.HttpRequest].inputs.headers.id}),k=((h=G==null?void 0:G.value)==null?void 0:h.value)||"",q={method:E,url:A,params:P,headers:k,data:M};J.Logger.log("Axios request config: ",q);const ne=await n2e(q);return{value:U.Success,error:null,result:{status:ne.status,headers:ne.headers,data:ne.data}}}catch(m){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:m,result:null}}}})}}class s2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SQL,version:"1.0.0",description:"Execute SQL operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(ao.ExecuteSQL);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e;try{const f=r.find(_=>{var P,V;return((V=(P=_.valueOwner)==null?void 0:P.declaration)==null?void 0:V.id)===re.operation[ao.ExecuteSQL].inputs.connectionConfig.id}),h=((a=f==null?void 0:f.value)==null?void 0:a.value)||"",m=r.find(_=>{var P,V;return((V=(P=_.valueOwner)==null?void 0:P.declaration)==null?void 0:V.id)===re.operation[ao.ExecuteSQL].inputs.query.id}),E=((c=m==null?void 0:m.value)==null?void 0:c.value)||"",b=this.extensionsRegistry.requestContexts(this,[se.Editor])[0],A=await n2e.post(((e=b.env)==null?void 0:e.API_BASE_URL)+"/editor-runtime/v1/execute-sql",{connectionConfig:h,query:E},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${await b.getAccessToken()}`}});return{value:U.Success,error:null,result:{results:A.data.results||[]}}}catch(f){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:f,result:null}}}})}}class l2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(Ne.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)});J.Logger.log("Inputs for entity validation: ",a);const e=bD(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 Xa=s=>s.map(p=>{var i,r;return((i=p.value)==null?void 0:i.valueAsType)??((r=p.value)==null?void 0:r.value)});class o2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(Ne.ReadKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Xa(r),e=xVe(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__ENTITY_WRITE_KEY,version:"1.0.0",description:"Entity write-key operation implementation module (top-level, immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(Ne.WriteKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Xa(r),f=$Ve(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__ENTITY_DELETE_KEY,version:"1.0.0",description:"Entity delete-key operation implementation module (top-level, immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(Ne.DeleteKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Xa(r),e=LVe(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__ENTITY_READ_NESTED_KEY,version:"1.0.0",description:"Entity read-nested-key operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(Ne.ReadNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Xa(r),f=BVe(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__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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(Ne.WriteNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Xa(r),f=MVe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class f2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(Ne.WriteSafeNestedKeyRecursively);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Xa(r),f=GVe(a,c,e);return{value:U.Success,error:null,result:f}}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__ENTITY_DELETE_NESTED_KEY,version:"1.0.0",description:"Entity delete-nested-key operation implementation module (immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(Ne.DeleteNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Xa(r),e=kVe(a,c);return{value:U.Success,error:null,result:e}}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_HAS_KEY,version:"1.0.0",description:"Object has-key (top-level property present?)",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Ne.HasKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Xa(r),e=jVe(a,c);return{value:U.Success,error:null,result:e}}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_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object key-value-equals (top-level property strict equality)",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Ne.KeyValueEquals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Xa(r),f=UVe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class T2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Ne.HasNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Xa(r),e=FVe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class v2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Ne.NestedKeyValueEquals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Xa(r),f=KVe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class E2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Ne.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 P=((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),V=(m=(h=r[0])==null?void 0:h.value)==null?void 0:m.value,M=(b=(E=r[1])==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle;if(!V)throw new TypeError("IsInstanceOfType expects a non-null input value.");if(!M)throw new TypeError("IsInstanceOfType expects a valid expectedType input.");if(!P)throw new TypeError("IsInstanceOfType cannot determine the value owner.");if(M.type!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType expects expectedType to be a DefinitionEntity.");const G=P.getDataType(null);if(((A=G==null?void 0:G.entity)==null?void 0:A.type)!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType cannot determine the data type of the input value.");let k=!1;return((_=G==null?void 0:G.entity)==null?void 0:_.id)!==(M==null?void 0:M.id)?k=!1:bD(G==null?void 0:G.entity).safeParse(V).success?k=!0:k=!1,{value:U.Success,error:null,result:k}}catch(P){return{value:U.UnhandledError,error:P,result:null}}}})}}class b2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic);if(!r)return;const a=r.get(Ne.Merge);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Xa(r),c=qVe(...a);return{value:U.Success,error:null,result:c}}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__OBJECT_KEYS,version:"1.0.0",description:"Object keys operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic);if(!r)return;const a=r.get(Ne.Keys);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Xa(r),c=SVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class g2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic);if(!r)return;const a=r.get(Ne.Values);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Xa(r),c=ZVe(a);return{value:U.Success,error:null,result:c}}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__OBJECT_ENTRIES,version:"1.0.0",description:"Object entries operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic);if(!r)return;const a=r.get(Ne.Entries);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Xa(r),c=HVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}let Us=null;try{Us=require("crypto")}catch{}const ZT=typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto:Us&&Us.webcrypto?Us.webcrypto:null,gp=ZT?ZT.subtle:null;function nv(s){const p=new ArrayBuffer(s.byteLength);return new Uint8Array(p).set(s),p}function yn(s,p="utf8"){if(s instanceof Uint8Array)return s;const i=String(s);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 Uo(s,p="utf8"){if(p==="utf8"){if(typeof TextDecoder<"u")return new TextDecoder().decode(s);if(typeof Buffer<"u")return Buffer.from(s).toString("utf8")}else if(p==="hex"){if(typeof Buffer<"u")return Buffer.from(s).toString("hex")}else if(p==="base64"){if(typeof Buffer<"u")return Buffer.from(s).toString("base64")}else if(p==="base64url"&&typeof Buffer<"u")return Buffer.from(s).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");throw new Error(`Unsupported environment/encoding combo for fromBytes(${p})`)}const R2e=s=>yn(s,"base64"),D2e=(s,p)=>{const i=s instanceof Uint8Array?s:yn(String(s),p||"utf8");return Uo(i,"base64")},_h=(s,p)=>{const i=s instanceof Uint8Array?s:yn(String(s),p||"utf8");return Uo(i,"base64url")},Of=s=>yn(s,"base64url"),w2e=(s,p)=>{const i=s instanceof Uint8Array?s:yn(String(s),p||"utf8");return Uo(i,"hex")},C2e=s=>yn(s,"hex");function h$(s){if(ZT&&ZT.getRandomValues){const p=new Uint8Array(s);return ZT.getRandomValues(p),p}if(Us&&Us.randomBytes)return new Uint8Array(Us.randomBytes(s));throw new Error("Secure random not available")}function V1(s,p){if(!(s instanceof Uint8Array)||!(p instanceof Uint8Array)||s.length!==p.length)return!1;let i=0;for(let r=0;r<s.length;r++)i|=s[r]^p[r];return i===0}function O2e(s,p,i,r){if((typeof s!="string"||typeof p!="string")&&typeof s!="string"&&typeof p!="string")throw new Error("Invalid input types");const a=i??"utf8",c=r??"utf8",e=yn(s??"",a),f=yn(p??"",c);return V1(e,f)}async function _2e(s,p){if(gp){const i=await gp.digest({name:s},nv(p));return new Uint8Array(i)}if(Us){const i=s.replace("SHA-","sha"),r=Us.createHash(i);return r.update(Buffer.from(p)),new Uint8Array(r.digest())}throw new Error("Hash not available")}async function V2e(s,p,i,r){if(typeof p!="string")throw new Error("Invalid input type for data; expected string");const a=String(s??"SHA-256"),c=i??"utf8",e=r??"base64url",f=yn(p??"",c),h=await _2e(a,f);return Uo(h,e)}async function P1(s,p,i){if(gp){const r=await gp.importKey("raw",nv(p),{name:"HMAC",hash:{name:s}},!1,["sign"]),a=await gp.sign("HMAC",r,nv(i));return new Uint8Array(a)}if(Us){const r=`sha${s.split("-")[1]}`,a=Us.createHmac(r,Buffer.from(p));return a.update(Buffer.from(i)),new Uint8Array(a.digest())}throw new Error("HMAC not available")}async function P2e(s,p,i,r,a,c){if(typeof s!="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=yn(s??"",f),b=yn(p??"",h),A=await P1(e,E,b);return Uo(A,m)}async function N1(s,p,{iterations:i,length:r,hashAlg:a="SHA-256"}){if(gp){const c=await gp.importKey("raw",nv(s),"PBKDF2",!1,["deriveBits"]),e=await gp.deriveBits({name:"PBKDF2",salt:nv(p),iterations:i,hash:a},c,r*8);return new Uint8Array(e)}if(Us){const c=a==="SHA-512"?"sha512":"sha256";return await new Promise((e,f)=>{Us.pbkdf2(Buffer.from(s),Buffer.from(p),i,r,c,(h,m)=>{h?f(h):e(new Uint8Array(m))})})}throw new Error("PBKDF2 not available")}async function N2e(s,p,i,r,a,c,e,f){if(typeof s!="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",P=yn(s??"",h),V=yn(p??"",m),M=await N1(P,V,{iterations:b,length:A,hashAlg:_});return Uo(M,E)}async function x2e(s,p=h$(16),i=21e4,r=32,a="SHA-256"){const c=yn(s,"utf8"),e=await N1(c,p,{iterations:i,length:r,hashAlg:a}),f=_h(p),h=_h(e);return`pbkdf2$${a.toLowerCase()}$${i}$${f}$${h}`}async function $2e(s,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=Of(i[3]),e=Of(i[4]),f=r.includes("512")?"SHA-512":"SHA-256",h=await N1(yn(s,"utf8"),c,{iterations:a,length:e.length,hashAlg:f});return V1(h,e)}async function L2e(s,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?yn(a,m):void 0;return await x2e(String(s??""),E,e,f,h)}function cU(s){return _h(yn(JSON.stringify(s),"utf8"))}function jg(s){try{return JSON.parse(Uo(Of(s),"utf8"))}catch{return null}}async function B2e(s,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),_={...s||{}};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 P=cU(b),V=cU(_),M=yn(`${P}.${V}`,"utf8"),k=await P1(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,M),q=_h(k);return`${P}.${V}.${q}`}async function M2e(s,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(s!=null&&typeof s!="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 _=yn(p??"",b??"utf8");return await B2e(s??{},_,{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 G2e(s,p,{alg:i="HS256",issuer:r,audience:a,maxAgeSeconds:c,clockSkewSeconds:e=60}={}){try{const[f,h,m]=String(s).split(".");if(!f||!h||!m)return{valid:!1,header:null,payload:null,reason:"Malformed"};const E=jg(f),b=jg(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=yn(`${f}.${h}`,"utf8"),P=await P1(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,A),V=Of(m);if(!V1(P,V))return{valid:!1,header:E,payload:b,reason:"Bad signature"};const M=Math.floor(Date.now()/1e3),G=Math.max(0,Number(e)||0);if(b.nbf!=null&&M+G<Number(b.nbf))return{valid:!1,header:E,payload:b,reason:"Not before"};if(b.exp!=null&&M-G>=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 k=b.aud;if(!(Array.isArray(k)?k.includes(a):k===a))return{valid:!1,header:E,payload:b,reason:"Audience mismatch"}}return c!=null&&b.iat!=null&&M-Number(b.iat)>Number(c)+G?{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 k2e(s,p,i,r,a,c,e,f){if(typeof s!="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=yn(p??"",f??"utf8");return await G2e(String(s??""),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 j2e(s){const[p,i,r]=String(s).split(".");return{header:p?jg(p):null,payload:i?jg(i):null,signature:r?Of(r):new Uint8Array}}function U2e(s,p){if(!s)throw new Error("Token is required for decoding");if(typeof s!="string")throw new Error("Invalid input type for token; expected string");const i=p??"base64url",{header:r,payload:a,signature:c}=j2e(String(s??"")),e=Uo(c,i);return{header:r,payload:a,signature:e}}class F2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(tt.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=h$(e),m=Uo(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 K2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.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=hVe(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 q2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.GenerateRandomFloat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=T1();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_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.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=Sx(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 Z2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.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=Zx(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 H2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.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=TVe(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 W2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.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=Hx(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 z2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.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=Wx(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 Y2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.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 J2e 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:[se.Logic]});R(this,"module",{init:i=>{J.Logger.log("Initializing Random Generate Short Identifier Module");const r=i.find(a=>a.contextType===se.Logic);if(r){J.Logger.log("Project state found, setting up operation");const a=r.get(tt.GenerateShortIdentifier);a?(J.Logger.log("Operation found, setting autoexecutable and implementation"),a.autoexecutable=!0,a.implementation=this.module.main):J.Logger.warn("Operation generate-short-identifier not found in project state")}else J.Logger.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,r)=>{try{const a=vVe();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_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.GenerateHexadecimalToken);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=EVe();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 R1i(s){let p;if(s===null?p="null":Array.isArray(s)?p="array":p=typeof s,!["string","number","boolean","null","object","array"].includes(p))throw new TypeError("GetTypeOf cannot determine type of the given value.");return p}class X2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.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:R1i(c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class eMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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 tMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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 iMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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=yn(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 rMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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=Uo(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 nMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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:D2e(a,c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class aMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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=R2e(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 sMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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=_h(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 lMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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=Of(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 oMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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=w2e(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 dMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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=C2e(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 uMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Li.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:V2e(a,c,e,f)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class pMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Li.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:P2e(c,e,a,f,h,m)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class cMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Li.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:O2e(a,c,e,f)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class fMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Li.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 _,P;return((_=A.value)==null?void 0:_.valueAsType)??((P=A.value)==null?void 0:P.value)});return{value:U.Success,error:null,result: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 yMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(bn.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 hMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(bn.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 mMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(hr.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,_,P,V]=r.map(M=>{var G,k;return((G=M.value)==null?void 0:G.valueAsType)??((k=M.value)==null?void 0:k.value)});return{value:U.Success,error:null,result:await M2e(a,c,e,f,h,m,E,b,A,_,P,V)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class TMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(hr.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 _,P;return((_=A.value)==null?void 0:_.valueAsType)??((P=A.value)==null?void 0:P.value)});return{value:U.Success,error:null,result:await k2e(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 vMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(hr.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:U2e(a,c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class EMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(An.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 L2e(a,c,e,f,h,m)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class bMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(An.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 $2e(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 W_ extends I1{constructor(p,i,r=i.projectId){super(p,se.Editor),this._editor=i,this.id=r}get ready(){return this._editor.ready}get env(){return this._editor.env}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 branchHead(){return this._editor.branchHead}get branchHeadPromise(){return this._editor.branchHeadPromise}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 activeWorkspace(){return this._editor.activeWorkspace}get branches(){return this._editor.branches}get roles(){return this._editor.roles}get READ_ONLY(){return this._editor.READ_ONLY}get isViewingNonHead(){return this._editor.isViewingNonHead}get canEdit(){return this._editor.canEdit}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)}getProjectRoles(){return this._editor.getProjectRoles()}getLastPublishedVersionLogic(p){return this._editor.getLastPublishedVersionLogic(p)}initialLoads(p){return this._editor.initialLoads(p)}moveBranchHeadToVersion(p,i,r){return this._editor.moveBranchHeadToVersion(p,i,r)}loadInitialBranchHead(){return this._editor.loadInitialBranchHead()}}function D1i(s,p){return p instanceof W_?p:new W_(s,p)}class z_ extends I1{constructor(p,i){super(p,se.PublicationRun),this._publicationRun=i}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get envIdentifier(){return this._publicationRun.envIdentifier}get projectVersion(){return this._publicationRun.projectVersion}get projectBranchId(){return this._publicationRun.projectBranchId}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 w1i(s,p){return p instanceof z_?p:new z_(s,p)}function C1i(s){s.register(new mPe(s)),s.register(new hPe(s)),s.register(new pPe(s)),s.register(new fPe(s)),s.register(new yPe(s)),s.register(new cPe(s)),s.register(new JLe(s)),s.register(new QLe(s)),s.register(new XLe(s)),s.register(new tBe(s)),s.register(new eBe(s)),s.register(new iBe(s)),s.register(new K2e(s)),s.register(new q2e(s)),s.register(new S2e(s)),s.register(new Z2e(s)),s.register(new H2e(s)),s.register(new W2e(s)),s.register(new z2e(s)),s.register(new Y2e(s)),s.register(new J2e(s)),s.register(new Q2e(s)),s.register(new Y$e(s)),s.register(new J$e(s)),s.register(new Q$e(s)),s.register(new X$e(s)),s.register(new eLe(s)),s.register(new tLe(s)),s.register(new iLe(s)),s.register(new rLe(s)),s.register(new nLe(s)),s.register(new aLe(s)),s.register(new sLe(s)),s.register(new lLe(s)),s.register(new oLe(s)),s.register(new dLe(s)),s.register(new uLe(s)),s.register(new pLe(s)),s.register(new cLe(s)),s.register(new fLe(s)),s.register(new yLe(s)),s.register(new TLe(s)),s.register(new vLe(s)),s.register(new ELe(s)),s.register(new m$e(s)),s.register(new T$e(s)),s.register(new v$e(s)),s.register(new E$e(s)),s.register(new b$e(s)),s.register(new A$e(s)),s.register(new g$e(s)),s.register(new I$e(s)),s.register(new R$e(s)),s.register(new w$e(s)),s.register(new C$e(s)),s.register(new O$e(s)),s.register(new _$e(s)),s.register(new V$e(s)),s.register(new Lxe(s)),s.register(new l2e(s)),s.register(new a2e(s)),s.register(new s2e(s)),s.register(new $Ne(s)),s.register(new LNe(s)),s.register(new BNe(s)),s.register(new MNe(s)),s.register(new GNe(s)),s.register(new kNe(s)),s.register(new jNe(s)),s.register(new UNe(s)),s.register(new FNe(s)),s.register(new txe(s)),s.register(new Nxe(s)),s.register(new xxe(s)),s.register(new $xe(s)),s.register(new KNe(s)),s.register(new qNe(s)),s.register(new SNe(s)),s.register(new ZNe(s)),s.register(new HNe(s)),s.register(new WNe(s)),s.register(new zNe(s)),s.register(new YNe(s)),s.register(new JNe(s)),s.register(new QNe(s)),s.register(new XNe(s)),s.register(new exe(s)),s.register(new ixe(s)),s.register(new rxe(s)),s.register(new nxe(s)),s.register(new axe(s)),s.register(new sxe(s)),s.register(new lxe(s)),s.register(new oxe(s)),s.register(new dxe(s)),s.register(new uxe(s)),s.register(new pxe(s)),s.register(new cxe(s)),s.register(new fxe(s)),s.register(new gxe(s)),s.register(new Ixe(s)),s.register(new Rxe(s)),s.register(new yxe(s)),s.register(new hxe(s)),s.register(new mxe(s)),s.register(new Txe(s)),s.register(new vxe(s)),s.register(new Exe(s)),s.register(new bxe(s)),s.register(new Axe(s)),s.register(new p2e(s)),s.register(new c2e(s)),s.register(new f2e(s)),s.register(new y2e(s)),s.register(new o2e(s)),s.register(new d2e(s)),s.register(new u2e(s)),s.register(new h2e(s)),s.register(new T2e(s)),s.register(new E2e(s)),s.register(new m2e(s)),s.register(new v2e(s)),s.register(new b2e(s)),s.register(new I2e(s)),s.register(new A2e(s)),s.register(new g2e(s)),s.register(new P$e(s)),s.register(new L$e(s)),s.register(new B$e(s)),s.register(new k$e(s)),s.register(new j$e(s)),s.register(new U$e(s)),s.register(new F$e(s)),s.register(new K$e(s)),s.register(new q$e(s)),s.register(new S$e(s)),s.register(new Z$e(s)),s.register(new M$e(s)),s.register(new G$e(s)),s.register(new x$e(s)),s.register(new $$e(s)),s.register(new N$e(s)),s.register(new D$e(s)),s.register(new W$e(s)),s.register(new z$e(s)),s.register(new H$e(s)),s.register(new nBe(s)),s.register(new OBe(s)),s.register(new CBe(s)),s.register(new _Be(s)),s.register(new VBe(s)),s.register(new lBe(s)),s.register(new oBe(s)),s.register(new yBe(s)),s.register(new cBe(s)),s.register(new DBe(s)),s.register(new EBe(s)),s.register(new ABe(s)),s.register(new IBe(s)),s.register(new gBe(s)),s.register(new fBe(s)),s.register(new mBe(s)),s.register(new TBe(s)),s.register(new hBe(s)),s.register(new rBe(s)),s.register(new dBe(s)),s.register(new bBe(s)),s.register(new xBe(s)),s.register(new K_(s)),s.register(new sBe(s)),s.register(new uBe(s)),s.register(new aBe(s)),s.register(new RBe(s)),s.register(new pBe(s)),s.register(new vBe(s)),s.register(new wBe(s)),s.register(new NBe(s)),s.register(new PBe(s)),s.register(new $Be(s)),s.register(new K_(s)),s.register(new BBe(s)),s.register(new LBe(s)),s.register(new MBe(s)),s.register(new $Le(s)),s.register(new LLe(s)),s.register(new BLe(s)),s.register(new ALe(s)),s.register(new mLe(s)),s.register(new DLe(s)),s.register(new _Le(s)),s.register(new hLe(s)),s.register(new VLe(s)),s.register(new xLe(s)),s.register(new CLe(s)),s.register(new wLe(s)),s.register(new Mg(s)),s.register(new MLe(s)),s.register(new GLe(s)),s.register(new OLe(s)),s.register(new NLe(s)),s.register(new PLe(s)),s.register(new RLe(s)),s.register(new ILe(s)),s.register(new gLe(s)),s.register(new bLe(s)),s.register(new ULe(s)),s.register(new jLe(s)),s.register(new FLe(s)),s.register(new kLe(s)),s.register(new Oxe(s)),s.register(new Dxe(s)),s.register(new Cxe(s)),s.register(new _xe(s)),s.register(new Vxe(s)),s.register(new wxe(s)),s.register(new Pxe(s)),s.register(new X2e(s)),s.register(new aMe(s)),s.register(new lMe(s)),s.register(new dMe(s)),s.register(new nMe(s)),s.register(new sMe(s)),s.register(new oMe(s)),s.register(new rMe(s)),s.register(new iMe(s)),s.register(new tMe(s)),s.register(new eMe(s)),s.register(new yMe(s)),s.register(new hMe(s)),s.register(new cMe(s)),s.register(new fMe(s)),s.register(new F2e(s)),s.register(new uMe(s)),s.register(new pMe(s)),s.register(new TMe(s)),s.register(new mMe(s)),s.register(new vMe(s)),s.register(new EMe(s)),s.register(new bMe(s)),s.register(new vPe(s)),s.register(new EPe(s)),s.register(new Lg(s)),s.register(new Bg(s))}class m${constructor(p=new J.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(){C1i(this),J.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case se.Editor:return this.onResolveEditorContextCallback();case se.Logic:return this.onResolveProjectLogicContextCallback();case se.EditorGUI:return this.onResolveEditorGUIContextCallback();case se.Compile:return this.onResolveCompileContextCallback();case se.PublicationRun:return this.onResolvePublicationRunContextCallback();case se.GUI:return this.onResolveGUIContextCallback();case se.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(){J.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder)if(p.module.init&&!this.initialized.has(p.manifest.id)){J.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)):J.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)?(J.Logger.log("Set "+p.manifest.id+" extension as initialized by default..."),this.initialized.add(p.manifest.id)):J.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)){J.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case se.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case se.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}J.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 sg=null;const T$={requestExtension:s=>(sg||(sg=new m$,sg.setup()),sg.requestExtension(s))};function O1i(s){return!(s instanceof Error)&&typeof s=="object"&&s!==null?s:s instanceof Error?{name:s.name,message:s.message,stack:s.stack,...s}:s}const lp={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var v$=(s=>(s.FinishedSuccess="finished-success",s.FinishedError="finished-error",s.Running="running",s.Paused="paused",s.Stopped="stopped",s.NotStarted="not-started",s))(v$||{});const AMe={...T$,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class yh extends J.Events{constructor(i,r,a,c=null,e=AMe){super();R(this,"project");R(this,"entryPoint");R(this,"state","not-started");R(this,"events",new J.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 $T(x.UUID.uuid(),this.project),this.resolvedValues=new $T(x.UUID.uuid(),this.project),this.persistedExecutionResults=new $T(x.UUID.uuid(),this.project),this.lastExecutionResults=new $T(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),tr.includes(i.type)&&ft(i).forEach(r=>this.skip(r))))}async schedule(i,r,a){if(this.hasExecuted(i))return null;if(Ft.includes(i.type))return this.executeBranch(i,a,r);if(sr.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[...Ot,...Ft].includes(r.type)?a.push(...r.inputs):Dt.includes(r.type)&&a.push(...r.outputs),a.map(e=>{var h;let f=i.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&Ft.includes(r.type)&&(f=i.find(m=>{var E;return((E=m.valueOwner.declaration)==null?void 0:E.id)===e.id})),f){const m=(h=f.value)==null?void 0:h.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return Jr.includes(e.type)?to(e,this.valueResolutionContext):xp(e,this.valueResolutionContext)}).reduce((e,f)=>{const h=pd(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return h.forEach(E=>{var _,P,V;if(E.id===(f==null?void 0:f.valueOwner.id))return;const b=Wt(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(((P=f==null?void 0:f.value)==null?void 0:P.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((V=f==null?void 0:f.value)==null?void 0:V.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={...lp,...c};try{let m={value:U.Success,error:null,result:null};if(r.sort((E,b)=>E.valueOwner.index-b.valueOwner.index),Object.values(Mr).includes(i.declaration.id)){const E=this.parentContext.requestExtension(fh+i.declaration.id).module.main;E?m=await E(i,r):J.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){J.Logger.warn("Raw error executing entity: ",m.error);const b=(f=i.error)==null?void 0:f.getDataType(null),A=Wt(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){J.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=Wt(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.sort((b,A)=>b.valueOwner.index-A.valueOwner.index)));let h=null;if(f.error&&i.error){const b=O1i(f.error),A=((c=i.error)==null?void 0:c.getDataType(null))||null,_=Wt(A,i.error,a);if(A!=null&&A.asType)_==null||_.setValueAsTypeSingle(f.error);else{const P=sn(b)?JSON.stringify(b,null,2):b;_==null||_.metaSync({value:P},null)}h={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:_}}const m=i==null?void 0:i.getDataType(null),E=Wt(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){console.warn("Operation execution error: ",f);let h=null;if(i.error){const m=(e=i.error)==null?void 0:e.getDataType(null),E=Wt(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=Wt(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(J.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=Wt(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={...lp,...c};try{let _={value:U.Success,error:null,result:null};const P=r.map(ne=>{var Y,ae;return((Y=ne==null?void 0:ne.value)==null?void 0:Y.valueAsType)||((ae=ne==null?void 0:ne.value)==null?void 0:ae.value)});let V={};i.getUniqueInputMaps().forEach(ne=>{const Y=i.body.inputs.find(de=>ce(de,a)===ce(ne,a)),ae=ne==null?void 0:ne.getDataType(null),te=Wt(ae,Y,a);ae!=null&&ae.asType?te==null||te.setValueAsTypeList([]):te==null||te.metaSync({value:[]},null),this.lastExecutionResults.writeValue(Y,te);const le={value:te,valueOwner:Y,type:Me.ExecutionResult,inheritanceLink:null};V[Y.id]=le});let G={value:U.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case re.loop["counted-loop"].id:{const ne=P[0];let Y=1;for(;Y<=ne&&Y<=50;){const ae=i.body.inputs.map(te=>{if(te===i.currentIterationNumberArgumentDeclaration){const le=i.currentIterationNumberArgumentDeclaration.getDataType(null),de=Xd(le),z=this.lastExecutionResults.readValue(te.id);if(z){z.metaSync({value:Y},null),this.lastExecutionResults.writeValue(te,z);const ye={value:z,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null};return V[te.id]=ye,ye}const Q={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:Y,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:de,standaloneParent:te.toReference()},ue=lr(Q,a);this.lastExecutionResults.writeValue(te,ue);const pe={value:ue,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null};return V[te.id]=pe,pe}else return V[te.id]}).filter(te=>!!te);if(G=await this.executeFullFunctionDeclarationLogic(i.body,ae,e),(G.results||[]).forEach(te=>{var Q,ue,pe,ye;if(te.valueOwner.type!==d.InputMap||Dt.includes(te.valueOwner.parent.type))return;const le=i.body.inputs.find(he=>ce(he,a)===ce(te.valueOwner,a)),z=[...((ue=(Q=V==null?void 0:V[le.id])==null?void 0:Q.value)==null?void 0:ue.value)||[],((pe=te==null?void 0:te.value)==null?void 0:pe.value)||null];(ye=V[le.id].value)==null||ye.metaSync({value:z},null),this.lastExecutionResults.writeValue(le,V[le.id].value)}),[U.CaughtError,U.Break,U.Return].includes(G.value))break;Y++}break}case re.loop["manual-flow-loop"].id:{let ne=1;for(;ne<=50;){const Y=i.body.inputs.map(ae=>{if(ae===i.currentIterationNumberArgumentDeclaration){const te=this.lastExecutionResults.readValue(ae.id);if(te){te.metaSync({value:ne},null),this.lastExecutionResults.writeValue(ae,te);const Q={value:te,valueOwner:ae,type:Me.ExecutionResult,inheritanceLink:null};return V[ae.id]=Q,Q}const le=i.currentIterationNumberArgumentDeclaration.getDataType(null),de=Wt(le,ae,a);return de==null||de.metaSync({value:ne},null),this.lastExecutionResults.writeValue(ae,de),{value:de,valueOwner:ae,type:Me.ExecutionResult,inheritanceLink:null}}else return V[ae.id]}).filter(ae=>!!ae);if(G=await this.executeFullFunctionDeclarationLogic(i.body,Y,e),(G.results||[]).forEach(ae=>{var z,Q,ue;if(ae.valueOwner.type!==d.InputMap||Dt.includes(ae.valueOwner.parent.type))return;const te=i.body.inputs.find(pe=>ce(pe,a)===ce(ae.valueOwner,a)),de=[...(z=V[te.id].value)==null?void 0:z.value,((Q=ae.value)==null?void 0:Q.value)||null];(ue=V[te.id].value)==null||ue.metaSync({value:de},null),this.lastExecutionResults.writeValue(te,V[te.id].value)}),[U.CaughtError,U.Break,U.Return].includes(G.value))break;ne++}break}case re.loop["list-loop"].id:{const ne=P[0];let Y=1;const ae=ne;for(let te=0;te<ae.length;te++){const le=ae[te],de=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const Q=this.lastExecutionResults.readValue(z.id);if(Q)return Q.metaSync({value:Y},null),this.lastExecutionResults.writeValue(z,Q),{value:Q,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ue=i.currentIterationNumberArgumentDeclaration.getDataType(null),pe=Wt(ue,z,a);return pe==null||pe.metaSync({value:Y},null),this.lastExecutionResults.writeValue(z,pe),{value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const Q=i.currentValueArgumentDeclaration.getDataType(null),ue=Xd(Q),pe=this.lastExecutionResults.readValue(z.id);if(pe)return pe.metaSync({value:le},null),this.lastExecutionResults.writeValue(z,pe),{value:pe,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ye={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:le,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ue,standaloneParent:z.toReference()},he=lr(ye,a);return this.lastExecutionResults.writeValue(z,he),{value:he,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return V[z.id]}).filter(z=>!!z);if(G=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(G.results||[]).forEach(z=>{var ye,he,ge;if(z.valueOwner.type!==d.InputMap||Dt.includes(z.valueOwner.parent.type))return;const Q=i.body.inputs.find(Re=>ce(Re,a)===ce(z.valueOwner,a)),pe=[...(ye=V[Q.id].value)==null?void 0:ye.value,((he=z.value)==null?void 0:he.value)||null];(ge=V[Q.id].value)==null||ge.metaSync({value:pe},null),this.lastExecutionResults.writeValue(Q,V[Q.id].value)}),[U.CaughtError,U.Break,U.Return].includes(G.value))break;Y++}break}case re.loop["object-keys-loop"].id:{const ne=P[0];let Y=1;const ae=ne?Object.keys(ne):[];for(let te=0;te<ae.length;te++){const le=ae[te],de=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const Q=this.lastExecutionResults.readValue(z.id);if(Q)return Q.metaSync({value:Y},null),this.lastExecutionResults.writeValue(z,Q),{value:Q,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ue=i.currentIterationNumberArgumentDeclaration.getDataType(null),pe=Wt(ue,z,a);return pe==null||pe.metaSync({value:Y},null),this.lastExecutionResults.writeValue(z,pe),{value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const Q=i.currentValueArgumentDeclaration.getDataType(null),ue=Xd(Q),pe=this.lastExecutionResults.readValue(z.id);if(pe)return pe.metaSync({value:le},null),this.lastExecutionResults.writeValue(z,pe),{value:pe,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ye={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:le,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ue,standaloneParent:z.toReference()},he=lr(ye,a);return this.lastExecutionResults.writeValue(z,he),{value:he,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return V[z.id]}).filter(z=>!!z);if(G=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(G.results||[]).forEach(z=>{var ye,he,ge;if(z.valueOwner.type!==d.InputMap||Dt.includes(z.valueOwner.parent.type))return;const Q=i.body.inputs.find(Re=>ce(Re,a)===ce(z.valueOwner,a)),pe=[...(ye=V[Q.id].value)==null?void 0:ye.value,((he=z.value)==null?void 0:he.value)||null];(ge=V[Q.id].value)==null||ge.metaSync({value:pe},null),this.lastExecutionResults.writeValue(Q,V[Q.id].value)}),[U.CaughtError,U.Break,U.Return].includes(G.value))break;Y++}break}case re.loop["object-values-loop"].id:{const ne=P[0];let Y=1;const ae=ne?Object.values(ne):[];for(let te=0;te<ae.length;te++){const le=ae[te],de=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const Q=this.lastExecutionResults.readValue(z.id);if(Q)return Q.metaSync({value:Y},null),this.lastExecutionResults.writeValue(z,Q),{value:Q,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ue=i.currentIterationNumberArgumentDeclaration.getDataType(null),pe=Wt(ue,z,a);return pe==null||pe.metaSync({value:Y},null),this.lastExecutionResults.writeValue(z,pe),{value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const Q=i.currentValueArgumentDeclaration.getDataType(null),ue=Xd(Q),pe=this.lastExecutionResults.readValue(z.id);if(pe)return pe.metaSync({value:le},null),this.lastExecutionResults.writeValue(z,pe),{value:pe,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ye={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:le,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ue,standaloneParent:z.toReference()},he=lr(ye,a);return this.lastExecutionResults.writeValue(z,he),{value:he,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return V[z.id]}).filter(z=>!!z);if(G=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(G.results||[]).forEach(z=>{var ye,he,ge;if(z.valueOwner.type!==d.InputMap||Dt.includes(z.valueOwner.parent.type))return;const Q=i.body.inputs.find(Re=>ce(Re,a)===ce(z.valueOwner,a)),pe=[...(ye=V[Q.id].value)==null?void 0:ye.value,((he=z.value)==null?void 0:he.value)||null];(ge=V[Q.id].value)==null||ge.metaSync({value:pe},null),this.lastExecutionResults.writeValue(Q,V[Q.id].value)}),[U.CaughtError,U.Break,U.Return].includes(G.value))break;Y++}break}case re.loop["string-loop"].id:{const ne=P[0];let Y=1;const ae=ne.split("");for(let te=0;te<ae.length;te++){const le=ae[te],de=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const Q=this.lastExecutionResults.readValue(z.id);if(Q)return Q.metaSync({value:Y},null),this.lastExecutionResults.writeValue(z,Q),{value:Q,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ue=i.currentIterationNumberArgumentDeclaration.getDataType(null),pe=Wt(ue,z,a);return pe==null||pe.metaSync({value:Y},null),this.lastExecutionResults.writeValue(z,pe),{value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const Q=i.currentValueArgumentDeclaration.getDataType(null),ue=Xd(Q),pe=this.lastExecutionResults.readValue(z.id);if(pe)return pe.metaSync({value:le},null),this.lastExecutionResults.writeValue(z,pe),{value:pe,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ye={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:le,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ue,standaloneParent:z.toReference()},he=lr(ye,a);return this.lastExecutionResults.writeValue(z,he),{value:he,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return V[z.id]}).filter(z=>!!z);if(G=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(G.results||[]).forEach(z=>{var ye,he,ge;if(z.valueOwner.type!==d.InputMap||Dt.includes(z.valueOwner.parent.type))return;const Q=i.body.inputs.find(Re=>ce(Re,a)===ce(z.valueOwner,a)),pe=[...(ye=V[Q.id].value)==null?void 0:ye.value,((he=z.value)==null?void 0:he.value)||null];(ge=V[Q.id].value)==null||ge.metaSync({value:pe},null),this.lastExecutionResults.writeValue(Q,V[Q.id].value)}),[U.CaughtError,U.Break,U.Return].includes(G.value))break;Y++}break}}if(_={value:[U.CaughtError,U.Return].includes(G.value)?G.value:U.Success,error:((h=(f=G.error)==null?void 0:f.value)==null?void 0:h.value)||null,result:((E=(m=G==null?void 0:G.result)==null?void 0:m.value)==null?void 0:E.value)||null},_.error&&i.error){const ne=(b=i.error)==null?void 0:b.getDataType(null),Y=Wt(ne||null,i.error,a);ne!=null&&ne.asType?Y==null||Y.setValueAsTypeSingle(_.error):Y==null||Y.metaSync({value:_.error},null);const ae={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:Y};return{value:_.value,entity:i,error:ae,result:null}}const k=i==null?void 0:i.getDataType(null),q=Wt(k,i,a);return k!=null&&k.asType?q==null||q.setValueAsTypeSingle(_.result):q==null||q.metaSync({value:_.result},null),{value:_.value,entity:i,error:null,result:{value:q||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(_){if(J.Logger.warn("Error executing loop: ",_),i.error){const P=(A=i.error)==null?void 0:A.getDataType(null),V=Wt(P,i.error,a);return P!=null&&P.asType?V==null||V.setValueAsTypeSingle(_):V==null||V.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:V},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,_,P,V,M,G,k,q,ne,Y,ae,te,le,de,z,Q,ue,pe,ye,he,ge;const e={...lp,...c};try{const Re=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);let $e=null;if(Re.error&&i.error){J.Logger.warn("Raw error executing entity: ",Re.error);const Ke=(f=i.error)==null?void 0:f.getDataType(null),Xe=Wt(Ke||null,i.error,a);Ke!=null&&Ke.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((V=(P=Re.error)==null?void 0:P.value)==null?void 0:V.valueAsTypeList)&&(Xe==null||Xe.setValueAsTypeList((G=(M=Re.error)==null?void 0:M.value)==null?void 0:G.valueAsTypeList)):Xe==null||Xe.metaSync({value:(q=(k=Re.error)==null?void 0:k.value)==null?void 0:q.value},null),$e={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:Xe}}let Be=U.Success;Re.value===U.UnhandledError&&(i.catchesError||i.errorCalls.length?Be=U.CaughtError:Be=U.UnhandledError);const ke=i==null?void 0:i.getDataType(null),Se=Wt(ke,i,a);return ke!=null&&ke.asType?(Y=(ne=Re.result)==null?void 0:ne.value)!=null&&Y.valueAsTypeSingle?Se==null||Se.setValueAsTypeSingle((te=(ae=Re.result)==null?void 0:ae.value)==null?void 0:te.valueAsTypeSingle):(de=(le=Re.result)==null?void 0:le.value)!=null&&de.valueAsTypeList&&Array.isArray((Q=(z=Re.result)==null?void 0:z.value)==null?void 0:Q.valueAsTypeList)&&(Se==null||Se.setValueAsTypeList((pe=(ue=Re.result)==null?void 0:ue.value)==null?void 0:pe.valueAsTypeList)):Se==null||Se.metaSync({value:((he=(ye=Re.result)==null?void 0:ye.value)==null?void 0:he.value)||null},null),{value:Be,entity:i,error:$e,result:{value:Se||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 $e=(ge=i.error)==null?void 0:ge.getDataType(null),Be=Wt($e,i.error,a);return $e!=null&&$e.asType?Be==null||Be.setValueAsTypeSingle(Re):Be==null||Be.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:Be},result:null}}}async executeCondition(i,r){var c,e,f,h;let a=!1;switch(i.declaration.id){case gn.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 gn.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 _r.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 _r.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={...lp,...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 yh(a,[i,...rI(i)],i,this,this.parentContext);return f.inheritValuesFromContext(this),await f.execute(e,r)}async executeFullFunctionDeclarationLogic(i,r,a={}){const c={...lp,...a},e=rI(i);e.forEach(m=>{this.addEntity(m)}),e.reduce((m,E)=>Dt.includes(E.type)?[...m,...E.outputs]:Ot.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 P=to(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(P==null?void 0:P.value)||null},result:null}}let a=to(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let P={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(P={...P,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)sn((m=a==null?void 0:a.value)==null?void 0:m.value)&&(P={...P,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:P},null);else{const V=Wt(c,i,this.project);V==null||V.metaSync({value:P},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:V}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(V=>{var M,G;if(((M=V.declaration)==null?void 0:M.type)===d.Property&&V.declaration.static){const k=this.lastExecutionResults.readValue(V.declaration.id),q=ce(V,this.project),ne=V.codeName||((G=V.declaration)==null?void 0:G.codeName)||ir(q);if(k)k.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,k);else{const Y=Wt(V.getDataType(null),V,this.project);Y==null||Y.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,Y)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&sn((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(P=>{var k;const V=P.codeName||((k=P.declaration)==null?void 0:k.codeName)||ir(ce(P,this.project)),M=e[V],G=Wt(P.getDataType(null),P,this.project);G==null||G.metaSync({value:M},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 P=to(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(P==null?void 0:P.value)||null},result:null}}let a=to(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let P={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(P={...P,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)sn((m=a==null?void 0:a.value)==null?void 0:m.value)&&(P={...P,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:P},null);else{const V=Wt(c,i,this.project);V==null||V.metaSync({value:P},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:V}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(V=>{var M,G;if(((M=V.declaration)==null?void 0:M.type)===d.Property&&V.declaration.static){const k=this.lastExecutionResults.readValue(V.declaration.id),q=ce(V,this.project),ne=V.codeName||((G=V.declaration)==null?void 0:G.codeName)||ir(q);if(k)k.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,k);else{const Y=Wt(V.getDataType(null),V,this.project);Y==null||Y.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,Y)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&sn((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(P=>{var k;const V=P.codeName||((k=P.declaration)==null?void 0:k.codeName)||ir(ce(P,this.project)),M=e[V],G=Wt(P.getDataType(null),P,this.project);G==null||G.metaSync({value:M},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 P=to(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(P==null?void 0:P.value)||null},result:null}}let a=to(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let P={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(P={...P,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)sn((m=a==null?void 0:a.value)==null?void 0:m.value)&&(P={...P,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:P},null);else{const V=Wt(c,i,this.project);V==null||V.metaSync({value:P},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:V}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(V=>{var M,G;if(((M=V.declaration)==null?void 0:M.type)===d.Property&&V.declaration.static){const k=this.lastExecutionResults.readValue(V.declaration.id),q=ce(V,this.project),ne=V.codeName||((G=V.declaration)==null?void 0:G.codeName)||ir(q);if(k)k.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,k);else{const Y=Wt(V.getDataType(null),V,this.project);Y==null||Y.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,Y)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&sn((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(P=>{var k;const V=P.codeName||((k=P.declaration)==null?void 0:k.codeName)||ir(ce(P,this.project)),M=e[V],G=Wt(P.getDataType(null),P,this.project);G==null||G.metaSync({value:M},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,_,P;let a=to(i,this.valueResolutionContext);const c=gr(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let V={};if(((h=e==null?void 0:e.entity)==null?void 0:h.type)===d.DefinitionEntity?V={...V,...e.entity.getActiveRawDefaultValue()}:((m=e==null?void 0:e.entity)==null?void 0:m.type)===d.BuiltInBaseEntity&&(V={...V,...e.entity.getRawDefaultValue()}),a!=null&&a.value)sn((E=a==null?void 0:a.value)==null?void 0:E.value)&&(V={...V,...(b=a==null?void 0:a.value)==null?void 0:b.value}),a==null||a.value.metaSync({value:V},null);else{const M=Wt(e,i,this.project);M==null||M.metaSync({value:V},null),a={valueOwner:c,type:Me.ExecutionResult,inheritanceLink:null,value:M}}i.inputs.forEach(M=>{var q,ne,Y,ae,te,le;const G=to(M,this.valueResolutionContext),k=c.inputs.find(de=>{var z,Q;return((z=de.declaration)==null?void 0:z.id)===((Q=M.declaration)==null?void 0:Q.id)});if(((q=k==null?void 0:k.declaration)==null?void 0:q.type)===d.Property&&((ne=k==null?void 0:k.declaration)!=null&&ne.static))G!=null&&G.value?this.lastExecutionResults.writeValue(k==null?void 0:k.declaration,G==null?void 0:G.value):this.lastExecutionResults.removeValue(k==null?void 0:k.declaration.id);else if(G!=null&&G.value){const de=ce(M,this.project),z=M.codeName||((Y=M.declaration)==null?void 0:Y.codeName)||ir(de);(le=a==null?void 0:a.value)==null||le.metaSync({value:{...(ae=a.value)==null?void 0:ae.value,[z]:(te=G==null?void 0:G.value)==null?void 0:te.value}},null)}}),this.lastExecutionResults.writeValue(c,a.value)}else this.lastExecutionResults.writeValue(c,a==null?void 0:a.value);const f=(A=a==null?void 0:a.value)!=null&&A.value&&sn((_=a.value)==null?void 0:_.value)?((P=a.value)==null?void 0:P.value)||{}:{};return i.outputs.map(V=>{var q;const M=V.codeName||((q=V.declaration)==null?void 0:q.codeName)||ir(ce(V,this.project)),G=f[M],k=Wt(V.getDataType(null),V,this.project);k==null||k.metaSync({value:G},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,_,P,V,M,G,k;const c={...lp,...a},e={detached:!1};switch(i.type){case d.Condition:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((f=c.onBeforeEntityExecution)==null?void 0:f.call(c,i,q,e)),this.executeCondition(i,q)}case d.InternalCall:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((h=c.onBeforeEntityExecution)==null?void 0:h.call(c,i,q,e)),this.executeInternalCall(i,q,this.project)}case d.Operation:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((m=c.onBeforeEntityExecution)==null?void 0:m.call(c,i,q,e)),yh.executeOperation(i,q,this.project)}case d.VariableInstance:case d.VariableDeclaration:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((E=c.onBeforeEntityExecution)==null?void 0:E.call(c,i,q,e)),this.executeVariable(i,q)}case d.FunctionCall:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((b=c.onBeforeEntityExecution)==null?void 0:b.call(c,i,q,e)),this.executeFunctionCall(i,q,this.project)}case d.FunctionDeclaration:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((A=c.onBeforeEntityExecution)==null?void 0:A.call(c,i,q,e)),yh.executeEntryPointEntity(i,q)}case d.Search:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((_=c.onBeforeEntityExecution)==null?void 0:_.call(c,i,q,e)),this.executeSearch(i,q,this.project)}case d.Loop:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((P=c.onBeforeEntityExecution)==null?void 0:P.call(c,i,q,e)),this.executeLoop(i,q,this.project,c)}case d.ReturnStatement:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((V=c.onBeforeEntityExecution)==null?void 0:V.call(c,i,q,e)),this.executeReturnStatement(i,q)}case d.ContinueStatement:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((M=c.onBeforeEntityExecution)==null?void 0:M.call(c,i,q,e)),this.executeContinueStatement(i,q)}case d.BreakStatement:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((G=c.onBeforeEntityExecution)==null?void 0:G.call(c,i,q,e)),this.executeBreakStatement(i,q)}case d.GlobalEvent:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((k=c.onBeforeEntityExecution)==null?void 0:k.call(c,i,q,e)),yh.executeEntryPointEntity(i,q)}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=pd((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={...lp,...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(V=>this.hasEntity(V));(i.errorCalls||[]).forEach(V=>{this.skip(V)});let A=[];const _=(await Promise.all(E.map(V=>this.schedule(V,[],c)))).filter(V=>!!V),P=_.filter(V=>!!V).find(V=>V.value===U.CaughtError||V.value===U.Return||V.value===U.Break||V.value===U.Continue);return P||(A=[...A,..._],h)}else if(h.value===U.CaughtError||h.value===U.ConditionNotMet){const E=(i.errorCalls||[]).filter(V=>this.hasEntity(V));(i.successCalls||i.calls||[]).forEach(V=>{this.skip(V)});let A=[];const _=(await Promise.all(E.map(V=>this.schedule(V,[],c)))).filter(V=>!!V),P=_.filter(V=>!!V).find(V=>V.value===U.CaughtError||V.value===U.UnhandledError||V.value===U.Return||V.value===U.Break||V.value===U.Continue);return P||(A=[...A,..._],h)}else{if(h.value===U.UnhandledError)return this.executing.forEach(E=>{this.skip(E)}),this.scheduled.forEach(E=>{this.skip(E)}),tr.includes(h.entity.type)&&ft(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={...lp,...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=J.YieldTracker.from(r),c=[];for(const e of i)c.push(this.addEntityAsync(e,r)),await a.tick();await Promise.all(c)}removeEntity(i){var r;if(i!==this.entryPoint){const a=this.entities.indexOf(i);a>-1&&(this.entities.splice(a,1),(r=this.onRemoveEntityCallback)==null||r.call(this,i,{}))}}hasEntity(i){var c,e,f;if(this.entities.includes(i))return!0;if(((c=i.parent)==null?void 0:c.type)===d.FunctionDeclaration&&((f=(e=i.parent)==null?void 0:e.parent)==null?void 0:f.type)===d.DefinitionEntity)return this.entities.includes(i.parent);const r=ht(i);if(!r)return!1;const a=r.type===d.Loop&&i.parent===r.body?r.body:null;return a?this.entities.includes(a)||this.entities.includes(r):this.entities.includes(r)}removeScheduled(i){const r=this.scheduled.indexOf(i);r>-1&&this.scheduled.splice(r,1)}hasScheduled(i){return!!this.scheduled.includes(i)}hasSkipped(i){return!!this.skipped.includes(i)}hasExecuted(i){return!!this.executed.includes(i)}hasEntityWithId(i){const r=this.project.get(i);return r?this.hasEntity(r):!1}onAddToSkippedList(i){this.onAddToSkippedListCallback=i}onAbortExecution(i){this.onAbortExecutionCallback=i}onAddEntity(i){this.onAddEntityCallback=i}onRemoveFromSkippedList(i){this.onRemoveFromSkippedListCallback=i}onRemoveEntity(i){this.onRemoveEntityCallback=i}addToExecutingList(i){this.executing.includes(i)||this.executing.push(i)}addToScheduledList(i){this.scheduled.includes(i)||this.scheduled.push(i)}removeFromScheduledList(i){const r=this.scheduled.indexOf(i);r>-1&&this.scheduled.splice(r,1)}removeFromExecutingList(i){var a;const r=this.executing.indexOf(i);r>-1&&(this.executing.splice(r,1),(a=this.onAbortExecutionCallback)==null||a.call(this,i,{}))}removeFromAlreadyExecutedList(i){const r=this.executed.indexOf(i);r>-1&&this.executed.splice(r,1)}removeFromSkippedList(i){var a;const r=this.skipped.indexOf(i);r>-1&&(this.skipped.splice(r,1),(a=this.onRemoveFromSkippedListCallback)==null||a.call(this,i,{}))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var r;this.skipped.includes(i)||(this.skipped.push(i),(r=this.onAddToSkippedListCallback)==null||r.call(this,i,{}))}getValueTypePreference(i){return this.parentContext.getValueTypePreference(i)||null}setValueTypePreference(i,r){this.parentContext.setValueTypePreference(i,r),this.emit(i,{})}}function _1i(s){var p,i;if(s.isList)return"list";if(((p=s.entity)==null?void 0:p.type)===d.DefinitionEntity)return"definition-entity";switch((i=s.entity)==null?void 0:i.name){case fe.Number:return"number";case fe.String:return"text";case fe.Boolean:return"boolean";case fe.UUID:return"uuid";case fe.Date:return"date-time";default:return"definition-entity"}}const cs={[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 E$(s){const p=mD(s);if(!p){const r=Bh(s);if(r.includes(Ae.HTTP_ENDPOINT))return"HTTP endpoint";if(r.includes(Ae.PERSISTED_ENTITY))return"Persisted entity";if(r.includes(Ae.CRON_JOB))return"Scheduled execution";if(r.includes(Ae.RELATIONAL_DATABASE))return"Relational database"}if(p){let r="Extension of "+ce(p,p.project)+" entity",a=ys(r);const c=Bh(s);return c.includes(Ae.HTTP_ENDPOINT)?"HTTP endpoint"+(a?", "+a:""):c.includes(Ae.PERSISTED_ENTITY)?"Persisted entity"+(a?", "+a:""):c.includes(Ae.CRON_JOB)?"Scheduled execution"+(a?", "+a:""):c.includes(Ae.RELATIONAL_DATABASE)?"Relational database"+(a?", "+a:""):r}let i="";return s.abstract&&(i="Template "),s.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function gMe(s){return s.parent.type===d.DefinitionEntity||s.parent.type===d.InstalledProject?"Internal action of "+ce(s.parent,s.project):s.parent.type===d.Loop?"Action repeated on every iteration":"Internal action of entity"}function b$(s){return UL(s)?gMe(s):"Custom trigger"}function V1i(s){var p;switch(s.type){case d.DefinitionEntity:return E$(s);case d.FunctionDeclaration:return b$(s)}return(p=cs[s.type])==null?void 0:p.singular}function P1i(s){var p;switch(s.type){case d.DefinitionEntity:return E$(s);case d.FunctionDeclaration:return b$(s)}return(p=cs[s.type])==null?void 0:p.singular}const A$=4e4,g$=280,N1i=300,I$=65,bf=32,Th=39,av=26,IMe=49,sv=44,x1i=35,vg=52,x1=10,Fa=x1*2,mp=38,Eg=90,Ug=270,RMe=A$/2+120,DMe=A$/2+180;function R$(s){let i=bf+sv+mp+x1;const r=[...s.inputs];return r.length&&(i+=Fa,r.forEach(()=>{i+=av})),{height:i,width:280}}function lv(s){var a,c;let i=bf+sv+mp+x1;const r=[...s.inputs];return r.length&&(i+=Fa,r.forEach(()=>{i+=av})),s.andChildrenGroup&&(i+=Fa,s.andChildrenGroup.forEach(e=>{i+=lv(e).height})),s.orChildrenGroup&&(i+=Fa,s.orChildrenGroup.forEach(e=>{i+=lv(e).height})),(((a=s.declaration)==null?void 0:a.id)===re.condition["condition-group-and"].id||((c=s.declaration)==null?void 0:c.id)===re.condition["condition-group-or"].id)&&(i+=mp),{height:i,width:280}}function wMe(s){var h,m;let i=I$;const r=[];if([d.DefinitionEntity].includes(s.type)){const E=[...s.suggestedProperties||[],...s.properties||[]];E.length&&(i+=Fa,E.forEach(b=>{i+=b.static?IMe:Th}))}if([d.DefinitionEntity,d.InstalledProject,d.Loop].includes(s.type)){const E=[...(s==null?void 0:s.suggestedMethods)||[],...s.methods||[],...s.functions||[],...s.body?[s.body]:[]];E.length&&(i+=Fa,E.forEach(b=>{const A=R$(b);i+=A.height}))}Ot.includes(s.type)?(r.push(...(s.inputs||[]).flatMap(E=>[E])||[]),i+=Fa,i+=sv,s.error&&(i+=vg)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(s.type)?(r.push(...s.outputs||[]),s.throws&&(i+=vg)):s.type===d.Condition&&(r.push(s.inputs[0]),s.inputs[1]&&r.push(s.inputs[1]),(((h=s.declaration)==null?void 0:h.id)===re.condition["condition-group-and"].id||((m=s.declaration)==null?void 0:m.id)===re.condition["condition-group-or"].id)&&(i+=mp),s.andChildrenGroup&&(i+=Fa,s.andChildrenGroup.forEach(E=>{i+=lv(E).height})),s.orChildrenGroup&&(i+=Fa,s.orChildrenGroup.forEach(E=>{i+=lv(E).height})));const a=r.length;a&&(i+=a*Th,i+=Fa);const c=[];if(s.type===d.FunctionDeclaration||s.type===d.GlobalEvent?c.push(...s.inputs||[]):Ot.includes(s.type)&&c.push(...s.outputs||[]),Mt.includes(s.type)){i+=Fa,i+=sv,s.usedInternalCalls.length&&s.usedInternalCalls.forEach(b=>{i+=vg+Fa,i+=b.inputs.length*av,i+=b.outputs.length*av});const E=s.getDataType(null);(!E||E.canModifyObjectStructure())&&(i+=mp)}s.type===d.Search&&(i+=mp);const e=c.length;return e&&(i+=e*Th,i+=Fa),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(s.type)&&(i+=mp),{height:i,width:280}}function CMe(s){let p=0;if(s.parent.type!==d.DefinitionEntity)return{offset:p};const i=s.parent,r=i.methods.findIndex(c=>c.id===s.id);return i.methods.slice(0,r).forEach(c=>{const e=R$(c);p+=e.height}),(i.properties.length||i.suggestedProperties.length)&&(p+=Fa,i.suggestedProperties.forEach(()=>{p+=Th}),i.properties.forEach(()=>{p+=Th})),{offset:p}}function _E(s){return`${s.split("-").map((r,a)=>a===0?r.charAt(0).toUpperCase()+r.slice(1):r.toLowerCase()).join(" ")}.`}function $1i(s){switch(s.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 vd.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case vd.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case hs.UUIDMustBeString:return`UUID must be a string, eg: "${Ap()}"`;case hs.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${Ap()}"`;case hs.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${Ap()}"`;case xn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case xn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case xn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";case xn.ValueMustBeString:return"This value must be a string";case ST.DayOfMonthAndWeekConflict:return"Cron expression cannot have both day of month and day of week";case ST.InvalidCharacters:return"Cron expression has invalid characters";case ST.MustHaveSixFields:return"Cron expression must have six fields";default:return _E(s.code)}}function L1i(s){switch(s.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 vd.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case vd.StatusCodeMustBeNumber:return"HTTP status code must be a number";case hs.UUIDMustBeString:return"UUID must be a string";case hs.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case hs.UUIDMustBeValidFormat:return"UUID must be in a valid format";case xn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case xn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case xn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return _E(s.code)}}function B1i(s){switch(s.code){case be.AbstractEntityWithNonAbstractMethods:return`${ce(s.entity,s.entity.project)} has non-template actions`;case be.AbstractEntityWithNonAbstractProperties:return`${ce(s.entity,s.entity.project)} has non-template properties`;case be.IncorrectEntityImplementation:return`${ce(s.entity,s.entity.project)} incorrectly implements template`;case be.IncorrectMethodImplementation:return`${ce(s.entity,s.entity.project)} incorrectly implements the template`;case be.IncorrectPropertyImplementation:return`${ce(s.entity,s.entity.project)} incorrectly implements the template`;case be.AbstractMethodInNonAbstractEntity:return`${ce(s.entity,s.entity.project)} can't be a template`;case be.AbstractPropertyInNonAbstractEntity:return`${ce(s.entity,s.entity.project)} can't be a template`;case Ce.MethodOverwritesOtherSiblingWithSameName:return`${ce(s.entity,s.entity.project)} overwrites action`;case Ce.PropertyOverwritesOtherSiblingWithSameName:return`${ce(s.entity,s.entity.project)} overwrites property`;case be.MissingMethodImplementation:return`${ce(s.entity,s.entity.project)} is missing action`;case be.MissingPropertyImplementation:return`${ce(s.entity,s.entity.project)} is missing property`;case Ce.NameNotUniqueInScope:return`${ce(s.entity,s.entity.project)} name is not unique`;case be.NoProperties:return`${ce(s.entity,s.entity.project)} has no properties`;case be.NonStaticPropertyInStaticEntity:return`${ce(s.entity,s.entity.project)} has non-static property`;case be.StaticEntityWithNonStaticProperties:return`${ce(s.entity,s.entity.project)} has non-static properties`;case be.ReadingFromIncompatibleType:return`${ce(s.entity,s.entity.project)} reads from different type`;case be.WritingToIncompatibleType:return`${ce(s.entity,s.entity.project)} writes to different type`;case be.ScopeWithoutLogic:return`${ce(s.entity,s.entity.project)} has no logic`;case be.NonStaticPropertyImplementsStatic:return`${ce(s.entity,s.entity.project)} has invalid static property`;case be.PropertyImplementsIncompatibleType:return`${ce(s.entity,s.entity.project)} has incompatible data type`;case be.PropertyImplementsNonAbstact:return`${ce(s.entity,s.entity.project)} has non-template property`;case be.StaticPropertyImplementsNonStatic:return`${ce(s.entity,s.entity.project)} has non-static property`;case be.VariableCallsOthersAndHasInternalCall:return`${ce(s.entity,s.entity.project)} has bad internal call`;case be.VariableHasInputsAndInternalCall:return`${ce(s.entity,s.entity.project)} has bad internal call`;case be.VariableHasOutputsAndInternalCall:return`${ce(s.entity,s.entity.project)} has bad internal call`;case be.VariableIsCalledAndHasInternalCall:return`${ce(s.entity,s.entity.project)} has bad internal call`;case Ce.InternalCallDeclarationIsInvalidType:return`${ce(s.entity,s.entity.project)} has declaration that is not an action`;case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${ce(s.entity,s.entity.project)} has declaration that is not found in parent`;case Ce.InternalCallParentDeclarationEntityInvalidType:return`${ce(s.entity,s.entity.project)} has invalid parent declaration type`;case Ce.InternalCallParentMissingDataType:return`${ce(s.entity,s.entity.project)}'s parent has no data type`;case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return`${ce(s.entity,s.entity.project)} has declaration that is not in parent`;case Ce.UnreachableEntity:return`${ce(s.entity,s.entity.project)} is unreachable`;case be.DisconnectedCallableEntity:return`${ce(s.entity,s.entity.project)} is not executed by any entity`;case be.AbstractEntityImplements:return`${ce(s.entity,s.entity.project)} implements a non-template entity`;case be.AbstractExtendingNonAbstractEntity:return`${ce(s.entity,s.entity.project)} extends a non-template entity`;case be.InvalidPropertiesCombination:return`${ce(s.entity,s.entity.project)} has invalid properties combination`;case be.ExtendingNonInteractiveEntity:return`${ce(s.entity,s.entity.project)} extends a non-interactive entity`;case be.ExtendsIncompatibleEntities:return`${ce(s.entity,s.entity.project)} extends incompatible entities`;case be.ImplementingNonAbstractEntity:return`${ce(s.entity,s.entity.project)} implements a non-template entity`;case be.ImplementsIncompatibleEntities:return`${ce(s.entity,s.entity.project)} implements incompatible entities`;case be.LackingReturnStatementOnSomeBranches:return`${ce(s.entity,s.entity.project)} is missing termination on some branches`;case be.LastCalledEntityMustBeReturnEntity:return`${ce(s.entity,s.entity.project)}'s last called entity must be a termination node`;case be.MissingRequiredValue:return`${ce(s.entity,s.entity.project)} is missing a required value`;case be.NoPrimaryKeyProperty:return`${ce(s.entity,s.entity.project)} has no primary key property`;case be.NonAbstractExtendingAbstractEntity:return`${ce(s.entity,s.entity.project)} extends a template entity`;case be.NonStaticExtendingStaticEntity:return`${ce(s.entity,s.entity.project)} extends a static entity`;case be.NonStaticImplementingStaticEntity:return`${ce(s.entity,s.entity.project)} implements a static entity`;case be.StaticExtendingNonStaticEntity:return`${ce(s.entity,s.entity.project)} extends a non-static entity`;case be.StaticImplementingNonStaticEntity:return`${ce(s.entity,s.entity.project)} implements a non-static entity`;case be.VariableReadsValueAndInternalCall:return`${ce(s.entity,s.entity.project)} reads a value and has internal call`;case be.VariableWritesValuesAndInternalCall:return`${ce(s.entity,s.entity.project)} writes values and has internal call`;case Ce.EmptyName:return`${cs[s.entity.type]} has no name`;case Ce.InvalidObjectStructure:return`${ce(s.entity,s.entity.project)} has invalid structure`;case Ce.LoopBodyFunctionOverwrite:return`${ce(s.entity,s.entity.project)}'s loop body action overwrites an action`;case Ce.MethodOverwritesBaseMethodWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites base action`;case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ce.MissingCaller:return`${ce(s.entity,s.entity.project)} is missing a caller`;case Ce.NameAsResolvedCodeNameNotUniqueInScope:return`${ce(s.entity,s.entity.project)} has a name not unique in the scope`;case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${ce(s.entity,s.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ce.NameMustStartWithLetterOrUnderscore:return`${ce(s.entity,s.entity.project)} name must start with letter or underscore`;case Ce.NoOverlapWithImplementedSignature:return`${ce(s.entity,s.entity.project)} has no overlap with implemented signature`;case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites base property`;case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ce.ReaderWriterIncompatibleDataType:return`${ce(s.entity,s.entity.project)} has reader/writer with incompatible data type`;case vd.StatusCodeMustBeBetween100And599:return`${ce(s.entity,s.entity.project)} HTTP status code must be between 100 and 599`;case vd.StatusCodeMustBeNumber:return`${ce(s.entity,s.entity.project)} HTTP status code must be a number`;case hs.UUIDMustBeString:return`${ce(s.entity,s.entity.project)} UUID must be a string`;case hs.UUIDMustNotContainSpaces:return`${ce(s.entity,s.entity.project)} UUID must not contain spaces`;case hs.UUIDMustBeValidFormat:return`${ce(s.entity,s.entity.project)} UUID must be in a valid format`;case xn.MustBeUniqueAmongSameEntities:return`${ce(s.entity,s.entity.project)} value must be unique among the same kind`;case xn.StringValueMustNotHaveDashes:return`${ce(s.entity,s.entity.project)} value must not contain dashes`;case xn.StringValueMustNotHaveSpaces:return`${ce(s.entity,s.entity.project)} value must not contain spaces`;default:return`${ce(s.entity,s.entity.project)} Error: ${_E(s.code)}`}}function M1i(s){var p,i,r,a;switch(s.code){case be.AbstractEntityWithNonAbstractMethods:return`${ce(s.entity,s.entity.project)} has non-template actions`;case be.AbstractEntityWithNonAbstractProperties:return`${ce(s.entity,s.entity.project)} has non-template properties`;case be.IncorrectEntityImplementation:return`${ce(s.entity,s.entity.project)} incorrectly implements the template entity`;case be.IncorrectMethodImplementation:return`${ce(s.entity,s.entity.project)} incorrectly implements the template action it's based on`;case be.IncorrectPropertyImplementation:return`${ce(s.entity,s.entity.project)} incorrectly implements the template property it's based on`;case be.AbstractMethodInNonAbstractEntity:return`${ce(s.entity,s.entity.project)} is a template action in a non-template entity`;case be.AbstractPropertyInNonAbstractEntity:return`${ce(s.entity,s.entity.project)} is a template property in a non-template entity`;case Ce.MethodOverwritesOtherSiblingWithSameName:return`${ce(s.entity,s.entity.project)} overwrites an action in the template entity`;case Ce.PropertyOverwritesOtherSiblingWithSameName:return`${ce(s.entity,s.entity.project)} overwrites a property in the template entity`;case be.MissingMethodImplementation:return`${ce(s.entity,s.entity.project)} is missing an action implementation from the template entity`;case be.MissingPropertyImplementation:return`${ce(s.entity,s.entity.project)} is missing a property implementation from the template entity`;case Ce.NameNotUniqueInScope:return`${ce(s.entity,s.entity.project)} has a duplicate name in the same scope`;case be.NoProperties:return`${ce(s.entity,s.entity.project)} has no properties, so it doesn't do anything`;case be.NonStaticPropertyInStaticEntity:return`${ce(s.entity,s.entity.project)} has a non-static property in a static entity`;case be.StaticEntityWithNonStaticProperties:return`${ce(s.entity,s.entity.project)} has non-static properties in a static entity`;case be.ReadingFromIncompatibleType:return`${ce(s.entity,s.entity.project)} reads data from a value of a different data type`;case be.WritingToIncompatibleType:return`${ce(s.entity,s.entity.project)} writes data to a value of a different data type`;case be.ScopeWithoutLogic:return`${ce(s.entity,s.entity.project)} has no logic`;case be.NonStaticPropertyImplementsStatic:return`${ce(s.entity,s.entity.project)} has a static property in a non-static entity`;case be.PropertyImplementsIncompatibleType:return`${ce(s.entity,s.entity.project)} implements a property of a different data type`;case be.PropertyImplementsNonAbstact:return`${ce(s.entity,s.entity.project)} implements a non-template property`;case be.StaticPropertyImplementsNonStatic:return`${ce(s.entity,s.entity.project)} has a static property in a non-static entity`;case be.VariableCallsOthersAndHasInternalCall:return`${ce(s.entity,s.entity.project)} calls other entities while being used to execute internal logic`;case be.VariableHasInputsAndInternalCall:return`${ce(s.entity,s.entity.project)} has inputs while being used to execute internal logic`;case be.VariableHasOutputsAndInternalCall:return`${ce(s.entity,s.entity.project)} has outputs while being used to execute internal logic`;case be.VariableIsCalledAndHasInternalCall:return`${ce(s.entity,s.entity.project)} is called while being used to execute internal logic`;case Ce.InternalCallDeclarationIsInvalidType:return`${ce(s.entity,s.entity.project)} has a declaration that is not an action`;case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${ce(s.entity,s.entity.project)} has a declaration that is not found in ${(p=s.entity.parent.getDataType(null))!=null&&p.entity?ce((i=s.entity.parent.getDataType(null))==null?void 0:i.entity,s.entity.project):"the variable's data-type entity"}`;case Ce.InternalCallParentDeclarationEntityInvalidType:return`${ce(s.entity,s.entity.project)} is part of a variable whos data-type entity can't have actions`;case Ce.InternalCallParentMissingDataType:return`${ce(s.entity,s.entity.project)} is part of a variable with no data-type entity`;case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return`${ce(s.entity,s.entity.project)} has a declaration doesn't belong to ${(r=s.entity.parent.getDataType(null))!=null&&r.entity?ce((a=s.entity.parent.getDataType(null))==null?void 0:a.entity,s.entity.project):"the variable's data-type entity"}`;case Ce.UnreachableEntity:return`${ce(s.entity,s.entity.project)} is unreachable`;case be.DisconnectedCallableEntity:return`${ce(s.entity,s.entity.project)} is disconnected and won't be executed by anything after publishing`;case be.AbstractEntityImplements:return`${ce(s.entity,s.entity.project)} implements a non-template entity`;case be.AbstractExtendingNonAbstractEntity:return`${ce(s.entity,s.entity.project)} extends a non-template entity`;case be.InvalidPropertiesCombination:return`${ce(s.entity,s.entity.project)} has an invalid combination of properties`;case be.ExtendingNonInteractiveEntity:return`${ce(s.entity,s.entity.project)} extends a non-interactive entity`;case be.ExtendsIncompatibleEntities:return`${ce(s.entity,s.entity.project)} extends incompatible entities`;case be.ImplementingNonAbstractEntity:return`${ce(s.entity,s.entity.project)} implements a non-template entity`;case be.ImplementsIncompatibleEntities:return`${ce(s.entity,s.entity.project)} implements incompatible entities`;case be.LackingReturnStatementOnSomeBranches:return`${ce(s.entity,s.entity.project)} has branches that don't terminate`;case be.LastCalledEntityMustBeReturnEntity:return`${ce(s.entity,s.entity.project)} must end with a termination node`;case be.MissingRequiredValue:return`${ce(s.entity,s.entity.project)} is missing a required value`;case be.NoPrimaryKeyProperty:return`${ce(s.entity,s.entity.project)} has no primary key property`;case be.NonAbstractExtendingAbstractEntity:return`${ce(s.entity,s.entity.project)} is a non-template entity extending a template entity`;case be.NonStaticExtendingStaticEntity:return`${ce(s.entity,s.entity.project)} is a non-static entity extending a static entity`;case be.NonStaticImplementingStaticEntity:return`${ce(s.entity,s.entity.project)} is a non-static entity implementing a static entity`;case be.StaticExtendingNonStaticEntity:return`${ce(s.entity,s.entity.project)} is a static entity extending a non-static entity`;case be.StaticImplementingNonStaticEntity:return`${ce(s.entity,s.entity.project)} is a static entity implementing a non-static entity`;case be.VariableReadsValueAndInternalCall:return`${ce(s.entity,s.entity.project)} reads a value and has an internal call`;case be.VariableWritesValuesAndInternalCall:return`${ce(s.entity,s.entity.project)} writes values and has an internal call`;case Ce.EmptyName:return`${cs[s.entity.type]} has no name`;case Ce.InvalidObjectStructure:return`${ce(s.entity,s.entity.project)} has an invalid structure`;case Ce.LoopBodyFunctionOverwrite:return`${ce(s.entity,s.entity.project)}'s loop body action overwrites`;case Ce.MethodOverwritesBaseMethodWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites a base action with same implementation`;case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ce.MissingCaller:return`${ce(s.entity,s.entity.project)} is missing a caller`;case Ce.NameAsResolvedCodeNameNotUniqueInScope:return`${ce(s.entity,s.entity.project)} has a name that is not unique in the scope`;case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${ce(s.entity,s.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ce.NameMustStartWithLetterOrUnderscore:return`${ce(s.entity,s.entity.project)} name must start with letter or underscore`;case Ce.NoOverlapWithImplementedSignature:return`${ce(s.entity,s.entity.project)} has no overlap with implemented signature`;case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites a base property with same implementation`;case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ce.ReaderWriterIncompatibleDataType:return`${ce(s.entity,s.entity.project)} has a reader/writer with incompatible data type`;case vd.StatusCodeMustBeBetween100And599:return`${ce(s.entity,s.entity.project)} HTTP status code must be between 100 and 599`;case vd.StatusCodeMustBeNumber:return`${ce(s.entity,s.entity.project)} HTTP status code must be a number, between 100 and 599`;case hs.UUIDMustBeString:return`${ce(s.entity,s.entity.project)} UUID must be a string, eg: "${Ap()}"`;case hs.UUIDMustNotContainSpaces:return`${ce(s.entity,s.entity.project)} UUID must not contain spaces, eg: "${Ap()}"`;case hs.UUIDMustBeValidFormat:return`${ce(s.entity,s.entity.project)} UUID must be in a valid format. Eg: "${Ap()}"`;case xn.MustBeUniqueAmongSameEntities:return`${ce(s.entity,s.entity.project)} value must be unique among the same kind`;case xn.StringValueMustNotHaveDashes:return`${ce(s.entity,s.entity.project)} value must not contain dashes`;case xn.StringValueMustNotHaveSpaces:return`${ce(s.entity,s.entity.project)} value must not contain spaces`;default:return`${ce(s.entity,s.entity.project)} Error: ${_E(s.code)}`}}function VE(s){const p=(s||"").startsWith("error-caller-only--");switch(p?s.replace("error-caller-only--",""):s){case Qt.CallIsInHigherScope:return"In a higher scope";case Qt.CallIsInLowerScope:return"In a lower scope";case Qt.CallerIsInHigherScope:return"Caller is in a higher scope";case Qt.CallerIsInLowerScope:return"Caller is in a lower scope";case Qt.CannotBeCalledByChildren:return"Cannot be called by children";case Qt.CannotCallAncestor:return"Cannot call ancestor";case Qt.CannotConnectToItself:return"Cannot connect to itself";case Qt.CannotReadMoreThanOneValue:return"Cannot read more than one value";case Qt.CannotReadValueFromChildren:return"Cannot read value from entities executed after itself";case Qt.CannotWriteValueToAncestor:return"Cannot write value to ancestor";case Tv.Suggestion:return"Suggestion";case Qt.ContinueOrBreakStatementCalledFromOutsideLoop:return"Cannot be called from outside loop";case Qt.DataTypesNotCompatible:return"Data types not compatible";case Qt.ElementInLoopBodyCallingOutsideLoop:return"Cannot call outside loop";case Qt.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees:return"Error cannot be connected to success branch";case Qt.ExecutionsAlreadyConnected:return"Executions already connected";case Qt.IsNotValueReadingEntity:return"Is not a value reading entity";case Qt.IsNotValueWritingEntity:return"Is not a value writing entity";case Qt.NotInScope:return"Not in a compatible scope";case Qt.OtherIncompatibleScopeReason:return"Incompatible scope";case Qt.SiblingInternalCallAlreadyUsedInParentVariable:return"Internal call already used in parent variable";case Qt.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees:return"Success cannot be connected to error branch";case Qt.ValuesAlreadyConnected:return"Values already connected";case Qt.CannotInteractWithInputInVariableWithInternalCalls:return"Cannot interact with input in variable with internal calls";case Qt.CannotInteractWithOutputInVariableWithInternalCalls:return"Cannot interact with output in variable with internal calls";case Tv.CanvasGloballyDisabled:return"Canvas is globally disabled";case Qt.PropertyIsConstantItsValueCantBeReset:return"Property is constant, its value can't be reset";case Qt.CannotWriteValueOfGlobalVariableDeclaration:return"Cannot write value of global variable declaration";case Qt.CannotReSetValueOfConstantVariable:return"Cannot re-set value of constant variable";case Qt.CannotConnectToOwnNode:return"It is part of the same node";case Qt.CalledByErrorMustBePassThroughCallable:return"Called by error must be pass-through callable";case Qt.CannotChangeScopeBecauseItCallsOtherEntities:return"Cannot change scope because it calls other entities in its current scope";case Qt.CannotChangeScopeBecauseItIsAlreadyCalledByOtherEntitiesInDifferentScope:return"Cannot change scope because it is already called by other entities in different scope";case Qt.VariableDeclarationCannotBeMovedToLowerScopeBecauseInstancesUsage:return"Variable declaration cannot be moved to lower scope because its instances are used in the current or different incompatible lower scope";case Qt.CalledBySourceMustBeCallerEntity:return"Not a caller type";case Qt.CalledByErrorCannotBeConnectedToEntitiesCalledByOwnSuccessBranch:return"Already connected to the success branch from a common origin caller";case Qt.CalledBySuccessCannotBeConnectedToEntitiesCalledByOwnErrorBranch:return"Already connected to the error branch from a common origin caller";case Qt.RedundantCall:return"Redundant call. Already connected further down the execution path";case Qt.CannotBeCalledBeforeDeclaration:return"Cannot be called before declaration";case Qt.CannotBeCalledInParallelBranchToDeclaration:return"Cannot be called in parallel branch to declaration";case Qt.CannotBeHigherScopeThanDeclaration:return"Cannot be in a higher scope than declaration";case Qt.CannotCallGlobalVariableDeclaration:return"Cannot call global variable declaration";case Qt.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 Qt.CannotInteractWithInputInGlobalVariableDeclaration:return"Cannot interact with input in global variable declaration";case Qt.IsNotCallableEntity:return"Is not a callable node type";case Qt.IsNotCallerEntity:return"Is not a caller node type";case Qt.IsNotPassThroughCallableEntity:return"Is not a pass-through callable node type that has an error branch";case Qt.NotAConnectableEntityType:return"Not a connectable node type";case Qt.WouldMakeAnEarlierNodeBeCalledBeforeItsDeclaration:return"Would make an earlier node be called before its declaration";default:return Gc(s||"")}}function G1i(s,p){const i=[...s,...p],r=Array.from(new Set(i));return{hasChanged:r.length!==s.length,reasons:r}}function k1i(s,p){const i=s.filter(a=>!p.includes(a));return{hasChanged:i.length!==s.length,reasons:i}}function j1i(s,p){return s.find(i=>i.entity.id===p)||null}function fU(s){return s.filter((p,i)=>s.indexOf(p)===i)}class an{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=RMe-Ug-g$,c=DMe-Eg-I$;p.type===d.Project?(p.x=a,p.y=c):p.metaSync({x:p.x||a,y:p.y||c},i);const e=new an(p,0,null,i);e.calculationEntryPoint=e,e._onlyEntities=r||[],e.ids=["0"];const f=[];e.next(m=>{f.push(...m)}),an.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&&an.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=an.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=uo(this.entity,!0);if(this.entity.type===d.Project){const i=[],r=[],a=[];p.forEach(e=>{if(d.DefinitionEntity===e.type){r.push(e);return}else if(Ft.includes(e.type)){a.push(e);return}i.push(e)});const c=i.sort((e,f)=>{const h=!!Xg(e,f).length,m=uo(e),E=uo(f);return h?0:m.length&&!E.length?-1:!m.length&&E.length?1:0}).filter(e=>!Kc(e).length);this.childEntities=[...r,...a,...c]}else{const i=[],r=[],a=[],c=[],e=[];tr.includes(this.entity.type)&&fD(this.entity).forEach(m=>{if(Mt.includes(m.type)){a.push(m);return}const E=ht(m);i.push(E)}),Dr.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:Mt.includes(h.type)?(a.push(h),!1):sr.includes(h.type)&&!m?(c.push(h),!1):h.type===d.DefinitionEntity?(e.push(h),!1):!0});i.sort((h,m)=>no(h,m)?-1:0),c.sort((h,m)=>no(h,m)?-1:0),a.sort((h,m)=>RV(h,m)?1:RV(m,h)?-1:0),this.childEntities=[...e,...i,...c,...f,...a,...r]}}calculateCardSize(){const p=wMe(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:an.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)=>an.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)=>an.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)=>an.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const p=this.ownEntityPlusBufferArea;return this.children.map(a=>a.fullBranchArea).reduce((a,c)=>an.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+Eg,right:p.right+Ug}}static filterOutRepeatedAreas(p){return p.filter((i,r)=>p.indexOf(i)===r)}getEarliestId(p,i){const r=p.split("-"),a=i.split("-");return r.length<a.length?p:r.length>a.length?i:r.reduce((e,f,h)=>f<a[h]?p:i,p)}getEarliestLevel(){return this.ids.reduce((r,a)=>this.getEarliestId(r,a),this.ids[0]).split("-").length}countColumns(){let p=0;if(this!==this.calculationEntryPoint)p++;else return p;if(!this.parents.length)return p;const r=this.parents.reduce((a,c)=>c.getEarliestLevel()>a.getEarliestLevel()?c:a,this.parents[0]).countColumns();return p+=r,p}getLatestId(p,i){if(p===i)return p;const r=p.split("-"),a=i.split("-");return r.length<a.length?i:r.length>a.length?p:r.reduce((e,f,h)=>f>a[h]?p:i,p)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((r,a)=>this.getLatestId(r,a),this.ids[0]).split("-").length}smoothPosition(){const p=this.flattenSiblings();if(!p.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(r=>{r!==this.calculationEntryPoint&&r.shiftDownAlone(i)})}else if([...Ft].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=p.filter(r=>!this.parents.includes(r));i.length?i.every(a=>{const c=this.countColumns(),e=a.countColumns();return c>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(p,i){if(p.includes(this))return p;this.move(this.entity,{y:this.entity.y+i});let r=[...p,this];return this.children.forEach(a=>{if(an.getEarliestParentInChain(a)!==this)return;const e=j1i(r,a.entity.id);r=an.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=an.filterOutRepeatedAreas([...this.flattenSiblings(),...p]);an.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+bf,h={top:f,left:e.left,bottom:f,right:e.right};return an.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(p.bottom-p.top)/2-bf;this.shiftDownAlone(r)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const p=this.children.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+bf,h={top:f,left:e.left,bottom:f,right:e.right};return an.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(p.bottom-p.top)/2-bf;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 fU(p)}getLowerAreas(){const p=this.getLowerSiblings(),i=this.parents.reduce((r,a)=>[...r,...a.getLowerAreas()],[]);return fU([...p,...i])}adjustVerticallyToAvoidOverlaps(p=[]){const r=an.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(_=>Xg(this.entity,_.entity))).filter(_=>_.id!==this.entity.id).map(_=>this.findAreaFromEntity(_)).filter(_=>!!_),E=this.getFullAreaUntilAny(m),b=r.getFullAreaUntilAny(m),A=e.reduce((_,P)=>P===this||P.fullBranchArea.left!==E.left?_:Math.max(_,P.fullBranchArea.bottom),b.bottom);if(E.top<A){const _=A-E.top+Eg;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 an(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 U1i(s,p,i={}){var c;const r=J.YieldTracker.from(i),a=[];console.log("Generating layout for project...");for(const e of s.instancesList){if(s.diggestedBuiltInBaseEntitiesIds.has(e.id)||!xf.includes(e.type)||((c=ht(e))==null?void 0:c.id)!==e.id)continue;let f=Ut(e,s);if(!f){console.log("No top scope owner for instance: ",e," in project: ",s);continue}if(!(Ft.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==s;)f=f.parent,Ft.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,p==null||p.add(e,H.Updated),a.push(e),await r.tick()}}an.autoGenerateLayout(s,p,a)}async function F1i(s,p,i={}){const r=J.YieldTracker.from(i),a=[],c=[s,...ft(s)].map(e=>ht(e)).filter(Boolean);for(const e of c){if(s.project.diggestedBuiltInBaseEntitiesIds.has(e.id))continue;let f=Ut(e,s.project);if(f&&!(Ft.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==s.project;)f=f.parent,Ft.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,p==null||p.add(e,H.Updated),a.push(e),await r.tick()}}an.autoGenerateLayout(s.project,p,a)}async function K1i(s,p,i={}){const r=J.YieldTracker.from(i),a=[],c=new Set;AKe(p,{shallowMissingActivesError:!0,excludeAffected:!0}).forEach(m=>{var b;if((!m.x||!m.y)&&!c.has(m.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(m.id)&&(a.push(m),c.add(m.id)),fo(m,s)){const A=ht(m);A&&!c.has(A.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(A.id)&&(a.push(A),c.add(A.id))}if(tr.includes(m.type)){const A=m;[A,...ft(A)].forEach(P=>{const V=ht(P);V&&!c.has(V.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(V.id)&&(a.push(V),c.add(V.id))})}m.type===d.DefinitionEntity&&m.methods.forEach(A=>{ft(A).forEach(P=>{const V=ht(P);V&&!c.has(V.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(V.id)&&(a.push(V),c.add(V.id))})}),((b=m.parent)==null?void 0:b.type)===d.Project&&(a.push(m),c.add(m.id),tr.includes(m.type)&&ft(m).forEach(P=>{const V=ht(P);V&&!c.has(V.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(V.id)&&(a.push(V),c.add(V.id))}))});let f=[];for(const m of a)s.diggestedBuiltInBaseEntitiesIds.has(m.id)||(m.x=0,m.y=0,p==null||p.add(m,H.Updated),f.push(m),await r.tick());f=C(f),an.autoGenerateLayout(s,p,f);const h=C([...f,...s.variableDeclarations,...s.variableInstances,...s.loops,...s.conditions,...s.operations,...s.searches]).filter(m=>m.x===0||m.y===0);an.autoGenerateLayout(s,p,h)}var BT=(s=>(s.Amazon="amazon",s.Google="google",s.Microsoft="microsoft",s))(BT||{}),Ir=(s=>(s.RelationalDatabase="relational-database",s.CompiledLocalCodebase="compiled-local-codebase",s.CloudHostedCodebase="cloud-hosted-codebase",s.HttpApi="http-api",s.HttpEndpoint="http-endpoint",s.ServerlessFunction="serverless-function",s.CronJob="cron-job",s.AWSTenantAccount="aws-tenant-account",s))(Ir||{}),Y_=(s=>(s.Post="post",s.Get="get",s.Acknowledgement="acknowledgment",s.Progress="progress",s.Error="error",s.Complete="complete",s))(Y_||{}),Tf=(s=>(s.Queued="queued",s.Running="running",s.Success="success",s.Failed="failed",s.CleanedUp="cleaned-up",s.Skipped="skipped",s.AbortedByUser="aborted-by-user",s.UnrecoverableFailure="unrecoverable-failure",s.Reverted="reverted",s.UnpublishingStarted="unpublishing-started",s.Unpublished="unpublished",s))(Tf||{}),J_=(s=>(s.Queued="queued",s.Running="running",s.Success="success",s.Failed="failed",s.CleanedUp="cleaned-up",s.UnrecoverableFailure="unrecoverable-failure",s.Reverted="reverted",s.UnpublishingStarted="unpublishing-started",s.Unpublished="unpublished",s))(J_||{}),Zt=(s=>(s.ProjectNotFound="project-not-found",s.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",s.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",s.DeploymentCompleted="deployment-completed",s.DeploymentStarted="deployment-started",s.DeploymentFailed="deployment-failed",s.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",s.RequestPayloadValidationFailed="request-payload-validation-failed",s.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",s.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",s.ProjectAlreadyBeingPublished="project-already-being-published",s.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",s.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",s.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",s.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",s.CreatingNewRelationalDatabase="creating-new-relational-database",s.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",s.RelationalDatabaseAlreadyExists="relational-database-already-exists",s.RelationalDatabaseDeletionStarted="relational-database-deletion-started",s.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",s.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",s.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",s.HttpApiDeploymentStarted="http-api-deployment-started",s.HttpApiDeploymentCompleted="http-api-deployment-completed",s.HttpApiDeploymentFailed="http-api-deployment-failed",s.CreatingNewHttpApi="creating-new-http-api",s.HttpApiAlreadyExists="http-api-already-exists",s.HttpApiDeletionStarted="http-api-deletion-started",s.HttpApiDeletionCompleted="http-api-deletion-completed",s.HttpApiDeletionFailed="http-api-deletion-failed",s.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",s.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",s.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",s.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",s.BundlingCodebaseForDownload="bundling-codebase-for-download",s.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",s.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",s.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",s.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",s.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",s.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",s.CodeCompilationStarted="code-compilation-started",s.CodeCompilationCompleted="code-compilation-completed",s.CodeCompilationFailed="code-compilation-failed",s.BundleCodebaseStarted="bundle-codebase-started",s.BundleCodebaseCompleted="bundle-codebase-completed",s.BundleCodebaseFailed="bundle-codebase-failed",s.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",s.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",s.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",s.MigrateRelationalDatabaseStarted="migrate-relational-database-started",s.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",s.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",s.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",s.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",s.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",s.ExecutePublicationCompletedEventTimedOut="execute-publication-completed-event-timed-out",s.AWSTenantAccountProvisioningStarted="aws-tenant-account-provisioning-started",s.AWSTenantAccountProvisioningCompleted="aws-tenant-account-provisioning-completed",s.AWSTenantAccountProvisioningFailed="aws-tenant-account-provisioning-failed",s))(Zt||{}),eo=(s=>(s.CodeCompilation="code-compilation",s.RelationalDatabaseDeployment="relational-database-deployment",s.RelationalDatabaseDeletion="relational-database-deletion",s.HttpApiDeployment="http-api-deployment",s.HttpApiDeletion="http-api-deletion",s.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",s.BundleCodebase="bundle-codebase",s.MigrateRelationalDatabase="migrate-relational-database",s.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",s.ExecutePublicationCompletedEvent="execute-publication-completed-event",s.CodebaseCleanup="codebase-cleanup",s.AWSTenantAccountProvisioning="aws-tenant-account-provisioning",s))(eo||{});Ir.CloudHostedCodebase,Ir.HttpApi,Ir.RelationalDatabase,Ir.CloudHostedCodebase,Ir.CloudHostedCodebase,Ir.RelationalDatabase,Ir.CloudHostedCodebase,Ir.CloudHostedCodebase;function OMe(s){return`project-${s}-http-api`}function $1(s){return`entity-${s}-database`}class _Me{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",Tf.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 VMe=(s=>(s.Ready="ready",s.Provisioning="provisioning",s.Queued="queued",s.ProvisioningFailed="provisioning-failed",s.Deleting="deleting",s.DeletingFailed="deleting-failed",s.Deleted="deleted",s))(VMe||{});class kc{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 q1i extends kc{constructor(i,r,a){super(i,Ir.HttpEndpoint,a);R(this,"resourceType",Ir.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=$1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class S1i extends kc{constructor(i,r,a){super(i,Ir.ServerlessFunction,a);R(this,"resourceType",Ir.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=$1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class PMe extends kc{constructor(i,r,a){super(i,Ir.HttpApi,a);R(this,"resourceType",Ir.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=OMe(this.publicationRun.project.id),this.resourceId}}class NMe extends kc{constructor(i,r,a){super(i,Ir.RelationalDatabase,a);R(this,"resourceType",Ir.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=$1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class xMe extends kc{constructor(i,r){super(i,Ir.CloudHostedCodebase,r);R(this,"resourceType",Ir.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 $Me extends kc{constructor(i,r){super(i,Ir.CompiledLocalCodebase,r);R(this,"resourceType",Ir.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 Z1i extends kc{constructor(i,r){super(i,Ir.AWSTenantAccount,r);R(this,"resourceType",Ir.AWSTenantAccount);R(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`aws-tenant-account--${this.publicationRun.project.id}`,this.resourceId}}class H1i{constructor(p,i){R(this,"id");R(this,"projectAutoIncrementPublicationCount");R(this,"projectPublishedSemanticVersion");R(this,"envIdentifier");R(this,"projectVersion");R(this,"projectBranchId");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",se.PublicationRun);R(this,"extensionsRegistry");this.id=p.id,this.projectAutoIncrementPublicationCount=p.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=p.projectPublishedSemanticVersion,this.envIdentifier=p.envIdentifier,this.projectVersion=p.projectVersion,this.projectBranchId=p.projectBranchId,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(Ir.CompiledLocalCodebase,new $Me(this,BT.Amazon)),this.implicitGlobalResources.set(Ir.CloudHostedCodebase,new xMe(this,BT.Amazon));const p=this.project.entities.filter(r=>ui(r,Ae.HTTP_ENDPOINT)),i=this.project.entities.filter(r=>ui(r,Ae.RELATIONAL_DATABASE));if(i.length&&i.forEach(r=>{const a=new NMe(this,[r],BT.Amazon);this.explicitResources.set(a.resourceId,a)}),p.length){const r=new PMe(this,p,BT.Amazon);this.explicitResources.set(r.resourceId,r)}}setSteps(p,i){p.forEach(r=>{this.addStep(r,i)}),this.editor.events.emit(Zt.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 _Me(p.stepType,p.id,p.resourceType,p.status,r,p.index,i,this,null);this.steps.push(c)}}onUpdate(p){var i;if(J.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===Y_.Error?(this.finalStatus=J_.Failed,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-error",p)):p.type===Y_.Complete&&(this.finalStatus=J_.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 m$(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(se.PublicationRun),this.extensionsRegistry}}function W1i(s){switch(s){case eo.CodeCompilation:return"Code generation";case eo.RelationalDatabaseDeployment:return"Database creation";case eo.HttpApiDeployment:return"HTTP gateway creation";case eo.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case eo.BundleCodebase:return"Bundle code";case eo.MigrateRelationalDatabase:return"Database structure migration";case eo.BusinessLogicCodebaseDeployment:return"Update servers with new code";case eo.CodebaseCleanup:return"Code cleanup";case eo.HttpApiDeletion:return"HTTP gateway deletion";case eo.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function z1i(s){switch(s){case Zt.DeploymentCompleted:return"Successfully published";case Zt.DeploymentStarted:return"Publication started";case Zt.DeploymentFailed:return"Publication failed";case Zt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case Zt.RequestPayloadValidationFailed:return"Request payload validation failed";case Zt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case Zt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case Zt.RelationalDatabaseDeploymentStarted:return"Database creation started";case Zt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case Zt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case Zt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case Zt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case Zt.RelationalDatabaseAlreadyExists:return"Database already exists";case Zt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case Zt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case Zt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case Zt.CreatingNewHttpApi:return"Creating new HTTP gateway";case Zt.HttpApiAlreadyExists:return"HTTP gateway already exists";case Zt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case Zt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case Zt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case Zt.BundlingCodebaseForDownload:return"Bundling code for download";case Zt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case Zt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case Zt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case Zt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case Zt.CodeCompilationStarted:return"Code generation started";case Zt.CodeCompilationCompleted:return"Code generation completed";case Zt.CodeCompilationFailed:return"Code generation failed";case Zt.BundleCodebaseStarted:return"Code bundling started";case Zt.BundleCodebaseCompleted:return"Code bundling completed";case Zt.BundleCodebaseFailed:return"Code bundling failed";case Zt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case Zt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case Zt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case Zt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case Zt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case Zt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case Zt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case Zt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case Zt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case Zt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case Zt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case Zt.ProjectNotFound:return"Project not found";case Zt.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case Zt.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case Zt.HttpApiDeletionStarted:return"HTTP gateway deletion started";case Zt.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case Zt.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case Zt.RelationalDatabaseDeletionStarted:return"Database deletion started";case Zt.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case Zt.RelationalDatabaseDeletionFailed:return"Database deletion failed";case Zt.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var LMe=(s=>(s.NO_LOGIC="NO_LOGIC",s.NO_NAME="NO_NAME",s.NO_CHANGES="NO_CHANGES",s.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",s))(LMe||{});function Y1i(s){switch(s){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 J1i(s){switch(s){case Ir.RelationalDatabase:return"Relational database";case Ir.HttpEndpoint:case Ir.HttpApi:return"HTTP endpoints";case Ir.ServerlessFunction:case Ir.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function Q1i(s){switch(s){case Tf.Running:return"In progress";case Tf.Failed:return"Failed";case Tf.Success:return"Succeeded";case Tf.Skipped:return"Skipped";case Tf.Queued:default:return"Queued"}}function BMe(s){var r;if(!ui(s,Ae.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=re["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(s.type===d.BuiltInBaseEntity?ui(s,Ae.EXTERNAL_INTEGRATION_CONNECTION)&&(p=Q_(s.name)):s.type===d.DefinitionEntity&&s.implements.forEach(a=>{if(ui(a,Ae.EXTERNAL_INTEGRATION_CONNECTION)){const c=Q_(a==null?void 0:a.name);if(c)return p=c,!0}}),!p){const a=s.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 X1i(s){return mTe[s]}function Q_(s){return s.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?s.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function MMe(s){if(s.type!==d.ActionDescriptor&&s.type!==d.Operation)throw new Error("Only ActionDescriptorState or OperationState can be used to resolve an external integration ID");if(s.type===d.ActionDescriptor){const p=s;if(p.id.startsWith("external-integration--"))return p.id.split("--")[1]}if(s.type===d.Operation){const p=s.declaration;if(Object.values(Ti).includes(p.id))return p.id.split("--")[1]||null}return null}function eDi(s){if(!s)throw new Error("The integrationName parameter is required to resolve the base built-in name.");return Object.values(Ae).find(i=>!!(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")&&i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===s.toLowerCase()))||null}function tDi(s){return s.type===d.BuiltInBaseEntity||s.type===d.DefinitionEntity?BMe(s):s.type===d.ActionDescriptor||s.type===d.Operation?MMe(s):null}function GMe(s){var a,c,e;if(!ui(s,Ae.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=pKe(s,Ae.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const r=re["built-in-base-entity"][i.id].properties.connectionId.id;if(s.type===d.BuiltInBaseEntity){if(ui(s,Ae.EXTERNAL_INTEGRATION_CONNECTION)){const f=s.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(s.type===d.DefinitionEntity){const f=s.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=s.extends)==null?void 0:c.type)===d.DefinitionEntity)return GMe(s.extends);p=(e=f==null?void 0:f.getDefaultValue())==null?void 0:e.value}return p}async function kMe(s,p={}){var f;const i=J.YieldTracker.from(p),a=[...Aa(s),...Dn(s),...D$(s),...ga(s),...w$(s)],c=YE(s);a.push(...c);const e=qt(s.errors,a);await i.tick();for(const h of s.inputs)await h.validateAsync({tracker:i});for(const h of s.outputs)await h.validateAsync({tracker:i});for(const h of s.internalCalls)await h.validateAsync({tracker:i});return await((f=s.dataType)==null?void 0:f.validateAsync({tracker:i})),e}function jMe(s){var a;(a=s.dataType)==null||a.validate(),s.inputs.forEach(c=>c.validate()),s.outputs.forEach(c=>c.validate()),s.internalCalls.forEach(c=>c.validate());const i=[...Aa(s),...Dn(s),...D$(s),...ga(s),...w$(s)],r=YE(s);return i.push(...r),qt(s.errors,i)}function D$(s,p){const r=[...s.project.getVariableDeclarations()].filter(a=>a.id!==s.id);return QE(s,[ir],r,p)}function w$(s){const p=[];if(s.parent!==s.project)return p;if(s.catchesError){const i=Rt({id:`${s.id}--${Ce.GlobalVariableDeclarationCannotCatchError}`,message:`${cs[s.type].singular} "${ce(s,s.project)}" with id "${s.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:ve.Error,code:Ce.GlobalVariableDeclarationCannotCatchError,entity:s});p.push(i.error)}if(s.errorCalls.length){const i=Rt({id:`${s.id}--${Ce.GlobalVariableDeclarationCannotCallOnError}`,message:`${cs[s.type].singular} "${ce(s,s.project)}" with id "${s.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:ve.Error,code:Ce.GlobalVariableDeclarationCannotCallOnError,entity:s});p.push(i.error)}if(s.calledBy.length){const i=Rt({id:`${s.id}--${Ce.GlobalVariableDeclarationCannotBeCalled}`,message:`${cs[s.type].singular} "${ce(s,s.project)}" with id "${s.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:ve.Error,code:Ce.GlobalVariableDeclarationCannotBeCalled,entity:s});p.push(i.error)}return[]}const iDi=Object.freeze(Object.defineProperty({__proto__:null,validate:jMe,validateAsync:kMe,validateGlobalVariableDeclaration:w$,validateVariableDeclarationName:D$},Symbol.toStringTag,{value:"Module"}));async function UMe(s,p={}){const i=J.YieldTracker.from(p),a=[...Aa(s),...Dn(s),...ga(s),...sd(s),...KMe(s)],c=YE(s);a.push(...c);const e=qt(s.errors,a);await i.tick();for(const f of s.inputs)await f.validateAsync({tracker:i});for(const f of s.outputs)await f.validateAsync({tracker:i});for(const f of s.internalCalls)await f.validateAsync({tracker:i});return e}function FMe(s){s.inputs.forEach(a=>a.validate()),s.outputs.forEach(a=>a.validate()),s.internalCalls.forEach(a=>a.validate());const i=[...Aa(s),...Dn(s),...ga(s)],r=YE(s);return i.push(...r),qt(s.errors,i)}function KMe(s){const p=[],i=s.declaration.constant;if(i&&s.readsValue){const r=Rt({id:`${s.id}--${be.ValueReadingOverridesConstantVariable}`,message:`The '${s.type}' entity "${ce(s,s.project)}" with id "${s.id}" is a constant variable whose value cannot be overriden, but reads a value.`,severity:ve.Error,code:be.ValueReadingOverridesConstantVariable,entity:s});p.push(r.error)}if(i&&s.defaultValue){const r=Rt({id:`${s.id}--${be.DefaultValueOverridesConstantVariable}`,message:`The '${s.type}' entity "${ce(s,s.project)}" with id "${s.id}" is a constant variable whose value cannot be overridden, but has a 'defaultValue'.`,severity:ve.Error,code:be.DefaultValueOverridesConstantVariable,entity:s});p.push(r.error)}return p}function sd(s){var h;const p=[],i=s.declaration;if((i==null?void 0:i.id)===((h=s.parent)==null?void 0:h.id)||!s.calledBy.length&&!s.successCalls.length&&!s.errorCalls.length&&s.usedInternalCalls.length)return p;const r=ft(s),a=ft(i);!!r.find(m=>m.id===i.id)&&p.push(Rt({id:`${s.id}--${be.CalledBeforeDeclaration}`,code:be.CalledBeforeDeclaration,severity:ve.Error,message:`Entity of type "${s.type}" with id "${s.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=Cf(this.defaults,i);const{transitional:r,paramsSerializer:a,headers:c}=i;r!==void 0&&mg.assertOptions(r,{silentJSONParsing:ml.transitional(ml.boolean),forcedJSONParsing:ml.transitional(ml.boolean),clarifyTimeoutError:ml.transitional(ml.boolean),legacyInterceptorReqResOrdering:ml.transitional(ml.boolean)},!1),a!=null&&(He.isFunction(a)?i.paramsSerializer={serialize:a}:mg.assertOptions(a,{encode:ml.function,serialize:ml.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),mg.assertOptions(i,{baseUrl:ml.spelling("baseURL"),withXsrfToken:ml.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=c&&He.merge(c.common,c[i.method]);c&&He.forEach(["delete","get","head","post","put","patch","common"],P=>{delete c[P]}),i.headers=so.concat(e,c);const f=[];let h=!0;this.interceptors.request.forEach(function(V){if(typeof V.runWhen=="function"&&V.runWhen(i)===!1)return;h=h&&V.synchronous;const M=i.transitional||d$;M&&M.legacyInterceptorReqResOrdering?f.unshift(V.fulfilled,V.rejected):f.push(V.fulfilled,V.rejected)});const m=[];this.interceptors.response.forEach(function(V){m.push(V.fulfilled,V.rejected)});let E,b=0,A;if(!h){const P=[uU.bind(this),void 0];for(P.unshift(...f),P.push(...m),A=P.length,E=Promise.resolve(i);b<A;)E=E.then(P[b++],P[b++]);return E}A=f.length;let _=i;for(;b<A;){const P=f[b++],V=f[b++];try{_=P(_)}catch(M){V.call(this,M);break}}try{E=uU.call(this,_)}catch(P){return Promise.reject(P)}for(b=0,A=m.length;b<A;)E=E.then(m[b++],m[b++]);return E}getUri(p){p=Cf(this.defaults,p);const i=QBe(p.baseURL,p.url,p.allowAbsoluteUrls);return WBe(i,p.params,p.paramsSerializer)}}He.forEach(["delete","get","head","options"],function(p){kg.prototype[p]=function(i,r){return this.request(Cf(r||{},{method:p,url:i,data:(r||{}).data}))}});He.forEach(["post","put","patch"],function(p){function i(r){return function(c,e,f){return this.request(Cf(f||{},{method:p,headers:r?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}kg.prototype[p]=i(),kg.prototype[p+"Form"]=i(!0)});const Tg=kg;class y${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 OE(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 y$(function(a){p=a}),cancel:p}}}const b1i=y$;function A1i(s){return function(i){return s.apply(null,i)}}function g1i(s){return He.isObject(s)&&s.isAxiosError===!0}const H_={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(H_).forEach(([s,p])=>{H_[p]=s});const I1i=H_;function r2e(s){const p=new Tg(s),i=GBe(Tg.prototype.request,p);return He.extend(i,Tg.prototype,p,{allOwnKeys:!0}),He.extend(i,p,null,{allOwnKeys:!0}),i.create=function(a){return r2e(Cf(s,a))},i}const Kn=r2e(c$);Kn.Axios=Tg;Kn.CanceledError=OE;Kn.CancelToken=b1i;Kn.isCancel=YBe;Kn.VERSION=i2e;Kn.toFormData=C1;Kn.AxiosError=ar;Kn.Cancel=Kn.CanceledError;Kn.all=function(p){return Promise.all(p)};Kn.spread=A1i;Kn.isAxiosError=g1i;Kn.mergeConfig=Cf;Kn.AxiosHeaders=so;Kn.formToJSON=s=>zBe(He.isHTMLForm(s)?new FormData(s):s);Kn.getAdapter=t2e.getAdapter;Kn.HttpStatusCode=I1i;Kn.default=Kn;const n2e=Kn;class a2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(En.HttpRequest);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e,f,h;try{const m=r.find(Y=>{var ae,te;return((te=(ae=Y.valueOwner)==null?void 0:ae.declaration)==null?void 0:te.id)===re.operation[En.HttpRequest].inputs.method.id}),E=((a=m==null?void 0:m.value)==null?void 0:a.value)||"",b=r.find(Y=>{var ae,te;return((te=(ae=Y.valueOwner)==null?void 0:ae.declaration)==null?void 0:te.id)===re.operation[En.HttpRequest].inputs.url.id}),A=((c=b==null?void 0:b.value)==null?void 0:c.value)||"",_=r.find(Y=>{var ae,te;return((te=(ae=Y.valueOwner)==null?void 0:ae.declaration)==null?void 0:te.id)===re.operation[En.HttpRequest].inputs.query.id}),P=((e=_==null?void 0:_.value)==null?void 0:e.value)||"",V=r.find(Y=>{var ae,te;return((te=(ae=Y.valueOwner)==null?void 0:ae.declaration)==null?void 0:te.id)===re.operation[En.HttpRequest].inputs.body.id}),M=((f=V==null?void 0:V.value)==null?void 0:f.value)||"",G=r.find(Y=>{var ae,te;return((te=(ae=Y.valueOwner)==null?void 0:ae.declaration)==null?void 0:te.id)===re.operation[En.HttpRequest].inputs.headers.id}),k=((h=G==null?void 0:G.value)==null?void 0:h.value)||"",q={method:E,url:A,params:P,headers:k,data:M};J.Logger.log("Axios request config: ",q);const ne=await n2e(q);return{value:U.Success,error:null,result:{status:ne.status,headers:ne.headers,data:ne.data}}}catch(m){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:m,result:null}}}})}}class s2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SQL,version:"1.0.0",description:"Execute SQL operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(ao.ExecuteSQL);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e;try{const f=r.find(_=>{var P,V;return((V=(P=_.valueOwner)==null?void 0:P.declaration)==null?void 0:V.id)===re.operation[ao.ExecuteSQL].inputs.connectionConfig.id}),h=((a=f==null?void 0:f.value)==null?void 0:a.value)||"",m=r.find(_=>{var P,V;return((V=(P=_.valueOwner)==null?void 0:P.declaration)==null?void 0:V.id)===re.operation[ao.ExecuteSQL].inputs.query.id}),E=((c=m==null?void 0:m.value)==null?void 0:c.value)||"",b=this.extensionsRegistry.requestContexts(this,[se.Editor])[0],A=await n2e.post(((e=b.env)==null?void 0:e.API_BASE_URL)+"/editor-runtime/v1/execute-sql",{connectionConfig:h,query:E},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${await b.getAccessToken()}`}});return{value:U.Success,error:null,result:{results:A.data.results||[]}}}catch(f){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:f,result:null}}}})}}class l2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(Ne.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)});J.Logger.log("Inputs for entity validation: ",a);const e=bD(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 Xa=s=>s.map(p=>{var i,r;return((i=p.value)==null?void 0:i.valueAsType)??((r=p.value)==null?void 0:r.value)});class o2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(Ne.ReadKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Xa(r),e=xVe(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__ENTITY_WRITE_KEY,version:"1.0.0",description:"Entity write-key operation implementation module (top-level, immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(Ne.WriteKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Xa(r),f=$Ve(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__ENTITY_DELETE_KEY,version:"1.0.0",description:"Entity delete-key operation implementation module (top-level, immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(Ne.DeleteKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Xa(r),e=LVe(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__ENTITY_READ_NESTED_KEY,version:"1.0.0",description:"Entity read-nested-key operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(Ne.ReadNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Xa(r),f=BVe(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__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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(Ne.WriteNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Xa(r),f=MVe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class f2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(Ne.WriteSafeNestedKeyRecursively);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Xa(r),f=GVe(a,c,e);return{value:U.Success,error:null,result:f}}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__ENTITY_DELETE_NESTED_KEY,version:"1.0.0",description:"Entity delete-nested-key operation implementation module (immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(Ne.DeleteNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Xa(r),e=kVe(a,c);return{value:U.Success,error:null,result:e}}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_HAS_KEY,version:"1.0.0",description:"Object has-key (top-level property present?)",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Ne.HasKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Xa(r),e=jVe(a,c);return{value:U.Success,error:null,result:e}}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_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object key-value-equals (top-level property strict equality)",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Ne.KeyValueEquals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Xa(r),f=UVe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class T2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Ne.HasNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Xa(r),e=FVe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class v2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Ne.NestedKeyValueEquals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Xa(r),f=KVe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class E2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Ne.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 P=((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),V=(m=(h=r[0])==null?void 0:h.value)==null?void 0:m.value,M=(b=(E=r[1])==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle;if(!V)throw new TypeError("IsInstanceOfType expects a non-null input value.");if(!M)throw new TypeError("IsInstanceOfType expects a valid expectedType input.");if(!P)throw new TypeError("IsInstanceOfType cannot determine the value owner.");if(M.type!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType expects expectedType to be a DefinitionEntity.");const G=P.getDataType(null);if(((A=G==null?void 0:G.entity)==null?void 0:A.type)!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType cannot determine the data type of the input value.");let k=!1;return((_=G==null?void 0:G.entity)==null?void 0:_.id)!==(M==null?void 0:M.id)?k=!1:bD(G==null?void 0:G.entity).safeParse(V).success?k=!0:k=!1,{value:U.Success,error:null,result:k}}catch(P){return{value:U.UnhandledError,error:P,result:null}}}})}}class b2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic);if(!r)return;const a=r.get(Ne.Merge);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Xa(r),c=qVe(...a);return{value:U.Success,error:null,result:c}}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__OBJECT_KEYS,version:"1.0.0",description:"Object keys operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic);if(!r)return;const a=r.get(Ne.Keys);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Xa(r),c=SVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class g2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic);if(!r)return;const a=r.get(Ne.Values);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Xa(r),c=ZVe(a);return{value:U.Success,error:null,result:c}}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__OBJECT_ENTRIES,version:"1.0.0",description:"Object entries operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic);if(!r)return;const a=r.get(Ne.Entries);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Xa(r),c=HVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}let Us=null;try{Us=require("crypto")}catch{}const ZT=typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto:Us&&Us.webcrypto?Us.webcrypto:null,gp=ZT?ZT.subtle:null;function nv(s){const p=new ArrayBuffer(s.byteLength);return new Uint8Array(p).set(s),p}function yn(s,p="utf8"){if(s instanceof Uint8Array)return s;const i=String(s);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 Uo(s,p="utf8"){if(p==="utf8"){if(typeof TextDecoder<"u")return new TextDecoder().decode(s);if(typeof Buffer<"u")return Buffer.from(s).toString("utf8")}else if(p==="hex"){if(typeof Buffer<"u")return Buffer.from(s).toString("hex")}else if(p==="base64"){if(typeof Buffer<"u")return Buffer.from(s).toString("base64")}else if(p==="base64url"&&typeof Buffer<"u")return Buffer.from(s).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");throw new Error(`Unsupported environment/encoding combo for fromBytes(${p})`)}const R2e=s=>yn(s,"base64"),D2e=(s,p)=>{const i=s instanceof Uint8Array?s:yn(String(s),p||"utf8");return Uo(i,"base64")},_h=(s,p)=>{const i=s instanceof Uint8Array?s:yn(String(s),p||"utf8");return Uo(i,"base64url")},Of=s=>yn(s,"base64url"),w2e=(s,p)=>{const i=s instanceof Uint8Array?s:yn(String(s),p||"utf8");return Uo(i,"hex")},C2e=s=>yn(s,"hex");function h$(s){if(ZT&&ZT.getRandomValues){const p=new Uint8Array(s);return ZT.getRandomValues(p),p}if(Us&&Us.randomBytes)return new Uint8Array(Us.randomBytes(s));throw new Error("Secure random not available")}function V1(s,p){if(!(s instanceof Uint8Array)||!(p instanceof Uint8Array)||s.length!==p.length)return!1;let i=0;for(let r=0;r<s.length;r++)i|=s[r]^p[r];return i===0}function O2e(s,p,i,r){if((typeof s!="string"||typeof p!="string")&&typeof s!="string"&&typeof p!="string")throw new Error("Invalid input types");const a=i??"utf8",c=r??"utf8",e=yn(s??"",a),f=yn(p??"",c);return V1(e,f)}async function _2e(s,p){if(gp){const i=await gp.digest({name:s},nv(p));return new Uint8Array(i)}if(Us){const i=s.replace("SHA-","sha"),r=Us.createHash(i);return r.update(Buffer.from(p)),new Uint8Array(r.digest())}throw new Error("Hash not available")}async function V2e(s,p,i,r){if(typeof p!="string")throw new Error("Invalid input type for data; expected string");const a=String(s??"SHA-256"),c=i??"utf8",e=r??"base64url",f=yn(p??"",c),h=await _2e(a,f);return Uo(h,e)}async function P1(s,p,i){if(gp){const r=await gp.importKey("raw",nv(p),{name:"HMAC",hash:{name:s}},!1,["sign"]),a=await gp.sign("HMAC",r,nv(i));return new Uint8Array(a)}if(Us){const r=`sha${s.split("-")[1]}`,a=Us.createHmac(r,Buffer.from(p));return a.update(Buffer.from(i)),new Uint8Array(a.digest())}throw new Error("HMAC not available")}async function P2e(s,p,i,r,a,c){if(typeof s!="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=yn(s??"",f),b=yn(p??"",h),A=await P1(e,E,b);return Uo(A,m)}async function N1(s,p,{iterations:i,length:r,hashAlg:a="SHA-256"}){if(gp){const c=await gp.importKey("raw",nv(s),"PBKDF2",!1,["deriveBits"]),e=await gp.deriveBits({name:"PBKDF2",salt:nv(p),iterations:i,hash:a},c,r*8);return new Uint8Array(e)}if(Us){const c=a==="SHA-512"?"sha512":"sha256";return await new Promise((e,f)=>{Us.pbkdf2(Buffer.from(s),Buffer.from(p),i,r,c,(h,m)=>{h?f(h):e(new Uint8Array(m))})})}throw new Error("PBKDF2 not available")}async function N2e(s,p,i,r,a,c,e,f){if(typeof s!="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",P=yn(s??"",h),V=yn(p??"",m),M=await N1(P,V,{iterations:b,length:A,hashAlg:_});return Uo(M,E)}async function x2e(s,p=h$(16),i=21e4,r=32,a="SHA-256"){const c=yn(s,"utf8"),e=await N1(c,p,{iterations:i,length:r,hashAlg:a}),f=_h(p),h=_h(e);return`pbkdf2$${a.toLowerCase()}$${i}$${f}$${h}`}async function $2e(s,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=Of(i[3]),e=Of(i[4]),f=r.includes("512")?"SHA-512":"SHA-256",h=await N1(yn(s,"utf8"),c,{iterations:a,length:e.length,hashAlg:f});return V1(h,e)}async function L2e(s,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?yn(a,m):void 0;return await x2e(String(s??""),E,e,f,h)}function cU(s){return _h(yn(JSON.stringify(s),"utf8"))}function jg(s){try{return JSON.parse(Uo(Of(s),"utf8"))}catch{return null}}async function B2e(s,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),_={...s||{}};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 P=cU(b),V=cU(_),M=yn(`${P}.${V}`,"utf8"),k=await P1(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,M),q=_h(k);return`${P}.${V}.${q}`}async function M2e(s,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(s!=null&&typeof s!="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 _=yn(p??"",b??"utf8");return await B2e(s??{},_,{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 G2e(s,p,{alg:i="HS256",issuer:r,audience:a,maxAgeSeconds:c,clockSkewSeconds:e=60}={}){try{const[f,h,m]=String(s).split(".");if(!f||!h||!m)return{valid:!1,header:null,payload:null,reason:"Malformed"};const E=jg(f),b=jg(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=yn(`${f}.${h}`,"utf8"),P=await P1(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,A),V=Of(m);if(!V1(P,V))return{valid:!1,header:E,payload:b,reason:"Bad signature"};const M=Math.floor(Date.now()/1e3),G=Math.max(0,Number(e)||0);if(b.nbf!=null&&M+G<Number(b.nbf))return{valid:!1,header:E,payload:b,reason:"Not before"};if(b.exp!=null&&M-G>=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 k=b.aud;if(!(Array.isArray(k)?k.includes(a):k===a))return{valid:!1,header:E,payload:b,reason:"Audience mismatch"}}return c!=null&&b.iat!=null&&M-Number(b.iat)>Number(c)+G?{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 k2e(s,p,i,r,a,c,e,f){if(typeof s!="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=yn(p??"",f??"utf8");return await G2e(String(s??""),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 j2e(s){const[p,i,r]=String(s).split(".");return{header:p?jg(p):null,payload:i?jg(i):null,signature:r?Of(r):new Uint8Array}}function U2e(s,p){if(!s)throw new Error("Token is required for decoding");if(typeof s!="string")throw new Error("Invalid input type for token; expected string");const i=p??"base64url",{header:r,payload:a,signature:c}=j2e(String(s??"")),e=Uo(c,i);return{header:r,payload:a,signature:e}}class F2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(tt.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=h$(e),m=Uo(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 K2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.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=hVe(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 q2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.GenerateRandomFloat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=T1();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_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.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=Sx(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 Z2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.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=Zx(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 H2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.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=TVe(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 W2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.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=Hx(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 z2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.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=Wx(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 Y2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.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 J2e 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:[se.Logic]});R(this,"module",{init:i=>{J.Logger.log("Initializing Random Generate Short Identifier Module");const r=i.find(a=>a.contextType===se.Logic);if(r){J.Logger.log("Project state found, setting up operation");const a=r.get(tt.GenerateShortIdentifier);a?(J.Logger.log("Operation found, setting autoexecutable and implementation"),a.autoexecutable=!0,a.implementation=this.module.main):J.Logger.warn("Operation generate-short-identifier not found in project state")}else J.Logger.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,r)=>{try{const a=vVe();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_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(tt.GenerateHexadecimalToken);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=EVe();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 R1i(s){let p;if(s===null?p="null":Array.isArray(s)?p="array":p=typeof s,!["string","number","boolean","null","object","array"].includes(p))throw new TypeError("GetTypeOf cannot determine type of the given value.");return p}class X2e 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.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:R1i(c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class eMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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 tMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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 iMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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=yn(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 rMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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=Uo(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 nMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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:D2e(a,c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class aMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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=R2e(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 sMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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=_h(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 lMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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=Of(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 oMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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=w2e(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 dMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.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=C2e(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 uMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Li.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:V2e(a,c,e,f)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class pMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Li.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:P2e(c,e,a,f,h,m)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class cMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Li.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:O2e(a,c,e,f)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class fMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(Li.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 _,P;return((_=A.value)==null?void 0:_.valueAsType)??((P=A.value)==null?void 0:P.value)});return{value:U.Success,error:null,result: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 yMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(bn.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 hMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===se.Logic);if(r){const a=r.get(bn.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 mMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(hr.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,_,P,V]=r.map(M=>{var G,k;return((G=M.value)==null?void 0:G.valueAsType)??((k=M.value)==null?void 0:k.value)});return{value:U.Success,error:null,result:await M2e(a,c,e,f,h,m,E,b,A,_,P,V)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class TMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(hr.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 _,P;return((_=A.value)==null?void 0:_.valueAsType)??((P=A.value)==null?void 0:P.value)});return{value:U.Success,error:null,result:await k2e(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 vMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(hr.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:U2e(a,c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class EMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(An.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 L2e(a,c,e,f,h,m)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class bMe 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:[se.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===se.Logic),a=r==null?void 0:r.get(An.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 $2e(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 W_ extends I1{constructor(p,i,r=i.projectId){super(p,se.Editor),this._editor=i,this.id=r}get ready(){return this._editor.ready}get env(){return this._editor.env}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 branchHead(){return this._editor.branchHead}get branchHeadPromise(){return this._editor.branchHeadPromise}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 activeWorkspace(){return this._editor.activeWorkspace}get branches(){return this._editor.branches}get roles(){return this._editor.roles}get READ_ONLY(){return this._editor.READ_ONLY}get isViewingNonHead(){return this._editor.isViewingNonHead}get canEdit(){return this._editor.canEdit}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)}getProjectRoles(){return this._editor.getProjectRoles()}getLastPublishedVersionLogic(p){return this._editor.getLastPublishedVersionLogic(p)}initialLoads(p){return this._editor.initialLoads(p)}moveBranchHeadToVersion(p,i,r){return this._editor.moveBranchHeadToVersion(p,i,r)}loadInitialBranchHead(){return this._editor.loadInitialBranchHead()}}function D1i(s,p){return p instanceof W_?p:new W_(s,p)}class z_ extends I1{constructor(p,i){super(p,se.PublicationRun),this._publicationRun=i}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get envIdentifier(){return this._publicationRun.envIdentifier}get projectVersion(){return this._publicationRun.projectVersion}get projectBranchId(){return this._publicationRun.projectBranchId}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 w1i(s,p){return p instanceof z_?p:new z_(s,p)}function C1i(s){s.register(new mPe(s)),s.register(new hPe(s)),s.register(new pPe(s)),s.register(new fPe(s)),s.register(new yPe(s)),s.register(new cPe(s)),s.register(new JLe(s)),s.register(new QLe(s)),s.register(new XLe(s)),s.register(new tBe(s)),s.register(new eBe(s)),s.register(new iBe(s)),s.register(new K2e(s)),s.register(new q2e(s)),s.register(new S2e(s)),s.register(new Z2e(s)),s.register(new H2e(s)),s.register(new W2e(s)),s.register(new z2e(s)),s.register(new Y2e(s)),s.register(new J2e(s)),s.register(new Q2e(s)),s.register(new Y$e(s)),s.register(new J$e(s)),s.register(new Q$e(s)),s.register(new X$e(s)),s.register(new eLe(s)),s.register(new tLe(s)),s.register(new iLe(s)),s.register(new rLe(s)),s.register(new nLe(s)),s.register(new aLe(s)),s.register(new sLe(s)),s.register(new lLe(s)),s.register(new oLe(s)),s.register(new dLe(s)),s.register(new uLe(s)),s.register(new pLe(s)),s.register(new cLe(s)),s.register(new fLe(s)),s.register(new yLe(s)),s.register(new TLe(s)),s.register(new vLe(s)),s.register(new ELe(s)),s.register(new m$e(s)),s.register(new T$e(s)),s.register(new v$e(s)),s.register(new E$e(s)),s.register(new b$e(s)),s.register(new A$e(s)),s.register(new g$e(s)),s.register(new I$e(s)),s.register(new R$e(s)),s.register(new w$e(s)),s.register(new C$e(s)),s.register(new O$e(s)),s.register(new _$e(s)),s.register(new V$e(s)),s.register(new Lxe(s)),s.register(new l2e(s)),s.register(new a2e(s)),s.register(new s2e(s)),s.register(new $Ne(s)),s.register(new LNe(s)),s.register(new BNe(s)),s.register(new MNe(s)),s.register(new GNe(s)),s.register(new kNe(s)),s.register(new jNe(s)),s.register(new UNe(s)),s.register(new FNe(s)),s.register(new txe(s)),s.register(new Nxe(s)),s.register(new xxe(s)),s.register(new $xe(s)),s.register(new KNe(s)),s.register(new qNe(s)),s.register(new SNe(s)),s.register(new ZNe(s)),s.register(new HNe(s)),s.register(new WNe(s)),s.register(new zNe(s)),s.register(new YNe(s)),s.register(new JNe(s)),s.register(new QNe(s)),s.register(new XNe(s)),s.register(new exe(s)),s.register(new ixe(s)),s.register(new rxe(s)),s.register(new nxe(s)),s.register(new axe(s)),s.register(new sxe(s)),s.register(new lxe(s)),s.register(new oxe(s)),s.register(new dxe(s)),s.register(new uxe(s)),s.register(new pxe(s)),s.register(new cxe(s)),s.register(new fxe(s)),s.register(new gxe(s)),s.register(new Ixe(s)),s.register(new Rxe(s)),s.register(new yxe(s)),s.register(new hxe(s)),s.register(new mxe(s)),s.register(new Txe(s)),s.register(new vxe(s)),s.register(new Exe(s)),s.register(new bxe(s)),s.register(new Axe(s)),s.register(new p2e(s)),s.register(new c2e(s)),s.register(new f2e(s)),s.register(new y2e(s)),s.register(new o2e(s)),s.register(new d2e(s)),s.register(new u2e(s)),s.register(new h2e(s)),s.register(new T2e(s)),s.register(new E2e(s)),s.register(new m2e(s)),s.register(new v2e(s)),s.register(new b2e(s)),s.register(new I2e(s)),s.register(new A2e(s)),s.register(new g2e(s)),s.register(new P$e(s)),s.register(new L$e(s)),s.register(new B$e(s)),s.register(new k$e(s)),s.register(new j$e(s)),s.register(new U$e(s)),s.register(new F$e(s)),s.register(new K$e(s)),s.register(new q$e(s)),s.register(new S$e(s)),s.register(new Z$e(s)),s.register(new M$e(s)),s.register(new G$e(s)),s.register(new x$e(s)),s.register(new $$e(s)),s.register(new N$e(s)),s.register(new D$e(s)),s.register(new W$e(s)),s.register(new z$e(s)),s.register(new H$e(s)),s.register(new nBe(s)),s.register(new OBe(s)),s.register(new CBe(s)),s.register(new _Be(s)),s.register(new VBe(s)),s.register(new lBe(s)),s.register(new oBe(s)),s.register(new yBe(s)),s.register(new cBe(s)),s.register(new DBe(s)),s.register(new EBe(s)),s.register(new ABe(s)),s.register(new IBe(s)),s.register(new gBe(s)),s.register(new fBe(s)),s.register(new mBe(s)),s.register(new TBe(s)),s.register(new hBe(s)),s.register(new rBe(s)),s.register(new dBe(s)),s.register(new bBe(s)),s.register(new xBe(s)),s.register(new K_(s)),s.register(new sBe(s)),s.register(new uBe(s)),s.register(new aBe(s)),s.register(new RBe(s)),s.register(new pBe(s)),s.register(new vBe(s)),s.register(new wBe(s)),s.register(new NBe(s)),s.register(new PBe(s)),s.register(new $Be(s)),s.register(new K_(s)),s.register(new BBe(s)),s.register(new LBe(s)),s.register(new MBe(s)),s.register(new $Le(s)),s.register(new LLe(s)),s.register(new BLe(s)),s.register(new ALe(s)),s.register(new mLe(s)),s.register(new DLe(s)),s.register(new _Le(s)),s.register(new hLe(s)),s.register(new VLe(s)),s.register(new xLe(s)),s.register(new CLe(s)),s.register(new wLe(s)),s.register(new Mg(s)),s.register(new MLe(s)),s.register(new GLe(s)),s.register(new OLe(s)),s.register(new NLe(s)),s.register(new PLe(s)),s.register(new RLe(s)),s.register(new ILe(s)),s.register(new gLe(s)),s.register(new bLe(s)),s.register(new ULe(s)),s.register(new jLe(s)),s.register(new FLe(s)),s.register(new kLe(s)),s.register(new Oxe(s)),s.register(new Dxe(s)),s.register(new Cxe(s)),s.register(new _xe(s)),s.register(new Vxe(s)),s.register(new wxe(s)),s.register(new Pxe(s)),s.register(new X2e(s)),s.register(new aMe(s)),s.register(new lMe(s)),s.register(new dMe(s)),s.register(new nMe(s)),s.register(new sMe(s)),s.register(new oMe(s)),s.register(new rMe(s)),s.register(new iMe(s)),s.register(new tMe(s)),s.register(new eMe(s)),s.register(new yMe(s)),s.register(new hMe(s)),s.register(new cMe(s)),s.register(new fMe(s)),s.register(new F2e(s)),s.register(new uMe(s)),s.register(new pMe(s)),s.register(new TMe(s)),s.register(new mMe(s)),s.register(new vMe(s)),s.register(new EMe(s)),s.register(new bMe(s)),s.register(new vPe(s)),s.register(new EPe(s)),s.register(new Lg(s)),s.register(new Bg(s))}class m${constructor(p=new J.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(){C1i(this),J.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case se.Editor:return this.onResolveEditorContextCallback();case se.Logic:return this.onResolveProjectLogicContextCallback();case se.EditorGUI:return this.onResolveEditorGUIContextCallback();case se.Compile:return this.onResolveCompileContextCallback();case se.PublicationRun:return this.onResolvePublicationRunContextCallback();case se.GUI:return this.onResolveGUIContextCallback();case se.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(){J.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder)if(p.module.init&&!this.initialized.has(p.manifest.id)){J.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)):J.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)?(J.Logger.log("Set "+p.manifest.id+" extension as initialized by default..."),this.initialized.add(p.manifest.id)):J.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)){J.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case se.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case se.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}J.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 sg=null;const T$={requestExtension:s=>(sg||(sg=new m$,sg.setup()),sg.requestExtension(s))};function O1i(s){return!(s instanceof Error)&&typeof s=="object"&&s!==null?s:s instanceof Error?{name:s.name,message:s.message,stack:s.stack,...s}:s}const lp={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var v$=(s=>(s.FinishedSuccess="finished-success",s.FinishedError="finished-error",s.Running="running",s.Paused="paused",s.Stopped="stopped",s.NotStarted="not-started",s))(v$||{});const AMe={...T$,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class yh extends J.Events{constructor(i,r,a,c=null,e=AMe){super();R(this,"project");R(this,"entryPoint");R(this,"state","not-started");R(this,"events",new J.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 $T(x.UUID.uuid(),this.project),this.resolvedValues=new $T(x.UUID.uuid(),this.project),this.persistedExecutionResults=new $T(x.UUID.uuid(),this.project),this.lastExecutionResults=new $T(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),tr.includes(i.type)&&ft(i).forEach(r=>this.skip(r))))}async schedule(i,r,a){if(this.hasExecuted(i))return null;if(Ft.includes(i.type))return this.executeBranch(i,a,r);if(sr.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[...Ot,...Ft].includes(r.type)?a.push(...r.inputs):Dt.includes(r.type)&&a.push(...r.outputs),a.map(e=>{var h;let f=i.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&Ft.includes(r.type)&&(f=i.find(m=>{var E;return((E=m.valueOwner.declaration)==null?void 0:E.id)===e.id})),f){const m=(h=f.value)==null?void 0:h.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return Jr.includes(e.type)?to(e,this.valueResolutionContext):xp(e,this.valueResolutionContext)}).reduce((e,f)=>{const h=pd(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return h.forEach(E=>{var _,P,V;if(E.id===(f==null?void 0:f.valueOwner.id))return;const b=Wt(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(((P=f==null?void 0:f.value)==null?void 0:P.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((V=f==null?void 0:f.value)==null?void 0:V.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={...lp,...c};try{let m={value:U.Success,error:null,result:null};if(r.sort((E,b)=>E.valueOwner.index-b.valueOwner.index),Object.values(Mr).includes(i.declaration.id)){const E=this.parentContext.requestExtension(fh+i.declaration.id).module.main;E?m=await E(i,r):J.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){J.Logger.warn("Raw error executing entity: ",m.error);const b=(f=i.error)==null?void 0:f.getDataType(null),A=Wt(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){J.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=Wt(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.sort((b,A)=>b.valueOwner.index-A.valueOwner.index)));let h=null;if(f.error&&i.error){const b=O1i(f.error),A=((c=i.error)==null?void 0:c.getDataType(null))||null,_=Wt(A,i.error,a);if(A!=null&&A.asType)_==null||_.setValueAsTypeSingle(f.error);else{const P=sn(b)?JSON.stringify(b,null,2):b;_==null||_.metaSync({value:P},null)}h={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:_}}const m=i==null?void 0:i.getDataType(null),E=Wt(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){console.warn("Operation execution error: ",f);let h=null;if(i.error){const m=(e=i.error)==null?void 0:e.getDataType(null),E=Wt(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=Wt(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(J.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=Wt(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={...lp,...c};try{let _={value:U.Success,error:null,result:null};const P=r.map(ne=>{var Y,ae;return((Y=ne==null?void 0:ne.value)==null?void 0:Y.valueAsType)||((ae=ne==null?void 0:ne.value)==null?void 0:ae.value)});let V={};i.getUniqueInputMaps().forEach(ne=>{const Y=i.body.inputs.find(de=>ce(de,a)===ce(ne,a)),ae=ne==null?void 0:ne.getDataType(null),te=Wt(ae,Y,a);ae!=null&&ae.asType?te==null||te.setValueAsTypeList([]):te==null||te.metaSync({value:[]},null),this.lastExecutionResults.writeValue(Y,te);const le={value:te,valueOwner:Y,type:Me.ExecutionResult,inheritanceLink:null};V[Y.id]=le});let G={value:U.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case re.loop["counted-loop"].id:{const ne=P[0];let Y=1;for(;Y<=ne&&Y<=50;){const ae=i.body.inputs.map(te=>{if(te===i.currentIterationNumberArgumentDeclaration){const le=i.currentIterationNumberArgumentDeclaration.getDataType(null),de=Xd(le),z=this.lastExecutionResults.readValue(te.id);if(z){z.metaSync({value:Y},null),this.lastExecutionResults.writeValue(te,z);const ye={value:z,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null};return V[te.id]=ye,ye}const Q={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:Y,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:de,standaloneParent:te.toReference()},ue=lr(Q,a);this.lastExecutionResults.writeValue(te,ue);const pe={value:ue,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null};return V[te.id]=pe,pe}else return V[te.id]}).filter(te=>!!te);if(G=await this.executeFullFunctionDeclarationLogic(i.body,ae,e),(G.results||[]).forEach(te=>{var Q,ue,pe,ye;if(te.valueOwner.type!==d.InputMap||Dt.includes(te.valueOwner.parent.type))return;const le=i.body.inputs.find(he=>ce(he,a)===ce(te.valueOwner,a)),z=[...((ue=(Q=V==null?void 0:V[le.id])==null?void 0:Q.value)==null?void 0:ue.value)||[],((pe=te==null?void 0:te.value)==null?void 0:pe.value)||null];(ye=V[le.id].value)==null||ye.metaSync({value:z},null),this.lastExecutionResults.writeValue(le,V[le.id].value)}),[U.CaughtError,U.Break,U.Return].includes(G.value))break;Y++}break}case re.loop["manual-flow-loop"].id:{let ne=1;for(;ne<=50;){const Y=i.body.inputs.map(ae=>{if(ae===i.currentIterationNumberArgumentDeclaration){const te=this.lastExecutionResults.readValue(ae.id);if(te){te.metaSync({value:ne},null),this.lastExecutionResults.writeValue(ae,te);const Q={value:te,valueOwner:ae,type:Me.ExecutionResult,inheritanceLink:null};return V[ae.id]=Q,Q}const le=i.currentIterationNumberArgumentDeclaration.getDataType(null),de=Wt(le,ae,a);return de==null||de.metaSync({value:ne},null),this.lastExecutionResults.writeValue(ae,de),{value:de,valueOwner:ae,type:Me.ExecutionResult,inheritanceLink:null}}else return V[ae.id]}).filter(ae=>!!ae);if(G=await this.executeFullFunctionDeclarationLogic(i.body,Y,e),(G.results||[]).forEach(ae=>{var z,Q,ue;if(ae.valueOwner.type!==d.InputMap||Dt.includes(ae.valueOwner.parent.type))return;const te=i.body.inputs.find(pe=>ce(pe,a)===ce(ae.valueOwner,a)),de=[...(z=V[te.id].value)==null?void 0:z.value,((Q=ae.value)==null?void 0:Q.value)||null];(ue=V[te.id].value)==null||ue.metaSync({value:de},null),this.lastExecutionResults.writeValue(te,V[te.id].value)}),[U.CaughtError,U.Break,U.Return].includes(G.value))break;ne++}break}case re.loop["list-loop"].id:{const ne=P[0];let Y=1;const ae=ne;for(let te=0;te<ae.length;te++){const le=ae[te],de=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const Q=this.lastExecutionResults.readValue(z.id);if(Q)return Q.metaSync({value:Y},null),this.lastExecutionResults.writeValue(z,Q),{value:Q,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ue=i.currentIterationNumberArgumentDeclaration.getDataType(null),pe=Wt(ue,z,a);return pe==null||pe.metaSync({value:Y},null),this.lastExecutionResults.writeValue(z,pe),{value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const Q=i.currentValueArgumentDeclaration.getDataType(null),ue=Xd(Q),pe=this.lastExecutionResults.readValue(z.id);if(pe)return pe.metaSync({value:le},null),this.lastExecutionResults.writeValue(z,pe),{value:pe,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ye={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:le,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ue,standaloneParent:z.toReference()},he=lr(ye,a);return this.lastExecutionResults.writeValue(z,he),{value:he,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return V[z.id]}).filter(z=>!!z);if(G=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(G.results||[]).forEach(z=>{var ye,he,ge;if(z.valueOwner.type!==d.InputMap||Dt.includes(z.valueOwner.parent.type))return;const Q=i.body.inputs.find(Re=>ce(Re,a)===ce(z.valueOwner,a)),pe=[...(ye=V[Q.id].value)==null?void 0:ye.value,((he=z.value)==null?void 0:he.value)||null];(ge=V[Q.id].value)==null||ge.metaSync({value:pe},null),this.lastExecutionResults.writeValue(Q,V[Q.id].value)}),[U.CaughtError,U.Break,U.Return].includes(G.value))break;Y++}break}case re.loop["object-keys-loop"].id:{const ne=P[0];let Y=1;const ae=ne?Object.keys(ne):[];for(let te=0;te<ae.length;te++){const le=ae[te],de=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const Q=this.lastExecutionResults.readValue(z.id);if(Q)return Q.metaSync({value:Y},null),this.lastExecutionResults.writeValue(z,Q),{value:Q,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ue=i.currentIterationNumberArgumentDeclaration.getDataType(null),pe=Wt(ue,z,a);return pe==null||pe.metaSync({value:Y},null),this.lastExecutionResults.writeValue(z,pe),{value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const Q=i.currentValueArgumentDeclaration.getDataType(null),ue=Xd(Q),pe=this.lastExecutionResults.readValue(z.id);if(pe)return pe.metaSync({value:le},null),this.lastExecutionResults.writeValue(z,pe),{value:pe,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ye={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:le,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ue,standaloneParent:z.toReference()},he=lr(ye,a);return this.lastExecutionResults.writeValue(z,he),{value:he,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return V[z.id]}).filter(z=>!!z);if(G=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(G.results||[]).forEach(z=>{var ye,he,ge;if(z.valueOwner.type!==d.InputMap||Dt.includes(z.valueOwner.parent.type))return;const Q=i.body.inputs.find(Re=>ce(Re,a)===ce(z.valueOwner,a)),pe=[...(ye=V[Q.id].value)==null?void 0:ye.value,((he=z.value)==null?void 0:he.value)||null];(ge=V[Q.id].value)==null||ge.metaSync({value:pe},null),this.lastExecutionResults.writeValue(Q,V[Q.id].value)}),[U.CaughtError,U.Break,U.Return].includes(G.value))break;Y++}break}case re.loop["object-values-loop"].id:{const ne=P[0];let Y=1;const ae=ne?Object.values(ne):[];for(let te=0;te<ae.length;te++){const le=ae[te],de=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const Q=this.lastExecutionResults.readValue(z.id);if(Q)return Q.metaSync({value:Y},null),this.lastExecutionResults.writeValue(z,Q),{value:Q,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ue=i.currentIterationNumberArgumentDeclaration.getDataType(null),pe=Wt(ue,z,a);return pe==null||pe.metaSync({value:Y},null),this.lastExecutionResults.writeValue(z,pe),{value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const Q=i.currentValueArgumentDeclaration.getDataType(null),ue=Xd(Q),pe=this.lastExecutionResults.readValue(z.id);if(pe)return pe.metaSync({value:le},null),this.lastExecutionResults.writeValue(z,pe),{value:pe,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ye={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:le,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ue,standaloneParent:z.toReference()},he=lr(ye,a);return this.lastExecutionResults.writeValue(z,he),{value:he,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return V[z.id]}).filter(z=>!!z);if(G=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(G.results||[]).forEach(z=>{var ye,he,ge;if(z.valueOwner.type!==d.InputMap||Dt.includes(z.valueOwner.parent.type))return;const Q=i.body.inputs.find(Re=>ce(Re,a)===ce(z.valueOwner,a)),pe=[...(ye=V[Q.id].value)==null?void 0:ye.value,((he=z.value)==null?void 0:he.value)||null];(ge=V[Q.id].value)==null||ge.metaSync({value:pe},null),this.lastExecutionResults.writeValue(Q,V[Q.id].value)}),[U.CaughtError,U.Break,U.Return].includes(G.value))break;Y++}break}case re.loop["string-loop"].id:{const ne=P[0];let Y=1;const ae=ne.split("");for(let te=0;te<ae.length;te++){const le=ae[te],de=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const Q=this.lastExecutionResults.readValue(z.id);if(Q)return Q.metaSync({value:Y},null),this.lastExecutionResults.writeValue(z,Q),{value:Q,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ue=i.currentIterationNumberArgumentDeclaration.getDataType(null),pe=Wt(ue,z,a);return pe==null||pe.metaSync({value:Y},null),this.lastExecutionResults.writeValue(z,pe),{value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const Q=i.currentValueArgumentDeclaration.getDataType(null),ue=Xd(Q),pe=this.lastExecutionResults.readValue(z.id);if(pe)return pe.metaSync({value:le},null),this.lastExecutionResults.writeValue(z,pe),{value:pe,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const ye={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:le,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ue,standaloneParent:z.toReference()},he=lr(ye,a);return this.lastExecutionResults.writeValue(z,he),{value:he,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return V[z.id]}).filter(z=>!!z);if(G=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(G.results||[]).forEach(z=>{var ye,he,ge;if(z.valueOwner.type!==d.InputMap||Dt.includes(z.valueOwner.parent.type))return;const Q=i.body.inputs.find(Re=>ce(Re,a)===ce(z.valueOwner,a)),pe=[...(ye=V[Q.id].value)==null?void 0:ye.value,((he=z.value)==null?void 0:he.value)||null];(ge=V[Q.id].value)==null||ge.metaSync({value:pe},null),this.lastExecutionResults.writeValue(Q,V[Q.id].value)}),[U.CaughtError,U.Break,U.Return].includes(G.value))break;Y++}break}}if(_={value:[U.CaughtError,U.Return].includes(G.value)?G.value:U.Success,error:((h=(f=G.error)==null?void 0:f.value)==null?void 0:h.value)||null,result:((E=(m=G==null?void 0:G.result)==null?void 0:m.value)==null?void 0:E.value)||null},_.error&&i.error){const ne=(b=i.error)==null?void 0:b.getDataType(null),Y=Wt(ne||null,i.error,a);ne!=null&&ne.asType?Y==null||Y.setValueAsTypeSingle(_.error):Y==null||Y.metaSync({value:_.error},null);const ae={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:Y};return{value:_.value,entity:i,error:ae,result:null}}const k=i==null?void 0:i.getDataType(null),q=Wt(k,i,a);return k!=null&&k.asType?q==null||q.setValueAsTypeSingle(_.result):q==null||q.metaSync({value:_.result},null),{value:_.value,entity:i,error:null,result:{value:q||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(_){if(J.Logger.warn("Error executing loop: ",_),i.error){const P=(A=i.error)==null?void 0:A.getDataType(null),V=Wt(P,i.error,a);return P!=null&&P.asType?V==null||V.setValueAsTypeSingle(_):V==null||V.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:V},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,_,P,V,M,G,k,q,ne,Y,ae,te,le,de,z,Q,ue,pe,ye,he,ge;const e={...lp,...c};try{const Re=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);let $e=null;if(Re.error&&i.error){J.Logger.warn("Raw error executing entity: ",Re.error);const Ke=(f=i.error)==null?void 0:f.getDataType(null),Xe=Wt(Ke||null,i.error,a);Ke!=null&&Ke.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((V=(P=Re.error)==null?void 0:P.value)==null?void 0:V.valueAsTypeList)&&(Xe==null||Xe.setValueAsTypeList((G=(M=Re.error)==null?void 0:M.value)==null?void 0:G.valueAsTypeList)):Xe==null||Xe.metaSync({value:(q=(k=Re.error)==null?void 0:k.value)==null?void 0:q.value},null),$e={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:Xe}}let Be=U.Success;Re.value===U.UnhandledError&&(i.catchesError||i.errorCalls.length?Be=U.CaughtError:Be=U.UnhandledError);const ke=i==null?void 0:i.getDataType(null),Se=Wt(ke,i,a);return ke!=null&&ke.asType?(Y=(ne=Re.result)==null?void 0:ne.value)!=null&&Y.valueAsTypeSingle?Se==null||Se.setValueAsTypeSingle((te=(ae=Re.result)==null?void 0:ae.value)==null?void 0:te.valueAsTypeSingle):(de=(le=Re.result)==null?void 0:le.value)!=null&&de.valueAsTypeList&&Array.isArray((Q=(z=Re.result)==null?void 0:z.value)==null?void 0:Q.valueAsTypeList)&&(Se==null||Se.setValueAsTypeList((pe=(ue=Re.result)==null?void 0:ue.value)==null?void 0:pe.valueAsTypeList)):Se==null||Se.metaSync({value:((he=(ye=Re.result)==null?void 0:ye.value)==null?void 0:he.value)||null},null),{value:Be,entity:i,error:$e,result:{value:Se||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 $e=(ge=i.error)==null?void 0:ge.getDataType(null),Be=Wt($e,i.error,a);return $e!=null&&$e.asType?Be==null||Be.setValueAsTypeSingle(Re):Be==null||Be.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:Be},result:null}}}async executeCondition(i,r){var c,e,f,h;let a=!1;switch(i.declaration.id){case gn.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 gn.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 _r.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 _r.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={...lp,...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 yh(a,[i,...rI(i)],i,this,this.parentContext);return f.inheritValuesFromContext(this),await f.execute(e,r)}async executeFullFunctionDeclarationLogic(i,r,a={}){const c={...lp,...a},e=rI(i);e.forEach(m=>{this.addEntity(m)}),e.reduce((m,E)=>Dt.includes(E.type)?[...m,...E.outputs]:Ot.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 P=to(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(P==null?void 0:P.value)||null},result:null}}let a=to(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let P={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(P={...P,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)sn((m=a==null?void 0:a.value)==null?void 0:m.value)&&(P={...P,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:P},null);else{const V=Wt(c,i,this.project);V==null||V.metaSync({value:P},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:V}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(V=>{var M,G;if(((M=V.declaration)==null?void 0:M.type)===d.Property&&V.declaration.static){const k=this.lastExecutionResults.readValue(V.declaration.id),q=ce(V,this.project),ne=V.codeName||((G=V.declaration)==null?void 0:G.codeName)||ir(q);if(k)k.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,k);else{const Y=Wt(V.getDataType(null),V,this.project);Y==null||Y.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,Y)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&sn((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(P=>{var k;const V=P.codeName||((k=P.declaration)==null?void 0:k.codeName)||ir(ce(P,this.project)),M=e[V],G=Wt(P.getDataType(null),P,this.project);G==null||G.metaSync({value:M},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 P=to(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(P==null?void 0:P.value)||null},result:null}}let a=to(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let P={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(P={...P,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)sn((m=a==null?void 0:a.value)==null?void 0:m.value)&&(P={...P,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:P},null);else{const V=Wt(c,i,this.project);V==null||V.metaSync({value:P},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:V}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(V=>{var M,G;if(((M=V.declaration)==null?void 0:M.type)===d.Property&&V.declaration.static){const k=this.lastExecutionResults.readValue(V.declaration.id),q=ce(V,this.project),ne=V.codeName||((G=V.declaration)==null?void 0:G.codeName)||ir(q);if(k)k.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,k);else{const Y=Wt(V.getDataType(null),V,this.project);Y==null||Y.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,Y)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&sn((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(P=>{var k;const V=P.codeName||((k=P.declaration)==null?void 0:k.codeName)||ir(ce(P,this.project)),M=e[V],G=Wt(P.getDataType(null),P,this.project);G==null||G.metaSync({value:M},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 P=to(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(P==null?void 0:P.value)||null},result:null}}let a=to(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let P={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(P={...P,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)sn((m=a==null?void 0:a.value)==null?void 0:m.value)&&(P={...P,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:P},null);else{const V=Wt(c,i,this.project);V==null||V.metaSync({value:P},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:V}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(V=>{var M,G;if(((M=V.declaration)==null?void 0:M.type)===d.Property&&V.declaration.static){const k=this.lastExecutionResults.readValue(V.declaration.id),q=ce(V,this.project),ne=V.codeName||((G=V.declaration)==null?void 0:G.codeName)||ir(q);if(k)k.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,k);else{const Y=Wt(V.getDataType(null),V,this.project);Y==null||Y.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,Y)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&sn((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(P=>{var k;const V=P.codeName||((k=P.declaration)==null?void 0:k.codeName)||ir(ce(P,this.project)),M=e[V],G=Wt(P.getDataType(null),P,this.project);G==null||G.metaSync({value:M},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,_,P;let a=to(i,this.valueResolutionContext);const c=gr(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let V={};if(((h=e==null?void 0:e.entity)==null?void 0:h.type)===d.DefinitionEntity?V={...V,...e.entity.getActiveRawDefaultValue()}:((m=e==null?void 0:e.entity)==null?void 0:m.type)===d.BuiltInBaseEntity&&(V={...V,...e.entity.getRawDefaultValue()}),a!=null&&a.value)sn((E=a==null?void 0:a.value)==null?void 0:E.value)&&(V={...V,...(b=a==null?void 0:a.value)==null?void 0:b.value}),a==null||a.value.metaSync({value:V},null);else{const M=Wt(e,i,this.project);M==null||M.metaSync({value:V},null),a={valueOwner:c,type:Me.ExecutionResult,inheritanceLink:null,value:M}}i.inputs.forEach(M=>{var q,ne,Y,ae,te,le;const G=to(M,this.valueResolutionContext),k=c.inputs.find(de=>{var z,Q;return((z=de.declaration)==null?void 0:z.id)===((Q=M.declaration)==null?void 0:Q.id)});if(((q=k==null?void 0:k.declaration)==null?void 0:q.type)===d.Property&&((ne=k==null?void 0:k.declaration)!=null&&ne.static))G!=null&&G.value?this.lastExecutionResults.writeValue(k==null?void 0:k.declaration,G==null?void 0:G.value):this.lastExecutionResults.removeValue(k==null?void 0:k.declaration.id);else if(G!=null&&G.value){const de=ce(M,this.project),z=M.codeName||((Y=M.declaration)==null?void 0:Y.codeName)||ir(de);(le=a==null?void 0:a.value)==null||le.metaSync({value:{...(ae=a.value)==null?void 0:ae.value,[z]:(te=G==null?void 0:G.value)==null?void 0:te.value}},null)}}),this.lastExecutionResults.writeValue(c,a.value)}else this.lastExecutionResults.writeValue(c,a==null?void 0:a.value);const f=(A=a==null?void 0:a.value)!=null&&A.value&&sn((_=a.value)==null?void 0:_.value)?((P=a.value)==null?void 0:P.value)||{}:{};return i.outputs.map(V=>{var q;const M=V.codeName||((q=V.declaration)==null?void 0:q.codeName)||ir(ce(V,this.project)),G=f[M],k=Wt(V.getDataType(null),V,this.project);k==null||k.metaSync({value:G},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,_,P,V,M,G,k;const c={...lp,...a},e={detached:!1,execution:this};switch(i.type){case d.Condition:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((f=c.onBeforeEntityExecution)==null?void 0:f.call(c,i,q,e)),this.executeCondition(i,q)}case d.InternalCall:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((h=c.onBeforeEntityExecution)==null?void 0:h.call(c,i,q,e)),this.executeInternalCall(i,q,this.project)}case d.Operation:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((m=c.onBeforeEntityExecution)==null?void 0:m.call(c,i,q,e)),yh.executeOperation(i,q,this.project)}case d.VariableInstance:case d.VariableDeclaration:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((E=c.onBeforeEntityExecution)==null?void 0:E.call(c,i,q,e)),this.executeVariable(i,q)}case d.FunctionCall:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((b=c.onBeforeEntityExecution)==null?void 0:b.call(c,i,q,e)),this.executeFunctionCall(i,q,this.project)}case d.FunctionDeclaration:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((A=c.onBeforeEntityExecution)==null?void 0:A.call(c,i,q,e)),yh.executeEntryPointEntity(i,q)}case d.Search:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((_=c.onBeforeEntityExecution)==null?void 0:_.call(c,i,q,e)),this.executeSearch(i,q,this.project)}case d.Loop:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((P=c.onBeforeEntityExecution)==null?void 0:P.call(c,i,q,e)),this.executeLoop(i,q,this.project,c)}case d.ReturnStatement:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((V=c.onBeforeEntityExecution)==null?void 0:V.call(c,i,q,e)),this.executeReturnStatement(i,q)}case d.ContinueStatement:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((M=c.onBeforeEntityExecution)==null?void 0:M.call(c,i,q,e)),this.executeContinueStatement(i,q)}case d.BreakStatement:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((G=c.onBeforeEntityExecution)==null?void 0:G.call(c,i,q,e)),this.executeBreakStatement(i,q)}case d.GlobalEvent:{const q=this.mergeExernalValuesWithInternalInputs(r,i);return await((k=c.onBeforeEntityExecution)==null?void 0:k.call(c,i,q,e)),yh.executeEntryPointEntity(i,q)}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=pd((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={...lp,...r},e={detached:!1,execution:this};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(V=>this.hasEntity(V));(i.errorCalls||[]).forEach(V=>{this.skip(V)});let A=[];const _=(await Promise.all(E.map(V=>this.schedule(V,[],c)))).filter(V=>!!V),P=_.filter(V=>!!V).find(V=>V.value===U.CaughtError||V.value===U.Return||V.value===U.Break||V.value===U.Continue);return P||(A=[...A,..._],h)}else if(h.value===U.CaughtError||h.value===U.ConditionNotMet){const E=(i.errorCalls||[]).filter(V=>this.hasEntity(V));(i.successCalls||i.calls||[]).forEach(V=>{this.skip(V)});let A=[];const _=(await Promise.all(E.map(V=>this.schedule(V,[],c)))).filter(V=>!!V),P=_.filter(V=>!!V).find(V=>V.value===U.CaughtError||V.value===U.UnhandledError||V.value===U.Return||V.value===U.Break||V.value===U.Continue);return P||(A=[...A,..._],h)}else{if(h.value===U.UnhandledError)return this.executing.forEach(E=>{this.skip(E)}),this.scheduled.forEach(E=>{this.skip(E)}),tr.includes(h.entity.type)&&ft(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={...lp,...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=J.YieldTracker.from(r),c=[];for(const e of i)c.push(this.addEntityAsync(e,r)),await a.tick();await Promise.all(c)}removeEntity(i){var r;if(i!==this.entryPoint){const a=this.entities.indexOf(i);a>-1&&(this.entities.splice(a,1),(r=this.onRemoveEntityCallback)==null||r.call(this,i,{}))}}hasEntity(i){var c,e,f;if(this.entities.includes(i))return!0;if(((c=i.parent)==null?void 0:c.type)===d.FunctionDeclaration&&((f=(e=i.parent)==null?void 0:e.parent)==null?void 0:f.type)===d.DefinitionEntity)return this.entities.includes(i.parent);const r=ht(i);if(!r)return!1;const a=r.type===d.Loop&&i.parent===r.body?r.body:null;return a?this.entities.includes(a)||this.entities.includes(r):this.entities.includes(r)}removeScheduled(i){const r=this.scheduled.indexOf(i);r>-1&&this.scheduled.splice(r,1)}hasScheduled(i){return!!this.scheduled.includes(i)}hasSkipped(i){return!!this.skipped.includes(i)}hasExecuted(i){return!!this.executed.includes(i)}hasEntityWithId(i){const r=this.project.get(i);return r?this.hasEntity(r):!1}onAddToSkippedList(i){this.onAddToSkippedListCallback=i}onAbortExecution(i){this.onAbortExecutionCallback=i}onAddEntity(i){this.onAddEntityCallback=i}onRemoveFromSkippedList(i){this.onRemoveFromSkippedListCallback=i}onRemoveEntity(i){this.onRemoveEntityCallback=i}addToExecutingList(i){this.executing.includes(i)||this.executing.push(i)}addToScheduledList(i){this.scheduled.includes(i)||this.scheduled.push(i)}removeFromScheduledList(i){const r=this.scheduled.indexOf(i);r>-1&&this.scheduled.splice(r,1)}removeFromExecutingList(i){var a;const r=this.executing.indexOf(i);r>-1&&(this.executing.splice(r,1),(a=this.onAbortExecutionCallback)==null||a.call(this,i,{}))}removeFromAlreadyExecutedList(i){const r=this.executed.indexOf(i);r>-1&&this.executed.splice(r,1)}removeFromSkippedList(i){var a;const r=this.skipped.indexOf(i);r>-1&&(this.skipped.splice(r,1),(a=this.onRemoveFromSkippedListCallback)==null||a.call(this,i,{}))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var r;this.skipped.includes(i)||(this.skipped.push(i),(r=this.onAddToSkippedListCallback)==null||r.call(this,i,{}))}getValueTypePreference(i){return this.parentContext.getValueTypePreference(i)||null}setValueTypePreference(i,r){this.parentContext.setValueTypePreference(i,r),this.emit(i,{})}}function _1i(s){var p,i;if(s.isList)return"list";if(((p=s.entity)==null?void 0:p.type)===d.DefinitionEntity)return"definition-entity";switch((i=s.entity)==null?void 0:i.name){case fe.Number:return"number";case fe.String:return"text";case fe.Boolean:return"boolean";case fe.UUID:return"uuid";case fe.Date:return"date-time";default:return"definition-entity"}}const cs={[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 E$(s){const p=mD(s);if(!p){const r=Bh(s);if(r.includes(Ae.HTTP_ENDPOINT))return"HTTP endpoint";if(r.includes(Ae.PERSISTED_ENTITY))return"Persisted entity";if(r.includes(Ae.CRON_JOB))return"Scheduled execution";if(r.includes(Ae.RELATIONAL_DATABASE))return"Relational database"}if(p){let r="Extension of "+ce(p,p.project)+" entity",a=ys(r);const c=Bh(s);return c.includes(Ae.HTTP_ENDPOINT)?"HTTP endpoint"+(a?", "+a:""):c.includes(Ae.PERSISTED_ENTITY)?"Persisted entity"+(a?", "+a:""):c.includes(Ae.CRON_JOB)?"Scheduled execution"+(a?", "+a:""):c.includes(Ae.RELATIONAL_DATABASE)?"Relational database"+(a?", "+a:""):r}let i="";return s.abstract&&(i="Template "),s.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function gMe(s){return s.parent.type===d.DefinitionEntity||s.parent.type===d.InstalledProject?"Internal action of "+ce(s.parent,s.project):s.parent.type===d.Loop?"Action repeated on every iteration":"Internal action of entity"}function b$(s){return UL(s)?gMe(s):"Custom trigger"}function V1i(s){var p;switch(s.type){case d.DefinitionEntity:return E$(s);case d.FunctionDeclaration:return b$(s)}return(p=cs[s.type])==null?void 0:p.singular}function P1i(s){var p;switch(s.type){case d.DefinitionEntity:return E$(s);case d.FunctionDeclaration:return b$(s)}return(p=cs[s.type])==null?void 0:p.singular}const A$=4e4,g$=280,N1i=300,I$=65,bf=32,Th=39,av=26,IMe=49,sv=44,x1i=35,vg=52,x1=10,Fa=x1*2,mp=38,Eg=90,Ug=270,RMe=A$/2+120,DMe=A$/2+180;function R$(s){let i=bf+sv+mp+x1;const r=[...s.inputs];return r.length&&(i+=Fa,r.forEach(()=>{i+=av})),{height:i,width:280}}function lv(s){var a,c;let i=bf+sv+mp+x1;const r=[...s.inputs];return r.length&&(i+=Fa,r.forEach(()=>{i+=av})),s.andChildrenGroup&&(i+=Fa,s.andChildrenGroup.forEach(e=>{i+=lv(e).height})),s.orChildrenGroup&&(i+=Fa,s.orChildrenGroup.forEach(e=>{i+=lv(e).height})),(((a=s.declaration)==null?void 0:a.id)===re.condition["condition-group-and"].id||((c=s.declaration)==null?void 0:c.id)===re.condition["condition-group-or"].id)&&(i+=mp),{height:i,width:280}}function wMe(s){var h,m;let i=I$;const r=[];if([d.DefinitionEntity].includes(s.type)){const E=[...s.suggestedProperties||[],...s.properties||[]];E.length&&(i+=Fa,E.forEach(b=>{i+=b.static?IMe:Th}))}if([d.DefinitionEntity,d.InstalledProject,d.Loop].includes(s.type)){const E=[...(s==null?void 0:s.suggestedMethods)||[],...s.methods||[],...s.functions||[],...s.body?[s.body]:[]];E.length&&(i+=Fa,E.forEach(b=>{const A=R$(b);i+=A.height}))}Ot.includes(s.type)?(r.push(...(s.inputs||[]).flatMap(E=>[E])||[]),i+=Fa,i+=sv,s.error&&(i+=vg)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(s.type)?(r.push(...s.outputs||[]),s.throws&&(i+=vg)):s.type===d.Condition&&(r.push(s.inputs[0]),s.inputs[1]&&r.push(s.inputs[1]),(((h=s.declaration)==null?void 0:h.id)===re.condition["condition-group-and"].id||((m=s.declaration)==null?void 0:m.id)===re.condition["condition-group-or"].id)&&(i+=mp),s.andChildrenGroup&&(i+=Fa,s.andChildrenGroup.forEach(E=>{i+=lv(E).height})),s.orChildrenGroup&&(i+=Fa,s.orChildrenGroup.forEach(E=>{i+=lv(E).height})));const a=r.length;a&&(i+=a*Th,i+=Fa);const c=[];if(s.type===d.FunctionDeclaration||s.type===d.GlobalEvent?c.push(...s.inputs||[]):Ot.includes(s.type)&&c.push(...s.outputs||[]),Mt.includes(s.type)){i+=Fa,i+=sv,s.usedInternalCalls.length&&s.usedInternalCalls.forEach(b=>{i+=vg+Fa,i+=b.inputs.length*av,i+=b.outputs.length*av});const E=s.getDataType(null);(!E||E.canModifyObjectStructure())&&(i+=mp)}s.type===d.Search&&(i+=mp);const e=c.length;return e&&(i+=e*Th,i+=Fa),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(s.type)&&(i+=mp),{height:i,width:280}}function CMe(s){let p=0;if(s.parent.type!==d.DefinitionEntity)return{offset:p};const i=s.parent,r=i.methods.findIndex(c=>c.id===s.id);return i.methods.slice(0,r).forEach(c=>{const e=R$(c);p+=e.height}),(i.properties.length||i.suggestedProperties.length)&&(p+=Fa,i.suggestedProperties.forEach(()=>{p+=Th}),i.properties.forEach(()=>{p+=Th})),{offset:p}}function _E(s){return`${s.split("-").map((r,a)=>a===0?r.charAt(0).toUpperCase()+r.slice(1):r.toLowerCase()).join(" ")}.`}function $1i(s){switch(s.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 vd.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case vd.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case hs.UUIDMustBeString:return`UUID must be a string, eg: "${Ap()}"`;case hs.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${Ap()}"`;case hs.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${Ap()}"`;case xn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case xn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case xn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";case xn.ValueMustBeString:return"This value must be a string";case ST.DayOfMonthAndWeekConflict:return"Cron expression cannot have both day of month and day of week";case ST.InvalidCharacters:return"Cron expression has invalid characters";case ST.MustHaveSixFields:return"Cron expression must have six fields";default:return _E(s.code)}}function L1i(s){switch(s.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 vd.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case vd.StatusCodeMustBeNumber:return"HTTP status code must be a number";case hs.UUIDMustBeString:return"UUID must be a string";case hs.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case hs.UUIDMustBeValidFormat:return"UUID must be in a valid format";case xn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case xn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case xn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return _E(s.code)}}function B1i(s){switch(s.code){case be.AbstractEntityWithNonAbstractMethods:return`${ce(s.entity,s.entity.project)} has non-template actions`;case be.AbstractEntityWithNonAbstractProperties:return`${ce(s.entity,s.entity.project)} has non-template properties`;case be.IncorrectEntityImplementation:return`${ce(s.entity,s.entity.project)} incorrectly implements template`;case be.IncorrectMethodImplementation:return`${ce(s.entity,s.entity.project)} incorrectly implements the template`;case be.IncorrectPropertyImplementation:return`${ce(s.entity,s.entity.project)} incorrectly implements the template`;case be.AbstractMethodInNonAbstractEntity:return`${ce(s.entity,s.entity.project)} can't be a template`;case be.AbstractPropertyInNonAbstractEntity:return`${ce(s.entity,s.entity.project)} can't be a template`;case Ce.MethodOverwritesOtherSiblingWithSameName:return`${ce(s.entity,s.entity.project)} overwrites action`;case Ce.PropertyOverwritesOtherSiblingWithSameName:return`${ce(s.entity,s.entity.project)} overwrites property`;case be.MissingMethodImplementation:return`${ce(s.entity,s.entity.project)} is missing action`;case be.MissingPropertyImplementation:return`${ce(s.entity,s.entity.project)} is missing property`;case Ce.NameNotUniqueInScope:return`${ce(s.entity,s.entity.project)} name is not unique`;case be.NoProperties:return`${ce(s.entity,s.entity.project)} has no properties`;case be.NonStaticPropertyInStaticEntity:return`${ce(s.entity,s.entity.project)} has non-static property`;case be.StaticEntityWithNonStaticProperties:return`${ce(s.entity,s.entity.project)} has non-static properties`;case be.ReadingFromIncompatibleType:return`${ce(s.entity,s.entity.project)} reads from different type`;case be.WritingToIncompatibleType:return`${ce(s.entity,s.entity.project)} writes to different type`;case be.ScopeWithoutLogic:return`${ce(s.entity,s.entity.project)} has no logic`;case be.NonStaticPropertyImplementsStatic:return`${ce(s.entity,s.entity.project)} has invalid static property`;case be.PropertyImplementsIncompatibleType:return`${ce(s.entity,s.entity.project)} has incompatible data type`;case be.PropertyImplementsNonAbstact:return`${ce(s.entity,s.entity.project)} has non-template property`;case be.StaticPropertyImplementsNonStatic:return`${ce(s.entity,s.entity.project)} has non-static property`;case be.VariableCallsOthersAndHasInternalCall:return`${ce(s.entity,s.entity.project)} has bad internal call`;case be.VariableHasInputsAndInternalCall:return`${ce(s.entity,s.entity.project)} has bad internal call`;case be.VariableHasOutputsAndInternalCall:return`${ce(s.entity,s.entity.project)} has bad internal call`;case be.VariableIsCalledAndHasInternalCall:return`${ce(s.entity,s.entity.project)} has bad internal call`;case Ce.InternalCallDeclarationIsInvalidType:return`${ce(s.entity,s.entity.project)} has declaration that is not an action`;case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${ce(s.entity,s.entity.project)} has declaration that is not found in parent`;case Ce.InternalCallParentDeclarationEntityInvalidType:return`${ce(s.entity,s.entity.project)} has invalid parent declaration type`;case Ce.InternalCallParentMissingDataType:return`${ce(s.entity,s.entity.project)}'s parent has no data type`;case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return`${ce(s.entity,s.entity.project)} has declaration that is not in parent`;case Ce.UnreachableEntity:return`${ce(s.entity,s.entity.project)} is unreachable`;case be.DisconnectedCallableEntity:return`${ce(s.entity,s.entity.project)} is not executed by any entity`;case be.AbstractEntityImplements:return`${ce(s.entity,s.entity.project)} implements a non-template entity`;case be.AbstractExtendingNonAbstractEntity:return`${ce(s.entity,s.entity.project)} extends a non-template entity`;case be.InvalidPropertiesCombination:return`${ce(s.entity,s.entity.project)} has invalid properties combination`;case be.ExtendingNonInteractiveEntity:return`${ce(s.entity,s.entity.project)} extends a non-interactive entity`;case be.ExtendsIncompatibleEntities:return`${ce(s.entity,s.entity.project)} extends incompatible entities`;case be.ImplementingNonAbstractEntity:return`${ce(s.entity,s.entity.project)} implements a non-template entity`;case be.ImplementsIncompatibleEntities:return`${ce(s.entity,s.entity.project)} implements incompatible entities`;case be.LackingReturnStatementOnSomeBranches:return`${ce(s.entity,s.entity.project)} is missing termination on some branches`;case be.LastCalledEntityMustBeReturnEntity:return`${ce(s.entity,s.entity.project)}'s last called entity must be a termination node`;case be.MissingRequiredValue:return`${ce(s.entity,s.entity.project)} is missing a required value`;case be.NoPrimaryKeyProperty:return`${ce(s.entity,s.entity.project)} has no primary key property`;case be.NonAbstractExtendingAbstractEntity:return`${ce(s.entity,s.entity.project)} extends a template entity`;case be.NonStaticExtendingStaticEntity:return`${ce(s.entity,s.entity.project)} extends a static entity`;case be.NonStaticImplementingStaticEntity:return`${ce(s.entity,s.entity.project)} implements a static entity`;case be.StaticExtendingNonStaticEntity:return`${ce(s.entity,s.entity.project)} extends a non-static entity`;case be.StaticImplementingNonStaticEntity:return`${ce(s.entity,s.entity.project)} implements a non-static entity`;case be.VariableReadsValueAndInternalCall:return`${ce(s.entity,s.entity.project)} reads a value and has internal call`;case be.VariableWritesValuesAndInternalCall:return`${ce(s.entity,s.entity.project)} writes values and has internal call`;case Ce.EmptyName:return`${cs[s.entity.type]} has no name`;case Ce.InvalidObjectStructure:return`${ce(s.entity,s.entity.project)} has invalid structure`;case Ce.LoopBodyFunctionOverwrite:return`${ce(s.entity,s.entity.project)}'s loop body action overwrites an action`;case Ce.MethodOverwritesBaseMethodWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites base action`;case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ce.MissingCaller:return`${ce(s.entity,s.entity.project)} is missing a caller`;case Ce.NameAsResolvedCodeNameNotUniqueInScope:return`${ce(s.entity,s.entity.project)} has a name not unique in the scope`;case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${ce(s.entity,s.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ce.NameMustStartWithLetterOrUnderscore:return`${ce(s.entity,s.entity.project)} name must start with letter or underscore`;case Ce.NoOverlapWithImplementedSignature:return`${ce(s.entity,s.entity.project)} has no overlap with implemented signature`;case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites base property`;case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ce.ReaderWriterIncompatibleDataType:return`${ce(s.entity,s.entity.project)} has reader/writer with incompatible data type`;case vd.StatusCodeMustBeBetween100And599:return`${ce(s.entity,s.entity.project)} HTTP status code must be between 100 and 599`;case vd.StatusCodeMustBeNumber:return`${ce(s.entity,s.entity.project)} HTTP status code must be a number`;case hs.UUIDMustBeString:return`${ce(s.entity,s.entity.project)} UUID must be a string`;case hs.UUIDMustNotContainSpaces:return`${ce(s.entity,s.entity.project)} UUID must not contain spaces`;case hs.UUIDMustBeValidFormat:return`${ce(s.entity,s.entity.project)} UUID must be in a valid format`;case xn.MustBeUniqueAmongSameEntities:return`${ce(s.entity,s.entity.project)} value must be unique among the same kind`;case xn.StringValueMustNotHaveDashes:return`${ce(s.entity,s.entity.project)} value must not contain dashes`;case xn.StringValueMustNotHaveSpaces:return`${ce(s.entity,s.entity.project)} value must not contain spaces`;default:return`${ce(s.entity,s.entity.project)} Error: ${_E(s.code)}`}}function M1i(s){var p,i,r,a;switch(s.code){case be.AbstractEntityWithNonAbstractMethods:return`${ce(s.entity,s.entity.project)} has non-template actions`;case be.AbstractEntityWithNonAbstractProperties:return`${ce(s.entity,s.entity.project)} has non-template properties`;case be.IncorrectEntityImplementation:return`${ce(s.entity,s.entity.project)} incorrectly implements the template entity`;case be.IncorrectMethodImplementation:return`${ce(s.entity,s.entity.project)} incorrectly implements the template action it's based on`;case be.IncorrectPropertyImplementation:return`${ce(s.entity,s.entity.project)} incorrectly implements the template property it's based on`;case be.AbstractMethodInNonAbstractEntity:return`${ce(s.entity,s.entity.project)} is a template action in a non-template entity`;case be.AbstractPropertyInNonAbstractEntity:return`${ce(s.entity,s.entity.project)} is a template property in a non-template entity`;case Ce.MethodOverwritesOtherSiblingWithSameName:return`${ce(s.entity,s.entity.project)} overwrites an action in the template entity`;case Ce.PropertyOverwritesOtherSiblingWithSameName:return`${ce(s.entity,s.entity.project)} overwrites a property in the template entity`;case be.MissingMethodImplementation:return`${ce(s.entity,s.entity.project)} is missing an action implementation from the template entity`;case be.MissingPropertyImplementation:return`${ce(s.entity,s.entity.project)} is missing a property implementation from the template entity`;case Ce.NameNotUniqueInScope:return`${ce(s.entity,s.entity.project)} has a duplicate name in the same scope`;case be.NoProperties:return`${ce(s.entity,s.entity.project)} has no properties, so it doesn't do anything`;case be.NonStaticPropertyInStaticEntity:return`${ce(s.entity,s.entity.project)} has a non-static property in a static entity`;case be.StaticEntityWithNonStaticProperties:return`${ce(s.entity,s.entity.project)} has non-static properties in a static entity`;case be.ReadingFromIncompatibleType:return`${ce(s.entity,s.entity.project)} reads data from a value of a different data type`;case be.WritingToIncompatibleType:return`${ce(s.entity,s.entity.project)} writes data to a value of a different data type`;case be.ScopeWithoutLogic:return`${ce(s.entity,s.entity.project)} has no logic`;case be.NonStaticPropertyImplementsStatic:return`${ce(s.entity,s.entity.project)} has a static property in a non-static entity`;case be.PropertyImplementsIncompatibleType:return`${ce(s.entity,s.entity.project)} implements a property of a different data type`;case be.PropertyImplementsNonAbstact:return`${ce(s.entity,s.entity.project)} implements a non-template property`;case be.StaticPropertyImplementsNonStatic:return`${ce(s.entity,s.entity.project)} has a static property in a non-static entity`;case be.VariableCallsOthersAndHasInternalCall:return`${ce(s.entity,s.entity.project)} calls other entities while being used to execute internal logic`;case be.VariableHasInputsAndInternalCall:return`${ce(s.entity,s.entity.project)} has inputs while being used to execute internal logic`;case be.VariableHasOutputsAndInternalCall:return`${ce(s.entity,s.entity.project)} has outputs while being used to execute internal logic`;case be.VariableIsCalledAndHasInternalCall:return`${ce(s.entity,s.entity.project)} is called while being used to execute internal logic`;case Ce.InternalCallDeclarationIsInvalidType:return`${ce(s.entity,s.entity.project)} has a declaration that is not an action`;case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${ce(s.entity,s.entity.project)} has a declaration that is not found in ${(p=s.entity.parent.getDataType(null))!=null&&p.entity?ce((i=s.entity.parent.getDataType(null))==null?void 0:i.entity,s.entity.project):"the variable's data-type entity"}`;case Ce.InternalCallParentDeclarationEntityInvalidType:return`${ce(s.entity,s.entity.project)} is part of a variable whos data-type entity can't have actions`;case Ce.InternalCallParentMissingDataType:return`${ce(s.entity,s.entity.project)} is part of a variable with no data-type entity`;case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return`${ce(s.entity,s.entity.project)} has a declaration doesn't belong to ${(r=s.entity.parent.getDataType(null))!=null&&r.entity?ce((a=s.entity.parent.getDataType(null))==null?void 0:a.entity,s.entity.project):"the variable's data-type entity"}`;case Ce.UnreachableEntity:return`${ce(s.entity,s.entity.project)} is unreachable`;case be.DisconnectedCallableEntity:return`${ce(s.entity,s.entity.project)} is disconnected and won't be executed by anything after publishing`;case be.AbstractEntityImplements:return`${ce(s.entity,s.entity.project)} implements a non-template entity`;case be.AbstractExtendingNonAbstractEntity:return`${ce(s.entity,s.entity.project)} extends a non-template entity`;case be.InvalidPropertiesCombination:return`${ce(s.entity,s.entity.project)} has an invalid combination of properties`;case be.ExtendingNonInteractiveEntity:return`${ce(s.entity,s.entity.project)} extends a non-interactive entity`;case be.ExtendsIncompatibleEntities:return`${ce(s.entity,s.entity.project)} extends incompatible entities`;case be.ImplementingNonAbstractEntity:return`${ce(s.entity,s.entity.project)} implements a non-template entity`;case be.ImplementsIncompatibleEntities:return`${ce(s.entity,s.entity.project)} implements incompatible entities`;case be.LackingReturnStatementOnSomeBranches:return`${ce(s.entity,s.entity.project)} has branches that don't terminate`;case be.LastCalledEntityMustBeReturnEntity:return`${ce(s.entity,s.entity.project)} must end with a termination node`;case be.MissingRequiredValue:return`${ce(s.entity,s.entity.project)} is missing a required value`;case be.NoPrimaryKeyProperty:return`${ce(s.entity,s.entity.project)} has no primary key property`;case be.NonAbstractExtendingAbstractEntity:return`${ce(s.entity,s.entity.project)} is a non-template entity extending a template entity`;case be.NonStaticExtendingStaticEntity:return`${ce(s.entity,s.entity.project)} is a non-static entity extending a static entity`;case be.NonStaticImplementingStaticEntity:return`${ce(s.entity,s.entity.project)} is a non-static entity implementing a static entity`;case be.StaticExtendingNonStaticEntity:return`${ce(s.entity,s.entity.project)} is a static entity extending a non-static entity`;case be.StaticImplementingNonStaticEntity:return`${ce(s.entity,s.entity.project)} is a static entity implementing a non-static entity`;case be.VariableReadsValueAndInternalCall:return`${ce(s.entity,s.entity.project)} reads a value and has an internal call`;case be.VariableWritesValuesAndInternalCall:return`${ce(s.entity,s.entity.project)} writes values and has an internal call`;case Ce.EmptyName:return`${cs[s.entity.type]} has no name`;case Ce.InvalidObjectStructure:return`${ce(s.entity,s.entity.project)} has an invalid structure`;case Ce.LoopBodyFunctionOverwrite:return`${ce(s.entity,s.entity.project)}'s loop body action overwrites`;case Ce.MethodOverwritesBaseMethodWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites a base action with same implementation`;case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ce.MissingCaller:return`${ce(s.entity,s.entity.project)} is missing a caller`;case Ce.NameAsResolvedCodeNameNotUniqueInScope:return`${ce(s.entity,s.entity.project)} has a name that is not unique in the scope`;case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${ce(s.entity,s.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ce.NameMustStartWithLetterOrUnderscore:return`${ce(s.entity,s.entity.project)} name must start with letter or underscore`;case Ce.NoOverlapWithImplementedSignature:return`${ce(s.entity,s.entity.project)} has no overlap with implemented signature`;case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites a base property with same implementation`;case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${ce(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ce.ReaderWriterIncompatibleDataType:return`${ce(s.entity,s.entity.project)} has a reader/writer with incompatible data type`;case vd.StatusCodeMustBeBetween100And599:return`${ce(s.entity,s.entity.project)} HTTP status code must be between 100 and 599`;case vd.StatusCodeMustBeNumber:return`${ce(s.entity,s.entity.project)} HTTP status code must be a number, between 100 and 599`;case hs.UUIDMustBeString:return`${ce(s.entity,s.entity.project)} UUID must be a string, eg: "${Ap()}"`;case hs.UUIDMustNotContainSpaces:return`${ce(s.entity,s.entity.project)} UUID must not contain spaces, eg: "${Ap()}"`;case hs.UUIDMustBeValidFormat:return`${ce(s.entity,s.entity.project)} UUID must be in a valid format. Eg: "${Ap()}"`;case xn.MustBeUniqueAmongSameEntities:return`${ce(s.entity,s.entity.project)} value must be unique among the same kind`;case xn.StringValueMustNotHaveDashes:return`${ce(s.entity,s.entity.project)} value must not contain dashes`;case xn.StringValueMustNotHaveSpaces:return`${ce(s.entity,s.entity.project)} value must not contain spaces`;default:return`${ce(s.entity,s.entity.project)} Error: ${_E(s.code)}`}}function VE(s){const p=(s||"").startsWith("error-caller-only--");switch(p?s.replace("error-caller-only--",""):s){case Qt.CallIsInHigherScope:return"In a higher scope";case Qt.CallIsInLowerScope:return"In a lower scope";case Qt.CallerIsInHigherScope:return"Caller is in a higher scope";case Qt.CallerIsInLowerScope:return"Caller is in a lower scope";case Qt.CannotBeCalledByChildren:return"Cannot be called by children";case Qt.CannotCallAncestor:return"Cannot call ancestor";case Qt.CannotConnectToItself:return"Cannot connect to itself";case Qt.CannotReadMoreThanOneValue:return"Cannot read more than one value";case Qt.CannotReadValueFromChildren:return"Cannot read value from entities executed after itself";case Qt.CannotWriteValueToAncestor:return"Cannot write value to ancestor";case Tv.Suggestion:return"Suggestion";case Qt.ContinueOrBreakStatementCalledFromOutsideLoop:return"Cannot be called from outside loop";case Qt.DataTypesNotCompatible:return"Data types not compatible";case Qt.ElementInLoopBodyCallingOutsideLoop:return"Cannot call outside loop";case Qt.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees:return"Error cannot be connected to success branch";case Qt.ExecutionsAlreadyConnected:return"Executions already connected";case Qt.IsNotValueReadingEntity:return"Is not a value reading entity";case Qt.IsNotValueWritingEntity:return"Is not a value writing entity";case Qt.NotInScope:return"Not in a compatible scope";case Qt.OtherIncompatibleScopeReason:return"Incompatible scope";case Qt.SiblingInternalCallAlreadyUsedInParentVariable:return"Internal call already used in parent variable";case Qt.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees:return"Success cannot be connected to error branch";case Qt.ValuesAlreadyConnected:return"Values already connected";case Qt.CannotInteractWithInputInVariableWithInternalCalls:return"Cannot interact with input in variable with internal calls";case Qt.CannotInteractWithOutputInVariableWithInternalCalls:return"Cannot interact with output in variable with internal calls";case Tv.CanvasGloballyDisabled:return"Canvas is globally disabled";case Qt.PropertyIsConstantItsValueCantBeReset:return"Property is constant, its value can't be reset";case Qt.CannotWriteValueOfGlobalVariableDeclaration:return"Cannot write value of global variable declaration";case Qt.CannotReSetValueOfConstantVariable:return"Cannot re-set value of constant variable";case Qt.CannotConnectToOwnNode:return"It is part of the same node";case Qt.CalledByErrorMustBePassThroughCallable:return"Called by error must be pass-through callable";case Qt.CannotChangeScopeBecauseItCallsOtherEntities:return"Cannot change scope because it calls other entities in its current scope";case Qt.CannotChangeScopeBecauseItIsAlreadyCalledByOtherEntitiesInDifferentScope:return"Cannot change scope because it is already called by other entities in different scope";case Qt.VariableDeclarationCannotBeMovedToLowerScopeBecauseInstancesUsage:return"Variable declaration cannot be moved to lower scope because its instances are used in the current or different incompatible lower scope";case Qt.CalledBySourceMustBeCallerEntity:return"Not a caller type";case Qt.CalledByErrorCannotBeConnectedToEntitiesCalledByOwnSuccessBranch:return"Already connected to the success branch from a common origin caller";case Qt.CalledBySuccessCannotBeConnectedToEntitiesCalledByOwnErrorBranch:return"Already connected to the error branch from a common origin caller";case Qt.RedundantCall:return"Redundant call. Already connected further down the execution path";case Qt.CannotBeCalledBeforeDeclaration:return"Cannot be called before declaration";case Qt.CannotBeCalledInParallelBranchToDeclaration:return"Cannot be called in parallel branch to declaration";case Qt.CannotBeHigherScopeThanDeclaration:return"Cannot be in a higher scope than declaration";case Qt.CannotCallGlobalVariableDeclaration:return"Cannot call global variable declaration";case Qt.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 Qt.CannotInteractWithInputInGlobalVariableDeclaration:return"Cannot interact with input in global variable declaration";case Qt.IsNotCallableEntity:return"Is not a callable node type";case Qt.IsNotCallerEntity:return"Is not a caller node type";case Qt.IsNotPassThroughCallableEntity:return"Is not a pass-through callable node type that has an error branch";case Qt.NotAConnectableEntityType:return"Not a connectable node type";case Qt.WouldMakeAnEarlierNodeBeCalledBeforeItsDeclaration:return"Would make an earlier node be called before its declaration";default:return Gc(s||"")}}function G1i(s,p){const i=[...s,...p],r=Array.from(new Set(i));return{hasChanged:r.length!==s.length,reasons:r}}function k1i(s,p){const i=s.filter(a=>!p.includes(a));return{hasChanged:i.length!==s.length,reasons:i}}function j1i(s,p){return s.find(i=>i.entity.id===p)||null}function fU(s){return s.filter((p,i)=>s.indexOf(p)===i)}class an{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=RMe-Ug-g$,c=DMe-Eg-I$;p.type===d.Project?(p.x=a,p.y=c):p.metaSync({x:p.x||a,y:p.y||c},i);const e=new an(p,0,null,i);e.calculationEntryPoint=e,e._onlyEntities=r||[],e.ids=["0"];const f=[];e.next(m=>{f.push(...m)}),an.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&&an.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=an.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=uo(this.entity,!0);if(this.entity.type===d.Project){const i=[],r=[],a=[];p.forEach(e=>{if(d.DefinitionEntity===e.type){r.push(e);return}else if(Ft.includes(e.type)){a.push(e);return}i.push(e)});const c=i.sort((e,f)=>{const h=!!Xg(e,f).length,m=uo(e),E=uo(f);return h?0:m.length&&!E.length?-1:!m.length&&E.length?1:0}).filter(e=>!Kc(e).length);this.childEntities=[...r,...a,...c]}else{const i=[],r=[],a=[],c=[],e=[];tr.includes(this.entity.type)&&fD(this.entity).forEach(m=>{if(Mt.includes(m.type)){a.push(m);return}const E=ht(m);i.push(E)}),Dr.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:Mt.includes(h.type)?(a.push(h),!1):sr.includes(h.type)&&!m?(c.push(h),!1):h.type===d.DefinitionEntity?(e.push(h),!1):!0});i.sort((h,m)=>no(h,m)?-1:0),c.sort((h,m)=>no(h,m)?-1:0),a.sort((h,m)=>RV(h,m)?1:RV(m,h)?-1:0),this.childEntities=[...e,...i,...c,...f,...a,...r]}}calculateCardSize(){const p=wMe(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:an.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)=>an.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)=>an.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)=>an.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const p=this.ownEntityPlusBufferArea;return this.children.map(a=>a.fullBranchArea).reduce((a,c)=>an.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+Eg,right:p.right+Ug}}static filterOutRepeatedAreas(p){return p.filter((i,r)=>p.indexOf(i)===r)}getEarliestId(p,i){const r=p.split("-"),a=i.split("-");return r.length<a.length?p:r.length>a.length?i:r.reduce((e,f,h)=>f<a[h]?p:i,p)}getEarliestLevel(){return this.ids.reduce((r,a)=>this.getEarliestId(r,a),this.ids[0]).split("-").length}countColumns(){let p=0;if(this!==this.calculationEntryPoint)p++;else return p;if(!this.parents.length)return p;const r=this.parents.reduce((a,c)=>c.getEarliestLevel()>a.getEarliestLevel()?c:a,this.parents[0]).countColumns();return p+=r,p}getLatestId(p,i){if(p===i)return p;const r=p.split("-"),a=i.split("-");return r.length<a.length?i:r.length>a.length?p:r.reduce((e,f,h)=>f>a[h]?p:i,p)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((r,a)=>this.getLatestId(r,a),this.ids[0]).split("-").length}smoothPosition(){const p=this.flattenSiblings();if(!p.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(r=>{r!==this.calculationEntryPoint&&r.shiftDownAlone(i)})}else if([...Ft].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=p.filter(r=>!this.parents.includes(r));i.length?i.every(a=>{const c=this.countColumns(),e=a.countColumns();return c>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(p,i){if(p.includes(this))return p;this.move(this.entity,{y:this.entity.y+i});let r=[...p,this];return this.children.forEach(a=>{if(an.getEarliestParentInChain(a)!==this)return;const e=j1i(r,a.entity.id);r=an.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=an.filterOutRepeatedAreas([...this.flattenSiblings(),...p]);an.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+bf,h={top:f,left:e.left,bottom:f,right:e.right};return an.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(p.bottom-p.top)/2-bf;this.shiftDownAlone(r)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const p=this.children.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+bf,h={top:f,left:e.left,bottom:f,right:e.right};return an.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(p.bottom-p.top)/2-bf;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 fU(p)}getLowerAreas(){const p=this.getLowerSiblings(),i=this.parents.reduce((r,a)=>[...r,...a.getLowerAreas()],[]);return fU([...p,...i])}adjustVerticallyToAvoidOverlaps(p=[]){const r=an.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(_=>Xg(this.entity,_.entity))).filter(_=>_.id!==this.entity.id).map(_=>this.findAreaFromEntity(_)).filter(_=>!!_),E=this.getFullAreaUntilAny(m),b=r.getFullAreaUntilAny(m),A=e.reduce((_,P)=>P===this||P.fullBranchArea.left!==E.left?_:Math.max(_,P.fullBranchArea.bottom),b.bottom);if(E.top<A){const _=A-E.top+Eg;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 an(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 U1i(s,p,i={}){var c;const r=J.YieldTracker.from(i),a=[];console.log("Generating layout for project...");for(const e of s.instancesList){if(s.diggestedBuiltInBaseEntitiesIds.has(e.id)||!xf.includes(e.type)||((c=ht(e))==null?void 0:c.id)!==e.id)continue;let f=Ut(e,s);if(!f){console.log("No top scope owner for instance: ",e," in project: ",s);continue}if(!(Ft.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==s;)f=f.parent,Ft.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,p==null||p.add(e,H.Updated),a.push(e),await r.tick()}}an.autoGenerateLayout(s,p,a)}async function F1i(s,p,i={}){const r=J.YieldTracker.from(i),a=[],c=[s,...ft(s)].map(e=>ht(e)).filter(Boolean);for(const e of c){if(s.project.diggestedBuiltInBaseEntitiesIds.has(e.id))continue;let f=Ut(e,s.project);if(f&&!(Ft.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==s.project;)f=f.parent,Ft.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,p==null||p.add(e,H.Updated),a.push(e),await r.tick()}}an.autoGenerateLayout(s.project,p,a)}async function K1i(s,p,i={}){const r=J.YieldTracker.from(i),a=[],c=new Set;AKe(p,{shallowMissingActivesError:!0,excludeAffected:!0}).forEach(m=>{var b;if((!m.x||!m.y)&&!c.has(m.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(m.id)&&(a.push(m),c.add(m.id)),fo(m,s)){const A=ht(m);A&&!c.has(A.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(A.id)&&(a.push(A),c.add(A.id))}if(tr.includes(m.type)){const A=m;[A,...ft(A)].forEach(P=>{const V=ht(P);V&&!c.has(V.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(V.id)&&(a.push(V),c.add(V.id))})}m.type===d.DefinitionEntity&&m.methods.forEach(A=>{ft(A).forEach(P=>{const V=ht(P);V&&!c.has(V.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(V.id)&&(a.push(V),c.add(V.id))})}),((b=m.parent)==null?void 0:b.type)===d.Project&&(a.push(m),c.add(m.id),tr.includes(m.type)&&ft(m).forEach(P=>{const V=ht(P);V&&!c.has(V.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(V.id)&&(a.push(V),c.add(V.id))}))});let f=[];for(const m of a)s.diggestedBuiltInBaseEntitiesIds.has(m.id)||(m.x=0,m.y=0,p==null||p.add(m,H.Updated),f.push(m),await r.tick());f=C(f),an.autoGenerateLayout(s,p,f);const h=C([...f,...s.variableDeclarations,...s.variableInstances,...s.loops,...s.conditions,...s.operations,...s.searches]).filter(m=>m.x===0||m.y===0);an.autoGenerateLayout(s,p,h)}var BT=(s=>(s.Amazon="amazon",s.Google="google",s.Microsoft="microsoft",s))(BT||{}),Ir=(s=>(s.RelationalDatabase="relational-database",s.CompiledLocalCodebase="compiled-local-codebase",s.CloudHostedCodebase="cloud-hosted-codebase",s.HttpApi="http-api",s.HttpEndpoint="http-endpoint",s.ServerlessFunction="serverless-function",s.CronJob="cron-job",s.AWSTenantAccount="aws-tenant-account",s))(Ir||{}),Y_=(s=>(s.Post="post",s.Get="get",s.Acknowledgement="acknowledgment",s.Progress="progress",s.Error="error",s.Complete="complete",s))(Y_||{}),Tf=(s=>(s.Queued="queued",s.Running="running",s.Success="success",s.Failed="failed",s.CleanedUp="cleaned-up",s.Skipped="skipped",s.AbortedByUser="aborted-by-user",s.UnrecoverableFailure="unrecoverable-failure",s.Reverted="reverted",s.UnpublishingStarted="unpublishing-started",s.Unpublished="unpublished",s))(Tf||{}),J_=(s=>(s.Queued="queued",s.Running="running",s.Success="success",s.Failed="failed",s.CleanedUp="cleaned-up",s.UnrecoverableFailure="unrecoverable-failure",s.Reverted="reverted",s.UnpublishingStarted="unpublishing-started",s.Unpublished="unpublished",s))(J_||{}),Zt=(s=>(s.ProjectNotFound="project-not-found",s.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",s.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",s.DeploymentCompleted="deployment-completed",s.DeploymentStarted="deployment-started",s.DeploymentFailed="deployment-failed",s.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",s.RequestPayloadValidationFailed="request-payload-validation-failed",s.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",s.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",s.ProjectAlreadyBeingPublished="project-already-being-published",s.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",s.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",s.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",s.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",s.CreatingNewRelationalDatabase="creating-new-relational-database",s.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",s.RelationalDatabaseAlreadyExists="relational-database-already-exists",s.RelationalDatabaseDeletionStarted="relational-database-deletion-started",s.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",s.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",s.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",s.HttpApiDeploymentStarted="http-api-deployment-started",s.HttpApiDeploymentCompleted="http-api-deployment-completed",s.HttpApiDeploymentFailed="http-api-deployment-failed",s.CreatingNewHttpApi="creating-new-http-api",s.HttpApiAlreadyExists="http-api-already-exists",s.HttpApiDeletionStarted="http-api-deletion-started",s.HttpApiDeletionCompleted="http-api-deletion-completed",s.HttpApiDeletionFailed="http-api-deletion-failed",s.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",s.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",s.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",s.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",s.BundlingCodebaseForDownload="bundling-codebase-for-download",s.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",s.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",s.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",s.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",s.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",s.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",s.CodeCompilationStarted="code-compilation-started",s.CodeCompilationCompleted="code-compilation-completed",s.CodeCompilationFailed="code-compilation-failed",s.BundleCodebaseStarted="bundle-codebase-started",s.BundleCodebaseCompleted="bundle-codebase-completed",s.BundleCodebaseFailed="bundle-codebase-failed",s.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",s.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",s.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",s.MigrateRelationalDatabaseStarted="migrate-relational-database-started",s.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",s.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",s.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",s.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",s.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",s.ExecutePublicationCompletedEventTimedOut="execute-publication-completed-event-timed-out",s.AWSTenantAccountProvisioningStarted="aws-tenant-account-provisioning-started",s.AWSTenantAccountProvisioningCompleted="aws-tenant-account-provisioning-completed",s.AWSTenantAccountProvisioningFailed="aws-tenant-account-provisioning-failed",s))(Zt||{}),eo=(s=>(s.CodeCompilation="code-compilation",s.RelationalDatabaseDeployment="relational-database-deployment",s.RelationalDatabaseDeletion="relational-database-deletion",s.HttpApiDeployment="http-api-deployment",s.HttpApiDeletion="http-api-deletion",s.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",s.BundleCodebase="bundle-codebase",s.MigrateRelationalDatabase="migrate-relational-database",s.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",s.ExecutePublicationCompletedEvent="execute-publication-completed-event",s.CodebaseCleanup="codebase-cleanup",s.AWSTenantAccountProvisioning="aws-tenant-account-provisioning",s))(eo||{});Ir.CloudHostedCodebase,Ir.HttpApi,Ir.RelationalDatabase,Ir.CloudHostedCodebase,Ir.CloudHostedCodebase,Ir.RelationalDatabase,Ir.CloudHostedCodebase,Ir.CloudHostedCodebase;function OMe(s){return`project-${s}-http-api`}function $1(s){return`entity-${s}-database`}class _Me{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",Tf.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 VMe=(s=>(s.Ready="ready",s.Provisioning="provisioning",s.Queued="queued",s.ProvisioningFailed="provisioning-failed",s.Deleting="deleting",s.DeletingFailed="deleting-failed",s.Deleted="deleted",s))(VMe||{});class kc{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 q1i extends kc{constructor(i,r,a){super(i,Ir.HttpEndpoint,a);R(this,"resourceType",Ir.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=$1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class S1i extends kc{constructor(i,r,a){super(i,Ir.ServerlessFunction,a);R(this,"resourceType",Ir.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=$1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class PMe extends kc{constructor(i,r,a){super(i,Ir.HttpApi,a);R(this,"resourceType",Ir.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=OMe(this.publicationRun.project.id),this.resourceId}}class NMe extends kc{constructor(i,r,a){super(i,Ir.RelationalDatabase,a);R(this,"resourceType",Ir.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=$1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class xMe extends kc{constructor(i,r){super(i,Ir.CloudHostedCodebase,r);R(this,"resourceType",Ir.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 $Me extends kc{constructor(i,r){super(i,Ir.CompiledLocalCodebase,r);R(this,"resourceType",Ir.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 Z1i extends kc{constructor(i,r){super(i,Ir.AWSTenantAccount,r);R(this,"resourceType",Ir.AWSTenantAccount);R(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`aws-tenant-account--${this.publicationRun.project.id}`,this.resourceId}}class H1i{constructor(p,i){R(this,"id");R(this,"projectAutoIncrementPublicationCount");R(this,"projectPublishedSemanticVersion");R(this,"envIdentifier");R(this,"projectVersion");R(this,"projectBranchId");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",se.PublicationRun);R(this,"extensionsRegistry");this.id=p.id,this.projectAutoIncrementPublicationCount=p.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=p.projectPublishedSemanticVersion,this.envIdentifier=p.envIdentifier,this.projectVersion=p.projectVersion,this.projectBranchId=p.projectBranchId,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(Ir.CompiledLocalCodebase,new $Me(this,BT.Amazon)),this.implicitGlobalResources.set(Ir.CloudHostedCodebase,new xMe(this,BT.Amazon));const p=this.project.entities.filter(r=>ui(r,Ae.HTTP_ENDPOINT)),i=this.project.entities.filter(r=>ui(r,Ae.RELATIONAL_DATABASE));if(i.length&&i.forEach(r=>{const a=new NMe(this,[r],BT.Amazon);this.explicitResources.set(a.resourceId,a)}),p.length){const r=new PMe(this,p,BT.Amazon);this.explicitResources.set(r.resourceId,r)}}setSteps(p,i){p.forEach(r=>{this.addStep(r,i)}),this.editor.events.emit(Zt.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 _Me(p.stepType,p.id,p.resourceType,p.status,r,p.index,i,this,null);this.steps.push(c)}}onUpdate(p){var i;if(J.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===Y_.Error?(this.finalStatus=J_.Failed,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-error",p)):p.type===Y_.Complete&&(this.finalStatus=J_.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 m$(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(se.PublicationRun),this.extensionsRegistry}}function W1i(s){switch(s){case eo.CodeCompilation:return"Code generation";case eo.RelationalDatabaseDeployment:return"Database creation";case eo.HttpApiDeployment:return"HTTP gateway creation";case eo.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case eo.BundleCodebase:return"Bundle code";case eo.MigrateRelationalDatabase:return"Database structure migration";case eo.BusinessLogicCodebaseDeployment:return"Update servers with new code";case eo.CodebaseCleanup:return"Code cleanup";case eo.HttpApiDeletion:return"HTTP gateway deletion";case eo.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function z1i(s){switch(s){case Zt.DeploymentCompleted:return"Successfully published";case Zt.DeploymentStarted:return"Publication started";case Zt.DeploymentFailed:return"Publication failed";case Zt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case Zt.RequestPayloadValidationFailed:return"Request payload validation failed";case Zt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case Zt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case Zt.RelationalDatabaseDeploymentStarted:return"Database creation started";case Zt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case Zt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case Zt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case Zt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case Zt.RelationalDatabaseAlreadyExists:return"Database already exists";case Zt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case Zt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case Zt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case Zt.CreatingNewHttpApi:return"Creating new HTTP gateway";case Zt.HttpApiAlreadyExists:return"HTTP gateway already exists";case Zt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case Zt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case Zt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case Zt.BundlingCodebaseForDownload:return"Bundling code for download";case Zt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case Zt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case Zt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case Zt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case Zt.CodeCompilationStarted:return"Code generation started";case Zt.CodeCompilationCompleted:return"Code generation completed";case Zt.CodeCompilationFailed:return"Code generation failed";case Zt.BundleCodebaseStarted:return"Code bundling started";case Zt.BundleCodebaseCompleted:return"Code bundling completed";case Zt.BundleCodebaseFailed:return"Code bundling failed";case Zt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case Zt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case Zt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case Zt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case Zt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case Zt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case Zt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case Zt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case Zt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case Zt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case Zt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case Zt.ProjectNotFound:return"Project not found";case Zt.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case Zt.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case Zt.HttpApiDeletionStarted:return"HTTP gateway deletion started";case Zt.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case Zt.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case Zt.RelationalDatabaseDeletionStarted:return"Database deletion started";case Zt.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case Zt.RelationalDatabaseDeletionFailed:return"Database deletion failed";case Zt.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var LMe=(s=>(s.NO_LOGIC="NO_LOGIC",s.NO_NAME="NO_NAME",s.NO_CHANGES="NO_CHANGES",s.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",s))(LMe||{});function Y1i(s){switch(s){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 J1i(s){switch(s){case Ir.RelationalDatabase:return"Relational database";case Ir.HttpEndpoint:case Ir.HttpApi:return"HTTP endpoints";case Ir.ServerlessFunction:case Ir.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function Q1i(s){switch(s){case Tf.Running:return"In progress";case Tf.Failed:return"Failed";case Tf.Success:return"Succeeded";case Tf.Skipped:return"Skipped";case Tf.Queued:default:return"Queued"}}function BMe(s){var r;if(!ui(s,Ae.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=re["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(s.type===d.BuiltInBaseEntity?ui(s,Ae.EXTERNAL_INTEGRATION_CONNECTION)&&(p=Q_(s.name)):s.type===d.DefinitionEntity&&s.implements.forEach(a=>{if(ui(a,Ae.EXTERNAL_INTEGRATION_CONNECTION)){const c=Q_(a==null?void 0:a.name);if(c)return p=c,!0}}),!p){const a=s.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 X1i(s){return mTe[s]}function Q_(s){return s.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?s.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function MMe(s){if(s.type!==d.ActionDescriptor&&s.type!==d.Operation)throw new Error("Only ActionDescriptorState or OperationState can be used to resolve an external integration ID");if(s.type===d.ActionDescriptor){const p=s;if(p.id.startsWith("external-integration--"))return p.id.split("--")[1]}if(s.type===d.Operation){const p=s.declaration;if(Object.values(Ti).includes(p.id))return p.id.split("--")[1]||null}return null}function eDi(s){if(!s)throw new Error("The integrationName parameter is required to resolve the base built-in name.");return Object.values(Ae).find(i=>!!(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")&&i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===s.toLowerCase()))||null}function tDi(s){return s.type===d.BuiltInBaseEntity||s.type===d.DefinitionEntity?BMe(s):s.type===d.ActionDescriptor||s.type===d.Operation?MMe(s):null}function GMe(s){var a,c,e;if(!ui(s,Ae.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=pKe(s,Ae.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const r=re["built-in-base-entity"][i.id].properties.connectionId.id;if(s.type===d.BuiltInBaseEntity){if(ui(s,Ae.EXTERNAL_INTEGRATION_CONNECTION)){const f=s.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(s.type===d.DefinitionEntity){const f=s.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=s.extends)==null?void 0:c.type)===d.DefinitionEntity)return GMe(s.extends);p=(e=f==null?void 0:f.getDefaultValue())==null?void 0:e.value}return p}async function kMe(s,p={}){var f;const i=J.YieldTracker.from(p),a=[...Aa(s),...Dn(s),...D$(s),...ga(s),...w$(s)],c=YE(s);a.push(...c);const e=qt(s.errors,a);await i.tick();for(const h of s.inputs)await h.validateAsync({tracker:i});for(const h of s.outputs)await h.validateAsync({tracker:i});for(const h of s.internalCalls)await h.validateAsync({tracker:i});return await((f=s.dataType)==null?void 0:f.validateAsync({tracker:i})),e}function jMe(s){var a;(a=s.dataType)==null||a.validate(),s.inputs.forEach(c=>c.validate()),s.outputs.forEach(c=>c.validate()),s.internalCalls.forEach(c=>c.validate());const i=[...Aa(s),...Dn(s),...D$(s),...ga(s),...w$(s)],r=YE(s);return i.push(...r),qt(s.errors,i)}function D$(s,p){const r=[...s.project.getVariableDeclarations()].filter(a=>a.id!==s.id);return QE(s,[ir],r,p)}function w$(s){const p=[];if(s.parent!==s.project)return p;if(s.catchesError){const i=Rt({id:`${s.id}--${Ce.GlobalVariableDeclarationCannotCatchError}`,message:`${cs[s.type].singular} "${ce(s,s.project)}" with id "${s.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:ve.Error,code:Ce.GlobalVariableDeclarationCannotCatchError,entity:s});p.push(i.error)}if(s.errorCalls.length){const i=Rt({id:`${s.id}--${Ce.GlobalVariableDeclarationCannotCallOnError}`,message:`${cs[s.type].singular} "${ce(s,s.project)}" with id "${s.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:ve.Error,code:Ce.GlobalVariableDeclarationCannotCallOnError,entity:s});p.push(i.error)}if(s.calledBy.length){const i=Rt({id:`${s.id}--${Ce.GlobalVariableDeclarationCannotBeCalled}`,message:`${cs[s.type].singular} "${ce(s,s.project)}" with id "${s.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:ve.Error,code:Ce.GlobalVariableDeclarationCannotBeCalled,entity:s});p.push(i.error)}return[]}const iDi=Object.freeze(Object.defineProperty({__proto__:null,validate:jMe,validateAsync:kMe,validateGlobalVariableDeclaration:w$,validateVariableDeclarationName:D$},Symbol.toStringTag,{value:"Module"}));async function UMe(s,p={}){const i=J.YieldTracker.from(p),a=[...Aa(s),...Dn(s),...ga(s),...sd(s),...KMe(s)],c=YE(s);a.push(...c);const e=qt(s.errors,a);await i.tick();for(const f of s.inputs)await f.validateAsync({tracker:i});for(const f of s.outputs)await f.validateAsync({tracker:i});for(const f of s.internalCalls)await f.validateAsync({tracker:i});return e}function FMe(s){s.inputs.forEach(a=>a.validate()),s.outputs.forEach(a=>a.validate()),s.internalCalls.forEach(a=>a.validate());const i=[...Aa(s),...Dn(s),...ga(s)],r=YE(s);return i.push(...r),qt(s.errors,i)}function KMe(s){const p=[],i=s.declaration.constant;if(i&&s.readsValue){const r=Rt({id:`${s.id}--${be.ValueReadingOverridesConstantVariable}`,message:`The '${s.type}' entity "${ce(s,s.project)}" with id "${s.id}" is a constant variable whose value cannot be overriden, but reads a value.`,severity:ve.Error,code:be.ValueReadingOverridesConstantVariable,entity:s});p.push(r.error)}if(i&&s.defaultValue){const r=Rt({id:`${s.id}--${be.DefaultValueOverridesConstantVariable}`,message:`The '${s.type}' entity "${ce(s,s.project)}" with id "${s.id}" is a constant variable whose value cannot be overridden, but has a 'defaultValue'.`,severity:ve.Error,code:be.DefaultValueOverridesConstantVariable,entity:s});p.push(r.error)}return p}function sd(s){var h;const p=[],i=s.declaration;if((i==null?void 0:i.id)===((h=s.parent)==null?void 0:h.id)||!s.calledBy.length&&!s.successCalls.length&&!s.errorCalls.length&&s.usedInternalCalls.length)return p;const r=ft(s),a=ft(i);!!r.find(m=>m.id===i.id)&&p.push(Rt({id:`${s.id}--${be.CalledBeforeDeclaration}`,code:be.CalledBeforeDeclaration,severity:ve.Error,message:`Entity of type "${s.type}" with id "${s.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:s}).error);const e=Ut(i,s.project),f=Ut(s,s.project);if((e==null?void 0:e.type)!==d.Project&&e&&f){const m=!!a.find(E=>E.id===s.id);if((e==null?void 0:e.id)===(f==null?void 0:f.id))m||p.push(Rt({id:`${s.id}--${be.CalledInParallelBranchToDeclaration}`,code:be.CalledInParallelBranchToDeclaration,severity:ve.Error,message:`Entity of type "${s.type}" with id "${s.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:s}).error);else if(Ka(f,e,s.project))p.push(Rt({id:`${s.id}--${be.HigherScopeThanDeclaration}`,code:be.HigherScopeThanDeclaration,severity:ve.Error,message:`Entity of type "${s.type}" with id "${s.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:s}).error);else if(Ka(e,f,s.project)){let E=f;for(;E.id!==e.id&&E.id!==s.project.id;){const A=Ut(E,s.project);if(A.id===e.id)break;E=A}const b=zm(E);if(b){const _=!!ft(b).find(V=>V.id===i.id),P=!!a.find(V=>V.id===b.id);_?p.push(Rt({id:`${s.id}--${be.CalledBeforeDeclaration}`,code:be.CalledBeforeDeclaration,severity:ve.Error,message:`Entity of type "${s.type}" with id "${s.id}" is called before its 'variable-declaration' '${i.name}' with id "${i.id}".
|
package/dist/index.d.ts
CHANGED
|
@@ -22357,6 +22357,7 @@ export declare enum BaseValueDescriptorIds {
|
|
|
22357
22357
|
|
|
22358
22358
|
export declare interface IExecutionCallbackContext {
|
|
22359
22359
|
detached: boolean;
|
|
22360
|
+
execution?: Execution;
|
|
22360
22361
|
}
|
|
22361
22362
|
|
|
22362
22363
|
export declare interface IExecutionClient {
|
package/dist/index.js
CHANGED
|
@@ -126132,7 +126132,8 @@ class uT extends Wy {
|
|
|
126132
126132
|
...Fu,
|
|
126133
126133
|
...a
|
|
126134
126134
|
}, e = {
|
|
126135
|
-
detached: !1
|
|
126135
|
+
detached: !1,
|
|
126136
|
+
execution: this
|
|
126136
126137
|
};
|
|
126137
126138
|
switch (i.type) {
|
|
126138
126139
|
case d.Condition: {
|
|
@@ -126325,7 +126326,8 @@ class uT extends Wy {
|
|
|
126325
126326
|
...Fu,
|
|
126326
126327
|
...r
|
|
126327
126328
|
}, e = {
|
|
126328
|
-
detached: !1
|
|
126329
|
+
detached: !1,
|
|
126330
|
+
execution: this
|
|
126329
126331
|
};
|
|
126330
126332
|
if (!this.hasEntity(i) || this.hasSkipped(i))
|
|
126331
126333
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elyx-code/project-logic-tree",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6966",
|
|
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",
|