@elyx-code/project-logic-tree 0.0.7105 → 0.0.7106

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -69,7 +69,7 @@ Children:`,e.map(T=>`${T.type} "${he(T,this.project)}"`).join(", ")),e.forEach(T
69
69
  ${m.error?`Error: ${JSON.stringify((T=m.error.value)==null?void 0:T.value,null,2)}`:`Value: ${JSON.stringify((A=(b=m.result)==null?void 0:b.value)==null?void 0:A.value,null,2)}`}`),this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(m),await((w=e.onEntityExecuted)==null?void 0:w.call(e,i,m,f)),m.value===K.Success){const I=(i.successCalls||i.calls||[]).filter(B=>this.hasEntity(B));(i.errorCalls||[]).forEach(B=>{this.skip(B)});let $=[];const L=(await Promise.all(I.map(B=>this.schedule(B,[],e)))).filter(B=>!!B),x=L.filter(B=>!!B).find(B=>B.value===K.CaughtError||B.value===K.Return||B.value===K.Break||B.value===K.Continue);return x||($=[...$,...L],m)}else if(m.value===K.CaughtError||m.value===K.ConditionNotMet){const I=(i.errorCalls||[]).filter(B=>this.hasEntity(B));(i.successCalls||i.calls||[]).forEach(B=>{this.skip(B)});let $=[];const L=(await Promise.all(I.map(B=>this.schedule(B,[],e)))).filter(B=>!!B),x=L.filter(B=>!!B).find(B=>B.value===K.CaughtError||B.value===K.UnhandledError||B.value===K.Return||B.value===K.Break||B.value===K.Continue);return x||($=[...$,...L],m)}else{if(m.value===K.UnhandledError)return this.executing.forEach(I=>{this.skip(I)}),this.scheduled.forEach(I=>{this.skip(I)}),Cr.includes(m.entity.type)&&Lt(m.entity).forEach(I=>{this.skip(I)}),m;if(m.value===K.Return)return m;if(m.value===K.Break)return m;if(m.value===K.Continue)return m}return m}async execute(i={},r=[]){console.log(`%cexecute -> [Execution] initialExternalValues:
70
70
  ${r.map(e=>{var f,h,m;return`${(f=e.valueOwner)==null?void 0:f.type} (${(h=e.valueOwner)==null?void 0:h.id}) "${he(e.valueOwner,this.project)}": ${JSON.stringify((m=e.value)==null?void 0:m.value,null,2)}`}).join(`
71
71
  `)}
72
- `,"color: #3b82f6; font-weight: bold;");const a={..._c,...i};this.state="running";const c=this.project.activeExecution;this.project.activeExecution=this;try{const e=await this.executeBranch(this.entryPoint,a,r);return this.state="finished-success",e}finally{this.project.activeExecution=c}}getExecutionLevels(){const i=[];let r=this;for(;r;){const a=r.entryPoint,c=a?he(a,this.project):"Unknown",e=a?a.type:"unknown";i.unshift(`${e} "${c}"`),r=r.parentExecution}return i.join(" -> ")}logBeforeExecution(i,r,a){var T,b;const c=this.getExecutionLevels(),e=hi(r,this.project),f=e?he(e,this.project):"Project",h=e?e.type:"Project",m=he(r,this.project);if(console.log(`%c[Execution: ${c}] %c[Scope: ${h} "${f}"]`,"color: #3b82f6; font-weight: bold;","color: #10b981; font-weight: bold;"),console.log(`%c${i} (${r.type}) -> [${m}]%c Inputs:`,"font-weight: bold; color: #224370ff;","color: #9ca3af;"),a.length?a.forEach(A=>{var I,C,$;const w=he(A.valueOwner,this.project);console.log(` %c${(I=A.valueOwner)==null?void 0:I.type}%c (${(C=A.valueOwner)==null?void 0:C.id}) %c"${w}"%c:`,"color: #8b5cf6; font-weight: bold;","color: #9ca3af;","color: #10b981; font-weight: bold;","color: #667a9bff;",($=A.value)==null?void 0:$.value)}):console.log(" (none)"),r.type===d.VariableInstance||r.type===d.VariableDeclaration){const A=ln(r),w=Cp(A,this.valueResolutionContext);console.log(` %cExisting Value%c of [${he(A,this.project)}]:`,"color: #ec4899; font-weight: bold;","color: #667a9bff;",(T=w==null?void 0:w.value)==null?void 0:T.value)}if(r.type===d.InternalCall){const A=r.parent;if(A){const w=Cp(A,this.valueResolutionContext);console.log(` %cParent Variable%c [${he(A,this.project)}] Value:`,"color: #f59e0b; font-weight: bold;","color: #667a9bff;",(b=w==null?void 0:w.value)==null?void 0:b.value)}}}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=re.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 r;return this.entities.includes(i)?!0:i.parent&&((r=i.parent)==null?void 0:r.id)!==(i==null?void 0:i.id)?this.hasEntity(i.parent):!1}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 g$i(s){var u,i;if(s.isList)return"list";if(((u=s.entity)==null?void 0:u.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 Il={[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 OB(s){const u=pC(s);if(!u){const r=a0(s);if(r.includes(Ae.HTTP_ENDPOINT))return"HTTP endpoint";if(r.includes(Ae.PERSISTED_ENTITY))return"SQL database table";if(r.includes(Ae.CRON_JOB))return"Scheduled execution";if(r.includes(Ae.RELATIONAL_DATABASE))return"Relational database";if(r.includes(Ae.CONTAINER_COMPUTE_ENTITY))return"Container compute";if(r.includes(Ae.SHARED_DRIVE_ENTITY))return"Shared files drive";if(r.includes(Ae.COMPUTE_ENTITY))return"Compute";if(r.includes(Ae.AIRTABLE_AUTH_CONNECTION))return"Airtable account connection";if(r.includes(Ae.GOOGLE_AUTH_CONNECTION))return"Google account connection";if(r.includes(Ae.SLACK_AUTH_CONNECTION))return"Slack account connection";if(r.includes(Ae.ATLASSIAN_AUTH_CONNECTION))return"Atlassian account connection";if(r.includes(Ae.JIRA_AUTH_CONNECTION))return"Jira account connection";if(r.includes(Ae.MICROSOFT_AUTH_CONNECTION))return"Microsoft account connection";if(r.includes(Ae.OPENAI_AUTH_CONNECTION))return"OpenAI account connection";if(r.includes(Ae.EXTERNAL_INTEGRATION_CONNECTION))return"External account connection"}if(u){let r="Extension of "+he(u,u.project)+" entity",a=wl(r);const c=a0(s);return c.includes(Ae.HTTP_ENDPOINT)?"HTTP endpoint"+(a?", "+a:""):c.includes(Ae.PERSISTED_ENTITY)?"SQL database table"+(a?", "+a:""):c.includes(Ae.CRON_JOB)?"Scheduled execution"+(a?", "+a:""):c.includes(Ae.RELATIONAL_DATABASE)?"Relational database"+(a?", "+a:""):c.includes(Ae.CONTAINER_COMPUTE_ENTITY)?"Container compute"+(a?", "+a:""):c.includes(Ae.SHARED_DRIVE_ENTITY)?"Shared files drive"+(a?", "+a:""):c.includes(Ae.COMPUTE_ENTITY)?"Compute"+(a?", "+a:""):c.includes(Ae.AIRTABLE_AUTH_CONNECTION)?"Airtable account connection"+(a?", "+a:""):c.includes(Ae.GOOGLE_AUTH_CONNECTION)?"Google account connection"+(a?", "+a:""):c.includes(Ae.SLACK_AUTH_CONNECTION)?"Slack account connection"+(a?", "+a:""):c.includes(Ae.ATLASSIAN_AUTH_CONNECTION)?"Atlassian account connection"+(a?", "+a:""):c.includes(Ae.JIRA_AUTH_CONNECTION)?"Jira account connection"+(a?", "+a:""):c.includes(Ae.MICROSOFT_AUTH_CONNECTION)?"Microsoft account connection"+(a?", "+a:""):c.includes(Ae.OPENAI_AUTH_CONNECTION)?"OpenAI account connection"+(a?", "+a:""):c.includes(Ae.EXTERNAL_INTEGRATION_CONNECTION)?"External account connection"+(a?", "+a:""):r}let i="";return s.abstract&&(i="Template "),s.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function mqe(s){return s.parent.type===d.DefinitionEntity||s.parent.type===d.InstalledProject?"Internal action of "+he(s.parent,s.project):s.parent.type===d.Loop?"Action repeated on every iteration":"Internal action of entity"}function _B(s){return zM(s)?mqe(s):"Custom trigger"}function I$i(s){var u;switch(s.type){case d.DefinitionEntity:return OB(s);case d.FunctionDeclaration:return _B(s)}return(u=Il[s.type])==null?void 0:u.singular}function R$i(s){var u;switch(s.type){case d.DefinitionEntity:return OB(s);case d.FunctionDeclaration:return _B(s)}return(u=Il[s.type])==null?void 0:u.singular}const PB=4e4,NB=280,w$i=300,xB=65,jy=32,km=39,KE=26,Tqe=49,SE=44,D$i=35,tR=52,_D=10,qs=_D*2,kc=38,iR=90,wR=270,vqe=PB/2+120,Eqe=PB/2+180;function VB(s){let i=jy+SE+kc+_D;const r=[...s.inputs];return r.length&&(i+=qs,r.forEach(()=>{i+=KE})),{height:i,width:280}}function qE(s){var a,c;let i=jy+SE+kc+_D;const r=[...s.inputs];return r.length&&(i+=qs,r.forEach(()=>{i+=KE})),s.andChildrenGroup&&(i+=qs,s.andChildrenGroup.forEach(e=>{i+=qE(e).height})),s.orChildrenGroup&&(i+=qs,s.orChildrenGroup.forEach(e=>{i+=qE(e).height})),(((a=s.declaration)==null?void 0:a.id)===U.condition["condition-group-and"].id||((c=s.declaration)==null?void 0:c.id)===U.condition["condition-group-or"].id)&&(i+=kc),{height:i,width:280}}function bqe(s){var h,m;let i=xB;const r=[];if([d.DefinitionEntity].includes(s.type)){const T=[...s.suggestedProperties||[],...s.properties||[]];T.length&&(i+=qs,T.forEach(b=>{i+=b.static?Tqe:km}))}if([d.DefinitionEntity,d.InstalledProject,d.Loop].includes(s.type)){const T=[...(s==null?void 0:s.suggestedMethods)||[],...s.methods||[],...s.functions||[],...s.body?[s.body]:[]];T.length&&(i+=qs,T.forEach(b=>{const A=VB(b);i+=A.height}))}ni.includes(s.type)?(r.push(...(s.inputs||[]).flatMap(T=>[T])||[]),i+=qs,i+=SE,s.error&&(i+=tR)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(s.type)?(r.push(...s.outputs||[]),s.throws&&(i+=tR)):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)===U.condition["condition-group-and"].id||((m=s.declaration)==null?void 0:m.id)===U.condition["condition-group-or"].id)&&(i+=kc),s.andChildrenGroup&&(i+=qs,s.andChildrenGroup.forEach(T=>{i+=qE(T).height})),s.orChildrenGroup&&(i+=qs,s.orChildrenGroup.forEach(T=>{i+=qE(T).height})));const a=r.length;a&&(i+=a*km,i+=qs);const c=[];if(s.type===d.FunctionDeclaration||s.type===d.GlobalEvent?c.push(...s.inputs||[]):ni.includes(s.type)&&c.push(...s.outputs||[]),vi.includes(s.type)){i+=qs,i+=SE,s.usedInternalCalls.length&&s.usedInternalCalls.forEach(b=>{i+=tR+qs,i+=b.inputs.length*KE,i+=b.outputs.length*KE});const T=s.getDataType(null);(!T||T.canModifyObjectStructure())&&(i+=kc)}s.type===d.Search&&(i+=kc);const e=c.length;return e&&(i+=e*km,i+=qs),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(s.type)&&(i+=kc),{height:i,width:280}}function Aqe(s){let u=0;if(s.parent.type!==d.DefinitionEntity)return{offset:u};const i=s.parent,r=i.methods.findIndex(c=>c.id===s.id);return i.methods.slice(0,r).forEach(c=>{const e=VB(c);u+=e.height}),(i.properties.length||i.suggestedProperties.length)&&(u+=qs,i.suggestedProperties.forEach(()=>{u+=km}),i.properties.forEach(()=>{u+=km})),{offset:u}}function mA(s){return`${s.split("-").map((r,a)=>a===0?r.charAt(0).toUpperCase()+r.slice(1):r.toLowerCase()).join(" ")}.`}function C$i(s){switch(s.code){case Re.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case Re.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case Re.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case Re.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case Re.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case Re.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case Re.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case Ve.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case Ve.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case Re.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case Re.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case Ve.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case Re.NoProperties:return"This entity has no properties, so it doesn't do anything";case Re.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case Re.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case Re.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case Re.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case Re.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case Re.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case Re.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case Re.PropertyImplementsNonAbstact:return"This property implements a non-template property";case Re.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case Re.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case Re.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case Re.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case Re.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case Ve.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case Ve.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case Ve.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case Ve.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case Ve.UnreachableEntity:return"This entity is unreachable";case Re.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case Re.AbstractEntityImplements:return"This template entity implements a non-template entity";case Re.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case Re.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case Re.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case Re.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case Re.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case Re.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case Re.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case Re.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case Re.MissingRequiredValue:return"This action is missing a required value";case Re.NoPrimaryKeyProperty:return"This entity has no primary key property";case Re.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case Re.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case Re.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case Re.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case Re.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case Re.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case Re.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case Ve.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case Ve.EmptyName:return"This entity has no name";case Ve.InvalidObjectStructure:return"This entity has an invalid structure";case Ve.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case Ve.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case Ve.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case Ve.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case Ve.MissingCaller:return"This action is missing a caller";case Ve.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case Ve.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case Ve.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case Ve.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case Ve.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case Ve.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case Ve.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case Ve.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case Vu.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Vu.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case Dl.UUIDMustBeString:return`UUID must be a string, eg: "${Kc()}"`;case Dl.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${Kc()}"`;case Dl.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${Kc()}"`;case Fa.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case Fa.StringValueMustNotHaveDashes:return"This value must not contain dashes";case Fa.StringValueMustNotHaveSpaces:return"This value must not contain spaces";case Fa.ValueMustBeString:return"This value must be a string";case DE.DayOfMonthAndWeekConflict:return"Cron expression cannot have both day of month and day of week";case DE.InvalidCharacters:return"Cron expression has invalid characters";case DE.MustHaveSixFields:return"Cron expression must have six fields";case Re.CalledBeforeDeclaration:return"Called before declaration";case Re.CalledInParallelBranchToDeclaration:return"Cannot call this action in a parallel branch";case Re.DefaultValueOverridesConstantProperty:return"Cannot override constant property";case Re.DefaultValueOverridesConstantVariable:return"Cannot override constant variable";case Re.EmptyGroupCondition:return"Cannot have an empty condition group";case Re.HigherScopeThanDeclaration:return"In higher scope than declaration";case Re.MissingEnumOptions:return"Missing enum options";case Re.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls:return"Current node catches its errors with no further calls which terminates the branch, but the parent trigger requires a returned value";case Re.ValueReadingOverridesConstantProperty:return"Value reading overrides constant property";case Re.ValueReadingOverridesConstantVariable:return"Value reading overrides constant variable";case Ve.GlobalVariableDeclarationCannotBeCalled:return"Global variable declaration cannot be called";case Ve.GlobalVariableDeclarationCannotCallOnError:return"Global variable declaration cannot have error calls";case Ve.GlobalVariableDeclarationCannotCatchError:return"Global variable declaration cannot catch errors";case Ve.InternalCallDeclarationNotFound:return"Internal call declaration not found";case Ve.NameIsForbiddenKeyword:return"The name given is a forbidden keyword";default:return mA(s.code)}}function O$i(s){switch(s.code){case Re.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case Re.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case Re.IncorrectEntityImplementation:return"Incorrect implementation";case Re.IncorrectMethodImplementation:return"Incorrect action implementation";case Re.IncorrectPropertyImplementation:return"Incorrect property implementation";case Re.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case Re.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case Ve.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case Ve.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case Re.MissingMethodImplementation:return"Missing action";case Re.MissingPropertyImplementation:return"Missing property";case Ve.NameNotUniqueInScope:return"Duplicate name";case Re.NoProperties:return"No properties";case Re.NonStaticPropertyInStaticEntity:return"Non-static property";case Re.StaticEntityWithNonStaticProperties:return"Non-static properties";case Re.ReadingFromIncompatibleType:return"Read from different type";case Re.WritingToIncompatibleType:return"Write to different type";case Re.ScopeWithoutLogic:return"No logic";case Re.NonStaticPropertyImplementsStatic:return"Invalid static property";case Re.PropertyImplementsIncompatibleType:return"Incompatible data type";case Re.PropertyImplementsNonAbstact:return"Non-template property";case Re.StaticPropertyImplementsNonStatic:return"Non-static property";case Re.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case Re.VariableHasInputsAndInternalCall:return"Bad internal call";case Re.VariableHasOutputsAndInternalCall:return"Bad internal call";case Re.VariableIsCalledAndHasInternalCall:return"Bad internal call";case Ve.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case Ve.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case Ve.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case Ve.InternalCallParentMissingDataType:return"Parent has no data type";case Ve.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case Ve.UnreachableEntity:return"Unreachable entity";case Re.DisconnectedCallableEntity:return"Disconnected entity";case Re.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case Re.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case Re.InvalidPropertiesCombination:return"Invalid properties combination";case Re.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case Re.ExtendsIncompatibleEntities:return"Extends incompatible entities";case Re.ImplementingNonAbstractEntity:return"Implementing non-template entity";case Re.ImplementsIncompatibleEntities:return"Implements incompatible entities";case Re.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case Re.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case Re.MissingRequiredValue:return"Missing required value";case Re.NoPrimaryKeyProperty:return"No primary key property";case Re.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case Re.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case Re.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case Re.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case Re.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case Re.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case Re.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case Ve.EmptyName:return"Empty name";case Ve.InvalidObjectStructure:return"Invalid object structure";case Ve.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case Ve.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case Ve.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ve.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ve.MissingCaller:return"Missing caller";case Ve.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case Ve.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case Ve.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case Ve.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case Ve.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case Ve.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ve.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ve.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case Vu.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Vu.StatusCodeMustBeNumber:return"HTTP status code must be a number";case Dl.UUIDMustBeString:return"UUID must be a string";case Dl.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case Dl.UUIDMustBeValidFormat:return"UUID must be in a valid format";case Fa.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case Fa.StringValueMustNotHaveDashes:return"This value must not contain dashes";case Fa.StringValueMustNotHaveSpaces:return"This value must not contain spaces";case Re.CalledBeforeDeclaration:return"Called before declaration";case Re.CalledInParallelBranchToDeclaration:return"Cannot call in a parallel branch";case Re.DefaultValueOverridesConstantProperty:return"Cannot override constant";case Re.DefaultValueOverridesConstantVariable:return"Cannot override constant";case Re.EmptyGroupCondition:return"Empty condition group";case Re.HigherScopeThanDeclaration:return"Higher scope than declaration";case Re.MissingEnumOptions:return"Missing enum options";case Re.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls:return"Catches errors with no further calls, but the parent trigger requires a returned value";case Re.ValueReadingOverridesConstantProperty:return"Value reading overrides constant";case Re.ValueReadingOverridesConstantVariable:return"Value reading overrides constant";case Ve.GlobalVariableDeclarationCannotBeCalled:return"Global variable declaration cannot be called";case Ve.GlobalVariableDeclarationCannotCallOnError:return"Global variable declaration cannot have error calls";case Ve.GlobalVariableDeclarationCannotCatchError:return"Global variable declaration cannot catch errors";case Ve.InternalCallDeclarationNotFound:return"Internal call declaration not found";case Ve.NameIsForbiddenKeyword:return"Name is a forbidden keyword";default:return mA(s.code)}}function _$i(s){switch(s.code){case Re.AbstractEntityWithNonAbstractMethods:return`${he(s.entity,s.entity.project)} has non-template actions`;case Re.AbstractEntityWithNonAbstractProperties:return`${he(s.entity,s.entity.project)} has non-template properties`;case Re.IncorrectEntityImplementation:return`${he(s.entity,s.entity.project)} incorrectly implements template`;case Re.IncorrectMethodImplementation:return`${he(s.entity,s.entity.project)} incorrectly implements the template`;case Re.IncorrectPropertyImplementation:return`${he(s.entity,s.entity.project)} incorrectly implements the template`;case Re.AbstractMethodInNonAbstractEntity:return`${he(s.entity,s.entity.project)} can't be a template`;case Re.AbstractPropertyInNonAbstractEntity:return`${he(s.entity,s.entity.project)} can't be a template`;case Ve.MethodOverwritesOtherSiblingWithSameName:return`${he(s.entity,s.entity.project)} overwrites action`;case Ve.PropertyOverwritesOtherSiblingWithSameName:return`${he(s.entity,s.entity.project)} overwrites property`;case Re.MissingMethodImplementation:return`${he(s.entity,s.entity.project)} is missing action`;case Re.MissingPropertyImplementation:return`${he(s.entity,s.entity.project)} is missing property`;case Ve.NameNotUniqueInScope:return`${he(s.entity,s.entity.project)} name is not unique`;case Re.NoProperties:return`${he(s.entity,s.entity.project)} has no properties`;case Re.NonStaticPropertyInStaticEntity:return`${he(s.entity,s.entity.project)} has non-static property`;case Re.StaticEntityWithNonStaticProperties:return`${he(s.entity,s.entity.project)} has non-static properties`;case Re.ReadingFromIncompatibleType:return`${he(s.entity,s.entity.project)} reads from different type`;case Re.WritingToIncompatibleType:return`${he(s.entity,s.entity.project)} writes to different type`;case Re.ScopeWithoutLogic:return`${he(s.entity,s.entity.project)} has no logic`;case Re.NonStaticPropertyImplementsStatic:return`${he(s.entity,s.entity.project)} has invalid static property`;case Re.PropertyImplementsIncompatibleType:return`${he(s.entity,s.entity.project)} has incompatible data type`;case Re.PropertyImplementsNonAbstact:return`${he(s.entity,s.entity.project)} has non-template property`;case Re.StaticPropertyImplementsNonStatic:return`${he(s.entity,s.entity.project)} has non-static property`;case Re.VariableCallsOthersAndHasInternalCall:return`${he(s.entity,s.entity.project)} has bad internal call`;case Re.VariableHasInputsAndInternalCall:return`${he(s.entity,s.entity.project)} has bad internal call`;case Re.VariableHasOutputsAndInternalCall:return`${he(s.entity,s.entity.project)} has bad internal call`;case Re.VariableIsCalledAndHasInternalCall:return`${he(s.entity,s.entity.project)} has bad internal call`;case Ve.InternalCallDeclarationIsInvalidType:return`${he(s.entity,s.entity.project)} has declaration that is not an action`;case Ve.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${he(s.entity,s.entity.project)} has declaration that is not found in parent`;case Ve.InternalCallParentDeclarationEntityInvalidType:return`${he(s.entity,s.entity.project)} has invalid parent declaration type`;case Ve.InternalCallParentMissingDataType:return`${he(s.entity,s.entity.project)}'s parent has no data type`;case Ve.InternalCallDeclarationNotInParentDatatypeEntity:return`${he(s.entity,s.entity.project)} has declaration that is not in parent`;case Ve.UnreachableEntity:return`${he(s.entity,s.entity.project)} is unreachable`;case Re.DisconnectedCallableEntity:return`${he(s.entity,s.entity.project)} is not executed by any entity`;case Re.AbstractEntityImplements:return`${he(s.entity,s.entity.project)} implements a non-template entity`;case Re.AbstractExtendingNonAbstractEntity:return`${he(s.entity,s.entity.project)} extends a non-template entity`;case Re.InvalidPropertiesCombination:return`${he(s.entity,s.entity.project)} has invalid properties combination`;case Re.ExtendingNonInteractiveEntity:return`${he(s.entity,s.entity.project)} extends a non-interactive entity`;case Re.ExtendsIncompatibleEntities:return`${he(s.entity,s.entity.project)} extends incompatible entities`;case Re.ImplementingNonAbstractEntity:return`${he(s.entity,s.entity.project)} implements a non-template entity`;case Re.ImplementsIncompatibleEntities:return`${he(s.entity,s.entity.project)} implements incompatible entities`;case Re.LackingReturnStatementOnSomeBranches:return`${he(s.entity,s.entity.project)} is missing termination on some branches`;case Re.LastCalledEntityMustBeReturnEntity:return`${he(s.entity,s.entity.project)}'s last called entity must be a termination node`;case Re.MissingRequiredValue:return`${he(s.entity,s.entity.project)} is missing a required value`;case Re.NoPrimaryKeyProperty:return`${he(s.entity,s.entity.project)} has no primary key property`;case Re.NonAbstractExtendingAbstractEntity:return`${he(s.entity,s.entity.project)} extends a template entity`;case Re.NonStaticExtendingStaticEntity:return`${he(s.entity,s.entity.project)} extends a static entity`;case Re.NonStaticImplementingStaticEntity:return`${he(s.entity,s.entity.project)} implements a static entity`;case Re.StaticExtendingNonStaticEntity:return`${he(s.entity,s.entity.project)} extends a non-static entity`;case Re.StaticImplementingNonStaticEntity:return`${he(s.entity,s.entity.project)} implements a non-static entity`;case Re.VariableReadsValueAndInternalCall:return`${he(s.entity,s.entity.project)} reads a value and has internal call`;case Re.VariableWritesValuesAndInternalCall:return`${he(s.entity,s.entity.project)} writes values and has internal call`;case Ve.EmptyName:return`${Il[s.entity.type]} has no name`;case Ve.InvalidObjectStructure:return`${he(s.entity,s.entity.project)} has invalid structure`;case Ve.LoopBodyFunctionOverwrite:return`${he(s.entity,s.entity.project)}'s loop body action overwrites an action`;case Ve.MethodOverwritesBaseMethodWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites base action`;case Ve.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ve.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ve.MissingCaller:return`${he(s.entity,s.entity.project)} is missing a caller`;case Ve.NameAsResolvedCodeNameNotUniqueInScope:return`${he(s.entity,s.entity.project)} has a name not unique in the scope`;case Ve.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${he(s.entity,s.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ve.NameMustStartWithLetterOrUnderscore:return`${he(s.entity,s.entity.project)} name must start with letter or underscore`;case Ve.NoOverlapWithImplementedSignature:return`${he(s.entity,s.entity.project)} has no overlap with implemented signature`;case Ve.PropertyOverwritesBasePropertyWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites base property`;case Ve.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ve.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ve.ReaderWriterIncompatibleDataType:return`${he(s.entity,s.entity.project)} has reader/writer with incompatible data type`;case Vu.StatusCodeMustBeBetween100And599:return`${he(s.entity,s.entity.project)} HTTP status code must be between 100 and 599`;case Vu.StatusCodeMustBeNumber:return`${he(s.entity,s.entity.project)} HTTP status code must be a number`;case Dl.UUIDMustBeString:return`${he(s.entity,s.entity.project)} UUID must be a string`;case Dl.UUIDMustNotContainSpaces:return`${he(s.entity,s.entity.project)} UUID must not contain spaces`;case Dl.UUIDMustBeValidFormat:return`${he(s.entity,s.entity.project)} UUID must be in a valid format`;case Fa.MustBeUniqueAmongSameEntities:return`${he(s.entity,s.entity.project)} value must be unique among the same kind`;case Fa.StringValueMustNotHaveDashes:return`${he(s.entity,s.entity.project)} value must not contain dashes`;case Fa.StringValueMustNotHaveSpaces:return`${he(s.entity,s.entity.project)} value must not contain spaces`;default:return`${he(s.entity,s.entity.project)} Error: ${mA(s.code)}`}}function P$i(s){var u,i,r,a;switch(s.code){case Re.AbstractEntityWithNonAbstractMethods:return`${he(s.entity,s.entity.project)} has non-template actions`;case Re.AbstractEntityWithNonAbstractProperties:return`${he(s.entity,s.entity.project)} has non-template properties`;case Re.IncorrectEntityImplementation:return`${he(s.entity,s.entity.project)} incorrectly implements the template entity`;case Re.IncorrectMethodImplementation:return`${he(s.entity,s.entity.project)} incorrectly implements the template action it's based on`;case Re.IncorrectPropertyImplementation:return`${he(s.entity,s.entity.project)} incorrectly implements the template property it's based on`;case Re.AbstractMethodInNonAbstractEntity:return`${he(s.entity,s.entity.project)} is a template action in a non-template entity`;case Re.AbstractPropertyInNonAbstractEntity:return`${he(s.entity,s.entity.project)} is a template property in a non-template entity`;case Ve.MethodOverwritesOtherSiblingWithSameName:return`${he(s.entity,s.entity.project)} overwrites an action in the template entity`;case Ve.PropertyOverwritesOtherSiblingWithSameName:return`${he(s.entity,s.entity.project)} overwrites a property in the template entity`;case Re.MissingMethodImplementation:return`${he(s.entity,s.entity.project)} is missing an action implementation from the template entity`;case Re.MissingPropertyImplementation:return`${he(s.entity,s.entity.project)} is missing a property implementation from the template entity`;case Ve.NameNotUniqueInScope:return`${he(s.entity,s.entity.project)} has a duplicate name in the same scope`;case Re.NoProperties:return`${he(s.entity,s.entity.project)} has no properties, so it doesn't do anything`;case Re.NonStaticPropertyInStaticEntity:return`${he(s.entity,s.entity.project)} has a non-static property in a static entity`;case Re.StaticEntityWithNonStaticProperties:return`${he(s.entity,s.entity.project)} has non-static properties in a static entity`;case Re.ReadingFromIncompatibleType:return`${he(s.entity,s.entity.project)} reads data from a value of a different data type`;case Re.WritingToIncompatibleType:return`${he(s.entity,s.entity.project)} writes data to a value of a different data type`;case Re.ScopeWithoutLogic:return`${he(s.entity,s.entity.project)} has no logic`;case Re.NonStaticPropertyImplementsStatic:return`${he(s.entity,s.entity.project)} has a static property in a non-static entity`;case Re.PropertyImplementsIncompatibleType:return`${he(s.entity,s.entity.project)} implements a property of a different data type`;case Re.PropertyImplementsNonAbstact:return`${he(s.entity,s.entity.project)} implements a non-template property`;case Re.StaticPropertyImplementsNonStatic:return`${he(s.entity,s.entity.project)} has a static property in a non-static entity`;case Re.VariableCallsOthersAndHasInternalCall:return`${he(s.entity,s.entity.project)} calls other entities while being used to execute internal logic`;case Re.VariableHasInputsAndInternalCall:return`${he(s.entity,s.entity.project)} has inputs while being used to execute internal logic`;case Re.VariableHasOutputsAndInternalCall:return`${he(s.entity,s.entity.project)} has outputs while being used to execute internal logic`;case Re.VariableIsCalledAndHasInternalCall:return`${he(s.entity,s.entity.project)} is called while being used to execute internal logic`;case Ve.InternalCallDeclarationIsInvalidType:return`${he(s.entity,s.entity.project)} has a declaration that is not an action`;case Ve.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${he(s.entity,s.entity.project)} has a declaration that is not found in ${(u=s.entity.parent.getDataType(null))!=null&&u.entity?he((i=s.entity.parent.getDataType(null))==null?void 0:i.entity,s.entity.project):"the variable's data-type entity"}`;case Ve.InternalCallParentDeclarationEntityInvalidType:return`${he(s.entity,s.entity.project)} is part of a variable whos data-type entity can't have actions`;case Ve.InternalCallParentMissingDataType:return`${he(s.entity,s.entity.project)} is part of a variable with no data-type entity`;case Ve.InternalCallDeclarationNotInParentDatatypeEntity:return`${he(s.entity,s.entity.project)} has a declaration doesn't belong to ${(r=s.entity.parent.getDataType(null))!=null&&r.entity?he((a=s.entity.parent.getDataType(null))==null?void 0:a.entity,s.entity.project):"the variable's data-type entity"}`;case Ve.UnreachableEntity:return`${he(s.entity,s.entity.project)} is unreachable`;case Re.DisconnectedCallableEntity:return`${he(s.entity,s.entity.project)} is disconnected and won't be executed by anything after publishing`;case Re.AbstractEntityImplements:return`${he(s.entity,s.entity.project)} implements a non-template entity`;case Re.AbstractExtendingNonAbstractEntity:return`${he(s.entity,s.entity.project)} extends a non-template entity`;case Re.InvalidPropertiesCombination:return`${he(s.entity,s.entity.project)} has an invalid combination of properties`;case Re.ExtendingNonInteractiveEntity:return`${he(s.entity,s.entity.project)} extends a non-interactive entity`;case Re.ExtendsIncompatibleEntities:return`${he(s.entity,s.entity.project)} extends incompatible entities`;case Re.ImplementingNonAbstractEntity:return`${he(s.entity,s.entity.project)} implements a non-template entity`;case Re.ImplementsIncompatibleEntities:return`${he(s.entity,s.entity.project)} implements incompatible entities`;case Re.LackingReturnStatementOnSomeBranches:return`${he(s.entity,s.entity.project)} has branches that don't terminate`;case Re.LastCalledEntityMustBeReturnEntity:return`${he(s.entity,s.entity.project)} must end with a termination node`;case Re.MissingRequiredValue:return`${he(s.entity,s.entity.project)} is missing a required value`;case Re.NoPrimaryKeyProperty:return`${he(s.entity,s.entity.project)} has no primary key property`;case Re.NonAbstractExtendingAbstractEntity:return`${he(s.entity,s.entity.project)} is a non-template entity extending a template entity`;case Re.NonStaticExtendingStaticEntity:return`${he(s.entity,s.entity.project)} is a non-static entity extending a static entity`;case Re.NonStaticImplementingStaticEntity:return`${he(s.entity,s.entity.project)} is a non-static entity implementing a static entity`;case Re.StaticExtendingNonStaticEntity:return`${he(s.entity,s.entity.project)} is a static entity extending a non-static entity`;case Re.StaticImplementingNonStaticEntity:return`${he(s.entity,s.entity.project)} is a static entity implementing a non-static entity`;case Re.VariableReadsValueAndInternalCall:return`${he(s.entity,s.entity.project)} reads a value and has an internal call`;case Re.VariableWritesValuesAndInternalCall:return`${he(s.entity,s.entity.project)} writes values and has an internal call`;case Ve.EmptyName:return`${Il[s.entity.type]} has no name`;case Ve.InvalidObjectStructure:return`${he(s.entity,s.entity.project)} has an invalid structure`;case Ve.LoopBodyFunctionOverwrite:return`${he(s.entity,s.entity.project)}'s loop body action overwrites`;case Ve.MethodOverwritesBaseMethodWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites a base action with same implementation`;case Ve.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ve.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ve.MissingCaller:return`${he(s.entity,s.entity.project)} is missing a caller`;case Ve.NameAsResolvedCodeNameNotUniqueInScope:return`${he(s.entity,s.entity.project)} has a name that is not unique in the scope`;case Ve.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${he(s.entity,s.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ve.NameMustStartWithLetterOrUnderscore:return`${he(s.entity,s.entity.project)} name must start with letter or underscore`;case Ve.NoOverlapWithImplementedSignature:return`${he(s.entity,s.entity.project)} has no overlap with implemented signature`;case Ve.PropertyOverwritesBasePropertyWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites a base property with same implementation`;case Ve.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ve.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ve.ReaderWriterIncompatibleDataType:return`${he(s.entity,s.entity.project)} has a reader/writer with incompatible data type`;case Vu.StatusCodeMustBeBetween100And599:return`${he(s.entity,s.entity.project)} HTTP status code must be between 100 and 599`;case Vu.StatusCodeMustBeNumber:return`${he(s.entity,s.entity.project)} HTTP status code must be a number, between 100 and 599`;case Dl.UUIDMustBeString:return`${he(s.entity,s.entity.project)} UUID must be a string, eg: "${Kc()}"`;case Dl.UUIDMustNotContainSpaces:return`${he(s.entity,s.entity.project)} UUID must not contain spaces, eg: "${Kc()}"`;case Dl.UUIDMustBeValidFormat:return`${he(s.entity,s.entity.project)} UUID must be in a valid format. Eg: "${Kc()}"`;case Fa.MustBeUniqueAmongSameEntities:return`${he(s.entity,s.entity.project)} value must be unique among the same kind`;case Fa.StringValueMustNotHaveDashes:return`${he(s.entity,s.entity.project)} value must not contain dashes`;case Fa.StringValueMustNotHaveSpaces:return`${he(s.entity,s.entity.project)} value must not contain spaces`;case Re.CalledBeforeDeclaration:return"Called before declaration";case Re.CalledInParallelBranchToDeclaration:return`${he(s.entity,s.entity.project)} cannot be called in a parallel branch`;case Re.DefaultValueOverridesConstantProperty:return`${he(s.entity,s.entity.project)} default value overrides constant property`;case Re.DefaultValueOverridesConstantVariable:return`${he(s.entity,s.entity.project)} default value overrides constant variable`;case Re.EmptyGroupCondition:return`${he(s.entity,s.entity.project)} contains an empty group condition`;case Re.HigherScopeThanDeclaration:return`${he(s.entity,s.entity.project)} is in a higher scope than its declaration`;case Re.MissingEnumOptions:return`${he(s.entity,s.entity.project)} is missing enum options`;case Re.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls:return`${he(s.entity,s.entity.project)} catches its errors but its parent scope requires a returned value`;case Re.ValueReadingOverridesConstantProperty:return`${he(s.entity,s.entity.project)} is reading a value, but it is a constant property`;case Re.ValueReadingOverridesConstantVariable:return`${he(s.entity,s.entity.project)} is reading a value, but it is a constant variable`;case Ve.GlobalVariableDeclarationCannotBeCalled:return`${he(s.entity,s.entity.project)} is global variable declaration and cannot be called`;case Ve.GlobalVariableDeclarationCannotCallOnError:return`${he(s.entity,s.entity.project)} is global variable declaration and cannot call on error`;case Ve.GlobalVariableDeclarationCannotCatchError:return`${he(s.entity,s.entity.project)} is global variable declaration and cannot catch errors`;case Ve.InternalCallDeclarationNotFound:return`${he(s.entity,s.entity.project)}'s declaration isn't found`;case Ve.NameIsForbiddenKeyword:return`${he(s.entity,s.entity.project)}'s name is a forbidden keyword`;default:return`${he(s.entity,s.entity.project)} Error: ${mA(s.code)}`}}function TA(s){const u=(s||"").startsWith("error-caller-only--");switch(u?s.replace("error-caller-only--",""):s){case _i.CallIsInHigherScope:return"In a higher scope";case _i.CallIsInLowerScope:return"In a lower scope";case _i.CallerIsInHigherScope:return"Caller is in a higher scope";case _i.CallerIsInLowerScope:return"Caller is in a lower scope";case _i.CannotBeCalledByChildren:return"Cannot be called by children";case _i.CannotCallAncestor:return"Cannot call ancestor";case _i.CannotConnectToItself:return"Cannot connect to itself";case _i.CannotReadMoreThanOneValue:return"Cannot read more than one value";case _i.CannotReadValueFromChildren:return"Cannot read value from entities executed after itself";case _i.CannotWriteValueToAncestor:return"Cannot write value to ancestor";case tb.Suggestion:return"Suggestion";case _i.ContinueOrBreakStatementCalledFromOutsideLoop:return"Cannot be called from outside loop";case _i.DataTypesNotCompatible:return"Data types not compatible";case _i.ElementInLoopBodyCallingOutsideLoop:return"Cannot call outside loop";case _i.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees:return"Error cannot be connected to success branch";case _i.ExecutionsAlreadyConnected:return"Executions already connected";case _i.IsNotValueReadingEntity:return"Is not a value reading entity";case _i.IsNotValueWritingEntity:return"Is not a value writing entity";case _i.NotInScope:return"Not in a compatible scope";case _i.OtherIncompatibleScopeReason:return"Incompatible scope";case _i.SiblingInternalCallAlreadyUsedInParentVariable:return"Internal call already used in parent variable";case _i.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees:return"Success cannot be connected to error branch";case _i.ValuesAlreadyConnected:return"Values already connected";case _i.CannotInteractWithInputInVariableWithInternalCalls:return"Cannot interact with input in variable with internal calls";case _i.CannotInteractWithOutputInVariableWithInternalCalls:return"Cannot interact with output in variable with internal calls";case tb.CanvasGloballyDisabled:return"Canvas is globally disabled";case _i.PropertyIsConstantItsValueCantBeReset:return"Property is constant, its value can't be reset";case _i.CannotWriteValueOfGlobalVariableDeclaration:return"Cannot write value of global variable declaration";case _i.CannotReSetValueOfConstantVariable:return"Cannot re-set value of constant variable";case _i.CannotConnectToOwnNode:return"It is part of the same node";case _i.CalledByErrorMustBePassThroughCallable:return"Called by error must be pass-through callable";case _i.CannotChangeScopeBecauseItCallsOtherEntities:return"Cannot change scope because it calls other entities in its current scope";case _i.CannotChangeScopeBecauseItIsAlreadyCalledByOtherEntitiesInDifferentScope:return"Cannot change scope because it is already called by other entities in different scope";case _i.VariableDeclarationCannotBeMovedToLowerScopeBecauseInstancesUsage:return"Variable declaration cannot be moved to lower scope because its instances are used in the current or different incompatible lower scope";case _i.CalledBySourceMustBeCallerEntity:return"Not a caller type";case _i.CalledByErrorCannotBeConnectedToEntitiesCalledByOwnSuccessBranch:return"Already connected to the success branch from a common origin caller";case _i.CalledBySuccessCannotBeConnectedToEntitiesCalledByOwnErrorBranch:return"Already connected to the error branch from a common origin caller";case _i.RedundantCall:return"Redundant call. Already connected further down the execution path";case _i.CannotBeCalledBeforeDeclaration:return"Cannot be called before declaration";case _i.CannotBeCalledInParallelBranchToDeclaration:return"Cannot be called in parallel branch to declaration";case _i.CannotBeHigherScopeThanDeclaration:return"Cannot be in a higher scope than declaration";case _i.CannotCallGlobalVariableDeclaration:return"Cannot call global variable declaration";case _i.EntityAlreadyCalledBySuccessCannotBeConnectedToUnrelatedErrorBranch:return u?"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 _i.CannotInteractWithInputInGlobalVariableDeclaration:return"Cannot interact with input in global variable declaration";case _i.IsNotCallableEntity:return"Is not a callable node type";case _i.IsNotCallerEntity:return"Is not a caller node type";case _i.IsNotPassThroughCallableEntity:return"Is not a pass-through callable node type that has an error branch";case _i.NotAConnectableEntityType:return"Not a connectable node type";case _i.WouldMakeAnEarlierNodeBeCalledBeforeItsDeclaration:return"Would make an earlier node be called before its declaration";default:return ly(s||"")}}function N$i(s,u){const i=[...s,...u],r=Array.from(new Set(i));return{hasChanged:r.length!==s.length,reasons:r}}function x$i(s,u){const i=s.filter(a=>!u.includes(a));return{hasChanged:i.length!==s.length,reasons:i}}function V$i(s,u){return s.find(i=>i.entity.id===u)||null}function sK(s){return s.filter((u,i)=>s.indexOf(u)===i)}class Hn{constructor(u,i,r=null,a){D(this,"ids",[]);D(this,"entity");D(this,"entityCardHeight");D(this,"entityCardWidth");D(this,"index");D(this,"childEntities",[]);D(this,"children",[]);D(this,"parents",[]);D(this,"calculationEntryPoint");D(this,"_onlyEntities",null);D(this,"_changeSet",null);if(this.index=i,this.entity=u,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(u,i,r){const a=vqe-wR-NB,c=Eqe-iR-xB;u.type===d.Project?(u.x=a,u.y=c):u.metaSync({x:u.x||a,y:u.y||c},i);const e=new Hn(u,0,null,i);e.calculationEntryPoint=e,e._onlyEntities=r||[],e.ids=["0"];const f=[];e.next(m=>{f.push(...m)}),Hn.recursivelyAssembleChildrenAreas(f),e.resolveChildrenOverlaps();const h=e.flattenChildEntities();return e._onlyEntities?h.filter(m=>{var T;return(T=e._onlyEntities)==null?void 0:T.includes(m)}):h}static recursivelyAssembleChildrenAreas(u){const i=[];u.forEach(r=>{r.next(a=>{i.push(...a)})}),i.length>0&&Hn.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities||[]}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(u){this.calculationEntryPoint._changeSet=u}findAreaInChildrenFromEntity(u){if(this.entity===u)return this;const i=this.children.find(a=>a.entity===u);return i||this.children.reduce((a,c)=>a||c.findAreaInChildrenFromEntity(u),null)}findAreaFromEntity(u){if(this.entity===u)return this;const i=this.calculationEntryPoint.children,r=i.find(c=>c.entity===u);return r||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(u),null)}addParent(u){if(!this.parents.includes(u)){const i=Hn.resolveIds(u,this.index);this.ids.push(...i),this.parents.push(u)}}static resolveIds(u,i){return u?u.ids.map(r=>`${r}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const u=wd(this.entity,!0);if(this.entity.type===d.Project){const i=[],r=[],a=[];u.forEach(e=>{if(d.DefinitionEntity===e.type){r.push(e);return}else if(Ei.includes(e.type)){a.push(e);return}i.push(e)});const c=i.sort((e,f)=>{const h=!!MR(e,f).length,m=wd(e),T=wd(f);return h?0:m.length&&!T.length?-1:!m.length&&T.length?1:0}).filter(e=>!py(e).length);this.childEntities=[...r,...a,...c]}else{const i=[],r=[],a=[],c=[],e=[];Cr.includes(this.entity.type)&&dC(this.entity).forEach(m=>{if(vi.includes(m.type)){a.push(m);return}const T=Ut(m);i.push(T)}),fn.includes(this.entity.type)&&r.push(...this.entity.detachedChildren);const f=u.filter(h=>{const m=i.includes(h);return m||a.includes(h)||r.includes(h)?!1:vi.includes(h.type)?(a.push(h),!1):Or.includes(h.type)&&!m?(c.push(h),!1):h.type===d.DefinitionEntity?(e.push(h),!1):!0});i.sort((h,m)=>bd(h,m)?-1:0),c.sort((h,m)=>bd(h,m)?-1:0),a.sort((h,m)=>mx(h,m)?1:mx(m,h)?-1:0),this.childEntities=[...e,...i,...c,...f,...a,...r]}}calculateCardSize(){const u=bqe(this.entity);this.entityCardWidth=u.width,this.entityCardHeight=u.height}static getBoundriesOfTwoAreas(u,i){return{top:Math.min(u.top,i.top),left:Math.min(u.left,i.left),bottom:Math.max(u.bottom,i.bottom),right:Math.max(u.right,i.right)}}static getBoundriedOfCombinedAreas(u,i){const r=u.filter(c=>!i.includes(c));return r.reduce((c,e)=>i.includes(e)?c:Hn.getBoundriesOfTwoAreas(c,e.fullBranchArea),r[0].fullBranchArea)}getFullAreaUntilAny(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!u.includes(e)).map(e=>e.getFullAreaUntilAny(u)).reduce((e,f)=>Hn.getBoundriesOfTwoAreas(e,f),i)}getFullAreaUntilAreaOrAnyChildren(u){const i=[u,...u.flattenChildren()],r=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(u)).reduce((e,f)=>Hn.getBoundriesOfTwoAreas(e,f),r)}getFullAreaUntil(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==u).map(c=>c.getFullAreaUntil(u)).reduce((c,e)=>Hn.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const u=this.ownEntityPlusBufferArea;return this.children.map(a=>a.fullBranchArea).reduce((a,c)=>Hn.getBoundriesOfTwoAreas(a,c),u)}get ownEntityArea(){return{top:this.entity.y,left:this.entity.x,bottom:this.entity.y+this.entityCardHeight,right:this.entity.x+this.entityCardWidth}}get ownEntityPlusBufferArea(){const u=this.ownEntityArea;return{top:u.top,left:u.left,bottom:u.bottom+iR,right:u.right+wR}}static filterOutRepeatedAreas(u){return u.filter((i,r)=>u.indexOf(i)===r)}getEarliestId(u,i){const r=u.split("-"),a=i.split("-");return r.length<a.length?u:r.length>a.length?i:r.reduce((e,f,h)=>f<a[h]?u:i,u)}getEarliestLevel(){return this.ids.reduce((r,a)=>this.getEarliestId(r,a),this.ids[0]).split("-").length}countColumns(){let u=0;if(this!==this.calculationEntryPoint)u++;else return u;if(!this.parents.length)return u;const r=this.parents.reduce((a,c)=>c.getEarliestLevel()>a.getEarliestLevel()?c:a,this.parents[0]).countColumns();return u+=r,u}getLatestId(u,i){if(u===i)return u;const r=u.split("-"),a=i.split("-");return r.length<a.length?i:r.length>a.length?u:r.reduce((e,f,h)=>f>a[h]?u:i,u)}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 u=this.flattenSiblings();if(!u.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(r=>{r!==this.calculationEntryPoint&&r.shiftDownAlone(i)})}else if([...Ei].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=u.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(u,i){if(u.includes(this))return u;this.move(this.entity,{y:this.entity.y+i});let r=[...u,this];return this.children.forEach(a=>{if(Hn.getEarliestParentInChain(a)!==this)return;const e=V$i(r,a.entity.id);r=Hn.filterOutRepeatedAreas([...r]),e||(r=r.filter(h=>h!==a));const f=a.shiftDownUntilAny(r,i);r.push(...f)}),r}shiftRightUntilAny(u,i){u.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(r=>{const a=Hn.filterOutRepeatedAreas([...this.flattenSiblings(),...u]);Hn.getEarliestParentInChain(r)===this&&r.shiftRightUntilAny(a,i)}))}shiftRight(u){this.move(this.entity,{x:this.entity.x+u}),this.children.forEach(i=>{const a=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(a,u)})}shiftDownAlone(u){this.move(this.entity,{y:this.entity.y+u})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const u=this.parents.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+jy,h={top:f,left:e.left,bottom:f,right:e.right};return Hn.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(u.bottom-u.top)/2-jy;this.shiftDownAlone(r)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const u=this.children.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+jy,h={top:f,left:e.left,bottom:f,right:e.right};return Hn.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(u.bottom-u.top)/2-jy;return this.shiftDownAlone(r),r}resolveChildrenOverlaps(){const u=this.flattenChildren();let i=[];u.forEach(r=>{const a=r.adjustVerticallyToAvoidOverlaps();i.push(...a)}),u.forEach(r=>{r.smoothPosition()})}static getEarliestParentInChain(u){let i=u.parents[0];return u.parents.length&&(i=u.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(u=new Set){return u.add(this.entity.id),this.parents.reduce((r,a)=>{if(u.has(a.entity.id))return r;u.add(a.entity.id);const e=a.children.slice(0,a.children.indexOf(this)).reduce((f,h)=>[...f,h,...h.flattenChildren(u)],[]);return[...r,...e]},[])}flattenSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((r,a)=>{if(u.has(a.entity.id))return r;u.add(a.entity.id);const e=a.children.filter(f=>f!==this).reduce((f,h)=>[...f,h,...h.flattenChildren(u)],[]);return[...r,...e]},[])}flattenChildren(u=new Set){return this.children.reduce((i,r)=>u.has(r.entity.id)?i:(u.add(r.entity.id),[...i,r,...r.flattenChildren(u)]),[])}flattenParents(u=new Set){return this.parents.reduce((r,a)=>u.has(a.entity.id)?r:(u.add(a.entity.id),[...r,a,...a.flattenParents(u)]),[])}getAreaIfRendered(u){return this.calculationEntryPoint.flattenChildren().find(a=>a.entity.id===u.id)||null}getLowerSiblings(){const u=this.parents.reduce((i,r)=>{const a=r.children.indexOf(this),c=r.children.slice(a+1);return[...i,...c]},[]);return sK(u)}getLowerAreas(){const u=this.getLowerSiblings(),i=this.parents.reduce((r,a)=>[...r,...a.getLowerAreas()],[]);return sK([...u,...i])}adjustVerticallyToAvoidOverlaps(u=[]){const r=Hn.getEarliestParentInChain(this).children[this.index-1];if(!r)return u;const a=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...a,...c,r],m=P(e.flatMap(w=>MR(this.entity,w.entity))).filter(w=>w.id!==this.entity.id).map(w=>this.findAreaFromEntity(w)).filter(w=>!!w),T=this.getFullAreaUntilAny(m),b=r.getFullAreaUntilAny(m),A=e.reduce((w,I)=>I===this||I.fullBranchArea.left!==T.left?w:Math.max(w,I.fullBranchArea.bottom),b.bottom);if(T.top<A){const w=A-T.top+iR;return this.shiftDownUntilAny(u,w)}return u}move(u,i){if(this.onlyEntities.includes(u)){if(!this.changeSet)throw new Error("Change set is not defined for this area, cannot move entity");u.metaSync(i,this.changeSet)}}addChild(u){const i=this.childEntities[u];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 Hn(i,u,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(u=new Set){return this.children.reduce((i,r)=>u.has(r.entity.id)?i:(u.add(r.entity.id),[...i,r.entity,...r.flattenChildEntities(u)]),[])}next(u){const i=[];this.childEntities.forEach((r,a)=>{const c=this.addChild(a);c&&i.push(c)}),u(i)}}async function $$i(s,u,i={}){var c;const r=re.YieldTracker.from(i),a=[];console.log("Generating layout for project...");for(const e of s.instancesList){if(s.diggestedBuiltInBaseEntitiesIds.has(e.id)||!th.includes(e.type)||((c=Ut(e))==null?void 0:c.id)!==e.id)continue;let f=hi(e,s);if(!f){console.log("No top scope owner for instance: ",e," in project: ",s);continue}if(!(Ei.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==s;)f=f.parent,Ei.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,u==null||u.add(e,X.Updated),a.push(e),await r.tick()}}Hn.autoGenerateLayout(s,u,a)}async function L$i(s,u,i={}){const r=re.YieldTracker.from(i),a=[],c=[s,...Lt(s)].map(e=>Ut(e)).filter(Boolean);for(const e of c){if(s.project.diggestedBuiltInBaseEntitiesIds.has(e.id))continue;let f=hi(e,s.project);if(f&&!(Ei.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==s.project;)f=f.parent,Ei.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,u==null||u.add(e,X.Updated),a.push(e),await r.tick()}}Hn.autoGenerateLayout(s.project,u,a)}async function B$i(s,u,i={}){const r=re.YieldTracker.from(i),a=[],c=new Set;v8e(u,{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)),Cd(m,s)){const A=Ut(m);A&&!c.has(A.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(A.id)&&(a.push(A),c.add(A.id))}if(Cr.includes(m.type)){const A=m;[A,...Lt(A)].forEach(I=>{const C=Ut(I);C&&!c.has(C.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(C.id)&&(a.push(C),c.add(C.id))})}m.type===d.DefinitionEntity&&m.methods.forEach(A=>{Lt(A).forEach(I=>{const C=Ut(I);C&&!c.has(C.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(C.id)&&(a.push(C),c.add(C.id))})}),((b=m.parent)==null?void 0:b.type)===d.Project&&(a.push(m),c.add(m.id),Cr.includes(m.type)&&Lt(m).forEach(I=>{const C=Ut(I);C&&!c.has(C.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(C.id)&&(a.push(C),c.add(C.id))}))});let f=[];for(const m of a)s.diggestedBuiltInBaseEntitiesIds.has(m.id)||(m.x=0,m.y=0,u==null||u.add(m,X.Updated),f.push(m),await r.tick());f=P(f),Hn.autoGenerateLayout(s,u,f);const h=P([...f,...s.variableDeclarations,...s.variableInstances,...s.loops,...s.conditions,...s.operations,...s.searches]).filter(m=>m.x===0||m.y===0);Hn.autoGenerateLayout(s,u,h)}var Pc=(s=>(s.Amazon="amazon",s.Google="google",s.Microsoft="microsoft",s))(Pc||{}),kr=(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.ContainerCompute="container-compute",s.SharedDrive="shared-drive",s.CloudFileSystemBucket="cloud-file-system-bucket",s.SystemApiToken="system-api-token",s))(kr||{}),jN=(s=>(s.Post="post",s.Get="get",s.Acknowledgement="acknowledgment",s.Progress="progress",s.Error="error",s.Complete="complete",s))(jN||{}),ky=(s=>(s.Queued="queued",s.Running="running",s.Success="success",s.Failed="failed",s.CleanupInProgress="cleanup-in-progress",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))(ky||{}),KN=(s=>(s.Queued="queued",s.Running="running",s.Success="success",s.Failed="failed",s.CleanupInProgress="cleanup-in-progress",s.CleanedUp="cleaned-up",s.UnrecoverableFailure="unrecoverable-failure",s.Reverted="reverted",s.UnpublishingStarted="unpublishing-started",s.Unpublished="unpublished",s))(KN||{}),Ii=(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.CloudFileSystemBucketDeploymentStarted="cloud-file-system-bucket-deployment-started",s.CloudFileSystemBucketDeploymentCompleted="cloud-file-system-bucket-deployment-completed",s.CloudFileSystemBucketDeploymentFailed="cloud-file-system-bucket-deployment-failed",s.CreatingNewCloudFileSystemBucket="creating-new-cloud-file-system-bucket",s.CloudFileSystemBucketAlreadyExists="cloud-file-system-bucket-already-exists",s.CloudFileSystemBucketDeletionStarted="cloud-file-system-bucket-deletion-started",s.CloudFileSystemBucketDeletionCompleted="cloud-file-system-bucket-deletion-completed",s.CloudFileSystemBucketDeletionFailed="cloud-file-system-bucket-deletion-failed",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.RevertRelationalDatabaseMigrationStarted="revert-relational-database-migration-started",s.RevertRelationalDatabaseMigrationCompleted="revert-relational-database-migration-completed",s.RevertRelationalDatabaseMigrationFailed="revert-relational-database-migration-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.ContainerComputeDeploymentStarted="container-compute-deployment-started",s.ContainerComputeDeploymentCompleted="container-compute-deployment-completed",s.ContainerComputeDeploymentFailed="container-compute-deployment-failed",s.ContainerComputeDeletionStarted="container-compute-deletion-started",s.ContainerComputeDeletionCompleted="container-compute-deletion-completed",s.ContainerComputeDeletionFailed="container-compute-deletion-failed",s.SharedDriveDeploymentStarted="shared-drive-deployment-started",s.SharedDriveDeploymentCompleted="shared-drive-deployment-completed",s.SharedDriveDeploymentFailed="shared-drive-deployment-failed",s.SharedDriveAlreadyExists="shared-drive-already-exists",s.SharedDriveDeletionStarted="shared-drive-deletion-started",s.SharedDriveDeletionCompleted="shared-drive-deletion-completed",s.SharedDriveDeletionFailed="shared-drive-deletion-failed",s.SystemApiTokenProvisioningStarted="system-api-token-provisioning-started",s.SystemApiTokenProvisioningCompleted="system-api-token-provisioning-completed",s.SystemApiTokenProvisioningFailed="system-api-token-provisioning-failed",s.SystemApiTokenAlreadyExists="system-api-token-already-exists",s))(Ii||{}),yd=(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.RevertRelationalDatabaseMigration="revert-relational-database-migration",s.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",s.ExecutePublicationCompletedEvent="execute-publication-completed-event",s.CodebaseCleanup="codebase-cleanup",s.AWSTenantAccountProvisioning="aws-tenant-account-provisioning",s.ContainerComputeDeployment="container-compute-deployment",s.ContainerComputeDeletion="container-compute-deletion",s.SharedDriveDeployment="shared-drive-deployment",s.SharedDriveDeletion="shared-drive-deletion",s.CloudFileSystemBucketDeployment="cloud-file-system-bucket-deployment",s.CloudFileSystemBucketDeletion="cloud-file-system-bucket-deletion",s.SystemApiTokenProvisioning="system-api-token-provisioning",s))(yd||{});kr.CloudHostedCodebase,kr.HttpApi,kr.RelationalDatabase,kr.CloudHostedCodebase,kr.CloudHostedCodebase,kr.RelationalDatabase,kr.CloudHostedCodebase,kr.CloudHostedCodebase;class SN{constructor(u,i,r,a,c,e,f,h,m,T=!1,b){D(this,"stepType");D(this,"id");D(this,"resourceType");D(this,"index");D(this,"dependency",[]);D(this,"lastEvent",null);D(this,"lastEventTimestamp",null);D(this,"status",ky.Queued);D(this,"publicationRun");D(this,"resource");D(this,"cleanup",!1);D(this,"cleanupFor",null);D(this,"logs",[]);this.stepType=u,this.id=i,this.resourceType=r,this.status=a,this.dependency=c,this.index=e,this.lastEventTimestamp=f,this.publicationRun=h,this.resource=m,this.cleanup=T,this.cleanupFor=b||null}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},cleanup:this.cleanup,cleanupFor:this.cleanupFor,logs:this.logs}}async update(u){var i,r;this.status=u.status,this.dependency=u.dependency,this.index=u.index,this.stepType=u.stepType,this.resourceType=u.resourceType,this.lastEvent=u.lastEvent,this.id=u.id,(r=this.resource)==null||r.setDetails((i=u.resource)==null?void 0:i.details)}addLog(u){const i=this.logs.findIndex(r=>r.id===u.id);if(i!==-1)this.logs[i]=u;else{const r=this.logs.findIndex(a=>F(a.createdAt).isAfter(F(u.createdAt)));r===-1?this.logs.push(u):this.logs.splice(r,0,u)}}}var gqe=(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))(gqe||{});class sp{constructor(u,i,r){D(this,"provisionedBy");D(this,"publicationRun");D(this,"resourceType");D(this,"provider");D(this,"resourceId");D(this,"details",null);D(this,"name",null);D(this,"status","queued");this.publicationRun=u,this.resourceType=i,this.provider=r}setDetails(u){this.details=u}setStatus(u){this.status=u}setProvisionedBy(u){this.provisionedBy=u}}class M$i extends sp{constructor(i,r,a){super(i,kr.HttpEndpoint,a);D(this,"resourceType",kr.HttpEndpoint);D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=PD((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id,this.publicationRun.envIdentifier),this.resourceId}}class G$i extends sp{constructor(i,r,a){super(i,kr.ServerlessFunction,a);D(this,"resourceType",kr.ServerlessFunction);D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=PD((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id,this.publicationRun.envIdentifier),this.resourceId}}class Iqe extends sp{constructor(i,r,a){super(i,kr.HttpApi,a);D(this,"resourceType",kr.HttpApi);D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=Pqe(this.publicationRun.project.id,this.publicationRun.envIdentifier),this.resourceId}}class Rqe extends sp{constructor(i,r,a){super(i,kr.RelationalDatabase,a);D(this,"resourceType",kr.RelationalDatabase);D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=PD((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id,this.publicationRun.envIdentifier),this.resourceId}}class wqe extends sp{constructor(i,r,a){super(i,kr.CloudFileSystemBucket,a);D(this,"resourceType",kr.CloudFileSystemBucket);D(this,"owners",new Map);D(this,"details",null);D(this,"name","");D(this,"status","queued");r.forEach(e=>{this.owners.set(e.id,e)});const c=r[0];c&&(this.name=c.name||""),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var r;const i=(r=Array.from(this.owners.values()))==null?void 0:r[0];return this.resourceId=`elyx-proj-${this.publicationRun.project.id}-bucket-${i.id}${this.publicationRun.envIdentifier?`-${this.publicationRun.envIdentifier}`:""}`.toLowerCase().substring(0,63),this.resourceId}}class Dqe extends sp{constructor(i,r){super(i,kr.CloudHostedCodebase,r);D(this,"resourceType",kr.CloudHostedCodebase);D(this,"details",null);D(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class Cqe extends sp{constructor(i,r){super(i,kr.CompiledLocalCodebase,r);D(this,"resourceType",kr.CompiledLocalCodebase);D(this,"details",null);D(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 Oqe extends sp{constructor(i,r){super(i,kr.AWSTenantAccount,r);D(this,"resourceType",kr.AWSTenantAccount);D(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`aws-tenant-account--${this.publicationRun.project.id}`,this.resourceId}}class _qe extends sp{constructor(i,r){super(i,kr.SystemApiToken,r);D(this,"resourceType",kr.SystemApiToken);D(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`system-api-token--${this.publicationRun.project.id}`,this.resourceId}}class k$i{constructor(u,i){D(this,"id");D(this,"projectAutoIncrementPublicationCount");D(this,"projectPublishedSemanticVersion");D(this,"envIdentifier");D(this,"projectVersion");D(this,"projectBranchId");D(this,"projectId");D(this,"triggeredBy");D(this,"createdAt");D(this,"updatedAt");D(this,"status");D(this,"steps",[]);D(this,"cleanupSteps",[]);D(this,"editor");D(this,"explicitResources",new Map);D(this,"implicitGlobalResources",new Map);D(this,"finalGlobalEvent",null);D(this,"finalStatus",null);D(this,"contextType",ae.PublicationRun);D(this,"extensionsRegistry");this.id=u.id,this.projectAutoIncrementPublicationCount=u.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=u.projectPublishedSemanticVersion,this.envIdentifier=u.envIdentifier,this.projectVersion=u.projectVersion,this.projectBranchId=u.projectBranchId,this.projectId=u.projectId,this.triggeredBy=u.triggeredBy,this.createdAt=u.createdAt,this.updatedAt=u.updatedAt,this.status=u.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(u){return this.steps.filter(i=>u.includes(i.resourceType))}getStepsTypes(u){return this.steps.filter(i=>u.includes(i.stepType))}toIds(u){return u.map(i=>i.id)}getResourceForEntity(u){const i=Array.from(this.explicitResources.values()).find(r=>r.owners.has(u.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(kr.CompiledLocalCodebase,new Cqe(this,Pc.Amazon)),this.implicitGlobalResources.set(kr.CloudHostedCodebase,new Dqe(this,Pc.Amazon));const u=this.project.entities.filter(a=>Pi(a,Ae.HTTP_ENDPOINT)),i=this.project.entities.filter(a=>Pi(a,Ae.RELATIONAL_DATABASE));if(i.length&&i.forEach(a=>{const c=new Rqe(this,[a],Pc.Amazon);this.explicitResources.set(c.resourceId,c)}),u.length){const a=new Iqe(this,u,Pc.Amazon);this.explicitResources.set(a.resourceId,a)}const r=this.project.entities.filter(a=>Pi(a,Ae.CLOUD_FILE_SYSTEM_BUCKET));r.length&&r.forEach(a=>{const c=new wqe(this,[a],Pc.Amazon);this.explicitResources.set(c.resourceId,c)}),this.implicitGlobalResources.set(kr.AWSTenantAccount,new Oqe(this,Pc.Amazon)),this.implicitGlobalResources.set(kr.SystemApiToken,new _qe(this,Pc.Amazon))}setSteps(u,i){u.forEach(r=>{this.addStep(r,i)}),this.editor.events.emit(Ii.ProjectPublishRequestAcknowledged,{})}addStep(u,i){const r=u.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===u.id)){const c=new SN(u.stepType,u.id,u.resourceType,u.status,r,u.index,i,this,null);this.steps.push(c)}}addCleanupStep(u,i){const r=u.dependency||[];if(r.length){const c=r.filter(e=>!this.cleanupSteps.find(f=>f.id===e));if(c.length)throw new Error(`Missing dependencies: ${c.join(", ")}`)}if(!this.steps.find(c=>c.id===u.id)){const c=new SN(u.stepType,u.id,u.resourceType,u.status,r,u.index,i,this,null,!0,u.cleanupFor);this.cleanupSteps.push(c)}}onUpdate(u){var i;if(re.Logger.log("onUpdate",u),(i=u.payload)!=null&&i.stepType){const r=this.steps.find(a=>{var c;return a.id===((c=u.payload)==null?void 0:c.id)});r&&F(u.emittedAt).isAfter(F(r.lastEventTimestamp))&&r.update(u.payload)}this.editor.events.emit("publication-updated",{}),u.type===jN.Error?(this.finalStatus=KN.Failed,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-error",u)):u.type===jN.Complete&&(this.finalStatus=KN.Success,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-completed",u))}requestExtension(u){return this.extensionsRegistry.requestExtension(u)}async initRegistry(){return this.extensionsRegistry=new wB(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(ae.PublicationRun),this.extensionsRegistry}}function PD(s,u){return`entity-${s}-database-${u}`}function U$i(s,u){return`entity-${s}-endpoint-${u}`}function F$i(s,u){return`entity-${s}-cron-${u}`}function Pqe(s,u){return`project-${s}-http-api-${u}`}function j$i(s,u){return`entity-${s}-function-${u}`}function Oa(s,u){return`entity-${s}-bucket-${u}`}function K$i(s){switch(s){case yd.CodeCompilation:return"Code generation";case yd.RelationalDatabaseDeployment:return"Database creation";case yd.HttpApiDeployment:return"HTTP gateway creation";case yd.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case yd.BundleCodebase:return"Bundle code";case yd.MigrateRelationalDatabase:return"Database structure migration";case yd.BusinessLogicCodebaseDeployment:return"Update servers with new code";case yd.CodebaseCleanup:return"Code cleanup";case yd.HttpApiDeletion:return"HTTP gateway deletion";case yd.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function S$i(s){switch(s){case Ii.DeploymentCompleted:return"Successfully published";case Ii.DeploymentStarted:return"Publication started";case Ii.DeploymentFailed:return"Publication failed";case Ii.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case Ii.RequestPayloadValidationFailed:return"Request payload validation failed";case Ii.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case Ii.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case Ii.RelationalDatabaseDeploymentStarted:return"Database creation started";case Ii.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case Ii.RelationalDatabaseDeploymentFailed:return"Database creation failed";case Ii.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case Ii.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case Ii.RelationalDatabaseAlreadyExists:return"Database already exists";case Ii.HttpApiDeploymentStarted:return"HTTP gateway creation started";case Ii.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case Ii.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case Ii.CreatingNewHttpApi:return"Creating new HTTP gateway";case Ii.HttpApiAlreadyExists:return"HTTP gateway already exists";case Ii.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case Ii.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case Ii.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case Ii.BundlingCodebaseForDownload:return"Bundling code for download";case Ii.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case Ii.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case Ii.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case Ii.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case Ii.CodeCompilationStarted:return"Code generation started";case Ii.CodeCompilationCompleted:return"Code generation completed";case Ii.CodeCompilationFailed:return"Code generation failed";case Ii.BundleCodebaseStarted:return"Code bundling started";case Ii.BundleCodebaseCompleted:return"Code bundling completed";case Ii.BundleCodebaseFailed:return"Code bundling failed";case Ii.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case Ii.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case Ii.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case Ii.MigrateRelationalDatabaseStarted:return"Database structure migration started";case Ii.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case Ii.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case Ii.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case Ii.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case Ii.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case Ii.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case Ii.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case Ii.ProjectNotFound:return"Project not found";case Ii.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case Ii.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case Ii.HttpApiDeletionStarted:return"HTTP gateway deletion started";case Ii.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case Ii.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case Ii.RelationalDatabaseDeletionStarted:return"Database deletion started";case Ii.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case Ii.RelationalDatabaseDeletionFailed:return"Database deletion failed";case Ii.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var Nqe=(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))(Nqe||{});function q$i(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 Z$i(s){switch(s){case kr.RelationalDatabase:return"Relational database";case kr.HttpEndpoint:case kr.HttpApi:return"HTTP endpoints";case kr.ServerlessFunction:case kr.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function H$i(s){switch(s){case ky.Running:return"In progress";case ky.Failed:return"Failed";case ky.Success:return"Succeeded";case ky.Skipped:return"Skipped";case ky.Queued:default:return"Queued"}}async function xqe(s,u={}){var h;const i=re.YieldTracker.from(u),r=As(s),a=gs(s),c=[...r,...a,...ha(s),...$B(s),...Is(s),...LB(s)],e=MA(s);c.push(...e);const f=bi(s.errors,c);await i.tick();for(const m of s.inputs)await m.validateAsync({tracker:i});for(const m of s.outputs)await m.validateAsync({tracker:i});for(const m of s.internalCalls)await m.validateAsync({tracker:i});return await((h=s.dataType)==null?void 0:h.validateAsync({tracker:i})),f}function Vqe(s){var c;(c=s.dataType)==null||c.validate(),s.inputs.forEach(e=>e.validate()),s.outputs.forEach(e=>e.validate()),s.internalCalls.forEach(e=>e.validate());const u=As(s),i=gs(s),r=[...u,...i,...ha(s),...$B(s),...Is(s),...LB(s)],a=MA(s);return r.push(...a),bi(s.errors,r)}function $B(s,u){const r=[...s.project.getVariableDeclarations()].filter(a=>a.id!==s.id);return kA(s,[Kr],r,u)}function LB(s){const u=[];if(s.parent!==s.project)return u;if(s.catchesError){const i=Zt({id:`${s.id}--${Ve.GlobalVariableDeclarationCannotCatchError}`,message:`${Il[s.type].singular} "${he(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:ge.Error,code:Ve.GlobalVariableDeclarationCannotCatchError,entity:s});u.push(i.error)}if(s.errorCalls.length){const i=Zt({id:`${s.id}--${Ve.GlobalVariableDeclarationCannotCallOnError}`,message:`${Il[s.type].singular} "${he(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:ge.Error,code:Ve.GlobalVariableDeclarationCannotCallOnError,entity:s});u.push(i.error)}if(s.calledBy.length){const i=Zt({id:`${s.id}--${Ve.GlobalVariableDeclarationCannotBeCalled}`,message:`${Il[s.type].singular} "${he(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:ge.Error,code:Ve.GlobalVariableDeclarationCannotBeCalled,entity:s});u.push(i.error)}return[]}const W$i=Object.freeze(Object.defineProperty({__proto__:null,validate:Vqe,validateAsync:xqe,validateGlobalVariableDeclaration:LB,validateVariableDeclarationName:$B},Symbol.toStringTag,{value:"Module"}));async function $qe(s,u={}){const i=re.YieldTracker.from(u),r=As(s),a=gs(s),c=[...r,...a,...ha(s),...Is(s),...bu(s),...Bqe(s)],e=MA(s);c.push(...e);const f=bi(s.errors,c);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 f}function Lqe(s){s.inputs.forEach(c=>c.validate()),s.outputs.forEach(c=>c.validate()),s.internalCalls.forEach(c=>c.validate());const u=As(s),i=gs(s),r=[...u,...i,...ha(s),...Is(s)],a=MA(s);return r.push(...a),bi(s.errors,r)}function Bqe(s){const u=[],i=s.declaration.constant;if(i&&s.readsValue){const r=Zt({id:`${s.id}--${Re.ValueReadingOverridesConstantVariable}`,message:`The '${s.type}' entity "${he(s,s.project)}" with id "${s.id}" is a constant variable whose value cannot be overriden, but reads a value.`,severity:ge.Error,code:Re.ValueReadingOverridesConstantVariable,entity:s});u.push(r.error)}if(i&&s.defaultValue){const r=Zt({id:`${s.id}--${Re.DefaultValueOverridesConstantVariable}`,message:`The '${s.type}' entity "${he(s,s.project)}" with id "${s.id}" is a constant variable whose value cannot be overridden, but has a 'defaultValue'.`,severity:ge.Error,code:Re.DefaultValueOverridesConstantVariable,entity:s});u.push(r.error)}return u}function bu(s){var h;const u=[],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 u;const r=Lt(s),a=Lt(i);!!r.find(m=>m.id===i.id)&&u.push(Zt({id:`${s.id}--${Re.CalledBeforeDeclaration}`,code:Re.CalledBeforeDeclaration,severity:ge.Error,message:`Entity of type "${s.type}" with id "${s.id}" is called before its 'variable-declaration' '${i.name}' with id "${i.id}".
72
+ `,"color: #3b82f6; font-weight: bold;");const a={..._c,...i};this.state="running";const c=this.project.activeExecution;this.project.activeExecution=this;try{const e=await this.executeBranch(this.entryPoint,a,r);return this.state="finished-success",e}finally{this.project.activeExecution=c}}getExecutionLevels(){const i=[];let r=this;for(;r;){const a=r.entryPoint,c=a?he(a,this.project):"Unknown",e=a?a.type:"unknown";i.unshift(`${e} "${c}"`),r=r.parentExecution}return i.join(" -> ")}logBeforeExecution(i,r,a){var T,b;const c=this.getExecutionLevels(),e=hi(r,this.project),f=e?he(e,this.project):"Project",h=e?e.type:"Project",m=he(r,this.project);if(console.log(`%c[Execution: ${c}] %c[Scope: ${h} "${f}"]`,"color: #3b82f6; font-weight: bold;","color: #10b981; font-weight: bold;"),console.log(`%c${i} (${r.type}) -> [${m}]%c Inputs:`,"font-weight: bold; color: #224370ff;","color: #9ca3af;"),a.length?a.forEach(A=>{var I,C,$;const w=he(A.valueOwner,this.project);console.log(` %c${(I=A.valueOwner)==null?void 0:I.type}%c (${(C=A.valueOwner)==null?void 0:C.id}) %c"${w}"%c:`,"color: #8b5cf6; font-weight: bold;","color: #9ca3af;","color: #10b981; font-weight: bold;","color: #667a9bff;",($=A.value)==null?void 0:$.value)}):console.log(" (none)"),r.type===d.VariableInstance||r.type===d.VariableDeclaration){const A=ln(r),w=Cp(A,this.valueResolutionContext);console.log(` %cExisting Value%c of [${he(A,this.project)}]:`,"color: #ec4899; font-weight: bold;","color: #667a9bff;",(T=w==null?void 0:w.value)==null?void 0:T.value)}if(r.type===d.InternalCall){const A=r.parent;if(A){const w=Cp(A,this.valueResolutionContext);console.log(` %cParent Variable%c [${he(A,this.project)}] Value:`,"color: #f59e0b; font-weight: bold;","color: #667a9bff;",(b=w==null?void 0:w.value)==null?void 0:b.value)}}}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=re.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 r;return this.entities.includes(i)?!0:i.parent&&((r=i.parent)==null?void 0:r.id)!==(i==null?void 0:i.id)?this.hasEntity(i.parent):!1}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 g$i(s){var u,i;if(s.isList)return"list";if(((u=s.entity)==null?void 0:u.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 Il={[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 OB(s){const u=pC(s);if(!u){const r=a0(s);if(r.includes(Ae.HTTP_ENDPOINT))return"HTTP endpoint";if(r.includes(Ae.PERSISTED_ENTITY))return"SQL database table";if(r.includes(Ae.CRON_JOB))return"Scheduled execution";if(r.includes(Ae.RELATIONAL_DATABASE))return"Relational database";if(r.includes(Ae.CONTAINER_COMPUTE_ENTITY))return"Container compute";if(r.includes(Ae.SHARED_DRIVE_ENTITY))return"Shared files drive";if(r.includes(Ae.COMPUTE_ENTITY))return"Compute";if(r.includes(Ae.AIRTABLE_AUTH_CONNECTION))return"Airtable account connection";if(r.includes(Ae.GOOGLE_AUTH_CONNECTION))return"Google account connection";if(r.includes(Ae.SLACK_AUTH_CONNECTION))return"Slack account connection";if(r.includes(Ae.ATLASSIAN_AUTH_CONNECTION))return"Atlassian account connection";if(r.includes(Ae.JIRA_AUTH_CONNECTION))return"Jira account connection";if(r.includes(Ae.MICROSOFT_AUTH_CONNECTION))return"Microsoft account connection";if(r.includes(Ae.OPENAI_AUTH_CONNECTION))return"OpenAI account connection";if(r.includes(Ae.EXTERNAL_INTEGRATION_CONNECTION))return"External account connection"}if(u){let r="Extension of "+he(u,u.project)+" entity",a=wl(r);const c=a0(s);return c.includes(Ae.HTTP_ENDPOINT)?"HTTP endpoint"+(a?", "+a:""):c.includes(Ae.PERSISTED_ENTITY)?"SQL database table"+(a?", "+a:""):c.includes(Ae.CRON_JOB)?"Scheduled execution"+(a?", "+a:""):c.includes(Ae.RELATIONAL_DATABASE)?"Relational database"+(a?", "+a:""):c.includes(Ae.CONTAINER_COMPUTE_ENTITY)?"Container compute"+(a?", "+a:""):c.includes(Ae.SHARED_DRIVE_ENTITY)?"Shared files drive"+(a?", "+a:""):c.includes(Ae.COMPUTE_ENTITY)?"Compute"+(a?", "+a:""):c.includes(Ae.AIRTABLE_AUTH_CONNECTION)?"Airtable account connection"+(a?", "+a:""):c.includes(Ae.GOOGLE_AUTH_CONNECTION)?"Google account connection"+(a?", "+a:""):c.includes(Ae.SLACK_AUTH_CONNECTION)?"Slack account connection"+(a?", "+a:""):c.includes(Ae.ATLASSIAN_AUTH_CONNECTION)?"Atlassian account connection"+(a?", "+a:""):c.includes(Ae.JIRA_AUTH_CONNECTION)?"Jira account connection"+(a?", "+a:""):c.includes(Ae.MICROSOFT_AUTH_CONNECTION)?"Microsoft account connection"+(a?", "+a:""):c.includes(Ae.OPENAI_AUTH_CONNECTION)?"OpenAI account connection"+(a?", "+a:""):c.includes(Ae.EXTERNAL_INTEGRATION_CONNECTION)?"External account connection"+(a?", "+a:""):r}let i="";return s.abstract&&(i="Template "),s.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function mqe(s){return s.parent.type===d.DefinitionEntity||s.parent.type===d.InstalledProject?"Internal action of "+he(s.parent,s.project):s.parent.type===d.Loop?"Action repeated on every iteration":"Internal action of entity"}function _B(s){return zM(s)?mqe(s):"Custom trigger"}function I$i(s){var u;switch(s.type){case d.DefinitionEntity:return OB(s);case d.FunctionDeclaration:return _B(s)}return(u=Il[s.type])==null?void 0:u.singular}function R$i(s){var u;switch(s.type){case d.DefinitionEntity:return OB(s);case d.FunctionDeclaration:return _B(s)}return(u=Il[s.type])==null?void 0:u.singular}const PB=4e4,NB=280,w$i=300,xB=65,jy=32,km=39,KE=26,Tqe=49,SE=44,D$i=35,tR=52,_D=10,qs=_D*2,kc=38,iR=90,wR=270,vqe=PB/2+120,Eqe=PB/2+180;function VB(s){let i=jy+SE+kc+_D;const r=[...s.inputs];return r.length&&(i+=qs,r.forEach(()=>{i+=KE})),{height:i,width:280}}function qE(s){var a,c;let i=jy+SE+kc+_D;const r=[...s.inputs];return r.length&&(i+=qs,r.forEach(()=>{i+=KE})),s.andChildrenGroup&&(i+=qs,s.andChildrenGroup.forEach(e=>{i+=qE(e).height})),s.orChildrenGroup&&(i+=qs,s.orChildrenGroup.forEach(e=>{i+=qE(e).height})),(((a=s.declaration)==null?void 0:a.id)===U.condition["condition-group-and"].id||((c=s.declaration)==null?void 0:c.id)===U.condition["condition-group-or"].id)&&(i+=kc),{height:i,width:280}}function bqe(s){var h,m;let i=xB;const r=[];if([d.DefinitionEntity].includes(s.type)){const T=[...s.suggestedProperties||[],...s.properties||[]];T.length&&(i+=qs,T.forEach(b=>{i+=b.static?Tqe:km}))}if([d.DefinitionEntity,d.InstalledProject,d.Loop].includes(s.type)){const T=[...(s==null?void 0:s.suggestedMethods)||[],...s.methods||[],...s.functions||[],...s.body?[s.body]:[]];T.length&&(i+=qs,T.forEach(b=>{const A=VB(b);i+=A.height}))}ni.includes(s.type)?(r.push(...(s.inputs||[]).flatMap(T=>[T])||[]),i+=qs,i+=SE,s.error&&(i+=tR)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(s.type)?(r.push(...s.outputs||[]),s.throws&&(i+=tR)):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)===U.condition["condition-group-and"].id||((m=s.declaration)==null?void 0:m.id)===U.condition["condition-group-or"].id)&&(i+=kc),s.andChildrenGroup&&(i+=qs,s.andChildrenGroup.forEach(T=>{i+=qE(T).height})),s.orChildrenGroup&&(i+=qs,s.orChildrenGroup.forEach(T=>{i+=qE(T).height})));const a=r.length;a&&(i+=a*km,i+=qs);const c=[];if(s.type===d.FunctionDeclaration||s.type===d.GlobalEvent?c.push(...s.inputs||[]):ni.includes(s.type)&&c.push(...s.outputs||[]),vi.includes(s.type)){i+=qs,i+=SE,s.usedInternalCalls.length&&s.usedInternalCalls.forEach(b=>{i+=tR+qs,i+=b.inputs.length*KE,i+=b.outputs.length*KE});const T=s.getDataType(null);(!T||T.canModifyObjectStructure())&&(i+=kc)}s.type===d.Search&&(i+=kc);const e=c.length;return e&&(i+=e*km,i+=qs),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(s.type)&&(i+=kc),{height:i,width:280}}function Aqe(s){let u=0;if(s.parent.type!==d.DefinitionEntity)return{offset:u};const i=s.parent,r=i.methods.findIndex(c=>c.id===s.id);return i.methods.slice(0,r).forEach(c=>{const e=VB(c);u+=e.height}),(i.properties.length||i.suggestedProperties.length)&&(u+=qs,i.suggestedProperties.forEach(()=>{u+=km}),i.properties.forEach(()=>{u+=km})),{offset:u}}function mA(s){return`${s.split("-").map((r,a)=>a===0?r.charAt(0).toUpperCase()+r.slice(1):r.toLowerCase()).join(" ")}.`}function C$i(s){switch(s.code){case Re.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case Re.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case Re.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case Re.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case Re.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case Re.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case Re.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case Ve.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case Ve.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case Re.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case Re.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case Ve.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case Re.NoProperties:return"This entity has no properties, so it doesn't do anything";case Re.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case Re.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case Re.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case Re.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case Re.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case Re.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case Re.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case Re.PropertyImplementsNonAbstact:return"This property implements a non-template property";case Re.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case Re.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case Re.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case Re.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case Re.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case Ve.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case Ve.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case Ve.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case Ve.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case Ve.UnreachableEntity:return"This entity is unreachable";case Re.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case Re.AbstractEntityImplements:return"This template entity implements a non-template entity";case Re.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case Re.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case Re.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case Re.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case Re.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case Re.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case Re.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case Re.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case Re.MissingRequiredValue:return"This action is missing a required value";case Re.NoPrimaryKeyProperty:return"This entity has no primary key property";case Re.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case Re.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case Re.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case Re.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case Re.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case Re.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case Re.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case Ve.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case Ve.EmptyName:return"This entity has no name";case Ve.InvalidObjectStructure:return"This entity has an invalid structure";case Ve.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case Ve.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case Ve.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case Ve.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case Ve.MissingCaller:return"This action is missing a caller";case Ve.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case Ve.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case Ve.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case Ve.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case Ve.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case Ve.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case Ve.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case Ve.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case Vu.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Vu.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case Dl.UUIDMustBeString:return`UUID must be a string, eg: "${Kc()}"`;case Dl.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${Kc()}"`;case Dl.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${Kc()}"`;case Fa.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case Fa.StringValueMustNotHaveDashes:return"This value must not contain dashes";case Fa.StringValueMustNotHaveSpaces:return"This value must not contain spaces";case Fa.ValueMustBeString:return"This value must be a string";case DE.DayOfMonthAndWeekConflict:return"Cron expression cannot have both day of month and day of week";case DE.InvalidCharacters:return"Cron expression has invalid characters";case DE.MustHaveSixFields:return"Cron expression must have six fields";case Re.CalledBeforeDeclaration:return"Called before declaration";case Re.CalledInParallelBranchToDeclaration:return"Cannot call this action in a parallel branch";case Re.DefaultValueOverridesConstantProperty:return"Cannot override constant property";case Re.DefaultValueOverridesConstantVariable:return"Cannot override constant variable";case Re.EmptyGroupCondition:return"Cannot have an empty condition group";case Re.HigherScopeThanDeclaration:return"In higher scope than declaration";case Re.MissingEnumOptions:return"Missing enum options";case Re.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls:return"Current node catches its errors with no further calls which terminates the branch, but the parent trigger requires a returned value";case Re.ValueReadingOverridesConstantProperty:return"Value reading overrides constant property";case Re.ValueReadingOverridesConstantVariable:return"Value reading overrides constant variable";case Ve.GlobalVariableDeclarationCannotBeCalled:return"Global variable declaration cannot be called";case Ve.GlobalVariableDeclarationCannotCallOnError:return"Global variable declaration cannot have error calls";case Ve.GlobalVariableDeclarationCannotCatchError:return"Global variable declaration cannot catch errors";case Ve.InternalCallDeclarationNotFound:return"Internal call declaration not found";case Ve.NameIsForbiddenKeyword:return"The name given is a forbidden keyword";default:return mA(s.code)}}function O$i(s){switch(s.code){case Re.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case Re.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case Re.IncorrectEntityImplementation:return"Incorrect implementation";case Re.IncorrectMethodImplementation:return"Incorrect action implementation";case Re.IncorrectPropertyImplementation:return"Incorrect property implementation";case Re.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case Re.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case Ve.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case Ve.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case Re.MissingMethodImplementation:return"Missing action";case Re.MissingPropertyImplementation:return"Missing property";case Ve.NameNotUniqueInScope:return"Duplicate name";case Re.NoProperties:return"No properties";case Re.NonStaticPropertyInStaticEntity:return"Non-static property";case Re.StaticEntityWithNonStaticProperties:return"Non-static properties";case Re.ReadingFromIncompatibleType:return"Read from different type";case Re.WritingToIncompatibleType:return"Write to different type";case Re.ScopeWithoutLogic:return"No logic";case Re.NonStaticPropertyImplementsStatic:return"Invalid static property";case Re.PropertyImplementsIncompatibleType:return"Incompatible data type";case Re.PropertyImplementsNonAbstact:return"Non-template property";case Re.StaticPropertyImplementsNonStatic:return"Non-static property";case Re.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case Re.VariableHasInputsAndInternalCall:return"Bad internal call";case Re.VariableHasOutputsAndInternalCall:return"Bad internal call";case Re.VariableIsCalledAndHasInternalCall:return"Bad internal call";case Ve.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case Ve.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case Ve.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case Ve.InternalCallParentMissingDataType:return"Parent has no data type";case Ve.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case Ve.UnreachableEntity:return"Unreachable entity";case Re.DisconnectedCallableEntity:return"Disconnected entity";case Re.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case Re.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case Re.InvalidPropertiesCombination:return"Invalid properties combination";case Re.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case Re.ExtendsIncompatibleEntities:return"Extends incompatible entities";case Re.ImplementingNonAbstractEntity:return"Implementing non-template entity";case Re.ImplementsIncompatibleEntities:return"Implements incompatible entities";case Re.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case Re.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case Re.MissingRequiredValue:return"Missing required value";case Re.NoPrimaryKeyProperty:return"No primary key property";case Re.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case Re.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case Re.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case Re.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case Re.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case Re.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case Re.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case Ve.EmptyName:return"Empty name";case Ve.InvalidObjectStructure:return"Invalid object structure";case Ve.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case Ve.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case Ve.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ve.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ve.MissingCaller:return"Missing caller";case Ve.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case Ve.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case Ve.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case Ve.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case Ve.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case Ve.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ve.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ve.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case Vu.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Vu.StatusCodeMustBeNumber:return"HTTP status code must be a number";case Dl.UUIDMustBeString:return"UUID must be a string";case Dl.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case Dl.UUIDMustBeValidFormat:return"UUID must be in a valid format";case Fa.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case Fa.StringValueMustNotHaveDashes:return"This value must not contain dashes";case Fa.StringValueMustNotHaveSpaces:return"This value must not contain spaces";case Re.CalledBeforeDeclaration:return"Called before declaration";case Re.CalledInParallelBranchToDeclaration:return"Cannot call in a parallel branch";case Re.DefaultValueOverridesConstantProperty:return"Cannot override constant";case Re.DefaultValueOverridesConstantVariable:return"Cannot override constant";case Re.EmptyGroupCondition:return"Empty condition group";case Re.HigherScopeThanDeclaration:return"Higher scope than declaration";case Re.MissingEnumOptions:return"Missing enum options";case Re.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls:return"Catches errors with no further calls, but the parent trigger requires a returned value";case Re.ValueReadingOverridesConstantProperty:return"Value reading overrides constant";case Re.ValueReadingOverridesConstantVariable:return"Value reading overrides constant";case Ve.GlobalVariableDeclarationCannotBeCalled:return"Global variable declaration cannot be called";case Ve.GlobalVariableDeclarationCannotCallOnError:return"Global variable declaration cannot have error calls";case Ve.GlobalVariableDeclarationCannotCatchError:return"Global variable declaration cannot catch errors";case Ve.InternalCallDeclarationNotFound:return"Internal call declaration not found";case Ve.NameIsForbiddenKeyword:return"Name is a forbidden keyword";default:return mA(s.code)}}function _$i(s){switch(s.code){case Re.AbstractEntityWithNonAbstractMethods:return`${he(s.entity,s.entity.project)} has non-template actions`;case Re.AbstractEntityWithNonAbstractProperties:return`${he(s.entity,s.entity.project)} has non-template properties`;case Re.IncorrectEntityImplementation:return`${he(s.entity,s.entity.project)} incorrectly implements template`;case Re.IncorrectMethodImplementation:return`${he(s.entity,s.entity.project)} incorrectly implements the template`;case Re.IncorrectPropertyImplementation:return`${he(s.entity,s.entity.project)} incorrectly implements the template`;case Re.AbstractMethodInNonAbstractEntity:return`${he(s.entity,s.entity.project)} can't be a template`;case Re.AbstractPropertyInNonAbstractEntity:return`${he(s.entity,s.entity.project)} can't be a template`;case Ve.MethodOverwritesOtherSiblingWithSameName:return`${he(s.entity,s.entity.project)} overwrites action`;case Ve.PropertyOverwritesOtherSiblingWithSameName:return`${he(s.entity,s.entity.project)} overwrites property`;case Re.MissingMethodImplementation:return`${he(s.entity,s.entity.project)} is missing action`;case Re.MissingPropertyImplementation:return`${he(s.entity,s.entity.project)} is missing property`;case Ve.NameNotUniqueInScope:return`${he(s.entity,s.entity.project)} name is not unique`;case Re.NoProperties:return`${he(s.entity,s.entity.project)} has no properties`;case Re.NonStaticPropertyInStaticEntity:return`${he(s.entity,s.entity.project)} has non-static property`;case Re.StaticEntityWithNonStaticProperties:return`${he(s.entity,s.entity.project)} has non-static properties`;case Re.ReadingFromIncompatibleType:return`${he(s.entity,s.entity.project)} reads from different type`;case Re.WritingToIncompatibleType:return`${he(s.entity,s.entity.project)} writes to different type`;case Re.ScopeWithoutLogic:return`${he(s.entity,s.entity.project)} has no logic`;case Re.NonStaticPropertyImplementsStatic:return`${he(s.entity,s.entity.project)} has invalid static property`;case Re.PropertyImplementsIncompatibleType:return`${he(s.entity,s.entity.project)} has incompatible data type`;case Re.PropertyImplementsNonAbstact:return`${he(s.entity,s.entity.project)} has non-template property`;case Re.StaticPropertyImplementsNonStatic:return`${he(s.entity,s.entity.project)} has non-static property`;case Re.VariableCallsOthersAndHasInternalCall:return`${he(s.entity,s.entity.project)} has bad internal call`;case Re.VariableHasInputsAndInternalCall:return`${he(s.entity,s.entity.project)} has bad internal call`;case Re.VariableHasOutputsAndInternalCall:return`${he(s.entity,s.entity.project)} has bad internal call`;case Re.VariableIsCalledAndHasInternalCall:return`${he(s.entity,s.entity.project)} has bad internal call`;case Ve.InternalCallDeclarationIsInvalidType:return`${he(s.entity,s.entity.project)} has declaration that is not an action`;case Ve.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${he(s.entity,s.entity.project)} has declaration that is not found in parent`;case Ve.InternalCallParentDeclarationEntityInvalidType:return`${he(s.entity,s.entity.project)} has invalid parent declaration type`;case Ve.InternalCallParentMissingDataType:return`${he(s.entity,s.entity.project)}'s parent has no data type`;case Ve.InternalCallDeclarationNotInParentDatatypeEntity:return`${he(s.entity,s.entity.project)} has declaration that is not in parent`;case Ve.UnreachableEntity:return`${he(s.entity,s.entity.project)} is unreachable`;case Re.DisconnectedCallableEntity:return`${he(s.entity,s.entity.project)} is not executed by any entity`;case Re.AbstractEntityImplements:return`${he(s.entity,s.entity.project)} implements a non-template entity`;case Re.AbstractExtendingNonAbstractEntity:return`${he(s.entity,s.entity.project)} extends a non-template entity`;case Re.InvalidPropertiesCombination:return`${he(s.entity,s.entity.project)} has invalid properties combination`;case Re.ExtendingNonInteractiveEntity:return`${he(s.entity,s.entity.project)} extends a non-interactive entity`;case Re.ExtendsIncompatibleEntities:return`${he(s.entity,s.entity.project)} extends incompatible entities`;case Re.ImplementingNonAbstractEntity:return`${he(s.entity,s.entity.project)} implements a non-template entity`;case Re.ImplementsIncompatibleEntities:return`${he(s.entity,s.entity.project)} implements incompatible entities`;case Re.LackingReturnStatementOnSomeBranches:return`${he(s.entity,s.entity.project)} is missing termination on some branches`;case Re.LastCalledEntityMustBeReturnEntity:return`${he(s.entity,s.entity.project)}'s last called entity must be a termination node`;case Re.MissingRequiredValue:return`${he(s.entity,s.entity.project)} is missing a required value`;case Re.NoPrimaryKeyProperty:return`${he(s.entity,s.entity.project)} has no primary key property`;case Re.NonAbstractExtendingAbstractEntity:return`${he(s.entity,s.entity.project)} extends a template entity`;case Re.NonStaticExtendingStaticEntity:return`${he(s.entity,s.entity.project)} extends a static entity`;case Re.NonStaticImplementingStaticEntity:return`${he(s.entity,s.entity.project)} implements a static entity`;case Re.StaticExtendingNonStaticEntity:return`${he(s.entity,s.entity.project)} extends a non-static entity`;case Re.StaticImplementingNonStaticEntity:return`${he(s.entity,s.entity.project)} implements a non-static entity`;case Re.VariableReadsValueAndInternalCall:return`${he(s.entity,s.entity.project)} reads a value and has internal call`;case Re.VariableWritesValuesAndInternalCall:return`${he(s.entity,s.entity.project)} writes values and has internal call`;case Ve.EmptyName:return`${Il[s.entity.type]} has no name`;case Ve.InvalidObjectStructure:return`${he(s.entity,s.entity.project)} has invalid structure`;case Ve.LoopBodyFunctionOverwrite:return`${he(s.entity,s.entity.project)}'s loop body action overwrites an action`;case Ve.MethodOverwritesBaseMethodWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites base action`;case Ve.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ve.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ve.MissingCaller:return`${he(s.entity,s.entity.project)} is missing a caller`;case Ve.NameAsResolvedCodeNameNotUniqueInScope:return`${he(s.entity,s.entity.project)} has a name not unique in the scope`;case Ve.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${he(s.entity,s.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ve.NameMustStartWithLetterOrUnderscore:return`${he(s.entity,s.entity.project)} name must start with letter or underscore`;case Ve.NoOverlapWithImplementedSignature:return`${he(s.entity,s.entity.project)} has no overlap with implemented signature`;case Ve.PropertyOverwritesBasePropertyWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites base property`;case Ve.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ve.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ve.ReaderWriterIncompatibleDataType:return`${he(s.entity,s.entity.project)} has reader/writer with incompatible data type`;case Vu.StatusCodeMustBeBetween100And599:return`${he(s.entity,s.entity.project)} HTTP status code must be between 100 and 599`;case Vu.StatusCodeMustBeNumber:return`${he(s.entity,s.entity.project)} HTTP status code must be a number`;case Dl.UUIDMustBeString:return`${he(s.entity,s.entity.project)} UUID must be a string`;case Dl.UUIDMustNotContainSpaces:return`${he(s.entity,s.entity.project)} UUID must not contain spaces`;case Dl.UUIDMustBeValidFormat:return`${he(s.entity,s.entity.project)} UUID must be in a valid format`;case Fa.MustBeUniqueAmongSameEntities:return`${he(s.entity,s.entity.project)} value must be unique among the same kind`;case Fa.StringValueMustNotHaveDashes:return`${he(s.entity,s.entity.project)} value must not contain dashes`;case Fa.StringValueMustNotHaveSpaces:return`${he(s.entity,s.entity.project)} value must not contain spaces`;default:return`${he(s.entity,s.entity.project)} Error: ${mA(s.code)}`}}function P$i(s){var u,i,r,a;switch(s.code){case Re.AbstractEntityWithNonAbstractMethods:return`${he(s.entity,s.entity.project)} has non-template actions`;case Re.AbstractEntityWithNonAbstractProperties:return`${he(s.entity,s.entity.project)} has non-template properties`;case Re.IncorrectEntityImplementation:return`${he(s.entity,s.entity.project)} incorrectly implements the template entity`;case Re.IncorrectMethodImplementation:return`${he(s.entity,s.entity.project)} incorrectly implements the template action it's based on`;case Re.IncorrectPropertyImplementation:return`${he(s.entity,s.entity.project)} incorrectly implements the template property it's based on`;case Re.AbstractMethodInNonAbstractEntity:return`${he(s.entity,s.entity.project)} is a template action in a non-template entity`;case Re.AbstractPropertyInNonAbstractEntity:return`${he(s.entity,s.entity.project)} is a template property in a non-template entity`;case Ve.MethodOverwritesOtherSiblingWithSameName:return`${he(s.entity,s.entity.project)} overwrites an action in the template entity`;case Ve.PropertyOverwritesOtherSiblingWithSameName:return`${he(s.entity,s.entity.project)} overwrites a property in the template entity`;case Re.MissingMethodImplementation:return`${he(s.entity,s.entity.project)} is missing an action implementation from the template entity`;case Re.MissingPropertyImplementation:return`${he(s.entity,s.entity.project)} is missing a property implementation from the template entity`;case Ve.NameNotUniqueInScope:return`${he(s.entity,s.entity.project)} has a duplicate name in the same scope`;case Re.NoProperties:return`${he(s.entity,s.entity.project)} has no properties, so it doesn't do anything`;case Re.NonStaticPropertyInStaticEntity:return`${he(s.entity,s.entity.project)} has a non-static property in a static entity`;case Re.StaticEntityWithNonStaticProperties:return`${he(s.entity,s.entity.project)} has non-static properties in a static entity`;case Re.ReadingFromIncompatibleType:return`${he(s.entity,s.entity.project)} reads data from a value of a different data type`;case Re.WritingToIncompatibleType:return`${he(s.entity,s.entity.project)} writes data to a value of a different data type`;case Re.ScopeWithoutLogic:return`${he(s.entity,s.entity.project)} has no logic`;case Re.NonStaticPropertyImplementsStatic:return`${he(s.entity,s.entity.project)} has a static property in a non-static entity`;case Re.PropertyImplementsIncompatibleType:return`${he(s.entity,s.entity.project)} implements a property of a different data type`;case Re.PropertyImplementsNonAbstact:return`${he(s.entity,s.entity.project)} implements a non-template property`;case Re.StaticPropertyImplementsNonStatic:return`${he(s.entity,s.entity.project)} has a static property in a non-static entity`;case Re.VariableCallsOthersAndHasInternalCall:return`${he(s.entity,s.entity.project)} calls other entities while being used to execute internal logic`;case Re.VariableHasInputsAndInternalCall:return`${he(s.entity,s.entity.project)} has inputs while being used to execute internal logic`;case Re.VariableHasOutputsAndInternalCall:return`${he(s.entity,s.entity.project)} has outputs while being used to execute internal logic`;case Re.VariableIsCalledAndHasInternalCall:return`${he(s.entity,s.entity.project)} is called while being used to execute internal logic`;case Ve.InternalCallDeclarationIsInvalidType:return`${he(s.entity,s.entity.project)} has a declaration that is not an action`;case Ve.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${he(s.entity,s.entity.project)} has a declaration that is not found in ${(u=s.entity.parent.getDataType(null))!=null&&u.entity?he((i=s.entity.parent.getDataType(null))==null?void 0:i.entity,s.entity.project):"the variable's data-type entity"}`;case Ve.InternalCallParentDeclarationEntityInvalidType:return`${he(s.entity,s.entity.project)} is part of a variable whos data-type entity can't have actions`;case Ve.InternalCallParentMissingDataType:return`${he(s.entity,s.entity.project)} is part of a variable with no data-type entity`;case Ve.InternalCallDeclarationNotInParentDatatypeEntity:return`${he(s.entity,s.entity.project)} has a declaration doesn't belong to ${(r=s.entity.parent.getDataType(null))!=null&&r.entity?he((a=s.entity.parent.getDataType(null))==null?void 0:a.entity,s.entity.project):"the variable's data-type entity"}`;case Ve.UnreachableEntity:return`${he(s.entity,s.entity.project)} is unreachable`;case Re.DisconnectedCallableEntity:return`${he(s.entity,s.entity.project)} is disconnected and won't be executed by anything after publishing`;case Re.AbstractEntityImplements:return`${he(s.entity,s.entity.project)} implements a non-template entity`;case Re.AbstractExtendingNonAbstractEntity:return`${he(s.entity,s.entity.project)} extends a non-template entity`;case Re.InvalidPropertiesCombination:return`${he(s.entity,s.entity.project)} has an invalid combination of properties`;case Re.ExtendingNonInteractiveEntity:return`${he(s.entity,s.entity.project)} extends a non-interactive entity`;case Re.ExtendsIncompatibleEntities:return`${he(s.entity,s.entity.project)} extends incompatible entities`;case Re.ImplementingNonAbstractEntity:return`${he(s.entity,s.entity.project)} implements a non-template entity`;case Re.ImplementsIncompatibleEntities:return`${he(s.entity,s.entity.project)} implements incompatible entities`;case Re.LackingReturnStatementOnSomeBranches:return`${he(s.entity,s.entity.project)} has branches that don't terminate`;case Re.LastCalledEntityMustBeReturnEntity:return`${he(s.entity,s.entity.project)} must end with a termination node`;case Re.MissingRequiredValue:return`${he(s.entity,s.entity.project)} is missing a required value`;case Re.NoPrimaryKeyProperty:return`${he(s.entity,s.entity.project)} has no primary key property`;case Re.NonAbstractExtendingAbstractEntity:return`${he(s.entity,s.entity.project)} is a non-template entity extending a template entity`;case Re.NonStaticExtendingStaticEntity:return`${he(s.entity,s.entity.project)} is a non-static entity extending a static entity`;case Re.NonStaticImplementingStaticEntity:return`${he(s.entity,s.entity.project)} is a non-static entity implementing a static entity`;case Re.StaticExtendingNonStaticEntity:return`${he(s.entity,s.entity.project)} is a static entity extending a non-static entity`;case Re.StaticImplementingNonStaticEntity:return`${he(s.entity,s.entity.project)} is a static entity implementing a non-static entity`;case Re.VariableReadsValueAndInternalCall:return`${he(s.entity,s.entity.project)} reads a value and has an internal call`;case Re.VariableWritesValuesAndInternalCall:return`${he(s.entity,s.entity.project)} writes values and has an internal call`;case Ve.EmptyName:return`${Il[s.entity.type]} has no name`;case Ve.InvalidObjectStructure:return`${he(s.entity,s.entity.project)} has an invalid structure`;case Ve.LoopBodyFunctionOverwrite:return`${he(s.entity,s.entity.project)}'s loop body action overwrites`;case Ve.MethodOverwritesBaseMethodWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites a base action with same implementation`;case Ve.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ve.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ve.MissingCaller:return`${he(s.entity,s.entity.project)} is missing a caller`;case Ve.NameAsResolvedCodeNameNotUniqueInScope:return`${he(s.entity,s.entity.project)} has a name that is not unique in the scope`;case Ve.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${he(s.entity,s.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ve.NameMustStartWithLetterOrUnderscore:return`${he(s.entity,s.entity.project)} name must start with letter or underscore`;case Ve.NoOverlapWithImplementedSignature:return`${he(s.entity,s.entity.project)} has no overlap with implemented signature`;case Ve.PropertyOverwritesBasePropertyWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites a base property with same implementation`;case Ve.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ve.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${he(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ve.ReaderWriterIncompatibleDataType:return`${he(s.entity,s.entity.project)} has a reader/writer with incompatible data type`;case Vu.StatusCodeMustBeBetween100And599:return`${he(s.entity,s.entity.project)} HTTP status code must be between 100 and 599`;case Vu.StatusCodeMustBeNumber:return`${he(s.entity,s.entity.project)} HTTP status code must be a number, between 100 and 599`;case Dl.UUIDMustBeString:return`${he(s.entity,s.entity.project)} UUID must be a string, eg: "${Kc()}"`;case Dl.UUIDMustNotContainSpaces:return`${he(s.entity,s.entity.project)} UUID must not contain spaces, eg: "${Kc()}"`;case Dl.UUIDMustBeValidFormat:return`${he(s.entity,s.entity.project)} UUID must be in a valid format. Eg: "${Kc()}"`;case Fa.MustBeUniqueAmongSameEntities:return`${he(s.entity,s.entity.project)} value must be unique among the same kind`;case Fa.StringValueMustNotHaveDashes:return`${he(s.entity,s.entity.project)} value must not contain dashes`;case Fa.StringValueMustNotHaveSpaces:return`${he(s.entity,s.entity.project)} value must not contain spaces`;case Re.CalledBeforeDeclaration:return"Called before declaration";case Re.CalledInParallelBranchToDeclaration:return`${he(s.entity,s.entity.project)} cannot be called in a parallel branch`;case Re.DefaultValueOverridesConstantProperty:return`${he(s.entity,s.entity.project)} default value overrides constant property`;case Re.DefaultValueOverridesConstantVariable:return`${he(s.entity,s.entity.project)} default value overrides constant variable`;case Re.EmptyGroupCondition:return`${he(s.entity,s.entity.project)} contains an empty group condition`;case Re.HigherScopeThanDeclaration:return`${he(s.entity,s.entity.project)} is in a higher scope than its declaration`;case Re.MissingEnumOptions:return`${he(s.entity,s.entity.project)} is missing enum options`;case Re.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls:return`${he(s.entity,s.entity.project)} catches its errors but its parent scope requires a returned value`;case Re.ValueReadingOverridesConstantProperty:return`${he(s.entity,s.entity.project)} is reading a value, but it is a constant property`;case Re.ValueReadingOverridesConstantVariable:return`${he(s.entity,s.entity.project)} is reading a value, but it is a constant variable`;case Ve.GlobalVariableDeclarationCannotBeCalled:return`${he(s.entity,s.entity.project)} is global variable declaration and cannot be called`;case Ve.GlobalVariableDeclarationCannotCallOnError:return`${he(s.entity,s.entity.project)} is global variable declaration and cannot call on error`;case Ve.GlobalVariableDeclarationCannotCatchError:return`${he(s.entity,s.entity.project)} is global variable declaration and cannot catch errors`;case Ve.InternalCallDeclarationNotFound:return`${he(s.entity,s.entity.project)}'s declaration isn't found`;case Ve.NameIsForbiddenKeyword:return`${he(s.entity,s.entity.project)}'s name is a forbidden keyword`;default:return`${he(s.entity,s.entity.project)} Error: ${mA(s.code)}`}}function TA(s){const u=(s||"").startsWith("error-caller-only--");switch(u?s.replace("error-caller-only--",""):s){case _i.CallIsInHigherScope:return"In a higher scope";case _i.CallIsInLowerScope:return"In a lower scope";case _i.CallerIsInHigherScope:return"Caller is in a higher scope";case _i.CallerIsInLowerScope:return"Caller is in a lower scope";case _i.CannotBeCalledByChildren:return"Cannot be called by children";case _i.CannotCallAncestor:return"Cannot call ancestor";case _i.CannotConnectToItself:return"Cannot connect to itself";case _i.CannotReadMoreThanOneValue:return"Cannot read more than one value";case _i.CannotReadValueFromChildren:return"Cannot read value from entities executed after itself";case _i.CannotWriteValueToAncestor:return"Cannot write value to ancestor";case tb.Suggestion:return"Suggestion";case _i.ContinueOrBreakStatementCalledFromOutsideLoop:return"Cannot be called from outside loop";case _i.DataTypesNotCompatible:return"Data types not compatible";case _i.ElementInLoopBodyCallingOutsideLoop:return"Cannot call outside loop";case _i.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees:return"Error cannot be connected to success branch";case _i.ExecutionsAlreadyConnected:return"Executions already connected";case _i.IsNotValueReadingEntity:return"Is not a value reading entity";case _i.IsNotValueWritingEntity:return"Is not a value writing entity";case _i.NotInScope:return"Not in a compatible scope";case _i.OtherIncompatibleScopeReason:return"Incompatible scope";case _i.SiblingInternalCallAlreadyUsedInParentVariable:return"Internal call already used in parent variable";case _i.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees:return"Success cannot be connected to error branch";case _i.ValuesAlreadyConnected:return"Values already connected";case _i.CannotInteractWithInputInVariableWithInternalCalls:return"Cannot interact with input in variable with internal calls";case _i.CannotInteractWithOutputInVariableWithInternalCalls:return"Cannot interact with output in variable with internal calls";case tb.CanvasGloballyDisabled:return"Canvas is globally disabled";case _i.PropertyIsConstantItsValueCantBeReset:return"Property is constant, its value can't be reset";case _i.CannotWriteValueOfGlobalVariableDeclaration:return"Cannot write value of global variable declaration";case _i.CannotReSetValueOfConstantVariable:return"Cannot re-set value of constant variable";case _i.CannotConnectToOwnNode:return"It is part of the same node";case _i.CalledByErrorMustBePassThroughCallable:return"Called by error must be pass-through callable";case _i.CannotChangeScopeBecauseItCallsOtherEntities:return"Cannot change scope because it calls other entities in its current scope";case _i.CannotChangeScopeBecauseItIsAlreadyCalledByOtherEntitiesInDifferentScope:return"Cannot change scope because it is already called by other entities in different scope";case _i.VariableDeclarationCannotBeMovedToLowerScopeBecauseInstancesUsage:return"Variable declaration cannot be moved to lower scope because its instances are used in the current or different incompatible lower scope";case _i.CalledBySourceMustBeCallerEntity:return"Not a caller type";case _i.CalledByErrorCannotBeConnectedToEntitiesCalledByOwnSuccessBranch:return"Already connected to the success branch from a common origin caller";case _i.CalledBySuccessCannotBeConnectedToEntitiesCalledByOwnErrorBranch:return"Already connected to the error branch from a common origin caller";case _i.RedundantCall:return"Redundant call. Already connected further down the execution path";case _i.CannotBeCalledBeforeDeclaration:return"Cannot be called before declaration";case _i.CannotBeCalledInParallelBranchToDeclaration:return"Cannot be called in parallel branch to declaration";case _i.CannotBeHigherScopeThanDeclaration:return"Cannot be in a higher scope than declaration";case _i.CannotCallGlobalVariableDeclaration:return"Cannot call global variable declaration";case _i.EntityAlreadyCalledBySuccessCannotBeConnectedToUnrelatedErrorBranch:return u?"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 _i.CannotInteractWithInputInGlobalVariableDeclaration:return"Cannot interact with input in global variable declaration";case _i.IsNotCallableEntity:return"Is not a callable node type";case _i.IsNotCallerEntity:return"Is not a caller node type";case _i.IsNotPassThroughCallableEntity:return"Is not a pass-through callable node type that has an error branch";case _i.NotAConnectableEntityType:return"Not a connectable node type";case _i.WouldMakeAnEarlierNodeBeCalledBeforeItsDeclaration:return"Would make an earlier node be called before its declaration";default:return ly(s||"")}}function N$i(s,u){const i=[...s,...u],r=Array.from(new Set(i));return{hasChanged:r.length!==s.length,reasons:r}}function x$i(s,u){const i=s.filter(a=>!u.includes(a));return{hasChanged:i.length!==s.length,reasons:i}}function V$i(s,u){return s.find(i=>i.entity.id===u)||null}function sK(s){return s.filter((u,i)=>s.indexOf(u)===i)}class Hn{constructor(u,i,r=null,a){D(this,"ids",[]);D(this,"entity");D(this,"entityCardHeight");D(this,"entityCardWidth");D(this,"index");D(this,"childEntities",[]);D(this,"children",[]);D(this,"parents",[]);D(this,"calculationEntryPoint");D(this,"_onlyEntities",null);D(this,"_changeSet",null);if(this.index=i,this.entity=u,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(u,i,r){const a=vqe-wR-NB,c=Eqe-iR-xB;u.type===d.Project?(u.x=a,u.y=c):u.metaSync({x:u.x||a,y:u.y||c},i);const e=new Hn(u,0,null,i);e.calculationEntryPoint=e,e._onlyEntities=r||[],e.ids=["0"];const f=[];e.next(m=>{f.push(...m)}),Hn.recursivelyAssembleChildrenAreas(f),e.resolveChildrenOverlaps();const h=e.flattenChildEntities();return e._onlyEntities?h.filter(m=>{var T;return(T=e._onlyEntities)==null?void 0:T.includes(m)}):h}static recursivelyAssembleChildrenAreas(u){const i=[];u.forEach(r=>{r.next(a=>{i.push(...a)})}),i.length>0&&Hn.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities||[]}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(u){this.calculationEntryPoint._changeSet=u}findAreaInChildrenFromEntity(u){if(this.entity===u)return this;const i=this.children.find(a=>a.entity===u);return i||this.children.reduce((a,c)=>a||c.findAreaInChildrenFromEntity(u),null)}findAreaFromEntity(u){if(this.entity===u)return this;const i=this.calculationEntryPoint.children,r=i.find(c=>c.entity===u);return r||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(u),null)}addParent(u){if(!this.parents.includes(u)){const i=Hn.resolveIds(u,this.index);this.ids.push(...i),this.parents.push(u)}}static resolveIds(u,i){return u?u.ids.map(r=>`${r}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const u=wd(this.entity,!0);if(this.entity.type===d.Project){const i=[],r=[],a=[];u.forEach(e=>{if(d.DefinitionEntity===e.type){r.push(e);return}else if(Ei.includes(e.type)){a.push(e);return}i.push(e)});const c=i.sort((e,f)=>{const h=!!MR(e,f).length,m=wd(e),T=wd(f);return h?0:m.length&&!T.length?-1:!m.length&&T.length?1:0}).filter(e=>!py(e).length);this.childEntities=[...r,...a,...c]}else{const i=[],r=[],a=[],c=[],e=[];Cr.includes(this.entity.type)&&dC(this.entity).forEach(m=>{if(vi.includes(m.type)){a.push(m);return}const T=Ut(m);i.push(T)}),fn.includes(this.entity.type)&&r.push(...this.entity.detachedChildren);const f=u.filter(h=>{const m=i.includes(h);return m||a.includes(h)||r.includes(h)?!1:vi.includes(h.type)?(a.push(h),!1):Or.includes(h.type)&&!m?(c.push(h),!1):h.type===d.DefinitionEntity?(e.push(h),!1):!0});i.sort((h,m)=>bd(h,m)?-1:0),c.sort((h,m)=>bd(h,m)?-1:0),a.sort((h,m)=>mx(h,m)?1:mx(m,h)?-1:0),this.childEntities=[...e,...i,...c,...f,...a,...r]}}calculateCardSize(){const u=bqe(this.entity);this.entityCardWidth=u.width,this.entityCardHeight=u.height}static getBoundriesOfTwoAreas(u,i){return{top:Math.min(u.top,i.top),left:Math.min(u.left,i.left),bottom:Math.max(u.bottom,i.bottom),right:Math.max(u.right,i.right)}}static getBoundriedOfCombinedAreas(u,i){const r=u.filter(c=>!i.includes(c));return r.reduce((c,e)=>i.includes(e)?c:Hn.getBoundriesOfTwoAreas(c,e.fullBranchArea),r[0].fullBranchArea)}getFullAreaUntilAny(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!u.includes(e)).map(e=>e.getFullAreaUntilAny(u)).reduce((e,f)=>Hn.getBoundriesOfTwoAreas(e,f),i)}getFullAreaUntilAreaOrAnyChildren(u){const i=[u,...u.flattenChildren()],r=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(u)).reduce((e,f)=>Hn.getBoundriesOfTwoAreas(e,f),r)}getFullAreaUntil(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==u).map(c=>c.getFullAreaUntil(u)).reduce((c,e)=>Hn.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const u=this.ownEntityPlusBufferArea;return this.children.map(a=>a.fullBranchArea).reduce((a,c)=>Hn.getBoundriesOfTwoAreas(a,c),u)}get ownEntityArea(){return{top:this.entity.y,left:this.entity.x,bottom:this.entity.y+this.entityCardHeight,right:this.entity.x+this.entityCardWidth}}get ownEntityPlusBufferArea(){const u=this.ownEntityArea;return{top:u.top,left:u.left,bottom:u.bottom+iR,right:u.right+wR}}static filterOutRepeatedAreas(u){return u.filter((i,r)=>u.indexOf(i)===r)}getEarliestId(u,i){const r=u.split("-"),a=i.split("-");return r.length<a.length?u:r.length>a.length?i:r.reduce((e,f,h)=>f<a[h]?u:i,u)}getEarliestLevel(){return this.ids.reduce((r,a)=>this.getEarliestId(r,a),this.ids[0]).split("-").length}countColumns(){let u=0;if(this!==this.calculationEntryPoint)u++;else return u;if(!this.parents.length)return u;const r=this.parents.reduce((a,c)=>c.getEarliestLevel()>a.getEarliestLevel()?c:a,this.parents[0]).countColumns();return u+=r,u}getLatestId(u,i){if(u===i)return u;const r=u.split("-"),a=i.split("-");return r.length<a.length?i:r.length>a.length?u:r.reduce((e,f,h)=>f>a[h]?u:i,u)}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 u=this.flattenSiblings();if(!u.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(r=>{r!==this.calculationEntryPoint&&r.shiftDownAlone(i)})}else if([...Ei].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=u.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(u,i){if(u.includes(this))return u;this.move(this.entity,{y:this.entity.y+i});let r=[...u,this];return this.children.forEach(a=>{if(Hn.getEarliestParentInChain(a)!==this)return;const e=V$i(r,a.entity.id);r=Hn.filterOutRepeatedAreas([...r]),e||(r=r.filter(h=>h!==a));const f=a.shiftDownUntilAny(r,i);r.push(...f)}),r}shiftRightUntilAny(u,i){u.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(r=>{const a=Hn.filterOutRepeatedAreas([...this.flattenSiblings(),...u]);Hn.getEarliestParentInChain(r)===this&&r.shiftRightUntilAny(a,i)}))}shiftRight(u){this.move(this.entity,{x:this.entity.x+u}),this.children.forEach(i=>{const a=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(a,u)})}shiftDownAlone(u){this.move(this.entity,{y:this.entity.y+u})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const u=this.parents.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+jy,h={top:f,left:e.left,bottom:f,right:e.right};return Hn.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(u.bottom-u.top)/2-jy;this.shiftDownAlone(r)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const u=this.children.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+jy,h={top:f,left:e.left,bottom:f,right:e.right};return Hn.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(u.bottom-u.top)/2-jy;return this.shiftDownAlone(r),r}resolveChildrenOverlaps(){const u=this.flattenChildren();let i=[];u.forEach(r=>{const a=r.adjustVerticallyToAvoidOverlaps();i.push(...a)}),u.forEach(r=>{r.smoothPosition()})}static getEarliestParentInChain(u){let i=u.parents[0];return u.parents.length&&(i=u.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(u=new Set){return u.add(this.entity.id),this.parents.reduce((r,a)=>{if(u.has(a.entity.id))return r;u.add(a.entity.id);const e=a.children.slice(0,a.children.indexOf(this)).reduce((f,h)=>[...f,h,...h.flattenChildren(u)],[]);return[...r,...e]},[])}flattenSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((r,a)=>{if(u.has(a.entity.id))return r;u.add(a.entity.id);const e=a.children.filter(f=>f!==this).reduce((f,h)=>[...f,h,...h.flattenChildren(u)],[]);return[...r,...e]},[])}flattenChildren(u=new Set){return this.children.reduce((i,r)=>u.has(r.entity.id)?i:(u.add(r.entity.id),[...i,r,...r.flattenChildren(u)]),[])}flattenParents(u=new Set){return this.parents.reduce((r,a)=>u.has(a.entity.id)?r:(u.add(a.entity.id),[...r,a,...a.flattenParents(u)]),[])}getAreaIfRendered(u){return this.calculationEntryPoint.flattenChildren().find(a=>a.entity.id===u.id)||null}getLowerSiblings(){const u=this.parents.reduce((i,r)=>{const a=r.children.indexOf(this),c=r.children.slice(a+1);return[...i,...c]},[]);return sK(u)}getLowerAreas(){const u=this.getLowerSiblings(),i=this.parents.reduce((r,a)=>[...r,...a.getLowerAreas()],[]);return sK([...u,...i])}adjustVerticallyToAvoidOverlaps(u=[]){const r=Hn.getEarliestParentInChain(this).children[this.index-1];if(!r)return u;const a=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...a,...c,r],m=P(e.flatMap(w=>MR(this.entity,w.entity))).filter(w=>w.id!==this.entity.id).map(w=>this.findAreaFromEntity(w)).filter(w=>!!w),T=this.getFullAreaUntilAny(m),b=r.getFullAreaUntilAny(m),A=e.reduce((w,I)=>I===this||I.fullBranchArea.left!==T.left?w:Math.max(w,I.fullBranchArea.bottom),b.bottom);if(T.top<A){const w=A-T.top+iR;return this.shiftDownUntilAny(u,w)}return u}move(u,i){if(this.onlyEntities.includes(u)){if(!this.changeSet)throw new Error("Change set is not defined for this area, cannot move entity");u.metaSync(i,this.changeSet)}}addChild(u){const i=this.childEntities[u];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 Hn(i,u,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(u=new Set){return this.children.reduce((i,r)=>u.has(r.entity.id)?i:(u.add(r.entity.id),[...i,r.entity,...r.flattenChildEntities(u)]),[])}next(u){const i=[];this.childEntities.forEach((r,a)=>{const c=this.addChild(a);c&&i.push(c)}),u(i)}}async function $$i(s,u,i={}){var c;const r=re.YieldTracker.from(i),a=[];console.log("Generating layout for project...");for(const e of s.instancesList){if(s.diggestedBuiltInBaseEntitiesIds.has(e.id)||!th.includes(e.type)||((c=Ut(e))==null?void 0:c.id)!==e.id)continue;let f=hi(e,s);if(!f){console.log("No top scope owner for instance: ",e," in project: ",s);continue}if(!(Ei.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==s;)f=f.parent,Ei.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,u==null||u.add(e,X.Updated),a.push(e),await r.tick()}}Hn.autoGenerateLayout(s,u,a)}async function L$i(s,u,i={}){const r=re.YieldTracker.from(i),a=[],c=[s,...Lt(s)].map(e=>Ut(e)).filter(Boolean);for(const e of c){if(s.project.diggestedBuiltInBaseEntitiesIds.has(e.id))continue;let f=hi(e,s.project);if(f&&!(Ei.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==s.project;)f=f.parent,Ei.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,u==null||u.add(e,X.Updated),a.push(e),await r.tick()}}Hn.autoGenerateLayout(s.project,u,a)}async function B$i(s,u,i={}){const r=re.YieldTracker.from(i),a=[],c=new Set;v8e(u,{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)),Cd(m,s)){const A=Ut(m);A&&!c.has(A.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(A.id)&&(a.push(A),c.add(A.id))}if(Cr.includes(m.type)){const A=m;[A,...Lt(A)].forEach(I=>{const C=Ut(I);C&&!c.has(C.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(C.id)&&(a.push(C),c.add(C.id))})}m.type===d.DefinitionEntity&&m.methods.forEach(A=>{Lt(A).forEach(I=>{const C=Ut(I);C&&!c.has(C.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(C.id)&&(a.push(C),c.add(C.id))})}),((b=m.parent)==null?void 0:b.type)===d.Project&&(a.push(m),c.add(m.id),Cr.includes(m.type)&&Lt(m).forEach(I=>{const C=Ut(I);C&&!c.has(C.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(C.id)&&(a.push(C),c.add(C.id))}))});let f=[];for(const m of a)s.diggestedBuiltInBaseEntitiesIds.has(m.id)||(m.x=0,m.y=0,u==null||u.add(m,X.Updated),f.push(m),await r.tick());f=P(f),Hn.autoGenerateLayout(s,u,f);const h=P([...f,...s.variableDeclarations,...s.variableInstances,...s.loops,...s.conditions,...s.operations,...s.searches]).filter(m=>m.x===0||m.y===0);Hn.autoGenerateLayout(s,u,h)}var Pc=(s=>(s.Amazon="amazon",s.Google="google",s.Microsoft="microsoft",s))(Pc||{}),kr=(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.ContainerCompute="container-compute",s.SharedDrive="shared-drive",s.CloudFileSystemBucket="cloud-file-system-bucket",s.SystemApiToken="system-api-token",s))(kr||{}),jN=(s=>(s.Post="post",s.Get="get",s.Acknowledgement="acknowledgment",s.Progress="progress",s.Error="error",s.Complete="complete",s))(jN||{}),ky=(s=>(s.Queued="queued",s.Running="running",s.Success="success",s.Failed="failed",s.CleanupInProgress="cleanup-in-progress",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))(ky||{}),KN=(s=>(s.Queued="queued",s.Running="running",s.Success="success",s.Failed="failed",s.CleanupInProgress="cleanup-in-progress",s.CleanedUp="cleaned-up",s.UnrecoverableFailure="unrecoverable-failure",s.Reverted="reverted",s.UnpublishingStarted="unpublishing-started",s.Unpublished="unpublished",s))(KN||{}),Ii=(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.CloudFileSystemBucketDeploymentStarted="cloud-file-system-bucket-deployment-started",s.CloudFileSystemBucketDeploymentCompleted="cloud-file-system-bucket-deployment-completed",s.CloudFileSystemBucketDeploymentFailed="cloud-file-system-bucket-deployment-failed",s.CreatingNewCloudFileSystemBucket="creating-new-cloud-file-system-bucket",s.CloudFileSystemBucketAlreadyExists="cloud-file-system-bucket-already-exists",s.CloudFileSystemBucketDeletionStarted="cloud-file-system-bucket-deletion-started",s.CloudFileSystemBucketDeletionCompleted="cloud-file-system-bucket-deletion-completed",s.CloudFileSystemBucketDeletionFailed="cloud-file-system-bucket-deletion-failed",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.RevertRelationalDatabaseMigrationStarted="revert-relational-database-migration-started",s.RevertRelationalDatabaseMigrationCompleted="revert-relational-database-migration-completed",s.RevertRelationalDatabaseMigrationFailed="revert-relational-database-migration-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.ContainerComputeDeploymentStarted="container-compute-deployment-started",s.ContainerComputeDeploymentCompleted="container-compute-deployment-completed",s.ContainerComputeDeploymentFailed="container-compute-deployment-failed",s.ContainerComputeDeletionStarted="container-compute-deletion-started",s.ContainerComputeDeletionCompleted="container-compute-deletion-completed",s.ContainerComputeDeletionFailed="container-compute-deletion-failed",s.SharedDriveDeploymentStarted="shared-drive-deployment-started",s.SharedDriveDeploymentCompleted="shared-drive-deployment-completed",s.SharedDriveDeploymentFailed="shared-drive-deployment-failed",s.SharedDriveAlreadyExists="shared-drive-already-exists",s.SharedDriveDeletionStarted="shared-drive-deletion-started",s.SharedDriveDeletionCompleted="shared-drive-deletion-completed",s.SharedDriveDeletionFailed="shared-drive-deletion-failed",s.SystemApiTokenProvisioningStarted="system-api-token-provisioning-started",s.SystemApiTokenProvisioningCompleted="system-api-token-provisioning-completed",s.SystemApiTokenProvisioningFailed="system-api-token-provisioning-failed",s.SystemApiTokenAlreadyExists="system-api-token-already-exists",s.SystemApiTokenRevokingStarted="system-api-token-revoking-started",s.SystemApiTokenRevokingCompleted="system-api-token-revoking-completed",s.SystemApiTokenRevokingFailed="system-api-token-revoking-failed",s))(Ii||{}),yd=(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.RevertRelationalDatabaseMigration="revert-relational-database-migration",s.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",s.ExecutePublicationCompletedEvent="execute-publication-completed-event",s.CodebaseCleanup="codebase-cleanup",s.AWSTenantAccountProvisioning="aws-tenant-account-provisioning",s.ContainerComputeDeployment="container-compute-deployment",s.ContainerComputeDeletion="container-compute-deletion",s.SharedDriveDeployment="shared-drive-deployment",s.SharedDriveDeletion="shared-drive-deletion",s.CloudFileSystemBucketDeployment="cloud-file-system-bucket-deployment",s.CloudFileSystemBucketDeletion="cloud-file-system-bucket-deletion",s.SystemApiTokenProvisioning="system-api-token-provisioning",s.SystemApiTokenRevoking="system-api-token-revoking",s))(yd||{});kr.CloudHostedCodebase,kr.HttpApi,kr.RelationalDatabase,kr.CloudHostedCodebase,kr.CloudHostedCodebase,kr.RelationalDatabase,kr.CloudHostedCodebase,kr.CloudHostedCodebase;class SN{constructor(u,i,r,a,c,e,f,h,m,T=!1,b){D(this,"stepType");D(this,"id");D(this,"resourceType");D(this,"index");D(this,"dependency",[]);D(this,"lastEvent",null);D(this,"lastEventTimestamp",null);D(this,"status",ky.Queued);D(this,"publicationRun");D(this,"resource");D(this,"cleanup",!1);D(this,"cleanupFor",null);D(this,"logs",[]);this.stepType=u,this.id=i,this.resourceType=r,this.status=a,this.dependency=c,this.index=e,this.lastEventTimestamp=f,this.publicationRun=h,this.resource=m,this.cleanup=T,this.cleanupFor=b||null}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},cleanup:this.cleanup,cleanupFor:this.cleanupFor,logs:this.logs}}async update(u){var i,r;this.status=u.status,this.dependency=u.dependency,this.index=u.index,this.stepType=u.stepType,this.resourceType=u.resourceType,this.lastEvent=u.lastEvent,this.id=u.id,(r=this.resource)==null||r.setDetails((i=u.resource)==null?void 0:i.details)}addLog(u){const i=this.logs.findIndex(r=>r.id===u.id);if(i!==-1)this.logs[i]=u;else{const r=this.logs.findIndex(a=>F(a.createdAt).isAfter(F(u.createdAt)));r===-1?this.logs.push(u):this.logs.splice(r,0,u)}}}var gqe=(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))(gqe||{});class sp{constructor(u,i,r){D(this,"provisionedBy");D(this,"publicationRun");D(this,"resourceType");D(this,"provider");D(this,"resourceId");D(this,"details",null);D(this,"name",null);D(this,"status","queued");this.publicationRun=u,this.resourceType=i,this.provider=r}setDetails(u){this.details=u}setStatus(u){this.status=u}setProvisionedBy(u){this.provisionedBy=u}}class M$i extends sp{constructor(i,r,a){super(i,kr.HttpEndpoint,a);D(this,"resourceType",kr.HttpEndpoint);D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=PD((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id,this.publicationRun.envIdentifier),this.resourceId}}class G$i extends sp{constructor(i,r,a){super(i,kr.ServerlessFunction,a);D(this,"resourceType",kr.ServerlessFunction);D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=PD((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id,this.publicationRun.envIdentifier),this.resourceId}}class Iqe extends sp{constructor(i,r,a){super(i,kr.HttpApi,a);D(this,"resourceType",kr.HttpApi);D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=Pqe(this.publicationRun.project.id,this.publicationRun.envIdentifier),this.resourceId}}class Rqe extends sp{constructor(i,r,a){super(i,kr.RelationalDatabase,a);D(this,"resourceType",kr.RelationalDatabase);D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=PD((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id,this.publicationRun.envIdentifier),this.resourceId}}class wqe extends sp{constructor(i,r,a){super(i,kr.CloudFileSystemBucket,a);D(this,"resourceType",kr.CloudFileSystemBucket);D(this,"owners",new Map);D(this,"details",null);D(this,"name","");D(this,"status","queued");r.forEach(e=>{this.owners.set(e.id,e)});const c=r[0];c&&(this.name=c.name||""),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var r;const i=(r=Array.from(this.owners.values()))==null?void 0:r[0];return this.resourceId=`elyx-proj-${this.publicationRun.project.id}-bucket-${i.id}${this.publicationRun.envIdentifier?`-${this.publicationRun.envIdentifier}`:""}`.toLowerCase().substring(0,63),this.resourceId}}class Dqe extends sp{constructor(i,r){super(i,kr.CloudHostedCodebase,r);D(this,"resourceType",kr.CloudHostedCodebase);D(this,"details",null);D(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class Cqe extends sp{constructor(i,r){super(i,kr.CompiledLocalCodebase,r);D(this,"resourceType",kr.CompiledLocalCodebase);D(this,"details",null);D(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 Oqe extends sp{constructor(i,r){super(i,kr.AWSTenantAccount,r);D(this,"resourceType",kr.AWSTenantAccount);D(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`aws-tenant-account--${this.publicationRun.project.id}`,this.resourceId}}class _qe extends sp{constructor(i,r){super(i,kr.SystemApiToken,r);D(this,"resourceType",kr.SystemApiToken);D(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`system-api-token--${this.publicationRun.project.id}`,this.resourceId}}class k$i{constructor(u,i){D(this,"id");D(this,"projectAutoIncrementPublicationCount");D(this,"projectPublishedSemanticVersion");D(this,"envIdentifier");D(this,"projectVersion");D(this,"projectBranchId");D(this,"projectId");D(this,"triggeredBy");D(this,"createdAt");D(this,"updatedAt");D(this,"status");D(this,"steps",[]);D(this,"cleanupSteps",[]);D(this,"editor");D(this,"explicitResources",new Map);D(this,"implicitGlobalResources",new Map);D(this,"finalGlobalEvent",null);D(this,"finalStatus",null);D(this,"contextType",ae.PublicationRun);D(this,"extensionsRegistry");this.id=u.id,this.projectAutoIncrementPublicationCount=u.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=u.projectPublishedSemanticVersion,this.envIdentifier=u.envIdentifier,this.projectVersion=u.projectVersion,this.projectBranchId=u.projectBranchId,this.projectId=u.projectId,this.triggeredBy=u.triggeredBy,this.createdAt=u.createdAt,this.updatedAt=u.updatedAt,this.status=u.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(u){return this.steps.filter(i=>u.includes(i.resourceType))}getStepsTypes(u){return this.steps.filter(i=>u.includes(i.stepType))}toIds(u){return u.map(i=>i.id)}getResourceForEntity(u){const i=Array.from(this.explicitResources.values()).find(r=>r.owners.has(u.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(kr.CompiledLocalCodebase,new Cqe(this,Pc.Amazon)),this.implicitGlobalResources.set(kr.CloudHostedCodebase,new Dqe(this,Pc.Amazon));const u=this.project.entities.filter(a=>Pi(a,Ae.HTTP_ENDPOINT)),i=this.project.entities.filter(a=>Pi(a,Ae.RELATIONAL_DATABASE));if(i.length&&i.forEach(a=>{const c=new Rqe(this,[a],Pc.Amazon);this.explicitResources.set(c.resourceId,c)}),u.length){const a=new Iqe(this,u,Pc.Amazon);this.explicitResources.set(a.resourceId,a)}const r=this.project.entities.filter(a=>Pi(a,Ae.CLOUD_FILE_SYSTEM_BUCKET));r.length&&r.forEach(a=>{const c=new wqe(this,[a],Pc.Amazon);this.explicitResources.set(c.resourceId,c)}),this.implicitGlobalResources.set(kr.AWSTenantAccount,new Oqe(this,Pc.Amazon)),this.implicitGlobalResources.set(kr.SystemApiToken,new _qe(this,Pc.Amazon))}setSteps(u,i){u.forEach(r=>{this.addStep(r,i)}),this.editor.events.emit(Ii.ProjectPublishRequestAcknowledged,{})}addStep(u,i){const r=u.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===u.id)){const c=new SN(u.stepType,u.id,u.resourceType,u.status,r,u.index,i,this,null);this.steps.push(c)}}addCleanupStep(u,i){const r=u.dependency||[];if(r.length){const c=r.filter(e=>!this.cleanupSteps.find(f=>f.id===e));if(c.length)throw new Error(`Missing dependencies: ${c.join(", ")}`)}if(!this.steps.find(c=>c.id===u.id)){const c=new SN(u.stepType,u.id,u.resourceType,u.status,r,u.index,i,this,null,!0,u.cleanupFor);this.cleanupSteps.push(c)}}onUpdate(u){var i;if(re.Logger.log("onUpdate",u),(i=u.payload)!=null&&i.stepType){const r=this.steps.find(a=>{var c;return a.id===((c=u.payload)==null?void 0:c.id)});r&&F(u.emittedAt).isAfter(F(r.lastEventTimestamp))&&r.update(u.payload)}this.editor.events.emit("publication-updated",{}),u.type===jN.Error?(this.finalStatus=KN.Failed,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-error",u)):u.type===jN.Complete&&(this.finalStatus=KN.Success,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-completed",u))}requestExtension(u){return this.extensionsRegistry.requestExtension(u)}async initRegistry(){return this.extensionsRegistry=new wB(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(ae.PublicationRun),this.extensionsRegistry}}function PD(s,u){return`entity-${s}-database-${u}`}function U$i(s,u){return`entity-${s}-endpoint-${u}`}function F$i(s,u){return`entity-${s}-cron-${u}`}function Pqe(s,u){return`project-${s}-http-api-${u}`}function j$i(s,u){return`entity-${s}-function-${u}`}function Oa(s,u){return`entity-${s}-bucket-${u}`}function K$i(s){switch(s){case yd.CodeCompilation:return"Code generation";case yd.RelationalDatabaseDeployment:return"Database creation";case yd.HttpApiDeployment:return"HTTP gateway creation";case yd.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case yd.BundleCodebase:return"Bundle code";case yd.MigrateRelationalDatabase:return"Database structure migration";case yd.BusinessLogicCodebaseDeployment:return"Update servers with new code";case yd.CodebaseCleanup:return"Code cleanup";case yd.HttpApiDeletion:return"HTTP gateway deletion";case yd.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function S$i(s){switch(s){case Ii.DeploymentCompleted:return"Successfully published";case Ii.DeploymentStarted:return"Publication started";case Ii.DeploymentFailed:return"Publication failed";case Ii.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case Ii.RequestPayloadValidationFailed:return"Request payload validation failed";case Ii.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case Ii.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case Ii.RelationalDatabaseDeploymentStarted:return"Database creation started";case Ii.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case Ii.RelationalDatabaseDeploymentFailed:return"Database creation failed";case Ii.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case Ii.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case Ii.RelationalDatabaseAlreadyExists:return"Database already exists";case Ii.HttpApiDeploymentStarted:return"HTTP gateway creation started";case Ii.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case Ii.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case Ii.CreatingNewHttpApi:return"Creating new HTTP gateway";case Ii.HttpApiAlreadyExists:return"HTTP gateway already exists";case Ii.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case Ii.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case Ii.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case Ii.BundlingCodebaseForDownload:return"Bundling code for download";case Ii.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case Ii.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case Ii.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case Ii.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case Ii.CodeCompilationStarted:return"Code generation started";case Ii.CodeCompilationCompleted:return"Code generation completed";case Ii.CodeCompilationFailed:return"Code generation failed";case Ii.BundleCodebaseStarted:return"Code bundling started";case Ii.BundleCodebaseCompleted:return"Code bundling completed";case Ii.BundleCodebaseFailed:return"Code bundling failed";case Ii.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case Ii.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case Ii.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case Ii.MigrateRelationalDatabaseStarted:return"Database structure migration started";case Ii.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case Ii.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case Ii.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case Ii.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case Ii.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case Ii.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case Ii.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case Ii.ProjectNotFound:return"Project not found";case Ii.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case Ii.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case Ii.HttpApiDeletionStarted:return"HTTP gateway deletion started";case Ii.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case Ii.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case Ii.RelationalDatabaseDeletionStarted:return"Database deletion started";case Ii.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case Ii.RelationalDatabaseDeletionFailed:return"Database deletion failed";case Ii.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var Nqe=(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))(Nqe||{});function q$i(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 Z$i(s){switch(s){case kr.RelationalDatabase:return"Relational database";case kr.HttpEndpoint:case kr.HttpApi:return"HTTP endpoints";case kr.ServerlessFunction:case kr.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function H$i(s){switch(s){case ky.Running:return"In progress";case ky.Failed:return"Failed";case ky.Success:return"Succeeded";case ky.Skipped:return"Skipped";case ky.Queued:default:return"Queued"}}async function xqe(s,u={}){var h;const i=re.YieldTracker.from(u),r=As(s),a=gs(s),c=[...r,...a,...ha(s),...$B(s),...Is(s),...LB(s)],e=MA(s);c.push(...e);const f=bi(s.errors,c);await i.tick();for(const m of s.inputs)await m.validateAsync({tracker:i});for(const m of s.outputs)await m.validateAsync({tracker:i});for(const m of s.internalCalls)await m.validateAsync({tracker:i});return await((h=s.dataType)==null?void 0:h.validateAsync({tracker:i})),f}function Vqe(s){var c;(c=s.dataType)==null||c.validate(),s.inputs.forEach(e=>e.validate()),s.outputs.forEach(e=>e.validate()),s.internalCalls.forEach(e=>e.validate());const u=As(s),i=gs(s),r=[...u,...i,...ha(s),...$B(s),...Is(s),...LB(s)],a=MA(s);return r.push(...a),bi(s.errors,r)}function $B(s,u){const r=[...s.project.getVariableDeclarations()].filter(a=>a.id!==s.id);return kA(s,[Kr],r,u)}function LB(s){const u=[];if(s.parent!==s.project)return u;if(s.catchesError){const i=Zt({id:`${s.id}--${Ve.GlobalVariableDeclarationCannotCatchError}`,message:`${Il[s.type].singular} "${he(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:ge.Error,code:Ve.GlobalVariableDeclarationCannotCatchError,entity:s});u.push(i.error)}if(s.errorCalls.length){const i=Zt({id:`${s.id}--${Ve.GlobalVariableDeclarationCannotCallOnError}`,message:`${Il[s.type].singular} "${he(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:ge.Error,code:Ve.GlobalVariableDeclarationCannotCallOnError,entity:s});u.push(i.error)}if(s.calledBy.length){const i=Zt({id:`${s.id}--${Ve.GlobalVariableDeclarationCannotBeCalled}`,message:`${Il[s.type].singular} "${he(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:ge.Error,code:Ve.GlobalVariableDeclarationCannotBeCalled,entity:s});u.push(i.error)}return[]}const W$i=Object.freeze(Object.defineProperty({__proto__:null,validate:Vqe,validateAsync:xqe,validateGlobalVariableDeclaration:LB,validateVariableDeclarationName:$B},Symbol.toStringTag,{value:"Module"}));async function $qe(s,u={}){const i=re.YieldTracker.from(u),r=As(s),a=gs(s),c=[...r,...a,...ha(s),...Is(s),...bu(s),...Bqe(s)],e=MA(s);c.push(...e);const f=bi(s.errors,c);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 f}function Lqe(s){s.inputs.forEach(c=>c.validate()),s.outputs.forEach(c=>c.validate()),s.internalCalls.forEach(c=>c.validate());const u=As(s),i=gs(s),r=[...u,...i,...ha(s),...Is(s)],a=MA(s);return r.push(...a),bi(s.errors,r)}function Bqe(s){const u=[],i=s.declaration.constant;if(i&&s.readsValue){const r=Zt({id:`${s.id}--${Re.ValueReadingOverridesConstantVariable}`,message:`The '${s.type}' entity "${he(s,s.project)}" with id "${s.id}" is a constant variable whose value cannot be overriden, but reads a value.`,severity:ge.Error,code:Re.ValueReadingOverridesConstantVariable,entity:s});u.push(r.error)}if(i&&s.defaultValue){const r=Zt({id:`${s.id}--${Re.DefaultValueOverridesConstantVariable}`,message:`The '${s.type}' entity "${he(s,s.project)}" with id "${s.id}" is a constant variable whose value cannot be overridden, but has a 'defaultValue'.`,severity:ge.Error,code:Re.DefaultValueOverridesConstantVariable,entity:s});u.push(r.error)}return u}function bu(s){var h;const u=[],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 u;const r=Lt(s),a=Lt(i);!!r.find(m=>m.id===i.id)&&u.push(Zt({id:`${s.id}--${Re.CalledBeforeDeclaration}`,code:Re.CalledBeforeDeclaration,severity:ge.Error,message:`Entity of type "${s.type}" with id "${s.id}" is called before its 'variable-declaration' '${i.name}' with id "${i.id}".
73
73
  The 'variable-declaration' must be called before any internal call that references it can be called.`,entity:s}).error);const e=hi(i,s.project),f=hi(s,s.project);if((e==null?void 0:e.type)!==d.Project&&e&&f){const m=!!a.find(T=>T.id===s.id);if((e==null?void 0:e.id)===(f==null?void 0:f.id))m||u.push(Zt({id:`${s.id}--${Re.CalledInParallelBranchToDeclaration}`,code:Re.CalledInParallelBranchToDeclaration,severity:ge.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}".
74
74
  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(Zs(f,e,s.project))u.push(Zt({id:`${s.id}--${Re.HigherScopeThanDeclaration}`,code:Re.HigherScopeThanDeclaration,severity:ge.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}".
75
75
  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(Zs(e,f,s.project)){let T=f;for(;T.id!==e.id&&T.id!==s.project.id;){const A=hi(T,s.project);if(A.id===e.id)break;T=A}const b=bT(T);if(b){const w=!!Lt(b).find(C=>C.id===i.id),I=!!a.find(C=>C.id===b.id);w?u.push(Zt({id:`${s.id}--${Re.CalledBeforeDeclaration}`,code:Re.CalledBeforeDeclaration,severity:ge.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.js CHANGED
@@ -148471,7 +148471,7 @@ async function TJi(s, u, i = {}) {
148471
148471
  ]).filter((m) => m.x === 0 || m.y === 0);
148472
148472
  Qn.autoGenerateLayout(s, u, h);
148473
148473
  }
148474
- var cc = /* @__PURE__ */ ((s) => (s.Amazon = "amazon", s.Google = "google", s.Microsoft = "microsoft", s))(cc || {}), Ur = /* @__PURE__ */ ((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.ContainerCompute = "container-compute", s.SharedDrive = "shared-drive", s.CloudFileSystemBucket = "cloud-file-system-bucket", s.SystemApiToken = "system-api-token", s))(Ur || {}), s_ = /* @__PURE__ */ ((s) => (s.Post = "post", s.Get = "get", s.Acknowledgement = "acknowledgment", s.Progress = "progress", s.Error = "error", s.Complete = "complete", s))(s_ || {}), oy = /* @__PURE__ */ ((s) => (s.Queued = "queued", s.Running = "running", s.Success = "success", s.Failed = "failed", s.CleanupInProgress = "cleanup-in-progress", 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))(oy || {}), l_ = /* @__PURE__ */ ((s) => (s.Queued = "queued", s.Running = "running", s.Success = "success", s.Failed = "failed", s.CleanupInProgress = "cleanup-in-progress", s.CleanedUp = "cleaned-up", s.UnrecoverableFailure = "unrecoverable-failure", s.Reverted = "reverted", s.UnpublishingStarted = "unpublishing-started", s.Unpublished = "unpublished", s))(l_ || {}), Ri = /* @__PURE__ */ ((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.CloudFileSystemBucketDeploymentStarted = "cloud-file-system-bucket-deployment-started", s.CloudFileSystemBucketDeploymentCompleted = "cloud-file-system-bucket-deployment-completed", s.CloudFileSystemBucketDeploymentFailed = "cloud-file-system-bucket-deployment-failed", s.CreatingNewCloudFileSystemBucket = "creating-new-cloud-file-system-bucket", s.CloudFileSystemBucketAlreadyExists = "cloud-file-system-bucket-already-exists", s.CloudFileSystemBucketDeletionStarted = "cloud-file-system-bucket-deletion-started", s.CloudFileSystemBucketDeletionCompleted = "cloud-file-system-bucket-deletion-completed", s.CloudFileSystemBucketDeletionFailed = "cloud-file-system-bucket-deletion-failed", 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.RevertRelationalDatabaseMigrationStarted = "revert-relational-database-migration-started", s.RevertRelationalDatabaseMigrationCompleted = "revert-relational-database-migration-completed", s.RevertRelationalDatabaseMigrationFailed = "revert-relational-database-migration-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.ContainerComputeDeploymentStarted = "container-compute-deployment-started", s.ContainerComputeDeploymentCompleted = "container-compute-deployment-completed", s.ContainerComputeDeploymentFailed = "container-compute-deployment-failed", s.ContainerComputeDeletionStarted = "container-compute-deletion-started", s.ContainerComputeDeletionCompleted = "container-compute-deletion-completed", s.ContainerComputeDeletionFailed = "container-compute-deletion-failed", s.SharedDriveDeploymentStarted = "shared-drive-deployment-started", s.SharedDriveDeploymentCompleted = "shared-drive-deployment-completed", s.SharedDriveDeploymentFailed = "shared-drive-deployment-failed", s.SharedDriveAlreadyExists = "shared-drive-already-exists", s.SharedDriveDeletionStarted = "shared-drive-deletion-started", s.SharedDriveDeletionCompleted = "shared-drive-deletion-completed", s.SharedDriveDeletionFailed = "shared-drive-deletion-failed", s.SystemApiTokenProvisioningStarted = "system-api-token-provisioning-started", s.SystemApiTokenProvisioningCompleted = "system-api-token-provisioning-completed", s.SystemApiTokenProvisioningFailed = "system-api-token-provisioning-failed", s.SystemApiTokenAlreadyExists = "system-api-token-already-exists", s))(Ri || {}), dd = /* @__PURE__ */ ((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.RevertRelationalDatabaseMigration = "revert-relational-database-migration", s.BusinessLogicCodebaseDeployment = "business-logic-codebase-deployment", s.ExecutePublicationCompletedEvent = "execute-publication-completed-event", s.CodebaseCleanup = "codebase-cleanup", s.AWSTenantAccountProvisioning = "aws-tenant-account-provisioning", s.ContainerComputeDeployment = "container-compute-deployment", s.ContainerComputeDeletion = "container-compute-deletion", s.SharedDriveDeployment = "shared-drive-deployment", s.SharedDriveDeletion = "shared-drive-deletion", s.CloudFileSystemBucketDeployment = "cloud-file-system-bucket-deployment", s.CloudFileSystemBucketDeletion = "cloud-file-system-bucket-deletion", s.SystemApiTokenProvisioning = "system-api-token-provisioning", s))(dd || {});
148474
+ var cc = /* @__PURE__ */ ((s) => (s.Amazon = "amazon", s.Google = "google", s.Microsoft = "microsoft", s))(cc || {}), Ur = /* @__PURE__ */ ((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.ContainerCompute = "container-compute", s.SharedDrive = "shared-drive", s.CloudFileSystemBucket = "cloud-file-system-bucket", s.SystemApiToken = "system-api-token", s))(Ur || {}), s_ = /* @__PURE__ */ ((s) => (s.Post = "post", s.Get = "get", s.Acknowledgement = "acknowledgment", s.Progress = "progress", s.Error = "error", s.Complete = "complete", s))(s_ || {}), oy = /* @__PURE__ */ ((s) => (s.Queued = "queued", s.Running = "running", s.Success = "success", s.Failed = "failed", s.CleanupInProgress = "cleanup-in-progress", 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))(oy || {}), l_ = /* @__PURE__ */ ((s) => (s.Queued = "queued", s.Running = "running", s.Success = "success", s.Failed = "failed", s.CleanupInProgress = "cleanup-in-progress", s.CleanedUp = "cleaned-up", s.UnrecoverableFailure = "unrecoverable-failure", s.Reverted = "reverted", s.UnpublishingStarted = "unpublishing-started", s.Unpublished = "unpublished", s))(l_ || {}), Ri = /* @__PURE__ */ ((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.CloudFileSystemBucketDeploymentStarted = "cloud-file-system-bucket-deployment-started", s.CloudFileSystemBucketDeploymentCompleted = "cloud-file-system-bucket-deployment-completed", s.CloudFileSystemBucketDeploymentFailed = "cloud-file-system-bucket-deployment-failed", s.CreatingNewCloudFileSystemBucket = "creating-new-cloud-file-system-bucket", s.CloudFileSystemBucketAlreadyExists = "cloud-file-system-bucket-already-exists", s.CloudFileSystemBucketDeletionStarted = "cloud-file-system-bucket-deletion-started", s.CloudFileSystemBucketDeletionCompleted = "cloud-file-system-bucket-deletion-completed", s.CloudFileSystemBucketDeletionFailed = "cloud-file-system-bucket-deletion-failed", 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.RevertRelationalDatabaseMigrationStarted = "revert-relational-database-migration-started", s.RevertRelationalDatabaseMigrationCompleted = "revert-relational-database-migration-completed", s.RevertRelationalDatabaseMigrationFailed = "revert-relational-database-migration-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.ContainerComputeDeploymentStarted = "container-compute-deployment-started", s.ContainerComputeDeploymentCompleted = "container-compute-deployment-completed", s.ContainerComputeDeploymentFailed = "container-compute-deployment-failed", s.ContainerComputeDeletionStarted = "container-compute-deletion-started", s.ContainerComputeDeletionCompleted = "container-compute-deletion-completed", s.ContainerComputeDeletionFailed = "container-compute-deletion-failed", s.SharedDriveDeploymentStarted = "shared-drive-deployment-started", s.SharedDriveDeploymentCompleted = "shared-drive-deployment-completed", s.SharedDriveDeploymentFailed = "shared-drive-deployment-failed", s.SharedDriveAlreadyExists = "shared-drive-already-exists", s.SharedDriveDeletionStarted = "shared-drive-deletion-started", s.SharedDriveDeletionCompleted = "shared-drive-deletion-completed", s.SharedDriveDeletionFailed = "shared-drive-deletion-failed", s.SystemApiTokenProvisioningStarted = "system-api-token-provisioning-started", s.SystemApiTokenProvisioningCompleted = "system-api-token-provisioning-completed", s.SystemApiTokenProvisioningFailed = "system-api-token-provisioning-failed", s.SystemApiTokenAlreadyExists = "system-api-token-already-exists", s.SystemApiTokenRevokingStarted = "system-api-token-revoking-started", s.SystemApiTokenRevokingCompleted = "system-api-token-revoking-completed", s.SystemApiTokenRevokingFailed = "system-api-token-revoking-failed", s))(Ri || {}), dd = /* @__PURE__ */ ((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.RevertRelationalDatabaseMigration = "revert-relational-database-migration", s.BusinessLogicCodebaseDeployment = "business-logic-codebase-deployment", s.ExecutePublicationCompletedEvent = "execute-publication-completed-event", s.CodebaseCleanup = "codebase-cleanup", s.AWSTenantAccountProvisioning = "aws-tenant-account-provisioning", s.ContainerComputeDeployment = "container-compute-deployment", s.ContainerComputeDeletion = "container-compute-deletion", s.SharedDriveDeployment = "shared-drive-deployment", s.SharedDriveDeletion = "shared-drive-deletion", s.CloudFileSystemBucketDeployment = "cloud-file-system-bucket-deployment", s.CloudFileSystemBucketDeletion = "cloud-file-system-bucket-deletion", s.SystemApiTokenProvisioning = "system-api-token-provisioning", s.SystemApiTokenRevoking = "system-api-token-revoking", s))(dd || {});
148475
148475
  Ur.CloudHostedCodebase, Ur.HttpApi, Ur.RelationalDatabase, Ur.CloudHostedCodebase, Ur.CloudHostedCodebase, Ur.RelationalDatabase, Ur.CloudHostedCodebase, Ur.CloudHostedCodebase;
148476
148476
  class sU {
148477
148477
  constructor(u, i, r, a, c, e, f, h, m, T = !1, E) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.7105",
3
+ "version": "0.0.7106",
4
4
  "author": "Sergio Herrero",
5
5
  "license": "UNLICENSED",
6
6
  "description": "An installable module which contains the type definitions and ephemeral state management for a projects' logic tree data structure",
@@ -38,7 +38,7 @@
38
38
  "log:project": "tsx --tsconfig tsconfig.scripts.json scripts/describe-project.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@elyx-code/definitions": "^0.0.80011",
41
+ "@elyx-code/definitions": "^0.0.80012",
42
42
  "axios": "^1.9.0",
43
43
  "dayjs": "^1.11.13",
44
44
  "sql-parser-cst": "^0.33.1",