@elyx-code/project-logic-tree 0.0.6187 → 0.0.6189

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -29136,7 +29136,7 @@ class A {
29136
29136
  return this.autoclose && this.autoCloseActionName && this.autoCloseActionName === a && (this.self && e === ((t = this.self) == null ? void 0 : t.id) || !this.self) && this.close(), this;
29137
29137
  }
29138
29138
  close() {
29139
- return this.open = !1, !this.isValid && this.self && !this.added[this.self.id] && !this.updated[this.self.id] && this.removed[this.self.id], this.isEmpty ? (this.project.discardChangeSet(this), this) : (this.discardOrphans(), this.project.closeChangeSet(this), this);
29139
+ return this.open = !1, !this.isValid && this.self && !this.added[this.self.id] && !this.updated[this.self.id] && this.removed[this.self.id], this.discardOrphans(), this.isEmpty ? (console.warn(`Empty change-set (${this.id}) discarded upon closing.`), this.project.discardChangeSet(this), this) : (this.project.closeChangeSet(this), this);
29140
29140
  }
29141
29141
  get(a) {
29142
29142
  return this.added[a] ? this.added[a] : this.updated[a] ? this.updated[a] : this.removed[a] ? this.removed[a] : null;
@@ -64404,9 +64404,10 @@ const oe = class oe extends tt {
64404
64404
  };
64405
64405
  }
64406
64406
  async closePendingCallbacks() {
64407
+ console.log("Closing pending callbacks");
64407
64408
  for (let e = 0; e < this.history.length; e++) {
64408
64409
  const t = this.history[e];
64409
- t.dirty && await this.closeChangeSet(t);
64410
+ t.dirty && await t.closeAsync();
64410
64411
  }
64411
64412
  }
64412
64413
  async onCloseChangeSet(e) {
@@ -40,7 +40,7 @@ Please provide a unique 'name' string.`,severity:D.Error,code:j.NameNotUniqueInS
40
40
  Please provide a unique 'name' string.`,severity:D.Error,code:j.NameNotUniqueInScope,issue:null}))}}return e}function Tc(i,s){const e=[];i.name||e.push(new P({id:`${i.id}--${j.EmptyName}`,message:`Entity with id "${i.id}" and type "${i.type}" has an empty name. Please provide a 'name' string.`,severity:D.Error,code:j.EmptyName,issue:null}));const t=B(i.parent);if(!t)e.push(new P({id:`${i.id}--parent-reference--${A.InvalidReferenceObjectStructure}`,message:`Reference object at 'parent' property for entity with id "${i.id}" and type "${i.type}" is not a valid reference. A reference needs to be a 'id' string of an existing entity in the project.`,severity:D.Error,code:A.InvalidReferenceObjectStructure,issue:null}));else{const r=s.get(t);if(!r)e.push(new P({id:`${i.id}--parent-reference--${A.ReferencedEntityNotFound}`,message:`The entity with id '${t}' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,severity:D.Error,code:A.ReferencedEntityNotFound,issue:null}));else{const d=xc(r).filter(o=>o.name===i.name);d.length&&e.push(new P({id:`${i.id}--${j.NameNotUniqueInScope}`,message:`Entity with id "${i.id}" and type "${i.type}" has a name "${i.name}" that is not unique among all inputs declared in the parent entity. Entity with id "${d[0].id}" has the same name.
41
41
  Please provide a unique 'name' string.`,severity:D.Error,code:j.NameNotUniqueInScope,issue:null}))}}return e}function Ec(i,s){const e=[];i.name||e.push(new P({id:`${i.id}--${j.EmptyName}`,message:`Entity with id "${i.id}" and type "${i.type}" has an empty name. Please provide a 'name' string.`,severity:D.Error,code:j.EmptyName,issue:null}));const t=B(i.parent);if(!t)e.push(new P({id:`${i.id}--parent-reference--${A.InvalidReferenceObjectStructure}`,message:`Reference object at 'parent' property for entity with id "${i.id}" and type "${i.type}" is not a valid reference. A reference needs to be a 'id' string of an existing entity in the project.`,severity:D.Error,code:A.InvalidReferenceObjectStructure,issue:null}));else{const r=s.get(t);if(!r)e.push(new P({id:`${i.id}--parent-reference--${A.ReferencedEntityNotFound}`,message:`The entity with id '${t}' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,severity:D.Error,code:A.ReferencedEntityNotFound,issue:null}));else{const d=fP(r).filter(o=>o.name===i.name);d.length&&e.push(new P({id:`${i.id}--${j.NameNotUniqueInScope}`,message:`Entity with id "${i.id}" and type "${i.type}" has a name "${i.name}" that is not unique among all outputs declared in the parent entity. Entity with id "${d[0].id}" has the same name.
42
42
  Please provide a unique 'name' string.`,severity:D.Error,code:j.NameNotUniqueInScope,issue:null}))}}return e}function F7(i,s){switch(i.type){case n.DefinitionEntity:return yc(i,s);case n.FunctionDeclaration:return hc(i,s);case n.VariableDeclaration:return mc(i,s);case n.Property:return vc(i,s);case n.ArgumentDeclaration:return Tc(i,s);case n.ReturnDeclaration:return Ec(i,s);default:return[]}}function q1(i,s,e){const r=`${Vd(i)}-${s}-id`;return e.instances[r]?I.UUID.uuid():r}function Ic(i,s){let e="",t=null;if(i.parent){const a=s.get(i.parent);a&&(t=a)}let r="";return t&&(r=`${Vd(F(t,s))}-`),e=`${r}${Vd(F(i,s))}-id`,s.instances[e]?I.UUID.uuid():e}function ct(i,s,e="uuid"){return e==="semantic"?q1(F(i,s),i.type,s):I.UUID.uuid()}function x7(i){var d;const s=l6(),e=i.toJSON();s.safeParse(e).success;const r=S7(i);(d=i.dataType)==null||d.validate();const a=[...r];if(i.id==="80c86e1b-caca-4ba5-9b1f-38f72d10e4a3"){const o=ye({id:`${i.id}--${q.PropertyImplementsNonAbstact}`,message:`Property "${F(i,i.project)}" with id "${i.id}" implements a non-abstract property "${F(i,i.project)}" with id "${i.id}".`,issue:null,severity:D.Error,code:q.PropertyImplementsNonAbstact,entity:i});a.push(o.error)}return a}function S7(i){const s=[];if(!i.implements)return s;const e=i.implements;if(!e.abstract){const r=ye({id:`${i.id}--${q.PropertyImplementsNonAbstact}`,message:`Property "${F(i,i.project)}" with id "${i.id}" implements a non-abstract property "${F(e,i.project)}" with id "${e.id}".`,issue:null,severity:D.Error,code:q.PropertyImplementsNonAbstact,entity:i});s.push(r.error)}if(i.static&&!e.static){const r=ye({id:`${i.id}--${q.NonStaticPropertyImplementsStatic}`,message:`Static property "${F(i,i.project)}" with id "${i.id}" implements a non-static property "${F(e,i.project)}" with id "${e.id}".`,issue:null,severity:D.Error,code:q.NonStaticPropertyImplementsStatic,entity:i});s.push(r.error)}if(!i.static&&e.static){const r=ye({id:`${i.id}--${q.StaticPropertyImplementsNonStatic}`,message:`Non-static property "${F(i,i.project)}" with id "${i.id}" implements a static property "${F(e,i.project)}" with id "${e.id}".`,issue:null,severity:D.Error,code:q.StaticPropertyImplementsNonStatic,entity:i});s.push(r.error)}if(!Ir(i.dataType,e.dataType)){const r=ye({id:`${i.id}--${q.PropertyImplementsIncompatibleType}`,message:`Property "${F(i,i.project)}" with id "${i.id}" implements a property "${F(e,i.project)}" with id "${e.id}" that has an incompatible data type.`,issue:null,severity:D.Error,code:q.PropertyImplementsIncompatibleType,entity:i});s.push(r.error)}return ze(i.errors,s)}function k7(i,s){const e=[];if(i.parent){const r=s.get(i.parent);if(!r)e.push(new P({id:`${i.id}--${i.parent}--${A.ReferencedEntityNotFound}`,code:A.ReferencedEntityNotFound,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", is referencing an entity with id "${i.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}));else{const a=zi(r);if(a){const d=r!==a?`The entity of type '${i.type}' with id '${i.id}' have 'parent' with id '${i.parent}' because the entity belongs to a built-in '${a.type}' entity with id '${a.id}' (${F(a,r.project)}) higher up in the tree.`:`The entity of type '${i.type}' with id '${i.id}' have 'parent' with id '${i.parent}' because it is a built-in entity of type ${a.type}.`;e.push(new P({id:`${i.id}--${A.InvalidBuiltInEntityReference}`,code:A.InvalidBuiltInEntityReference,severity:D.Error,message:d,issue:null}))}else if(![n.DefinitionEntity].includes(r.type))e.push(new P({id:`${i.id}--${i.parent}--${A.InvalidParentReference}`,code:A.InvalidParentReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has a parent reference that isn't pointing to an entity of type 'definition-entity'.`,issue:null}));else{const o=Wi(r).filter(l=>!l.interactive);if(o.length){let l=o.length>1?`The entity of type '${i.type}' with id '${i.id}' can't be added to the 'parent' entity with id '${r.id}' because it extends or implements multiple '${n.BuiltInBaseEntity}' entities that are non-interactive ("${ie(o.map(u=>F(u,u.project)),'", "','" and "')}").`:`The entity of type '${i.type}' with id '${i.id}' can't be added to the 'parent' entity with id '${r.id}' because it extends or implements a '${n.BuiltInBaseEntity}' entity that is non-interactive ("${F(o[0],o[0].project)}").`;l+=`
43
- ${Zi}`,e.push(new P({id:`${i.id}--${A.NonInteractiveEntityReferenced}`,code:A.NonInteractiveEntityReferenced,severity:D.Error,message:l,issue:null}))}else if(i.implements){const l=s.get(i.implements);if(i.id===i.implements)return e.push(new P({id:`${i.id}--${i.implements}--${A.SelfReference}`,code:A.SelfReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has a reference to itself at 'implements'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null})),e;if(!l)e.push(new P({id:`${i.id}--${i.implements}--${A.ReferencedEntityNotFound}`,code:A.ReferencedEntityNotFound,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", is referencing an entity with id "${i.implements}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}));else{const u=r.properties.find(h=>{var c;return((c=h.implements)==null?void 0:c.id)===i.implements});u?e.push(new P({id:`${i.id}--${j.PropertyOverwrite}`,code:j.PropertyOverwrite,severity:D.Error,message:`The property with id "${i.id}" is trying to implement the property with id "${i.implements}", but the parent entity already has a property with id '${u.id}' that implements the same base property.`,issue:null})):[n.Property].includes(l.type)?l.abstract||e.push(new P({id:`${i.id}--${i.implements}--${A.InvalidImplementsReference}`,code:A.InvalidImplementsReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'implements' reference that isn't pointing to an abstract entity.`,issue:null})):e.push(new P({id:`${i.id}--${i.implements}--${A.InvalidImplementsReference}`,code:A.InvalidImplementsReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'implements' reference that isn't pointing to an entity of type 'property'.`,issue:null}))}}}}}const t=Et(i,{},s);return e.push(...t.errors),e}class rt{constructor(s){f(this,"version");f(this,"previousVersion",null);f(this,"createdAt");f(this,"deleted",!1);f(this,"author");this.version=s.version,this.previousVersion=s.previousVersion,this.createdAt=T(s.createdAt).toISOString(),this.deleted=s.deleted,this.author=s.author}metaSync(s){this.deleted=s.deleted!==void 0?s.deleted:this.deleted}}var Ac=(i=>(i.Manual="manual",i.Automatic="automatic",i))(Ac||{}),b=(i=>(i.Added="added",i.Updated="updated",i.Removed="removed",i.Affected="affected",i))(b||{});class R{constructor(s,e,t,r,a=!1,d=""){f(this,"id",I.UUID.uuid());f(this,"seenEntities",[]);f(this,"added",{});f(this,"updated",{});f(this,"removed",{});f(this,"affected",{});f(this,"self",null);f(this,"author");f(this,"timestamp");f(this,"open",!0);f(this,"dirty",!0);f(this,"type","manual");f(this,"autoclose",!1);f(this,"autoCloseActionName","");f(this,"project");if(this.project=s,this.author=e||I.sessionAuthor||"",this.timestamp=t,this.self=r,this.autoclose=a,this.autoCloseActionName=d,this.autoclose&&!this.autoCloseActionName)throw new Error("Auto-close change-set must have an auto-close action name.")}get isEmpty(){return Object.keys(this.added).length===0&&Object.keys(this.updated).length===0&&Object.keys(this.removed).length===0}get isValid(){var s;return!(this.isEmpty&&this.self&&!this.affected[(s=this.self)==null?void 0:s.id])}get list(){return[...Object.values(this.added),...Object.values(this.updated),...Object.values(this.removed)]}get listAdded(){return Object.values(this.added)}get listUpdated(){return Object.values(this.updated)}get listRemoved(){return Object.values(this.removed)}get listAffected(){return Object.values(this.affected)}get addedIds(){return Object.keys(this.added)}get updatedIds(){return Object.keys(this.updated)}get removedIds(){return Object.keys(this.removed)}get affectedIds(){return Object.keys(this.affected)}discardOrphans(){const s=[...this.addedIds,...this.updatedIds],e=this.project.toFlatIds(),t=Vr(),r=e.filter(d=>!t.includes(d));s.filter(d=>!r.includes(d)).forEach(d=>{this.remove(d)})}async attemptAutocloseAsync(s,e){var t;return this.autoclose&&this.autoCloseActionName&&this.autoCloseActionName===s&&(this.self&&e===((t=this.self)==null?void 0:t.id)||!this.self)&&await this.closeAsync(),this}async closeAsync(){return this.open=!1,!this.isValid&&this.self&&!this.added[this.self.id]&&!this.updated[this.self.id]&&this.removed[this.self.id],this.discardOrphans(),this.isEmpty?(console.warn(`Empty change-set (${this.id}) discarded upon closing.`),this.project.discardChangeSet(this),this):(await this.project.closeChangeSet(this),this)}attemptAutoclose(s,e){var t;return this.autoclose&&this.autoCloseActionName&&this.autoCloseActionName===s&&(this.self&&e===((t=this.self)==null?void 0:t.id)||!this.self)&&this.close(),this}close(){return this.open=!1,!this.isValid&&this.self&&!this.added[this.self.id]&&!this.updated[this.self.id]&&this.removed[this.self.id],this.isEmpty?(this.project.discardChangeSet(this),this):(this.discardOrphans(),this.project.closeChangeSet(this),this)}get(s){return this.added[s]?this.added[s]:this.updated[s]?this.updated[s]:this.removed[s]?this.removed[s]:null}remove(s){return this.has(s)&&(delete this.added[s],delete this.updated[s],delete this.removed[s],delete this.affected[s],this.seenEntities=this.seenEntities.filter(e=>e!==s)),this}add(s,e){if(!this.open||!this.dirty)return this;const t=Array.from(new Set([...this.project.getAllBuiltInIds(),...Vr()]));if(t.includes(s.id))return this;if(!Xd(s,{...this.project.instances,...this.project.builtInInstances}).every(d=>!t.includes(d)))return this;if(this.seenEntities.indexOf(s.id)===-1&&this.seenEntities.push(s.id),(e==="updated"||e==="removed")&&!this.has(s.id)&&s.createdAt!==this.timestamp){s.increaseVersion(this.timestamp);const{added:d,updated:o,removed:l,affected:u}=s.recursiveCaptureUpstreamVersions(this.timestamp);for(const h of d)this.add(h,"added");for(const h of o)this.add(h,"updated");for(const h of l)this.add(h,"removed");for(const h of u)this.add(h,"affected")}if(e==="added"&&!this.has(s.id)&&s.createdAt!==this.timestamp){const{added:d,updated:o,removed:l,affected:u}=s.recursiveCaptureUpstreamVersions(this.timestamp);for(const h of d)this.add(h,"added");for(const h of o)this.add(h,"updated");for(const h of l)this.add(h,"removed");for(const h of u)this.add(h,"affected")}if(e==="removed"){if(this.added[s.id])return delete this.added[s.id],this.seenEntities=this.seenEntities.filter(d=>d!==s.id),delete this.project.deletedInstances[s.id],this;this.updated[s.id]&&delete this.updated[s.id],this.affected[s.id]&&delete this.affected[s.id],this.removed[s.id]=s}if(e==="added"){if(this.removed[s.id])return this;this.updated[s.id]&&delete this.updated[s.id],this.affected[s.id]&&delete this.affected[s.id],this.added[s.id]=s}if(e==="updated"){if(this.removed[s.id])return this;if(this.added[s.id])return this;this.affected[s.id]&&delete this.affected[s.id],this.updated[s.id]=s}if(e==="affected"){if(this.removed[s.id])return this;if(this.added[s.id])return this;if(this.updated[s.id])return this;this.affected[s.id]=s}return this}toJSON(){const s={},e={},t={},r=new Set;for(const a of Object.values(this.added))s[a.id]=a.toShallowJSON();for(const a of Object.values(this.updated))e[a.id]=a.toShallowJSON();for(const a of Object.values(this.removed))t[a.id]=a.toShallowJSON();for(const a of Object.values(this.affected))r.add(a.id);return{added:s,updated:e,removed:t,affected:Array.from(r),self:this.self?this.self.toShallowJSON():null,seenEntities:this.seenEntities}}has(s){return!!this.added[s]||!!this.removed[s]||!!this.updated[s]||!!this.affected[s]}hasAdded(s){return!!this.added[s]}hasUpdated(s){return!!this.updated[s]}hasRemoved(s){return!!this.removed[s]}hasAffected(s){return!!this.affected[s]}}function Z7(i){return new Set([...Object.keys(i.added),...Object.keys(i.updated),...Object.keys(i.removed),...Array.from(i.affected)])}var J1=(i=>(i.Implements="implements",i.DataTypeEntity="data-type-entity",i))(J1||{});const Ie=class Ie extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"name");f(this,"description",null);f(this,"private");f(this,"abstract");f(this,"index");f(this,"static");f(this,"required");f(this,"constant",!1);f(this,"type",n.Property);f(this,"hidden",!1);f(this,"defaultValue",null);f(this,"dataType",null);f(this,"implements",null);f(this,"project");f(this,"errors",[]);f(this,"parent");f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"suggestion",!1);this.initialData=e,this.project=t,this.id=e.id,this.name=e.name,this.description=e.description,this.private=e.private,this.abstract=e.abstract,this.index=e.index,this.static=e.static,this.required=e.required||!1,this.hidden=e.hidden||!1,this.constant=e.constant||!1}static fromGenerationTarget(e,t){const r=B(e.parent),a=t.get(r);let d=null;if(e.implements){const u=B(e.implements);d=t.get(u)}const o={id:e.id,version:I.UUID.uuid(),createdAt:T().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,name:e.name,type:n.Property,index:a.properties.length,private:e.private||!1,abstract:e.abstract||!1,static:e.static||!1,required:e.required||!1,constant:e.constant||!1,hidden:!1,description:e.description,defaultValue:null,implements:d,dataType:null,parent:a},l=V(o,t);return l.setParent(a,null),l.initChildren(null),l}static validateGenerationTarget(e,t){let r=JSON.parse(JSON.stringify(e));const a=[],d=k7(r,t),o=vc(r,t);return a.push(...d,...o,...ot(r)),{errors:a,modifiedData:r}}get isExtendedProperty(){const e=this.parent.allBasePropertiesFromExtendedAndImplementedEntities.find(t=>t.name===this.name);return!!e&&e.id!==this.id&&!e.abstract}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new P({id:`${this.id}--${A.InvalidParentUpdate}`,code:A.InvalidParentUpdate,severity:D.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated, as it would mean moving the '${this.type}' entity to another parent entity.
43
+ ${Zi}`,e.push(new P({id:`${i.id}--${A.NonInteractiveEntityReferenced}`,code:A.NonInteractiveEntityReferenced,severity:D.Error,message:l,issue:null}))}else if(i.implements){const l=s.get(i.implements);if(i.id===i.implements)return e.push(new P({id:`${i.id}--${i.implements}--${A.SelfReference}`,code:A.SelfReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has a reference to itself at 'implements'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null})),e;if(!l)e.push(new P({id:`${i.id}--${i.implements}--${A.ReferencedEntityNotFound}`,code:A.ReferencedEntityNotFound,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", is referencing an entity with id "${i.implements}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}));else{const u=r.properties.find(h=>{var c;return((c=h.implements)==null?void 0:c.id)===i.implements});u?e.push(new P({id:`${i.id}--${j.PropertyOverwrite}`,code:j.PropertyOverwrite,severity:D.Error,message:`The property with id "${i.id}" is trying to implement the property with id "${i.implements}", but the parent entity already has a property with id '${u.id}' that implements the same base property.`,issue:null})):[n.Property].includes(l.type)?l.abstract||e.push(new P({id:`${i.id}--${i.implements}--${A.InvalidImplementsReference}`,code:A.InvalidImplementsReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'implements' reference that isn't pointing to an abstract entity.`,issue:null})):e.push(new P({id:`${i.id}--${i.implements}--${A.InvalidImplementsReference}`,code:A.InvalidImplementsReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'implements' reference that isn't pointing to an entity of type 'property'.`,issue:null}))}}}}}const t=Et(i,{},s);return e.push(...t.errors),e}class rt{constructor(s){f(this,"version");f(this,"previousVersion",null);f(this,"createdAt");f(this,"deleted",!1);f(this,"author");this.version=s.version,this.previousVersion=s.previousVersion,this.createdAt=T(s.createdAt).toISOString(),this.deleted=s.deleted,this.author=s.author}metaSync(s){this.deleted=s.deleted!==void 0?s.deleted:this.deleted}}var Ac=(i=>(i.Manual="manual",i.Automatic="automatic",i))(Ac||{}),b=(i=>(i.Added="added",i.Updated="updated",i.Removed="removed",i.Affected="affected",i))(b||{});class R{constructor(s,e,t,r,a=!1,d=""){f(this,"id",I.UUID.uuid());f(this,"seenEntities",[]);f(this,"added",{});f(this,"updated",{});f(this,"removed",{});f(this,"affected",{});f(this,"self",null);f(this,"author");f(this,"timestamp");f(this,"open",!0);f(this,"dirty",!0);f(this,"type","manual");f(this,"autoclose",!1);f(this,"autoCloseActionName","");f(this,"project");if(this.project=s,this.author=e||I.sessionAuthor||"",this.timestamp=t,this.self=r,this.autoclose=a,this.autoCloseActionName=d,this.autoclose&&!this.autoCloseActionName)throw new Error("Auto-close change-set must have an auto-close action name.")}get isEmpty(){return Object.keys(this.added).length===0&&Object.keys(this.updated).length===0&&Object.keys(this.removed).length===0}get isValid(){var s;return!(this.isEmpty&&this.self&&!this.affected[(s=this.self)==null?void 0:s.id])}get list(){return[...Object.values(this.added),...Object.values(this.updated),...Object.values(this.removed)]}get listAdded(){return Object.values(this.added)}get listUpdated(){return Object.values(this.updated)}get listRemoved(){return Object.values(this.removed)}get listAffected(){return Object.values(this.affected)}get addedIds(){return Object.keys(this.added)}get updatedIds(){return Object.keys(this.updated)}get removedIds(){return Object.keys(this.removed)}get affectedIds(){return Object.keys(this.affected)}discardOrphans(){const s=[...this.addedIds,...this.updatedIds],e=this.project.toFlatIds(),t=Vr(),r=e.filter(d=>!t.includes(d));s.filter(d=>!r.includes(d)).forEach(d=>{this.remove(d)})}async attemptAutocloseAsync(s,e){var t;return this.autoclose&&this.autoCloseActionName&&this.autoCloseActionName===s&&(this.self&&e===((t=this.self)==null?void 0:t.id)||!this.self)&&await this.closeAsync(),this}async closeAsync(){return this.open=!1,!this.isValid&&this.self&&!this.added[this.self.id]&&!this.updated[this.self.id]&&this.removed[this.self.id],this.discardOrphans(),this.isEmpty?(console.warn(`Empty change-set (${this.id}) discarded upon closing.`),this.project.discardChangeSet(this),this):(await this.project.closeChangeSet(this),this)}attemptAutoclose(s,e){var t;return this.autoclose&&this.autoCloseActionName&&this.autoCloseActionName===s&&(this.self&&e===((t=this.self)==null?void 0:t.id)||!this.self)&&this.close(),this}close(){return this.open=!1,!this.isValid&&this.self&&!this.added[this.self.id]&&!this.updated[this.self.id]&&this.removed[this.self.id],this.discardOrphans(),this.isEmpty?(console.warn(`Empty change-set (${this.id}) discarded upon closing.`),this.project.discardChangeSet(this),this):(this.project.closeChangeSet(this),this)}get(s){return this.added[s]?this.added[s]:this.updated[s]?this.updated[s]:this.removed[s]?this.removed[s]:null}remove(s){return this.has(s)&&(delete this.added[s],delete this.updated[s],delete this.removed[s],delete this.affected[s],this.seenEntities=this.seenEntities.filter(e=>e!==s)),this}add(s,e){if(!this.open||!this.dirty)return this;const t=Array.from(new Set([...this.project.getAllBuiltInIds(),...Vr()]));if(t.includes(s.id))return this;if(!Xd(s,{...this.project.instances,...this.project.builtInInstances}).every(d=>!t.includes(d)))return this;if(this.seenEntities.indexOf(s.id)===-1&&this.seenEntities.push(s.id),(e==="updated"||e==="removed")&&!this.has(s.id)&&s.createdAt!==this.timestamp){s.increaseVersion(this.timestamp);const{added:d,updated:o,removed:l,affected:u}=s.recursiveCaptureUpstreamVersions(this.timestamp);for(const h of d)this.add(h,"added");for(const h of o)this.add(h,"updated");for(const h of l)this.add(h,"removed");for(const h of u)this.add(h,"affected")}if(e==="added"&&!this.has(s.id)&&s.createdAt!==this.timestamp){const{added:d,updated:o,removed:l,affected:u}=s.recursiveCaptureUpstreamVersions(this.timestamp);for(const h of d)this.add(h,"added");for(const h of o)this.add(h,"updated");for(const h of l)this.add(h,"removed");for(const h of u)this.add(h,"affected")}if(e==="removed"){if(this.added[s.id])return delete this.added[s.id],this.seenEntities=this.seenEntities.filter(d=>d!==s.id),delete this.project.deletedInstances[s.id],this;this.updated[s.id]&&delete this.updated[s.id],this.affected[s.id]&&delete this.affected[s.id],this.removed[s.id]=s}if(e==="added"){if(this.removed[s.id])return this;this.updated[s.id]&&delete this.updated[s.id],this.affected[s.id]&&delete this.affected[s.id],this.added[s.id]=s}if(e==="updated"){if(this.removed[s.id])return this;if(this.added[s.id])return this;this.affected[s.id]&&delete this.affected[s.id],this.updated[s.id]=s}if(e==="affected"){if(this.removed[s.id])return this;if(this.added[s.id])return this;if(this.updated[s.id])return this;this.affected[s.id]=s}return this}toJSON(){const s={},e={},t={},r=new Set;for(const a of Object.values(this.added))s[a.id]=a.toShallowJSON();for(const a of Object.values(this.updated))e[a.id]=a.toShallowJSON();for(const a of Object.values(this.removed))t[a.id]=a.toShallowJSON();for(const a of Object.values(this.affected))r.add(a.id);return{added:s,updated:e,removed:t,affected:Array.from(r),self:this.self?this.self.toShallowJSON():null,seenEntities:this.seenEntities}}has(s){return!!this.added[s]||!!this.removed[s]||!!this.updated[s]||!!this.affected[s]}hasAdded(s){return!!this.added[s]}hasUpdated(s){return!!this.updated[s]}hasRemoved(s){return!!this.removed[s]}hasAffected(s){return!!this.affected[s]}}function Z7(i){return new Set([...Object.keys(i.added),...Object.keys(i.updated),...Object.keys(i.removed),...Array.from(i.affected)])}var J1=(i=>(i.Implements="implements",i.DataTypeEntity="data-type-entity",i))(J1||{});const Ie=class Ie extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"name");f(this,"description",null);f(this,"private");f(this,"abstract");f(this,"index");f(this,"static");f(this,"required");f(this,"constant",!1);f(this,"type",n.Property);f(this,"hidden",!1);f(this,"defaultValue",null);f(this,"dataType",null);f(this,"implements",null);f(this,"project");f(this,"errors",[]);f(this,"parent");f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"suggestion",!1);this.initialData=e,this.project=t,this.id=e.id,this.name=e.name,this.description=e.description,this.private=e.private,this.abstract=e.abstract,this.index=e.index,this.static=e.static,this.required=e.required||!1,this.hidden=e.hidden||!1,this.constant=e.constant||!1}static fromGenerationTarget(e,t){const r=B(e.parent),a=t.get(r);let d=null;if(e.implements){const u=B(e.implements);d=t.get(u)}const o={id:e.id,version:I.UUID.uuid(),createdAt:T().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,name:e.name,type:n.Property,index:a.properties.length,private:e.private||!1,abstract:e.abstract||!1,static:e.static||!1,required:e.required||!1,constant:e.constant||!1,hidden:!1,description:e.description,defaultValue:null,implements:d,dataType:null,parent:a},l=V(o,t);return l.setParent(a,null),l.initChildren(null),l}static validateGenerationTarget(e,t){let r=JSON.parse(JSON.stringify(e));const a=[],d=k7(r,t),o=vc(r,t);return a.push(...d,...o,...ot(r)),{errors:a,modifiedData:r}}get isExtendedProperty(){const e=this.parent.allBasePropertiesFromExtendedAndImplementedEntities.find(t=>t.name===this.name);return!!e&&e.id!==this.id&&!e.abstract}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new P({id:`${this.id}--${A.InvalidParentUpdate}`,code:A.InvalidParentUpdate,severity:D.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated, as it would mean moving the '${this.type}' entity to another parent entity.
44
44
  This is likely an incorrect strategy, either the '${this.type}' entity doesn't need to be updated or it should be deleted and a new one created in the desired parent.`,issue:null})),(e.readsValue||e.writesValue)&&t.push(new P({id:`${this.id}--${j.InvalidObjectStructure}`,code:j.InvalidObjectStructure,severity:D.Error,message:`Entity of type '${this.type}' with id '${this.id}' is not a value reading or writing entity.
45
45
  ${Ld}`,issue:null})),{errors:t,modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(){const e=[],t=[],r=[],a=[];return Object.values(this.detachedDependents).forEach(d=>{const o=d.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),r.push(...o.removed),a.push(...o.affected)}),{updated:p(e),added:p(t),removed:p(r),affected:p(a),self:this}}onDetachedDependencyRemoved(e,t,r){const a=[],d=[],o=[],l=[];return t==="implements"&&(this.setImplements(null,r),a.push(this)),{updated:p(a),added:p(d),removed:p(o),affected:p(l),self:this}}onDetachedDependencyRestored(e,t,r){const a=[],d=[],o=[],l=[];return t==="implements"&&(this.setImplements(e,r),a.push(this)),{updated:p(a),added:p(d),removed:p(o),affected:p(l),self:this}}subscribeToDependencies(){var e,t,r,a,d;return(t=(e=this.implements)==null?void 0:e.subscribeDependents)==null||t.call(e,[{entity:this,field:"implements"}]),(d=(a=(r=this.dataType)==null?void 0:r.entity)==null?void 0:a.subscribeDependents)==null||d.call(a,[{entity:this,field:"data-type-entity"}]),this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=I.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t,r;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new Ie(this,this.project);return(r=this.knownVersions)==null||r.set(this.version,e),e.defaultValue=this.defaultValue,e.dataType=this.dataType,e.implements=this.implements,e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],r=[],a=[],d=[];if(this.parent&&this.parent.type!==n.PrimitiveEntity&&this.parent.type!==n.BuiltInBaseEntity){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),r.push(...o.added),a.push(...o.removed)}return{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}async restoreVersion(e){var l;const t=[],r=[],a=[],d=[];if(this.version===e)return{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this};if(!this.knownVersions){const u=new Map;for(const[h,c]of this.knownVersions||new Map){if(u.set(h,c),c.activeVersion=!1,c.knownVersions)for(const[v,E]of c.knownVersions)u.set(v,E);c.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new Ie(u,this.project)}return this.metaSync(o.toShallowJSON(),null),this.defaultValue=o.defaultValue,this.dataType=o.dataType,this.implements=o.implements,this.parent=o.parent,{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}hydrateAncestors(){const e=[],t=[],r=[],a=[];if(this.initialData.parent){const d=B(this.initialData.parent),o=this.project.get(d);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${Wt(this.type)} with id '${this.id}' has a parent reference "${d}" which is missing in the project`)}else throw new Error(`${Wt(this.type)} with id '${this.id}' is missing a parent reference`);if(this.initialData.implements){const d=B(this.initialData.implements),o=this.project.get(d);o&&(this.setImplements(o,null),e.push(o))}return{updated:p(e),added:p(t),removed:p(r),affected:p(a),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],r=[],a=[],d=[];return this.initialized=!0,this.captureVersion(),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}addSelfToProject(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"add-self-to-project"))){const t=[this],r=[],a=[],d=[];return this.parent.addProperty(this),t.push(this.parent),this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}setParent(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"set-parent"))){var r;return((r=this.parent)==null?void 0:r.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,b.Updated),t==null||t.attemptAutoclose("set-parent",this.id))),this}setImplements(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"set-implements"))){var r;return((r=this.implements)==null?void 0:r.id)!==(e==null?void 0:e.id)&&(this.implements=e,t&&(t==null||t.add(this,b.Updated),t==null||t.attemptAutoclose("set-implements",this.id))),this}initChildren(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=V(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(e)),this.initialData.dataType){const t=V(this.initialData.dataType,this.project);t.setParent(this,null),t.initChildren(e),this.dataType=t}if(this.initialData.implements){const t=V(this.initialData.implements,this.project);this.setImplements(t,null)}return this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-meta"))){const r=dt(this,e);return e.deleted===!0&&!this.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&this.deleted?t==null||t.add(this,b.Added):r&&(t==null||t.add(this,b.Updated)),super.metaSync(e),this.name=e.name||this.name,this.description=e.description||this.description,this.abstract=e.abstract!==void 0?e.abstract:this.abstract,this.private=e.private!==void 0?e.private:this.private,this.index=e.index||(e.index!==0?this.index:0),this.static=e.static!==void 0?e.static:this.static,this.hidden=e.hidden!==void 0?e.hidden:this.hidden,this.constant=e.constant!==void 0?e.constant:this.constant,this.required=e.required!==void 0?e.required:this.required,t==null||t.attemptAutoclose("sync-meta",this.id),this}async APILoad(e=L,...t){return await Ie.repository.APILoad(this.id,...t),this}async APICreate(e=L,...t){return await Ie.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=L,...t){return await Ie.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=L,...t){return await Ie.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=L,...t){return await Ie.repository.APIClone(this.id,...t),this}async APILoadVersion(e=L,t,...r){return await Ie.repository.APILoadVersion(this.id,t,...r)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"remove-entity"))){const r=[],a=[],d=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(a.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(l=>{const{updated:u,removed:h,added:c}=l.entity.onDetachedDependencyRemoved(this,l.field,t);r.push(...u),a.push(...h),d.push(...c)}),this.defaultValue){const{updated:l,removed:u}=this.defaultValue.remove({ignoreUpstream:!0},t);r.push(...l),a.push(...u)}if(this.dataType){const{updated:l,removed:u}=this.dataType.remove({ignoreUpstream:!0},t);r.push(...l),a.push(...u)}return e||this.parent.type===n.DefinitionEntity&&(this.parent.removeProperty(this),r.push(this.parent)),t==null||t.attemptAutoclose("remove-entity",this.id),{added:p(d),updated:p(r),removed:p(a),affected:p(o),self:this}}restore({}={},e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"restore-entity"))){const t=[],r=[],a=[],d=[];if(e!=null&&e.hasAdded(this.id))return e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),this.defaultValue){const{updated:o}=this.defaultValue.restore({},e);r.push(...o)}if(this.dataType){const{updated:o}=this.dataType.restore({},e);r.push(...o)}return this.parent.type===n.DefinitionEntity&&(this.parent.addProperty(this),r.push(this.parent)),e==null||e.attemptAutoclose("restore-entity",this.id),{added:p(t),updated:p(r),removed:p(a),affected:p(d),self:this}}toFlat(e=new Set){var r,a;return e.has(this.id)?[]:(e.add(this.id),[this,...((r=this.defaultValue)==null?void 0:r.toFlat(e))||[],...((a=this.dataType)==null?void 0:a.toFlat(e))||[],...this.parent.toFlat(e)])}toFlatIds(e=new Set){var r,a;return e.has(this.id)?[]:(e.add(this.id),[this.id,...((r=this.defaultValue)==null?void 0:r.toFlatIds(e))||[],...((a=this.dataType)==null?void 0:a.toFlatIds(e))||[],...this.parent.toFlatIds(e)])}toJSON(e=new Set){var t,r,a;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,index:this.index,private:this.private,required:this.required,static:this.static,constant:this.constant,abstract:this.abstract,hidden:this.hidden,defaultValue:((t=this.defaultValue)==null?void 0:t.toJSON(e))||null,dataType:((r=this.dataType)==null?void 0:r.toJSON(e))||null,implements:((a=this.implements)==null?void 0:a.toJSON(e))||null,parent:this.parent.toReference()})}toJSONClone(e=Z){var r,a,d,o,l,u,h;let t;return(r=e.seenEntityMaps)!=null&&r.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||ct(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(d=e.seenEntities)!=null&&d.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:I.UUID.uuid(),createdAt:e.timestamp||T().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,type:this.type,name:this.name,description:this.description,index:this.index,private:this.private,required:this.required,static:this.static,constant:this.constant,abstract:this.abstract,hidden:this.hidden,defaultValue:((u=this.defaultValue)==null?void 0:u.toJSONClone({...e,newId:null}))||null,dataType:((h=this.dataType)==null?void 0:h.toJSONClone({...e,newId:null}))||null,implements:(()=>{var c;return this.implements&&this.project.getBuiltIn(this.implements.id)?this.implements.toJSON():((c=this.implements)==null?void 0:c.toJSONClone({...e,newId:null}))||null})(),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+I.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=Z){var r,a,d,o;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,name:this.name,description:this.description,type:this.type,index:this.index,private:this.private,required:this.required,abstract:this.abstract,static:this.static,constant:this.constant,hidden:this.hidden,defaultValue:((a=this.defaultValue)==null?void 0:a.toReference(e))||null,dataType:((d=this.dataType)==null?void 0:d.toReference(e))||null,implements:((o=this.implements)==null?void 0:o.toReference(e))||null,parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){var r,a,d;return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...((r=this.defaultValue)==null?void 0:r.toFlatJSON(e))||[],...((a=this.dataType)==null?void 0:a.toFlatJSON(e))||[],...((d=this.implements)==null?void 0:d.toFlatJSON(e))||[],...this.parent.toFlatJSON(e)])}toGenerationTarget(){var e;return{id:this.id,name:this.name,description:this.description,type:this.type,private:this.private,required:this.required,abstract:this.abstract,static:this.static,implements:((e=this.implements)==null?void 0:e.id)||null,parent:this.parent.id}}toFlatGenerationTarget(e=new Set){var r,a;return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...((r=this.defaultValue)==null?void 0:r.toFlatGenerationTarget(e))||[],...((a=this.dataType)==null?void 0:a.toFlatGenerationTarget(e))||[]])}clearErrors(){var e,t;return this.errors=[],(e=this.defaultValue)==null||e.clearErrors(),(t=this.dataType)==null||t.clearErrors(),this}validate(){return this.errors=x7(this),this.errors.length,{success:!0,error:null,data:null}}getErrors(){var t,r;return[...this.errors,...((t=this.defaultValue)==null?void 0:t.getErrors())||[],...((r=this.dataType)==null?void 0:r.getErrors())||[]]}getShallowErrors(){return this.errors}clone(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"clone-entity")),t=null,r=null,a=!0){var E,O;let d=ft(t,this);const o=r||I.UUID.uuid();let l=t||this.parent;const u={hidden:!1,id:o,version:I.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||T().toISOString(),author:(e==null?void 0:e.author)||"1",previousVersion:null,deleted:!1,type:this.type,name:this.name,description:this.description,index:this.index,private:this.private,constant:this.constant,required:this.required,abstract:this.abstract,static:this.static,defaultValue:null,dataType:null,implements:this.implements,parent:l},h=lt(u,d);a&&h.subscribe(),h.setParent(l,null),h.initChildren(e),e==null||e.add(h,b.Added);const c=((E=this.dataType)==null?void 0:E.clone(e,h,I.UUID.uuid(),a))||null;c&&h.setDataType(c);const v=(O=this.defaultValue)==null?void 0:O.clone(e,h,I.UUID.uuid(),a);return h.defaultValue=v||null,this.implements&&(h.implements=this.implements),h.addSelfToProject(null),e==null||e.attemptAutoclose("clone-entity",this.id),h}setDataType(e){return this.dataType=e,this}removeDataType(){return this.dataType=null,this}getDataType(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"get-data-type"))){return this.dataType}getDefaultValue(){return this.defaultValue}setDefaultValue(e){return this.defaultValue=e,this}};f(Ie,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...r)=>null}),f(Ie,"type",n.Property),f(Ie,"USER_MANAGED_PARENT_TYPES",[n.DefinitionEntity]),f(Ie,"PARENT_TYPES",[...Ie.USER_MANAGED_PARENT_TYPES,n.PrimitiveEntity,n.BuiltInBaseEntity]),f(Ie,"MUTABLE_BASE_PROPERTIES",["name","description","private","abstract","static","required","constant"]),f(Ie,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(Ie,"BASE_PROPERTIES",[...Ie.MUTABLE_BASE_PROPERTIES,...Ie.INMUTABLE_BASE_PROPERTIES]),f(Ie,"MUTABLE_META_PROPERTIES",[...Ie.MUTABLE_BASE_PROPERTIES,"index"]),f(Ie,"INMUTABLE_META_PROPERTIES",[...Ie.INMUTABLE_BASE_PROPERTIES]),f(Ie,"META_PROPERTIES",[...Ie.MUTABLE_META_PROPERTIES,...Ie.INMUTABLE_META_PROPERTIES]),f(Ie,"MUTABLE_UPSTREAM_PROPERTIES",[]),f(Ie,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","implements"]),f(Ie,"UPSTREAM_PROPERTIES",[...Ie.MUTABLE_UPSTREAM_PROPERTIES,...Ie.INMUTABLE_UPSTREAM_PROPERTIES]),f(Ie,"MUTABLE_DOWNSTREAM_PROPERTIES",["dataType"]),f(Ie,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(Ie,"DOWNSTREAM_PROPERTIES",[...Ie.MUTABLE_DOWNSTREAM_PROPERTIES,...Ie.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(Ie,"PROPERTIES",[...Ie.META_PROPERTIES,...Ie.UPSTREAM_PROPERTIES,...Ie.DOWNSTREAM_PROPERTIES]);let Bi=Ie;function q7(i){var a;const s=g6(),e=i.toJSON();s.safeParse(e).success,(a=i.dataType)==null||a.validate();const r=[];if(i.id==="iterate-over-employee-list-continue-statement-employee-dto-output-decl-id"){const d=ye({id:`${i.id}--${q.PropertyImplementsNonAbstact}`,message:`Property "${F(i,i.project)}" with id "${i.id}" implements a non-abstract property "${F(i,i.project)}" with id "${i.id}".`,issue:null,severity:D.Error,code:q.PropertyImplementsNonAbstact,entity:i});r.push(d.error)}return ze(i.errors,r)}var W1=(i=>(i.Implements="implements",i.DataTypeEntity="data-type-entity",i))(W1||{});const Ae=class Ae extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"name");f(this,"description",null);f(this,"index");f(this,"required");f(this,"constant",!0);f(this,"isError");f(this,"type",n.ReturnDeclaration);f(this,"defaultValue",null);f(this,"dataType",null);f(this,"readsValue",null);f(this,"implements",null);f(this,"project");f(this,"errors",[]);f(this,"parent");f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"suggestion",!1);this.initialData=e,this.project=t,this.id=e.id,this.index=e.index,this.name=e.name,this.description=e.description,this.required=e.required,this.constant=!0,this.isError=e.isError}static fromGenerationTarget(e,t){const r=B(e.parent),a=t.get(r);let d=null;if(e.readsValue){const u=B(e.readsValue);d=t.get(u)}const o={id:e.id,version:I.UUID.uuid(),createdAt:T().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,name:e.name,type:n.ReturnDeclaration,index:a.outputs.length,isError:!1,description:e.description,defaultValue:null,implements:null,required:e.required,constant:!0,readsValue:d,dataType:null,parent:a},l=V(o,t);return l.setParent(a,null),l.initChildren(null),l}static validateGenerationTarget(e,t){var l,u;let r=JSON.parse(JSON.stringify(e));const a=[],d=Et(r,{parent:{list:!1,types:[n.ReturnStatement,n.Search,n.BreakStatement,n.ContinueStatement]}},t),o=Ec(r,t);if(r=d.modifiedData,r.parent){const h=t.get(B(r.parent));if(h&&[n.BreakStatement,n.ContinueStatement].includes(h.type)){const c=h,v=c.parent,E=[...v.breakStatements.filter(w=>w.id!==h.id),...v.continueStatements.filter(w=>w.id!==h.id)];if(c.outputs.length)a.push(new P({id:`${r.id}--${j.NoOverlapWithImplementedSignature}`,code:j.NoOverlapWithImplementedSignature,severity:D.Error,message:`Entity of type '${n.ReturnDeclaration}' with id '${r.id}' cannot be added to the parent entity of type '${c.type}' with id '${c.id}'. This '${c.type}' already has return declarations.
46
46
  ${Vc}`,issue:null}));else{const w=(u=(l=E[0])==null?void 0:l.outputs[0])==null?void 0:u.name;w!==r.name&&a.push(new P({id:`${r.id}--${j.NoOverlapWithImplementedSignature}`,code:j.NoOverlapWithImplementedSignature,severity:D.Error,message:`Entity of type '${n.ReturnDeclaration}' with id '${r.id}' cannot be added to the parent entity of type '${c.type}' with id '${c.id}'. This new 'return-declaration' doesn't have the same name "${w}" as the return declarations on the other statements in the same scope.
@@ -405,4 +405,4 @@ If an entity is called by another, they must be in the same scope, which means t
405
405
  You shouldn't have to manually update a 'parent' property. The equivalent result is to change its callers, the value writters of its inputs, or the value readers of its outputs.`,issue:null})),{errors:t,modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(){const e=[],t=[],r=[],a=[];return Object.values(this.detachedDependents).forEach(d=>{const o=d.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),r.push(...o.removed),a.push(...o.affected)}),{updated:p(e),added:p(t),removed:p(r),affected:p(a),self:this}}onDetachedDependencyRemoved(e,t,r){const a=[],d=[],o=[],l=[];if(t==="declaration"){const{updated:u,added:h,removed:c}=this.remove({ignoreUpstream:!1},r);a.push(...u),d.push(...h),o.push(...c)}if(t==="parent"){const{updated:u,added:h,removed:c}=this.remove({ignoreUpstream:!1},r);a.push(...u),d.push(...h),o.push(...c)}return{updated:p(a),added:p(d),removed:p(o),affected:p(l),self:this}}onDetachedDependencyRestored(e,t,r){const a=[],d=[],o=[],l=[];if(t==="declaration"){const{updated:u,added:h,removed:c}=this.restore({},r);a.push(...u),d.push(...h),o.push(...c)}if(t==="parent"){const{updated:u,added:h,removed:c}=this.restore({},r);a.push(...u),d.push(...h),o.push(...c)}return{updated:p(a),added:p(d),removed:p(o),affected:p(l),self:this}}subscribeToDependencies(){var e;return(e=this.parent)==null||e.subscribeDependents([{entity:this,field:"parent"}]),this.declaration.subscribeDependents([{entity:this,field:"declaration"}]),this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=I.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t,r;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new ke(this,this.project);return(r=this.knownVersions)==null||r.set(this.version,e),e.inputs=this.inputs,e.outputs=this.outputs,e.error=this.error,e.successCalls=this.successCalls,e.errorCalls=this.errorCalls,e.process=this.process,e.declaration=this.declaration,e.calledBySuccess=this.calledBySuccess,e.calledByError=this.calledByError,e.calledByEntry=this.calledByEntry,e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],r=[],a=[],d=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),r.push(...o.added),a.push(...o.removed)}return{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}async restoreVersion(e){var l;const t=[],r=[],a=[],d=[];if(this.version===e)return{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this};if(!this.knownVersions){const u=new Map;for(const[h,c]of this.knownVersions||new Map){if(u.set(h,c),c.activeVersion=!1,c.knownVersions)for(const[v,E]of c.knownVersions)u.set(v,E);c.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new ke(u,this.project)}return this.metaSync(o.toShallowJSON(),null),this.inputs=o.inputs,this.outputs=o.outputs,this.error=o.error,this.successCalls=o.successCalls,this.errorCalls=o.errorCalls,this.process=o.process,this.declaration=o.declaration,this.calledBySuccess=o.calledBySuccess,this.calledByError=o.calledByError,this.calledByEntry=o.calledByEntry,this.parent=o.parent,{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}hydrateAncestors(){const e=[],t=[],r=[],a=[];if(this.initialData.parent){const d=B(this.initialData.parent),o=this.project.get(d);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${d}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.declaration){const d=B(this.initialData.declaration),o=this.project.get(d);o&&(this.setDeclaration(o),e.push(o))}return this.initialData.calledByEntry.forEach(d=>{const o=B(d),l=this.project.get(o);l&&(this.addEntryCaller(l,null),e.push(l))}),this.initialData.calledBySuccess.forEach(d=>{const o=B(d),l=this.project.get(o);l&&(this.addSuccessCaller(l,null),e.push(l))}),this.initialData.calledByError.forEach(d=>{const o=B(d),l=this.project.get(o);l&&(this.addErrorCaller(l,null),e.push(l))}),{updated:p(e),added:p(t),removed:p(r),affected:p(a),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],r=[],a=[],d=[];this.initialized=!0,this.captureVersion();const{updated:o,added:l,removed:u}=this.syncMissingFixedInputs(e),{updated:h,added:c,removed:v}=this.syncMissingFixedOutputs(e);return t.push(...o,...h),r.push(...l,...c),a.push(...u,...v),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}addSelfToProject(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"add-self-to-project"))){var o;const t=[this],r=[],a=[],d=[];return this.parent===this.project&&this.project.addFunctionCall(this),(o=this.process)==null||o.writesValues.forEach(l=>{l.setValueWriter(this.process),t.push(l)}),this.successCalls.forEach(l=>{l.addSuccessCaller(this,e),t.push(l)}),this.errorCalls.forEach(l=>{l.addErrorCaller(this,e),t.push(l)}),this.calledBySuccess.forEach(l=>{l.addSuccessCall(this),t.push(l)}),this.calledByError.forEach(l=>{l.addErrorCall(this),t.push(l)}),this.calledByEntry.forEach(l=>{l.addCall(this),t.push(l)}),this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(e){const t=this.inputs.findIndex(r=>r.id===e.id);return t>-1&&this.inputs.splice(t,1),this}addInput(e){return this.inputs.includes(e)?this:(this.inputs.push(e),this)}addOutput(e){return this.outputs.includes(e)?this:(this.outputs.push(e),this)}removeOutput(e){const t=this.outputs.findIndex(r=>r.id===e.id);return t>-1&&this.outputs.splice(t,1),this}addValueReader(e){var t;return(t=this.process)==null||t.addValueReader(e),this}removeValueReader(e){var t;return(t=this.process)==null||t.removeValueReader(e),this}addSuccessCaller(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"add-success-caller"))){return this.calledBySuccess.find(r=>r.id===e.id)||(this.calledBySuccess.push(e),t&&(t==null||t.add(this,b.Updated),t==null||t.add(e,b.Affected)),t==null||t.attemptAutoclose("add-success-caller",this.id)),this}addErrorCaller(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"add-error-caller"))){return this.calledByError.find(r=>r.id===e.id)||(this.calledByError.push(e),t&&(t==null||t.add(this,b.Updated),t==null||t.add(e,b.Affected)),t==null||t.attemptAutoclose("add-error-caller",this.id)),this}addEntryCaller(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"add-entry-caller"))){return this.calledByEntry.find(r=>r.id===e.id)||(this.calledByEntry.push(e),t&&(t==null||t.add(this,b.Updated),t==null||t.add(e,b.Affected)),t==null||t.attemptAutoclose("add-entry-caller",this.id)),this}addErrorCall(e){return this.errorCalls.find(t=>t.id===e.id)||this.errorCalls.push(e),this}addSuccessCall(e){return this.successCalls.find(t=>t.id===e.id)||this.successCalls.push(e),this}removeCall(e){const t=this.successCalls.findIndex(a=>a.id===e.id);t>-1&&this.successCalls.splice(t,1);const r=this.errorCalls.findIndex(a=>a.id===e.id);return r>-1&&this.errorCalls.splice(r,1),this}removeCaller(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"remove-caller"))){return this.calledBySuccess=this.calledBySuccess.filter(r=>r.id!==e.id?(t&&(t==null||t.add(this,b.Updated),t==null||t.add(r,b.Affected)),!0):!1),this.calledByError=this.calledByError.filter(r=>r.id!==e.id?(t&&(t==null||t.add(this,b.Updated),t==null||t.add(r,b.Affected)),!0):!1),this.calledByEntry=this.calledByEntry.filter(r=>r.id!==e.id?(t&&(t==null||t.add(this,b.Updated),t==null||t.add(r,b.Affected)),!0):!1),t==null||t.attemptAutoclose("remove-caller",this.id),this}setParent(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"set-parent"))){var r;return((r=this.parent)==null?void 0:r.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,b.Updated),t==null||t.attemptAutoclose("set-parent",this.id))),this}setDeclaration(e){return this.declaration=e,this}initChildren(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.declaration.type===n.FunctionDeclaration){const t=V(this.initialData.declaration,this.project);this.declaration=t}else{const t=B(this.initialData.declaration),r=this.project.get(t);this.declaration=r}return this.successCalls=this.initialData.successCalls.map(t=>{const r=V(t,this.project);return r.addSuccessCaller(this),[n.BreakStatement,n.ContinueStatement].includes(r.type)?(r.setParent(this.parent.parent,null),r.initChildren(e)):r.type!==n.InternalCall&&(r.setParent(this.parent,null),r.initChildren(e)),r}),this.errorCalls=this.initialData.errorCalls.map(t=>{const r=V(t,this.project);return r.addErrorCaller(this),[n.BreakStatement,n.ContinueStatement].includes(r.type)?(r.setParent(this.parent.parent,null),r.initChildren(e)):r.type!==n.InternalCall&&(r.setParent(this.parent,null),r.initChildren(e)),r}),this.inputs=this.initialData.inputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.initialData.process&&(this.process=V(this.initialData.process,this.project),this.process.setParent(this,null),this.process.initChildren(e)),this.initialData.error&&(this.error=V(this.initialData.error,this.project),this.error.setParent(this,null),this.error.initChildren(e)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-meta"))){const r=dt(this,e);return e.deleted===!0&&!this.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&this.deleted?t==null||t.add(this,b.Added):r&&(t==null||t.add(this,b.Updated)),super.metaSync(e),this.x=e.x||this.x,this.y=e.y||this.y,t==null||t.attemptAutoclose("sync-meta",this.id),this}async APILoad(e=L,...t){return await ke.repository.APILoad(this.id,...t),this}async APICreate(e=L,...t){return await ke.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=L,...t){return await ke.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=L,...t){return await ke.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=L,...t){return await ke.repository.APIClone(this.id,...t),this}async APILoadVersion(e=L,t,...r){return await ke.repository.APILoadVersion(this.id,t,...r)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"remove-entity"))){var l;const r=[],a=[],d=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(a.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(u=>{const{updated:h,removed:c,added:v}=u.entity.onDetachedDependencyRemoved(this,u.field,t);r.push(...h),a.push(...c),d.push(...v)}),this.process){const{updated:u,removed:h}=(l=this.process)==null?void 0:l.remove({ignoreUpstream:!0},t);r.push(...u),a.push(...h)}if(this.inputs.forEach(u=>{const{updated:h,removed:c}=u.remove({ignoreUpstream:!0},t);r.push(...h),a.push(...c)}),this.outputs.forEach(u=>{const{updated:h,removed:c}=u.remove({ignoreUpstream:!0},t);r.push(...h),a.push(...c)}),this.error){const{updated:u,removed:h}=this.error.remove({ignoreUpstream:!0},t);r.push(...u),a.push(...h)}return this.successCalls.forEach(u=>{r.push(u),u.removeCaller(this)}),this.errorCalls.forEach(u=>{r.push(u),u.removeCaller(this)}),e||this.calledBy.forEach(u=>{r.push(u),u.removeCall(this)}),t==null||t.attemptAutoclose("remove-entity",this.id),{added:p(d),updated:p(r),removed:p(a),affected:p(o),self:this}}restore({}={},e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"restore-entity"))){const t=[],r=[],a=[],d=[];if(e!=null&&e.hasAdded(this.id))return e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),this.process){const{updated:o}=this.process.restore({},e);r.push(...o)}return this.inputs.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.outputs.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.successCalls.forEach(o=>{r.push(o),o.addSuccessCaller(this)}),this.errorCalls.forEach(o=>{r.push(o),o.addErrorCaller(this)}),this.calledBySuccess.forEach(o=>{r.push(o),o.addSuccessCall(this)}),this.calledByError.forEach(o=>{r.push(o),o.addErrorCall(this)}),this.calledByEntry.forEach(o=>{r.push(o),o.addCall(this)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:p(t),updated:p(r),removed:p(a),affected:p(d),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.successCalls.flatMap(r=>r.toFlat(e)),...this.errorCalls.flatMap(r=>r.toFlat(e)),...this.inputs.flatMap(r=>r.toFlat(e)),...this.outputs.flatMap(r=>r.toFlat(e)),...this.process?this.process.toFlat(e):[],...this.error?this.error.toFlat(e):[],...this.calledBy.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.successCalls.flatMap(r=>r.toFlatIds(e)),...this.errorCalls.flatMap(r=>r.toFlatIds(e)),...this.inputs.flatMap(r=>r.toFlatIds(e)),...this.outputs.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){var t,r;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,successCalls:this.successCalls.map(a=>a.toJSON(e)),errorCalls:this.errorCalls.map(a=>a.toJSON(e)),calledBySuccess:this.calledBySuccess.map(a=>a.toReference()),calledByError:this.calledByError.map(a=>a.toReference()),calledByEntry:this.calledByEntry.map(a=>a.toReference()),process:(t=this.process)==null?void 0:t.toJSON(e),declaration:this.declaration.toJSON(e),inputs:this.inputs.map(a=>a.toJSON(e)),outputs:this.outputs.map(a=>a.toJSON(e)),parent:this.parent.toReference(),error:(r=this.error)==null?void 0:r.toJSON(e)})}toJSONClone(e=Z){var r,a,d,o,l,u,h;let t;return(r=e.seenEntityMaps)!=null&&r.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||ct(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(d=e.seenEntities)!=null&&d.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:I.UUID.uuid(),createdAt:e.timestamp||T().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,successCalls:this.successCalls.map(c=>c.toJSONClone({...e,newId:null})),errorCalls:this.errorCalls.map(c=>c.toJSONClone({...e,newId:null})),calledBySuccess:this.calledBySuccess.map(c=>c.toReference({seenEntityMaps:e.seenEntityMaps})),calledByError:this.calledByError.map(c=>c.toReference({seenEntityMaps:e.seenEntityMaps})),calledByEntry:this.calledByEntry.map(c=>c.toReference({seenEntityMaps:e.seenEntityMaps})),process:(u=this.process)==null?void 0:u.toJSONClone({...e,newId:null}),declaration:this.declaration.toJSONClone({...e,newId:null}),inputs:this.inputs.map(c=>c.toJSONClone({...e,newId:null})),outputs:this.outputs.map(c=>c.toJSONClone({...e,newId:null})),error:(h=this.error)==null?void 0:h.toJSONClone({...e,newId:null}),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+I.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,process:this.process?this.process.toReference(e):null,inputs:this.inputs.map(a=>a.toReference(e)),outputs:this.outputs.map(a=>a.toReference(e)),declaration:this.declaration.toReference(e),successCalls:this.successCalls.map(a=>a.toReference(e)),errorCalls:this.errorCalls.map(a=>a.toReference(e)),calledBySuccess:this.calledBySuccess.map(a=>a.toReference(e)),calledByError:this.calledByError.map(a=>a.toReference(e)),calledByEntry:this.calledByEntry.map(a=>a.toReference(e)),error:this.error?this.error.toReference(e):null,parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.successCalls.flatMap(r=>r.toFlatJSON(e)),...this.errorCalls.flatMap(r=>r.toFlatJSON(e)),...this.inputs.flatMap(r=>r.toFlatJSON(e)),...this.outputs.flatMap(r=>r.toFlatJSON(e)),...this.process?this.process.toFlatJSON(e):[],...this.error?this.error.toFlatJSON(e):[]])}toGenerationTarget(){const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,calledByEntry:this.calledByEntry.map(t=>t.id),calledBySuccess:this.calledBySuccess.map(t=>t.id),calledByError:this.calledByError.map(t=>t.id),declaration:this.declaration.id,parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.successCalls.flatMap(r=>r.toFlatGenerationTarget(e)),...this.errorCalls.flatMap(r=>r.toFlatGenerationTarget(e)),...this.inputs.flatMap(r=>r.toFlatGenerationTarget(e)),...this.outputs.flatMap(r=>r.toFlatGenerationTarget(e)),...this.process?this.process.toFlatGenerationTarget(e):[],...this.error?this.error.toFlatGenerationTarget(e):[]])}clearErrors(){var e,t;return this.errors=[],this.inputs.forEach(r=>r.clearErrors()),this.outputs.forEach(r=>r.clearErrors()),this.successCalls.forEach(r=>r.clearErrors()),this.errorCalls.forEach(r=>r.clearErrors()),(e=this.process)==null||e.clearErrors(),(t=this.error)==null||t.clearErrors(),this}validate(){const e=Nq(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.inputs.flatMap(t=>t.getErrors()),...this.outputs.flatMap(t=>t.getErrors()),...this.error?this.error.getErrors():[],...this.process?this.process.getErrors():[]]}getShallowErrors(){return this.errors}clone(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"clone-entity")),t=null,r=null,a=!0){var O,w;let d=ft(t,this);const o=this.toJSON(),l=r||I.UUID.uuid();o.inputs=[];const u=l.split("-id"),h=u[u.length-1||0]||l;o.id=l,o.version=I.UUID.uuid(),o.createdAt=(e==null?void 0:e.timestamp)||T().toISOString(),o.author=(e==null?void 0:e.author)||"1",o.previousVersion=null,o.deleted=!1;const c=lt(o,d);t?c.setParent(t,null):c.setParent(this.parent,null),a&&c.subscribe(),c.initChildren(e),e==null||e.add(c,b.Added);const v=(O=this.inputs)==null?void 0:O.map((C,U)=>C.clone(e,c,h+"-input-map-"+U+"-id",a));c.inputs=v;const E=(w=this.outputs)==null?void 0:w.map((C,U)=>C.clone(e,c,h+"-output-map-"+U+"-id",a));return c.outputs=E,this.error&&(c.error=this.error.clone(e,c,h+"-error-map-id",a)),this.process&&(c.process=this.process.clone(e,c,h+"-process-id",a)),e==null||e.attemptAutoclose("clone-entity",this.id),c}removeUnrecognizedInputs(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"remove-unrecognized-inputs"))){const t=[],r=[],a=[],d=[];return this.inputs.forEach(o=>{if(!this.declaration.inputs.find(u=>{var h;return u.id===((h=o.declaration)==null?void 0:h.id)})){const u=o.remove({ignoreUpstream:!1},e);a.push(...u.removed),t.push(...u.updated)}}),e==null||e.attemptAutoclose("remove-unrecognized-inputs",this.id),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}removeUnrecognizedOutputs(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"remove-unrecognized-outputs"))){const t=[],r=[],a=[],d=[];return this.outputs.forEach(o=>{if(!this.declaration.getUniqueReturnDeclarations().find(u=>{var h;return u.id===((h=o.declaration)==null?void 0:h.id)})){const u=o.remove({ignoreUpstream:!1},e);a.push(...u.removed),t.push(...u.updated)}}),e==null||e.attemptAutoclose("remove-unrecognized-outputs",this.id),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}syncMissingFixedInputs(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-missing-fixed-inputs"))){const t=[],r=[],a=[],d=[],o=this.declaration.inputs.filter(c=>!this.inputs.find(v=>v.declaration.id===c.id));this.inputs.sort((c,v)=>c.index-v.index),o.forEach(c=>{this.inputs.forEach(O=>{O.index>=c.index&&O.metaSync({index:O.index+1},e)});const v={id:I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||T().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,type:n.InputMap,declaration:c.toJSON(),readsValue:null,defaultValue:null,index:c.index,name:null,description:null,parent:this.toReference()},E=V(v,this.project);E.setParent(this,e),E.initChildren(e),e==null||e.add(E,b.Added),E.addSelfToProject(e),r.push(E)}),this.inputs.sort((c,v)=>c.index-v.index);const{updated:l,added:u,removed:h}=this.removeUnrecognizedInputs(e);return t.push(...l),r.push(...u),a.push(...h),e==null||e.attemptAutoclose("sync-missing-fixed-inputs",this.id),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}syncMissingFixedOutputs(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-missing-fixed-outputs"))){const t=[],r=[],a=[],d=[],o=[];this.outputs=this.initialData.outputs.map(v=>{const E=V(v,this.project);return o.push(E.index),E.setParent(this,null),E.initChildren(e),E});const l=this.declaration.getUniqueReturnDeclarations().filter(v=>!this.outputs.find(E=>E.declaration.id===v.id));this.outputs.sort((v,E)=>v.index-E.index),l.forEach((v,E)=>{this.outputs.forEach(U=>{U.index>=v.index&&U.index++});const O=o.includes(v.index)?this.outputs.length-1+E:v.index,w={id:I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||T().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,type:n.OutputMap,declaration:v.toJSON(),defaultValue:null,writesValues:[],index:O,parent:this.toReference()},C=V(w,this.project);C.setParent(this,e),C.initChildren(e),e==null||e.add(C,b.Added),C.addSelfToProject(e)}),this.outputs.sort((v,E)=>v.index-E.index);const{updated:u,added:h,removed:c}=this.removeUnrecognizedOutputs(e);return t.push(...u),r.push(...h),a.push(...c),e==null||e.attemptAutoclose("sync-missing-fixed-outputs",this.id),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}};f(ke,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...r)=>null}),f(ke,"type",n.FunctionCall),f(ke,"USER_MANAGED_PARENT_TYPES",[...mt,n.Project]),f(ke,"PARENT_TYPES",[...ke.USER_MANAGED_PARENT_TYPES]),f(ke,"MUTABLE_BASE_PROPERTIES",[]),f(ke,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(ke,"BASE_PROPERTIES",[...ke.MUTABLE_BASE_PROPERTIES,...ke.INMUTABLE_BASE_PROPERTIES]),f(ke,"MUTABLE_META_PROPERTIES",["x","y"]),f(ke,"INMUTABLE_META_PROPERTIES",[...ke.INMUTABLE_BASE_PROPERTIES]),f(ke,"META_PROPERTIES",[...ke.MUTABLE_META_PROPERTIES,...ke.INMUTABLE_META_PROPERTIES]),f(ke,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),f(ke,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),f(ke,"UPSTREAM_PROPERTIES",[...ke.MUTABLE_UPSTREAM_PROPERTIES,...ke.INMUTABLE_UPSTREAM_PROPERTIES]),f(ke,"MUTABLE_DOWNSTREAM_PROPERTIES",["successCalls","errorCalls","writesValues","inputs","outputs","error"]),f(ke,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(ke,"DOWNSTREAM_PROPERTIES",[...ke.MUTABLE_DOWNSTREAM_PROPERTIES,...ke.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(ke,"PROPERTIES",[...ke.META_PROPERTIES,...ke.UPSTREAM_PROPERTIES,...ke.DOWNSTREAM_PROPERTIES]);let qi=ke;function Lc(i){return i&&typeof i.then=="function"}class Fd{constructor(s){f(this,"order",[]);f(this,"flatRecord",{});f(this,"allBuiltInEntityIds",Vr());f(this,"onGoingVisits",{});this.flatten(s),this.orderEntities()}flatten(s){const e=new Set(Vr()),t=p(N(s,e,{ignoreBuiltInBaseEntities:!0})),r=new Set;for(const a of t)this.flatRecord[a.id]=a,r.add(a.id);this.order=Array.from(r)}moveEntityAfterDependencies(s){const{upstream:e}=Jd(s,this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds});for(const t of Object.keys(e)){const r=this.order.indexOf(t),a=this.order.indexOf(s.id);if(r>a)return this.order.splice(a,1),this.order.splice(r,0,s.id),!0}return!1}orderEntities(){let s=!1;for(let e=0;e<this.order.length;e++){const t=this.order[e],r=this.flatRecord[t];if(this.moveEntityAfterDependencies(r)){s=!0;break}}s&&this.orderEntities()}getUpstreamOngoingDependenciesVisits(s,e){const{upstream:t}=Jd(this.flatRecord[s],this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds}),r={};return Object.entries(this.onGoingVisits[e]||{}).forEach(([a,d])=>{Object.keys(t).includes(a)&&(r[a]=d)}),r}getDownstreamOngoingDependenciesVisits(s,e){const t=Object.keys(this.onGoingVisits[e]||{}),r=new Set(t.flatMap(d=>Object.keys(Jd(this.flatRecord[d],this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds}).downstream))),a={};return Array.from(r).forEach(d=>{d===s&&(a[d]=this.onGoingVisits[e][d])}),a}async settlePromises(s,e){const t=Object.values(s);t.length&&await Promise.all(t),Object.keys(s).forEach(r=>{delete this.onGoingVisits[e][r]})}visit(s){const e=this.order;for(const t of e)s(this.flatRecord[t],this.flatRecord);return this}reverseVisit(s){const e=this.order.slice().reverse();for(const t of e)s(this.flatRecord[t],this.flatRecord);return this}async visitAsync(s){const e=this.order,t=Math.random().toString(36).substring(7);this.onGoingVisits[t]={};for(const r of e){const a=this.getUpstreamOngoingDependenciesVisits(r,t);Object.keys(a).length&&await this.settlePromises(a,t);const d=s(this.flatRecord[r],this.flatRecord);Lc(d)&&(this.onGoingVisits[t][r]=d)}return await this.settlePromises(this.onGoingVisits[t],t),this.onGoingVisits[t]={},this}async reverseVisitAsync(s){const e=this.order.slice().reverse(),t=Math.random().toString(36).substring(7);this.onGoingVisits[t]={};for(const r of e){const a=this.getDownstreamOngoingDependenciesVisits(r,t);Object.keys(a).length&&await this.settlePromises(a,t);const d=s(this.flatRecord[r],this.flatRecord);Lc(d)&&(this.onGoingVisits[t][r]=d)}return await this.settlePromises(this.onGoingVisits[t],t),this.onGoingVisits[t]={},this}}function AO(i,s){switch(i.id){case x["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const e=i.project.entities.filter(l=>!!l.implements.find(u=>u.id===x["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));if(e.find(l=>!!l.properties.find(u=>{var h;return u.implements&&u.implements.id===x["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((h=u.getDefaultValue())==null?void 0:h.value)===!0}))){const u=e[0].properties.find(c=>c.implements&&c.implements.id===x["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),h=u==null?void 0:u.defaultValue;if(h)h.value=!0;else if(u!=null&&u.dataType){const c={id:I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(s==null?void 0:s.timestamp)||new Date().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,type:n.LiteralValue,name:g.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:u==null?void 0:u.dataType.toReference()},v=V(c,i.project);return v.setParent(u==null?void 0:u.dataType,s),v.initChildren(s),s==null||s.add(v,b.Added),v.addSelfToProject(s),{newEntities:[v]}}return{newEntities:[]}}const r=i.project.get(x["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),a=xd(r,"Main database",s);if(a.errors.length>0)return{newEntities:[]};const d=a.implemented.properties.find(l=>l.implements&&l.implements.id===x["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),o=d==null?void 0:d.defaultValue;if(o)o.value=!0;else if(d!=null&&d.dataType){const l={id:I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(s==null?void 0:s.timestamp)||new Date().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,type:n.LiteralValue,name:g.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:d==null?void 0:d.dataType.toReference()},u=V(l,i.project);u.setParent(d==null?void 0:d.dataType,s),u.initChildren(s),s==null||s.add(u,b.Added),u.addSelfToProject(s)}return{newEntities:[a.implemented]}}}return{newEntities:[]}}function bO(i,s){return i.implements.filter(t=>t.type===n.BuiltInBaseEntity).map(t=>{switch(t.id){case x["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const a=i.project.entities.filter(l=>l.implements.find(u=>u.id===x["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)).find(l=>!!l.properties.find(u=>{var h;return u.implements&&u.implements.id===x["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((h=u.getDefaultValue())==null?void 0:h.value)===!0}));if(!a)return{newEntities:[]};const d=i.properties.find(l=>l.implements&&l.implements.id===x["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id),o=d==null?void 0:d.defaultValue;if(d&&(d!=null&&d.dataType)&&!o){const l={id:I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(s==null?void 0:s.timestamp)||new Date().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,type:n.LiteralValue,name:g.EntityTemplate,autogeneration:null,value:null,valueAsTypeSingle:a,valueAsTypeList:null,parent:d==null?void 0:d.dataType.toReference()},u=V(l,i.project);return u.setParent(d==null?void 0:d.dataType,s),u.initChildren(s),s==null||s.add(u,b.Added),u.addSelfToProject(s),{newEntities:[u]}}return{newEntities:[]}}}}),{newEntities:[]}}function xd(i,s,e,t){const r=t||I.UUID.uuid(),a=I.UUID.uuid(),d={id:r,version:a,createdAt:(e==null?void 0:e.timestamp)||new Date().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,name:s,type:n.DefinitionEntity,description:null,static:!1,abstract:!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[i],x:0,y:0,parent:i.project},o=AO(i,e),l=V(d,i.project);l.setParent(i.project,e),l.initChildren(e),e==null||e.add(l,b.Added),i.properties.map(h=>{const c=I.UUID.uuid(),v=h.clone(e,l,c);return v.abstract=!1,v.implements=h,e==null||e.add(v,b.Added),v.setParent(l,e),l.addProperty(v),v}),i.abstractMethods.map(h=>{const c=I.UUID.uuid(),v=h.implementAsFunctionDeclaration(e,l,c);return l.addMethod(v),e==null||e.add(v,b.Added),v}),l.afterAllChildrenInitialized(e);const u=bO(l,e);return{implemented:l,errors:[],entitiesChanges:{new:[l,...o.newEntities,...u.newEntities],updated:[l],deleted:[]}}}function Uc(i,s){return s.entities.find(r=>{const a=r.properties,d=a.map(c=>c.name),o=i.every(c=>d.includes(c)),l=d.filter(c=>!i.includes(c)),u=a.every(c=>!l.includes(c.name)||!c.required);return o&&u})||null}function RO(i,s,e,t=bt.OrDataTypeGroup){const r=[],a=[],d=[],o=[],u={id:I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||new Date().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,type:n.DataType,entity:i.toJSON(),isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:t,parent:s.toReference()},h=V(u,i.project);return a.push(h),h.setParent(s,e),h.initChildren(e),e==null||e.add(h,b.Added),h.setEntity(i),h.addSelfToProject(e),{updated:p(r),added:p(a),removed:p(d),affected:p(o),self:h}}function $c(i,s,e,t,r){var u,h,c,v,E,O,w,C;const a=[],d=[],o=[],l=[];switch(typeof i){case"string":let U=!1;const G=new Date(i);if(G instanceof Date&&!isNaN(G.valueOf())&&(U=!0),U){const _=s.project.getBuiltIn(x[n.PrimitiveEntity][g.Date].id);s.setEntity(_);break}else{const _=s.project.getBuiltIn(x[n.PrimitiveEntity][g.String].id);s.setEntity(_);break}case"number":s.setEntity(s.project.getBuiltIn(x[n.PrimitiveEntity][g.Number].id));break;case"boolean":s.setEntity(s.project.getBuiltIn(x[n.PrimitiveEntity][g.Boolean].id));break;case"object":if(i===null){s.setEntity(s.project.getBuiltIn(x[n.PrimitiveEntity][g.Null].id));break}else if(Array.isArray(i))if(s.metaSync({isList:!0},t),i.length>0){const _=i.slice(0,5).filter(k=>k!==void 0);if(_.every(k=>typeof k==typeof _[0])&&(typeof _[0]!="object"||_[0]===null))switch(typeof _[0]){case"string":s.setEntity(s.project.getBuiltIn(x[n.PrimitiveEntity][g.String].id));break;case"number":s.setEntity(s.project.getBuiltIn(x[n.PrimitiveEntity][g.Number].id));break;case"boolean":s.setEntity(s.project.getBuiltIn(x[n.PrimitiveEntity][g.Boolean].id));break;case"object":s.setEntity(s.project.getBuiltIn(x[n.PrimitiveEntity][g.Null].id));break}else{const k=[];let J=!1;_.forEach(pe=>{var Te,K,se,Ht;if(Array.isArray(pe)&&(J=!0),typeof pe=="object"&&!Array.isArray(pe)&&pe!==null){const Yr=Sd(pe,s.project,{...e,id:I.UUID.uuid()},t,r);Yr.hasCreated&&k.push((Te=Yr.changeSet)==null?void 0:Te.self),a.push(...(K=Yr.changeSet)==null?void 0:K.updated),d.push(...(se=Yr.changeSet)==null?void 0:se.added),o.push(...(Ht=Yr.changeSet)==null?void 0:Ht.removed)}});const ee=p(k);if(!ee.length&&!J){_.forEach(pe=>{const Te={id:I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,type:n.DataType,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:bt.OrDataTypeGroup,parent:s.toReference()},K=V(Te,s.project);switch(K.setParent(s,t),K.initChildren(t),t==null||t.add(K,b.Added),K.addSelfToProject(t),typeof pe){case"string":K.setEntity(K.project.getBuiltIn(x[n.PrimitiveEntity][g.String].id));break;case"number":K.setEntity(K.project.getBuiltIn(x[n.PrimitiveEntity][g.Number].id));break;case"boolean":K.setEntity(K.project.getBuiltIn(x[n.PrimitiveEntity][g.Boolean].id));break;case"object":K.setEntity(K.project.getBuiltIn(x[n.PrimitiveEntity][g.Null].id));break}});break}else ee.length===1&&!J?s.setEntity(ee[0]):_.forEach(pe=>{if(typeof pe=="object"&&!Array.isArray(pe)&&pe!==null){const Te=Uc(Object.keys(pe),s.project);if(Te){const K=RO(Te||ee[0],s,t,bt.OrDataTypeGroup);a.push(...K.updated),d.push(...K.added),o.push(...K.removed)}}else{const Te={id:I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,type:n.DataType,entity:null,isList:Array.isArray(pe),asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:bt.OrDataTypeGroup,parent:s.toReference()},K=V(Te,s.project);K.setParent(s,t),K.initChildren(t),t==null||t.add(K,b.Added),K.addSelfToProject(t);const se=$c(pe,K,{...e,id:I.UUID.uuid()},t,r);a.push(...se.updated),d.push(...se.added),o.push(...se.removed)}})}}else{const _=Sd(i[0],s.project,{...e},t,r);s.setEntity((u=_.changeSet)==null?void 0:u.self),a.push(...(h=_.changeSet)==null?void 0:h.updated),d.push(...(c=_.changeSet)==null?void 0:c.added),o.push(...(v=_.changeSet)==null?void 0:v.removed);break}else{const _=Sd(i,s.project,{...e},t,r);s.setEntity((E=_.changeSet)==null?void 0:E.self),a.push(...(O=_.changeSet)==null?void 0:O.updated),d.push(...(w=_.changeSet)==null?void 0:w.added),o.push(...(C=_.changeSet)==null?void 0:C.removed);break}}return{updated:p(a),added:p(d),removed:p(o),affected:p(l),self:s}}function Sd(i,s,e,t,r){const a=[],d=[],o=[],l=[],u=Object.keys(i),h=Uc(u,s);if(h)return{hasCreated:!1,changeSet:{updated:[],added:[],removed:[],affected:[],self:h}};const c=r?e.name+" of "+r.name:e.name,E={id:e.id||I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,name:c,type:n.DefinitionEntity,description:e.description||null,static:e.static||!1,abstract:e.abstract||!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[],x:0,y:0,parent:s.toReference()},O=V(E,s);return O.setParent(s,t),O.initChildren(t),t==null||t.add(O,b.Added),O.addSelfToProject(t),d.push(O),u.forEach((w,C)=>{const G={id:I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,name:w,type:n.Property,description:null,static:!1,abstract:!1,defaultValue:null,constant:!1,dataType:null,implements:null,index:C,hidden:!1,private:!1,required:!0,parent:O.toReference()},_=V(G,s);_.setParent(O,t),_.initChildren(t),t==null||t.add(_,b.Added),_.addSelfToProject(t),d.push(_);const $=i[w],J={id:I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,type:n.DataType,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parent:_.toReference()},ee=V(J,s);ee.setParent(_,t),ee.initChildren(t),t==null||t.add(ee,b.Added),ee.addSelfToProject(t),d.push(ee);const pe=$c($,ee,{...e,name:w,id:I.UUID.uuid()},t,r||O);a.push(...pe.updated),d.push(...pe.added),o.push(...pe.removed)}),{hasCreated:!0,changeSet:{updated:p(a),added:p(d),removed:p(o),affected:p(l),self:O}}}function kd(i,s){const e=Mn(i);if(e.length===0)return{list:[],last:null};let t=null;return{list:e.flatMap(a=>{if(a===s)return t=a,[a];const d=kd(a,s);return d.last&&(t=d.last),[a,...d.list]}),last:t}}function DO(i,s,e=new Set){const t=Ji(i),r=Ji(s),a=t.filter(l=>!r.includes(l)),d=t.filter(l=>r.includes(l)),o=a.reduce((l,u)=>e.has(u.id)?l:(e.add(u.id),p([...l,...DO(u,s,e)])),[]);return p([...d,...o])}function Vs(i,s){const e=kd(i,s);return e.last===s&&e.list.length>0&&e.list[0]!==s}function Lq(i,s){return!!kd(i,s).last}function Uq(i){if(at.includes(i.type))return i;if([...Cr,n.VariableDeclaration].includes(i.type)){const s=i.parent;return at.includes(s.type)?s:null}return null}function jc(i,s){if(!i||!s)throw new Error("Both entities must be defined to find a common ancestor");if(i===s)return i;const e=i.parent;if(e){if(e===s)return s;if(e.type===n.Project)return null}else return null;const t=s.parent;if(t){if(t===i)return i;if(t.type===n.Project)return null}else return null;return jc(e,t)}function Ot(i){if(Gs.includes(i.type)){if(i.type===n.FunctionDeclaration){const s=i.parent;if(s.type===n.DefinitionEntity)return s;if(s.type===n.Loop)return s}return i}else{const s=i.parent;return s?Ot(s):null}}function Zd(i,s){const e=Cs(i,s);if(!e)return null;if(Gs.includes(e.type)){if(e.type===n.FunctionDeclaration){const t=Cs(e.parent,s);if(t){if(t.type===n.DefinitionEntity)return t;if(t.type===n.Loop)return t}}return e}else{const t=e.parent?Cs(e.parent,s):null;return t?Zd(t,s):null}}function OO(i){if(!i)return null;if(Cr.includes(i.type))return i;const s=i.parent;return s?OO(s):null}function PO(i){if(!i)return null;if(nt.includes(i.type))return i;const s=i.parent;return s?PO(s):null}function wO(i){if(!i)return null;if(Br.includes(i.type))return i;const s=i.parent;return s?wO(s):null}function $q(i){return i.type===n.VariableDeclaration?[i]:nt.includes(i.type)?[...i.inputs,...i.outputs||[]]:st.includes(i.type)?i.outputs:$n.includes(i.type)||i.type===n.FunctionDeclaration?i.inputs:[]}function jq(i){const s=Ji(i),e=[],t=[];ef.includes(i.type)&&e.push(...Gc(i));const r=s.filter(a=>{const d=e.includes(a);return d?!1:Cr.includes(a.type)&&!d?(t.push(a),!1):!0});return e.sort((a,d)=>Vs(d,a)?-1:0),t.sort((a,d)=>Vs(d,a)?-1:0),[...e,...t,...r]}function VO(i){return[...i].sort((s,e)=>Vs(e,s)?-1:0)}function Gq(i){const s=VO(i),e=[];return s.forEach(t=>{const r=e[e.length-1];if(r){const a=r[r.length-1];Vs(t,a)?e.push([t]):r.push(t)}else e.push([t])}),e}function zt(i){const s=i.map(e=>Ot(e));return p(s)}function Gc(i){return nt.includes(i.type)?[...zt(i.successCalls),...zt(i.errorCalls)]:at.includes(i.type)?zt(i.calls):[]}function Fq(i,s){return Gc(i).includes(s)}function Fc(i){return i.writesValues||[]}function xq(i,s){return Fc(i).includes(s)}function CO(i){var s;return Qe.includes((s=i==null?void 0:i.readsValue)==null?void 0:s.type)?i.readsValue:null}function Sq(i){return i.writesValues}function BO(i=[]){return i.map(CO).filter(s=>!!s)}function qd(i=[]){return i.map(s=>s.writesValues).flat().filter(s=>Qe.includes(s.type))}function _O(i=[]){return i.map(s=>s.readsValue).filter(s=>!!s&&Qe.includes(s.type))}function MO(i){return Qe.includes(i.type)?i:null}function gO(i){return i.writesValues.map(MO).filter(s=>!!s)}function NO(i=[]){return i.reduce((s,e)=>e.type===n.OutputMap?[...s,...gO(e)]:s,[])}function it(i){return nt.includes(i.type)?[...Wr(zt(i.successCalls)),...Wr(zt(i.errorCalls))]:at.includes(i.type)?Wr(zt(i.calls)):[]}function kq(i){return nt.includes(i.type)?[...Wr(zt(i.successCalls)),...Wr(zt(i.errorCalls))]:at.includes(i.type)?Wr(zt(i.calls)):[]}function LO(i,s=new Set){return i.writesValues.filter(t=>Qe.includes(t.type)&&!s.has(t.id)).reduce((t,r)=>s.has(r.id)?t:[...t,...We(r,s)],[])}function UO(i,s=new Set){var t;return(((t=i.readsValue)==null?void 0:t.writesValues)||[]).filter(r=>Qe.includes(r.type)&&!s.has(r.id)).reduce((r,a)=>s.has(a.id)?r:[...r,...We(a,s)],[])}function We(i,s=new Set){if(s.has(i.id))return[];if(i.type===n.ReturnStatement)return _O(i.outputs).reduce((t,r)=>[...t,...We(r,s)],[]);if(i.type===n.FunctionCall||i.type===n.Operation||i.type===n.Condition)return[...it(i).reduce((a,d)=>{const o=Ot(d);return[...a,...We(o||d,s)]},[]),...BO(i.inputs),...NO(i.outputs)].reduce((a,d)=>[...a,...We(d,s)],[]);if($n.includes(i.type)){const e=qd(i.inputs),r=it(i).reduce((a,d)=>{const o=Ot(d);return[...a,...We(o||d,s)]},[]);return e.push(...r),e.reduce((a,d)=>[...a,...We(d,s)],[])}if(i.type===n.FunctionDeclaration){const e=[...qd(i.inputs)],r=it(i).reduce((a,d)=>{const o=Ot(d);return[...a,...We(o||d,s)]},[]);return e.push(...r),e.reduce((a,d)=>[...a,...We(d)],[])}if(Qe.includes(i.type)){s.add(i.id);const t=it(i).reduce((r,a)=>{const d=Ot(a);return[...r,...We(d||a,s)]},[]);return[i,...t,...UO(i,s),...LO(i,s)]}return[]}function ir(i,s=new Set){return s.has(i.id)?[]:(s.add(i.id),[...Ji(i).reduce((r,a)=>[...r,a,...ir(a,s)],[])])}function Wr(i){return i.reduce((s,e)=>e.type===n.ReturnStatement||e.type===n.ContinueStatement||e.type===n.BreakStatement?[...s,e]:[...s,e,...it(e)],[])}function $O(i){const s=i.entities||[],e=[...s,...i.functions||[],...i.events||[],...i.projects||[]],t=s.reduce((l,u)=>[...l,...u.properties],[]),r=s.reduce((l,u)=>[...l,...u.methods],[]),a=r.reduce((l,u)=>[...l,...qd(u.inputs),...Wr(zt(u.calls)),...u.returnStatements],[]),d=i.functions.reduce((l,u)=>[...l,...Wr(zt(u.calls)),...u.returnStatements],[]),o=i.events.reduce((l,u)=>[...l,...Wr(zt(u.calls)),...u.returnStatements],[]);return[...e,...t,...r,...a,...d,...o]}function jO(i,s){return s.filter(t=>{if(!t)return!1;switch(t.type){case n.FunctionCall:return t.inputs.find(r=>r.id===i.id)!==void 0||t.outputs.find(r=>r.id===i.id)!==void 0;case n.Condition:return t.successCalls.find(r=>r.id===i.id)!==void 0||t.errorCalls.find(r=>r.id===i.id)!==void 0||t.inputs.find(r=>r.id===i.id)!==void 0;case n.Operation:return t.outputs.find(r=>r.id===i.id)!==void 0;case n.VariableDeclaration:return nt.includes(i.type)?cP(i).find(a=>{var d;return((d=a.readsValue)==null?void 0:d.id)===t.id})!==void 0:!1;case n.DefinitionEntity:return t.properties.find(r=>r.id===i.id)!==void 0||t.methods.find(r=>r.id===i.id)!==void 0;case n.FunctionDeclaration:return t.inputs.find(r=>r.id===i.id)!==void 0||(t.returnStatements.map(r=>r.outputs).flat()||[]).find(r=>r.id===i.id)!==void 0;default:return!1}})}function Zq(i){const s=$O(i.project);return jO(i,s)}function Cs(i,s){return i?typeof i=="string"?s[i]:i.type===n.GenericReference?s[i.entityId]:s[i.id]?s[i.id]:null:null}function Jd(i,s={},e={ignoreBuiltInBaseEntities:!1,allBuiltInEntityIds:[]}){if(e.ignoreBuiltInBaseEntities&&(hr.includes(i.type)||(e.allBuiltInEntityIds||[]).includes(i.id)))return{upstream:{},downstream:{}};const t=i,r=i,a=i,d=i,o=i,l=i,u=i,h=i,c=i,v=i,E=i,O=i,w=i,C=[...w.readsValue?[w.readsValue]:[],...w.declaration?[w.declaration]:[],...(O.calledByEntry||[]).flatMap($=>$),...(O.calledBySuccess||[]).flatMap($=>$),...(O.calledByError||[]).flatMap($=>$),...(a.extends||[]).flatMap($=>$),...v.parent?[v.parent]:[]];Array.isArray(a.implements)?C.push(...a.implements.flatMap($=>$)):c.implements&&C.push(c.implements),o.valueAsTypeList&&Array.isArray(o.valueAsTypeList)&&C.push(...o.valueAsTypeList.flatMap($=>$)),o.valueAsTypeSingle&&C.push(o.valueAsTypeSingle);const U=[...(t.inputs||[]).flatMap($=>$),...(E.inputsDeclarations||[]).flatMap($=>$),...(t.outputs||[]).flatMap($=>$),...(E.outputsDeclarations||[]).flatMap($=>$),...(w.internalCalls||[]).flatMap($=>$),...w.writesValues||[],...O.dataType?[O.dataType]:[],...l.body?[l.body]:[],...O.defaultValue?[O.defaultValue]:[],...(O.successCalls||[]).flatMap($=>$),...(O.errorCalls||[]).flatMap($=>$),...(a.properties||[]).flatMap($=>$),...(a.methods||[]).flatMap($=>$),...(a.abstractMethods||[]).flatMap($=>$),...u.error?[u.error]:[],...u.process?[u.process]:[],...v.throws?[v.throws]:[],...(r.andChildrenGroup||[]).flatMap($=>$),...(r.orChildrenGroup||[]).flatMap($=>$),...(h.entities||[]).flatMap($=>$),...(h.functions||[]).flatMap($=>$),...(h.functionCalls||[]).flatMap($=>$),...(h.events||[]).flatMap($=>$),...(h.conditions||[]).flatMap($=>$),...(h.operations||[]).flatMap($=>$),...(h.loops||[]).flatMap($=>$),...(h.variableDeclarations||[]).flatMap($=>$),...(h.variableInstances||[]).flatMap($=>$),...(h.searches||[]).flatMap($=>$),...(h.projects||[]).flatMap($=>$),...(d.calls||[]).flatMap($=>$)];i.type===n.DataType&&(r.entity&&s[B(r.entity)]&&s[B(r.entity)].parent&&B(s[B(r.entity)].parent)===i.id?U.push(r.entity):r.entity&&C.push(r.entity));const G={},_={};return C.forEach($=>{const k=B($);if(k&&e.ignoreBuiltInBaseEntities&&(hr.includes($.type)||(e.allBuiltInEntityIds||[]).includes(k)))return;const J=$.version;k&&(G[k]=J)}),U.forEach($=>{const k=B($);if(k&&e.ignoreBuiltInBaseEntities&&(hr.includes($.type)||(e.allBuiltInEntityIds||[]).includes(k)))return;const J=$.version;k&&(_[k]=J)}),{upstream:G,downstream:_}}function qq(i,s){const e=[];if(Cr.includes(i.type)){fr(i).forEach(a=>{const d=Zd(a,s);d&&e.push(d)});const r=[...i.inputs||[],...i.outputs||[]].map(a=>{const d=Cs(a,s);return d?yP(d,s):null}).filter(a=>a!==null);e.push(...p(r))}if(Qe.includes(i.type)){const t=Wd(i);t&&e.push(t)}return p(e)}function Mn(i){const s=[];if(Cr.includes(i.type)){i.calledBy.forEach(r=>{const a=Ot(r);a&&s.push(a)});const t=[...i.inputs||[],...i.outputs||[]].map(r=>Wd(r)).filter(r=>r!==null);s.push(...p(t))}if(Qe.includes(i.type)){const e=Wd(i);e&&s.push(e)}return p(s)}function fr(i){return[...i.calledByEntry||[],...i.calledByError||[],...i.calledBySuccess||[]].filter(s=>s.type!==n.GenericReference)}function GO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ActionDescriptor)throw new Error("Entity must be an action descriptor to be flattened");return[i,...i.inputs.flatMap(t=>N(t,s,e)),...i.outputs.flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...i.parent?N(i.parent,s,e):[]]}function FO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ArgumentDeclaration)throw new Error("Entity must be an argument declaration to be flattened");return[i,...i.defaultValue?N(i.defaultValue,s):[],...i.writesValues.flatMap(t=>N(t,s,e)),...i.dataType?N(i.dataType,s,e):[],...i.parent?N(i.parent,s,e):[]]}function xO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.BreakStatement)throw new Error("Entity must be a break statement to be flattened");return[i,...i.outputs.flatMap(t=>N(t,s,e)),...i.throws?N(i.throws,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function SO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.BuiltInBaseEntity)throw new Error("Entity must be a built-in base entity to be flattened");return[i,...(i.properties||[]).flatMap(t=>N(t,s,e)),...(i.methods||[]).flatMap(t=>N(t,s,e)),...(i.abstractMethods||[]).flatMap(t=>N(t,s,e)),...(i.extends||[]).flatMap(t=>N(t,s,e))]}function kO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Condition)throw new Error("Entity must be a condition to be flattened");return[i,...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function ZO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ContinueStatement)throw new Error("Entity must be a continue statement to be flattened");return[i,...i.outputs.flatMap(t=>N(t,s,e)),...i.throws?N(i.throws,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function qO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.DefinitionEntity)throw new Error("Entity must be a definition entity to be flattened");return[i,...(i.extends||[]).flatMap(t=>N(t,s,e)),...(i.implements||[]).flatMap(t=>N(t,s,e)),...(i.properties||[]).flatMap(t=>N(t,s,e)),...(i.methods||[]).flatMap(t=>N(t,s,e)),...(i.abstractMethods||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function JO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.DataType)throw new Error("Entity must be a data type to be flattened");return[i,...(i.andChildrenGroup||[]).flatMap(t=>N(t,s,e)),...(i.orChildrenGroup||[]).flatMap(t=>N(t,s,e)),...i.entity?N(i.entity,s,e):[],...i.parent?N(i.parent,s,e):[]]}function WO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.FunctionCall)throw new Error("Entity must be a function call to be flattened");return[i,...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...i.process?N(i.process,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function zO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.FunctionDeclaration)throw new Error("Entity must be a function declaration to be flattened");return[i,...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.calls||[]).flatMap(t=>N(t,s,e)),...i.implements?N(i.implements,s,e):[],...i.parent?N(i.parent,s,e):[]]}function YO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.GlobalEvent)throw new Error("Entity must be a global event to be flattened");return[i,...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.calls||[]).flatMap(t=>N(t,s,e)),...i.implements?N(i.implements,s,e):[],...i.parent?N(i.parent,s,e):[]]}function HO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.InputMap)throw new Error("Entity must be an input map to be flattened");return[i,...i.readsValue?N(i.readsValue,s,e):[],...i.declaration?N(i.declaration,s,e):[],...i.defaultValue?N(i.defaultValue,s,e):[],...i.parent?N(i.parent,s,e):[]]}function KO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.InstalledProject)throw new Error("Entity must be an installed project to be flattened");return[i,...(i.functions||[]).flatMap(t=>N(t,s,e)),...(i.events||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function XO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.InternalCall)throw new Error("Entity must be an internal call to be flattened");return[i,...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...i.process?N(i.process,s,e):[],...i.parent?N(i.parent,s,e):[]]}function QO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.LiteralValue)throw new Error("Entity must be a literal value to be flattened");return[i,...i.valueAsTypeSingle?N(i.valueAsTypeSingle,s,e):[],...i.valueAsTypeList&&Array.isArray(i.valueAsTypeList)?i.valueAsTypeList.flatMap(t=>N(t,s,e)):[],...i.parent?N(i.parent,s,e):[]]}function eP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Loop)throw new Error("Entity must be a loop to be flattened");return[i,...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...i.process?N(i.process,s,e):[],...i.body?N(i.body,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function tP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Operation)throw new Error("Entity must be an operation to be flattened");return[i,...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...i.process?N(i.process,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function rP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.OutputMap)throw new Error("Entity must be an output map to be flattened");return[i,...(i.writesValues||[]).flatMap(t=>N(t,s,e)),...i.declaration?N(i.declaration,s,e):[],...i.defaultValue?N(i.defaultValue,s,e):[],...i.parent?N(i.parent,s,e):[]]}function iP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.PrimitiveEntity)throw new Error("Entity must be a primitive entity to be flattened");return[i,...(i.properties||[]).flatMap(t=>N(t,s,e)),...(i.methods||[]).flatMap(t=>N(t,s,e)),...(i.abstractMethods||[]).flatMap(t=>N(t,s,e))]}function nP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Project)throw new Error("Entity must be a project to be flattened");return[i,...(i.entities||[]).flatMap(t=>N(t,s,e)),...(i.functions||[]).flatMap(t=>N(t,s,e)),...(i.events||[]).flatMap(t=>N(t,s,e)),...(i.projects||[]).flatMap(t=>N(t,s,e)),...(i.variableDeclarations||[]).flatMap(t=>N(t,s,e)),...(i.variableInstances||[]).flatMap(t=>N(t,s,e)),...(i.operations||[]).flatMap(t=>N(t,s,e)),...(i.conditions||[]).flatMap(t=>N(t,s,e)),...(i.functionCalls||[]).flatMap(t=>N(t,s,e)),...(i.projects||[]).flatMap(t=>N(t,s,e)),...(i.loops||[]).flatMap(t=>N(t,s,e)),...(i.searches||[]).flatMap(t=>N(t,s,e))]}function aP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Property)throw new Error("Entity must be a property to be flattened");return[i,...i.defaultValue?N(i.defaultValue,s,e):[],...i.dataType?N(i.dataType,s,e):[],...i.parent?N(i.parent,s,e):[]]}function sP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ReturnDeclaration)throw new Error("Entity must be a return declaration to be flattened");return[i,...i.readsValue?N(i.readsValue,s,e):[],...i.defaultValue?N(i.defaultValue,s,e):[],...i.dataType?N(i.dataType,s,e):[],...i.parent?N(i.parent,s,e):[]]}function oP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ReturnStatement)throw new Error("Entity must be a return statement to be flattened");return[i,...(i.outputs||[]).flatMap(t=>N(t,s,e)),...i.throws?N(i.throws,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function dP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Search)throw new Error("Entity must be a search to be flattened");return[i,...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(i.inputsDeclarations||[]).flatMap(t=>N(t,s,e)),...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputsDeclarations||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function lP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ValueDescriptor)throw new Error("Entity must be a value descriptor to be flattened");return[i,...i.defaultValue?N(i.defaultValue,s,e):[],...i.dataType?N(i.dataType,s,e):[],...i.parent?N(i.parent,s,e):[]]}function uP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.VariableDeclaration)throw new Error("Entity must be a variable declaration to be flattened");return[i,...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...(i.internalCalls||[]).flatMap(t=>N(t,s,e)),...(i.writesValues||[]).flatMap(t=>N(t,s,e)),...i.readsValue?N(i.readsValue,s,e):[],...i.defaultValue?N(i.defaultValue,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.dataType?N(i.dataType,s,e):[],...i.parent?N(i.parent,s,e):[]]}function pP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.VariableInstance)throw new Error("Entity must be a variable instance to be flattened");return[i,...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...(i.internalCalls||[]).flatMap(t=>N(t,s,e)),...(i.writesValues||[]).flatMap(t=>N(t,s,e)),...i.readsValue?N(i.readsValue,s,e):[],...i.defaultValue?N(i.defaultValue,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.declaration?N(i.declaration,s,e):[],...i.parent?N(i.parent,s,e):[]]}function Vr(){const i=new Set,s=eI.flatMap(e=>N(e,i)).map(e=>e.id);if(!s.includes("http-request-error-return-delaration-id"))throw new Error("Built-in base entities must be included in the list");return s}function N(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(!i)throw new Error("Entity must be defined to be flattened");if(i.type===n.GenericReference)return[];if(e.ignoreBuiltInBaseEntities&&(hr.includes(i.type)||Vr().includes(i.id)))return[];if(s.has(i.id))return[];switch(i.type){case n.FunctionCall:return WO(i,s,e);case n.Operation:return tP(i,s,e);case n.Condition:return kO(i,s,e);case n.Loop:return eP(i,s,e);case n.Search:return dP(i,s,e);case n.GlobalEvent:return YO(i,s,e);case n.ReturnStatement:return oP(i,s,e);case n.ContinueStatement:return ZO(i,s,e);case n.BreakStatement:return xO(i,s,e);case n.VariableDeclaration:return uP(i,s,e);case n.DefinitionEntity:return qO(i,s,e);case n.FunctionDeclaration:return zO(i,s,e);case n.Project:return nP(i,s,e);case n.ActionDescriptor:return GO(i,s,e);case n.ArgumentDeclaration:return FO(i,s,e);case n.ReturnDeclaration:return sP(i,s,e);case n.ValueDescriptor:return lP(i,s,e);case n.InputMap:return HO(i,s,e);case n.OutputMap:return rP(i,s,e);case n.DataType:return JO(i,s,e);case n.InstalledProject:return KO(i,s,e);case n.InternalCall:return XO(i,s,e);case n.LiteralValue:return QO(i,s,e);case n.Property:return aP(i,s,e);case n.VariableInstance:return pP(i,s,e);case n.BuiltInBaseEntity:return e.ignoreBuiltInBaseEntities?[]:SO(i,s,e);case n.PrimitiveEntity:return e.ignoreBuiltInBaseEntities?[]:iP(i,s,e)}return[]}function xc(i){return i.type===n.FunctionCall||i.type===n.InternalCall||[n.Operation,n.Condition,n.Loop].includes(i.type)?i.declaration.inputs:i.type===n.FunctionDeclaration||$n.includes(i.type)?i.inputs:i.type===n.Search?i.inputsDeclarations:[]}function Jq(i,s){return s.type===n.Condition?s.inputs.find(e=>e.declaration.id===i.id):s.type===n.FunctionCall||s.type===n.Operation?s.inputs.find(e=>e.declaration.id===i.id):null}function cP(i){return nt.includes(i.type)?i.inputs:[]}function fP(i){var s;return i.type===n.FunctionCall?((s=i.declaration.returnStatements[0])==null?void 0:s.outputs)||[]:[n.Operation,n.Condition,n.Loop].includes(i.type)?i.declaration.outputs:i.type===n.Search?i.outputsDeclarations:st.includes(i.type)?i.outputs:[]}function Wq(i,s){return s.type===n.Condition?null:s.type===n.FunctionCall||s.type===n.Operation?s.outputs.find(e=>e.declaration.id===i.id):null}function zq(i){return i.type===n.Condition?[]:nt.includes(i.type)?i.outputs:[]}function Wd(i){const s=i.readsValue;return s?Ot(s):null}function yP(i,s){const e=i.readsValue;return e?Zd(e,s):null}function hP(i){const s=i.internalCalls||[];return p(zt(p(s.flatMap(e=>[...e.successCalls,...e.errorCalls]))))}function ba(i){const s=Fc(i),e=[];return s.forEach(t=>{if(Qe.includes(t.type))e.push(t);else if(hi.includes(t.type)){const r=t.parent;e.push(r)}}),e}function p(i){const s=new Set;return i.filter(e=>!e||s.has(e.id)?!1:(s.add(e.id),!0))}function Ji(i,s=!1){const e=[];if(i.type===n.Project&&e.push(...(i==null?void 0:i.entities)||[],...(i==null?void 0:i.functions)||[],...(i==null?void 0:i.variableDeclarations)||[],...(i==null?void 0:i.variableInstances)||[],...(i==null?void 0:i.searches)||[],...(i==null?void 0:i.loops)||[],...(i==null?void 0:i.operations)||[],...(i==null?void 0:i.conditions)||[],...(i==null?void 0:i.functionCalls)||[],...(i==null?void 0:i.events)||[],...(i==null?void 0:i.projects)||[]),mt.includes(i.type)&&e.push(...(i==null?void 0:i.detachedChildren)||[]),i.type===n.DefinitionEntity){const t=[...i.suggestedMethods,...i.methods].flatMap(r=>r.collapsed&&s?[]:Ji(r));e.push(...t)}if(i.type===n.Condition){const t=i.successCalls.map(a=>Ot(a)),r=i.errorCalls.map(a=>Ot(a));e.push(...t,...r)}if($n.includes(i.type)){if(i.collapsed&&s)return[];const t=i.inputs.map(a=>ba(a)).flat(),r=i.calls.map(a=>Ot(a));e.push(...p(t),...r)}if(nt.includes(i.type)&&i.type!==n.Condition&&i.type!==n.Loop){const t=i==null?void 0:i.outputs.map(d=>ba(d)).flat(),r=i.successCalls.map(d=>Ot(d)),a=i.errorCalls.map(d=>Ot(d));e.push(...p(t),...r,...a)}if(Qe.includes(i.type)){const t=ba(i),r=hP(i);e.push(...t,...r)}if(i.type===n.Loop){const t=i.outputs.map(d=>ba(d)).flat();if(i.body){const d=Ji(i.body,s);e.push(...d)}const r=i.errorCalls.map(d=>Ot(d)),a=i.successCalls.map(d=>Ot(d));e.push(...p(t),...a,...r)}if(i.type===n.FunctionDeclaration){if(i.collapsed&&s)return[];const t=i.inputs.map(a=>ba(a)).flat(),r=i.calls.map(a=>Ot(a));e.push(...p(t),...r)}return p(e)}function mP(i,s=!1){const e=Ji(i,s),t=[...e,...e.reduce((r,a)=>[...r,...mP(a,s)],[])];return p(t)}function vP(i){const s=Mn(i),e=[...s,...s.reduce((t,r)=>[...t,...vP(r)],[])];return p(e)}function zd(i){return i.implements.reduce((s,e)=>e.type===n.DefinitionEntity?[...s,n.DefinitionEntity,...zd(e),...Yd(e)]:[...s,e.name],[])}function Yd(i){return i.extends.reduce((s,e)=>e.type===n.DefinitionEntity?[...s,n.DefinitionEntity,...Yd(e),...zd(e)]:[...s,e.name],[])}function Sc(i){return i.extends.reduce((s,e)=>e.type===n.DefinitionEntity?[...s,e,...Sc(e),...kc(e)]:[...s,e],[])}function kc(i){return i.implements.reduce((s,e)=>e.type===n.DefinitionEntity?[...s,e,...kc(e),...Sc(e)]:[...s,e],[])}function Zc(i){return[...Yd(i),...zd(i)].filter((e,t,r)=>r.indexOf(e)===t)}function TP(i){return i.implements.length===0&&i.extends.length===0?null:i.implements.find(t=>t.type===n.BuiltInBaseEntity&&t.name===Y.PERSISTED_ENTITY)?i:[...i.implements,...i.extends].reduce((t,r)=>{if(r.type===n.DefinitionEntity){const a=TP(r);if(a)return a}return t},null)}function Yq(i){const s=i.extends.find(e=>e.type===n.BuiltInBaseEntity);return s&&s.type===n.BuiltInBaseEntity?s:null}function Hq(i){const s=i.implements.find(e=>e.type===n.BuiltInBaseEntity);return s&&s.type===n.BuiltInBaseEntity?s:null}function qc(i){const s=i.extends.find(e=>e.type===n.DefinitionEntity);return s&&s.type===n.DefinitionEntity?s:null}function Wi(i){const s=[...i.implements,...i.extends].reduce((e,t)=>t.type===n.BuiltInBaseEntity?[...e,t]:t.type===n.DefinitionEntity?[...e,...Wi(t)]:e,[]);return p(s)}function Jc(i){return i.type===n.PrimitiveEntity?!0:i.type===n.BuiltInBaseEntity?i.interactive:!Wi(i).find(t=>!t.interactive)}function Kq(i){return i.parent===i.project&&i.project.variableDeclarations.includes(i)}function Wc(i){return i.parent!==i.project?!1:n.VariableDeclaration===i.type?i.project.variableDeclarations.includes(i):n.VariableInstance===i.type?i.project.variableInstances.includes(i):n.FunctionCall===i.type?i.project.functionCalls.includes(i):n.Condition===i.type?i.project.conditions.includes(i):n.Operation===i.type?i.project.operations.includes(i):n.Loop===i.type?i.project.loops.includes(i):n.Search===i.type?i.project.searches.includes(i):!1}function EP(i){if([...at,n.DefinitionEntity,n.InstalledProject,n.Project].includes(i.type)||Wc(i))return!1;const s=Mn(i);return s.length===0?!0:s.some(e=>EP(e))}function zc(i){return[...at,n.DefinitionEntity,n.InstalledProject,n.Project].includes(i.type)||Wc(i)?!1:Mn(i).length===0}function IP(i,s=0){if(zc(i)){const e=Mn(i);return e.length===0?i:e.map(r=>IP(r,s+1)).reduce((r,a)=>r?a&&a.x<r.x?a:r:a,null)}return null}function AP(i){const s=[];if(zc(i))s.push(i);else return[];return Mn(i).forEach(t=>{s.push(...AP(t))}),s}function bP(i){return i.type===n.FunctionDeclaration&&i.parent!==i.project&&!![n.DefinitionEntity,n.Loop,n.InstalledProject].includes(i.parent.type)}function Xq(i,s){const e=new Map;return i.forEach(t=>{e.set(t.id,t)}),s.forEach(t=>{e.set(t.id,t)}),Array.from(e.values())}function Bs(i){switch(i){case n.DefinitionEntity:return Yi;case n.FunctionDeclaration:return Mi;case n.VariableDeclaration:return $i;case n.VariableInstance:return Ui;case n.FunctionCall:return qi;case n.Operation:return gi;case n.Condition:return Li;case n.ReturnStatement:return _i;case n.Loop:return Ni;case n.Search:return ji;case n.InputMap:return Zr;case n.OutputMap:return qr;case n.ArgumentDeclaration:return Fi;case n.ReturnDeclaration:return rr;case n.Property:return Bi;case n.InstalledProject:return Gi;case n.Project:return I;case n.BuiltInBaseEntity:return zr;default:return null}}function Yt(i,s){if(mt.includes(i.type))return i;if(hr.includes(i.type))return null;const e=i.parent;if(!e)return null;if(e.type===n.GenericReference){const t=B(e);if(!t)return null;const r=s.get(t);return r?Yt(r,s):null}else return e===s?s:Yt(e,s)}function Yc(i,s){if(hr.includes(i.type)||s.getBuiltIn(i.id))return null;const e=nr(i.parent,s);return e?e===s?mt.includes(i.type)?i:null:e.type===n.DefinitionEntity?i:Yc(e,s):null}function Hd(i,s,e){if(i===s||s===e||i===e)return!1;const t=Yt(s.parent,e);return t===i?!0:Hd(t,s,e)}var Kd=(i=>(i.SameBothLocal="same-both-local",i.AInB="a-in-b",i.BInA="b-in-a",i.ParallelInCommonParent="parallel-in-common-parent",i.ParallelInProject="parallel-in-project",i.AIsGlobalBIsNot="a-is-global-b-is-not",i.BIsGlobalAIsNot="b-is-global-a-is-not",i.SameBothGlobal="same-both-global",i))(Kd||{});function _s(i,s,e){const t=Yt(i,e),r=Yt(s,e);if(!t)throw new Error("Could not find scope owner for the entity: "+i.id);if(!r)throw new Error("Could not find scope owner for the entity: "+s.id);if(t===r&&t.type!==n.Project)return{compatible:!0,type:"same-both-local",commonAncestorScope:t};if(t===r&&t.type===n.Project)return{compatible:!0,type:"same-both-global",commonAncestorScope:t};if(t.type===n.Project&&r.type!==n.Project)return{compatible:!1,type:"a-is-global-b-is-not",commonAncestorScope:t};if(t.type!==n.Project&&r.type===n.Project)return{compatible:!1,type:"b-is-global-a-is-not",commonAncestorScope:r};if(Hd(t,r,e))return{compatible:!0,type:"b-in-a",commonAncestorScope:t};if(Hd(r,t,e))return{compatible:!0,type:"a-in-b",commonAncestorScope:r};const o=jc(t,r);return o===e?{compatible:!1,type:"parallel-in-project",commonAncestorScope:o}:o?{compatible:!1,type:"parallel-in-common-parent",commonAncestorScope:Yt(o,e)}:{compatible:!1,type:"parallel-in-project",commonAncestorScope:e}}function RP(i,s,e){const t=_s(i,s,e);if(!t.compatible||t.type!=="same-both-local")return null;if(i===s)return i;let r=Yt(i.parent,e);if(r){if(r===s)return s;if(r.type===n.Project)return i}else return i;for(;r;){if(r){if(r===s)return s;if(r.type===n.Project)return i}else return i;r=Yt(r.parent,e)}let a=Yt(s.parent,e);if(a){if(a===i)return i;if(a.type===n.Project)return s}else return s;for(;a;){if(a){if(a===i)return i;if(a.type===n.Project)return s}else return s;a=Yt(a.parent,e)}return null}function DP(i){return i.length===0?null:i.length===1?i[0]:i.reduce((e,t)=>{const r=RP(e,t,t.project);return!r||r===t?e:t},i[0])}function nr(i,s){if(!i)return null;let e;return typeof i=="string"?e=i:i.type===n.GenericReference?e=B(i):e=i.id,e===s.id?s:s.get(e)}function zi(i){if(!i)return null;if(hr.includes(i.type))return i;if(i.type===n.Project)return null;if(i.project.getBuiltIn(i.id))return i;const s=i.parent;return!s||s.type===n.Project?null:zi(s)}function Qq(i,s){var e;if(i.readsValue){const t=nr(i.readsValue,s.project);s.setValueWriter(t),t.addValueReader(s)}else i.readsValue===null&&((e=s.readsValue)==null||e.removeValueReader(s),s.readsValue=null);return s}function Ms(i){const s=[];function e(a,d){return s.some(o=>o.blockedByCaller===a&&o.blockedByCalling===d)}function t(a,d){e(a,d)||s.push({blockedByCaller:a,blockedByCalling:d})}const r=Yc(i,i.project);return i.calledBySuccess.forEach(a=>{[...a.successCalls||[]].forEach(l=>{st.includes(l.type)&&l!==i&&(it(i).find(c=>c===l)||t(a,l))});let o;if(nt.includes(a.type)&&(o=a),o){const l=Ms(o);l.reachable||it(i).find(c=>c===a)||l.blocks.forEach(c=>{t(a,c.blockedByCalling)})}}),i.calledByError.forEach(a=>{[...a.errorCalls||[]].forEach(l=>{st.includes(l.type)&&l!==i&&(it(i).find(c=>c===l)||t(a,l))});let o;if(nt.includes(a.type)&&(o=a),o){const l=Ms(o);l.reachable||it(i).find(c=>c===a)||l.blocks.forEach(c=>{t(a,c.blockedByCalling)})}}),i.calledByEntry.forEach(a=>{if([...a.calls||[]].forEach(l=>{st.includes(l.type)&&l!==i&&(it(i).find(c=>c===l)||t(a,l))}),a===r)return;let o;if(a.type===n.FunctionDeclaration){const l=Ot(a);if(l.type===n.DefinitionEntity)return;l.type===n.Loop&&(o=l)}if(o){const l=Ms(o);l.reachable||l.blocks.forEach(u=>{t(a,u.blockedByCalling)})}}),{reachable:s.length===0,entryPoint:r,blocks:s}}function eJ(i){return Gs.includes(i.type)?i.type===n.FunctionDeclaration?!bP(i):!0:!1}function tJ(i){if(n.ActionDescriptor===i.type){if(i.project.operationDeclarations.find(a=>a.id===i.id))return n.Operation;if(i.project.globalEventActionDescriptors.find(a=>a.id===i.id))return n.GlobalEvent;if(i.project.loopDeclarations.find(a=>a.id===i.id))return n.Loop;if(i.project.conditionDeclarations.find(a=>a.id===i.id))return n.Condition}return i.type}function Ra(i,s){if(i.type!==n.DefinitionEntity||i.abstract)return!1;const e=qc(i)||i;return!!Zc(e).includes(s)}function rJ(i){const s=[];return i.entities.forEach(e=>{if(Ra(e,Y.PERSISTED_ENTITY)){s.push(e);return}}),p(s)}function iJ(i){const s=[];return i.entities.forEach(e=>{if(Ra(e,Y.RELATIONAL_DATABASE)){s.push(e);return}}),p(s)}function nJ(i){return i.type!==n.DefinitionEntity||i.abstract||!Ra(i,Y.PERSISTED_ENTITY)?null:(i==null?void 0:i.properties.find(e=>{var t;return((t=e.implements)==null?void 0:t.id)===x[n.BuiltInBaseEntity][Y.PERSISTED_ENTITY].properties.primaryKey.id&&!e.abstract}))||null}function aJ(i){if(i.type!==n.DefinitionEntity)return[];if(i.abstract)return[];if(!Ra(i,Y.PERSISTED_ENTITY))return[];const s=[],e=i.properties.filter(t=>{var r;return((r=t.implements)==null?void 0:r.id)!==x[n.BuiltInBaseEntity][Y.PERSISTED_ENTITY].properties.database.id&&!t.abstract});return s.push(...e),s}function sJ(i){var e;if(!i||i.type!==n.DefinitionEntity||!Ra(i,Y.PERSISTED_ENTITY))return null;const s=i.properties.find(t=>{var r;return((r=t.implements)==null?void 0:r.id)===x[n.BuiltInBaseEntity][Y.PERSISTED_ENTITY].properties.database.id});return(e=s==null?void 0:s.getDefaultValue())==null?void 0:e.valueAsTypeSingle}function ft(i,s){var t;if(!rf.includes(s.type)||!i)return s.project||null;let e=s.project;return i.type===n.Project?e=i:((t=s.project)==null?void 0:t.id)!==i.project.id&&(e=i.project),e}function oJ(i){switch(i){case n.Project:return I;case n.InstalledProject:return Gi;case n.DefinitionEntity:return Yi;case n.FunctionDeclaration:return Mi;case n.GlobalEvent:return Vn;case n.VariableInstance:return Ui;case n.VariableDeclaration:return $i;case n.InputMap:return Zr;case n.OutputMap:return qr;case n.Condition:return Li;case n.Operation:return gi;case n.FunctionCall:return qi;case n.ReturnDeclaration:return rr;case n.ArgumentDeclaration:return Fi;case n.PrimitiveEntity:return ar;case n.DataType:return wn;case n.Property:return Bi;case n.ActionDescriptor:return qe;case n.ReturnStatement:return _i;case n.ContinueStatement:return jt;case n.BreakStatement:return Cn;case n.Loop:return Ni;case n.Search:return ji;case n.ValueDescriptor:return xi;case n.InternalCall:return Bn;case n.LiteralValue:return _n}return null}function dJ(i){const s={added:{},updated:{},removed:{},affected:[],seenEntities:[],self:i==null?void 0:i.self};return i==null||i.added.forEach(e=>{s.added[e.id]=e}),i==null||i.updated.forEach(e=>{s.updated[e.id]=e}),i==null||i.removed.forEach(e=>{s.removed[e.id]=e}),s.affected=Array.from(new Set(i==null?void 0:i.affected.map(e=>e.id))),s}function dt(i,s){const e=Bs(i.type);return e?!e.MUTABLE_META_PROPERTIES.every(r=>{const a=i[r],d=s[r];return d===void 0||a===d?!0:Array.isArray(a)&&Array.isArray(d)?a.length!==d.length?!1:a.every((o,l)=>o===d[l]):!1}):!1}function Xd(i,s={}){if(i.type===n.Project)return[];if(!i.parent)return[];const e=B(i.parent);if(!e)return[];const t=s[e];return t?[t.id,...Xd(t,s)]:[]}function lJ(i){const s=[],e=new Set;return[...i.listAdded,...i.listUpdated,...i.listAffected].forEach(t=>{const r=Ot(t);!r||e.has(r.id)||(e.add(r.id),s.push(r))}),p(s)}function uJ(i,s){const e=[];if(i.parent)if(i.id===i.parent)e.push(new P({id:`${i.id}--${i.parent}--${A.SelfReference}`,code:A.SelfReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has a reference to itself at 'parent'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));else{const t=s.get(i.parent);t?[n.Project,n.DataType].includes(t.type)||e.push(new P({id:`${i.id}--${i.parent}--${A.InvalidParentReference}`,code:A.InvalidParentReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has a parent reference that isn't pointing to an entity of type 'project' or 'data-type'.`,issue:null})):e.push(new P({id:`${i.id}--${i.parent}--${A.ReferencedEntityNotFound}`,code:A.ReferencedEntityNotFound,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", is referencing an entity with id "${i.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}return i.implements&&Array.isArray(i.implements)?i.implements.forEach(t=>{if(i.id===t){e.push(new P({id:`${i.id}--${t}--${A.SelfReference}`,code:A.SelfReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has a reference to itself at one of the 'implements' references. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));return}const r=s.get(t);r?[n.DefinitionEntity,n.BuiltInBaseEntity].includes(r.type)?r.abstract||e.push(new P({id:`${i.id}--${t}--${A.InvalidImplementsReference}`,code:A.InvalidImplementsReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'implements' reference that isn't pointing to an abstract entity.`,issue:null})):e.push(new P({id:`${i.id}--${t}--${A.InvalidImplementsReference}`,code:A.InvalidImplementsReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'implements' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):e.push(new P({id:`${i.id}--${t}--${A.ReferencedEntityNotFound}`,code:A.ReferencedEntityNotFound,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", is referencing an entity with id "${t}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}):e.push(new P({id:`${i.id}--${j.InvalidObjectStructure}`,code:j.InvalidObjectStructure,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'implements' property that isn't an array.`,issue:null})),i.extends&&Array.isArray(i.extends)&&i.extends.forEach(t=>{const r=s.get(t);r?[n.DefinitionEntity,n.BuiltInBaseEntity].includes(r.type)?r.abstract&&e.push(new P({id:`${i.id}--${t}--${A.InvalidExtendsReference}`,code:A.InvalidExtendsReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'extends' reference that isn't pointing to a non-abstract entity. Did you want to use the property 'implements', which holds a list of references to absract entities, instead?`,issue:null})):e.push(new P({id:`${i.id}--${t}--${A.InvalidExtendsReference}`,code:A.InvalidExtendsReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'extends' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):e.push(new P({id:`${i.id}--${t}--${A.ReferencedEntityNotFound}`,code:A.ReferencedEntityNotFound,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", is referencing an entity with id "${t}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}),e}var OP=(i=>(i.Extends="extends",i.Implements="implements",i))(OP||{});const Le=class Le extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"name");f(this,"description",null);f(this,"x");f(this,"y");f(this,"static");f(this,"abstract");f(this,"type",n.DefinitionEntity);f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"implements",[]);f(this,"project");f(this,"errors",[]);f(this,"parent");f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"suggestedProperties",[]);f(this,"suggestedMethods",[]);this.initialData=e,this.project=t,this.id=e.id,this.name=e.name,this.description=e.description,this.x=e.x,this.y=e.y,this.static=e.static,this.abstract=e.abstract}static fromGenerationTarget(e,t){let r=t;if(e.parent){const u=B(e.parent);r=t.get(u)}const a=[];e.implements&&e.implements.forEach(u=>{a.push(t.get(u)||t.getBuiltIn(u))});const d=[];e.extends&&e.extends.forEach(u=>{d.push(t.get(u)||t.getBuiltIn(u))});const o={id:e.id,version:I.UUID.uuid(),createdAt:T().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,name:e.name,type:n.DefinitionEntity,description:e.description,static:e.static,abstract:e.abstract,properties:[],methods:[],abstractMethods:[],extends:d,implements:a,x:0,y:0,parent:r},l=V(o,t);return l.setParent(r,null),l.initChildren(null),l}static validateGenerationTarget(e,t){let r=JSON.parse(JSON.stringify(e));const a=[],d=uJ(r,t),o=yc(r,t);a.push(...d,...o,...ot(r));const l=r.parent?t.get(r.parent):null;if(l&&l.type===n.DataType){const u=l;u.entity&&a.push(new P({id:`${e.id}--${A.NewEntityWouldOverriteExisting}`,code:A.NewEntityWouldOverriteExisting,severity:D.Error,message:`The entity of type '${e.type}' with id '${e.id}' can't be added to the 'parent' entity with id '${u.id}' because it already has an 'entity' child. Data type entities can only have one 'entity' as children.
406
406
  You can inspect the existing 'entity' field with the 'describe_entity' action. Like so:
407
407
  ${Jr({describe_entity:u.entity.id})}
408
- Alternatively you can update the parent data-type entity with 'update' action to remove the existing value of the field.`,issue:null}))}return{errors:a,modifiedData:r}}get allBasePropertiesFromExtendedAndImplementedEntities(){return p([...this.extends.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract),...e],[]),...this.implements.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract),...e],[])])}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[]),...this.implements.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[])].filter(e=>!!e.abstract))}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new P({id:`${this.id}--${A.InvalidParentUpdate}`,code:A.InvalidParentUpdate,severity:D.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on an '${this.type}', must be the root project as it is a globally declared entity.`,issue:null})),{errors:t,modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(){const e=[],t=[],r=[],a=[];return Object.values(this.detachedDependents).forEach(d=>{const o=d.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),r.push(...o.removed),a.push(...o.affected)}),{updated:p(e),added:p(t),removed:p(r),affected:p(a),self:this}}onDetachedDependencyRemoved(e,t,r){const a=[],d=[],o=[],l=[];return t==="implements"&&this.removeImplementation(e),t==="extends"&&this.removeExtension(e),{updated:p(a),added:p(d),removed:p(o),affected:p(l),self:this}}onDetachedDependencyRestored(e,t,r){const a=[],d=[],o=[],l=[];return t==="implements"&&this.addImplementation(e),t==="extends"&&this.addExtension(e),{updated:p(a),added:p(d),removed:p(o),affected:p(l),self:this}}subscribeToDependencies(){return this.implements.forEach(e=>{hr.includes(e.type)||e.subscribeDependents([{entity:this,field:"implements"}])}),this.extends.forEach(e=>{hr.includes(e.type)||e.subscribeDependents([{entity:this,field:"extends"}])}),this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=I.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t,r;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new Le(this,this.project);return(r=this.knownVersions)==null||r.set(this.version,e),e.properties=this.properties,e.methods=this.methods,e.abstractMethods=this.abstractMethods,e.extends=this.extends,e.implements=this.implements,e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],r=[],a=[],d=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),r.push(...o.added),a.push(...o.removed)}return{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}async restoreVersion(e){var l;const t=[],r=[],a=[],d=[];if(this.version===e)return{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this};if(!this.knownVersions){const u=new Map;for(const[h,c]of this.knownVersions||new Map){if(u.set(h,c),c.activeVersion=!1,c.knownVersions)for(const[v,E]of c.knownVersions)u.set(v,E);c.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new Le(u,this.project)}return this.metaSync(o.toShallowJSON(),null),this.properties=o.properties,this.methods=o.methods,this.abstractMethods=o.abstractMethods,this.extends=o.extends,this.implements=o.implements,this.parent=o.parent,{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}hydrateAncestors(){const e=[],t=[],r=[],a=[];if(this.initialData.parent){const d=B(this.initialData.parent),o=this.project.get(d);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${d}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);return this.initialData.extends.forEach(d=>{const o=B(d),l=this.project.get(o);l&&(this.addExtension(l),l.type!==n.BuiltInBaseEntity&&e.push(l))}),this.initialData.implements.forEach(d=>{const o=B(d),l=this.project.get(o);l&&(this.addImplementation(l),l.type!==n.BuiltInBaseEntity&&e.push(l))}),{updated:p(e),added:p(t),removed:p(r),affected:p(a),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],r=[],a=[],d=[];this.initialized=!0,this.captureVersion();const{updated:o,added:l,removed:u,affected:h}=this.syncImplementationProperties(e);t.push(...o),r.push(...l),a.push(...u),d.push(...h);const{updated:c,added:v,removed:E,affected:O}=this.addExtendedProperties(e);return t.push(...c),r.push(...v),a.push(...E),d.push(...O),this.addSuggestions(),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}addSelfToProject(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"add-self-to-project"))){const t=[this],r=[],a=[],d=[];if(this.parent.type===n.DataType){const o=this.parent;o.entity=this,t.push(o)}else this.project.addDefinitionEntity(this);return this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}setParent(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"set-parent"))){var r;return((r=this.parent)==null?void 0:r.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,b.Updated),t==null||t.attemptAutoclose("set-parent",this.id))),this}addExtension(e){return this.extends.includes(e)||this.extends.push(e),this}removeExtension(e){return this.extends=this.extends.filter(t=>t.id!==e.id),this}addImplementation(e){return this.implements.includes(e)||this.implements.push(e),this}removeImplementation(e){return this.implements=this.implements.filter(t=>t.id!==e.id),this}removeProperty(e){return this.properties=this.properties.filter(t=>t.id!==e.id),this}addMethod(e){return this.methods.includes(e)||(this.methods.push(e),this.suggestedMethods=this.suggestedMethods.filter(t=>t.name!==e.name)),this}removeMethod(e){return this.methods=this.methods.filter(t=>t.id!==e.id),this}addProperty(e){return this.properties.includes(e)||(this.properties.push(e),this.suggestedProperties=this.suggestedProperties.filter(t=>t.name!==e.name)),this}addSuggestedProperty(e){return this.suggestedProperties.includes(e)||this.suggestedProperties.push(e),this}addSuggestedMethod(e){return this.suggestedMethods.includes(e)||this.suggestedMethods.push(e),this}removeSuggestedProperty(e){return this.suggestedProperties=this.suggestedProperties.filter(t=>t.id!==e.id),this}removeSuggestedMethod(e){return this.suggestedMethods=this.suggestedMethods.filter(t=>t.id!==e.id),this}addAbstractMethod(e){return this.abstractMethods.includes(e)||this.abstractMethods.push(e),this}removeAbstractMethod(e){return this.abstractMethods=this.abstractMethods.filter(t=>t.id!==e.id),this}initChildren(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.properties=this.initialData.properties.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.methods=this.initialData.methods.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.extends=this.initialData.extends.map(t=>V(t,this.project)),this.implements=this.initialData.implements.map(t=>V(t,this.project)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}syncImplementationProperties(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-implementation-properties"))){const t=[],r=[],a=[],d=[],o=this.properties,l=this.implementedPropertiesFromOriginalParents,u=[...this.allBasePropertiesFromExtendedAndImplementedEntities,...o];return l.filter(c=>!u.find(E=>{var O;return((O=E.implements)==null?void 0:O.id)===c.id})).forEach(c=>{if(this.properties.find(w=>{var C;return((C=w.implements)==null?void 0:C.id)===c.id}))return;const E=this.properties.find(w=>w.name===c.name&&!!w.abstract&&!w.implements);if(E){E.implements=c,E.abstract=!1;return}const O=c.clone(e,this,I.UUID.uuid());O.initChildren(e),r.push(O),e==null||e.add(O,b.Added),O.setImplements(c,e),O.metaSync({abstract:!1},e),this.addProperty(O)}),e==null||e.attemptAutoclose("sync-implementation-properties",this.id),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}addExtendedProperties(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"add-extended-properties"))){const t=[],r=[],a=[],d=[],o=this.properties,l=this.extendedPropertiesFromOriginalParents,u=l.filter(c=>l.find(E=>{var O;return((O=E.implements)==null?void 0:O.id)===c.id})?!1:!c.abstract),h=new Set(o.map(c=>c.name));return u.forEach(c=>{if(h.has(c.name))return;h.add(c.name);const v=c.clone(e,this,I.UUID.uuid());v.initChildren(e),r.push(v),e==null||e.add(v,b.Added),this.addProperty(v)}),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}addSuggestions(){return this.implements.forEach(e=>{$5(this,e).forEach(a=>{const d=a.toJSON();d.id=`_suggestion--parent--${this.id}--${a.id}`;const o=V(d,this.project);o.suggestion=!0,o.setParent(this,null),o.initChildren(null),this.addSuggestedProperty(o)}),j5(this,e).forEach(a=>{const d=`_suggestion--parent--${this.id}--${a.id}`,o=a.implementAsFunctionDeclaration(null,this,d),l=V(o,this.project);if(l.suggestion=!0,l.setParent(this,null),l.initChildren(null),this.methods=this.methods.filter(u=>u.id!==d),l.inputs.forEach(u=>{u.suggestion=!0}),l.returnStatements.length){const u=l.returnStatements[0];u.suggestion=!0,u.outputs.forEach(h=>{h.suggestion=!0})}this.addSuggestedMethod(l)})}),this}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-meta"))){const r=dt(this,e);return e.deleted===!0&&!this.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&this.deleted?t==null||t.add(this,b.Added):r&&(t==null||t.add(this,b.Updated)),super.metaSync(e),this.name=e.name||this.name,this.x=e.x||this.x,this.y=e.y||this.y,this.static=e.static||this.static,this.abstract=e.abstract||this.abstract,t==null||t.attemptAutoclose("sync-meta",this.id),this}async APILoad(e=L,...t){return await Le.repository.APILoad(this.id,...t),this}async APICreate(e=L,...t){return await Le.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=L,...t){return await Le.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=L,...t){return await Le.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=L,...t){return await Le.repository.APIClone(this.id,...t),this}async APILoadVersion(e=L,t,...r){return await Le.repository.APILoadVersion(this.id,t,...r)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"remove-entity"))){const r=[],a=[],d=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(a.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(l=>{const{updated:u,removed:h,added:c}=l.entity.onDetachedDependencyRemoved(this,l.field,t);r.push(...u),a.push(...h),d.push(...c)}),this.properties.forEach(l=>{const{updated:u,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...u),a.push(...h)}),this.methods.forEach(l=>{const{updated:u,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...u),a.push(...h)}),this.abstractMethods.forEach(l=>{const{updated:u,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...u),a.push(...h)}),this.suggestedProperties.forEach(l=>{const{updated:u,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...u),a.push(...h)}),this.suggestedMethods.forEach(l=>{const{updated:u,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...u),a.push(...h)}),!e){if(this.parent.type===n.Project)this.parent.removeDefinitionEntity(this);else if(this.parent.type===n.DataType){const l=this.parent.setEntity(null);r.push(l)}}return t==null||t.attemptAutoclose("remove-entity",this.id),{added:p(d),updated:p(r),removed:p(a),affected:p(o),self:this}}restore({}={},e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"restore-entity"))){const t=[],r=[],a=[],d=[];return e!=null&&e.hasAdded(this.id)?(e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),this.properties.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.methods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.abstractMethods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.suggestedProperties.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.suggestedMethods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:p(t),updated:p(r),removed:p(a),affected:p(d),self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.extends.flatMap(r=>r.toFlat(e)),...this.implements.flatMap(r=>r.toFlat(e)),...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e)),...this.parent.toFlat(e)])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.extends.flatMap(r=>r.toFlatIds(e)),...this.implements.flatMap(r=>r.toFlatIds(e)),...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e)),...this.parent.toFlatIds(e)])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),implements:this.implements.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e)),parent:this.parent.toReference()})}toJSONClone(e=Z){var r,a,d,o,l;let t;return(r=e.seenEntityMaps)!=null&&r.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||ct(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(d=e.seenEntities)!=null&&d.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:I.UUID.uuid(),createdAt:e.timestamp||T().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(u=>u.toJSONClone({...e,newId:null})),methods:this.methods.map(u=>u.toJSONClone({...e,newId:null})),abstractMethods:this.abstractMethods.map(u=>u.toJSONClone({...e,newId:null})),implements:this.implements.map(u=>u.type===n.BuiltInBaseEntity?u.toJSON():u.toJSONClone({...e,newId:null})),extends:this.extends.map(u=>u.type===n.BuiltInBaseEntity?u.toJSON():u.toJSONClone({...e,newId:null})),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+I.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,name:this.name,description:this.description,type:this.type,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(a=>a.toReference(e)),methods:this.methods.map(a=>a.toReference(e)),abstractMethods:this.abstractMethods.map(a=>a.toReference(e)),implements:this.implements.map(a=>a.toReference(e)),extends:this.extends.map(a=>a.toReference(e)),parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.toFlatJSON(e)),...this.implements.flatMap(r=>r.toFlatJSON(e)),...this.extends.flatMap(r=>r.toFlatJSON(e)),...this.parent.toFlatJSON(e)])}toGenerationTarget(){const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,name:this.name,description:this.description,type:this.type,static:this.static,abstract:this.abstract,extends:this.extends.map(t=>t.id),implements:this.implements.map(t=>t.id),parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.implements.filter(r=>r.type===n.DefinitionEntity).flatMap(r=>r.toFlatGenerationTarget(e)),...this.implements.filter(r=>r.type===n.DefinitionEntity).flatMap(r=>r.toFlatGenerationTarget(e)),...this.parent.toFlatGenerationTarget(e)])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){return this.errors=U5(this),{success:!0,error:null,data:null}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"clone-entity")),t=null,r=null,a=!0){var w,C,U;let d=ft(t,this);const o=this.toJSON(),l=r||I.UUID.uuid();o.properties=[],o.methods=[],o.abstractMethods=[];const u=l.split("-id"),h=u[u.length-1||0]||l;o.id=l,o.version=I.UUID.uuid(),o.createdAt=(e==null?void 0:e.timestamp)||T().toISOString(),o.author=(e==null?void 0:e.author)||"1",o.previousVersion=null,o.deleted=!1;const c=lt(o,d);t&&c.setParent(t,null),a&&c.subscribe(),c.initChildren(e),e==null||e.add(c,b.Added);const v=(w=this.properties)==null?void 0:w.map(G=>G.clone(e,c,I.UUID.uuid(),a));c.properties=v;const E=(C=this.methods)==null?void 0:C.map((G,_)=>G.clone(e,c,h+"-method-"+_+"-id",a));c.methods=E;const O=(U=this.abstractMethods)==null?void 0:U.map((G,_)=>G.clone(e,c,h+"-abstract-method-"+_+"-id",a));return c.abstractMethods=O,e==null||e.attemptAutoclose("clone-entity",this.id),c}getFunctionDeclaration(e){return this.methods.find(t=>t.id===e)}implement(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"implement-definition-entity")),r){const a=xd(this,e,t,r);return t==null||t.attemptAutoclose("implement-definition-entity",this.id),a}getAllInteractiveMethods(){const e=this.implements.filter(r=>r.type===n.DefinitionEntity||r.type===n.BuiltInBaseEntity&&r.interactive);return p([...this.methods,...this.extends.flatMap(r=>r.getAllInteractiveMethods()),...e.flatMap(r=>r.getAllInteractiveMethods())])}inferFromInputs(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"infer-definition-entity-from-inputs"))){const r=[],a=[],d=[],o=[];if(this.parent.type!==n.DataType||!this.parent.inferred)return t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};const l=[];e.forEach(c=>{l.find(E=>F(E,this.project)===F(c,this.project))||l.push(c)});const u=this.properties.filter(c=>!c.dataType);l.forEach(c=>{var U,G;const v=u.find(_=>F(_,this.project)===F(c,this.project));if(!v)return;const O=Pn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),w=kr(O,t),C=w==null?void 0:w.clone(t,v,I.UUID.uuid(),!0);if(C){const _=(U=v.dataType)==null?void 0:U.merge(C,t);v.dataType&&(_==null?void 0:_.self.id)!==v.dataType.id&&v.dataType.remove({ignoreUpstream:!1},t),C.id!==((G=_==null?void 0:_.self)==null?void 0:G.id)&&C.remove({ignoreUpstream:!1},t),_!=null&&_.self&&(_.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(_.self,b.Added),v.setDataType(_.self),t==null||t.add(v,b.Updated))}c.setDeclaration(v),t==null||t.add(c,b.Updated)});const h=[];return l.forEach(c=>{if(!c.declaration){h.push(c);return}}),h.length===0?(t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(h.forEach(c=>{var _,$,k,J;const v=this.properties.find(ee=>F(ee,this.project)===F(c,this.project));if(v){if(c.setDeclaration(v),!v.getDataType(t)){const pe=Pn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),Te=kr(pe),K=Te==null?void 0:Te.clone(t,v,I.UUID.uuid(),!0);if(K){const se=(_=v.dataType)==null?void 0:_.merge(K,t);v.dataType&&(se==null?void 0:se.self.id)!==v.dataType.id&&v.dataType.remove({ignoreUpstream:!1},t),K.id!==(($=se==null?void 0:se.self)==null?void 0:$.id)&&K.remove({ignoreUpstream:!1},t),se!=null&&se.self&&(se.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(se.self,b.Added),v.setDataType(se.self),t==null||t.add(v,b.Updated))}}return}const E={id:I.UUID.uuid(),type:n.Property,version:I.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||T().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,name:F(c,this.project),description:c.description,defaultValue:null,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,constant:!0,index:c.index,implements:null,dataType:null,parent:this.toReference()},O=V(E,this.project);O.setParent(this,t),O.initChildren(t),t==null||t.add(O,b.Added);const C=Pn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),U=kr(C),G=U==null?void 0:U.clone(t,O,I.UUID.uuid(),!0);if(G){const ee=(k=O.dataType)==null?void 0:k.merge(G,t);O.dataType&&(ee==null?void 0:ee.self.id)!==O.dataType.id&&O.dataType.remove({ignoreUpstream:!1},t),G.id!==((J=ee==null?void 0:ee.self)==null?void 0:J.id)&&G.remove({ignoreUpstream:!1},t),ee!=null&&ee.self&&(ee.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(ee.self,b.Added),O.setDataType(ee.self),t==null||t.add(O,b.Updated))}return this.addProperty(O),c.setDeclaration(O),t==null||t.add(c,b.Updated),O}),t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:p(r),updated:p(a),removed:p(d),affected:p(o),self:this})}};f(Le,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...r)=>null}),f(Le,"type",n.DefinitionEntity),f(Le,"USER_MANAGED_PARENT_TYPES",[n.Project,n.DataType]),f(Le,"PARENT_TYPES",[...Le.USER_MANAGED_PARENT_TYPES]),f(Le,"MUTABLE_BASE_PROPERTIES",["name","description","static","abstract"]),f(Le,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(Le,"BASE_PROPERTIES",[...Le.MUTABLE_BASE_PROPERTIES,...Le.INMUTABLE_BASE_PROPERTIES]),f(Le,"MUTABLE_META_PROPERTIES",[...Le.MUTABLE_BASE_PROPERTIES,"x","y"]),f(Le,"INMUTABLE_META_PROPERTIES",[...Le.INMUTABLE_BASE_PROPERTIES]),f(Le,"META_PROPERTIES",[...Le.MUTABLE_META_PROPERTIES,...Le.INMUTABLE_META_PROPERTIES]),f(Le,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),f(Le,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),f(Le,"UPSTREAM_PROPERTIES",[...Le.MUTABLE_UPSTREAM_PROPERTIES,...Le.INMUTABLE_UPSTREAM_PROPERTIES]),f(Le,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),f(Le,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(Le,"DOWNSTREAM_PROPERTIES",[...Le.MUTABLE_DOWNSTREAM_PROPERTIES,...Le.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(Le,"PROPERTIES",[...Le.META_PROPERTIES,...Le.UPSTREAM_PROPERTIES,...Le.DOWNSTREAM_PROPERTIES]);let Yi=Le;function pJ(i){const s=y6(),e=i.toJSON();s.safeParse(e).success;const r=[];return ze(i.errors,r)}const Ls=class Ls extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"version");f(this,"name");f(this,"description",null);f(this,"type",n.BuiltInBaseEntity);f(this,"abstract",!1);f(this,"static");f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"interactive",!1);f(this,"errors",[]);f(this,"project");this.initialData=this.initialData||e,this.project=this.project||t,this.id=this.id||e.id,this.version=this.version||e.version,this.name=this.name||e.name,this.static=this.static||e.static,this.interactive=this.interactive||e.interactive,this.abstract=e.abstract,this.properties=this.initialData.properties.map(r=>{const a=V(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=V(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=V(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.extends=this.initialData.extends.map(r=>V(r,this.project))}get allBasePropertiesFromExtendedAndImplementedEntities(){return p(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract);return[...e,...r]},[]))}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[])])}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(e=L,...t){return await Ls.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e)),...this.extends.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e)),...this.extends.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e))})}toReference(e=Z){return{id:this.id+"--"+I.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=Z){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(t=>t.toReference()),methods:this.methods.map(t=>t.toReference()),abstractMethods:this.abstractMethods.map(t=>t.toReference()),extends:this.extends.map(t=>t.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,interactive:this.interactive,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=pJ(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}implement(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),null,!0,"implement-built-in-base-entity")),r){const a=xd(this,e,t,r);return t==null||t.attemptAutoclose("implement-built-in-base-entity",this.id),a}getAllInteractiveMethods(){const e=[];return this.interactive&&(e.push(...this.methods),this.extends.filter(r=>r.type===n.BuiltInBaseEntity&&r.interactive||r.type===n.PrimitiveEntity).forEach(r=>{r instanceof Ls&&e.push(...r.getAllInteractiveMethods())})),p(e)}};f(Ls,"repository",{APILoad:async(e,...t)=>null});let zr=Ls;function cJ(i){const s=a6(),e=i.toJSON();s.safeParse(e).success;const r=[];return ze(i.errors,r)}const rl=class rl extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"name");f(this,"description",null);f(this,"type",n.PrimitiveEntity);f(this,"static");f(this,"abstract");f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"errors",[]);f(this,"project");this.initialData=e,this.project=t,this.id=e.id,this.name=e.name,this.static=e.static,this.abstract=e.abstract,this.properties=this.initialData.properties.map(r=>{const a=V(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=V(r,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=V(r,this.project);return a.parent=this,a})}get allBasePropertiesFromExtendedAndImplementedEntities(){return p(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract);return[...e,...r]},[]))}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[])])}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(e=L,...t){return await rl.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e))})}toReference(e=Z){return{id:this.id+"--"+I.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=Z){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,properties:this.properties.map(t=>t.toReference()),methods:this.methods.map(t=>t.toReference()),abstractMethods:this.abstractMethods.map(t=>t.toReference()),extends:this.extends.map(t=>t.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=cJ(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}getAllInteractiveMethods(){const e=[];return e.push(...this.methods),this.extends.filter(r=>r.type===n.BuiltInBaseEntity&&r.interactive||r.type===n.PrimitiveEntity).forEach(r=>{r instanceof zr&&e.push(...r.getAllInteractiveMethods())}),p(e)}};f(rl,"repository",{APILoad:async(e,...t)=>null});let ar=rl;function lt(i,s){if(!i)throw new Error("Entity is null");const e=s.get(i.id);switch(i.type){case n.LiteralValue:return e||new _n(i,s);case n.DefinitionEntity:return e||new Yi(i,s);case n.PrimitiveEntity:return e||new ar(i,s);case n.FunctionDeclaration:return e||new Mi(i,s);case n.GlobalEvent:return e||new Vn(i,s);case n.DataType:return e||new wn(i,s);case n.Property:return e||new Bi(i,s);case n.FunctionCall:return e||new qi(i,s);case n.Condition:return e||new Li(i,s);case n.Operation:return e||new gi(i,s);case n.VariableDeclaration:return e||new $i(i,s);case n.VariableInstance:return e||new Ui(i,s);case n.OutputMap:return e||new qr(i,s);case n.ReturnDeclaration:return e||new rr(i,s);case n.ArgumentDeclaration:return e||new Fi(i,s);case n.InputMap:return e||new Zr(i,s);case n.Project:return e||new I(i);case n.InstalledProject:return e||new Gi(i,s);case n.ActionDescriptor:return e||new qe(i,s);case n.ReturnStatement:return e||new _i(i,s);case n.Loop:return e||new Ni(i,s);case n.Search:return e||new ji(i,s);case n.ValueDescriptor:return e||new xi(i,s);case n.BuiltInBaseEntity:return e||new zr(i,s);case n.InternalCall:return e||new Bn(i,s);case n.ContinueStatement:return e||new jt(i,s);case n.BreakStatement:return e||new Cn(i,s);case n.GenericReference:return s.get(i.entityId);default:throw new Error("Invalid entity type: "+i.type)}}function V(i,s){if(!i)throw new Error("Entity is null");const e=lt(i,s);return e.subscribe(),e}function fJ(i,s){if(!i)throw new Error("Entity is null");switch(i.type){case n.LiteralValue:return _n.fromGenerationTarget(i,s);case n.DefinitionEntity:return Yi.fromGenerationTarget(i,s);case n.FunctionDeclaration:return Mi.fromGenerationTarget(i,s);case n.GlobalEvent:return Vn.fromGenerationTarget(i,s);case n.DataType:return wn.fromGenerationTarget(i,s);case n.Property:return Bi.fromGenerationTarget(i,s);case n.FunctionCall:return qi.fromGenerationTarget(i,s);case n.Condition:return Li.fromGenerationTarget(i,s);case n.Operation:return gi.fromGenerationTarget(i,s);case n.VariableDeclaration:return $i.fromGenerationTarget(i,s);case n.VariableInstance:return Ui.fromGenerationTarget(i,s);case n.OutputMap:return qr.fromGenerationTarget(i,s);case n.ReturnDeclaration:return rr.fromGenerationTarget(i,s);case n.ArgumentDeclaration:return Fi.fromGenerationTarget(i,s);case n.InputMap:return Zr.fromGenerationTarget(i,s);case n.InstalledProject:return Gi.fromGenerationTarget(i,s);case n.ReturnStatement:return _i.fromGenerationTarget(i,s);case n.Loop:return Ni.fromGenerationTarget(i,s);case n.Search:return ji.fromGenerationTarget(i,s);case n.ActionDescriptor:return qe.fromGenerationTarget(i,s);case n.ValueDescriptor:return xi.fromGenerationTarget(i,s);case n.InternalCall:return Bn.fromGenerationTarget(i,s);case n.ContinueStatement:return jt.fromGenerationTarget(i,s);case n.BreakStatement:return Cn.fromGenerationTarget(i,s);default:throw new Error("Invalid entity type: "+i.type)}}const Z={seenEntityMaps:new Map,seenEntities:new Set,timestamp:T().toISOString()};class PP{constructor(){f(this,"initialData")}}const L={cascade:!1},wP={APILoad:async(i,...s)=>null},yJ={APICreate:async(i,...s)=>i,APIUpdate:async(i,...s)=>i,APIDelete:async(i,...s)=>i,APIClone:async(i,...s)=>{},APILoadVersion:async(i,s,...e)=>null,...wP};class hJ{}class mJ extends PP{}class vJ{}class TJ{}class EJ{}class Hc{}class IJ extends Hc{}class AJ extends Hc{}class bJ{}class yi{static initReadsValue(s){if(s.initialData.readsValue&&s.initialData.readsValue.type!==n.GenericReference)s.readsValue=V(s.initialData.readsValue,s.project);else if(s.initialData.readsValue&&s.initialData.readsValue.type===n.GenericReference){const e=nr(s.initialData.readsValue,s.project);e&&(s.readsValue=e)}if(s.readsValue){if(Qe.includes(s.readsValue.type)){let e=s.parent;mt.includes(e.type)||(e=e.parent);const t=s.type===n.InputMap&&s.parent.type===n.Loop;t&&(e=s.parent.parent),s.readsValue.setParent(e,null),s.readsValue.initChildren(null),!t&&e.detachedChildren.includes(s)?e.replaceDetachedChild(s,s.readsValue):t||e.subscribeDetachedChild(s.readsValue)}s.readsValue.addValueReader(s)}return s.readsValue}static hydrateReadsValue(s){if(s.initialData.readsValue&&s.initialData.readsValue.type!==n.GenericReference)s.readsValue=V(s.initialData.readsValue,s.project);else if(s.initialData.readsValue&&s.initialData.readsValue.type===n.GenericReference){const e=nr(s.initialData.readsValue,s.project);e&&(s.readsValue=e)}if(s.readsValue){if(Qe.includes(s.readsValue.type)){let e=s.parent;mt.includes(e.type)||(e=e.parent);const t=s.type===n.InputMap&&s.parent.type===n.Loop;t&&(e=s.parent.parent),s.readsValue.setParent(e,null),!t&&e.detachedChildren.includes(s)?e.replaceDetachedChild(s,s.readsValue):t||e.subscribeDetachedChild(s.readsValue)}s.readsValue.addValueReader(s)}return s.readsValue}}class gs{static initWritesValues(s,e){const t=s.initialData.writesValues.reduce((a,d)=>{if(d.type===n.GenericReference||s.writesValues.some(l=>l.id===d.id))return a;const o=V(d,s.project);return o.setValueWriter(s),Qe.includes(o.type)&&(o.setParent(e,null),o.initChildren(null)),[...a,o]},[]),r=[...s.writesValues];return s.writesValues=p([...r,...t]),s.writesValues}}class RJ{}const oe=class oe extends rt{constructor(e){super(e);f(this,"initialData");f(this,"id");f(this,"type",n.Project);f(this,"name",null);f(this,"description",null);f(this,"x");f(this,"y");f(this,"entities",[]);f(this,"projects",[]);f(this,"functions",[]);f(this,"events",[]);f(this,"variableDeclarations",[]);f(this,"variableInstances",[]);f(this,"conditions",[]);f(this,"operations",[]);f(this,"functionCalls",[]);f(this,"loops",[]);f(this,"searches",[]);f(this,"primitives",[]);f(this,"builtInBaseEntities",[]);f(this,"operationDeclarations",[]);f(this,"globalEventActionDescriptors",[]);f(this,"loopDeclarations",[]);f(this,"loopDeclarationsBodies",[]);f(this,"conditionDeclarations",[]);f(this,"valueDescriptors",[]);f(this,"dataTypes",[]);f(this,"project");f(this,"instances",{});f(this,"builtInInstances",{});f(this,"deletedInstances",{});f(this,"errors",[]);f(this,"references",[]);f(this,"history",[]);f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"onCloseChangeSetCallback",null);this.initialData=e,this.id=e.id,this.name=e.name,this.description=e.description,this.x=0,this.y=0,this.instances[this.id]=this;try{(!oe.UUID||oe.UUID.isBackup)&&(oe.UUID=Uo==null?void 0:Uo()),oe.UUID||(oe.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:t=>t})}catch(t){console.error("Error initializing UUID module",t),oe.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:r=>r}}}static injectUUIDModule(e){oe.UUID=e}static validateGenerationTarget(e,t){let r=JSON.parse(JSON.stringify(e));const a=[];return a.push(...ot(r)),{errors:a,modifiedData:r}}async closePendingCallbacks(){for(let e=0;e<this.history.length;e++){const t=this.history[e];t.dirty&&await this.closeChangeSet(t)}}async onCloseChangeSet(e){this.onCloseChangeSetCallback=e,await this.closePendingCallbacks()}async closeChangeSet(e){if(this.onCloseChangeSetCallback){const t=await this.onCloseChangeSetCallback(e);return t.success&&(e.dirty=!1),t}return{success:!1}}addChangeSet(e){if(!this.history.length)return this.history.push(e),e;const t=this.history.find(a=>a.id===(e==null?void 0:e.id));if(t)return t;const r=this.history.findIndex(a=>T(a.timestamp).isBefore(T(e==null?void 0:e.timestamp)));return r===-1?this.history.push(e):this.history.splice(r,0,e),e}discardChangeSet(e){const t=this.history.findIndex(r=>r.id===(e==null?void 0:e.id));return t!==-1&&this.history.splice(t,1),this}undo(){const e=[],t=[],r=[],a=[];return{updated:p(e),added:p(t),removed:p(r),affected:p(a),self:this}}redo(){const e=[],t=[],r=[],a=[];return{updated:p(e),added:p(t),removed:p(r),affected:p(a),self:this}}async inject(...e){return await Promise.all(e.map(t=>new Promise(async r=>{await t.init(this),r(null)}))),this}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(){const e=[],t=[],r=[],a=[];return Object.values(this.detachedDependents).forEach(d=>{const o=d.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),r.push(...o.removed),a.push(...o.affected)}),{updated:p(e),added:p(t),removed:p(r),affected:p(a),self:this}}onDetachedDependencyRemoved(e,t,r){const a=[],d=[],o=[],l=[];return{updated:p(a),added:p(d),removed:p(o),affected:p(l),self:this}}onDetachedDependencyRestored(e,t,r){const a=[],d=[],o=[],l=[];return{updated:p(a),added:p(d),removed:p(o),affected:p(l),self:this}}subscribeToDependencies(){return this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=oe.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t,r;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new oe(this);return(r=this.knownVersions)==null||r.set(this.version,e),e.entities=this.entities,e.projects=this.projects,e.functions=this.functions,e.events=this.events,e.variableDeclarations=this.variableDeclarations,e.variableInstances=this.variableInstances,e.conditions=this.conditions,e.operations=this.operations,e.functionCalls=this.functionCalls,e.loops=this.loops,e.searches=this.searches,this}recursiveCaptureUpstreamVersions(e){const t=[],r=[],a=[],d=[];return{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}async restoreVersion(e){var l;const t=[],r=[],a=[],d=[];if(this.version===e)return{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this};if(!this.knownVersions){const u=new Map;for(const[h,c]of this.knownVersions||new Map){if(u.set(h,c),c.activeVersion=!1,c.knownVersions)for(const[v,E]of c.knownVersions)u.set(v,E);c.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new oe(u)}return this.metaSync(o.toShallowJSON(),null),this.entities=o.entities,this.projects=o.projects,this.functions=o.functions,this.events=o.events,this.variableDeclarations=o.variableDeclarations,this.variableInstances=o.variableInstances,this.conditions=o.conditions,this.operations=o.operations,this.functionCalls=o.functionCalls,this.loops=o.loops,this.searches=o.searches,{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}hydrateAncestors(){const e=[],t=[],r=[],a=[];return{updated:p(e),added:p(t),removed:p(r),affected:p(a),self:this}}afterAllChildrenInitialized(e=null){const t=[],r=[],a=[],d=[];return this.initialized=!0,this.captureVersion(),this.validate(),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}addSelfToProject(e){const t=[],r=[],a=[],d=[];return this.subscribe(),this.subscribeToDependencies(),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}get instancesList(){return Object.values(this.instances)}isOperationDeclaration(e){return this.operationDeclarations.includes(e)}isGlobalEventActionDescriptor(e){return this.globalEventActionDescriptors.includes(e)}isLoopDeclaration(e){return this.loopDeclarations.includes(e)}isConditionDeclaration(e){return this.conditionDeclarations.includes(e)}initChildren(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.entities=this.initialData.entities.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.projects=this.initialData.projects.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.variableDeclarations=this.initialData.variableDeclarations.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.variableInstances=this.initialData.variableInstances.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.conditions=this.initialData.conditions.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.operations=this.initialData.operations.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.functions=this.initialData.functions.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.events=this.initialData.events.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.functionCalls=this.initialData.functionCalls.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.loops=this.initialData.loops.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.searches=this.initialData.searches.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.attachOrphanReferences(),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}subscribeInstance(e){return(!this.instances[e.id]||this.instances[e.id]!==e)&&(this.instances[e.id]=e),this}subscribeDeletedInstance(e){return(!this.deletedInstances[e.id]||this.deletedInstances[e.id]!==e)&&(this.deletedInstances[e.id]=e),this}subscribeBuiltInInstance(e){return(!this.builtInInstances[e.id]||this.builtInInstances[e.id]!==e)&&(this.builtInInstances[e.id]=e),this}subscribe(){return this}unsubscribe(){return this}unsubscribeInstance(e){return delete this.instances[e.id],this}unsubscribeDeletedInstance(e){return delete this.deletedInstances[e.id],this}findSubscribedBuiltInInstance(e){return this.builtInInstances[e.id]||null}get(e){return this.instances[e]||this.builtInInstances[e]||null}getDeleted(e){return this.deletedInstances[e]||null}getManaged(e){return this.getBuiltIn(e)?null:this.instances[e]||null}getBuiltIn(e){return this.builtInInstances[e]||null}findSubscribedInstanceFromReference(e){return this.instances[e.entityId]||null}findSubscribedBuiltInInstanceFromReference(e){return this.builtInInstances[e.entityId]||null}metaSync(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-meta"))){const r=dt(this,e);return e.deleted===!0&&!this.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&this.deleted?t==null||t.add(this,b.Added):r&&(t==null||t.add(this,b.Updated)),super.metaSync(e),this.name=e.name||this.name,this.description=e.description||this.description,this.x=e.x||this.x,this.y=e.y||this.y,t==null||t.attemptAutoclose("sync-meta",this.id),this}async APILoad(e=L,...t){return await oe.repository.APILoad(this.id,...t),this}async APICreate(e=L,...t){return await oe.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=L,...t){return await oe.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=L,...t){return await oe.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=L,...t){return await oe.repository.APIClone(this.id,...t),this}async APILoadVersion(e=L,t,...r){return await oe.repository.APILoadVersion(this.id,t,...r)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"remove-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}restore({}={},e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"restore-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}getAllBuiltInIds(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlatIds(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlatIds(e)),...this.operationDeclarations.flatMap(t=>t.toFlatIds(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlatIds(e)),...this.loopDeclarations.flatMap(t=>t.toFlatIds(e)),...this.conditionDeclarations.flatMap(t=>t.toFlatIds(e)),...this.valueDescriptors.flatMap(t=>t.toFlatIds(e)),...this.dataTypes.flatMap(t=>t.toFlatIds(e))]}getAllBuiltIn(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlat(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlat(e)),...this.operationDeclarations.flatMap(t=>t.toFlat(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlat(e)),...this.loopDeclarations.flatMap(t=>t.toFlat(e)),...this.conditionDeclarations.flatMap(t=>t.toFlat(e)),...this.valueDescriptors.flatMap(t=>t.toFlat(e)),...this.dataTypes.flatMap(t=>t.toFlat(e))]}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.entities.flatMap(r=>r.toFlat(e)),...this.functions.flatMap(r=>r.toFlat(e)),...this.events.flatMap(r=>r.toFlat(e)),...this.projects.flatMap(r=>r.toFlat(e)),...this.variableDeclarations.flatMap(r=>r.toFlat(e)),...this.variableInstances.flatMap(r=>r.toFlat(e)),...this.conditions.flatMap(r=>r.toFlat(e)),...this.operations.flatMap(r=>r.toFlat(e)),...this.functionCalls.flatMap(r=>r.toFlat(e)),...this.loops.flatMap(r=>r.toFlat(e)),...this.searches.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.entities.flatMap(r=>r.toFlatIds(e)),...this.functions.flatMap(r=>r.toFlatIds(e)),...this.events.flatMap(r=>r.toFlatIds(e)),...this.projects.flatMap(r=>r.toFlatIds(e)),...this.variableDeclarations.flatMap(r=>r.toFlatIds(e)),...this.variableInstances.flatMap(r=>r.toFlatIds(e)),...this.conditions.flatMap(r=>r.toFlatIds(e)),...this.operations.flatMap(r=>r.toFlatIds(e)),...this.functionCalls.flatMap(r=>r.toFlatIds(e)),...this.loops.flatMap(r=>r.toFlatIds(e)),...this.searches.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(t=>t.toJSON(e)),variableDeclarations:this.variableDeclarations.map(t=>t.toJSON(e)),variableInstances:this.variableInstances.map(t=>t.toJSON(e)),conditions:this.conditions.map(t=>t.toJSON(e)),operations:this.operations.map(t=>t.toJSON(e)),loops:this.loops.map(t=>t.toJSON(e)),searches:this.searches.map(t=>t.toJSON(e)),functions:this.functions.map(t=>t.toJSON(e)),events:this.events.map(t=>t.toJSON(e)),projects:this.projects.map(t=>t.toJSON(e)),functionCalls:this.functionCalls.map(t=>t.toJSON(e))})}toJSONClone(e={uuidStrategy:"uuid"}){const t=new Map,r=new Set,a=this.getAllBuiltInIds();return Object.keys(this.instances).forEach(d=>{if(a.includes(d)){t.set(d,d);return}t.set(d,oe.UUID.uuid())}),r.add(this.id),{id:t.get(this.id),version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),projects:this.projects.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),variableDeclarations:this.variableDeclarations.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),variableInstances:this.variableInstances.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),conditions:this.conditions.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),operations:this.operations.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),functions:this.functions.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),events:this.events.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),functionCalls:this.functionCalls.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),loops:this.loops.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),searches:this.searches.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null}))}}toReference(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+oe.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(a=>a.toReference(e)),functions:this.functions.map(a=>a.toReference(e)),events:this.events.map(a=>a.toReference(e)),projects:this.projects.map(a=>a.toReference(e)),variableDeclarations:this.variableDeclarations.map(a=>a.toReference(e)),variableInstances:this.variableInstances.map(a=>a.toReference(e)),conditions:this.conditions.map(a=>a.toReference(e)),operations:this.operations.map(a=>a.toReference(e)),functionCalls:this.functionCalls.map(a=>a.toReference(e)),loops:this.loops.map(a=>a.toReference(e)),searches:this.searches.map(a=>a.toReference(e))}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.entities.flatMap(r=>r.toFlatJSON(e)),...this.functions.flatMap(r=>r.toFlatJSON(e)),...this.events.flatMap(r=>r.toFlatJSON(e)),...this.projects.flatMap(r=>r.toFlatJSON(e)),...this.variableDeclarations.flatMap(r=>r.toFlatJSON(e)),...this.variableInstances.flatMap(r=>r.toFlatJSON(e)),...this.conditions.flatMap(r=>r.toFlatJSON(e)),...this.operations.flatMap(r=>r.toFlatJSON(e)),...this.functionCalls.flatMap(r=>r.toFlatJSON(e)),...this.loops.flatMap(r=>r.toFlatJSON(e)),...this.searches.flatMap(r=>r.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[...this.entities.flatMap(r=>r.toFlatGenerationTarget(e)),...this.functions.flatMap(r=>r.toFlatGenerationTarget(e)),...this.events.flatMap(r=>r.toFlatGenerationTarget(e)),...this.projects.flatMap(r=>r.toFlatGenerationTarget(e)),...this.variableDeclarations.flatMap(r=>r.toFlatGenerationTarget(e)),...this.variableInstances.flatMap(r=>r.toFlatGenerationTarget(e)),...this.conditions.flatMap(r=>r.toFlatGenerationTarget(e)),...this.operations.flatMap(r=>r.toFlatGenerationTarget(e)),...this.functionCalls.flatMap(r=>r.toFlatGenerationTarget(e)),...this.loops.flatMap(r=>r.toFlatGenerationTarget(e)),...this.searches.flatMap(r=>r.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.entities.forEach(e=>e.clearErrors()),this.projects.forEach(e=>e.clearErrors()),this.functions.forEach(e=>e.clearErrors()),this.events.forEach(e=>e.clearErrors()),this.variableDeclarations.forEach(e=>e.clearErrors()),this.variableInstances.forEach(e=>e.clearErrors()),this.conditions.forEach(e=>e.clearErrors()),this.operations.forEach(e=>e.clearErrors()),this.functionCalls.forEach(e=>e.clearErrors()),this.loops.forEach(e=>e.clearErrors()),this.searches.forEach(e=>e.clearErrors()),this}validate(){const e=B5(),t=this.toJSON();return e.safeParse(t),this.validateChildren(),{success:!0,error:null,data:t}}validateChildren(){this.entities.forEach(e=>e.validate()),this.projects.forEach(e=>e.validate()),this.functions.forEach(e=>e.validate()),this.events.forEach(e=>e.validate()),this.variableDeclarations.forEach(e=>e.validate()),this.variableInstances.forEach(e=>e.validate()),this.conditions.forEach(e=>e.validate()),this.operations.forEach(e=>e.validate()),this.functionCalls.forEach(e=>e.validate()),this.loops.forEach(e=>e.validate()),this.searches.forEach(e=>e.validate())}getErrors(){return[...this.errors,...this.entities.flatMap(t=>t.getErrors()),...this.projects.flatMap(t=>t.getErrors()),...this.functions.flatMap(t=>t.getErrors()),...this.events.flatMap(t=>t.getErrors()),...this.variableDeclarations.flatMap(t=>t.getErrors()),...this.variableInstances.flatMap(t=>t.getErrors()),...this.conditions.flatMap(t=>t.getErrors()),...this.operations.flatMap(t=>t.getErrors()),...this.functionCalls.flatMap(t=>t.getErrors()),...this.loops.flatMap(t=>t.getErrors()),...this.searches.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(){return this}getDefinitionEntity(e){return this.entities.find(t=>t.id===e)||null}addDefinitionEntityFromTransfer(e){const t=V(e,this);return this.addDefinitionEntity(t),t}addDefinitionEntity(e){return this.entities.includes(e)||this.entities.push(e),e}addFunctionDeclarationFromTransfer(e){const t=V(e,this);return this.addFunctionDeclaration(t),t}addFunctionDeclaration(e){return this.functions.includes(e)||this.functions.push(e),e}addFunctionCallFromTransfer(e){const t=V(e,this);return this.addFunctionCall(t),t}addFunctionCall(e){return this.functionCalls.includes(e)||this.functionCalls.push(e),e}addVariableDeclarationFromTransfer(e){const t=V(e,this);return this.addVariableDeclaration(t),t}addVariableDeclaration(e){return this.variableDeclarations.includes(e)||this.variableDeclarations.push(e),e}addVariableInstanceFromTransfer(e){const t=V(e,this);return this.addVariableInstance(t),t}addVariableInstance(e){return this.variableInstances.includes(e)||this.variableInstances.push(e),e}addInstalledProjectFromTransfer(e){const t=V(e,this);return this.addInstalledProject(t),this}addInstalledProject(e){return this.projects.includes(e)||this.projects.push(e),this}addGlobalEventFromTransfer(e){const t=V(e,this);return this.addGlobalEvent(t),this}addGlobalEvent(e){return this.events.includes(e)||this.events.push(e),this}addConditionFromTransfer(e){const t=V(e,this);return this.addCondition(t),this}addCondition(e){return this.conditions.includes(e)||this.conditions.push(e),this}addOperationFromTransfer(e){const t=V(e,this);return this.addOperation(t),this}addOperation(e){return this.operations.includes(e)||this.operations.push(e),this}addLoopFromTransfer(e){const t=V(e,this);return this.addLoop(t),this}addLoop(e){return this.loops.includes(e)||this.loops.push(e),this}addSearchFromTransfer(e){const t=V(e,this);return this.addSearch(t),this}addSearch(e){return this.searches.includes(e)||this.searches.push(e),this}removeDefinitionEntity(e){const t=this.entities.findIndex(r=>r.id===e.id);if(t>-1){const r=this.entities[t];return this.entities.splice(t,1),r}return null}removeFunctionDeclaration(e){const t=this.functions.findIndex(r=>r.id===e.id);if(t>-1){const r=this.functions[t];return this.functions.splice(t,1),r}return null}removeExternalProject(e){const t=this.projects.findIndex(r=>r.id===e.id);if(t>-1){const r=this.projects[t];return this.projects.splice(t,1),r}return null}removeGlobalEvent(e){const t=this.events.findIndex(r=>r.id===e.id);if(t>-1){const r=this.events[t];return this.events.splice(t,1),r}return null}removeTopLevelVariableDeclaration(e){if(e.type!==n.VariableDeclaration)return null;const t=this.variableDeclarations.findIndex(r=>r.id===e.id);if(t>-1){const r=this.variableDeclarations[t];return this.variableDeclarations.splice(t,1),r}return null}getEntryPoints(){return[...this.functions,...this.events,...this.entities.flatMap(t=>t.methods)]}getFunctionDeclaration(e){return this.functions.find(t=>t.id===e)||null}getConditions(){return[...this.conditions,...this.getEntryPoints().reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.functionCalls.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.operations.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.functionCalls.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.conditions.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.conditions.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.operations.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.functionCalls.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.conditions.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.operations.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.loops.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.searches.reduce((t,r)=>{const a=We(r);return[...t,...a]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.functionCalls.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.conditions.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.operations.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.loops.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.searches.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[])]}getVariableDeclarations(){return p([...this.variableDeclarations,...this.getEntryPoints().reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.functionCalls.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.conditions.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.operations.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.loops.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.searches.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[])])}attachOrphanReferences(){const e=this.getVariableInstances(),t=this.getVariableDeclarations();return e.forEach(r=>{if(!r.declaration){const a=r.initialData,d=a.declaration.entityId||a.declaration.id,o=t.find(l=>l.id===d);o&&r.setDeclaration(o)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(e=>e.name===Y.PERSISTED_ENTITY)||null}};f(oe,"sessionAuthor","1"),f(oe,"UUID",{isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:e=>e}),f(oe,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...r)=>null}),f(oe,"type",n.Project),f(oe,"USER_MANAGED_PARENT_TYPES",[]),f(oe,"PARENT_TYPES",[...oe.USER_MANAGED_PARENT_TYPES]),f(oe,"MUTABLE_BASE_PROPERTIES",["name","description"]),f(oe,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(oe,"BASE_PROPERTIES",[...oe.MUTABLE_BASE_PROPERTIES,...oe.INMUTABLE_BASE_PROPERTIES]),f(oe,"MUTABLE_META_PROPERTIES",[...oe.MUTABLE_BASE_PROPERTIES,"x","y"]),f(oe,"INMUTABLE_META_PROPERTIES",[...oe.INMUTABLE_BASE_PROPERTIES]),f(oe,"META_PROPERTIES",[...oe.MUTABLE_META_PROPERTIES,...oe.INMUTABLE_META_PROPERTIES]),f(oe,"MUTABLE_UPSTREAM_PROPERTIES",[]),f(oe,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),f(oe,"UPSTREAM_PROPERTIES",[...oe.MUTABLE_UPSTREAM_PROPERTIES,...oe.INMUTABLE_UPSTREAM_PROPERTIES]),f(oe,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),f(oe,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(oe,"DOWNSTREAM_PROPERTIES",[...oe.MUTABLE_DOWNSTREAM_PROPERTIES,...oe.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(oe,"PROPERTIES",[...oe.META_PROPERTIES,...oe.UPSTREAM_PROPERTIES,...oe.DOWNSTREAM_PROPERTIES]);let I=oe;var VP=(i=>(i.PersistChangeSet="persist-change-set",i.CreateSingle="create-single",i.CreateBulk="create-bulk",i.CreateSingleNested="create-single-nested",i.CreateBulkNested="create-bulk-nested",i.Update="update",i.Clone="clone",i.Delete="delete",i.Load="load",i.LoadNested="load-nested",i.LoadVersion="load-version",i))(VP||{});class CP extends qe{constructor(e){super(br,e);f(this,"id",He.Parallel);f(this,"name",He.Parallel);f(this,"description","Execute a list of actions one after the other");f(this,"version","1");f(this,"autoexecutable",!0);f(this,"initialData",br);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=br.inputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=br.outputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=br.error?V(br.error,this.project):null}}class BP extends qe{constructor(e){super(Ft,e);f(this,"id",Ft.id);f(this,"name",Ft.name);f(this,"description",Ft.description);f(this,"version",Ft.version);f(this,"autoexecutable",!1);f(this,"initialData",Ft);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=Ft.inputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=Ft.outputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=Ft.error?V(Ft.error,this.project):null}}class _P extends qe{constructor(e){super(ti,e);f(this,"id",He.Sequential);f(this,"name",He.Sequential);f(this,"description","Execute a list of actions one after the other");f(this,"version","1");f(this,"autoexecutable",!0);f(this,"initialData",ti);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=ti.inputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=ti.outputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=ti.error?V(ti.error,this.project):null}}class DJ extends qe{constructor(s){super(wa,s)}}class OJ extends qe{constructor(s){super(Xi,s)}}class PJ extends qe{constructor(e){super(Qi,e);f(this,"autoexecutable",!0)}getEntityToMatchInputMap(e){return e.inputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===x.operation[Ke.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(e){return e.inputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===x.operation[Ke.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(e){return e.outputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===x.operation[Ke.Validate].outputs.outputEntity.id})||null}getEntityToMatch(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"get-entity-to-match-validate-data"))){let r=null;if(e.readsValue){const d=e.readsValue.getDataType(t);d&&d.entity&&d.entity.type===n.DefinitionEntity&&(r=d.entity)}const a=e.getDefaultValue();return!r&&a&&a.valueAsTypeSingle&&!Array.isArray(a.valueAsTypeSingle)&&a.valueAsTypeSingle.type===n.DefinitionEntity&&(r=a.valueAsTypeSingle),r}syncOperationInstance(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-operation-instance-validate-data"))){const r=[],a=[],d=[],o=[],l=this.getEntityToMatchInputMap(e);if(l){const{added:c,updated:v,removed:E,affected:O}=this.syncEntityToMatchInputMapDataType(l,t);r.push(...v),a.push(...c),d.push(...E),o.push(...O)}const u=this.getDataToValidateInputMap(e);if(u){const{added:c,updated:v,removed:E,affected:O}=this.syncDataToValidateInputMapDataType(u,t);r.push(...v),a.push(...c),d.push(...E),o.push(...O)}const h=this.getOutputDataOutputMap(e);if(h){const{added:c,updated:v,removed:E,affected:O}=this.syncOutputDataOutputMapDataType(h,t);r.push(...v),a.push(...c),d.push(...E),o.push(...O)}return t==null||t.attemptAutoclose("sync-operation-instance-validate-data",this.id),{updated:p(r),added:p(a),removed:p(d),affected:p(o),self:e}}syncEntityToMatchInputMapDataType(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-entity-to-match-input-map-data-type"))){var u,h,c;const r=[],a=[],d=[],o=[];if(((u=e.declaration)==null?void 0:u.id)!==x.operation[Ke.Validate].inputs.entityToMatch.id)return t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const v={id:I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:null,like:!0,inferred:!0,parent:e.toReference()},E=V(v,e.project);E.setParent(e,t),E.initChildren(t),t==null||t.add(E,b.Added),r.push(E),e.setDataType(E)}(h=e.dataType)==null||h.metaSync({inferred:!0,like:!1,asType:!0},t);const l=this.getEntityToMatch(e,t);return(c=e.dataType)==null||c.setEntity(l),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:p(a),added:p(r),removed:p(d),affected:p(o),self:e.dataType}}syncDataToValidateInputMapDataType(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-data-to-validate-input-map-data-type"))){var c,v,E;const r=[],a=[],d=[],o=[];if(((c=e.declaration)==null?void 0:c.id)!==x.operation[Ke.Validate].inputs.dataToValidate.id)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const l=this.getEntityToMatchInputMap(e.parent);if(!l)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(l,t))return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const O={id:I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:e.toReference()},w=V(O,e.project);w.setParent(e,t),w.initChildren(t),t==null||t.add(w,b.Added),r.push(w),e.setDataType(w)}(v=e.dataType)==null||v.metaSync({inferred:!0,like:!0,asType:!1},t);const h=this.getEntityToMatch(l,t);return(E=e.dataType)==null||E.setEntity(h),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:p(a),added:p(r),removed:p(d),affected:p(o),self:e.dataType}}syncOutputDataOutputMapDataType(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-output-data-output-map-data-type"))){var c,v,E;const r=[],a=[],d=[],o=[];if(((c=e.declaration)==null?void 0:c.id)!==x.operation[Ke.Validate].outputs.outputEntity.id)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const l=this.getEntityToMatchInputMap(e.parent);if(!l)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(l,t))return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const O={id:I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:e.toReference()},w=V(O,e.project);w.setParent(e,t),w.initChildren(t),t==null||t.add(w,b.Added),r.push(w),e.setDataType(w)}(v=e.dataType)==null||v.metaSync({inferred:!0,like:!0,asType:!1},t);const h=this.getEntityToMatch(l,t);return(E=e.dataType)==null||E.setEntity(h),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:p(a),added:p(r),removed:p(d),affected:p(o),self:e.dataType}}inferInputMapDataType(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"infer-input-map-data-type-validate-data"))){var r,a;if(((r=e.declaration)==null?void 0:r.id)===x.operation[Ke.Validate].inputs.entityToMatch.id){const{added:d,updated:o,removed:l,affected:u}=this.syncEntityToMatchInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:p(o),added:p(d),removed:p(l),affected:p(u),self:e.dataType}}else if(((a=e.declaration)==null?void 0:a.id)===x.operation[Ke.Validate].inputs.dataToValidate.id){const{added:d,updated:o,removed:l,affected:u}=this.syncDataToValidateInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type",this.id),{updated:p(o),added:p(d),removed:p(l),affected:p(u),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}inferOutputMapDataType(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"infer-output-map-data-type-validate-data"))){var r;if(((r=e.declaration)==null?void 0:r.id)===x.operation[Ke.Validate].outputs.outputEntity.id){const{added:a,updated:d,removed:o,affected:l}=this.syncOutputDataOutputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-output-map-data-type-validate-data",this.id),{updated:p(d),added:p(a),removed:p(o),affected:p(l),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}}class wJ extends qe{constructor(s){super(yl,s)}}class VJ extends qe{constructor(s){super(ml,s)}}class CJ extends qe{constructor(s){super(vl,s)}}class BJ extends qe{constructor(s){super(Zs,s)}}class _J extends qe{constructor(s){super(xs,s)}}class MJ extends qe{constructor(s){super(Pa,s)}}function gJ(i){const s=[new _P(i),new CP(i),new BP(i),new DJ(i),new OJ(i),new PJ(i),new BJ(i),new wJ(i),new CJ(i),new VJ(i),new _J(i),new MJ(i),new qe(fl,i),new qe(cl,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.operationDeclarations=s,s}class MP extends zr{constructor(e){super(Pt,e);f(this,"initialData");f(this,"id",Y.PERSISTED_ENTITY);f(this,"version","1");f(this,"name",Y.PERSISTED_ENTITY);f(this,"description",Pt.description);f(this,"type",n.BuiltInBaseEntity);f(this,"abstract",Pt.abstract);f(this,"static",Pt.static);f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"errors",[]);f(this,"project");this.initialData=Pt,this.project=e,this.id=Pt.id,this.version=Pt.version,this.name=Pt.name,this.static=Pt.static,this.abstract=Pt.abstract,this.properties=this.initialData.properties.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.methods=this.initialData.methods.map(t=>{const r=V(t,this.project);return r.parent=this,r}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const r=V(t,this.project);return r.parent=this,r}),this.extends=this.initialData.extends.map(t=>V(t,this.project))}}function NJ(i){const s=[new MP(i),new zr(ga,i),new zr(Nr,i),new zr(oo,i)];return s.forEach(e=>{i.subscribeBuiltInInstance(e)}),i.builtInBaseEntities=s,s}function LJ(i){const s=[new ar(ne,i),new ar(Kr,i),new ar(me,i),new ar(sl,i),new ar(Rt,i),new ar(Xr,i),new ar(_r,i),new ar(Qr,i),new ar(jn,i)];return s.forEach(e=>{i.subscribeBuiltInInstance(e)}),i.primitives=s,s}function UJ(i){const s=[new qe(uo,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.globalEventActionDescriptors=s,s}function $J(i){const s=[new qe(_a,i),new qe(mi,i),new qe(Ca,i),new qe(xn,i),new qe(Sn,i),new qe(Xs,i)];s.forEach(t=>{t.initChildren(null),i.subscribeBuiltInInstance(t)}),i.loopDeclarations=s;const e=[new qe(ro,i),new qe(Ba,i),new qe(eo,i),new qe(Bl,i),new qe(Ml,i),new qe(Qs,i)];return e.forEach(t=>{t.initChildren(null),i.subscribeBuiltInInstance(t)}),i.loopDeclarationsBodies=e,s}function jJ(i){const s=[new xi(po,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.valueDescriptors=s,s}function GJ(i){const s=[new qe(an,i),new qe(Wn,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.operationDeclarations=s,s}const gn={},Qd={},Ns={empty:!1,enrich:!0,mock:!1,ignoreCache:!1,onFetch:async()=>null,manuallyInit:!1};function gP(i,{enrich:s}={enrich:!0}){const e=i.project,t=i.record,r=new Fd(e),a=new Set;t[e.id]=e,a.add(e.id);const d=T().toISOString();Object.values(t).forEach(u=>{!u||r.allBuiltInEntityIds.includes(u.id)||a.add(u.id)}),r.order=Array.from(a),r.flatRecord=t,r.orderEntities();const o=el(i.project);o.instances[e.id]=o;const l=s?o.addChangeSet(new R(o,"",d,o)):null;return r.visit(u=>{if(u.id===o.id)return;const h=V(u,o);h.hydrateAncestors(),h.addSelfToProject(null)}),s?(r.visit(u=>{const h=o.get(u.id);h&&h.afterAllChildrenInitialized(l)}),o.afterAllChildrenInitialized(l)):tl(o,d).forEach(h=>{h.remove({ignoreUpstream:!0},null)}),o.instancesList.forEach(u=>{u.previousVersion=null}),l==null||l.close(),o}async function FJ(i,s=Ns){const e={...Ns,...s};if(e.empty)return{data:{project:{id:i.id,type:n.Project,version:I.UUID.uuid(),createdAt:T().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]},record:{}}};if(e.mock){const r={...ip};return r.id=i.id,{data:{project:r,record:{}}}}return console.log("Fetching project from external API"),new Promise(async r=>{if(e.onFetch){const a=await e.onFetch(i.id);if(a){r({data:a});return}}else r({data:null})})}function el(i){const s=new I(i);return LJ(s),NJ(s),gJ(s),UJ(s),$J(s),jJ(s),GJ(s),Array.from(new Set([...s.getAllBuiltInIds(),...Vr()])).forEach(t=>{if(!s.builtInInstances[t]&&s.instances[t])s.builtInInstances[t]=s.instances[t],delete s.instances[t];else if(!s.builtInInstances[t])throw new Error(`Built in entity was not properly initialized: ${t}`)}),s}function tl(i,s){return i.instancesList.filter(t=>T(t.createdAt).isAfter(T(s)||!!t.previousVersion))}function xJ(i,{enrich:s}={enrich:!0}){const e=new Map,t=Array.from(new Set([...i.getAllBuiltInIds(),...Vr()]));Object.keys(i.instances).forEach(u=>{if(t.includes(u)){e.set(u,u);return}const h=i.get(u);if(!Xd(h,{...i.instances,...i.builtInInstances}).every(E=>!t.includes(E))){e.set(u,u);return}e.set(u,I.UUID.uuid())});const r=T().toISOString(),a=i.toShallowJSON({seenEntityMaps:e});a.previousVersion=null,a.createdAt=r,a.version=I.UUID.uuid();const d=el(a),o=s?d.addChangeSet(new R(d,"",r,d)):null,l=new Fd(i);return l.visit(u=>{const h=u.toShallowJSON({seenEntityMaps:e});h.previousVersion=null,h.createdAt=r,h.version=I.UUID.uuid();const c=V(h,d);c.hydrateAncestors(),c.addSelfToProject(o),o==null||o.add(c,b.Added)}),s?(l.visit(u=>{const h=d.get(e.get(u.id));h&&h.afterAllChildrenInitialized(o)}),d.afterAllChildrenInitialized(o)):tl(d,r).forEach(h=>{h.remove({ignoreUpstream:!0},null)}),d.instancesList.forEach(u=>{u.previousVersion=null}),o==null||o.close(),d}function NP(i,{enrich:s}={enrich:!0}){const e=el(i),t=T().toISOString(),r=s?e.addChangeSet(new R(e,"",t,e)):null;r&&(r.type=Ac.Automatic);const a=new Fd(i);return a.visit(d=>{const o=V(d,e);o.hydrateAncestors(),o.addSelfToProject(r)}),s?(a.visit(d=>{const o=e.get(d.id);o&&o.afterAllChildrenInitialized(r)}),e.afterAllChildrenInitialized(r)):tl(e,t).forEach(o=>{o.remove({ignoreUpstream:!0},null)}),r==null||r.close(),e}async function SJ(i,s=Ns){const e={...Ns,...s};if(i.id&&gn[i.id]&&!e.ignoreCache)return gn[i.id];if(i.id&&Qd[i.id]&&!e.ignoreCache)return await Qd[i.id],gn[i.id];const t=FJ(i,e);i.id&&(Qd[i.id]=t);const r=await t;if(r.data){let a;return e.mock?a=NP(ip,{enrich:!!e.enrich}):r.data instanceof I?a=r.data:a=gP(r.data,{enrich:!!e.enrich}),gn[i.id]=a,i.id&&delete Qd[i.id],a}return null}function kJ(i){return gn[i.id]&&delete gn[i.id],null}const ZJ="test_primitive_entities_export";y.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=Mc,y.ALL_BUILT_IN_BASE_ENTITIES=NE,y.ALL_BUILT_IN_CONDITION_ENTITIES=zE,y.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=HE,y.ALL_BUILT_IN_LOOP_BODY_ENTITIES=uT,y.ALL_BUILT_IN_LOOP_ENTITIES=lT,y.ALL_BUILT_IN_OPERATION_ENTITIES=A0,y.ALL_BUILT_IN_PRIMITIVE_ENTITIES=lf,y.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=eI,y.ALL_BUILT_IN_VALUE_DESCRIPTORS=QE,y.ActionDescriptorState=qe,y.ActionInputMapState=yq,y.ActionOutputMapState=vq,y.AppendToListOperationInputIds=vh,y.AppendToListOperationOutputIds=Th,y.ArgumentDeclarationDependencyField=aO,y.ArgumentDeclarationState=Fi,y.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=Vc,y.BUILT_IN_BASE_ENTITY_IDS=x,y.BUILT_IN_ENTITY_TYPES=hr,y.BaseCanvasDraggableState=vJ,y.BaseEntityNames=Y,y.BaseState=mJ,y.BaseValueDescriptorIds=Fs,y.BreakStatementDependencyField=Rc,y.BreakStatementState=Cn,y.BuiltInBaseEntityState=zr,y.CACHED_PROJECTS_BY_ID=gn,y.CALLABLE_ENTITIES_EXPLANATION=Oq,y.CALLABLE_TYPES=Cr,y.CALLER_ENTITIES_EXPLANATION=uO,y.CALLER_TYPES=Br,y.CALLS_UPDATE_EXPLANATION=ki,y.COMPARISON_CONDITIONS=JE,y.CONDITIONS=WE,y.CUSTOM_ENTITY_OPERATIONS=Gm,y.CallableEntityClass=EJ,y.CallerEntityClass=Hc,y.ChangeSet=R,y.ChangeSetChangeCaptureType=Ac,y.ChangeSetEntityChangeType=b,y.ChildEntityState=TJ,y.ComparisonOperatorTypes=pt,y.ConditionDependencyField=Q1,y.ConditionState=Li,y.ContinueStatementDependencyField=bc,y.ContinueStatementState=jt,y.CreateNewInputIds=fm,y.CreateNewOutputIds=ym,y.DRAGGABLE_CALLABLE_TYPES=al,y.DRAGGABLE_CALLER_TYPES=ef,y.DRAGGABLE_ELEMENT_TYPES=Gs,y.DRAGGABLE_EXECUTABLE_TYPES=GP,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=js,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=nl,y.DataTypeCompatibilityTypes=Er,y.DataTypeDependencyField=Y1,y.DataTypeParentChildRelation=bt,y.DataTypeState=wn,y.DefinitionEntityDependencyField=OP,y.DefinitionEntityState=Yi,y.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=yJ,y.ENTITIES_WITH_VALLUES_EXPLANATION=Ld,y.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=L,y.ENTITY_RECUSION_OPTIONS_DEFAULTS=Z,y.ENTITY_TYPES=FP,y.ENTITY_WITH_DECLARATION_TYPES=$P,y.ENTITY_WITH_LOGIC_SCOPE_TYPES=mt,y.ENTITY_WITH_NAMES_TYPES=tf,y.ENTITY_WITH_PARENT_TYPES=LP,y.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=Xc,y.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=UP,y.ENTITY_WITH_VALUE_TYPES=Kc,y.ENTRY_POINT_ENTITIES_EXPLANATION=Ps,y.ENTRY_POINT_TYPES=at,y.EVENT_TYPES=$n,y.EXECUTABLE_TYPES=jP,y.EXECUTION_OPERATIONS=cm,y.EntityAction=VP,y.EntityError=hn,y.EntityErrorSeverity=D,y.EntityGenerationError=P,y.EntityGenerationErrorCode=A,y.EntityInstanceErrorCode=q,y.EntityOperations=Ke,y.EntityType=n,y.EntityWithLogicScopeClass=RJ,y.EntityWithValueClass=bJ,y.EntryPointEntityClass=IJ,y.ExecutionOperations=He,y.ExecutionTerminationType=K1,y.FunctionCallDependencyField=IO,y.FunctionCallState=qi,y.FunctionDeclarationDependencyField=z1,y.FunctionDeclarationState=Mi,y.GET_PROJECT_OPTIONS_DEFAULTS=Ns,y.GLOBAL_EVENT_DECLARATIONS=YE,y.GetLastInListOperationInputIds=ah,y.GetLastInListOperationOutputIds=sh,y.GlobalEventNames=Hr,y.GlobalEventState=Vn,y.HTTPOperations=Ct,y.HTTP_OPERATIONS=E0,y.InputMapDependencyField=iO,y.InputMapState=Zr,y.InstalledProjectState=Gi,y.InternalCallDependencyField=rO,y.InternalCallState=Bn,y.JoinListOperationInputIds=Oy,y.JoinListOperationOutputIds=Py,y.LIST_OPERATIONS=_h,y.ListOperations=fe,y.LiteralValueDependencyField=sO,y.LiteralValueState=_n,y.LoopDependencyField=X1,y.LoopState=Ni,y.LoopTypes=X,y.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=Zi,y.NUMBER_OPERATIONS=Gf,y.NumberOperations=Xe,y.OPERATION_DECLARATIONS=I0,y.OperationDependencyField=H1,y.OperationState=gi,y.OutputMapDependencyField=nO,y.OutputMapParentChildRelation=Un,y.OutputMapState=qr,y.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=Ud,y.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=Si,y.PASS_THROUGH_CALLABLE_TYPES=nt,y.PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=Qc,y.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=_c,y.ParallelExecutionOperation=CP,y.PassThroughCallableEntityClass=AJ,y.PersistedEntity=MP,y.PersistedEntityMethods=or,y.PrimitiveEntityState=ar,y.PrimitiveTypes=g,y.ProjectState=I,y.PropertyDependencyField=J1,y.PropertyState=Bi,y.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=wP,y.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=Pq,y.ReturnDeclarationDependencyField=W1,y.ReturnDeclarationState=rr,y.ReturnStatementDependencyField=_d,y.ReturnStatementState=_i,y.STANDALONE_CONDITIONS=$E,y.STRING_OPERATIONS=Dy,y.ScopeCompatibilityType=Kd,y.SearchDependencyField=tO,y.SearchState=ji,y.SequentialExecutionOperation=_P,y.SequentialExecutionOperationInputIds=Qh,y.SequentialExecutionOperationOutputIds=em,y.SharedEntityErrorCode=j,y.SharedStateFunctionality=PP,y.SplitListOperationInputIds=xy,y.SplitListOperationOutputIds=Sy,y.StandaloneOperatorTypes=yr,y.StringOperations=Ee,y.TERMINATION_TYPES=st,y.Traverser=Fd,y.USER_MANAGED_ENTITY_TYPES=rf,y.UserManagedEntityStateTemplate=hJ,y.VALUE_READING_ENTITIES_EXPLANATION=Bc,y.VALUE_READING_TYPES=hi,y.VALUE_WRITING_ENTITIES_EXPLANATION=pO,y.VALUE_WRITING_TYPES=ht,y.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=Cc,y.VARIABLE_TYPES=Qe,y.ValueAutogenerationType=yt,y.ValueDescriptorDependencyField=oO,y.ValueDescriptorParentChildRelation=M,y.ValueDescriptorState=xi,y.ValueReadingEntityClass=yi,y.ValueWritingEntityClass=gs,y.VariableDeclarationDependencyField=eO,y.VariableDeclarationState=$i,y.VariableInputMapState=fq,y.VariableInstanceDependencyField=Dc,y.VariableInstanceState=Ui,y.VariableOutputMapState=mq,y.WaitOperation=BP,y.WaitOperationInputIds=Jh,y.WaitOperationOutputIds=Wh,y.appendToListOperation=Zs,y.appendToListOperationElementToAppendArgument=El,y.appendToListOperationElementToAppendArgumentParentRef=Ph,y.appendToListOperationElementToAppendArgumentRef=Ah,y.appendToListOperationError=Bh,y.appendToListOperationErrorParentRef=Ch,y.appendToListOperationListArgument=Tl,y.appendToListOperationListArgumentParentRef=Oh,y.appendToListOperationListArgumentRef=Eh,y.appendToListOperationListDataType=Ih,y.appendToListOperationResultListDataType=Dh,y.appendToListOperationResultListReturn=Vh,y.appendToListOperationResultListReturnParentRef=wh,y.appendToListOperationResultListReturnRef=Rh,y.appendToListOperationSecondListDataType=bh,y.asGenerationActionExample=Jr,y.booleanPrototype=Kr,y.capitalizeFirstLetter=Wt,y.changeSetJSONRecordToUniqueIds=Z7,y.checkAreDataTypesCompatible=Ir,y.checkAreDefinitionEntitiesCompatibleAsDataType=g1,y.checkArePropertiesCompatibleAsDataType=M1,y.checkHasMetadataChanged=dt,y.checkIsBranchDependentButNotDirectlyOnBranch=Vs,y.checkIsBranchDependentOnBranch=Lq,y.checkIsCallableEntityReachable=Ms,y.checkIsCanvasEntity=eJ,y.checkIsDetachedBranch=EP,y.checkIsDetachedBranchShallow=zc,y.checkIsGlobalVariable=Kq,y.checkIsGloballyDeclared=Wc,y.checkIsMethod=bP,y.checkIsNestedScope=Hd,y.checkScopeCompatibility=_s,y.cloneProject=xJ,y.countedLoopActionDescriptor=_a,y.countedLoopActionDescriptorDynamicReturnDeclaration=tT,y.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=eT,y.countedLoopActionDescriptorStringArgumentDeclaration=Qv,y.countedLoopActionDescriptorStringArgumentDeclarationDataType=Kv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=Yv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=zv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=Hv,y.countedLoopActionDescriptorStringArgumentDeclarationParentRef=Xv,y.countedLoopBodyActionDescriptor=ro,y.countedLoopBodyActionDescriptorAnyDynamicArgument=sT,y.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=aT,y.countedLoopBodyActionDescriptorAnyDynamicReturn=dT,y.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=oT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Nl,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=iT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=rT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=nT,y.createDefinitionEntityFromJSONObject=Sd,y.createEntityError=ye,y.createNestedDataTypeForEntity=RO,y.createNewInstanceOperation=Xi,y.createNewInstanceOperationEntityToInstanciateArgument=bm,y.createNewInstanceOperationEntityToInstanciateArgumentRef=Em,y.createNewInstanceOperationEntityToInstanciateDataType=Im,y.createNewInstanceOperationError=Pm,y.createNewInstanceOperationErrorParentRef=Om,y.createNewInstanceOperationNewEntityDataArgument=Tm,y.createNewInstanceOperationNewEntityDataArgumentDataType=vm,y.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=mm,y.createNewInstanceOperationNewEntityDataArgumentParentRef=hm,y.createNewInstanceOperationOutputEntityDeclaration=Dm,y.createNewInstanceOperationOutputEntityDeclarationParentRef=Rm,y.createNewInstanceOperationRef=Am,y.createSemanticId=q1,y.createStateFromGenerationTargetType=fJ,y.createStateFromType=lt,y.createStateFromTypeAndSubscribe=V,y.cronJobBuiltInBaseEntity=oo,y.cronJobBuiltInBaseEntityExpressionProperty=ME,y.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=WP,y.cronJobBuiltInBaseEntityExpressionPropertyRef=BE,y.cronJobBuiltInBaseEntityRef=_E,y.cronJobTriggeredFunctionDeclarationBlueprint=zl,y.cronJobTriggeredFunctionDeclarationBlueprintParentRef=VE,y.dataTypeCompatibilityToErrorExplanation=EO,y.datePrototype=_r,y.dateValueAutogenerationSchema=dp,y.definitionEntityToZodSchema=mI,y.deletePersistedEntityMethod=Wl,y.deletePersistedEntityMethodParentRef=fE,y.deleteRootProject=kJ,y.endpointBuiltInBaseEntity=ga,y.endpointBuiltInBaseEntityRef=yT,y.endpointBuiltInBaseEntityRefFour=YT,y.endpointBuiltInBaseEntityRefThree=RT,y.endpointBuiltInBaseEntityRefTwo=ET,y.endpointBuiltInCorsProperty=hT,y.endpointBuiltInCorsPropertyDataType=fT,y.endpointBuiltInCorsPropertyDataTypeRef=pT,y.endpointBuiltInCorsPropertyRef=cT,y.endpointBuiltInMethodProperty=Ul,y.endpointBuiltInMethodPropertyDataType=bT,y.endpointBuiltInMethodPropertyDataTypeRef=IT,y.endpointBuiltInMethodPropertyRef=AT,y.endpointBuiltInPathProperty=Ll,y.endpointBuiltInPathPropertyDataType=TT,y.endpointBuiltInPathPropertyDataTypeRef=mT,y.endpointBuiltInPathPropertyRef=vT,y.endpointPathParamsArgumentDeclaration=jl,y.endpointPathParamsArgumentDeclarationRef=gT,y.endpointPathParamsVariableDataType=NT,y.endpointPathParamsVariableDataTypeRef=MT,y.endpointReachedTriggerActionDescriptor=Zl,y.endpointReachedTriggerActionDescriptorRef=LT,y.endpointReachedTriggerActionDescriptorRefFour=jT,y.endpointReachedTriggerActionDescriptorRefThree=$T,y.endpointReachedTriggerActionDescriptorRefTwo=UT,y.endpointRequestBodyArgumentDeclaration=Fl,y.endpointRequestBodyArgumentDeclarationRef=wT,y.endpointRequestBodyVariableDataType=VT,y.endpointRequestHeadersArgumentDeclaration=$l,y.endpointRequestHeadersArgumentDeclarationRef=OT,y.endpointRequestHeadersVariableDataType=PT,y.endpointRequestHeadersVariableDataTypeRef=DT,y.endpointRequestQueryParamsArgumentDeclaration=Gl,y.endpointRequestQueryParamsArgumentDeclarationRef=BT,y.endpointRequestQueryParamsVariableDataType=_T,y.endpointRequestQueryParamsVariableDataTypeRef=CT,y.endpointResponseBodyDataType=WT,y.endpointResponseBodyReturnDeclaration=kl,y.endpointResponseBodyReturnDeclarationRef=JT,y.endpointResponseCodeDataType=FT,y.endpointResponseCodeReturnDeclaration=xl,y.endpointResponseCodeReturnDeclarationRef=GT,y.endpointResponseHeadersDataType=ZT,y.endpointResponseHeadersDataTypeRef=ST,y.endpointResponseHeadersReturnDeclaration=Sl,y.endpointResponseHeadersReturnDeclarationRef=kT,y.endpointReturnStatementRef=xT,y.endpointReturnStatementRefThree=zT,y.endpointReturnStatementRefTwo=qT,y.enrichFromKnownEntities=Cs,y.enumOptionsProperty=df,y.enumOptionsPropertyDataType=sf,y.enumOptionsPropertyDataTypeRef=nf,y.enumOptionsPropertyRef=af,y.enumPrototype=Xr,y.enumPrototypeRef=of,y.executionBuiltInBaseEntity=lo,y.executionBuiltInEntityAbortMethod=Yl,y.executionBuiltInEntityAbortMethodParentRef=gE,y.filterOutDuplicateEntities=p,y.filterOutDuplicateErrors=H9,y.findEntityFromKeys=Uc,y.findReferenceToSelfInList=jO,y.findReferencesToSelfInProject=Zq,y.flattenActionDescriptor=GO,y.flattenArgumentDeclaration=FO,y.flattenBreakStatement=xO,y.flattenBuiltInBaseEntity=SO,y.flattenCalls=Wr,y.flattenCanvasAncestorsUntil=kd,y.flattenCondition=kO,y.flattenContinueStatement=ZO,y.flattenDataType=JO,y.flattenDefinitionEntity=qO,y.flattenDefinitionEntityExtensionAndImplementationTypes=Zc,y.flattenDefinitionEntityExtensionTypes=Yd,y.flattenDefinitionEntityExtensions=Sc,y.flattenDefinitionEntityImplementations=kc,y.flattenDefinitionEntityImplementionTypes=zd,y.flattenDerivedCanvasEntities=ir,y.flattenDetachedBranch=AP,y.flattenElementCalls=it,y.flattenElementCallsOnTheSameScope=kq,y.flattenEntity=N,y.flattenFunctionCall=WO,y.flattenFunctionDeclaration=zO,y.flattenGlobalEvent=YO,y.flattenInputMap=HO,y.flattenInstalledProject=KO,y.flattenInternalCall=XO,y.flattenLiteralValue=QO,y.flattenLoop=eP,y.flattenOperation=tP,y.flattenOutputMap=rP,y.flattenPrimitiveEntity=iP,y.flattenProject=nP,y.flattenProjectElements=$O,y.flattenProperty=aP,y.flattenRelatedCanvasElementsOnTheLeft=vP,y.flattenRelatedCanvasElementsOnTheRight=mP,y.flattenReturnDeclaration=sP,y.flattenReturnStatement=oP,y.flattenSearch=dP,y.flattenValueDescriptor=lP,y.flattenVariableDeclaration=uP,y.flattenVariableInstance=pP,y.flattenVariableReads=UO,y.flattenVariableWrites=LO,y.flattenVariables=We,y.fromChangeSetToRecordChangeSet=dJ,y.fromZodParseToEntityGenerationErrors=Oc,y.generate=KV,y.generateActionExample=wq,y.generateExecutionDataType=N7,y.generateIdFromStrategy=ct,y.generateMutablePropertiesExplanation=Md,y.generateRandomBoolean=kI,y.generateRandomDate=II,y.generateRandomDateAfter=vI,y.generateRandomDateBefore=TI,y.generateRandomDateBetweenRange=EI,y.generateRandomNumber=jI,y.generateRandomNumberAfter=LI,y.generateRandomNumberBefore=UI,y.generateRandomNumberBetweenRange=$I,y.generateRandomText=SI,y.generateRandomTextAfter=GI,y.generateRandomTextBefore=FI,y.generateRandomTextBetweenRange=xI,y.generateUniqueUUID=NI,y.getAllActionDescriptorsForConditions=Gd,y.getAllActionDescriptorsForGlobalEvents=$d,y.getAllActionDescriptorsForLoops=jd,y.getAllActionDescriptorsForOperations=_q,y.getAllBuiltInEntityIds=Vr,y.getAllGloballyDeclaredFunctionDeclarationsExplanation=mO,y.getBaseBuiltInEntities=Wi,y.getBaseSchemaBasedOnType=dO,y.getBuiltInEntityOwner=zi,y.getCallableEntityReferenceSchema=Dt,y.getCallableEntityTypeSchema=ID,y.getCalledBy=fr,y.getCallerEntityReferenceSchema=e5,y.getCallerEntityTypeSchema=Q3,y.getCalls=Gc,y.getCanvasEntitiesDerivedFromInternalCalls=hP,y.getCanvasEntitiesDerivedFromWrites=ba,y.getCanvasEntityDerivedFromValueReadingEntity=Wd,y.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=yP,y.getCanvasEntityReferenceSchema=v5,y.getCanvasEntityTypeSchema=m5,y.getChildrenEntityWithValues=$q,y.getColumnProperties=aJ,y.getCommonAncestor=jc,y.getCommonChildren=DO,y.getDatabaseEntities=iJ,y.getDatabaseEntity=sJ,y.getDeclaration=Pn,y.getDeepestScope=DP,y.getDefinitionEntityExtends=Ra,y.getDraggableCallableEntityReferenceSchema=bD,y.getDraggableCallableEntityTypeSchema=AD,y.getDraggableCallerEntityReferenceSchema=r5,y.getDraggableCallerEntityTypeSchema=t5,y.getDraggableExecutableEntityReferenceSchema=s5,y.getDraggableExecutableEntityTypeSchema=a5,y.getDraggablePassThroughCallableEntityReferenceSchema=Td,y.getDraggablePassThroughCallableEntityTypeSchema=vd,y.getDraggablePlayableEntityReferenceSchema=p5,y.getDraggablePlayableEntityTypeSchema=u5,y.getEntitiesCreatedSinceInitialization=tl,y.getEntityArgumentDeclarations=xc,y.getEntityInputMaps=cP,y.getEntityOutputMaps=zq,y.getEntityReferenceSchema=h5,y.getEntityReturnDeclarations=fP,y.getEntityTypeSchema=y5,y.getEntityWithLogicScopeReferenceSchema=ui,y.getEntityWithLogicScopeTypeSchema=o5,y.getEntityWithValueReferenceSchema=ED,y.getEntityWithValueTypeSchema=X3,y.getEntryPointEntityReferenceSchema=At,y.getEntryPointEntityTypeSchema=wi,y.getEventEntityReferenceSchema=hd,y.getEventEntityTypeSchema=yd,y.getExecutableEntityReferenceSchema=n5,y.getExecutableEntityTypeSchema=i5,y.getExtendedBuiltInEntity=Yq,y.getExtendedDefinitionEntity=qc,y.getGenerationTargetSchemaBasedOnType=lO,y.getHeadIfPartOfDetachedBranch=IP,y.getHighestScope=RP,y.getImplementedBuiltInEntity=Hq,y.getIsInteractive=Jc,y.getLastInListOperation=vl,y.getLastInListOperationError=mh,y.getLastInListOperationErrorParentRef=hh,y.getLastInListOperationInputListArgument=ch,y.getLastInListOperationInputListArgumentParentRef=ph,y.getLastInListOperationInputListArgumentRef=oh,y.getLastInListOperationInputListDataType=dh,y.getLastInListOperationOutputElementDataType=uh,y.getLastInListOperationOutputElementReturn=yh,y.getLastInListOperationOutputElementReturnParentRef=fh,y.getLastInListOperationOutputElementReturnRef=lh,y.getLinkedEntitiesFromArgumentDeclaration=Sq,y.getLowestPersistedEntityImplementation=TP,y.getParentCallableEntity=OO,y.getParentCallerEntity=wO,y.getParentCanvasEntities=zt,y.getParentCanvasEntity=Ot,y.getParentCanvasEntityFromTransfer=Zd,y.getParentEntryPoint=Uq,y.getParentPassthroughCallableEntity=PO,y.getPassThroughCallableEntityReferenceSchema=et,y.getPassThroughCallableEntityTypeSchema=md,y.getPeristedEntities=rJ,y.getPlayableEntityReferenceSchema=l5,y.getPlayableEntityTypeSchema=d5,y.getProject=SJ,y.getPrototypeByType=Bs,y.getRecusriveParentsIds=Xd,y.getReferenceEntityId=B,y.getReferencedEntitiesStateOrErrors=Nd,y.getReferencedEntityStateOrErrors=Pc,y.getReferencedIds=Jd,y.getRelatedCanvasElementsOnTheLeft=Mn,y.getRelatedCanvasElementsOnTheLeftFromTransfer=qq,y.getRelatedCanvasElementsOnTheRight=Ji,y.getRootEntryPointScopeOwner=Yc,y.getScopeOwner=Yt,y.getStateClassFromType=oJ,y.getTerminationReferenceSchema=f5,y.getTerminationTypeSchema=c5,y.getTouchedCanvasEntitiesFromChangeSet=lJ,y.getUsedArgFromDeclaration=Jq,y.getUsedReturnFromDeclaration=Wq,y.getValueReadingEntityReferenceSchema=TD,y.getValueReadingEntityTypeSchema=li,y.getValueWritingEntityReferenceSchema=K3,y.getValueWritingEntityTypeSchema=ms,y.getVariableFromInputMapping=CO,y.getVariableFromReturnVariablePointer=MO,y.getVariableReferenceSchema=Pi,y.getVariableTypeSchema=In,y.getVariablesFromArgumentDeclarations=qd,y.getVariablesFromInputMaps=BO,y.getVariablesFromOutputMapping=gO,y.getVariablesFromOutputMaps=NO,y.getVariablesFromReturnDeclarations=_O,y.getVariablesInSameOrHigherScope=fc,y.getWrites=Fc,y.groupCallsBasedOnParallelizableExecution=Gq,y.handleAfterEntityImplementationSideEffects=bO,y.handleBeforeEntityImplementationSideEffects=AO,y.httpRequestBodyArgument=zs,y.httpRequestBodyArgumentRef=Xm,y.httpRequestBodyDataType=Qm,y.httpRequestHeadersArgument=Ws,y.httpRequestHeadersArgumentRef=Hm,y.httpRequestHeadersDataType=Km,y.httpRequestMethodArgument=qs,y.httpRequestMethodArgumentRef=zm,y.httpRequestMethodDataType=Ym,y.httpRequestMethodDataTypeRef=Jm,y.httpRequestOperation=wa,y.httpRequestOperationErrorValueDescriptor=Ol,y.httpRequestOperationErrorValueDescriptorDatatype=T0,y.httpRequestOperationErrorValueDescriptorRef=v0,y.httpRequestOperationRef=f0,y.httpRequestOperationRefEight=h0,y.httpRequestOperationRefFive=p0,y.httpRequestOperationRefFour=u0,y.httpRequestOperationRefNine=m0,y.httpRequestOperationRefSeven=y0,y.httpRequestOperationRefSix=c0,y.httpRequestOperationRefThree=l0,y.httpRequestOperationRefTwo=d0,y.httpRequestQueryParamsArgument=Dl,y.httpRequestQueryParamsArgumentRef=Zm,y.httpRequestQueryParamsDataType=qm,y.httpRequestVariableURLArgument=Js,y.httpRequestVariableURLArgumentRef=Sm,y.httpRequestVariableURLDataType=km,y.httpRequestVariableURLDataTypeRef=Fm,y.httpResponseBodyReturnDataType=o0,y.httpResponseBodyReturnDataTypeRef=a0,y.httpResponseBodyReturnReturn=Ks,y.httpResponseBodyReturnReturnRef=s0,y.httpResponseCodeDataType=t0,y.httpResponseCodeReturn=Ys,y.httpResponseCodeReturnRef=e0,y.httpResponseHeadersDataType=n0,y.httpResponseHeadersDataTypeRef=r0,y.httpResponseHeadersReturn=Hs,y.httpResponseHeadersReturnRef=i0,y.implement=xd,y.inferArgumentDeclarationDataType=N1,y.inferDataType=kr,y.inferInputMapDataType=uc,y.inferOutputMapDataType=cc,y.inferPropertyDataType=$1,y.inferReturnDeclarationDataType=pc,y.inferValueDescriptorDataType=j1,y.inferVariableDeclarationDataType=U1,y.inferVariableInstanceDataType=L1,y.initBaseProjectEntity=el,y.initProject=NP,y.initProjectFromFetchResult=gP,y.isPromise=Lc,y.iterateOverListActionDescriptorListArgumentDeclaration=X0,y.iterateOverListActionDescriptorListArgumentDeclarationDataType=H0,y.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=Y0,y.iterateOverListActionDescriptorListArgumentDeclarationParentRef=K0,y.iterateOverListLoopActionDescriptor=mi,y.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=ev,y.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=Q0,y.iterateOverListLoopBodyActionDescriptor=Ba,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=lv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=dv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=pv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=uv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=to,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=rv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=tv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=iv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=ov,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=av,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=nv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=sv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=mv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=yv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=fv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=hv,y.iterateOverObjectKeysLoopActionDescriptor=xn,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=Tv,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=vv,y.iterateOverObjectKeysLoopBodyActionDescriptor=Bl,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=wv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Pv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=Cv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=Vv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Cl,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=Iv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Ev,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Av,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Ov,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Rv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=bv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Dv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=Nv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=Mv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=_v,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=gv,y.iterateOverObjectValuesLoopActionDescriptor=Sn,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=Uv,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=Lv,y.iterateOverObjectValuesLoopBodyActionDescriptor=Ml,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=qv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Zv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=Wv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=Jv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=_l,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=jv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=$v,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Gv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=kv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=xv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Fv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Sv,y.iterateOverStringActionDescriptorDynamicReturnDeclaration=$0,y.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=U0,y.iterateOverStringActionDescriptorStringArgumentDeclaration=L0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=g0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=M0,y.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=N0,y.iterateOverStringLoopActionDescriptor=Ca,y.iterateOverStringLoopBodyActionDescriptor=eo,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=q0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Z0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=W0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=J0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=wl,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=G0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=j0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=F0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Vl,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=S0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=x0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=k0,y.joinListOperation=yl,y.joinListOperationError=Fy,y.joinListOperationErrorParentRef=Gy,y.joinListOperationFirstListArgument=Ny,y.joinListOperationFirstListArgumentParentRef=gy,y.joinListOperationFirstListArgumentRef=wy,y.joinListOperationFirstListDataType=Vy,y.joinListOperationResultListDataType=My,y.joinListOperationResultListReturn=jy,y.joinListOperationResultListReturnParentRef=$y,y.joinListOperationResultListReturnRef=_y,y.joinListOperationSecondListArgument=Uy,y.joinListOperationSecondListArgumentParentRef=Ly,y.joinListOperationSecondListArgumentRef=Cy,y.joinListOperationSecondListDataType=By,y.joinListWithLastSeparator=ie,y.joinStringsOperation=Pa,y.joinStringsOperationDynamicStringArgument=sy,y.joinStringsOperationDynamicStringArgumentParentRef=ay,y.joinStringsOperationDynamicStringArgumentRef=iy,y.joinStringsOperationDynamicStringDataType=ny,y.joinStringsOperationError=ry,y.joinStringsOperationErrorParentRef=ty,y.joinStringsOperationFirstStringArgument=Ss,y.joinStringsOperationFirstStringArgumentParentRef=Jf,y.joinStringsOperationFirstStringArgumentRef=Ff,y.joinStringsOperationFirstStringDataType=xf,y.joinStringsOperationResultStringDataType=qf,y.joinStringsOperationResultStringReturn=Oa,y.joinStringsOperationResultStringReturnParentRef=ey,y.joinStringsOperationResultStringReturnRef=Zf,y.joinStringsOperationSecondStringArgument=ks,y.joinStringsOperationSecondStringArgumentParentRef=Qf,y.joinStringsOperationSecondStringArgumentRef=Sf,y.joinStringsOperationSecondStringDataType=kf,y.joinStringsOperationSeparatorStringArgument=Xf,y.joinStringsOperationSeparatorStringArgumentParentRef=Kf,y.joinStringsOperationSeparatorStringArgumentRef=Wf,y.joinStringsOperationSeparatorStringDataType=Hf,y.joinStringsOperationSeparatorStringDataTypeDefaultValue=Yf,y.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=zf,y.keyValuePrototype=jn,y.lowercaseFirstLetter=Pd,y.manualFlowActionDescriptorDeclarationArgumentDeclaration=Pl,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=O0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=D0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=P0,y.manualFlowLoopActionDescriptor=Xs,y.manualFlowLoopActionDescriptorDynamicReturnDeclaration=R0,y.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=b0,y.manualFlowLoopBodyActionDescriptor=Qs,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=V0,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=w0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=B0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=C0,y.mapActionDescriptorToTypeItRepresents=tJ,y.mergeEntityErrorsList=K9,y.mergeListOfEntities=Xq,y.methodDefaultValue=Wm,y.mockClientProject=ip,y.moreThanOrEqualCondition=Wn,y.moreThanOrEqualConditionLeftHandArgument=xE,y.moreThanOrEqualConditionLeftHandArgumentDataType=GE,y.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=jE,y.moreThanOrEqualConditionLeftHandArgumentParentRef=FE,y.moreThanOrEqualConditionRightHandArgument=qE,y.moreThanOrEqualConditionRightHandArgumentDataType=kE,y.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=SE,y.moreThanOrEqualConditionRightHandArgumentParentRef=ZE,y.notEmptyCondition=an,y.notEmptyConditionArgument=UE,y.notEmptyConditionRef=LE,y.nullPrototype=sl,y.numberAdditionOperation=xs,y.numberAdditionOperationDynamicSummandArgument=bf,y.numberAdditionOperationDynamicSummandArgumentType=Af,y.numberAdditionOperationDynamicSummandArgumentTypeParentRef=If,y.numberAdditionOperationError=Ef,y.numberAdditionOperationErrorParentRef=Tf,y.numberAdditionOperationFirstNumberArgument=ol,y.numberAdditionOperationFirstNumberArgumentRef=uf,y.numberAdditionOperationFirstNumberDataType=pf,y.numberAdditionOperationRef=mf,y.numberAdditionOperationRefThree=ll,y.numberAdditionOperationRefTwo=vf,y.numberAdditionOperationResultNumberDataType=hf,y.numberAdditionOperationResultNumberReturn=ul,y.numberAdditionOperationResultNumberReturnRef=yf,y.numberAdditionOperationSecondNumberArgument=dl,y.numberAdditionOperationSecondNumberArgumentRef=cf,y.numberAdditionOperationSecondNumberDataType=ff,y.numberPrototype=me,y.numberSubtractionOperation=cl,y.numberSubtractionOperationDynamicSubtrahendArgument=jf,y.numberSubtractionOperationDynamicSubtrahendArgumentType=$f,y.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=Uf,y.numberSubtractionOperationError=Lf,y.numberSubtractionOperationErrorParentRef=Nf,y.numberSubtractionOperationFirstNumberArgument=Cf,y.numberSubtractionOperationFirstNumberArgumentRef=Rf,y.numberSubtractionOperationFirstNumberDataType=Df,y.numberSubtractionOperationRef=pl,y.numberSubtractionOperationRefThree=Mf,y.numberSubtractionOperationRefTwo=Bf,y.numberSubtractionOperationResultNumberDataType=Vf,y.numberSubtractionOperationResultNumberReturn=gf,y.numberSubtractionOperationResultNumberReturnRef=wf,y.numberSubtractionOperationSecondNumberArgument=_f,y.numberSubtractionOperationSecondNumberArgumentRef=Of,y.numberSubtractionOperationSecondNumberDataType=Pf,y.numberValueAutogenerationSchema=op,y.parallelExecutionOperation=br,y.parallelExecutionOperationError=qh,y.parallelExecutionOperationErrorParentRef=Zh,y.parallelExecutionOperationListOfExecutionResultsDataType=xh,y.parallelExecutionOperationListOfExecutionResultsReturn=Al,y.parallelExecutionOperationListOfExecutionResultsReturnRef=Fh,y.parallelExecutionOperationListOfFunctionsArgument=Il,y.parallelExecutionOperationListOfFunctionsArgumentDatatype=Gh,y.parallelExecutionOperationListOfFunctionsArgumentRef=jh,y.parallelExecutionOperationListOfFunctionsBlueprint=$h,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=Lh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInputParentRef=Nh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=gh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutputParentRef=Mh,y.parallelExecutionOperationListOfFunctionsBlueprintParentRef=Uh,y.parallelExecutionOperationRef=Sh,y.parallelExecutionOperationRefThree=kh,y.persistedBuiltInBaseEntity=Pt,y.persistedBuiltInBaseEntityDatabaseProperty=Zn,y.persistedBuiltInBaseEntityDatabasePropertyDataType=mE,y.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=qP,y.persistedBuiltInBaseEntityDatabasePropertyParentRef=vE,y.persistedBuiltInBaseEntityDatabasePropertyRef=hE,y.persistedBuiltInBaseEntityPrimaryKeyProperty=qn,y.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=OE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=EE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=TE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=PE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=DE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=AE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=IE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=RE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=bE,y.processOutputGlobalValueDescriptorDataType=XE,y.processOutputGlobalValueDescriptorReturn=po,y.processOutputGlobalValueDescriptorReturnRef=KE,y.projectPublicationCompletedGlobalEvent=uo,y.propertyToZodSchema=hI,y.relationalDatabaseBuiltInBaseEntity=Nr,y.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=Jl,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=pE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=uE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=cE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=lE,y.relationalDatabaseBuiltInBaseEntityDefaultProperty=ql,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=dE,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=sE,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=oE,y.relationalDatabaseBuiltInBaseEntityIdentifierProperty=io,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=XT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=HT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=KT,y.relationalDatabaseBuiltInBaseEntityMinSizeProperty=so,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=aE,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=iE,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=nE,y.relationalDatabaseBuiltInBaseEntityPasswordProperty=ao,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=rE,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=ZP,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=tE,y.relationalDatabaseBuiltInBaseEntityRef=kn,y.relationalDatabaseBuiltInBaseEntityUsernameProperty=no,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=eE,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=kP,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=QT,y.resolveActionDescriptorName=Z1,y.resolveBaseEntityName=F1,y.resolveBuiltInBaseEntityDataTypeLabel=x1,y.resolveClonedEntityProject=ft,y.resolveConditionOperatorLabel=Bd,y.resolveDataType=wd,y.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=$c,y.resolveDataTypeLabel=Cd,y.resolveDefinitionEntityDataTypeLabel=G7,y.resolveEntityDataTypeLabel=j7,y.resolveEntityName=F,y.resolveFirstCallsSecond=Fq,y.resolveFirstWritesSecond=xq,y.resolvePrimaryKeyProperty=nJ,y.resolvePrimitiveEntityName=k1,y.resolveSearchName=S1,y.resolveVariableScope=L7,y.sequentialExecutionOperation=ti,y.sequentialExecutionOperationError=pm,y.sequentialExecutionOperationErrorParentRef=um,y.sequentialExecutionOperationListOfExecutionResultsDataType=om,y.sequentialExecutionOperationListOfExecutionResultsReturn=Rl,y.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=lm,y.sequentialExecutionOperationListOfExecutionResultsReturnRef=sm,y.sequentialExecutionOperationListOfFunctionsArgument=bl,y.sequentialExecutionOperationListOfFunctionsArgumentDatatype=am,y.sequentialExecutionOperationListOfFunctionsArgumentParentRef=dm,y.sequentialExecutionOperationListOfFunctionsArgumentRef=nm,y.sequentialExecutionOperationListOfFunctionsBlueprint=im,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=rm,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=tm,y.softDeletePersistedEntityMethod=JP,y.softDeletePersistedEntityMethodParentRef=wE,y.sortCallsBasedOnExecutionDependencies=VO,y.sortChildrenEntitiesBasedOnExecutionDependencies=jq,y.splitListOperation=ml,y.splitListOperationError=nh,y.splitListOperationErrorParentRef=ih,y.splitListOperationFirstOutputListDataType=Wy,y.splitListOperationFirstOutputListReturn=Qy,y.splitListOperationFirstOutputListReturnParentRef=Xy,y.splitListOperationFirstOutputListReturnRef=hl,y.splitListOperationInputListArgument=Yy,y.splitListOperationInputListArgumentParentRef=zy,y.splitListOperationInputListArgumentRef=ky,y.splitListOperationInputListDataType=Zy,y.splitListOperationSecondOutputListDataType=eh,y.splitListOperationSecondOutputListReturn=rh,y.splitListOperationSecondOutputListReturnParentRef=th,y.splitListOperationSplitIndexArgument=Ky,y.splitListOperationSplitIndexArgumentParentRef=Hy,y.splitListOperationSplitIndexArgumentRef=qy,y.splitListOperationSplitIndexDataType=Jy,y.splitStringOperation=fl,y.splitStringOperationError=Ry,y.splitStringOperationErrorParentRef=by,y.splitStringOperationFirstPartResultStringDataType=cy,y.splitStringOperationFirstPartResultStringReturn=Ay,y.splitStringOperationFirstPartResultStringReturnParentRef=Iy,y.splitStringOperationFirstPartResultStringReturnRef=py,y.splitStringOperationIndexArgument=Ty,y.splitStringOperationIndexArgumentParentRef=vy,y.splitStringOperationIndexArgumentRef=ly,y.splitStringOperationIndexDataType=uy,y.splitStringOperationSecondPartResultStringDataType=yy,y.splitStringOperationSecondPartResultStringReturn=xP,y.splitStringOperationSecondPartResultStringReturnParentRef=Ey,y.splitStringOperationSecondPartResultStringReturnRef=fy,y.splitStringOperationStringArgument=my,y.splitStringOperationStringArgumentParentRef=hy,y.splitStringOperationStringArgumentRef=oy,y.splitStringOperationStringDataType=dy,y.stringPrototype=ne,y.stringValueAutogenerationSchema=sp,y.suggestNewIdForEntity=Ic,y.test_primitive_entities_export=ZJ,y.toCamelCase=U7,y.toEntityState=nr,y.toKebabCase=G1,y.toLowerCaseKebabCase=Vd,y.toPascalCase=$7,y.untypedDataPrototype=Rt,y.updateErrorsList=ze,y.updateValueReader=Qq,y.urlDefaultValue=xm,y.uuidPrototype=Qr,y.validateArgumentDeclarationName=Tc,y.validateCalledByErrorIdInAction=Cq,y.validateCalledByIdInAction=Vq,y.validateCallers=hO,y.validateConditionEntityDeclaration=Mq,y.validateDataOperation=Qi,y.validateDataOperationDataToValidateArgument=Bm,y.validateDataOperationDataToValidateArgumentParentRef=Cm,y.validateDataOperationDataToValidateArgumentRef=wm,y.validateDataOperationDataToValidateDataType=Vm,y.validateDataOperationEntityToMatchTypeArgument=Nm,y.validateDataOperationEntityToMatchTypeArgumentParentRef=gm,y.validateDataOperationEntityToMatchTypeArgumentRef=_m,y.validateDataOperationEntityToMatchTypeDataType=Mm,y.validateDataOperationError=jm,y.validateDataOperationErrorParentRef=$m,y.validateDataOperationOutputEntityDeclaration=Um,y.validateDataOperationOutputEntityDeclarationParentRef=Lm,y.validateDefinitionEntityName=yc,y.validateEntryCaller=yO,y.validateErrorCaller=fO,y.validateFunctionCallDeclaration=vO,y.validateFunctionDeclarationName=hc,y.validateGeneratedEntityParentIsNotBuiltInEntity=Dq,y.validateGeneration=bq,y.validateGenerationTarget=ot,y.validateGenerationUpdate=Rq,y.validateLoopEntityDeclaration=gq,y.validateName=F7,y.validateOperationEntityDeclaration=TO,y.validatePropertyName=vc,y.validateReachability=fi,y.validateReadsValueInActionPayload=Bq,y.validateReferenceObject=gd,y.validateReferenceToOne=wc,y.validateReferences=Et,y.validateReturnDeclarationName=Ec,y.validateSuccessCaller=cO,y.validateValueReaderGenerationUpdate=ws,y.validateValueWritter=gc,y.validateVariableDeclarationName=mc,y.validateVariableInternalCallUse=Nc,y.valueAutogenerationCurrentDateAndTimeSchema=KR,y.valueAutogenerationGenericSchema=Qo,y.valueAutogenerationOptions=lp,y.valueAutogenerationOptionsSchema=HR,y.valueAutogenerationRandomBooleanSchema=ap,y.valueAutogenerationRandomDateBetweenSchema=sD,y.valueAutogenerationRandomDateFromSchema=nD,y.valueAutogenerationRandomDateSchema=rd,y.valueAutogenerationRandomDateUntilSchema=aD,y.valueAutogenerationRandomNumberBetweenSchema=eD,y.valueAutogenerationRandomNumberFromSchema=XR,y.valueAutogenerationRandomNumberSchema=ed,y.valueAutogenerationRandomNumberUntilSchema=QR,y.valueAutogenerationRandomSchema=ls,y.valueAutogenerationRandomTextBetweenSchema=iD,y.valueAutogenerationRandomTextFromSchema=tD,y.valueAutogenerationRandomTextSchema=td,y.valueAutogenerationRandomTextUntilSchema=rD,y.valueAutogenerationRangeValueTypesSchema=ds,y.valueAutogenerationUniqueSchema=np,y.waitOperation=Ft,y.waitOperationMillisecondsNumberArgument=Ki,y.waitOperationMillisecondsNumberArgumentRef=zh,y.waitOperationMillisecondsNumberDataType=Yh,y.waitOperationOperationError=Xh,y.waitOperationOperationErrorParentRef=Kh,y.waitOperationRef=Hh,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
408
+ Alternatively you can update the parent data-type entity with 'update' action to remove the existing value of the field.`,issue:null}))}return{errors:a,modifiedData:r}}get allBasePropertiesFromExtendedAndImplementedEntities(){return p([...this.extends.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract),...e],[]),...this.implements.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract),...e],[])])}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[]),...this.implements.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[])].filter(e=>!!e.abstract))}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new P({id:`${this.id}--${A.InvalidParentUpdate}`,code:A.InvalidParentUpdate,severity:D.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on an '${this.type}', must be the root project as it is a globally declared entity.`,issue:null})),{errors:t,modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(){const e=[],t=[],r=[],a=[];return Object.values(this.detachedDependents).forEach(d=>{const o=d.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),r.push(...o.removed),a.push(...o.affected)}),{updated:p(e),added:p(t),removed:p(r),affected:p(a),self:this}}onDetachedDependencyRemoved(e,t,r){const a=[],d=[],o=[],l=[];return t==="implements"&&this.removeImplementation(e),t==="extends"&&this.removeExtension(e),{updated:p(a),added:p(d),removed:p(o),affected:p(l),self:this}}onDetachedDependencyRestored(e,t,r){const a=[],d=[],o=[],l=[];return t==="implements"&&this.addImplementation(e),t==="extends"&&this.addExtension(e),{updated:p(a),added:p(d),removed:p(o),affected:p(l),self:this}}subscribeToDependencies(){return this.implements.forEach(e=>{hr.includes(e.type)||e.subscribeDependents([{entity:this,field:"implements"}])}),this.extends.forEach(e=>{hr.includes(e.type)||e.subscribeDependents([{entity:this,field:"extends"}])}),this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=I.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t,r;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new Le(this,this.project);return(r=this.knownVersions)==null||r.set(this.version,e),e.properties=this.properties,e.methods=this.methods,e.abstractMethods=this.abstractMethods,e.extends=this.extends,e.implements=this.implements,e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],r=[],a=[],d=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),r.push(...o.added),a.push(...o.removed)}return{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}async restoreVersion(e){var l;const t=[],r=[],a=[],d=[];if(this.version===e)return{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this};if(!this.knownVersions){const u=new Map;for(const[h,c]of this.knownVersions||new Map){if(u.set(h,c),c.activeVersion=!1,c.knownVersions)for(const[v,E]of c.knownVersions)u.set(v,E);c.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new Le(u,this.project)}return this.metaSync(o.toShallowJSON(),null),this.properties=o.properties,this.methods=o.methods,this.abstractMethods=o.abstractMethods,this.extends=o.extends,this.implements=o.implements,this.parent=o.parent,{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}hydrateAncestors(){const e=[],t=[],r=[],a=[];if(this.initialData.parent){const d=B(this.initialData.parent),o=this.project.get(d);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${d}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);return this.initialData.extends.forEach(d=>{const o=B(d),l=this.project.get(o);l&&(this.addExtension(l),l.type!==n.BuiltInBaseEntity&&e.push(l))}),this.initialData.implements.forEach(d=>{const o=B(d),l=this.project.get(o);l&&(this.addImplementation(l),l.type!==n.BuiltInBaseEntity&&e.push(l))}),{updated:p(e),added:p(t),removed:p(r),affected:p(a),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],r=[],a=[],d=[];this.initialized=!0,this.captureVersion();const{updated:o,added:l,removed:u,affected:h}=this.syncImplementationProperties(e);t.push(...o),r.push(...l),a.push(...u),d.push(...h);const{updated:c,added:v,removed:E,affected:O}=this.addExtendedProperties(e);return t.push(...c),r.push(...v),a.push(...E),d.push(...O),this.addSuggestions(),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}addSelfToProject(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"add-self-to-project"))){const t=[this],r=[],a=[],d=[];if(this.parent.type===n.DataType){const o=this.parent;o.entity=this,t.push(o)}else this.project.addDefinitionEntity(this);return this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}setParent(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"set-parent"))){var r;return((r=this.parent)==null?void 0:r.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,b.Updated),t==null||t.attemptAutoclose("set-parent",this.id))),this}addExtension(e){return this.extends.includes(e)||this.extends.push(e),this}removeExtension(e){return this.extends=this.extends.filter(t=>t.id!==e.id),this}addImplementation(e){return this.implements.includes(e)||this.implements.push(e),this}removeImplementation(e){return this.implements=this.implements.filter(t=>t.id!==e.id),this}removeProperty(e){return this.properties=this.properties.filter(t=>t.id!==e.id),this}addMethod(e){return this.methods.includes(e)||(this.methods.push(e),this.suggestedMethods=this.suggestedMethods.filter(t=>t.name!==e.name)),this}removeMethod(e){return this.methods=this.methods.filter(t=>t.id!==e.id),this}addProperty(e){return this.properties.includes(e)||(this.properties.push(e),this.suggestedProperties=this.suggestedProperties.filter(t=>t.name!==e.name)),this}addSuggestedProperty(e){return this.suggestedProperties.includes(e)||this.suggestedProperties.push(e),this}addSuggestedMethod(e){return this.suggestedMethods.includes(e)||this.suggestedMethods.push(e),this}removeSuggestedProperty(e){return this.suggestedProperties=this.suggestedProperties.filter(t=>t.id!==e.id),this}removeSuggestedMethod(e){return this.suggestedMethods=this.suggestedMethods.filter(t=>t.id!==e.id),this}addAbstractMethod(e){return this.abstractMethods.includes(e)||this.abstractMethods.push(e),this}removeAbstractMethod(e){return this.abstractMethods=this.abstractMethods.filter(t=>t.id!==e.id),this}initChildren(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.properties=this.initialData.properties.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.methods=this.initialData.methods.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.extends=this.initialData.extends.map(t=>V(t,this.project)),this.implements=this.initialData.implements.map(t=>V(t,this.project)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}syncImplementationProperties(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-implementation-properties"))){const t=[],r=[],a=[],d=[],o=this.properties,l=this.implementedPropertiesFromOriginalParents,u=[...this.allBasePropertiesFromExtendedAndImplementedEntities,...o];return l.filter(c=>!u.find(E=>{var O;return((O=E.implements)==null?void 0:O.id)===c.id})).forEach(c=>{if(this.properties.find(w=>{var C;return((C=w.implements)==null?void 0:C.id)===c.id}))return;const E=this.properties.find(w=>w.name===c.name&&!!w.abstract&&!w.implements);if(E){E.implements=c,E.abstract=!1;return}const O=c.clone(e,this,I.UUID.uuid());O.initChildren(e),r.push(O),e==null||e.add(O,b.Added),O.setImplements(c,e),O.metaSync({abstract:!1},e),this.addProperty(O)}),e==null||e.attemptAutoclose("sync-implementation-properties",this.id),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}addExtendedProperties(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"add-extended-properties"))){const t=[],r=[],a=[],d=[],o=this.properties,l=this.extendedPropertiesFromOriginalParents,u=l.filter(c=>l.find(E=>{var O;return((O=E.implements)==null?void 0:O.id)===c.id})?!1:!c.abstract),h=new Set(o.map(c=>c.name));return u.forEach(c=>{if(h.has(c.name))return;h.add(c.name);const v=c.clone(e,this,I.UUID.uuid());v.initChildren(e),r.push(v),e==null||e.add(v,b.Added),this.addProperty(v)}),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}addSuggestions(){return this.implements.forEach(e=>{$5(this,e).forEach(a=>{const d=a.toJSON();d.id=`_suggestion--parent--${this.id}--${a.id}`;const o=V(d,this.project);o.suggestion=!0,o.setParent(this,null),o.initChildren(null),this.addSuggestedProperty(o)}),j5(this,e).forEach(a=>{const d=`_suggestion--parent--${this.id}--${a.id}`,o=a.implementAsFunctionDeclaration(null,this,d),l=V(o,this.project);if(l.suggestion=!0,l.setParent(this,null),l.initChildren(null),this.methods=this.methods.filter(u=>u.id!==d),l.inputs.forEach(u=>{u.suggestion=!0}),l.returnStatements.length){const u=l.returnStatements[0];u.suggestion=!0,u.outputs.forEach(h=>{h.suggestion=!0})}this.addSuggestedMethod(l)})}),this}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-meta"))){const r=dt(this,e);return e.deleted===!0&&!this.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&this.deleted?t==null||t.add(this,b.Added):r&&(t==null||t.add(this,b.Updated)),super.metaSync(e),this.name=e.name||this.name,this.x=e.x||this.x,this.y=e.y||this.y,this.static=e.static||this.static,this.abstract=e.abstract||this.abstract,t==null||t.attemptAutoclose("sync-meta",this.id),this}async APILoad(e=L,...t){return await Le.repository.APILoad(this.id,...t),this}async APICreate(e=L,...t){return await Le.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=L,...t){return await Le.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=L,...t){return await Le.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=L,...t){return await Le.repository.APIClone(this.id,...t),this}async APILoadVersion(e=L,t,...r){return await Le.repository.APILoadVersion(this.id,t,...r)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"remove-entity"))){const r=[],a=[],d=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(a.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(l=>{const{updated:u,removed:h,added:c}=l.entity.onDetachedDependencyRemoved(this,l.field,t);r.push(...u),a.push(...h),d.push(...c)}),this.properties.forEach(l=>{const{updated:u,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...u),a.push(...h)}),this.methods.forEach(l=>{const{updated:u,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...u),a.push(...h)}),this.abstractMethods.forEach(l=>{const{updated:u,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...u),a.push(...h)}),this.suggestedProperties.forEach(l=>{const{updated:u,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...u),a.push(...h)}),this.suggestedMethods.forEach(l=>{const{updated:u,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...u),a.push(...h)}),!e){if(this.parent.type===n.Project)this.parent.removeDefinitionEntity(this);else if(this.parent.type===n.DataType){const l=this.parent.setEntity(null);r.push(l)}}return t==null||t.attemptAutoclose("remove-entity",this.id),{added:p(d),updated:p(r),removed:p(a),affected:p(o),self:this}}restore({}={},e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"restore-entity"))){const t=[],r=[],a=[],d=[];return e!=null&&e.hasAdded(this.id)?(e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),this.properties.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.methods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.abstractMethods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.suggestedProperties.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.suggestedMethods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:p(t),updated:p(r),removed:p(a),affected:p(d),self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.extends.flatMap(r=>r.toFlat(e)),...this.implements.flatMap(r=>r.toFlat(e)),...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e)),...this.parent.toFlat(e)])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.extends.flatMap(r=>r.toFlatIds(e)),...this.implements.flatMap(r=>r.toFlatIds(e)),...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e)),...this.parent.toFlatIds(e)])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),implements:this.implements.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e)),parent:this.parent.toReference()})}toJSONClone(e=Z){var r,a,d,o,l;let t;return(r=e.seenEntityMaps)!=null&&r.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||ct(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(d=e.seenEntities)!=null&&d.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:I.UUID.uuid(),createdAt:e.timestamp||T().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(u=>u.toJSONClone({...e,newId:null})),methods:this.methods.map(u=>u.toJSONClone({...e,newId:null})),abstractMethods:this.abstractMethods.map(u=>u.toJSONClone({...e,newId:null})),implements:this.implements.map(u=>u.type===n.BuiltInBaseEntity?u.toJSON():u.toJSONClone({...e,newId:null})),extends:this.extends.map(u=>u.type===n.BuiltInBaseEntity?u.toJSON():u.toJSONClone({...e,newId:null})),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+I.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,name:this.name,description:this.description,type:this.type,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(a=>a.toReference(e)),methods:this.methods.map(a=>a.toReference(e)),abstractMethods:this.abstractMethods.map(a=>a.toReference(e)),implements:this.implements.map(a=>a.toReference(e)),extends:this.extends.map(a=>a.toReference(e)),parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.toFlatJSON(e)),...this.implements.flatMap(r=>r.toFlatJSON(e)),...this.extends.flatMap(r=>r.toFlatJSON(e)),...this.parent.toFlatJSON(e)])}toGenerationTarget(){const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,name:this.name,description:this.description,type:this.type,static:this.static,abstract:this.abstract,extends:this.extends.map(t=>t.id),implements:this.implements.map(t=>t.id),parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.implements.filter(r=>r.type===n.DefinitionEntity).flatMap(r=>r.toFlatGenerationTarget(e)),...this.implements.filter(r=>r.type===n.DefinitionEntity).flatMap(r=>r.toFlatGenerationTarget(e)),...this.parent.toFlatGenerationTarget(e)])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){return this.errors=U5(this),{success:!0,error:null,data:null}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"clone-entity")),t=null,r=null,a=!0){var w,C,U;let d=ft(t,this);const o=this.toJSON(),l=r||I.UUID.uuid();o.properties=[],o.methods=[],o.abstractMethods=[];const u=l.split("-id"),h=u[u.length-1||0]||l;o.id=l,o.version=I.UUID.uuid(),o.createdAt=(e==null?void 0:e.timestamp)||T().toISOString(),o.author=(e==null?void 0:e.author)||"1",o.previousVersion=null,o.deleted=!1;const c=lt(o,d);t&&c.setParent(t,null),a&&c.subscribe(),c.initChildren(e),e==null||e.add(c,b.Added);const v=(w=this.properties)==null?void 0:w.map(G=>G.clone(e,c,I.UUID.uuid(),a));c.properties=v;const E=(C=this.methods)==null?void 0:C.map((G,_)=>G.clone(e,c,h+"-method-"+_+"-id",a));c.methods=E;const O=(U=this.abstractMethods)==null?void 0:U.map((G,_)=>G.clone(e,c,h+"-abstract-method-"+_+"-id",a));return c.abstractMethods=O,e==null||e.attemptAutoclose("clone-entity",this.id),c}getFunctionDeclaration(e){return this.methods.find(t=>t.id===e)}implement(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"implement-definition-entity")),r){const a=xd(this,e,t,r);return t==null||t.attemptAutoclose("implement-definition-entity",this.id),a}getAllInteractiveMethods(){const e=this.implements.filter(r=>r.type===n.DefinitionEntity||r.type===n.BuiltInBaseEntity&&r.interactive);return p([...this.methods,...this.extends.flatMap(r=>r.getAllInteractiveMethods()),...e.flatMap(r=>r.getAllInteractiveMethods())])}inferFromInputs(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"infer-definition-entity-from-inputs"))){const r=[],a=[],d=[],o=[];if(this.parent.type!==n.DataType||!this.parent.inferred)return t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};const l=[];e.forEach(c=>{l.find(E=>F(E,this.project)===F(c,this.project))||l.push(c)});const u=this.properties.filter(c=>!c.dataType);l.forEach(c=>{var U,G;const v=u.find(_=>F(_,this.project)===F(c,this.project));if(!v)return;const O=Pn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),w=kr(O,t),C=w==null?void 0:w.clone(t,v,I.UUID.uuid(),!0);if(C){const _=(U=v.dataType)==null?void 0:U.merge(C,t);v.dataType&&(_==null?void 0:_.self.id)!==v.dataType.id&&v.dataType.remove({ignoreUpstream:!1},t),C.id!==((G=_==null?void 0:_.self)==null?void 0:G.id)&&C.remove({ignoreUpstream:!1},t),_!=null&&_.self&&(_.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(_.self,b.Added),v.setDataType(_.self),t==null||t.add(v,b.Updated))}c.setDeclaration(v),t==null||t.add(c,b.Updated)});const h=[];return l.forEach(c=>{if(!c.declaration){h.push(c);return}}),h.length===0?(t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(h.forEach(c=>{var _,$,k,J;const v=this.properties.find(ee=>F(ee,this.project)===F(c,this.project));if(v){if(c.setDeclaration(v),!v.getDataType(t)){const pe=Pn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),Te=kr(pe),K=Te==null?void 0:Te.clone(t,v,I.UUID.uuid(),!0);if(K){const se=(_=v.dataType)==null?void 0:_.merge(K,t);v.dataType&&(se==null?void 0:se.self.id)!==v.dataType.id&&v.dataType.remove({ignoreUpstream:!1},t),K.id!==(($=se==null?void 0:se.self)==null?void 0:$.id)&&K.remove({ignoreUpstream:!1},t),se!=null&&se.self&&(se.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(se.self,b.Added),v.setDataType(se.self),t==null||t.add(v,b.Updated))}}return}const E={id:I.UUID.uuid(),type:n.Property,version:I.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||T().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,name:F(c,this.project),description:c.description,defaultValue:null,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,constant:!0,index:c.index,implements:null,dataType:null,parent:this.toReference()},O=V(E,this.project);O.setParent(this,t),O.initChildren(t),t==null||t.add(O,b.Added);const C=Pn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),U=kr(C),G=U==null?void 0:U.clone(t,O,I.UUID.uuid(),!0);if(G){const ee=(k=O.dataType)==null?void 0:k.merge(G,t);O.dataType&&(ee==null?void 0:ee.self.id)!==O.dataType.id&&O.dataType.remove({ignoreUpstream:!1},t),G.id!==((J=ee==null?void 0:ee.self)==null?void 0:J.id)&&G.remove({ignoreUpstream:!1},t),ee!=null&&ee.self&&(ee.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(ee.self,b.Added),O.setDataType(ee.self),t==null||t.add(O,b.Updated))}return this.addProperty(O),c.setDeclaration(O),t==null||t.add(c,b.Updated),O}),t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:p(r),updated:p(a),removed:p(d),affected:p(o),self:this})}};f(Le,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...r)=>null}),f(Le,"type",n.DefinitionEntity),f(Le,"USER_MANAGED_PARENT_TYPES",[n.Project,n.DataType]),f(Le,"PARENT_TYPES",[...Le.USER_MANAGED_PARENT_TYPES]),f(Le,"MUTABLE_BASE_PROPERTIES",["name","description","static","abstract"]),f(Le,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(Le,"BASE_PROPERTIES",[...Le.MUTABLE_BASE_PROPERTIES,...Le.INMUTABLE_BASE_PROPERTIES]),f(Le,"MUTABLE_META_PROPERTIES",[...Le.MUTABLE_BASE_PROPERTIES,"x","y"]),f(Le,"INMUTABLE_META_PROPERTIES",[...Le.INMUTABLE_BASE_PROPERTIES]),f(Le,"META_PROPERTIES",[...Le.MUTABLE_META_PROPERTIES,...Le.INMUTABLE_META_PROPERTIES]),f(Le,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),f(Le,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),f(Le,"UPSTREAM_PROPERTIES",[...Le.MUTABLE_UPSTREAM_PROPERTIES,...Le.INMUTABLE_UPSTREAM_PROPERTIES]),f(Le,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),f(Le,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(Le,"DOWNSTREAM_PROPERTIES",[...Le.MUTABLE_DOWNSTREAM_PROPERTIES,...Le.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(Le,"PROPERTIES",[...Le.META_PROPERTIES,...Le.UPSTREAM_PROPERTIES,...Le.DOWNSTREAM_PROPERTIES]);let Yi=Le;function pJ(i){const s=y6(),e=i.toJSON();s.safeParse(e).success;const r=[];return ze(i.errors,r)}const Ls=class Ls extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"version");f(this,"name");f(this,"description",null);f(this,"type",n.BuiltInBaseEntity);f(this,"abstract",!1);f(this,"static");f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"interactive",!1);f(this,"errors",[]);f(this,"project");this.initialData=this.initialData||e,this.project=this.project||t,this.id=this.id||e.id,this.version=this.version||e.version,this.name=this.name||e.name,this.static=this.static||e.static,this.interactive=this.interactive||e.interactive,this.abstract=e.abstract,this.properties=this.initialData.properties.map(r=>{const a=V(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=V(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=V(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.extends=this.initialData.extends.map(r=>V(r,this.project))}get allBasePropertiesFromExtendedAndImplementedEntities(){return p(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract);return[...e,...r]},[]))}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[])])}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(e=L,...t){return await Ls.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e)),...this.extends.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e)),...this.extends.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e))})}toReference(e=Z){return{id:this.id+"--"+I.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=Z){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(t=>t.toReference()),methods:this.methods.map(t=>t.toReference()),abstractMethods:this.abstractMethods.map(t=>t.toReference()),extends:this.extends.map(t=>t.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,interactive:this.interactive,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=pJ(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}implement(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),null,!0,"implement-built-in-base-entity")),r){const a=xd(this,e,t,r);return t==null||t.attemptAutoclose("implement-built-in-base-entity",this.id),a}getAllInteractiveMethods(){const e=[];return this.interactive&&(e.push(...this.methods),this.extends.filter(r=>r.type===n.BuiltInBaseEntity&&r.interactive||r.type===n.PrimitiveEntity).forEach(r=>{r instanceof Ls&&e.push(...r.getAllInteractiveMethods())})),p(e)}};f(Ls,"repository",{APILoad:async(e,...t)=>null});let zr=Ls;function cJ(i){const s=a6(),e=i.toJSON();s.safeParse(e).success;const r=[];return ze(i.errors,r)}const rl=class rl extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"name");f(this,"description",null);f(this,"type",n.PrimitiveEntity);f(this,"static");f(this,"abstract");f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"errors",[]);f(this,"project");this.initialData=e,this.project=t,this.id=e.id,this.name=e.name,this.static=e.static,this.abstract=e.abstract,this.properties=this.initialData.properties.map(r=>{const a=V(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=V(r,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=V(r,this.project);return a.parent=this,a})}get allBasePropertiesFromExtendedAndImplementedEntities(){return p(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract);return[...e,...r]},[]))}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[])])}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(e=L,...t){return await rl.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e))})}toReference(e=Z){return{id:this.id+"--"+I.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=Z){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,properties:this.properties.map(t=>t.toReference()),methods:this.methods.map(t=>t.toReference()),abstractMethods:this.abstractMethods.map(t=>t.toReference()),extends:this.extends.map(t=>t.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=cJ(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}getAllInteractiveMethods(){const e=[];return e.push(...this.methods),this.extends.filter(r=>r.type===n.BuiltInBaseEntity&&r.interactive||r.type===n.PrimitiveEntity).forEach(r=>{r instanceof zr&&e.push(...r.getAllInteractiveMethods())}),p(e)}};f(rl,"repository",{APILoad:async(e,...t)=>null});let ar=rl;function lt(i,s){if(!i)throw new Error("Entity is null");const e=s.get(i.id);switch(i.type){case n.LiteralValue:return e||new _n(i,s);case n.DefinitionEntity:return e||new Yi(i,s);case n.PrimitiveEntity:return e||new ar(i,s);case n.FunctionDeclaration:return e||new Mi(i,s);case n.GlobalEvent:return e||new Vn(i,s);case n.DataType:return e||new wn(i,s);case n.Property:return e||new Bi(i,s);case n.FunctionCall:return e||new qi(i,s);case n.Condition:return e||new Li(i,s);case n.Operation:return e||new gi(i,s);case n.VariableDeclaration:return e||new $i(i,s);case n.VariableInstance:return e||new Ui(i,s);case n.OutputMap:return e||new qr(i,s);case n.ReturnDeclaration:return e||new rr(i,s);case n.ArgumentDeclaration:return e||new Fi(i,s);case n.InputMap:return e||new Zr(i,s);case n.Project:return e||new I(i);case n.InstalledProject:return e||new Gi(i,s);case n.ActionDescriptor:return e||new qe(i,s);case n.ReturnStatement:return e||new _i(i,s);case n.Loop:return e||new Ni(i,s);case n.Search:return e||new ji(i,s);case n.ValueDescriptor:return e||new xi(i,s);case n.BuiltInBaseEntity:return e||new zr(i,s);case n.InternalCall:return e||new Bn(i,s);case n.ContinueStatement:return e||new jt(i,s);case n.BreakStatement:return e||new Cn(i,s);case n.GenericReference:return s.get(i.entityId);default:throw new Error("Invalid entity type: "+i.type)}}function V(i,s){if(!i)throw new Error("Entity is null");const e=lt(i,s);return e.subscribe(),e}function fJ(i,s){if(!i)throw new Error("Entity is null");switch(i.type){case n.LiteralValue:return _n.fromGenerationTarget(i,s);case n.DefinitionEntity:return Yi.fromGenerationTarget(i,s);case n.FunctionDeclaration:return Mi.fromGenerationTarget(i,s);case n.GlobalEvent:return Vn.fromGenerationTarget(i,s);case n.DataType:return wn.fromGenerationTarget(i,s);case n.Property:return Bi.fromGenerationTarget(i,s);case n.FunctionCall:return qi.fromGenerationTarget(i,s);case n.Condition:return Li.fromGenerationTarget(i,s);case n.Operation:return gi.fromGenerationTarget(i,s);case n.VariableDeclaration:return $i.fromGenerationTarget(i,s);case n.VariableInstance:return Ui.fromGenerationTarget(i,s);case n.OutputMap:return qr.fromGenerationTarget(i,s);case n.ReturnDeclaration:return rr.fromGenerationTarget(i,s);case n.ArgumentDeclaration:return Fi.fromGenerationTarget(i,s);case n.InputMap:return Zr.fromGenerationTarget(i,s);case n.InstalledProject:return Gi.fromGenerationTarget(i,s);case n.ReturnStatement:return _i.fromGenerationTarget(i,s);case n.Loop:return Ni.fromGenerationTarget(i,s);case n.Search:return ji.fromGenerationTarget(i,s);case n.ActionDescriptor:return qe.fromGenerationTarget(i,s);case n.ValueDescriptor:return xi.fromGenerationTarget(i,s);case n.InternalCall:return Bn.fromGenerationTarget(i,s);case n.ContinueStatement:return jt.fromGenerationTarget(i,s);case n.BreakStatement:return Cn.fromGenerationTarget(i,s);default:throw new Error("Invalid entity type: "+i.type)}}const Z={seenEntityMaps:new Map,seenEntities:new Set,timestamp:T().toISOString()};class PP{constructor(){f(this,"initialData")}}const L={cascade:!1},wP={APILoad:async(i,...s)=>null},yJ={APICreate:async(i,...s)=>i,APIUpdate:async(i,...s)=>i,APIDelete:async(i,...s)=>i,APIClone:async(i,...s)=>{},APILoadVersion:async(i,s,...e)=>null,...wP};class hJ{}class mJ extends PP{}class vJ{}class TJ{}class EJ{}class Hc{}class IJ extends Hc{}class AJ extends Hc{}class bJ{}class yi{static initReadsValue(s){if(s.initialData.readsValue&&s.initialData.readsValue.type!==n.GenericReference)s.readsValue=V(s.initialData.readsValue,s.project);else if(s.initialData.readsValue&&s.initialData.readsValue.type===n.GenericReference){const e=nr(s.initialData.readsValue,s.project);e&&(s.readsValue=e)}if(s.readsValue){if(Qe.includes(s.readsValue.type)){let e=s.parent;mt.includes(e.type)||(e=e.parent);const t=s.type===n.InputMap&&s.parent.type===n.Loop;t&&(e=s.parent.parent),s.readsValue.setParent(e,null),s.readsValue.initChildren(null),!t&&e.detachedChildren.includes(s)?e.replaceDetachedChild(s,s.readsValue):t||e.subscribeDetachedChild(s.readsValue)}s.readsValue.addValueReader(s)}return s.readsValue}static hydrateReadsValue(s){if(s.initialData.readsValue&&s.initialData.readsValue.type!==n.GenericReference)s.readsValue=V(s.initialData.readsValue,s.project);else if(s.initialData.readsValue&&s.initialData.readsValue.type===n.GenericReference){const e=nr(s.initialData.readsValue,s.project);e&&(s.readsValue=e)}if(s.readsValue){if(Qe.includes(s.readsValue.type)){let e=s.parent;mt.includes(e.type)||(e=e.parent);const t=s.type===n.InputMap&&s.parent.type===n.Loop;t&&(e=s.parent.parent),s.readsValue.setParent(e,null),!t&&e.detachedChildren.includes(s)?e.replaceDetachedChild(s,s.readsValue):t||e.subscribeDetachedChild(s.readsValue)}s.readsValue.addValueReader(s)}return s.readsValue}}class gs{static initWritesValues(s,e){const t=s.initialData.writesValues.reduce((a,d)=>{if(d.type===n.GenericReference||s.writesValues.some(l=>l.id===d.id))return a;const o=V(d,s.project);return o.setValueWriter(s),Qe.includes(o.type)&&(o.setParent(e,null),o.initChildren(null)),[...a,o]},[]),r=[...s.writesValues];return s.writesValues=p([...r,...t]),s.writesValues}}class RJ{}const oe=class oe extends rt{constructor(e){super(e);f(this,"initialData");f(this,"id");f(this,"type",n.Project);f(this,"name",null);f(this,"description",null);f(this,"x");f(this,"y");f(this,"entities",[]);f(this,"projects",[]);f(this,"functions",[]);f(this,"events",[]);f(this,"variableDeclarations",[]);f(this,"variableInstances",[]);f(this,"conditions",[]);f(this,"operations",[]);f(this,"functionCalls",[]);f(this,"loops",[]);f(this,"searches",[]);f(this,"primitives",[]);f(this,"builtInBaseEntities",[]);f(this,"operationDeclarations",[]);f(this,"globalEventActionDescriptors",[]);f(this,"loopDeclarations",[]);f(this,"loopDeclarationsBodies",[]);f(this,"conditionDeclarations",[]);f(this,"valueDescriptors",[]);f(this,"dataTypes",[]);f(this,"project");f(this,"instances",{});f(this,"builtInInstances",{});f(this,"deletedInstances",{});f(this,"errors",[]);f(this,"references",[]);f(this,"history",[]);f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"onCloseChangeSetCallback",null);this.initialData=e,this.id=e.id,this.name=e.name,this.description=e.description,this.x=0,this.y=0,this.instances[this.id]=this;try{(!oe.UUID||oe.UUID.isBackup)&&(oe.UUID=Uo==null?void 0:Uo()),oe.UUID||(oe.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:t=>t})}catch(t){console.error("Error initializing UUID module",t),oe.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:r=>r}}}static injectUUIDModule(e){oe.UUID=e}static validateGenerationTarget(e,t){let r=JSON.parse(JSON.stringify(e));const a=[];return a.push(...ot(r)),{errors:a,modifiedData:r}}async closePendingCallbacks(){console.log("Closing pending callbacks");for(let e=0;e<this.history.length;e++){const t=this.history[e];t.dirty&&await t.closeAsync()}}async onCloseChangeSet(e){this.onCloseChangeSetCallback=e,await this.closePendingCallbacks()}async closeChangeSet(e){if(this.onCloseChangeSetCallback){const t=await this.onCloseChangeSetCallback(e);return t.success&&(e.dirty=!1),t}return{success:!1}}addChangeSet(e){if(!this.history.length)return this.history.push(e),e;const t=this.history.find(a=>a.id===(e==null?void 0:e.id));if(t)return t;const r=this.history.findIndex(a=>T(a.timestamp).isBefore(T(e==null?void 0:e.timestamp)));return r===-1?this.history.push(e):this.history.splice(r,0,e),e}discardChangeSet(e){const t=this.history.findIndex(r=>r.id===(e==null?void 0:e.id));return t!==-1&&this.history.splice(t,1),this}undo(){const e=[],t=[],r=[],a=[];return{updated:p(e),added:p(t),removed:p(r),affected:p(a),self:this}}redo(){const e=[],t=[],r=[],a=[];return{updated:p(e),added:p(t),removed:p(r),affected:p(a),self:this}}async inject(...e){return await Promise.all(e.map(t=>new Promise(async r=>{await t.init(this),r(null)}))),this}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(){const e=[],t=[],r=[],a=[];return Object.values(this.detachedDependents).forEach(d=>{const o=d.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),r.push(...o.removed),a.push(...o.affected)}),{updated:p(e),added:p(t),removed:p(r),affected:p(a),self:this}}onDetachedDependencyRemoved(e,t,r){const a=[],d=[],o=[],l=[];return{updated:p(a),added:p(d),removed:p(o),affected:p(l),self:this}}onDetachedDependencyRestored(e,t,r){const a=[],d=[],o=[],l=[];return{updated:p(a),added:p(d),removed:p(o),affected:p(l),self:this}}subscribeToDependencies(){return this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=oe.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t,r;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new oe(this);return(r=this.knownVersions)==null||r.set(this.version,e),e.entities=this.entities,e.projects=this.projects,e.functions=this.functions,e.events=this.events,e.variableDeclarations=this.variableDeclarations,e.variableInstances=this.variableInstances,e.conditions=this.conditions,e.operations=this.operations,e.functionCalls=this.functionCalls,e.loops=this.loops,e.searches=this.searches,this}recursiveCaptureUpstreamVersions(e){const t=[],r=[],a=[],d=[];return{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}async restoreVersion(e){var l;const t=[],r=[],a=[],d=[];if(this.version===e)return{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this};if(!this.knownVersions){const u=new Map;for(const[h,c]of this.knownVersions||new Map){if(u.set(h,c),c.activeVersion=!1,c.knownVersions)for(const[v,E]of c.knownVersions)u.set(v,E);c.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new oe(u)}return this.metaSync(o.toShallowJSON(),null),this.entities=o.entities,this.projects=o.projects,this.functions=o.functions,this.events=o.events,this.variableDeclarations=o.variableDeclarations,this.variableInstances=o.variableInstances,this.conditions=o.conditions,this.operations=o.operations,this.functionCalls=o.functionCalls,this.loops=o.loops,this.searches=o.searches,{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}hydrateAncestors(){const e=[],t=[],r=[],a=[];return{updated:p(e),added:p(t),removed:p(r),affected:p(a),self:this}}afterAllChildrenInitialized(e=null){const t=[],r=[],a=[],d=[];return this.initialized=!0,this.captureVersion(),this.validate(),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}addSelfToProject(e){const t=[],r=[],a=[],d=[];return this.subscribe(),this.subscribeToDependencies(),{updated:p(t),added:p(r),removed:p(a),affected:p(d),self:this}}get instancesList(){return Object.values(this.instances)}isOperationDeclaration(e){return this.operationDeclarations.includes(e)}isGlobalEventActionDescriptor(e){return this.globalEventActionDescriptors.includes(e)}isLoopDeclaration(e){return this.loopDeclarations.includes(e)}isConditionDeclaration(e){return this.conditionDeclarations.includes(e)}initChildren(e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.entities=this.initialData.entities.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.projects=this.initialData.projects.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.variableDeclarations=this.initialData.variableDeclarations.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.variableInstances=this.initialData.variableInstances.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.conditions=this.initialData.conditions.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.operations=this.initialData.operations.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.functions=this.initialData.functions.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.events=this.initialData.events.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.functionCalls=this.initialData.functionCalls.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.loops=this.initialData.loops.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.searches=this.initialData.searches.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.attachOrphanReferences(),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}subscribeInstance(e){return(!this.instances[e.id]||this.instances[e.id]!==e)&&(this.instances[e.id]=e),this}subscribeDeletedInstance(e){return(!this.deletedInstances[e.id]||this.deletedInstances[e.id]!==e)&&(this.deletedInstances[e.id]=e),this}subscribeBuiltInInstance(e){return(!this.builtInInstances[e.id]||this.builtInInstances[e.id]!==e)&&(this.builtInInstances[e.id]=e),this}subscribe(){return this}unsubscribe(){return this}unsubscribeInstance(e){return delete this.instances[e.id],this}unsubscribeDeletedInstance(e){return delete this.deletedInstances[e.id],this}findSubscribedBuiltInInstance(e){return this.builtInInstances[e.id]||null}get(e){return this.instances[e]||this.builtInInstances[e]||null}getDeleted(e){return this.deletedInstances[e]||null}getManaged(e){return this.getBuiltIn(e)?null:this.instances[e]||null}getBuiltIn(e){return this.builtInInstances[e]||null}findSubscribedInstanceFromReference(e){return this.instances[e.entityId]||null}findSubscribedBuiltInInstanceFromReference(e){return this.builtInInstances[e.entityId]||null}metaSync(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-meta"))){const r=dt(this,e);return e.deleted===!0&&!this.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&this.deleted?t==null||t.add(this,b.Added):r&&(t==null||t.add(this,b.Updated)),super.metaSync(e),this.name=e.name||this.name,this.description=e.description||this.description,this.x=e.x||this.x,this.y=e.y||this.y,t==null||t.attemptAutoclose("sync-meta",this.id),this}async APILoad(e=L,...t){return await oe.repository.APILoad(this.id,...t),this}async APICreate(e=L,...t){return await oe.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=L,...t){return await oe.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=L,...t){return await oe.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=L,...t){return await oe.repository.APIClone(this.id,...t),this}async APILoadVersion(e=L,t,...r){return await oe.repository.APILoadVersion(this.id,t,...r)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"remove-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}restore({}={},e=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"restore-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}getAllBuiltInIds(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlatIds(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlatIds(e)),...this.operationDeclarations.flatMap(t=>t.toFlatIds(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlatIds(e)),...this.loopDeclarations.flatMap(t=>t.toFlatIds(e)),...this.conditionDeclarations.flatMap(t=>t.toFlatIds(e)),...this.valueDescriptors.flatMap(t=>t.toFlatIds(e)),...this.dataTypes.flatMap(t=>t.toFlatIds(e))]}getAllBuiltIn(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlat(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlat(e)),...this.operationDeclarations.flatMap(t=>t.toFlat(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlat(e)),...this.loopDeclarations.flatMap(t=>t.toFlat(e)),...this.conditionDeclarations.flatMap(t=>t.toFlat(e)),...this.valueDescriptors.flatMap(t=>t.toFlat(e)),...this.dataTypes.flatMap(t=>t.toFlat(e))]}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.entities.flatMap(r=>r.toFlat(e)),...this.functions.flatMap(r=>r.toFlat(e)),...this.events.flatMap(r=>r.toFlat(e)),...this.projects.flatMap(r=>r.toFlat(e)),...this.variableDeclarations.flatMap(r=>r.toFlat(e)),...this.variableInstances.flatMap(r=>r.toFlat(e)),...this.conditions.flatMap(r=>r.toFlat(e)),...this.operations.flatMap(r=>r.toFlat(e)),...this.functionCalls.flatMap(r=>r.toFlat(e)),...this.loops.flatMap(r=>r.toFlat(e)),...this.searches.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.entities.flatMap(r=>r.toFlatIds(e)),...this.functions.flatMap(r=>r.toFlatIds(e)),...this.events.flatMap(r=>r.toFlatIds(e)),...this.projects.flatMap(r=>r.toFlatIds(e)),...this.variableDeclarations.flatMap(r=>r.toFlatIds(e)),...this.variableInstances.flatMap(r=>r.toFlatIds(e)),...this.conditions.flatMap(r=>r.toFlatIds(e)),...this.operations.flatMap(r=>r.toFlatIds(e)),...this.functionCalls.flatMap(r=>r.toFlatIds(e)),...this.loops.flatMap(r=>r.toFlatIds(e)),...this.searches.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(t=>t.toJSON(e)),variableDeclarations:this.variableDeclarations.map(t=>t.toJSON(e)),variableInstances:this.variableInstances.map(t=>t.toJSON(e)),conditions:this.conditions.map(t=>t.toJSON(e)),operations:this.operations.map(t=>t.toJSON(e)),loops:this.loops.map(t=>t.toJSON(e)),searches:this.searches.map(t=>t.toJSON(e)),functions:this.functions.map(t=>t.toJSON(e)),events:this.events.map(t=>t.toJSON(e)),projects:this.projects.map(t=>t.toJSON(e)),functionCalls:this.functionCalls.map(t=>t.toJSON(e))})}toJSONClone(e={uuidStrategy:"uuid"}){const t=new Map,r=new Set,a=this.getAllBuiltInIds();return Object.keys(this.instances).forEach(d=>{if(a.includes(d)){t.set(d,d);return}t.set(d,oe.UUID.uuid())}),r.add(this.id),{id:t.get(this.id),version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),projects:this.projects.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),variableDeclarations:this.variableDeclarations.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),variableInstances:this.variableInstances.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),conditions:this.conditions.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),operations:this.operations.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),functions:this.functions.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),events:this.events.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),functionCalls:this.functionCalls.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),loops:this.loops.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),searches:this.searches.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null}))}}toReference(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+oe.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(a=>a.toReference(e)),functions:this.functions.map(a=>a.toReference(e)),events:this.events.map(a=>a.toReference(e)),projects:this.projects.map(a=>a.toReference(e)),variableDeclarations:this.variableDeclarations.map(a=>a.toReference(e)),variableInstances:this.variableInstances.map(a=>a.toReference(e)),conditions:this.conditions.map(a=>a.toReference(e)),operations:this.operations.map(a=>a.toReference(e)),functionCalls:this.functionCalls.map(a=>a.toReference(e)),loops:this.loops.map(a=>a.toReference(e)),searches:this.searches.map(a=>a.toReference(e))}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.entities.flatMap(r=>r.toFlatJSON(e)),...this.functions.flatMap(r=>r.toFlatJSON(e)),...this.events.flatMap(r=>r.toFlatJSON(e)),...this.projects.flatMap(r=>r.toFlatJSON(e)),...this.variableDeclarations.flatMap(r=>r.toFlatJSON(e)),...this.variableInstances.flatMap(r=>r.toFlatJSON(e)),...this.conditions.flatMap(r=>r.toFlatJSON(e)),...this.operations.flatMap(r=>r.toFlatJSON(e)),...this.functionCalls.flatMap(r=>r.toFlatJSON(e)),...this.loops.flatMap(r=>r.toFlatJSON(e)),...this.searches.flatMap(r=>r.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[...this.entities.flatMap(r=>r.toFlatGenerationTarget(e)),...this.functions.flatMap(r=>r.toFlatGenerationTarget(e)),...this.events.flatMap(r=>r.toFlatGenerationTarget(e)),...this.projects.flatMap(r=>r.toFlatGenerationTarget(e)),...this.variableDeclarations.flatMap(r=>r.toFlatGenerationTarget(e)),...this.variableInstances.flatMap(r=>r.toFlatGenerationTarget(e)),...this.conditions.flatMap(r=>r.toFlatGenerationTarget(e)),...this.operations.flatMap(r=>r.toFlatGenerationTarget(e)),...this.functionCalls.flatMap(r=>r.toFlatGenerationTarget(e)),...this.loops.flatMap(r=>r.toFlatGenerationTarget(e)),...this.searches.flatMap(r=>r.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.entities.forEach(e=>e.clearErrors()),this.projects.forEach(e=>e.clearErrors()),this.functions.forEach(e=>e.clearErrors()),this.events.forEach(e=>e.clearErrors()),this.variableDeclarations.forEach(e=>e.clearErrors()),this.variableInstances.forEach(e=>e.clearErrors()),this.conditions.forEach(e=>e.clearErrors()),this.operations.forEach(e=>e.clearErrors()),this.functionCalls.forEach(e=>e.clearErrors()),this.loops.forEach(e=>e.clearErrors()),this.searches.forEach(e=>e.clearErrors()),this}validate(){const e=B5(),t=this.toJSON();return e.safeParse(t),this.validateChildren(),{success:!0,error:null,data:t}}validateChildren(){this.entities.forEach(e=>e.validate()),this.projects.forEach(e=>e.validate()),this.functions.forEach(e=>e.validate()),this.events.forEach(e=>e.validate()),this.variableDeclarations.forEach(e=>e.validate()),this.variableInstances.forEach(e=>e.validate()),this.conditions.forEach(e=>e.validate()),this.operations.forEach(e=>e.validate()),this.functionCalls.forEach(e=>e.validate()),this.loops.forEach(e=>e.validate()),this.searches.forEach(e=>e.validate())}getErrors(){return[...this.errors,...this.entities.flatMap(t=>t.getErrors()),...this.projects.flatMap(t=>t.getErrors()),...this.functions.flatMap(t=>t.getErrors()),...this.events.flatMap(t=>t.getErrors()),...this.variableDeclarations.flatMap(t=>t.getErrors()),...this.variableInstances.flatMap(t=>t.getErrors()),...this.conditions.flatMap(t=>t.getErrors()),...this.operations.flatMap(t=>t.getErrors()),...this.functionCalls.flatMap(t=>t.getErrors()),...this.loops.flatMap(t=>t.getErrors()),...this.searches.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(){return this}getDefinitionEntity(e){return this.entities.find(t=>t.id===e)||null}addDefinitionEntityFromTransfer(e){const t=V(e,this);return this.addDefinitionEntity(t),t}addDefinitionEntity(e){return this.entities.includes(e)||this.entities.push(e),e}addFunctionDeclarationFromTransfer(e){const t=V(e,this);return this.addFunctionDeclaration(t),t}addFunctionDeclaration(e){return this.functions.includes(e)||this.functions.push(e),e}addFunctionCallFromTransfer(e){const t=V(e,this);return this.addFunctionCall(t),t}addFunctionCall(e){return this.functionCalls.includes(e)||this.functionCalls.push(e),e}addVariableDeclarationFromTransfer(e){const t=V(e,this);return this.addVariableDeclaration(t),t}addVariableDeclaration(e){return this.variableDeclarations.includes(e)||this.variableDeclarations.push(e),e}addVariableInstanceFromTransfer(e){const t=V(e,this);return this.addVariableInstance(t),t}addVariableInstance(e){return this.variableInstances.includes(e)||this.variableInstances.push(e),e}addInstalledProjectFromTransfer(e){const t=V(e,this);return this.addInstalledProject(t),this}addInstalledProject(e){return this.projects.includes(e)||this.projects.push(e),this}addGlobalEventFromTransfer(e){const t=V(e,this);return this.addGlobalEvent(t),this}addGlobalEvent(e){return this.events.includes(e)||this.events.push(e),this}addConditionFromTransfer(e){const t=V(e,this);return this.addCondition(t),this}addCondition(e){return this.conditions.includes(e)||this.conditions.push(e),this}addOperationFromTransfer(e){const t=V(e,this);return this.addOperation(t),this}addOperation(e){return this.operations.includes(e)||this.operations.push(e),this}addLoopFromTransfer(e){const t=V(e,this);return this.addLoop(t),this}addLoop(e){return this.loops.includes(e)||this.loops.push(e),this}addSearchFromTransfer(e){const t=V(e,this);return this.addSearch(t),this}addSearch(e){return this.searches.includes(e)||this.searches.push(e),this}removeDefinitionEntity(e){const t=this.entities.findIndex(r=>r.id===e.id);if(t>-1){const r=this.entities[t];return this.entities.splice(t,1),r}return null}removeFunctionDeclaration(e){const t=this.functions.findIndex(r=>r.id===e.id);if(t>-1){const r=this.functions[t];return this.functions.splice(t,1),r}return null}removeExternalProject(e){const t=this.projects.findIndex(r=>r.id===e.id);if(t>-1){const r=this.projects[t];return this.projects.splice(t,1),r}return null}removeGlobalEvent(e){const t=this.events.findIndex(r=>r.id===e.id);if(t>-1){const r=this.events[t];return this.events.splice(t,1),r}return null}removeTopLevelVariableDeclaration(e){if(e.type!==n.VariableDeclaration)return null;const t=this.variableDeclarations.findIndex(r=>r.id===e.id);if(t>-1){const r=this.variableDeclarations[t];return this.variableDeclarations.splice(t,1),r}return null}getEntryPoints(){return[...this.functions,...this.events,...this.entities.flatMap(t=>t.methods)]}getFunctionDeclaration(e){return this.functions.find(t=>t.id===e)||null}getConditions(){return[...this.conditions,...this.getEntryPoints().reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.functionCalls.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.operations.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.functionCalls.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.conditions.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.conditions.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.operations.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.functionCalls.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.conditions.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.operations.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.loops.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.searches.reduce((t,r)=>{const a=We(r);return[...t,...a]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.functionCalls.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.conditions.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.operations.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.loops.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.searches.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[])]}getVariableDeclarations(){return p([...this.variableDeclarations,...this.getEntryPoints().reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.functionCalls.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.conditions.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.operations.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.loops.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.searches.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[])])}attachOrphanReferences(){const e=this.getVariableInstances(),t=this.getVariableDeclarations();return e.forEach(r=>{if(!r.declaration){const a=r.initialData,d=a.declaration.entityId||a.declaration.id,o=t.find(l=>l.id===d);o&&r.setDeclaration(o)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(e=>e.name===Y.PERSISTED_ENTITY)||null}};f(oe,"sessionAuthor","1"),f(oe,"UUID",{isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:e=>e}),f(oe,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...r)=>null}),f(oe,"type",n.Project),f(oe,"USER_MANAGED_PARENT_TYPES",[]),f(oe,"PARENT_TYPES",[...oe.USER_MANAGED_PARENT_TYPES]),f(oe,"MUTABLE_BASE_PROPERTIES",["name","description"]),f(oe,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(oe,"BASE_PROPERTIES",[...oe.MUTABLE_BASE_PROPERTIES,...oe.INMUTABLE_BASE_PROPERTIES]),f(oe,"MUTABLE_META_PROPERTIES",[...oe.MUTABLE_BASE_PROPERTIES,"x","y"]),f(oe,"INMUTABLE_META_PROPERTIES",[...oe.INMUTABLE_BASE_PROPERTIES]),f(oe,"META_PROPERTIES",[...oe.MUTABLE_META_PROPERTIES,...oe.INMUTABLE_META_PROPERTIES]),f(oe,"MUTABLE_UPSTREAM_PROPERTIES",[]),f(oe,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),f(oe,"UPSTREAM_PROPERTIES",[...oe.MUTABLE_UPSTREAM_PROPERTIES,...oe.INMUTABLE_UPSTREAM_PROPERTIES]),f(oe,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),f(oe,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(oe,"DOWNSTREAM_PROPERTIES",[...oe.MUTABLE_DOWNSTREAM_PROPERTIES,...oe.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(oe,"PROPERTIES",[...oe.META_PROPERTIES,...oe.UPSTREAM_PROPERTIES,...oe.DOWNSTREAM_PROPERTIES]);let I=oe;var VP=(i=>(i.PersistChangeSet="persist-change-set",i.CreateSingle="create-single",i.CreateBulk="create-bulk",i.CreateSingleNested="create-single-nested",i.CreateBulkNested="create-bulk-nested",i.Update="update",i.Clone="clone",i.Delete="delete",i.Load="load",i.LoadNested="load-nested",i.LoadVersion="load-version",i))(VP||{});class CP extends qe{constructor(e){super(br,e);f(this,"id",He.Parallel);f(this,"name",He.Parallel);f(this,"description","Execute a list of actions one after the other");f(this,"version","1");f(this,"autoexecutable",!0);f(this,"initialData",br);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=br.inputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=br.outputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=br.error?V(br.error,this.project):null}}class BP extends qe{constructor(e){super(Ft,e);f(this,"id",Ft.id);f(this,"name",Ft.name);f(this,"description",Ft.description);f(this,"version",Ft.version);f(this,"autoexecutable",!1);f(this,"initialData",Ft);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=Ft.inputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=Ft.outputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=Ft.error?V(Ft.error,this.project):null}}class _P extends qe{constructor(e){super(ti,e);f(this,"id",He.Sequential);f(this,"name",He.Sequential);f(this,"description","Execute a list of actions one after the other");f(this,"version","1");f(this,"autoexecutable",!0);f(this,"initialData",ti);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=ti.inputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=ti.outputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=ti.error?V(ti.error,this.project):null}}class DJ extends qe{constructor(s){super(wa,s)}}class OJ extends qe{constructor(s){super(Xi,s)}}class PJ extends qe{constructor(e){super(Qi,e);f(this,"autoexecutable",!0)}getEntityToMatchInputMap(e){return e.inputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===x.operation[Ke.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(e){return e.inputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===x.operation[Ke.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(e){return e.outputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===x.operation[Ke.Validate].outputs.outputEntity.id})||null}getEntityToMatch(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"get-entity-to-match-validate-data"))){let r=null;if(e.readsValue){const d=e.readsValue.getDataType(t);d&&d.entity&&d.entity.type===n.DefinitionEntity&&(r=d.entity)}const a=e.getDefaultValue();return!r&&a&&a.valueAsTypeSingle&&!Array.isArray(a.valueAsTypeSingle)&&a.valueAsTypeSingle.type===n.DefinitionEntity&&(r=a.valueAsTypeSingle),r}syncOperationInstance(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-operation-instance-validate-data"))){const r=[],a=[],d=[],o=[],l=this.getEntityToMatchInputMap(e);if(l){const{added:c,updated:v,removed:E,affected:O}=this.syncEntityToMatchInputMapDataType(l,t);r.push(...v),a.push(...c),d.push(...E),o.push(...O)}const u=this.getDataToValidateInputMap(e);if(u){const{added:c,updated:v,removed:E,affected:O}=this.syncDataToValidateInputMapDataType(u,t);r.push(...v),a.push(...c),d.push(...E),o.push(...O)}const h=this.getOutputDataOutputMap(e);if(h){const{added:c,updated:v,removed:E,affected:O}=this.syncOutputDataOutputMapDataType(h,t);r.push(...v),a.push(...c),d.push(...E),o.push(...O)}return t==null||t.attemptAutoclose("sync-operation-instance-validate-data",this.id),{updated:p(r),added:p(a),removed:p(d),affected:p(o),self:e}}syncEntityToMatchInputMapDataType(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-entity-to-match-input-map-data-type"))){var u,h,c;const r=[],a=[],d=[],o=[];if(((u=e.declaration)==null?void 0:u.id)!==x.operation[Ke.Validate].inputs.entityToMatch.id)return t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const v={id:I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:null,like:!0,inferred:!0,parent:e.toReference()},E=V(v,e.project);E.setParent(e,t),E.initChildren(t),t==null||t.add(E,b.Added),r.push(E),e.setDataType(E)}(h=e.dataType)==null||h.metaSync({inferred:!0,like:!1,asType:!0},t);const l=this.getEntityToMatch(e,t);return(c=e.dataType)==null||c.setEntity(l),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:p(a),added:p(r),removed:p(d),affected:p(o),self:e.dataType}}syncDataToValidateInputMapDataType(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-data-to-validate-input-map-data-type"))){var c,v,E;const r=[],a=[],d=[],o=[];if(((c=e.declaration)==null?void 0:c.id)!==x.operation[Ke.Validate].inputs.dataToValidate.id)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const l=this.getEntityToMatchInputMap(e.parent);if(!l)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(l,t))return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const O={id:I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:e.toReference()},w=V(O,e.project);w.setParent(e,t),w.initChildren(t),t==null||t.add(w,b.Added),r.push(w),e.setDataType(w)}(v=e.dataType)==null||v.metaSync({inferred:!0,like:!0,asType:!1},t);const h=this.getEntityToMatch(l,t);return(E=e.dataType)==null||E.setEntity(h),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:p(a),added:p(r),removed:p(d),affected:p(o),self:e.dataType}}syncOutputDataOutputMapDataType(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"sync-output-data-output-map-data-type"))){var c,v,E;const r=[],a=[],d=[],o=[];if(((c=e.declaration)==null?void 0:c.id)!==x.operation[Ke.Validate].outputs.outputEntity.id)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const l=this.getEntityToMatchInputMap(e.parent);if(!l)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(l,t))return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const O={id:I.UUID.uuid(),version:I.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:e.toReference()},w=V(O,e.project);w.setParent(e,t),w.initChildren(t),t==null||t.add(w,b.Added),r.push(w),e.setDataType(w)}(v=e.dataType)==null||v.metaSync({inferred:!0,like:!0,asType:!1},t);const h=this.getEntityToMatch(l,t);return(E=e.dataType)==null||E.setEntity(h),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:p(a),added:p(r),removed:p(d),affected:p(o),self:e.dataType}}inferInputMapDataType(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"infer-input-map-data-type-validate-data"))){var r,a;if(((r=e.declaration)==null?void 0:r.id)===x.operation[Ke.Validate].inputs.entityToMatch.id){const{added:d,updated:o,removed:l,affected:u}=this.syncEntityToMatchInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:p(o),added:p(d),removed:p(l),affected:p(u),self:e.dataType}}else if(((a=e.declaration)==null?void 0:a.id)===x.operation[Ke.Validate].inputs.dataToValidate.id){const{added:d,updated:o,removed:l,affected:u}=this.syncDataToValidateInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type",this.id),{updated:p(o),added:p(d),removed:p(l),affected:p(u),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}inferOutputMapDataType(e,t=this.project.addChangeSet(new R(this.project,"",T().toISOString(),this,!0,"infer-output-map-data-type-validate-data"))){var r;if(((r=e.declaration)==null?void 0:r.id)===x.operation[Ke.Validate].outputs.outputEntity.id){const{added:a,updated:d,removed:o,affected:l}=this.syncOutputDataOutputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-output-map-data-type-validate-data",this.id),{updated:p(d),added:p(a),removed:p(o),affected:p(l),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}}class wJ extends qe{constructor(s){super(yl,s)}}class VJ extends qe{constructor(s){super(ml,s)}}class CJ extends qe{constructor(s){super(vl,s)}}class BJ extends qe{constructor(s){super(Zs,s)}}class _J extends qe{constructor(s){super(xs,s)}}class MJ extends qe{constructor(s){super(Pa,s)}}function gJ(i){const s=[new _P(i),new CP(i),new BP(i),new DJ(i),new OJ(i),new PJ(i),new BJ(i),new wJ(i),new CJ(i),new VJ(i),new _J(i),new MJ(i),new qe(fl,i),new qe(cl,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.operationDeclarations=s,s}class MP extends zr{constructor(e){super(Pt,e);f(this,"initialData");f(this,"id",Y.PERSISTED_ENTITY);f(this,"version","1");f(this,"name",Y.PERSISTED_ENTITY);f(this,"description",Pt.description);f(this,"type",n.BuiltInBaseEntity);f(this,"abstract",Pt.abstract);f(this,"static",Pt.static);f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"errors",[]);f(this,"project");this.initialData=Pt,this.project=e,this.id=Pt.id,this.version=Pt.version,this.name=Pt.name,this.static=Pt.static,this.abstract=Pt.abstract,this.properties=this.initialData.properties.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.methods=this.initialData.methods.map(t=>{const r=V(t,this.project);return r.parent=this,r}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const r=V(t,this.project);return r.parent=this,r}),this.extends=this.initialData.extends.map(t=>V(t,this.project))}}function NJ(i){const s=[new MP(i),new zr(ga,i),new zr(Nr,i),new zr(oo,i)];return s.forEach(e=>{i.subscribeBuiltInInstance(e)}),i.builtInBaseEntities=s,s}function LJ(i){const s=[new ar(ne,i),new ar(Kr,i),new ar(me,i),new ar(sl,i),new ar(Rt,i),new ar(Xr,i),new ar(_r,i),new ar(Qr,i),new ar(jn,i)];return s.forEach(e=>{i.subscribeBuiltInInstance(e)}),i.primitives=s,s}function UJ(i){const s=[new qe(uo,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.globalEventActionDescriptors=s,s}function $J(i){const s=[new qe(_a,i),new qe(mi,i),new qe(Ca,i),new qe(xn,i),new qe(Sn,i),new qe(Xs,i)];s.forEach(t=>{t.initChildren(null),i.subscribeBuiltInInstance(t)}),i.loopDeclarations=s;const e=[new qe(ro,i),new qe(Ba,i),new qe(eo,i),new qe(Bl,i),new qe(Ml,i),new qe(Qs,i)];return e.forEach(t=>{t.initChildren(null),i.subscribeBuiltInInstance(t)}),i.loopDeclarationsBodies=e,s}function jJ(i){const s=[new xi(po,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.valueDescriptors=s,s}function GJ(i){const s=[new qe(an,i),new qe(Wn,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.operationDeclarations=s,s}const gn={},Qd={},Ns={empty:!1,enrich:!0,mock:!1,ignoreCache:!1,onFetch:async()=>null,manuallyInit:!1};function gP(i,{enrich:s}={enrich:!0}){const e=i.project,t=i.record,r=new Fd(e),a=new Set;t[e.id]=e,a.add(e.id);const d=T().toISOString();Object.values(t).forEach(u=>{!u||r.allBuiltInEntityIds.includes(u.id)||a.add(u.id)}),r.order=Array.from(a),r.flatRecord=t,r.orderEntities();const o=el(i.project);o.instances[e.id]=o;const l=s?o.addChangeSet(new R(o,"",d,o)):null;return r.visit(u=>{if(u.id===o.id)return;const h=V(u,o);h.hydrateAncestors(),h.addSelfToProject(null)}),s?(r.visit(u=>{const h=o.get(u.id);h&&h.afterAllChildrenInitialized(l)}),o.afterAllChildrenInitialized(l)):tl(o,d).forEach(h=>{h.remove({ignoreUpstream:!0},null)}),o.instancesList.forEach(u=>{u.previousVersion=null}),l==null||l.close(),o}async function FJ(i,s=Ns){const e={...Ns,...s};if(e.empty)return{data:{project:{id:i.id,type:n.Project,version:I.UUID.uuid(),createdAt:T().toISOString(),author:I.sessionAuthor,previousVersion:null,deleted:!1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]},record:{}}};if(e.mock){const r={...ip};return r.id=i.id,{data:{project:r,record:{}}}}return console.log("Fetching project from external API"),new Promise(async r=>{if(e.onFetch){const a=await e.onFetch(i.id);if(a){r({data:a});return}}else r({data:null})})}function el(i){const s=new I(i);return LJ(s),NJ(s),gJ(s),UJ(s),$J(s),jJ(s),GJ(s),Array.from(new Set([...s.getAllBuiltInIds(),...Vr()])).forEach(t=>{if(!s.builtInInstances[t]&&s.instances[t])s.builtInInstances[t]=s.instances[t],delete s.instances[t];else if(!s.builtInInstances[t])throw new Error(`Built in entity was not properly initialized: ${t}`)}),s}function tl(i,s){return i.instancesList.filter(t=>T(t.createdAt).isAfter(T(s)||!!t.previousVersion))}function xJ(i,{enrich:s}={enrich:!0}){const e=new Map,t=Array.from(new Set([...i.getAllBuiltInIds(),...Vr()]));Object.keys(i.instances).forEach(u=>{if(t.includes(u)){e.set(u,u);return}const h=i.get(u);if(!Xd(h,{...i.instances,...i.builtInInstances}).every(E=>!t.includes(E))){e.set(u,u);return}e.set(u,I.UUID.uuid())});const r=T().toISOString(),a=i.toShallowJSON({seenEntityMaps:e});a.previousVersion=null,a.createdAt=r,a.version=I.UUID.uuid();const d=el(a),o=s?d.addChangeSet(new R(d,"",r,d)):null,l=new Fd(i);return l.visit(u=>{const h=u.toShallowJSON({seenEntityMaps:e});h.previousVersion=null,h.createdAt=r,h.version=I.UUID.uuid();const c=V(h,d);c.hydrateAncestors(),c.addSelfToProject(o),o==null||o.add(c,b.Added)}),s?(l.visit(u=>{const h=d.get(e.get(u.id));h&&h.afterAllChildrenInitialized(o)}),d.afterAllChildrenInitialized(o)):tl(d,r).forEach(h=>{h.remove({ignoreUpstream:!0},null)}),d.instancesList.forEach(u=>{u.previousVersion=null}),o==null||o.close(),d}function NP(i,{enrich:s}={enrich:!0}){const e=el(i),t=T().toISOString(),r=s?e.addChangeSet(new R(e,"",t,e)):null;r&&(r.type=Ac.Automatic);const a=new Fd(i);return a.visit(d=>{const o=V(d,e);o.hydrateAncestors(),o.addSelfToProject(r)}),s?(a.visit(d=>{const o=e.get(d.id);o&&o.afterAllChildrenInitialized(r)}),e.afterAllChildrenInitialized(r)):tl(e,t).forEach(o=>{o.remove({ignoreUpstream:!0},null)}),r==null||r.close(),e}async function SJ(i,s=Ns){const e={...Ns,...s};if(i.id&&gn[i.id]&&!e.ignoreCache)return gn[i.id];if(i.id&&Qd[i.id]&&!e.ignoreCache)return await Qd[i.id],gn[i.id];const t=FJ(i,e);i.id&&(Qd[i.id]=t);const r=await t;if(r.data){let a;return e.mock?a=NP(ip,{enrich:!!e.enrich}):r.data instanceof I?a=r.data:a=gP(r.data,{enrich:!!e.enrich}),gn[i.id]=a,i.id&&delete Qd[i.id],a}return null}function kJ(i){return gn[i.id]&&delete gn[i.id],null}const ZJ="test_primitive_entities_export";y.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=Mc,y.ALL_BUILT_IN_BASE_ENTITIES=NE,y.ALL_BUILT_IN_CONDITION_ENTITIES=zE,y.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=HE,y.ALL_BUILT_IN_LOOP_BODY_ENTITIES=uT,y.ALL_BUILT_IN_LOOP_ENTITIES=lT,y.ALL_BUILT_IN_OPERATION_ENTITIES=A0,y.ALL_BUILT_IN_PRIMITIVE_ENTITIES=lf,y.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=eI,y.ALL_BUILT_IN_VALUE_DESCRIPTORS=QE,y.ActionDescriptorState=qe,y.ActionInputMapState=yq,y.ActionOutputMapState=vq,y.AppendToListOperationInputIds=vh,y.AppendToListOperationOutputIds=Th,y.ArgumentDeclarationDependencyField=aO,y.ArgumentDeclarationState=Fi,y.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=Vc,y.BUILT_IN_BASE_ENTITY_IDS=x,y.BUILT_IN_ENTITY_TYPES=hr,y.BaseCanvasDraggableState=vJ,y.BaseEntityNames=Y,y.BaseState=mJ,y.BaseValueDescriptorIds=Fs,y.BreakStatementDependencyField=Rc,y.BreakStatementState=Cn,y.BuiltInBaseEntityState=zr,y.CACHED_PROJECTS_BY_ID=gn,y.CALLABLE_ENTITIES_EXPLANATION=Oq,y.CALLABLE_TYPES=Cr,y.CALLER_ENTITIES_EXPLANATION=uO,y.CALLER_TYPES=Br,y.CALLS_UPDATE_EXPLANATION=ki,y.COMPARISON_CONDITIONS=JE,y.CONDITIONS=WE,y.CUSTOM_ENTITY_OPERATIONS=Gm,y.CallableEntityClass=EJ,y.CallerEntityClass=Hc,y.ChangeSet=R,y.ChangeSetChangeCaptureType=Ac,y.ChangeSetEntityChangeType=b,y.ChildEntityState=TJ,y.ComparisonOperatorTypes=pt,y.ConditionDependencyField=Q1,y.ConditionState=Li,y.ContinueStatementDependencyField=bc,y.ContinueStatementState=jt,y.CreateNewInputIds=fm,y.CreateNewOutputIds=ym,y.DRAGGABLE_CALLABLE_TYPES=al,y.DRAGGABLE_CALLER_TYPES=ef,y.DRAGGABLE_ELEMENT_TYPES=Gs,y.DRAGGABLE_EXECUTABLE_TYPES=GP,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=js,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=nl,y.DataTypeCompatibilityTypes=Er,y.DataTypeDependencyField=Y1,y.DataTypeParentChildRelation=bt,y.DataTypeState=wn,y.DefinitionEntityDependencyField=OP,y.DefinitionEntityState=Yi,y.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=yJ,y.ENTITIES_WITH_VALLUES_EXPLANATION=Ld,y.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=L,y.ENTITY_RECUSION_OPTIONS_DEFAULTS=Z,y.ENTITY_TYPES=FP,y.ENTITY_WITH_DECLARATION_TYPES=$P,y.ENTITY_WITH_LOGIC_SCOPE_TYPES=mt,y.ENTITY_WITH_NAMES_TYPES=tf,y.ENTITY_WITH_PARENT_TYPES=LP,y.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=Xc,y.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=UP,y.ENTITY_WITH_VALUE_TYPES=Kc,y.ENTRY_POINT_ENTITIES_EXPLANATION=Ps,y.ENTRY_POINT_TYPES=at,y.EVENT_TYPES=$n,y.EXECUTABLE_TYPES=jP,y.EXECUTION_OPERATIONS=cm,y.EntityAction=VP,y.EntityError=hn,y.EntityErrorSeverity=D,y.EntityGenerationError=P,y.EntityGenerationErrorCode=A,y.EntityInstanceErrorCode=q,y.EntityOperations=Ke,y.EntityType=n,y.EntityWithLogicScopeClass=RJ,y.EntityWithValueClass=bJ,y.EntryPointEntityClass=IJ,y.ExecutionOperations=He,y.ExecutionTerminationType=K1,y.FunctionCallDependencyField=IO,y.FunctionCallState=qi,y.FunctionDeclarationDependencyField=z1,y.FunctionDeclarationState=Mi,y.GET_PROJECT_OPTIONS_DEFAULTS=Ns,y.GLOBAL_EVENT_DECLARATIONS=YE,y.GetLastInListOperationInputIds=ah,y.GetLastInListOperationOutputIds=sh,y.GlobalEventNames=Hr,y.GlobalEventState=Vn,y.HTTPOperations=Ct,y.HTTP_OPERATIONS=E0,y.InputMapDependencyField=iO,y.InputMapState=Zr,y.InstalledProjectState=Gi,y.InternalCallDependencyField=rO,y.InternalCallState=Bn,y.JoinListOperationInputIds=Oy,y.JoinListOperationOutputIds=Py,y.LIST_OPERATIONS=_h,y.ListOperations=fe,y.LiteralValueDependencyField=sO,y.LiteralValueState=_n,y.LoopDependencyField=X1,y.LoopState=Ni,y.LoopTypes=X,y.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=Zi,y.NUMBER_OPERATIONS=Gf,y.NumberOperations=Xe,y.OPERATION_DECLARATIONS=I0,y.OperationDependencyField=H1,y.OperationState=gi,y.OutputMapDependencyField=nO,y.OutputMapParentChildRelation=Un,y.OutputMapState=qr,y.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=Ud,y.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=Si,y.PASS_THROUGH_CALLABLE_TYPES=nt,y.PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=Qc,y.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=_c,y.ParallelExecutionOperation=CP,y.PassThroughCallableEntityClass=AJ,y.PersistedEntity=MP,y.PersistedEntityMethods=or,y.PrimitiveEntityState=ar,y.PrimitiveTypes=g,y.ProjectState=I,y.PropertyDependencyField=J1,y.PropertyState=Bi,y.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=wP,y.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=Pq,y.ReturnDeclarationDependencyField=W1,y.ReturnDeclarationState=rr,y.ReturnStatementDependencyField=_d,y.ReturnStatementState=_i,y.STANDALONE_CONDITIONS=$E,y.STRING_OPERATIONS=Dy,y.ScopeCompatibilityType=Kd,y.SearchDependencyField=tO,y.SearchState=ji,y.SequentialExecutionOperation=_P,y.SequentialExecutionOperationInputIds=Qh,y.SequentialExecutionOperationOutputIds=em,y.SharedEntityErrorCode=j,y.SharedStateFunctionality=PP,y.SplitListOperationInputIds=xy,y.SplitListOperationOutputIds=Sy,y.StandaloneOperatorTypes=yr,y.StringOperations=Ee,y.TERMINATION_TYPES=st,y.Traverser=Fd,y.USER_MANAGED_ENTITY_TYPES=rf,y.UserManagedEntityStateTemplate=hJ,y.VALUE_READING_ENTITIES_EXPLANATION=Bc,y.VALUE_READING_TYPES=hi,y.VALUE_WRITING_ENTITIES_EXPLANATION=pO,y.VALUE_WRITING_TYPES=ht,y.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=Cc,y.VARIABLE_TYPES=Qe,y.ValueAutogenerationType=yt,y.ValueDescriptorDependencyField=oO,y.ValueDescriptorParentChildRelation=M,y.ValueDescriptorState=xi,y.ValueReadingEntityClass=yi,y.ValueWritingEntityClass=gs,y.VariableDeclarationDependencyField=eO,y.VariableDeclarationState=$i,y.VariableInputMapState=fq,y.VariableInstanceDependencyField=Dc,y.VariableInstanceState=Ui,y.VariableOutputMapState=mq,y.WaitOperation=BP,y.WaitOperationInputIds=Jh,y.WaitOperationOutputIds=Wh,y.appendToListOperation=Zs,y.appendToListOperationElementToAppendArgument=El,y.appendToListOperationElementToAppendArgumentParentRef=Ph,y.appendToListOperationElementToAppendArgumentRef=Ah,y.appendToListOperationError=Bh,y.appendToListOperationErrorParentRef=Ch,y.appendToListOperationListArgument=Tl,y.appendToListOperationListArgumentParentRef=Oh,y.appendToListOperationListArgumentRef=Eh,y.appendToListOperationListDataType=Ih,y.appendToListOperationResultListDataType=Dh,y.appendToListOperationResultListReturn=Vh,y.appendToListOperationResultListReturnParentRef=wh,y.appendToListOperationResultListReturnRef=Rh,y.appendToListOperationSecondListDataType=bh,y.asGenerationActionExample=Jr,y.booleanPrototype=Kr,y.capitalizeFirstLetter=Wt,y.changeSetJSONRecordToUniqueIds=Z7,y.checkAreDataTypesCompatible=Ir,y.checkAreDefinitionEntitiesCompatibleAsDataType=g1,y.checkArePropertiesCompatibleAsDataType=M1,y.checkHasMetadataChanged=dt,y.checkIsBranchDependentButNotDirectlyOnBranch=Vs,y.checkIsBranchDependentOnBranch=Lq,y.checkIsCallableEntityReachable=Ms,y.checkIsCanvasEntity=eJ,y.checkIsDetachedBranch=EP,y.checkIsDetachedBranchShallow=zc,y.checkIsGlobalVariable=Kq,y.checkIsGloballyDeclared=Wc,y.checkIsMethod=bP,y.checkIsNestedScope=Hd,y.checkScopeCompatibility=_s,y.cloneProject=xJ,y.countedLoopActionDescriptor=_a,y.countedLoopActionDescriptorDynamicReturnDeclaration=tT,y.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=eT,y.countedLoopActionDescriptorStringArgumentDeclaration=Qv,y.countedLoopActionDescriptorStringArgumentDeclarationDataType=Kv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=Yv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=zv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=Hv,y.countedLoopActionDescriptorStringArgumentDeclarationParentRef=Xv,y.countedLoopBodyActionDescriptor=ro,y.countedLoopBodyActionDescriptorAnyDynamicArgument=sT,y.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=aT,y.countedLoopBodyActionDescriptorAnyDynamicReturn=dT,y.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=oT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Nl,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=iT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=rT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=nT,y.createDefinitionEntityFromJSONObject=Sd,y.createEntityError=ye,y.createNestedDataTypeForEntity=RO,y.createNewInstanceOperation=Xi,y.createNewInstanceOperationEntityToInstanciateArgument=bm,y.createNewInstanceOperationEntityToInstanciateArgumentRef=Em,y.createNewInstanceOperationEntityToInstanciateDataType=Im,y.createNewInstanceOperationError=Pm,y.createNewInstanceOperationErrorParentRef=Om,y.createNewInstanceOperationNewEntityDataArgument=Tm,y.createNewInstanceOperationNewEntityDataArgumentDataType=vm,y.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=mm,y.createNewInstanceOperationNewEntityDataArgumentParentRef=hm,y.createNewInstanceOperationOutputEntityDeclaration=Dm,y.createNewInstanceOperationOutputEntityDeclarationParentRef=Rm,y.createNewInstanceOperationRef=Am,y.createSemanticId=q1,y.createStateFromGenerationTargetType=fJ,y.createStateFromType=lt,y.createStateFromTypeAndSubscribe=V,y.cronJobBuiltInBaseEntity=oo,y.cronJobBuiltInBaseEntityExpressionProperty=ME,y.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=WP,y.cronJobBuiltInBaseEntityExpressionPropertyRef=BE,y.cronJobBuiltInBaseEntityRef=_E,y.cronJobTriggeredFunctionDeclarationBlueprint=zl,y.cronJobTriggeredFunctionDeclarationBlueprintParentRef=VE,y.dataTypeCompatibilityToErrorExplanation=EO,y.datePrototype=_r,y.dateValueAutogenerationSchema=dp,y.definitionEntityToZodSchema=mI,y.deletePersistedEntityMethod=Wl,y.deletePersistedEntityMethodParentRef=fE,y.deleteRootProject=kJ,y.endpointBuiltInBaseEntity=ga,y.endpointBuiltInBaseEntityRef=yT,y.endpointBuiltInBaseEntityRefFour=YT,y.endpointBuiltInBaseEntityRefThree=RT,y.endpointBuiltInBaseEntityRefTwo=ET,y.endpointBuiltInCorsProperty=hT,y.endpointBuiltInCorsPropertyDataType=fT,y.endpointBuiltInCorsPropertyDataTypeRef=pT,y.endpointBuiltInCorsPropertyRef=cT,y.endpointBuiltInMethodProperty=Ul,y.endpointBuiltInMethodPropertyDataType=bT,y.endpointBuiltInMethodPropertyDataTypeRef=IT,y.endpointBuiltInMethodPropertyRef=AT,y.endpointBuiltInPathProperty=Ll,y.endpointBuiltInPathPropertyDataType=TT,y.endpointBuiltInPathPropertyDataTypeRef=mT,y.endpointBuiltInPathPropertyRef=vT,y.endpointPathParamsArgumentDeclaration=jl,y.endpointPathParamsArgumentDeclarationRef=gT,y.endpointPathParamsVariableDataType=NT,y.endpointPathParamsVariableDataTypeRef=MT,y.endpointReachedTriggerActionDescriptor=Zl,y.endpointReachedTriggerActionDescriptorRef=LT,y.endpointReachedTriggerActionDescriptorRefFour=jT,y.endpointReachedTriggerActionDescriptorRefThree=$T,y.endpointReachedTriggerActionDescriptorRefTwo=UT,y.endpointRequestBodyArgumentDeclaration=Fl,y.endpointRequestBodyArgumentDeclarationRef=wT,y.endpointRequestBodyVariableDataType=VT,y.endpointRequestHeadersArgumentDeclaration=$l,y.endpointRequestHeadersArgumentDeclarationRef=OT,y.endpointRequestHeadersVariableDataType=PT,y.endpointRequestHeadersVariableDataTypeRef=DT,y.endpointRequestQueryParamsArgumentDeclaration=Gl,y.endpointRequestQueryParamsArgumentDeclarationRef=BT,y.endpointRequestQueryParamsVariableDataType=_T,y.endpointRequestQueryParamsVariableDataTypeRef=CT,y.endpointResponseBodyDataType=WT,y.endpointResponseBodyReturnDeclaration=kl,y.endpointResponseBodyReturnDeclarationRef=JT,y.endpointResponseCodeDataType=FT,y.endpointResponseCodeReturnDeclaration=xl,y.endpointResponseCodeReturnDeclarationRef=GT,y.endpointResponseHeadersDataType=ZT,y.endpointResponseHeadersDataTypeRef=ST,y.endpointResponseHeadersReturnDeclaration=Sl,y.endpointResponseHeadersReturnDeclarationRef=kT,y.endpointReturnStatementRef=xT,y.endpointReturnStatementRefThree=zT,y.endpointReturnStatementRefTwo=qT,y.enrichFromKnownEntities=Cs,y.enumOptionsProperty=df,y.enumOptionsPropertyDataType=sf,y.enumOptionsPropertyDataTypeRef=nf,y.enumOptionsPropertyRef=af,y.enumPrototype=Xr,y.enumPrototypeRef=of,y.executionBuiltInBaseEntity=lo,y.executionBuiltInEntityAbortMethod=Yl,y.executionBuiltInEntityAbortMethodParentRef=gE,y.filterOutDuplicateEntities=p,y.filterOutDuplicateErrors=H9,y.findEntityFromKeys=Uc,y.findReferenceToSelfInList=jO,y.findReferencesToSelfInProject=Zq,y.flattenActionDescriptor=GO,y.flattenArgumentDeclaration=FO,y.flattenBreakStatement=xO,y.flattenBuiltInBaseEntity=SO,y.flattenCalls=Wr,y.flattenCanvasAncestorsUntil=kd,y.flattenCondition=kO,y.flattenContinueStatement=ZO,y.flattenDataType=JO,y.flattenDefinitionEntity=qO,y.flattenDefinitionEntityExtensionAndImplementationTypes=Zc,y.flattenDefinitionEntityExtensionTypes=Yd,y.flattenDefinitionEntityExtensions=Sc,y.flattenDefinitionEntityImplementations=kc,y.flattenDefinitionEntityImplementionTypes=zd,y.flattenDerivedCanvasEntities=ir,y.flattenDetachedBranch=AP,y.flattenElementCalls=it,y.flattenElementCallsOnTheSameScope=kq,y.flattenEntity=N,y.flattenFunctionCall=WO,y.flattenFunctionDeclaration=zO,y.flattenGlobalEvent=YO,y.flattenInputMap=HO,y.flattenInstalledProject=KO,y.flattenInternalCall=XO,y.flattenLiteralValue=QO,y.flattenLoop=eP,y.flattenOperation=tP,y.flattenOutputMap=rP,y.flattenPrimitiveEntity=iP,y.flattenProject=nP,y.flattenProjectElements=$O,y.flattenProperty=aP,y.flattenRelatedCanvasElementsOnTheLeft=vP,y.flattenRelatedCanvasElementsOnTheRight=mP,y.flattenReturnDeclaration=sP,y.flattenReturnStatement=oP,y.flattenSearch=dP,y.flattenValueDescriptor=lP,y.flattenVariableDeclaration=uP,y.flattenVariableInstance=pP,y.flattenVariableReads=UO,y.flattenVariableWrites=LO,y.flattenVariables=We,y.fromChangeSetToRecordChangeSet=dJ,y.fromZodParseToEntityGenerationErrors=Oc,y.generate=KV,y.generateActionExample=wq,y.generateExecutionDataType=N7,y.generateIdFromStrategy=ct,y.generateMutablePropertiesExplanation=Md,y.generateRandomBoolean=kI,y.generateRandomDate=II,y.generateRandomDateAfter=vI,y.generateRandomDateBefore=TI,y.generateRandomDateBetweenRange=EI,y.generateRandomNumber=jI,y.generateRandomNumberAfter=LI,y.generateRandomNumberBefore=UI,y.generateRandomNumberBetweenRange=$I,y.generateRandomText=SI,y.generateRandomTextAfter=GI,y.generateRandomTextBefore=FI,y.generateRandomTextBetweenRange=xI,y.generateUniqueUUID=NI,y.getAllActionDescriptorsForConditions=Gd,y.getAllActionDescriptorsForGlobalEvents=$d,y.getAllActionDescriptorsForLoops=jd,y.getAllActionDescriptorsForOperations=_q,y.getAllBuiltInEntityIds=Vr,y.getAllGloballyDeclaredFunctionDeclarationsExplanation=mO,y.getBaseBuiltInEntities=Wi,y.getBaseSchemaBasedOnType=dO,y.getBuiltInEntityOwner=zi,y.getCallableEntityReferenceSchema=Dt,y.getCallableEntityTypeSchema=ID,y.getCalledBy=fr,y.getCallerEntityReferenceSchema=e5,y.getCallerEntityTypeSchema=Q3,y.getCalls=Gc,y.getCanvasEntitiesDerivedFromInternalCalls=hP,y.getCanvasEntitiesDerivedFromWrites=ba,y.getCanvasEntityDerivedFromValueReadingEntity=Wd,y.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=yP,y.getCanvasEntityReferenceSchema=v5,y.getCanvasEntityTypeSchema=m5,y.getChildrenEntityWithValues=$q,y.getColumnProperties=aJ,y.getCommonAncestor=jc,y.getCommonChildren=DO,y.getDatabaseEntities=iJ,y.getDatabaseEntity=sJ,y.getDeclaration=Pn,y.getDeepestScope=DP,y.getDefinitionEntityExtends=Ra,y.getDraggableCallableEntityReferenceSchema=bD,y.getDraggableCallableEntityTypeSchema=AD,y.getDraggableCallerEntityReferenceSchema=r5,y.getDraggableCallerEntityTypeSchema=t5,y.getDraggableExecutableEntityReferenceSchema=s5,y.getDraggableExecutableEntityTypeSchema=a5,y.getDraggablePassThroughCallableEntityReferenceSchema=Td,y.getDraggablePassThroughCallableEntityTypeSchema=vd,y.getDraggablePlayableEntityReferenceSchema=p5,y.getDraggablePlayableEntityTypeSchema=u5,y.getEntitiesCreatedSinceInitialization=tl,y.getEntityArgumentDeclarations=xc,y.getEntityInputMaps=cP,y.getEntityOutputMaps=zq,y.getEntityReferenceSchema=h5,y.getEntityReturnDeclarations=fP,y.getEntityTypeSchema=y5,y.getEntityWithLogicScopeReferenceSchema=ui,y.getEntityWithLogicScopeTypeSchema=o5,y.getEntityWithValueReferenceSchema=ED,y.getEntityWithValueTypeSchema=X3,y.getEntryPointEntityReferenceSchema=At,y.getEntryPointEntityTypeSchema=wi,y.getEventEntityReferenceSchema=hd,y.getEventEntityTypeSchema=yd,y.getExecutableEntityReferenceSchema=n5,y.getExecutableEntityTypeSchema=i5,y.getExtendedBuiltInEntity=Yq,y.getExtendedDefinitionEntity=qc,y.getGenerationTargetSchemaBasedOnType=lO,y.getHeadIfPartOfDetachedBranch=IP,y.getHighestScope=RP,y.getImplementedBuiltInEntity=Hq,y.getIsInteractive=Jc,y.getLastInListOperation=vl,y.getLastInListOperationError=mh,y.getLastInListOperationErrorParentRef=hh,y.getLastInListOperationInputListArgument=ch,y.getLastInListOperationInputListArgumentParentRef=ph,y.getLastInListOperationInputListArgumentRef=oh,y.getLastInListOperationInputListDataType=dh,y.getLastInListOperationOutputElementDataType=uh,y.getLastInListOperationOutputElementReturn=yh,y.getLastInListOperationOutputElementReturnParentRef=fh,y.getLastInListOperationOutputElementReturnRef=lh,y.getLinkedEntitiesFromArgumentDeclaration=Sq,y.getLowestPersistedEntityImplementation=TP,y.getParentCallableEntity=OO,y.getParentCallerEntity=wO,y.getParentCanvasEntities=zt,y.getParentCanvasEntity=Ot,y.getParentCanvasEntityFromTransfer=Zd,y.getParentEntryPoint=Uq,y.getParentPassthroughCallableEntity=PO,y.getPassThroughCallableEntityReferenceSchema=et,y.getPassThroughCallableEntityTypeSchema=md,y.getPeristedEntities=rJ,y.getPlayableEntityReferenceSchema=l5,y.getPlayableEntityTypeSchema=d5,y.getProject=SJ,y.getPrototypeByType=Bs,y.getRecusriveParentsIds=Xd,y.getReferenceEntityId=B,y.getReferencedEntitiesStateOrErrors=Nd,y.getReferencedEntityStateOrErrors=Pc,y.getReferencedIds=Jd,y.getRelatedCanvasElementsOnTheLeft=Mn,y.getRelatedCanvasElementsOnTheLeftFromTransfer=qq,y.getRelatedCanvasElementsOnTheRight=Ji,y.getRootEntryPointScopeOwner=Yc,y.getScopeOwner=Yt,y.getStateClassFromType=oJ,y.getTerminationReferenceSchema=f5,y.getTerminationTypeSchema=c5,y.getTouchedCanvasEntitiesFromChangeSet=lJ,y.getUsedArgFromDeclaration=Jq,y.getUsedReturnFromDeclaration=Wq,y.getValueReadingEntityReferenceSchema=TD,y.getValueReadingEntityTypeSchema=li,y.getValueWritingEntityReferenceSchema=K3,y.getValueWritingEntityTypeSchema=ms,y.getVariableFromInputMapping=CO,y.getVariableFromReturnVariablePointer=MO,y.getVariableReferenceSchema=Pi,y.getVariableTypeSchema=In,y.getVariablesFromArgumentDeclarations=qd,y.getVariablesFromInputMaps=BO,y.getVariablesFromOutputMapping=gO,y.getVariablesFromOutputMaps=NO,y.getVariablesFromReturnDeclarations=_O,y.getVariablesInSameOrHigherScope=fc,y.getWrites=Fc,y.groupCallsBasedOnParallelizableExecution=Gq,y.handleAfterEntityImplementationSideEffects=bO,y.handleBeforeEntityImplementationSideEffects=AO,y.httpRequestBodyArgument=zs,y.httpRequestBodyArgumentRef=Xm,y.httpRequestBodyDataType=Qm,y.httpRequestHeadersArgument=Ws,y.httpRequestHeadersArgumentRef=Hm,y.httpRequestHeadersDataType=Km,y.httpRequestMethodArgument=qs,y.httpRequestMethodArgumentRef=zm,y.httpRequestMethodDataType=Ym,y.httpRequestMethodDataTypeRef=Jm,y.httpRequestOperation=wa,y.httpRequestOperationErrorValueDescriptor=Ol,y.httpRequestOperationErrorValueDescriptorDatatype=T0,y.httpRequestOperationErrorValueDescriptorRef=v0,y.httpRequestOperationRef=f0,y.httpRequestOperationRefEight=h0,y.httpRequestOperationRefFive=p0,y.httpRequestOperationRefFour=u0,y.httpRequestOperationRefNine=m0,y.httpRequestOperationRefSeven=y0,y.httpRequestOperationRefSix=c0,y.httpRequestOperationRefThree=l0,y.httpRequestOperationRefTwo=d0,y.httpRequestQueryParamsArgument=Dl,y.httpRequestQueryParamsArgumentRef=Zm,y.httpRequestQueryParamsDataType=qm,y.httpRequestVariableURLArgument=Js,y.httpRequestVariableURLArgumentRef=Sm,y.httpRequestVariableURLDataType=km,y.httpRequestVariableURLDataTypeRef=Fm,y.httpResponseBodyReturnDataType=o0,y.httpResponseBodyReturnDataTypeRef=a0,y.httpResponseBodyReturnReturn=Ks,y.httpResponseBodyReturnReturnRef=s0,y.httpResponseCodeDataType=t0,y.httpResponseCodeReturn=Ys,y.httpResponseCodeReturnRef=e0,y.httpResponseHeadersDataType=n0,y.httpResponseHeadersDataTypeRef=r0,y.httpResponseHeadersReturn=Hs,y.httpResponseHeadersReturnRef=i0,y.implement=xd,y.inferArgumentDeclarationDataType=N1,y.inferDataType=kr,y.inferInputMapDataType=uc,y.inferOutputMapDataType=cc,y.inferPropertyDataType=$1,y.inferReturnDeclarationDataType=pc,y.inferValueDescriptorDataType=j1,y.inferVariableDeclarationDataType=U1,y.inferVariableInstanceDataType=L1,y.initBaseProjectEntity=el,y.initProject=NP,y.initProjectFromFetchResult=gP,y.isPromise=Lc,y.iterateOverListActionDescriptorListArgumentDeclaration=X0,y.iterateOverListActionDescriptorListArgumentDeclarationDataType=H0,y.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=Y0,y.iterateOverListActionDescriptorListArgumentDeclarationParentRef=K0,y.iterateOverListLoopActionDescriptor=mi,y.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=ev,y.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=Q0,y.iterateOverListLoopBodyActionDescriptor=Ba,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=lv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=dv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=pv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=uv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=to,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=rv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=tv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=iv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=ov,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=av,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=nv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=sv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=mv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=yv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=fv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=hv,y.iterateOverObjectKeysLoopActionDescriptor=xn,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=Tv,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=vv,y.iterateOverObjectKeysLoopBodyActionDescriptor=Bl,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=wv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Pv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=Cv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=Vv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Cl,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=Iv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Ev,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Av,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Ov,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Rv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=bv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Dv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=Nv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=Mv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=_v,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=gv,y.iterateOverObjectValuesLoopActionDescriptor=Sn,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=Uv,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=Lv,y.iterateOverObjectValuesLoopBodyActionDescriptor=Ml,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=qv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Zv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=Wv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=Jv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=_l,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=jv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=$v,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Gv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=kv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=xv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Fv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Sv,y.iterateOverStringActionDescriptorDynamicReturnDeclaration=$0,y.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=U0,y.iterateOverStringActionDescriptorStringArgumentDeclaration=L0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=g0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=M0,y.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=N0,y.iterateOverStringLoopActionDescriptor=Ca,y.iterateOverStringLoopBodyActionDescriptor=eo,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=q0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Z0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=W0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=J0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=wl,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=G0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=j0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=F0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Vl,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=S0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=x0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=k0,y.joinListOperation=yl,y.joinListOperationError=Fy,y.joinListOperationErrorParentRef=Gy,y.joinListOperationFirstListArgument=Ny,y.joinListOperationFirstListArgumentParentRef=gy,y.joinListOperationFirstListArgumentRef=wy,y.joinListOperationFirstListDataType=Vy,y.joinListOperationResultListDataType=My,y.joinListOperationResultListReturn=jy,y.joinListOperationResultListReturnParentRef=$y,y.joinListOperationResultListReturnRef=_y,y.joinListOperationSecondListArgument=Uy,y.joinListOperationSecondListArgumentParentRef=Ly,y.joinListOperationSecondListArgumentRef=Cy,y.joinListOperationSecondListDataType=By,y.joinListWithLastSeparator=ie,y.joinStringsOperation=Pa,y.joinStringsOperationDynamicStringArgument=sy,y.joinStringsOperationDynamicStringArgumentParentRef=ay,y.joinStringsOperationDynamicStringArgumentRef=iy,y.joinStringsOperationDynamicStringDataType=ny,y.joinStringsOperationError=ry,y.joinStringsOperationErrorParentRef=ty,y.joinStringsOperationFirstStringArgument=Ss,y.joinStringsOperationFirstStringArgumentParentRef=Jf,y.joinStringsOperationFirstStringArgumentRef=Ff,y.joinStringsOperationFirstStringDataType=xf,y.joinStringsOperationResultStringDataType=qf,y.joinStringsOperationResultStringReturn=Oa,y.joinStringsOperationResultStringReturnParentRef=ey,y.joinStringsOperationResultStringReturnRef=Zf,y.joinStringsOperationSecondStringArgument=ks,y.joinStringsOperationSecondStringArgumentParentRef=Qf,y.joinStringsOperationSecondStringArgumentRef=Sf,y.joinStringsOperationSecondStringDataType=kf,y.joinStringsOperationSeparatorStringArgument=Xf,y.joinStringsOperationSeparatorStringArgumentParentRef=Kf,y.joinStringsOperationSeparatorStringArgumentRef=Wf,y.joinStringsOperationSeparatorStringDataType=Hf,y.joinStringsOperationSeparatorStringDataTypeDefaultValue=Yf,y.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=zf,y.keyValuePrototype=jn,y.lowercaseFirstLetter=Pd,y.manualFlowActionDescriptorDeclarationArgumentDeclaration=Pl,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=O0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=D0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=P0,y.manualFlowLoopActionDescriptor=Xs,y.manualFlowLoopActionDescriptorDynamicReturnDeclaration=R0,y.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=b0,y.manualFlowLoopBodyActionDescriptor=Qs,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=V0,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=w0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=B0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=C0,y.mapActionDescriptorToTypeItRepresents=tJ,y.mergeEntityErrorsList=K9,y.mergeListOfEntities=Xq,y.methodDefaultValue=Wm,y.mockClientProject=ip,y.moreThanOrEqualCondition=Wn,y.moreThanOrEqualConditionLeftHandArgument=xE,y.moreThanOrEqualConditionLeftHandArgumentDataType=GE,y.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=jE,y.moreThanOrEqualConditionLeftHandArgumentParentRef=FE,y.moreThanOrEqualConditionRightHandArgument=qE,y.moreThanOrEqualConditionRightHandArgumentDataType=kE,y.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=SE,y.moreThanOrEqualConditionRightHandArgumentParentRef=ZE,y.notEmptyCondition=an,y.notEmptyConditionArgument=UE,y.notEmptyConditionRef=LE,y.nullPrototype=sl,y.numberAdditionOperation=xs,y.numberAdditionOperationDynamicSummandArgument=bf,y.numberAdditionOperationDynamicSummandArgumentType=Af,y.numberAdditionOperationDynamicSummandArgumentTypeParentRef=If,y.numberAdditionOperationError=Ef,y.numberAdditionOperationErrorParentRef=Tf,y.numberAdditionOperationFirstNumberArgument=ol,y.numberAdditionOperationFirstNumberArgumentRef=uf,y.numberAdditionOperationFirstNumberDataType=pf,y.numberAdditionOperationRef=mf,y.numberAdditionOperationRefThree=ll,y.numberAdditionOperationRefTwo=vf,y.numberAdditionOperationResultNumberDataType=hf,y.numberAdditionOperationResultNumberReturn=ul,y.numberAdditionOperationResultNumberReturnRef=yf,y.numberAdditionOperationSecondNumberArgument=dl,y.numberAdditionOperationSecondNumberArgumentRef=cf,y.numberAdditionOperationSecondNumberDataType=ff,y.numberPrototype=me,y.numberSubtractionOperation=cl,y.numberSubtractionOperationDynamicSubtrahendArgument=jf,y.numberSubtractionOperationDynamicSubtrahendArgumentType=$f,y.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=Uf,y.numberSubtractionOperationError=Lf,y.numberSubtractionOperationErrorParentRef=Nf,y.numberSubtractionOperationFirstNumberArgument=Cf,y.numberSubtractionOperationFirstNumberArgumentRef=Rf,y.numberSubtractionOperationFirstNumberDataType=Df,y.numberSubtractionOperationRef=pl,y.numberSubtractionOperationRefThree=Mf,y.numberSubtractionOperationRefTwo=Bf,y.numberSubtractionOperationResultNumberDataType=Vf,y.numberSubtractionOperationResultNumberReturn=gf,y.numberSubtractionOperationResultNumberReturnRef=wf,y.numberSubtractionOperationSecondNumberArgument=_f,y.numberSubtractionOperationSecondNumberArgumentRef=Of,y.numberSubtractionOperationSecondNumberDataType=Pf,y.numberValueAutogenerationSchema=op,y.parallelExecutionOperation=br,y.parallelExecutionOperationError=qh,y.parallelExecutionOperationErrorParentRef=Zh,y.parallelExecutionOperationListOfExecutionResultsDataType=xh,y.parallelExecutionOperationListOfExecutionResultsReturn=Al,y.parallelExecutionOperationListOfExecutionResultsReturnRef=Fh,y.parallelExecutionOperationListOfFunctionsArgument=Il,y.parallelExecutionOperationListOfFunctionsArgumentDatatype=Gh,y.parallelExecutionOperationListOfFunctionsArgumentRef=jh,y.parallelExecutionOperationListOfFunctionsBlueprint=$h,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=Lh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInputParentRef=Nh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=gh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutputParentRef=Mh,y.parallelExecutionOperationListOfFunctionsBlueprintParentRef=Uh,y.parallelExecutionOperationRef=Sh,y.parallelExecutionOperationRefThree=kh,y.persistedBuiltInBaseEntity=Pt,y.persistedBuiltInBaseEntityDatabaseProperty=Zn,y.persistedBuiltInBaseEntityDatabasePropertyDataType=mE,y.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=qP,y.persistedBuiltInBaseEntityDatabasePropertyParentRef=vE,y.persistedBuiltInBaseEntityDatabasePropertyRef=hE,y.persistedBuiltInBaseEntityPrimaryKeyProperty=qn,y.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=OE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=EE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=TE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=PE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=DE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=AE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=IE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=RE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=bE,y.processOutputGlobalValueDescriptorDataType=XE,y.processOutputGlobalValueDescriptorReturn=po,y.processOutputGlobalValueDescriptorReturnRef=KE,y.projectPublicationCompletedGlobalEvent=uo,y.propertyToZodSchema=hI,y.relationalDatabaseBuiltInBaseEntity=Nr,y.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=Jl,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=pE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=uE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=cE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=lE,y.relationalDatabaseBuiltInBaseEntityDefaultProperty=ql,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=dE,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=sE,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=oE,y.relationalDatabaseBuiltInBaseEntityIdentifierProperty=io,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=XT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=HT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=KT,y.relationalDatabaseBuiltInBaseEntityMinSizeProperty=so,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=aE,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=iE,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=nE,y.relationalDatabaseBuiltInBaseEntityPasswordProperty=ao,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=rE,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=ZP,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=tE,y.relationalDatabaseBuiltInBaseEntityRef=kn,y.relationalDatabaseBuiltInBaseEntityUsernameProperty=no,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=eE,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=kP,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=QT,y.resolveActionDescriptorName=Z1,y.resolveBaseEntityName=F1,y.resolveBuiltInBaseEntityDataTypeLabel=x1,y.resolveClonedEntityProject=ft,y.resolveConditionOperatorLabel=Bd,y.resolveDataType=wd,y.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=$c,y.resolveDataTypeLabel=Cd,y.resolveDefinitionEntityDataTypeLabel=G7,y.resolveEntityDataTypeLabel=j7,y.resolveEntityName=F,y.resolveFirstCallsSecond=Fq,y.resolveFirstWritesSecond=xq,y.resolvePrimaryKeyProperty=nJ,y.resolvePrimitiveEntityName=k1,y.resolveSearchName=S1,y.resolveVariableScope=L7,y.sequentialExecutionOperation=ti,y.sequentialExecutionOperationError=pm,y.sequentialExecutionOperationErrorParentRef=um,y.sequentialExecutionOperationListOfExecutionResultsDataType=om,y.sequentialExecutionOperationListOfExecutionResultsReturn=Rl,y.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=lm,y.sequentialExecutionOperationListOfExecutionResultsReturnRef=sm,y.sequentialExecutionOperationListOfFunctionsArgument=bl,y.sequentialExecutionOperationListOfFunctionsArgumentDatatype=am,y.sequentialExecutionOperationListOfFunctionsArgumentParentRef=dm,y.sequentialExecutionOperationListOfFunctionsArgumentRef=nm,y.sequentialExecutionOperationListOfFunctionsBlueprint=im,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=rm,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=tm,y.softDeletePersistedEntityMethod=JP,y.softDeletePersistedEntityMethodParentRef=wE,y.sortCallsBasedOnExecutionDependencies=VO,y.sortChildrenEntitiesBasedOnExecutionDependencies=jq,y.splitListOperation=ml,y.splitListOperationError=nh,y.splitListOperationErrorParentRef=ih,y.splitListOperationFirstOutputListDataType=Wy,y.splitListOperationFirstOutputListReturn=Qy,y.splitListOperationFirstOutputListReturnParentRef=Xy,y.splitListOperationFirstOutputListReturnRef=hl,y.splitListOperationInputListArgument=Yy,y.splitListOperationInputListArgumentParentRef=zy,y.splitListOperationInputListArgumentRef=ky,y.splitListOperationInputListDataType=Zy,y.splitListOperationSecondOutputListDataType=eh,y.splitListOperationSecondOutputListReturn=rh,y.splitListOperationSecondOutputListReturnParentRef=th,y.splitListOperationSplitIndexArgument=Ky,y.splitListOperationSplitIndexArgumentParentRef=Hy,y.splitListOperationSplitIndexArgumentRef=qy,y.splitListOperationSplitIndexDataType=Jy,y.splitStringOperation=fl,y.splitStringOperationError=Ry,y.splitStringOperationErrorParentRef=by,y.splitStringOperationFirstPartResultStringDataType=cy,y.splitStringOperationFirstPartResultStringReturn=Ay,y.splitStringOperationFirstPartResultStringReturnParentRef=Iy,y.splitStringOperationFirstPartResultStringReturnRef=py,y.splitStringOperationIndexArgument=Ty,y.splitStringOperationIndexArgumentParentRef=vy,y.splitStringOperationIndexArgumentRef=ly,y.splitStringOperationIndexDataType=uy,y.splitStringOperationSecondPartResultStringDataType=yy,y.splitStringOperationSecondPartResultStringReturn=xP,y.splitStringOperationSecondPartResultStringReturnParentRef=Ey,y.splitStringOperationSecondPartResultStringReturnRef=fy,y.splitStringOperationStringArgument=my,y.splitStringOperationStringArgumentParentRef=hy,y.splitStringOperationStringArgumentRef=oy,y.splitStringOperationStringDataType=dy,y.stringPrototype=ne,y.stringValueAutogenerationSchema=sp,y.suggestNewIdForEntity=Ic,y.test_primitive_entities_export=ZJ,y.toCamelCase=U7,y.toEntityState=nr,y.toKebabCase=G1,y.toLowerCaseKebabCase=Vd,y.toPascalCase=$7,y.untypedDataPrototype=Rt,y.updateErrorsList=ze,y.updateValueReader=Qq,y.urlDefaultValue=xm,y.uuidPrototype=Qr,y.validateArgumentDeclarationName=Tc,y.validateCalledByErrorIdInAction=Cq,y.validateCalledByIdInAction=Vq,y.validateCallers=hO,y.validateConditionEntityDeclaration=Mq,y.validateDataOperation=Qi,y.validateDataOperationDataToValidateArgument=Bm,y.validateDataOperationDataToValidateArgumentParentRef=Cm,y.validateDataOperationDataToValidateArgumentRef=wm,y.validateDataOperationDataToValidateDataType=Vm,y.validateDataOperationEntityToMatchTypeArgument=Nm,y.validateDataOperationEntityToMatchTypeArgumentParentRef=gm,y.validateDataOperationEntityToMatchTypeArgumentRef=_m,y.validateDataOperationEntityToMatchTypeDataType=Mm,y.validateDataOperationError=jm,y.validateDataOperationErrorParentRef=$m,y.validateDataOperationOutputEntityDeclaration=Um,y.validateDataOperationOutputEntityDeclarationParentRef=Lm,y.validateDefinitionEntityName=yc,y.validateEntryCaller=yO,y.validateErrorCaller=fO,y.validateFunctionCallDeclaration=vO,y.validateFunctionDeclarationName=hc,y.validateGeneratedEntityParentIsNotBuiltInEntity=Dq,y.validateGeneration=bq,y.validateGenerationTarget=ot,y.validateGenerationUpdate=Rq,y.validateLoopEntityDeclaration=gq,y.validateName=F7,y.validateOperationEntityDeclaration=TO,y.validatePropertyName=vc,y.validateReachability=fi,y.validateReadsValueInActionPayload=Bq,y.validateReferenceObject=gd,y.validateReferenceToOne=wc,y.validateReferences=Et,y.validateReturnDeclarationName=Ec,y.validateSuccessCaller=cO,y.validateValueReaderGenerationUpdate=ws,y.validateValueWritter=gc,y.validateVariableDeclarationName=mc,y.validateVariableInternalCallUse=Nc,y.valueAutogenerationCurrentDateAndTimeSchema=KR,y.valueAutogenerationGenericSchema=Qo,y.valueAutogenerationOptions=lp,y.valueAutogenerationOptionsSchema=HR,y.valueAutogenerationRandomBooleanSchema=ap,y.valueAutogenerationRandomDateBetweenSchema=sD,y.valueAutogenerationRandomDateFromSchema=nD,y.valueAutogenerationRandomDateSchema=rd,y.valueAutogenerationRandomDateUntilSchema=aD,y.valueAutogenerationRandomNumberBetweenSchema=eD,y.valueAutogenerationRandomNumberFromSchema=XR,y.valueAutogenerationRandomNumberSchema=ed,y.valueAutogenerationRandomNumberUntilSchema=QR,y.valueAutogenerationRandomSchema=ls,y.valueAutogenerationRandomTextBetweenSchema=iD,y.valueAutogenerationRandomTextFromSchema=tD,y.valueAutogenerationRandomTextSchema=td,y.valueAutogenerationRandomTextUntilSchema=rD,y.valueAutogenerationRangeValueTypesSchema=ds,y.valueAutogenerationUniqueSchema=np,y.waitOperation=Ft,y.waitOperationMillisecondsNumberArgument=Ki,y.waitOperationMillisecondsNumberArgumentRef=zh,y.waitOperationMillisecondsNumberDataType=Yh,y.waitOperationOperationError=Xh,y.waitOperationOperationErrorParentRef=Kh,y.waitOperationRef=Hh,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6187",
3
+ "version": "0.0.6189",
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",