@elyx-code/project-logic-tree 0.0.6431 → 0.0.6433
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 +31 -7
- package/dist/index.umd.cjs +5 -5
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -31,12 +31,12 @@ If you want to implement a new method, you can create a new 'function-declaratio
|
|
|
31
31
|
If you want to modify the existing implementation, you can update the existing method instead, but it will have to match the same base ${f.ActionDescriptor} signature, otherwise the implementation will have a validation error.`}))}}else if(v&&v.type===f.Loop){const $=v.body;$&&((A=$.implements)==null?void 0:A.id)===o.implements&&p.push(new ee({id:`${o.id}--${ae.LoopBodyFunctionOverwrite}`,code:ae.LoopBodyFunctionOverwrite,severity:q.Error,message:`The '${f.FunctionDeclaration}' with id "${o.id}" is being added as the 'body' of the ${f.Loop} with id "${v.id}", but the loop already has a function-declaration body. A loop can only have one function-declaration body at a time. You can edit the existing body instead, but it will have to match the same base signature, otherwise the implementation will have a validation error.`}))}const E=o.parent&&a.get(o.parent)||a.getBuiltIn(o.parent),b=E?Co(E):null;return b&&p.push(new ee({id:`${i.id}--${k.BuiltInEntityParent}`,code:k.BuiltInEntityParent,severity:q.Error,message:`The entity with id '${i.id}' and type '${i.type}', belongs to a built-in system entity "${ne(b,a)}" with id '${b.id}', and therefore it cannot be created as it would affect a built in entity, which are inmutable.`})),p.push(...e.errors,...y,...Ur(o)),{errors:p,modifiedData:o}}get isExtendedMethod(){if(this.parent.type!==f.DefinitionEntity)return!1;const i=this.parent.allBaseMethodsFromExtendedAndImplementedEntities.find(a=>{var o;return a.id===((o=this.extends)==null?void 0:o.id)});return!!i&&i.id!==this.id&&i.type!==f.ActionDescriptor}get returnStatements(){return _t(this).filter(o=>o.type===f.ReturnStatement&&o.parent.id===this.id)}validateGeneratedUpdate(i){const a=[];return i.parent&&(this.parent.type===f.Project?a.push(new ee({id:`${this.id}--${k.InvalidParentUpdate}`,code:k.InvalidParentUpdate,severity:q.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.
|
|
32
32
|
This is likely an incorrect strategy because this is a globally declared '${this.type}' entity which can only have the root project as its parent.`})):a.push(new ee({id:`${this.id}--${k.InvalidParentUpdate}`,code:k.InvalidParentUpdate,severity:q.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.
|
|
33
33
|
This is likely an incorrect strategy because this function declaration is a method, since it belongs to a '${this.parent.type}' entity, 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.
|
|
34
|
-
Please consider than any updates might affect the overlap with the signature of the parent entity's action descriptors.`}))),{errors:a,modifiedData:i}}subscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-dependents"))){const a=[],o=[],p=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),o.push(...v.added),p.push(...v.removed),e.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}onDetachedDependencyRemoved(i,a,o){const p=[],e=[],y=[],v=[];if(a==="function-declaration-implements"&&this.setImplements(null,o),a==="function-declaration-extends"){const{updated:E,added:b,removed:A,affected:$}=this.remove({ignoreUpstream:!1},o);p.push(...E),e.push(...b),y.push(...A),v.push(...$)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,o){const p=[],e=[],y=[],v=[];if(a==="function-declaration-implements"&&(this.setImplements(i,o),p.push(i)),a==="function-declaration-extends"){const{updated:E,added:b,removed:A,affected:$}=this.restore({},o);p.push(...E),e.push(...b),y.push(...A),v.push(...$)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){var i,a;return(i=this.implements)==null||i.unsubscribeDependents([{entity:this,field:"function-declaration-implements"}]),(a=this.extends)==null||a.unsubscribeDependents([{entity:this,field:"function-declaration-extends"}]),this}subscribeToDependencies(){var i,a;return(i=this.implements)==null||i.subscribeDependents([{entity:this,field:"function-declaration-implements"}]),(a=this.extends)==null||a.subscribeDependents([{entity:this,field:"function-declaration-extends"}]),this}increaseVersion(i){if(i&&!L(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&L(i).isSame(L(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=L(i).toISOString()||L().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new Lt(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.inputs=[...this.inputs],i.calls=[...this.calls],i.implements=this.implements,i.extends=this.extends,i.detachedChildren=[...this.detachedChildren],i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const a=[],o=[],p=[],e=[];if(this.parent&&this.parent.type!==f.PrimitiveEntity&&this.parent.type!==f.BuiltInBaseEntity){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),o.push(...y.added),p.push(...y.removed)}return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}async restoreVersion(i){var v;const a=[],o=[],p=[],e=[];if(this.version===i)return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[$,V]of A.knownVersions)E.set($,V);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new Lt(E,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.inputs=y.inputs,this.calls=y.calls,this.implements=y.implements,this.detachedChildren=y.detachedChildren,this.parent=y.parent,{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"update-with-shallow-transfer"))){if(this.metaSync(i,a),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent){const o=H(i.parent),p=this.project.get(o),e=this.parent;if(e&&e.id!==(p==null?void 0:p.id)&&this.removeFromParent(a),p)this.setParent(p,null);else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${o}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.implements){const o=H(i.implements),p=this.project.get(o);if(p)this.setImplements(p,a);else if(o)throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${Ri(this.type)} with id '${this.id}' has a 'implements' reference "${o}" which is missing in the project`)}if(i.extends){const o=H(i.extends),p=this.project.get(o);if(p)this.setExtends(p,a);else if(o)throw new Error(`${Ri(this.type)} with id '${this.id}' has a 'extends' reference "${o}" which is missing in the project`)}return this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const i=[],a=[],o=[],p=[];if(this.initialData.parent){const e=H(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${Ri(this.type)} with id '${this.id}' has a 'parent' reference "${e}" which is missing in the project`)}else throw new Error(`${Ri(this.type)} with id '${this.id}' is missing a 'parent' reference`);if(this.initialData.implements){const e=H(this.initialData.implements),y=this.project.get(e);if(y)this.setImplements(y,null),i.push(y);else if(e)throw new Error(`${Ri(this.type)} with id '${this.id}' has a 'implements' reference "${e}" which is missing in the project`)}if(this.initialData.extends){const e=H(this.initialData.extends),y=this.project.get(e);if(y)this.setExtends(y,null),i.push(y);else if(e)throw new Error(`${Ri(this.type)} with id '${this.id}' has a 'extends' reference "${e}" which is missing in the project`)}return{updated:R(i),added:R(a),removed:R(o),affected:R(p),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],o=[],p=[],e=[];this.initialized=!0;const{updated:y,added:v,removed:E}=this.syncInputs(i);return a.push(...y),o.push(...v),p.push(...E),this.captureVersion(),i==null||i.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-self-to-project"))){const a=[this],o=[],p=[],e=[];return this.parent===this.project?this.project.addFunctionDeclaration(this):this.parent.type===f.DefinitionEntity?(this.parent.addMethod(this),e.push(this.parent)):this.parent.type===f.Loop&&(this.parent.setBody(this),e.push(this.parent)),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}replaceDetachedChild(i,a){const o=this.detachedChildren.indexOf(i);return o!==-1&&(this.detachedChildren[o]=a),this}subscribeDetachedChild(i){return this.detachedChildren.includes(i)||this.detachedChildren.push(i),this}unsubscribeDetachedChild(i){const a=this.detachedChildren.indexOf(i);return a!==-1&&this.detachedChildren.splice(a,1),this}addInputDeclaration(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-input-declaration"))){return this.inputs.includes(i)?(a==null||a.attemptAutoclose("add-input-declaration",this.id),this):(this.inputs.push(i),a==null||a.attemptAutoclose("add-input-declaration",this.id),this)}removeInputDeclaration(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-input-declaration"))){const o=this.inputs.findIndex(p=>p.id===i.id);return o>-1&&(this.inputs.splice(o,1),a&&(a==null||a.add(this,S.Affected))),a==null||a.attemptAutoclose("remove-input-declaration",this.id),this}setParent(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-parent"))){var o;return((o=this.parent)==null?void 0:o.id)!==(i==null?void 0:i.id)&&(this.parent=i,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-parent",this.id),this}setImplements(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-implements"))){var o;return((o=this.implements)==null?void 0:o.id)!==(i==null?void 0:i.id)&&(this.implements=i,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-implements",this.id),this}setExtends(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-extends"))){var o;return((o=this.extends)==null?void 0:o.id)!==(i==null?void 0:i.id)&&(this.extends=i,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-extends",this.id),this}addCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-call"))){return this.calls.includes(i)||(this.calls.push(i),a==null||a.add(i,S.Affected)),a==null||a.attemptAutoclose("add-call",this.id),this}removeCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-call"))){const o=this.calls.indexOf(i);return o!==-1&&(this.calls.splice(o,1),a==null||a.add(i,S.Affected)),a==null||a.attemptAutoclose("remove-call",this.id),this}initChildren(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.inputs=this.initialData.inputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),o}),this.calls=this.initialData.calls.map(a=>{const o=te(a,this.project);return o.addEntryCaller(this,null),[f.BreakStatement,f.ContinueStatement].includes(o.type)?(o.setParent(this.parent,null),o.initChildren(i)):o.type!==f.InternalCall&&(o.setParent(this,null),o.initChildren(i)),o}),this.initialData.implements&&(this.implements=te(this.initialData.implements,this.project)),this.initialData.extends&&(this.extends=te(this.initialData.extends,this.project)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"meta-sync"))){const o=xr(this,i),p=this.toMeta();return this.name=i.name!==void 0?i.name:p.name,this.codeName=i.codeName!==void 0?i.codeName:p.codeName,this.description=i.description!==void 0?i.description:p.description,this.private=i.private!==void 0?i.private:this.private,this.index=i.index||(i.index!==0?p.index:0),this.collapsed=i.collapsed!==void 0?i.collapsed:p.collapsed,this.x=i.x||p.x,this.y=i.y||p.y,super.metaSync(i),i.deleted===!0&&!p.deleted?a==null||a.add(this,S.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,S.Added):o&&(a==null||a.add(this,S.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ve,...a){return await Lt.repository.APILoad(this.id,...a),this}async APICreate(i=ve,...a){return await Lt.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ve,...a){return await Lt.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ve,...a){return await Lt.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ve,...a){return await Lt.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ve,a,...o){return await Lt.repository.APILoadVersion(this.id,a,...o)}removeFromParent(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-from-parent"))){const a=[],o=[],p=[],e=[];return this.parent.type===f.DefinitionEntity?(this.parent.removeMethod(this),i==null||i.add(this.parent,S.Affected),e.push(this.parent)):this.parent.type===f.Loop?(this.parent.detachBody(),i==null||i.add(this.parent,S.Affected),e.push(this.parent)):this.parent.type===f.Project&&(this.project.removeFunctionDeclaration(this),i==null||i.add(this.parent,S.Affected),e.push(this.parent)),i==null||i.attemptAutoclose("remove-from-parent",this.id),{added:R(p),updated:R(a),removed:R(o),affected:R(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-entity"))){const o=[],p=[],e=[],y=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(p.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(E=>{const{updated:b,removed:A,added:$}=E.entity.onDetachedDependencyRemoved(this,E.field,a);o.push(...b),p.push(...A),e.push(...$)}),this.inputs.forEach(E=>{const{updated:b,removed:A}=E.remove({ignoreUpstream:!0},a);o.push(...b),p.push(...A)}),Is(this).forEach(E=>{const{updated:b,removed:A}=E.remove({ignoreUpstream:!0},a);o.push(...b),p.push(...A)}),!i){const E=this.removeFromParent(a);e.push(...E.added),o.push(...E.updated),p.push(...E.removed),y.push(...E.affected)}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:R(e),updated:R(o),removed:R(p),affected:R(y),self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"restore-entity"))){const a=[],o=[],p=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:A}=v.entity.onDetachedDependencyRestored(this,v.field,i);o.push(...E),p.push(...b),a.push(...A)}),this.inputs.forEach(v=>{const{updated:E}=v.restore({},i);o.push(...E)}),Is(this).forEach(v=>{const{updated:E}=v.restore({},i);o.push(...E)}),this.parent.type===f.DefinitionEntity&&(this.parent.addMethod(this),i==null||i.add(this.parent,S.Affected),e.push(this.parent)),i==null||i.attemptAutoclose("restore-entity",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this})}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.inputs.flatMap(o=>o.toFlat(i)),...this.calls.flatMap(o=>o.toFlat(i)),...this.returnStatements.flatMap(o=>o.toFlat(i)),...this.implements?this.implements.toFlat(i):[]])}toFlatIds(i=new Set){if(i.has(this.id))return[];i.add(this.id);const a=Is(this);return[this.id,...this.inputs.flatMap(p=>p.toFlatIds(i)),...this.calls.flatMap(p=>p.toFlatIds(i)),...this.returnStatements.flatMap(p=>p.toFlatIds(i)),...this.implements?this.implements.toFlatIds(i):[],...a.flatMap(p=>p.toFlatIds(i))]}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,codeName:this.codeName,description:this.description,collapsed:this.collapsed,private:this.private,index:this.index,x:this.x,y:this.y,type:this.type,name:this.name}}toJSON(i=new Set){var a,o;return i.has(this.id)?this.toReference():(i.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,codeName:this.codeName,description:this.description,index:this.index,x:this.x,y:this.y,collapsed:this.collapsed,private:this.private,calls:this.calls.map(p=>p.toJSON(i)),inputs:this.inputs.map(p=>p.toJSON(i)),implements:((a=this.implements)==null?void 0:a.toJSON(i))||null,extends:((o=this.extends)==null?void 0:o.toJSON(i))||null,parent:this.parent.toReference()})}toJSONClone(i=ke){var o,p,e,y,v;let a;return(o=i.seenEntityMaps)!=null&&o.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||Kr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(p=i.seenEntities)!=null&&p.has(a)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(a),(v=i.seenEntities)==null||v.add(this.id),{id:a,version:N.UUID.uuid(),createdAt:i.timestamp||L().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,name:this.name,codeName:this.codeName,description:this.description,index:this.index,x:this.x,y:this.y,collapsed:this.collapsed,private:this.private,calls:this.calls.map(E=>E.toJSONClone({...i,newId:null})),inputs:this.inputs.map(E=>E.toJSONClone({...i,newId:null})),implements:(()=>{var E;return this.implements&&this.project.getBuiltIn(this.implements.id)?this.implements.toJSON():(E=this.implements)==null?void 0:E.toJSONClone({...i,newId:null})})(),extends:(()=>{var E;return this.extends&&this.project.getBuiltIn(this.extends.id)?this.extends.toJSON():(E=this.extends)==null?void 0:E.toJSONClone({...i,newId:null})})(),parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=ke){var o;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+N.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=ke){var o,p,e;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,codeName:this.codeName,description:this.description,index:this.index,collapsed:this.collapsed,private:this.private,x:this.x,y:this.y,inputs:this.inputs.map(y=>y.toReference(i)),calls:this.calls.map(y=>y.toReference(i)),implements:((p=this.implements)==null?void 0:p.toReference(i))||null,extends:((e=this.extends)==null?void 0:e.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.inputs.flatMap(o=>o.toFlatJSON(i)),...this.calls.flatMap(o=>o.toFlatJSON(i)),...this.returnStatements.flatMap(o=>o.toFlatJSON(i)),...this.implements?this.implements.toFlatJSON(i):[]])}toGenerationTarget(){var a,o;const i=this.parent.type===f.Project?void 0:this.parent.id;return{id:this.id,name:this.name,description:this.description||void 0,type:this.type,private:this.private,implements:((a=this.implements)==null?void 0:a.id)||void 0,extends:((o=this.extends)==null?void 0:o.id)||void 0,parent:i}}toFlatGenerationTarget(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.inputs.flatMap(o=>o.toFlatGenerationTarget(i)),...this.calls.flatMap(o=>o.toFlatGenerationTarget(i)),...this.returnStatements.flatMap(o=>o.toFlatGenerationTarget(i))])}clearErrors(){return this.errors=[],this.inputs.forEach(i=>i.clearErrors()),this.calls.forEach(i=>i.clearErrors()),this.returnStatements.forEach(i=>i.clearErrors()),this}validate(){const i=Xx(this);return this.errors=[...i],{success:!0}}getErrors(){const i=Is(this);return[...this.errors,...this.inputs.flatMap(o=>o.getErrors()),...i.flatMap(o=>o.getErrors())]}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"clone-entity")),a=null,o=null,p=!0,e=!1){var V;let y=Sr(a,this);const v=this.toJSON(),E=o||N.UUID.uuid();v.inputs=[],v.calls=[],v.id=E,v.version=N.UUID.uuid(),v.createdAt=(i==null?void 0:i.timestamp)||L().toISOString(),v.author=(i==null?void 0:i.author)||"1",v.previousVersion=null,v.deleted=!1;const b=dr(v,y);a?b.setParent(a,null):b.setParent(this.parent,null),p&&b.subscribe(),b.initChildren(i),i==null||i.add(b,S.Added);const A=(V=this.inputs)==null?void 0:V.map(B=>B.clone(i,b,N.UUID.uuid(),p));return b.inputs=A,e?(Is(this).map(B=>B.clone(i,b,N.UUID.uuid(),p)),i==null||i.attemptAutoclose("clone-entity",this.id),b):(i==null||i.attemptAutoclose("clone-entity",this.id),b)}getVariableInstances(){return vr(this).filter(o=>o.type===f.VariableInstance)}getArgument(i){return this.inputs.find(a=>a.id===i)||null}createCall(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"create-call")),a=this.project,o={}){const p={id:o.id||N.UUID.uuid(),version:o.version||N.UUID.uuid(),createdAt:o.createdAt||(i==null?void 0:i.timestamp)||L().toISOString(),author:o.author||N.sessionAuthor||"1",previousVersion:o.previousVersion||null,deleted:o.deleted||!1,type:f.FunctionCall,parent:a.toReference(),successCalls:o.successCalls||[],errorCalls:o.errorCalls||[],inputs:o.inputs||[],outputs:o.outputs||[],error:o.error||null,process:o.process||null,calledBySuccess:o.calledBySuccess||[],calledByError:o.calledByError||[],calledByEntry:o.calledByEntry||[],declaration:this.toJSON(),x:0,y:0},e=te(p,this.project);return e.hydrateAncestors(),i==null||i.add(e,S.Added),e.addSelfToProject(i),e.setParent(a,i),e.initChildren(i),e.afterAllChildrenInitialized(i),i==null||i.add(e,S.Added),i==null||i.attemptAutoclose("create-call",this.id),e}createInternalCall(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"create-internal")),a,o={}){const p={id:o.id||N.UUID.uuid(),version:o.version||N.UUID.uuid(),createdAt:o.createdAt||(i==null?void 0:i.timestamp)||L().toISOString(),author:o.author||N.sessionAuthor||"1",previousVersion:o.previousVersion||null,deleted:o.deleted||!1,type:f.InternalCall,parent:a.toReference(),successCalls:o.successCalls||[],errorCalls:o.errorCalls||[],inputs:o.inputs||[],outputs:o.outputs||[],error:o.error||null,process:o.process||null,calledBySuccess:o.calledBySuccess||[],calledByError:o.calledByError||[],calledByEntry:o.calledByEntry||[],declaration:this.toShallowJSON(),index:a.internalCalls.length},e=te(p,this.project);return e.hydrateAncestors(),i==null||i.add(e,S.Added),e.addSelfToProject(i),e.setParent(a,i),e.initChildren(i),e.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("create-internal",this.id),e}addReturnStatement(i){return this.returnStatements.includes(i)||this.returnStatements.push(i),this}removeReturnStatement(i){const a=this.returnStatements.indexOf(i);return a!==-1&&this.returnStatements.splice(a,1),this}getUniqueReturnDeclarations(){const i=[],a=[...this.returnStatements];this.parent.type===f.Loop&&a.push(...this.parent.breakStatements,...this.parent.continueStatements);const o=a.flatMap(p=>p.outputs);if(this.implements&&this.parent.type!==f.Loop){const p=this.implements.outputs;return o.forEach(e=>{const y=p.find(E=>E===e.implements),v=i.find(E=>E.implements===e.implements);y&&!v&&i.push(e)}),R(i)}else return o.forEach(p=>{i.find(y=>y===p||ne(y,this.project)===ne(p,this.project)&&en(y.dataType,p.dataType))||i.push(p)}),R(i)}removeUnrecognizedInputs(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-unrecognized-inputs"))){const a=[],o=[],p=[],e=[];return this.implements?(this.inputs.forEach(v=>{var b;if(!(((b=this.implements)==null?void 0:b.inputs)||[]).find(A=>{var $;return A.id===(($=v.implements)==null?void 0:$.id)})){const A=v.remove({ignoreUpstream:!1},i);p.push(...A.removed),a.push(...A.updated)}}),this.inputs.filter((v,E)=>{const b=this.inputs.findIndex($=>$.implements===v.implements&&$!==v);if(b===-1)return!1;const A=this.inputs[b];return L(A==null?void 0:A.createdAt).isSame(L(v.createdAt))?E>b:!!L(A==null?void 0:A.createdAt).isAfter(v.createdAt)}).forEach(v=>{const E=v.remove({ignoreUpstream:!1},i);p.push(...E.removed),a.push(...E.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-inputs",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}):(i==null||i.attemptAutoclose("remove-unrecognized-inputs",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this})}syncInputs(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-missing-fixed-inputs"))){var A;const a=[],o=[],p=[],e=[],y=(((A=this.implements)==null?void 0:A.inputs)||[]).filter($=>$.parentRelationType===oe.FixedArguments&&!this.inputs.find(V=>{var B;return((B=V.implements)==null?void 0:B.id)===$.id}));this.inputs.sort(($,V)=>$.index-V.index),y.forEach($=>{this.inputs.forEach(F=>{F.index>=$.index&&F.metaSync({index:F.index+1},i)});const V=ea.new(i);V.implements=$.toJSON(),V.index=$.index,V.parent=this.toReference(),V.name=$.name;const B=te(V,this.project);B.hydrateAncestors(),i==null||i.add(B,S.Added),B.setParent(this,i),B.initChildren(i),B.addSelfToProject(i)}),this.inputs.sort(($,V)=>$.index-V.index);const{updated:v,added:E,removed:b}=this.removeUnrecognizedInputs(i);return a.push(...v),o.push(...E),p.push(...b),i==null||i.attemptAutoclose("sync-missing-fixed-inputs",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}};g(Lt,"repository",{APICreate:async(i,...a)=>i,APIUpdate:async(i,...a)=>i,APIDelete:async(i,...a)=>i,APIClone:async(i,...a)=>{},APILoad:async(i,...a)=>null,APILoadVersion:async(i,a,...o)=>null}),g(Lt,"type",f.FunctionDeclaration),g(Lt,"USER_MANAGED_PARENT_TYPES",[f.Project,f.InstalledProject,f.DefinitionEntity,f.Loop]),g(Lt,"PARENT_TYPES",[...Lt.USER_MANAGED_PARENT_TYPES,f.BuiltInBaseEntity,f.PrimitiveEntity]),g(Lt,"MUTABLE_BASE_PROPERTIES",["name","codeName","description","private"]),g(Lt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),g(Lt,"BASE_PROPERTIES",[...Lt.MUTABLE_BASE_PROPERTIES,...Lt.INMUTABLE_BASE_PROPERTIES]),g(Lt,"MUTABLE_META_PROPERTIES",[...Lt.MUTABLE_BASE_PROPERTIES,"x","y","index","collapsed"]),g(Lt,"INMUTABLE_META_PROPERTIES",[...Lt.INMUTABLE_BASE_PROPERTIES]),g(Lt,"META_PROPERTIES",[...Lt.MUTABLE_META_PROPERTIES,...Lt.INMUTABLE_META_PROPERTIES]),g(Lt,"MUTABLE_UPSTREAM_PROPERTIES",[]),g(Lt,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","implements","extends"]),g(Lt,"UPSTREAM_PROPERTIES",[...Lt.MUTABLE_UPSTREAM_PROPERTIES,...Lt.INMUTABLE_UPSTREAM_PROPERTIES]),g(Lt,"MUTABLE_DOWNSTREAM_PROPERTIES",["inputs","calls"]),g(Lt,"INMUATABLE_DOWNSTREAM_PROPERTIES",[]),g(Lt,"DOWNSTREAM_PROPERTIES",[...Lt.MUTABLE_DOWNSTREAM_PROPERTIES,...Lt.INMUATABLE_DOWNSTREAM_PROPERTIES]),g(Lt,"PROPERTIES",[...Lt.META_PROPERTIES,...Lt.UPSTREAM_PROPERTIES,...Lt.DOWNSTREAM_PROPERTIES]);let uo=Lt;function tj(d){const u=n0e(),i=d.toJSON();u.safeParse(i).success;const o=[];if(d.entity&&d.andChildrenGroup||d.entity&&d.orChildrenGroup||d.andChildrenGroup&&d.orChildrenGroup){const p=mt({id:d.id+"--"+le.InvalidPropertiesCombination,message:`Data type with id "${d.id}" has invalid properties combination. Only one of the following properties can be present at the time: 'entity', 'andChildrenGroup' or 'orChildrenGroup'`,severity:q.Error,code:le.InvalidPropertiesCombination,entity:d});o.push(p.error)}return Er(d.errors,o)}const F0e=Object.freeze(Object.defineProperty({__proto__:null,validate:tj},Symbol.toStringTag,{value:"Module"}));function S0e(d,u){const i=[],a=[f.DefinitionEntity,f.ActionDescriptor,f.Property,f.ArgumentDeclaration,f.ReturnDeclaration,f.VariableDeclaration,f.ValueDescriptor,f.DataType],o=`'${ot(a,"', '","' or '")}'`;if(d.parent)if(d.id===d.parent)i.push(new ee({id:`${d.id}--${d.parent}--${k.SelfReference}`,code:k.SelfReference,severity:q.Error,message:`Entity of type "${d.type}" with id "${d.id}", has a reference to itself at 'parent'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`}));else{const p=u.get(d.parent);p?a.includes(p.type)||i.push(new ee({id:`${d.id}--${d.parent}--${k.InvalidParentReference}`,code:k.InvalidParentReference,severity:q.Error,message:`Entity of type "${d.type}" with id "${d.id}", has a parent reference that isn't pointing to an entity of type ${o}.`})):i.push(new ee({id:`${d.id}--${d.parent}--${k.ReferencedEntityNotFound}`,code:k.ReferencedEntityNotFound,severity:q.Error,message:`Entity of type "${d.type}" with id "${d.id}", is referencing an entity with id "${d.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`}))}else i.push(new ee({id:`${d.id}--${ae.InvalidObjectStructure}`,code:ae.InvalidObjectStructure,severity:q.Error,message:`Entity of type "${d.type}" with id "${d.id}" is missing a 'parent' reference. The 'parent' of a 'data-type' entity must be a reference to an entity of type ${o}.`}));if(d.entity){if(d.id===d.entity)return i.push(new ee({id:`${d.id}--${d.entity}--${k.SelfReference}`,code:k.SelfReference,severity:q.Error,message:`Entity of type "${d.type}" with id "${d.id}", has a reference to itself at 'entity'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`})),i;const p=u.get(d.entity);p?[f.DefinitionEntity,f.PrimitiveEntity,f.ActionDescriptor,f.BuiltInBaseEntity].includes(p.type)||i.push(new ee({id:`${d.id}--${d.entity}--${k.InvalidImplementsReference}`,code:k.InvalidImplementsReference,severity:q.Error,message:`Entity of type "${d.type}" with id "${d.id}", has an 'entity' reference that isn't pointing to an entity of type 'definition-entity', 'primitive-entity', 'action-descriptor' or 'built-in-base-entity'.`})):i.push(new ee({id:`${d.id}--${d.entity}--${k.ReferencedEntityNotFound}`,code:k.ReferencedEntityNotFound,severity:q.Error,message:`Entity of type "${d.type}" with id "${d.id}", is referencing an entity with id "${d.entity}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`}))}return i}var vA=(d=>(d.Entity="entity",d))(vA||{});const Mt=class Mt extends Nr{constructor(i,a){super(i);g(this,"initialData");g(this,"id");g(this,"isList",null);g(this,"asType",null);g(this,"type",f.DataType);g(this,"options",null);g(this,"parentRelationType",null);g(this,"like");g(this,"implementationChooseOne",!1);g(this,"inferred",!1);g(this,"staticEntities",null);g(this,"interactiveEntities",null);g(this,"actionEntities",null);g(this,"index",null);g(this,"entity",null);g(this,"andChildrenGroup",null);g(this,"orChildrenGroup",null);g(this,"project");g(this,"errors",[]);g(this,"parent");g(this,"detachedDependents",{});g(this,"knownVersions",null);g(this,"activeVersion",!1);g(this,"initialized",!1);g(this,"startedInitialization",!1);this.initialData=i,this.project=a,this.id=i.id,this.isList=i.isList,this.asType=i.asType,this.options=i.options,this.index=i.index||null,this.parentRelationType=i.parentRelationType,this.inferred=i.inferred||!1,this.like=i.like||!1,this.implementationChooseOne=i.implementationChooseOne||!1,this.staticEntities=i.staticEntities,this.interactiveEntities=i.interactiveEntities,this.actionEntities=i.actionEntities}static new(i=null){return{id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,entity:null,isList:!1,like:!1,index:null,inferred:!1,implementationChooseOne:!1,parentRelationType:null,options:null,asType:null,staticEntities:null,interactiveEntities:null,actionEntities:null,andChildrenGroup:null,orChildrenGroup:null,parent:null}}static fromGenerationTarget(i,a){const o=H(i.parent),p=a.get(o);let e=null;i.entity&&(e=a.get(i.entity));let y=null;p&&p.type===f.DataType&&(i.parentRelationType===Ii.OrDataTypeGroup?y=(p.orChildrenGroup||[]).length:i.parentRelationType===Ii.AndDataTypeGroup&&(y=(p.andChildrenGroup||[]).length));const v={id:i.id,version:N.UUID.uuid(),createdAt:L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,andChildrenGroup:null,orChildrenGroup:null,parentRelationType:i.parentRelationType||null,options:i.options||null,isList:i.isList,like:i.like||!1,index:y,inferred:!1,implementationChooseOne:i.implementationChooseOne||!1,staticEntities:i.staticEntities??null,interactiveEntities:i.interactiveEntities??null,actionEntities:i.actionEntities??null,entity:e,asType:i.asType,parent:p},E=te(v,a);return E.setParent(p,null),E}static validateGenerationTarget(i,a){var E;let o=JSON.parse(JSON.stringify(i));const p=[],e=S0e(o,a);if(p.push(...e,...Ur(o)),o.entity){const b=a.get(o.entity);if(b.type===f.DefinitionEntity){const $=xi(b).filter(V=>!V.interactive);if($.length){const V=$.length>1?`entities with ids '${ot($.map(B=>B.id),"', '","' and '")}'`:`entity with id '${$[0].id}'`;p.push(new ee({id:`${i.id}--${k.NonInteractiveEntityReferenced}`,code:k.NonInteractiveEntityReferenced,severity:q.Error,message:`The entity with id '${i.id}' and type '${i.type}', cannot reference 'definition-entity' with id '${o.entity}' at 'entity'. The entity extends or implements non-interactive built-in-base-entity ${V}.
|
|
34
|
+
Please consider than any updates might affect the overlap with the signature of the parent entity's action descriptors.`}))),{errors:a,modifiedData:i}}subscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-dependents"))){const a=[],o=[],p=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),o.push(...v.added),p.push(...v.removed),e.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}onDetachedDependencyRemoved(i,a,o){const p=[],e=[],y=[],v=[];if(a==="function-declaration-implements"&&this.setImplements(null,o),a==="function-declaration-extends"){const{updated:E,added:b,removed:A,affected:$}=this.remove({ignoreUpstream:!1},o);p.push(...E),e.push(...b),y.push(...A),v.push(...$)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,o){const p=[],e=[],y=[],v=[];if(a==="function-declaration-implements"&&(this.setImplements(i,o),p.push(i)),a==="function-declaration-extends"){const{updated:E,added:b,removed:A,affected:$}=this.restore({},o);p.push(...E),e.push(...b),y.push(...A),v.push(...$)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){var i,a;return(i=this.implements)==null||i.unsubscribeDependents([{entity:this,field:"function-declaration-implements"}]),(a=this.extends)==null||a.unsubscribeDependents([{entity:this,field:"function-declaration-extends"}]),this}subscribeToDependencies(){var i,a;return(i=this.implements)==null||i.subscribeDependents([{entity:this,field:"function-declaration-implements"}]),(a=this.extends)==null||a.subscribeDependents([{entity:this,field:"function-declaration-extends"}]),this}increaseVersion(i){if(i&&!L(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&L(i).isSame(L(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=L(i).toISOString()||L().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new Lt(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.inputs=[...this.inputs],i.calls=[...this.calls],i.implements=this.implements,i.extends=this.extends,i.detachedChildren=[...this.detachedChildren],i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const a=[],o=[],p=[],e=[];if(this.parent&&this.parent.type!==f.PrimitiveEntity&&this.parent.type!==f.BuiltInBaseEntity){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),o.push(...y.added),p.push(...y.removed)}return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}async restoreVersion(i){var v;const a=[],o=[],p=[],e=[];if(this.version===i)return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[$,V]of A.knownVersions)E.set($,V);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new Lt(E,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.inputs=y.inputs,this.calls=y.calls,this.implements=y.implements,this.detachedChildren=y.detachedChildren,this.parent=y.parent,{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"update-with-shallow-transfer"))){if(this.metaSync(i,a),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent){const o=H(i.parent),p=this.project.get(o),e=this.parent;if(e&&e.id!==(p==null?void 0:p.id)&&this.removeFromParent(a),p)this.setParent(p,null);else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${o}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.implements){const o=H(i.implements),p=this.project.get(o);if(p)this.setImplements(p,a);else if(o)throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${Ri(this.type)} with id '${this.id}' has a 'implements' reference "${o}" which is missing in the project`)}if(i.extends){const o=H(i.extends),p=this.project.get(o);if(p)this.setExtends(p,a);else if(o)throw new Error(`${Ri(this.type)} with id '${this.id}' has a 'extends' reference "${o}" which is missing in the project`)}return this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const i=[],a=[],o=[],p=[];if(this.initialData.parent){const e=H(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${Ri(this.type)} with id '${this.id}' has a 'parent' reference "${e}" which is missing in the project`)}else throw new Error(`${Ri(this.type)} with id '${this.id}' is missing a 'parent' reference`);if(this.initialData.implements){const e=H(this.initialData.implements),y=this.project.get(e);if(y)this.setImplements(y,null),i.push(y);else if(e)throw new Error(`${Ri(this.type)} with id '${this.id}' has a 'implements' reference "${e}" which is missing in the project`)}if(this.initialData.extends){const e=H(this.initialData.extends),y=this.project.get(e);if(y)this.setExtends(y,null),i.push(y);else if(e)throw new Error(`${Ri(this.type)} with id '${this.id}' has a 'extends' reference "${e}" which is missing in the project`)}return{updated:R(i),added:R(a),removed:R(o),affected:R(p),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],o=[],p=[],e=[];this.initialized=!0;const{updated:y,added:v,removed:E}=this.syncInputs(i);return a.push(...y),o.push(...v),p.push(...E),this.captureVersion(),i==null||i.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-self-to-project"))){const a=[this],o=[],p=[],e=[];return this.parent===this.project?this.project.addFunctionDeclaration(this):this.parent.type===f.DefinitionEntity?(this.parent.addMethod(this),e.push(this.parent)):this.parent.type===f.Loop&&(this.parent.setBody(this),e.push(this.parent)),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}replaceDetachedChild(i,a){const o=this.detachedChildren.indexOf(i);return o!==-1&&(this.detachedChildren[o]=a),this}subscribeDetachedChild(i){return this.detachedChildren.includes(i)||this.detachedChildren.push(i),this}unsubscribeDetachedChild(i){const a=this.detachedChildren.indexOf(i);return a!==-1&&this.detachedChildren.splice(a,1),this}addInputDeclaration(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-input-declaration"))){return this.inputs.includes(i)?(a==null||a.attemptAutoclose("add-input-declaration",this.id),this):(this.inputs.push(i),a==null||a.attemptAutoclose("add-input-declaration",this.id),this)}removeInputDeclaration(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-input-declaration"))){const o=this.inputs.findIndex(p=>p.id===i.id);return o>-1&&(this.inputs.splice(o,1),a&&(a==null||a.add(this,S.Affected))),a==null||a.attemptAutoclose("remove-input-declaration",this.id),this}setParent(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-parent"))){var o;return((o=this.parent)==null?void 0:o.id)!==(i==null?void 0:i.id)&&(this.parent=i,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-parent",this.id),this}setImplements(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-implements"))){var o;return((o=this.implements)==null?void 0:o.id)!==(i==null?void 0:i.id)&&(this.implements=i,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-implements",this.id),this}setExtends(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-extends"))){var o;return((o=this.extends)==null?void 0:o.id)!==(i==null?void 0:i.id)&&(this.extends=i,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-extends",this.id),this}addCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-call"))){return this.calls.includes(i)||(this.calls.push(i),a==null||a.add(i,S.Affected)),a==null||a.attemptAutoclose("add-call",this.id),this}removeCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-call"))){const o=this.calls.indexOf(i);return o!==-1&&(this.calls.splice(o,1),a==null||a.add(i,S.Affected)),a==null||a.attemptAutoclose("remove-call",this.id),this}initChildren(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.inputs=this.initialData.inputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),o}),this.calls=this.initialData.calls.map(a=>{const o=te(a,this.project);return o.addEntryCaller(this,null),[f.BreakStatement,f.ContinueStatement].includes(o.type)?(o.setParent(this.parent,null),o.initChildren(i)):o.type!==f.InternalCall&&(o.setParent(this,null),o.initChildren(i)),o}),this.initialData.implements&&(this.implements=te(this.initialData.implements,this.project)),this.initialData.extends&&(this.extends=te(this.initialData.extends,this.project)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"meta-sync"))){const o=xr(this,i),p=this.toMeta();return this.name=i.name!==void 0?i.name:p.name,this.codeName=i.codeName!==void 0?i.codeName:p.codeName,this.description=i.description!==void 0?i.description:p.description,this.private=i.private!==void 0?i.private:this.private,this.index=i.index||(i.index!==0?p.index:0),this.collapsed=i.collapsed!==void 0?i.collapsed:p.collapsed,this.x=i.x||p.x,this.y=i.y||p.y,super.metaSync(i),i.deleted===!0&&!p.deleted?a==null||a.add(this,S.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,S.Added):o&&(a==null||a.add(this,S.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ve,...a){return await Lt.repository.APILoad(this.id,...a),this}async APICreate(i=ve,...a){return await Lt.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ve,...a){return await Lt.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ve,...a){return await Lt.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ve,...a){return await Lt.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ve,a,...o){return await Lt.repository.APILoadVersion(this.id,a,...o)}removeFromParent(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-from-parent"))){const a=[],o=[],p=[],e=[];return this.parent.type===f.DefinitionEntity?(this.parent.removeMethod(this),i==null||i.add(this.parent,S.Affected),e.push(this.parent)):this.parent.type===f.Loop?(this.parent.detachBody(),i==null||i.add(this.parent,S.Affected),e.push(this.parent)):this.parent.type===f.Project&&(this.project.removeFunctionDeclaration(this),i==null||i.add(this.parent,S.Affected),e.push(this.parent)),i==null||i.attemptAutoclose("remove-from-parent",this.id),{added:R(p),updated:R(a),removed:R(o),affected:R(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-entity"))){const o=[],p=[],e=[],y=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(p.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(E=>{const{updated:b,removed:A,added:$}=E.entity.onDetachedDependencyRemoved(this,E.field,a);o.push(...b),p.push(...A),e.push(...$)}),this.inputs.forEach(E=>{const{updated:b,removed:A}=E.remove({ignoreUpstream:!0},a);o.push(...b),p.push(...A)}),Is(this).forEach(E=>{const{updated:b,removed:A}=E.remove({ignoreUpstream:!0},a);o.push(...b),p.push(...A)}),!i){const E=this.removeFromParent(a);e.push(...E.added),o.push(...E.updated),p.push(...E.removed),y.push(...E.affected)}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:R(e),updated:R(o),removed:R(p),affected:R(y),self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"restore-entity"))){const a=[],o=[],p=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:A}=v.entity.onDetachedDependencyRestored(this,v.field,i);o.push(...E),p.push(...b),a.push(...A)}),this.inputs.forEach(v=>{const{updated:E}=v.restore({},i);o.push(...E)}),Is(this).forEach(v=>{const{updated:E}=v.restore({},i);o.push(...E)}),this.parent.type===f.DefinitionEntity&&(this.parent.addMethod(this),i==null||i.add(this.parent,S.Affected),e.push(this.parent)),i==null||i.attemptAutoclose("restore-entity",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this})}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.inputs.flatMap(o=>o.toFlat(i)),...this.calls.flatMap(o=>o.toFlat(i)),...this.returnStatements.flatMap(o=>o.toFlat(i)),...this.implements?this.implements.toFlat(i):[]])}toFlatIds(i=new Set){if(i.has(this.id))return[];i.add(this.id);const a=Is(this);return[this.id,...this.inputs.flatMap(p=>p.toFlatIds(i)),...this.calls.flatMap(p=>p.toFlatIds(i)),...this.returnStatements.flatMap(p=>p.toFlatIds(i)),...this.implements?this.implements.toFlatIds(i):[],...a.flatMap(p=>p.toFlatIds(i))]}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,codeName:this.codeName,description:this.description,collapsed:this.collapsed,private:this.private,index:this.index,x:this.x,y:this.y,type:this.type,name:this.name}}toJSON(i=new Set){var a,o;return i.has(this.id)?this.toReference():(i.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,codeName:this.codeName,description:this.description,index:this.index,x:this.x,y:this.y,collapsed:this.collapsed,private:this.private,calls:this.calls.map(p=>p.toJSON(i)),inputs:this.inputs.map(p=>p.toJSON(i)),implements:((a=this.implements)==null?void 0:a.toJSON(i))||null,extends:((o=this.extends)==null?void 0:o.toJSON(i))||null,parent:this.parent.toReference()})}toJSONClone(i=ke){var o,p,e,y,v;let a;return(o=i.seenEntityMaps)!=null&&o.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||Kr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(p=i.seenEntities)!=null&&p.has(a)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(a),(v=i.seenEntities)==null||v.add(this.id),{id:a,version:N.UUID.uuid(),createdAt:i.timestamp||L().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,name:this.name,codeName:this.codeName,description:this.description,index:this.index,x:this.x,y:this.y,collapsed:this.collapsed,private:this.private,calls:this.calls.map(E=>E.toJSONClone({...i,newId:null})),inputs:this.inputs.map(E=>E.toJSONClone({...i,newId:null})),implements:(()=>{var E;return this.implements&&this.project.getBuiltIn(this.implements.id)?this.implements.toJSON():(E=this.implements)==null?void 0:E.toJSONClone({...i,newId:null})})(),extends:(()=>{var E;return this.extends&&this.project.getBuiltIn(this.extends.id)?this.extends.toJSON():(E=this.extends)==null?void 0:E.toJSONClone({...i,newId:null})})(),parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=ke){var o;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+N.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=ke){var o,p,e;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,codeName:this.codeName,description:this.description,index:this.index,collapsed:this.collapsed,private:this.private,x:this.x,y:this.y,inputs:this.inputs.map(y=>y.toReference(i)),calls:this.calls.map(y=>y.toReference(i)),implements:((p=this.implements)==null?void 0:p.toReference(i))||null,extends:((e=this.extends)==null?void 0:e.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.inputs.flatMap(o=>o.toFlatJSON(i)),...this.calls.flatMap(o=>o.toFlatJSON(i)),...this.returnStatements.flatMap(o=>o.toFlatJSON(i)),...this.implements?this.implements.toFlatJSON(i):[]])}toGenerationTarget(){var a,o;const i=this.parent.type===f.Project?void 0:this.parent.id;return{id:this.id,name:this.name,description:this.description||void 0,type:this.type,private:this.private,implements:((a=this.implements)==null?void 0:a.id)||void 0,extends:((o=this.extends)==null?void 0:o.id)||void 0,parent:i}}toFlatGenerationTarget(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.inputs.flatMap(o=>o.toFlatGenerationTarget(i)),...this.calls.flatMap(o=>o.toFlatGenerationTarget(i)),...this.returnStatements.flatMap(o=>o.toFlatGenerationTarget(i))])}clearErrors(){return this.errors=[],this.inputs.forEach(i=>i.clearErrors()),this.calls.forEach(i=>i.clearErrors()),this.returnStatements.forEach(i=>i.clearErrors()),this}validate(){const i=Xx(this);return this.errors=[...i],{success:!0}}getErrors(){const i=Is(this);return[...this.errors,...this.inputs.flatMap(o=>o.getErrors()),...i.flatMap(o=>o.getErrors())]}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"clone-entity")),a=null,o=null,p=!0,e=!1){var V;let y=Sr(a,this);const v=this.toJSON(),E=o||N.UUID.uuid();v.inputs=[],v.calls=[],v.id=E,v.version=N.UUID.uuid(),v.createdAt=(i==null?void 0:i.timestamp)||L().toISOString(),v.author=(i==null?void 0:i.author)||"1",v.previousVersion=null,v.deleted=!1;const b=dr(v,y);a?b.setParent(a,null):b.setParent(this.parent,null),p&&b.subscribe(),b.initChildren(i),i==null||i.add(b,S.Added);const A=(V=this.inputs)==null?void 0:V.map(B=>B.clone(i,b,N.UUID.uuid(),p));return b.inputs=A,e?(Is(this).map(B=>B.clone(i,b,N.UUID.uuid(),p)),i==null||i.attemptAutoclose("clone-entity",this.id),b):(i==null||i.attemptAutoclose("clone-entity",this.id),b)}getVariableInstances(){return vr(this).filter(o=>o.type===f.VariableInstance)}getArgument(i){return this.inputs.find(a=>a.id===i)||null}createCall(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"create-call")),a=this.project,o={}){const p={id:o.id||N.UUID.uuid(),version:o.version||N.UUID.uuid(),createdAt:o.createdAt||(i==null?void 0:i.timestamp)||L().toISOString(),author:o.author||N.sessionAuthor||"1",previousVersion:o.previousVersion||null,deleted:o.deleted||!1,type:f.FunctionCall,parent:a.toReference(),successCalls:o.successCalls||[],errorCalls:o.errorCalls||[],inputs:o.inputs||[],outputs:o.outputs||[],error:o.error||null,process:o.process||null,calledBySuccess:o.calledBySuccess||[],calledByError:o.calledByError||[],calledByEntry:o.calledByEntry||[],declaration:this.toJSON(),x:0,y:0},e=te(p,this.project);return e.hydrateAncestors(),i==null||i.add(e,S.Added),e.addSelfToProject(i),e.setParent(a,i),e.initChildren(i),e.afterAllChildrenInitialized(i),i==null||i.add(e,S.Added),i==null||i.attemptAutoclose("create-call",this.id),e}createInternalCall(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"create-internal")),a,o={}){const p={id:o.id||N.UUID.uuid(),version:o.version||N.UUID.uuid(),createdAt:o.createdAt||(i==null?void 0:i.timestamp)||L().toISOString(),author:o.author||N.sessionAuthor||"1",previousVersion:o.previousVersion||null,deleted:o.deleted||!1,type:f.InternalCall,parent:a.toReference(),successCalls:o.successCalls||[],errorCalls:o.errorCalls||[],inputs:o.inputs||[],outputs:o.outputs||[],error:o.error||null,process:o.process||null,calledBySuccess:o.calledBySuccess||[],calledByError:o.calledByError||[],calledByEntry:o.calledByEntry||[],declaration:this.toShallowJSON(),index:a.internalCalls.length},e=te(p,this.project);return e.hydrateAncestors(),i==null||i.add(e,S.Added),e.addSelfToProject(i),e.setParent(a,i),e.initChildren(i),e.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("create-internal",this.id),e}addReturnStatement(i){return this.returnStatements.includes(i)||this.returnStatements.push(i),this}removeReturnStatement(i){const a=this.returnStatements.indexOf(i);return a!==-1&&this.returnStatements.splice(a,1),this}getUniqueReturnDeclarations(){const i=[],a=[...this.returnStatements];this.parent.type===f.Loop&&a.push(...this.parent.breakStatements,...this.parent.continueStatements);const o=a.flatMap(p=>p.outputs);if(this.implements&&this.parent.type!==f.Loop){const p=this.implements.outputs;return o.forEach(e=>{const y=p.find(E=>E===e.implements),v=i.find(E=>E.implements===e.implements);y&&!v&&i.push(e)}),R(i)}else return o.forEach(p=>{i.find(y=>y===p||ne(y,this.project)===ne(p,this.project)&&en(y.dataType,p.dataType))||i.push(p)}),R(i)}removeUnrecognizedInputs(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-unrecognized-inputs"))){const a=[],o=[],p=[],e=[];return this.implements?(this.inputs.forEach(v=>{var b;if(!(((b=this.implements)==null?void 0:b.inputs)||[]).find(A=>{var $;return A.id===(($=v.implements)==null?void 0:$.id)})){const A=v.remove({ignoreUpstream:!1},i);p.push(...A.removed),a.push(...A.updated)}}),this.inputs.filter((v,E)=>{const b=this.inputs.findIndex($=>$.implements===v.implements&&$!==v);if(b===-1)return!1;const A=this.inputs[b];return L(A==null?void 0:A.createdAt).isSame(L(v.createdAt))?E>b:!!L(A==null?void 0:A.createdAt).isAfter(v.createdAt)}).forEach(v=>{const E=v.remove({ignoreUpstream:!1},i);p.push(...E.removed),a.push(...E.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-inputs",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}):(i==null||i.attemptAutoclose("remove-unrecognized-inputs",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this})}syncInputs(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-missing-fixed-inputs"))){var A;const a=[],o=[],p=[],e=[],y=(((A=this.implements)==null?void 0:A.inputs)||[]).filter($=>$.parentRelationType===oe.FixedArguments&&!this.inputs.find(V=>{var B;return((B=V.implements)==null?void 0:B.id)===$.id}));this.inputs.sort(($,V)=>$.index-V.index),y.forEach($=>{this.inputs.forEach(F=>{F.index>=$.index&&F.metaSync({index:F.index+1},i)});const V=ea.new(i);V.implements=$.toJSON(),V.index=$.index,V.parent=this.toReference(),V.name=$.name;const B=te(V,this.project);B.hydrateAncestors(),i==null||i.add(B,S.Added),B.setParent(this,i),B.initChildren(i),B.addSelfToProject(i)}),this.inputs.sort(($,V)=>$.index-V.index);const{updated:v,added:E,removed:b}=this.removeUnrecognizedInputs(i);return a.push(...v),o.push(...E),p.push(...b),i==null||i.attemptAutoclose("sync-missing-fixed-inputs",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}};g(Lt,"repository",{APICreate:async(i,...a)=>i,APIUpdate:async(i,...a)=>i,APIDelete:async(i,...a)=>i,APIClone:async(i,...a)=>{},APILoad:async(i,...a)=>null,APILoadVersion:async(i,a,...o)=>null}),g(Lt,"type",f.FunctionDeclaration),g(Lt,"USER_MANAGED_PARENT_TYPES",[f.Project,f.InstalledProject,f.DefinitionEntity,f.Loop]),g(Lt,"PARENT_TYPES",[...Lt.USER_MANAGED_PARENT_TYPES,f.BuiltInBaseEntity,f.PrimitiveEntity]),g(Lt,"MUTABLE_BASE_PROPERTIES",["name","codeName","description","private"]),g(Lt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),g(Lt,"BASE_PROPERTIES",[...Lt.MUTABLE_BASE_PROPERTIES,...Lt.INMUTABLE_BASE_PROPERTIES]),g(Lt,"MUTABLE_META_PROPERTIES",[...Lt.MUTABLE_BASE_PROPERTIES,"x","y","index","collapsed"]),g(Lt,"INMUTABLE_META_PROPERTIES",[...Lt.INMUTABLE_BASE_PROPERTIES]),g(Lt,"META_PROPERTIES",[...Lt.MUTABLE_META_PROPERTIES,...Lt.INMUTABLE_META_PROPERTIES]),g(Lt,"MUTABLE_UPSTREAM_PROPERTIES",[]),g(Lt,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","implements","extends"]),g(Lt,"UPSTREAM_PROPERTIES",[...Lt.MUTABLE_UPSTREAM_PROPERTIES,...Lt.INMUTABLE_UPSTREAM_PROPERTIES]),g(Lt,"MUTABLE_DOWNSTREAM_PROPERTIES",["inputs","calls"]),g(Lt,"INMUATABLE_DOWNSTREAM_PROPERTIES",[]),g(Lt,"DOWNSTREAM_PROPERTIES",[...Lt.MUTABLE_DOWNSTREAM_PROPERTIES,...Lt.INMUATABLE_DOWNSTREAM_PROPERTIES]),g(Lt,"PROPERTIES",[...Lt.META_PROPERTIES,...Lt.UPSTREAM_PROPERTIES,...Lt.DOWNSTREAM_PROPERTIES]);let uo=Lt;function tj(d){const u=n0e(),i=d.toJSON();u.safeParse(i).success;const o=[];if(d.entity&&d.andChildrenGroup||d.entity&&d.orChildrenGroup||d.andChildrenGroup&&d.orChildrenGroup){const p=mt({id:d.id+"--"+le.InvalidPropertiesCombination,message:`Data type with id "${d.id}" has invalid properties combination. Only one of the following properties can be present at the time: 'entity', 'andChildrenGroup' or 'orChildrenGroup'`,severity:q.Error,code:le.InvalidPropertiesCombination,entity:d});o.push(p.error)}return Er(d.errors,o)}const F0e=Object.freeze(Object.defineProperty({__proto__:null,validate:tj},Symbol.toStringTag,{value:"Module"}));function S0e(d,u){const i=[],a=[f.DefinitionEntity,f.ActionDescriptor,f.Property,f.ArgumentDeclaration,f.ReturnDeclaration,f.VariableDeclaration,f.ValueDescriptor,f.DataType],o=`'${ot(a,"', '","' or '")}'`;if(d.parent)if(d.id===d.parent)i.push(new ee({id:`${d.id}--${d.parent}--${k.SelfReference}`,code:k.SelfReference,severity:q.Error,message:`Entity of type "${d.type}" with id "${d.id}", has a reference to itself at 'parent'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`}));else{const p=u.get(d.parent);p?a.includes(p.type)||i.push(new ee({id:`${d.id}--${d.parent}--${k.InvalidParentReference}`,code:k.InvalidParentReference,severity:q.Error,message:`Entity of type "${d.type}" with id "${d.id}", has a parent reference that isn't pointing to an entity of type ${o}.`})):i.push(new ee({id:`${d.id}--${d.parent}--${k.ReferencedEntityNotFound}`,code:k.ReferencedEntityNotFound,severity:q.Error,message:`Entity of type "${d.type}" with id "${d.id}", is referencing an entity with id "${d.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`}))}else i.push(new ee({id:`${d.id}--${ae.InvalidObjectStructure}`,code:ae.InvalidObjectStructure,severity:q.Error,message:`Entity of type "${d.type}" with id "${d.id}" is missing a 'parent' reference. The 'parent' of a 'data-type' entity must be a reference to an entity of type ${o}.`}));if(d.entity){if(d.id===d.entity)return i.push(new ee({id:`${d.id}--${d.entity}--${k.SelfReference}`,code:k.SelfReference,severity:q.Error,message:`Entity of type "${d.type}" with id "${d.id}", has a reference to itself at 'entity'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`})),i;const p=u.get(d.entity);p?[f.DefinitionEntity,f.PrimitiveEntity,f.ActionDescriptor,f.BuiltInBaseEntity].includes(p.type)||i.push(new ee({id:`${d.id}--${d.entity}--${k.InvalidImplementsReference}`,code:k.InvalidImplementsReference,severity:q.Error,message:`Entity of type "${d.type}" with id "${d.id}", has an 'entity' reference that isn't pointing to an entity of type 'definition-entity', 'primitive-entity', 'action-descriptor' or 'built-in-base-entity'.`})):i.push(new ee({id:`${d.id}--${d.entity}--${k.ReferencedEntityNotFound}`,code:k.ReferencedEntityNotFound,severity:q.Error,message:`Entity of type "${d.type}" with id "${d.id}", is referencing an entity with id "${d.entity}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`}))}return i}var vA=(d=>(d.Entity="entity",d))(vA||{});const Mt=class Mt extends Nr{constructor(i,a){super(i);g(this,"initialData");g(this,"id");g(this,"isList",null);g(this,"asType",null);g(this,"type",f.DataType);g(this,"options",null);g(this,"parentRelationType",null);g(this,"like");g(this,"implementationChooseOne",!1);g(this,"inferred",!1);g(this,"staticEntities",null);g(this,"interactiveEntities",null);g(this,"actionEntities",null);g(this,"index",null);g(this,"entity",null);g(this,"andChildrenGroup",null);g(this,"orChildrenGroup",null);g(this,"project");g(this,"errors",[]);g(this,"parent");g(this,"detachedDependents",{});g(this,"knownVersions",null);g(this,"activeVersion",!1);g(this,"initialized",!1);g(this,"startedInitialization",!1);this.initialData=i,this.project=a,this.id=i.id,this.isList=i.isList,this.asType=i.asType,this.options=i.options,this.index=i.index??null,this.parentRelationType=i.parentRelationType,this.inferred=i.inferred||!1,this.like=i.like||!1,this.implementationChooseOne=i.implementationChooseOne||!1,this.staticEntities=i.staticEntities,this.interactiveEntities=i.interactiveEntities,this.actionEntities=i.actionEntities}static new(i=null){return{id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,entity:null,isList:!1,like:!1,index:null,inferred:!1,implementationChooseOne:!1,parentRelationType:null,options:null,asType:null,staticEntities:null,interactiveEntities:null,actionEntities:null,andChildrenGroup:null,orChildrenGroup:null,parent:null}}static fromGenerationTarget(i,a){const o=H(i.parent),p=a.get(o);let e=null;i.entity&&(e=a.get(i.entity));let y=null;p&&p.type===f.DataType&&(i.parentRelationType===Ii.OrDataTypeGroup?y=(p.orChildrenGroup||[]).length:i.parentRelationType===Ii.AndDataTypeGroup&&(y=(p.andChildrenGroup||[]).length));const v={id:i.id,version:N.UUID.uuid(),createdAt:L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,andChildrenGroup:null,orChildrenGroup:null,parentRelationType:i.parentRelationType||null,options:i.options||null,isList:i.isList,like:i.like||!1,index:y,inferred:!1,implementationChooseOne:i.implementationChooseOne||!1,staticEntities:i.staticEntities??null,interactiveEntities:i.interactiveEntities??null,actionEntities:i.actionEntities??null,entity:e,asType:i.asType,parent:p},E=te(v,a);return E.setParent(p,null),E}static validateGenerationTarget(i,a){var E;let o=JSON.parse(JSON.stringify(i));const p=[],e=S0e(o,a);if(p.push(...e,...Ur(o)),o.entity){const b=a.get(o.entity);if(b.type===f.DefinitionEntity){const $=xi(b).filter(V=>!V.interactive);if($.length){const V=$.length>1?`entities with ids '${ot($.map(B=>B.id),"', '","' and '")}'`:`entity with id '${$[0].id}'`;p.push(new ee({id:`${i.id}--${k.NonInteractiveEntityReferenced}`,code:k.NonInteractiveEntityReferenced,severity:q.Error,message:`The entity with id '${i.id}' and type '${i.type}', cannot reference 'definition-entity' with id '${o.entity}' at 'entity'. The entity extends or implements non-interactive built-in-base-entity ${V}.
|
|
35
35
|
${_o}`}))}}}const y=o.parent&&a.get(o.parent)||a.getBuiltIn(o.parent),v=y?Co(y):null;if(v)p.push(new ee({id:`${i.id}--${k.BuiltInEntityParent}`,code:k.BuiltInEntityParent,severity:q.Error,message:`The entity with id '${i.id}' and type '${i.type}', belongs to a built-in system entity "${ne(v,a)}" with id '${v.id}', and therefore it cannot be created as it would affect a built in entity, which are inmutable.`}));else if(y){const b=y.type,A=[f.Property,f.VariableDeclaration,f.ArgumentDeclaration,f.ReturnDeclaration,f.ValueDescriptor];if(A.includes(b)&&(o.parentRelationType&&p.push(new ee({id:`${i.id}--${k.InvalidParentRelationType}`,code:k.InvalidParentRelationType,severity:q.Error,message:`The entity with id '${i.id}' and type '${i.type}', cannot have a 'parentRelationType' property set of type '${b}'.
|
|
36
36
|
The entitities of type '${ot(A,"', '","' and '")}' can only have one 'data-type' child under the 'dataType' property so no 'parentRelationType' is needed.`})),y.dataType)){const $=(E=y.dataType)==null?void 0:E.id;p.push(new ee({id:`${i.id}--${k.NewEntityWouldOverriteExisting}`,code:k.NewEntityWouldOverriteExisting,severity:q.Error,message:`The entity with id '${i.id}' and type '${i.type}', cannot be added as a child to the entity with id '${o.parent}' and type '${b}', because it already has a 'data-type' child with id '${$}'.
|
|
37
37
|
The entitities of type '${ot(A,"', '","' and '")}' can only have one 'data-type' child under the 'dataType' property. You can inspect the existing data-type entity with the 'describe_entity' action. Like so:
|
|
38
38
|
${aa({describe_entity:$})}
|
|
39
|
-
Alternatively you can update the entity with 'update' action. Or replace it by first removing it and then creating a new one.`}))}b===f.DataType&&(!o.parentRelationType||!(o.parentRelationType===Ii.AndDataTypeGroup||o.parentRelationType===Ii.OrDataTypeGroup))&&p.push(new ee({id:`${i.id}--${k.InvalidParentRelationType}`,code:k.InvalidParentRelationType,severity:q.Error,message:`The entity with id '${i.id}' and type '${i.type}', must have a 'parentRelationType' property set to either 'or-data-type-group' or 'and-data-type-group' when being added as a child to an entity of type 'data-type'.`}))}return{errors:p,modifiedData:o}}get isGroup(){const i=[...this.andChildrenGroup||[],...this.orChildrenGroup||[]];if(i.length>1){let a=0;for(const o of i)if(o.isResolved&&(a++,a>1))return!0}return!1}get isResolved(){return[f.BuiltInBaseEntity,f.ActionDescriptor].includes(this.parent.type)||Co(this.parent)?!0:!(!this.entity&&!this.isGroup)}validateGeneratedUpdate(i){return{errors:[],modifiedData:i}}subscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-dependents"))){const a=[],o=[],p=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),o.push(...v.added),p.push(...v.removed),e.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}onDetachedDependencyRemoved(i,a,o){const p=[],e=[],y=[],v=[];return a==="entity"&&this.setEntity(i,o),{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,o){const p=[],e=[],y=[],v=[];return a==="entity"&&this.setEntity(null,o),{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){var i,a;return(a=(i=this.entity)==null?void 0:i.unsubscribeDependents)==null||a.call(i,[{entity:this,field:"entity"}]),this}subscribeToDependencies(){var i,a;return(a=(i=this.entity)==null?void 0:i.subscribeDependents)==null||a.call(i,[{entity:this,field:"entity"}]),this}increaseVersion(i){if(i&&!L(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&L(i).isSame(L(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=L(i).toISOString()||L().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new Mt(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.entity=this.entity,i.andChildrenGroup=this.andChildrenGroup?[...this.andChildrenGroup]:this.andChildrenGroup,i.orChildrenGroup=this.orChildrenGroup?[...this.orChildrenGroup]:this.orChildrenGroup,i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const a=[],o=[],p=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),o.push(...y.added),p.push(...y.removed)}return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}async restoreVersion(i){var v;const a=[],o=[],p=[],e=[];if(this.version===i)return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[$,V]of A.knownVersions)E.set($,V);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new Mt(E,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.entity=y.entity,this.andChildrenGroup=y.andChildrenGroup,this.orChildrenGroup=y.orChildrenGroup,this.parent=y.parent,{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"update-with-shallow-transfer"))){if(this.metaSync(i,a),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent){const o=H(i.parent),p=this.project.get(o),e=this.parent;if(e&&e.id!==(p==null?void 0:p.id)&&this.removeFromParent(a),p)this.setParent(p,a);else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${o}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.entity){const o=H(i.entity),p=this.project.get(o);p&&(p.type===f.DefinitionEntity&&p.parent===this||this.setEntity(p,null))}return this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const i=[],a=[],o=[],p=[];if(this.initialData.parent){const e=H(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.entity){const e=H(this.initialData.entity),y=this.project.get(e);y&&(y.type===f.DefinitionEntity&&y.parent===this||(this.setEntity(y,null),y.type!==f.BuiltInBaseEntity&&y.type!==f.PrimitiveEntity&&i.push(y)))}return{updated:R(i),added:R(a),removed:R(o),affected:R(p),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],o=[],p=[],e=[];return this.initialized=!0,this.captureVersion(),i==null||i.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-self-to-project"))){const a=[this],o=[],p=[],e=[];return this.parent.type===f.DataType?this.parentRelationType===Ii.AndDataTypeGroup?this.parent.addToAndGroup(this):this.parentRelationType===Ii.OrDataTypeGroup&&this.parent.addToOrGroup(this):this.parent.setDataType(this,i),e.push(this.parent),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}setParent(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-parent"))){var o;return((o=this.parent)==null?void 0:o.id)!==(i==null?void 0:i.id)&&(this.parent=i,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-parent",this.id),this}removeChildGroup(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-child-group"))){if(this.andChildrenGroup){const o=this.andChildrenGroup.findIndex(p=>p.id===i.id);o!==-1&&(this.andChildrenGroup.splice(o,1),a==null||a.add(this,S.Updated))}if(this.orChildrenGroup){const o=this.orChildrenGroup.findIndex(p=>p.id===i.id);o!==-1&&(this.orChildrenGroup.splice(o,1),a==null||a.add(this,S.Updated))}return a==null||a.attemptAutoclose("remove-child-group",this.id),this}initChildren(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"init-children"))){var a,o,p,e;if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.entity)if(this.initialData.entity.type===f.GenericReference){const y=this.project.findSubscribedInstanceFromReference(this.initialData.entity);this.entity=y}else this.entity=te(this.initialData.entity,this.project),((o=(a=this.initialData.entity)==null?void 0:a.parent)==null?void 0:o.id)===this.id&&this.entity.setParent(this,null),(e=(p=this.entity).initChildren)==null||e.call(p,i);return this.initialData.andChildrenGroup&&(this.andChildrenGroup=this.initialData.andChildrenGroup.map(y=>{const v=te(y,this.project);return v.setParent(this,null),v.initChildren(i),v})),this.initialData.orChildrenGroup&&(this.orChildrenGroup=this.initialData.orChildrenGroup.map(y=>{const v=te(y,this.project);return v.setParent(this,null),v.initChildren(i),v})),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"meta-sync"))){const o=xr(this,i),p=this.toMeta();return this.options=i.options||p.options,this.parentRelationType=i.parentRelationType||p.parentRelationType,this.isList=i.isList!==void 0?i.isList:p.isList,this.inferred=i.inferred!==void 0?i.inferred:p.inferred,this.like=i.like!==void 0?i.like:p.like,this.asType=i.asType!==void 0?i.asType:p.asType,this.index=i.index!==void 0?i.index:p.index,this.implementationChooseOne=i.implementationChooseOne!==void 0?i.implementationChooseOne:p.implementationChooseOne,this.staticEntities=i.staticEntities!==void 0?i.staticEntities:p.staticEntities,this.interactiveEntities=i.interactiveEntities!==void 0?i.interactiveEntities:p.interactiveEntities,this.actionEntities=i.actionEntities!==void 0?i.actionEntities:p.actionEntities,super.metaSync(i),i.deleted===!0&&!p.deleted?a==null||a.add(this,S.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,S.Added):o&&(a==null||a.add(this,S.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ve,...a){return await Mt.repository.APILoad(this.id,...a),this}async APICreate(i=ve,...a){return await Mt.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ve,...a){return await Mt.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ve,...a){return await Mt.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ve,...a){return await Mt.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ve,a,...o){return await Mt.repository.APILoadVersion(this.id,a,...o)}removeFromParent(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-from-parent"))){var y;const a=[],o=[],p=[],e=[];if(((y=this.parent)==null?void 0:y.type)===f.DataType)this.parent.removeChildGroup(this,i);else{const v=this.parent;v==null||v.removeDataType()}return this.parent&&a.push(this.parent),i==null||i.attemptAutoclose("remove-from-parent",this.id),{added:R(p),updated:R(a),removed:R(o),affected:R(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-entity"))){if(this.id==="iterate-over-string-loop-string-argument-declaration-data-type-id")throw new Error("You are trying to remove the iterate-over-string-loop-string-argument-declaration-data-type-id entity. This is not allowed.");const o=[],p=[],e=[],y=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(p.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:A}=v.entity.onDetachedDependencyRemoved(this,v.field,a);o.push(...E),p.push(...b),e.push(...A)}),this.entity&&this.entity.type===f.DefinitionEntity&&this.entity.parent===this){const{updated:v,removed:E}=this.entity.remove({ignoreUpstream:!0},a);o.push(...v),p.push(...E)}if(this.andChildrenGroup&&this.andChildrenGroup.forEach(v=>{const{removed:E,updated:b}=v.remove({ignoreUpstream:!0},a);p.push(...E),o.push(...b)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(v=>{const{removed:E,updated:b}=v.remove({ignoreUpstream:!0},a);p.push(...E),o.push(...b)}),!i){const v=this.removeFromParent(a);e.push(...v.added),o.push(...v.updated),p.push(...v.removed),y.push(...v.affected)}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:R(e),updated:R(o),removed:R(p),affected:R(y),self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"restore-entity"))){const a=[],o=[],p=[],e=[];if(i!=null&&i.hasAdded(this.id))return i==null||i.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(y=>{const{updated:v,removed:E,added:b}=y.entity.onDetachedDependencyRestored(this,y.field,i);o.push(...v),p.push(...E),a.push(...b)}),this.entity&&this.entity.type===f.DefinitionEntity&&this.entity.parent===this){const{updated:y}=this.entity.restore({},i);o.push(...y)}if(this.andChildrenGroup&&this.andChildrenGroup.forEach(y=>{const{updated:v,added:E}=y.restore({},i);o.push(...v),a.push(...E)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(y=>{const{updated:v,added:E}=y.restore({},i);o.push(...v),a.push(...E)}),this.parent.type===f.DataType){const y=this.parent;Array.isArray(y.andChildrenGroup)&&y.andChildrenGroup.push(this)}if(this.parent.type===f.DataType){const y=this.parent;this.parentRelationType===Ii.AndDataTypeGroup?Array.isArray(y.andChildrenGroup)&&y.andChildrenGroup.push(this):this.parentRelationType===Ii.OrDataTypeGroup&&Array.isArray(y.orChildrenGroup)&&y.orChildrenGroup.push(this)}else{const y=this.parent;y.setDataType(this,i),o.push(y)}return i==null||i.attemptAutoclose("restore-entity",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this}}toFlat(i=new Set){var o,p,e;return i.has(this.id)?[]:(i.add(this.id),[this,...((o=this.andChildrenGroup)==null?void 0:o.flatMap(y=>y.toFlat(i)))||[],...((p=this.orChildrenGroup)==null?void 0:p.flatMap(y=>y.toFlat(i)))||[],...((e=this.entity)==null?void 0:e.toFlat(i))||[]])}toFlatIds(i=new Set){var o,p,e;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((o=this.andChildrenGroup)==null?void 0:o.flatMap(y=>y.toFlatIds(i)))||[],...((p=this.orChildrenGroup)==null?void 0:p.flatMap(y=>y.toFlatIds(i)))||[],...((e=this.entity)==null?void 0:e.toFlatIds(i))||[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,like:this.like,isList:this.isList,inferred:this.inferred,index:this.index,parentRelationType:this.parentRelationType,implementationChooseOne:this.implementationChooseOne,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,options:this.options,asType:this.asType,type:this.type}}toJSON(i=new Set){var a,o,p,e;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,options:this.options,isList:this.isList,asType:this.asType,index:this.index,like:this.like,inferred:this.inferred,parentRelationType:this.parentRelationType,implementationChooseOne:this.implementationChooseOne,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,andChildrenGroup:((a=this.andChildrenGroup)==null?void 0:a.map(y=>y.toJSON(i)))||null,orChildrenGroup:((o=this.orChildrenGroup)==null?void 0:o.map(y=>y.toJSON(i)))||null,entity:((p=this.entity)==null?void 0:p.parent)===this?this.entity.toJSON(i):((e=this.entity)==null?void 0:e.toReference())||null,parent:this.parent.toReference()})}toJSONClone(i=ke){var o,p,e,y,v,E,b,A,$;let a;return(o=i.seenEntityMaps)!=null&&o.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||Kr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(p=i.seenEntities)!=null&&p.has(a)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(a),(v=i.seenEntities)==null||v.add(this.id),{id:a,version:N.UUID.uuid(),createdAt:i.timestamp||L().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,options:this.options,isList:this.isList,asType:this.asType,like:this.like,index:this.index,inferred:this.inferred,parentRelationType:this.parentRelationType,implementationChooseOne:this.implementationChooseOne,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,andChildrenGroup:((E=this.andChildrenGroup)==null?void 0:E.map(V=>V.toJSONClone({...i,newId:null})))||null,orChildrenGroup:((b=this.orChildrenGroup)==null?void 0:b.map(V=>V.toJSONClone({...i,newId:null})))||null,entity:((A=this.entity)==null?void 0:A.parent)===this?this.entity.toJSONClone({...i,newId:null}):(($=this.entity)==null?void 0:$.toReference({seenEntityMaps:i.seenEntityMaps}))||null,parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=ke){var o;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+N.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=ke){var o,p,e,y;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,isList:this.isList,options:this.options,asType:this.asType,index:this.index,parentRelationType:this.parentRelationType,like:this.like,inferred:this.inferred,implementationChooseOne:this.implementationChooseOne,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,andChildrenGroup:((p=this.andChildrenGroup)==null?void 0:p.map(v=>v.toReference(i)))||null,orChildrenGroup:((e=this.orChildrenGroup)==null?void 0:e.map(v=>v.toReference(i)))||null,entity:((y=this.entity)==null?void 0:y.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var o,p,e;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((o=this.andChildrenGroup)==null?void 0:o.flatMap(y=>y.toFlatJSON(i)))||[],...((p=this.orChildrenGroup)==null?void 0:p.flatMap(y=>y.toFlatJSON(i)))||[],...((e=this.entity)==null?void 0:e.toFlatJSON(i))||[]])}toGenerationTarget(){var i;return{id:this.id,type:this.type,options:this.options||void 0,isList:this.isList,like:this.like,parentRelationType:this.parentRelationType||void 0,asType:this.asType,entity:((i=this.entity)==null?void 0:i.id)||null,parent:this.parent.id}}toFlatGenerationTarget(i=new Set){var o,p;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((o=this.andChildrenGroup)==null?void 0:o.flatMap(e=>e.toFlatGenerationTarget(i)))||[],...((p=this.orChildrenGroup)==null?void 0:p.flatMap(e=>e.toFlatGenerationTarget(i)))||[],...this.entity&&this.entity.type==f.DefinitionEntity&&this.entity.parent===this&&this.entity.toFlatGenerationTarget(i)||[]])}clearErrors(){var i,a,o,p;return this.errors=[],(i=this.andChildrenGroup)==null||i.forEach(e=>e.clearErrors()),(a=this.orChildrenGroup)==null||a.forEach(e=>e.clearErrors()),this.inferred&&this.entity&&this.entity.type===f.DefinitionEntity&&((o=this.entity)==null?void 0:o.parent)===this&&((p=this.entity)==null||p.clearErrors()),this}validate(){const i=tj(this);return this.errors=i,{success:!0}}getErrors(){return[...this.errors]}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"clone-entity")),a=null,o=null,p=!0){var V,B,F;let e=Sr(a,this),y=a||this.parent;const E={id:o||N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||"1",previousVersion:null,deleted:!1,type:f.DataType,isList:this.isList,asType:this.asType,options:this.options,index:this.index,parentRelationType:this.parentRelationType,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,like:this.like,inferred:this.inferred,implementationChooseOne:this.implementationChooseOne,andChildrenGroup:null,orChildrenGroup:null,entity:null,parent:y.toReference()},b=dr(E,e);a&&b.setParent(a,null),p&&b.subscribe(),b.initChildren(i),i==null||i.add(b,S.Added);const A=(V=this.andChildrenGroup)==null?void 0:V.map(K=>K.clone(i,b,N.UUID.uuid(),p)),$=(B=this.orChildrenGroup)==null?void 0:B.map(K=>K.clone(i,b,N.UUID.uuid(),p));if(b.andChildrenGroup=A||null,b.orChildrenGroup=$||null,this.entity&&this.entity.type===f.DefinitionEntity&&((F=this.entity)==null?void 0:F.parent)===this){const K=this.entity.clone(i,b,N.UUID.uuid(),p);b.setEntity(K,i)}else this.entity&&b.setEntity(this.entity,i);return i==null||i.attemptAutoclose("clone-entity",this.id),b}merge(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"merge-entity"))){const o=[],p=[],e=[],y=[];if(this.asType!==(i==null?void 0:i.asType)&&(this.metaSync({asType:i==null?void 0:i.asType},a),a==null||a.add(this,S.Updated),o.push(this)),this.index!==(i==null?void 0:i.index)&&(this.metaSync({index:i==null?void 0:i.index},a),a==null||a.add(this,S.Updated),o.push(this)),this.isList!==(i==null?void 0:i.isList)&&(this.metaSync({isList:i==null?void 0:i.isList},a),a==null||a.add(this,S.Updated),o.push(this)),this.like!==(i==null?void 0:i.like)&&(this.metaSync({like:i==null?void 0:i.like},a),a==null||a.add(this,S.Updated),o.push(this)),i!=null&&i.inferred){if(i.entity&&i.entity.type===f.DefinitionEntity&&i.entity.parent===i){const v=i.entity.clone(a,this,N.UUID.uuid(),!0);this.setEntity(v,a),p.push(v)}else i.entity&&(this.setEntity(i.entity,a),a==null||a.add(this,S.Updated),o.push(this));this.inferred||(this.metaSync({inferred:!0},a),a==null||a.add(this,S.Updated),o.push(this))}else if(this.inferred){if(this.metaSync({inferred:!1},a),a==null||a.add(this,S.Updated),o.push(this),this.entity&&this.entity.type===f.DefinitionEntity&&this.entity.parent===this){const{updated:v,removed:E}=this.entity.remove({ignoreUpstream:!0},a);e.push(...E),v.push(...v)}i.entity!==this.entity&&(this.setEntity(i.entity,a),a==null||a.add(this,S.Updated),o.push(this))}else i.entity!==this.entity&&(this.setEntity(i.entity,a),a==null||a.add(this,S.Updated),o.push(this));return a==null||a.attemptAutoclose("merge-entity",this.id),{updated:R(o),added:R(p),removed:R(e),affected:R(y),self:this}}addToAndGroup(i){return this.andChildrenGroup||(this.andChildrenGroup=[]),this.andChildrenGroup.includes(i)||this.andChildrenGroup.push(i),this}addToOrGroup(i){return this.orChildrenGroup||(this.orChildrenGroup=[]),this.orChildrenGroup.includes(i)||this.orChildrenGroup.push(i),this}setEntity(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-data-type-entity-value"))){var p;const o=this.entity;return(o==null?void 0:o.id)!==(i==null?void 0:i.id)&&(this.entity=i,a==null||a.add(this,S.Affected),o&&o.type===f.DefinitionEntity&&((p=o.parent)==null?void 0:p.id)===this.id&&(o==null||o.remove({ignoreUpstream:!0},a))),a==null||a.attemptAutoclose("set-data-type-entity-value",this.id),this}isObject(){return!!this.entity&&(this.entity.type===f.DefinitionEntity||this.entity.type===f.BuiltInBaseEntity||this.entity.name===Q.KeyValue)&&!this.isList}canBeObject(){var a;let i=!1;if(this.parent.type!==f.DataType){const o=(a=this.project.requestActiveDynamicValue(this.parent))==null?void 0:a.value;o?!o.valueAsType&&(o.value===""||o.value===null||Ar(o))&&(i=!0):i=!0}return(this.isObject()||!this.entity||this.entity.name===Q.Untyped)&&i}hasStrictObjectStructure(){var i;return this.isObject()&&((i=this.entity)==null?void 0:i.type)===f.DefinitionEntity}isInlineDeclaredEntity(){var i,a;return((i=this.entity)==null?void 0:i.type)===f.DefinitionEntity&&((a=this.entity.parent)==null?void 0:a.id)===(this==null?void 0:this.id)}isIndependentlyUserDeclaredEntity(){var i,a;return((i=this.entity)==null?void 0:i.type)===f.DefinitionEntity&&((a=this.entity)==null?void 0:a.parent)!==this}canModifyObjectStructure(){var a;const i=this.isIndependentlyUserDeclaredEntity();return(this.isInlineDeclaredEntity()||this.canBeObject()||((a=this.entity)==null?void 0:a.name)===Q.KeyValue)&&!i}inferFromInputs(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"infer-data-type-from-inputs"))){var v;const o=[],p=[],e=[],y=[];if(!this.inferred)return a==null||a.attemptAutoclose("infer-data-type-from-inputs",this.id),{updated:[],added:[],removed:[],affected:[],self:this};if(!this.entity&&i.length){const E=ne(this.parent,this.project)+" data type definition",b={id:N.UUID.uuid(),type:f.DefinitionEntity,version:N.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,name:E,description:((v=this.parent)==null?void 0:v.description)||null,codeName:null,static:!0,abstract:!1,properties:[],methods:[],extends:[],implements:[],abstractMethods:[],x:0,y:0,parent:this.toReference()},A=te(b,this.project);A.hydrateAncestors(),A.setParent(this,a),A.initChildren(a),a==null||a.add(A,S.Added),A.metaSync(b,a),this.setEntity(A,a),a==null||a.add(this,S.Updated)}if(this.entity){const{updated:E,added:b,removed:A,affected:$}=this.entity.inferFromInputs(i,a);p.push(...E),o.push(...b),e.push(...A),y.push(...$)}return this.like||this.metaSync({like:!0},a),a==null||a.attemptAutoclose("infer-data-type-from-inputs",this.id),{updated:R(p),added:R(o),removed:R(e),affected:R(y),self:this}}};g(Mt,"repository",{APICreate:async(i,...a)=>i,APIUpdate:async(i,...a)=>i,APIDelete:async(i,...a)=>i,APIClone:async(i,...a)=>{},APILoad:async(i,...a)=>null,APILoadVersion:async(i,a,...o)=>null}),g(Mt,"type",f.DataType),g(Mt,"USER_MANAGED_PARENT_TYPES",[f.Property,f.ArgumentDeclaration,f.ReturnDeclaration,f.VariableDeclaration,f.ValueDescriptor,f.InputMap,f.OutputMap,f.DataType]),g(Mt,"PARENT_TYPES",[...Mt.USER_MANAGED_PARENT_TYPES]),g(Mt,"MUTABLE_BASE_PROPERTIES",["isList","asType","options","parentRelationType","like","implementationChooseOne","staticEntities","interactiveEntities","actionEntities"]),g(Mt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","index","author","previousVersion"]),g(Mt,"BASE_PROPERTIES",[...Mt.MUTABLE_BASE_PROPERTIES,...Mt.INMUTABLE_BASE_PROPERTIES]),g(Mt,"MUTABLE_META_PROPERTIES",[...Mt.MUTABLE_BASE_PROPERTIES,"inferred"]),g(Mt,"INMUTABLE_META_PROPERTIES",[...Mt.INMUTABLE_BASE_PROPERTIES]),g(Mt,"META_PROPERTIES",[...Mt.MUTABLE_META_PROPERTIES,...Mt.INMUTABLE_META_PROPERTIES]),g(Mt,"MUTABLE_UPSTREAM_PROPERTIES",["entity","parent"]),g(Mt,"INMUTABLE_UPSTREAM_PROPERTIES",[]),g(Mt,"UPSTREAM_PROPERTIES",[...Mt.MUTABLE_UPSTREAM_PROPERTIES,...Mt.INMUTABLE_UPSTREAM_PROPERTIES]),g(Mt,"MUTABLE_DOWNSTREAM_PROPERTIES",[]),g(Mt,"INMUTABLE_DOWNSTREAM_PROPERTIES",["andChildrenGroup","orChildrenGroup"]),g(Mt,"DOWNSTREAM_PROPERTIES",[...Mt.MUTABLE_DOWNSTREAM_PROPERTIES,...Mt.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(Mt,"PROPERTIES",[...Mt.META_PROPERTIES,...Mt.UPSTREAM_PROPERTIES,...Mt.DOWNSTREAM_PROPERTIES]);let vs=Mt;function rj(d){var y;const u=Gye(),i=d.toJSON();u.safeParse(i).success;const o=K0e(d),p=Ka(d),e=[...o,...p];return d.outputs.forEach(v=>v.validate()),(y=d.error)==null||y.validate(),Er(d.errors,e)}function K0e(d){const u=[];return d.inputs.forEach(i=>{i.validate()}),Er(d.errors,u)}const k0e=Object.freeze(Object.defineProperty({__proto__:null,validate:rj},Symbol.toStringTag,{value:"Module"}));var ij=(d=>(d.Parent="parent",d))(ij||{});const Bt=class Bt extends Nr{constructor(i,a){super(i);g(this,"initialData");g(this,"id");g(this,"x");g(this,"y");g(this,"type",f.Operation);g(this,"declaration");g(this,"inputs",[]);g(this,"outputs",[]);g(this,"process",null);g(this,"successCalls",[]);g(this,"errorCalls",[]);g(this,"error",null);g(this,"calledBySuccess",[]);g(this,"calledByError",[]);g(this,"calledByEntry",[]);g(this,"parent");g(this,"errors",[]);g(this,"project");g(this,"detachedDependents",{});g(this,"knownVersions",null);g(this,"activeVersion",!1);g(this,"initialized",!1);g(this,"startedInitialization",!1);this.initialData=i,this.project=a,this.id=i.id,this.x=i.x,this.y=i.y}static new(i=null){return{id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.Operation,declaration:null,inputs:[],outputs:[],process:null,error:null,parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],errorCalls:[],successCalls:[],x:0,y:0}}static fromGenerationTarget(i,a){let o=a;if(i.parent){const $=H(i.parent);o=a.get($)}const p=H(i.declaration),e=a.get(p),y=i.calledByEntry.map($=>{const V=H($);return a.get(V)}),v=i.calledBySuccess.map($=>{const V=H($);return a.get(V)}),E=i.calledByError.map($=>{const V=H($);return a.get(V)}),b={id:i.id,version:N.UUID.uuid(),createdAt:L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.Operation,declaration:e,calledByEntry:y,calledBySuccess:v,calledByError:E,errorCalls:[],successCalls:[],inputs:[],outputs:[],process:null,error:null,x:0,y:0,parent:o},A=te(b,a);return A.setParent(o,null),A}static validateGenerationTarget(i,a){let o=JSON.parse(JSON.stringify(i));const p=[],e=li(o,{parent:{list:!1,types:[...Br,f.Project],optional:!0}},a);o=e.modifiedData,p.push(...e.errors,...Ur(o));const y=H(o.declaration);if(y){const v=L5(y,a);p.push(...v)}else{const v=`
|
|
39
|
+
Alternatively you can update the entity with 'update' action. Or replace it by first removing it and then creating a new one.`}))}b===f.DataType&&(!o.parentRelationType||!(o.parentRelationType===Ii.AndDataTypeGroup||o.parentRelationType===Ii.OrDataTypeGroup))&&p.push(new ee({id:`${i.id}--${k.InvalidParentRelationType}`,code:k.InvalidParentRelationType,severity:q.Error,message:`The entity with id '${i.id}' and type '${i.type}', must have a 'parentRelationType' property set to either 'or-data-type-group' or 'and-data-type-group' when being added as a child to an entity of type 'data-type'.`}))}return{errors:p,modifiedData:o}}get isGroup(){const i=[...this.andChildrenGroup||[],...this.orChildrenGroup||[]];if(i.length>1){let a=0;for(const o of i)if(o.isResolved&&(a++,a>1))return!0}return!1}get isResolved(){return[f.BuiltInBaseEntity,f.ActionDescriptor].includes(this.parent.type)||Co(this.parent)?!0:!(!this.entity&&!this.isGroup)}validateGeneratedUpdate(i){return{errors:[],modifiedData:i}}subscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-dependents"))){const a=[],o=[],p=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),o.push(...v.added),p.push(...v.removed),e.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}onDetachedDependencyRemoved(i,a,o){const p=[],e=[],y=[],v=[];return a==="entity"&&this.setEntity(i,o),{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,o){const p=[],e=[],y=[],v=[];return a==="entity"&&this.setEntity(null,o),{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){var i,a;return(a=(i=this.entity)==null?void 0:i.unsubscribeDependents)==null||a.call(i,[{entity:this,field:"entity"}]),this}subscribeToDependencies(){var i,a;return(a=(i=this.entity)==null?void 0:i.subscribeDependents)==null||a.call(i,[{entity:this,field:"entity"}]),this}increaseVersion(i){if(i&&!L(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&L(i).isSame(L(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=L(i).toISOString()||L().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new Mt(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.entity=this.entity,i.andChildrenGroup=this.andChildrenGroup?[...this.andChildrenGroup]:this.andChildrenGroup,i.orChildrenGroup=this.orChildrenGroup?[...this.orChildrenGroup]:this.orChildrenGroup,i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const a=[],o=[],p=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),o.push(...y.added),p.push(...y.removed)}return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}async restoreVersion(i){var v;const a=[],o=[],p=[],e=[];if(this.version===i)return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[$,V]of A.knownVersions)E.set($,V);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new Mt(E,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.entity=y.entity,this.andChildrenGroup=y.andChildrenGroup,this.orChildrenGroup=y.orChildrenGroup,this.parent=y.parent,{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"update-with-shallow-transfer"))){if(this.metaSync(i,a),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent){const o=H(i.parent),p=this.project.get(o),e=this.parent;if(e&&e.id!==(p==null?void 0:p.id)&&this.removeFromParent(a),p)this.setParent(p,a),this.addSelfToProject(a);else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${o}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.entity){const o=H(i.entity),p=this.project.get(o);p&&(p.type===f.DefinitionEntity&&p.parent===this||this.setEntity(p,null))}return i.andChildrenGroup&&(this.andChildrenGroup=i.andChildrenGroup.map(o=>{const p=H(o),e=this.project.get(p);if(e&&!(e.type===f.DataType&&e.parent===this))return e}).filter(o=>!!o)),i.orChildrenGroup&&(this.orChildrenGroup=i.orChildrenGroup.map(o=>{const p=H(o),e=this.project.get(p);if(e&&!(e.type===f.DataType&&e.parent===this))return e}).filter(o=>!!o)),this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const i=[],a=[],o=[],p=[];if(this.initialData.parent){const e=H(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.entity){const e=H(this.initialData.entity),y=this.project.get(e);y&&(y.type===f.DefinitionEntity&&y.parent===this||(this.setEntity(y,null),y.type!==f.BuiltInBaseEntity&&y.type!==f.PrimitiveEntity&&i.push(y)))}return{updated:R(i),added:R(a),removed:R(o),affected:R(p),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],o=[],p=[],e=[];return this.initialized=!0,this.captureVersion(),i==null||i.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-self-to-project"))){const a=[this],o=[],p=[],e=[];return this.parent.type===f.DataType?this.parentRelationType===Ii.AndDataTypeGroup?this.parent.addToAndGroup(this):this.parentRelationType===Ii.OrDataTypeGroup&&this.parent.addToOrGroup(this):this.parent.setDataType(this,i),e.push(this.parent),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}setParent(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-parent"))){var o;return((o=this.parent)==null?void 0:o.id)!==(i==null?void 0:i.id)&&(this.parent=i,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-parent",this.id),this}removeChildGroup(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-child-group"))){if(this.andChildrenGroup){const o=this.andChildrenGroup.findIndex(p=>p.id===i.id);o!==-1&&(this.andChildrenGroup.splice(o,1),a==null||a.add(this,S.Updated))}if(this.orChildrenGroup){const o=this.orChildrenGroup.findIndex(p=>p.id===i.id);o!==-1&&(this.orChildrenGroup.splice(o,1),a==null||a.add(this,S.Updated))}return a==null||a.attemptAutoclose("remove-child-group",this.id),this}initChildren(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"init-children"))){var a,o,p,e;if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.entity)if(this.initialData.entity.type===f.GenericReference){const y=this.project.findSubscribedInstanceFromReference(this.initialData.entity);this.entity=y}else this.entity=te(this.initialData.entity,this.project),((o=(a=this.initialData.entity)==null?void 0:a.parent)==null?void 0:o.id)===this.id&&this.entity.setParent(this,null),(e=(p=this.entity).initChildren)==null||e.call(p,i);return this.initialData.andChildrenGroup&&(this.andChildrenGroup=this.initialData.andChildrenGroup.map(y=>{const v=te(y,this.project);return v.setParent(this,null),v.initChildren(i),v})),this.initialData.orChildrenGroup&&(this.orChildrenGroup=this.initialData.orChildrenGroup.map(y=>{const v=te(y,this.project);return v.setParent(this,null),v.initChildren(i),v})),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"meta-sync"))){const o=xr(this,i),p=this.toMeta();return this.options=i.options||p.options,this.parentRelationType=i.parentRelationType||p.parentRelationType,this.isList=i.isList!==void 0?i.isList:p.isList,this.inferred=i.inferred!==void 0?i.inferred:p.inferred,this.like=i.like!==void 0?i.like:p.like,this.asType=i.asType!==void 0?i.asType:p.asType,this.index=i.index!==void 0?i.index:p.index,this.implementationChooseOne=i.implementationChooseOne!==void 0?i.implementationChooseOne:p.implementationChooseOne,this.staticEntities=i.staticEntities!==void 0?i.staticEntities:p.staticEntities,this.interactiveEntities=i.interactiveEntities!==void 0?i.interactiveEntities:p.interactiveEntities,this.actionEntities=i.actionEntities!==void 0?i.actionEntities:p.actionEntities,super.metaSync(i),i.deleted===!0&&!p.deleted?a==null||a.add(this,S.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,S.Added):o&&(a==null||a.add(this,S.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ve,...a){return await Mt.repository.APILoad(this.id,...a),this}async APICreate(i=ve,...a){return await Mt.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ve,...a){return await Mt.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ve,...a){return await Mt.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ve,...a){return await Mt.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ve,a,...o){return await Mt.repository.APILoadVersion(this.id,a,...o)}removeFromParent(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-from-parent"))){var y;const a=[],o=[],p=[],e=[];if(((y=this.parent)==null?void 0:y.type)===f.DataType)this.parent.removeChildGroup(this,i);else{const v=this.parent;v==null||v.removeDataType()}return this.parent&&a.push(this.parent),i==null||i.attemptAutoclose("remove-from-parent",this.id),{added:R(p),updated:R(a),removed:R(o),affected:R(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-entity"))){if(this.id==="iterate-over-string-loop-string-argument-declaration-data-type-id")throw new Error("You are trying to remove the iterate-over-string-loop-string-argument-declaration-data-type-id entity. This is not allowed.");const o=[],p=[],e=[],y=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(p.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:A}=v.entity.onDetachedDependencyRemoved(this,v.field,a);o.push(...E),p.push(...b),e.push(...A)}),this.entity&&this.entity.type===f.DefinitionEntity&&this.entity.parent===this){const{updated:v,removed:E}=this.entity.remove({ignoreUpstream:!0},a);o.push(...v),p.push(...E)}if(this.andChildrenGroup&&this.andChildrenGroup.forEach(v=>{const{removed:E,updated:b}=v.remove({ignoreUpstream:!0},a);p.push(...E),o.push(...b)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(v=>{const{removed:E,updated:b}=v.remove({ignoreUpstream:!0},a);p.push(...E),o.push(...b)}),!i){const v=this.removeFromParent(a);e.push(...v.added),o.push(...v.updated),p.push(...v.removed),y.push(...v.affected)}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:R(e),updated:R(o),removed:R(p),affected:R(y),self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"restore-entity"))){const a=[],o=[],p=[],e=[];if(i!=null&&i.hasAdded(this.id))return i==null||i.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(y=>{const{updated:v,removed:E,added:b}=y.entity.onDetachedDependencyRestored(this,y.field,i);o.push(...v),p.push(...E),a.push(...b)}),this.entity&&this.entity.type===f.DefinitionEntity&&this.entity.parent===this){const{updated:y}=this.entity.restore({},i);o.push(...y)}if(this.andChildrenGroup&&this.andChildrenGroup.forEach(y=>{const{updated:v,added:E}=y.restore({},i);o.push(...v),a.push(...E)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(y=>{const{updated:v,added:E}=y.restore({},i);o.push(...v),a.push(...E)}),this.parent.type===f.DataType){const y=this.parent;Array.isArray(y.andChildrenGroup)&&y.andChildrenGroup.push(this)}if(this.parent.type===f.DataType){const y=this.parent;this.parentRelationType===Ii.AndDataTypeGroup?Array.isArray(y.andChildrenGroup)&&y.andChildrenGroup.push(this):this.parentRelationType===Ii.OrDataTypeGroup&&Array.isArray(y.orChildrenGroup)&&y.orChildrenGroup.push(this)}else{const y=this.parent;y.setDataType(this,i),o.push(y)}return i==null||i.attemptAutoclose("restore-entity",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this}}toFlat(i=new Set){var o,p,e;return i.has(this.id)?[]:(i.add(this.id),[this,...((o=this.andChildrenGroup)==null?void 0:o.flatMap(y=>y.toFlat(i)))||[],...((p=this.orChildrenGroup)==null?void 0:p.flatMap(y=>y.toFlat(i)))||[],...((e=this.entity)==null?void 0:e.toFlat(i))||[]])}toFlatIds(i=new Set){var o,p,e;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((o=this.andChildrenGroup)==null?void 0:o.flatMap(y=>y.toFlatIds(i)))||[],...((p=this.orChildrenGroup)==null?void 0:p.flatMap(y=>y.toFlatIds(i)))||[],...((e=this.entity)==null?void 0:e.toFlatIds(i))||[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,like:this.like,isList:this.isList,inferred:this.inferred,index:this.index,parentRelationType:this.parentRelationType,implementationChooseOne:this.implementationChooseOne,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,options:this.options,asType:this.asType,type:this.type}}toJSON(i=new Set){var a,o,p,e;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,options:this.options,isList:this.isList,asType:this.asType,index:this.index,like:this.like,inferred:this.inferred,parentRelationType:this.parentRelationType,implementationChooseOne:this.implementationChooseOne,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,andChildrenGroup:((a=this.andChildrenGroup)==null?void 0:a.map(y=>y.toJSON(i)))||null,orChildrenGroup:((o=this.orChildrenGroup)==null?void 0:o.map(y=>y.toJSON(i)))||null,entity:((p=this.entity)==null?void 0:p.parent)===this?this.entity.toJSON(i):((e=this.entity)==null?void 0:e.toReference())||null,parent:this.parent.toReference()})}toJSONClone(i=ke){var o,p,e,y,v,E,b,A,$;let a;return(o=i.seenEntityMaps)!=null&&o.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||Kr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(p=i.seenEntities)!=null&&p.has(a)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(a),(v=i.seenEntities)==null||v.add(this.id),{id:a,version:N.UUID.uuid(),createdAt:i.timestamp||L().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,options:this.options,isList:this.isList,asType:this.asType,like:this.like,index:this.index,inferred:this.inferred,parentRelationType:this.parentRelationType,implementationChooseOne:this.implementationChooseOne,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,andChildrenGroup:((E=this.andChildrenGroup)==null?void 0:E.map(V=>V.toJSONClone({...i,newId:null})))||null,orChildrenGroup:((b=this.orChildrenGroup)==null?void 0:b.map(V=>V.toJSONClone({...i,newId:null})))||null,entity:((A=this.entity)==null?void 0:A.parent)===this?this.entity.toJSONClone({...i,newId:null}):(($=this.entity)==null?void 0:$.toReference({seenEntityMaps:i.seenEntityMaps}))||null,parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=ke){var o;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+N.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=ke){var o,p,e,y;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,isList:this.isList,options:this.options,asType:this.asType,index:this.index,parentRelationType:this.parentRelationType,like:this.like,inferred:this.inferred,implementationChooseOne:this.implementationChooseOne,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,andChildrenGroup:((p=this.andChildrenGroup)==null?void 0:p.map(v=>v.toReference(i)))||null,orChildrenGroup:((e=this.orChildrenGroup)==null?void 0:e.map(v=>v.toReference(i)))||null,entity:((y=this.entity)==null?void 0:y.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var o,p,e;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((o=this.andChildrenGroup)==null?void 0:o.flatMap(y=>y.toFlatJSON(i)))||[],...((p=this.orChildrenGroup)==null?void 0:p.flatMap(y=>y.toFlatJSON(i)))||[],...((e=this.entity)==null?void 0:e.toFlatJSON(i))||[]])}toGenerationTarget(){var i;return{id:this.id,type:this.type,options:this.options||void 0,isList:this.isList,like:this.like,parentRelationType:this.parentRelationType||void 0,asType:this.asType,entity:((i=this.entity)==null?void 0:i.id)||null,parent:this.parent.id}}toFlatGenerationTarget(i=new Set){var o,p;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((o=this.andChildrenGroup)==null?void 0:o.flatMap(e=>e.toFlatGenerationTarget(i)))||[],...((p=this.orChildrenGroup)==null?void 0:p.flatMap(e=>e.toFlatGenerationTarget(i)))||[],...this.entity&&this.entity.type==f.DefinitionEntity&&this.entity.parent===this&&this.entity.toFlatGenerationTarget(i)||[]])}clearErrors(){var i,a,o,p;return this.errors=[],(i=this.andChildrenGroup)==null||i.forEach(e=>e.clearErrors()),(a=this.orChildrenGroup)==null||a.forEach(e=>e.clearErrors()),this.inferred&&this.entity&&this.entity.type===f.DefinitionEntity&&((o=this.entity)==null?void 0:o.parent)===this&&((p=this.entity)==null||p.clearErrors()),this}validate(){const i=tj(this);return this.errors=i,{success:!0}}getErrors(){return[...this.errors]}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"clone-entity")),a=null,o=null,p=!0){var V,B,F;let e=Sr(a,this),y=a||this.parent;const E={id:o||N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||"1",previousVersion:null,deleted:!1,type:f.DataType,isList:this.isList,asType:this.asType,options:this.options,index:this.index,parentRelationType:this.parentRelationType,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,like:this.like,inferred:this.inferred,implementationChooseOne:this.implementationChooseOne,andChildrenGroup:null,orChildrenGroup:null,entity:null,parent:y.toReference()},b=dr(E,e);a&&b.setParent(a,null),p&&b.subscribe(),b.initChildren(i),i==null||i.add(b,S.Added);const A=(V=this.andChildrenGroup)==null?void 0:V.map(K=>K.clone(i,b,N.UUID.uuid(),p)),$=(B=this.orChildrenGroup)==null?void 0:B.map(K=>K.clone(i,b,N.UUID.uuid(),p));if(b.andChildrenGroup=A||null,b.orChildrenGroup=$||null,this.entity&&this.entity.type===f.DefinitionEntity&&((F=this.entity)==null?void 0:F.parent)===this){const K=this.entity.clone(i,b,N.UUID.uuid(),p);b.setEntity(K,i)}else this.entity&&b.setEntity(this.entity,i);return i==null||i.attemptAutoclose("clone-entity",this.id),b}merge(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"merge-entity"))){const o=[],p=[],e=[],y=[];if(this.asType!==(i==null?void 0:i.asType)&&(this.metaSync({asType:i==null?void 0:i.asType},a),a==null||a.add(this,S.Updated),o.push(this)),this.index!==(i==null?void 0:i.index)&&(this.metaSync({index:i==null?void 0:i.index},a),a==null||a.add(this,S.Updated),o.push(this)),this.isList!==(i==null?void 0:i.isList)&&(this.metaSync({isList:i==null?void 0:i.isList},a),a==null||a.add(this,S.Updated),o.push(this)),this.like!==(i==null?void 0:i.like)&&(this.metaSync({like:i==null?void 0:i.like},a),a==null||a.add(this,S.Updated),o.push(this)),i!=null&&i.inferred){if(i.entity&&i.entity.type===f.DefinitionEntity&&i.entity.parent===i){const v=i.entity.clone(a,this,N.UUID.uuid(),!0);this.setEntity(v,a),p.push(v)}else i.entity&&(this.setEntity(i.entity,a),a==null||a.add(this,S.Updated),o.push(this));this.inferred||(this.metaSync({inferred:!0},a),a==null||a.add(this,S.Updated),o.push(this))}else if(this.inferred){if(this.metaSync({inferred:!1},a),a==null||a.add(this,S.Updated),o.push(this),this.entity&&this.entity.type===f.DefinitionEntity&&this.entity.parent===this){const{updated:v,removed:E}=this.entity.remove({ignoreUpstream:!0},a);e.push(...E),v.push(...v)}i.entity!==this.entity&&(this.setEntity(i.entity,a),a==null||a.add(this,S.Updated),o.push(this))}else i.entity!==this.entity&&(this.setEntity(i.entity,a),a==null||a.add(this,S.Updated),o.push(this));return a==null||a.attemptAutoclose("merge-entity",this.id),{updated:R(o),added:R(p),removed:R(e),affected:R(y),self:this}}addToAndGroup(i){return this.andChildrenGroup||(this.andChildrenGroup=[]),this.andChildrenGroup.includes(i)||this.andChildrenGroup.push(i),this}addToOrGroup(i){return this.orChildrenGroup||(this.orChildrenGroup=[]),this.orChildrenGroup.includes(i)||this.orChildrenGroup.push(i),this}setEntity(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-data-type-entity-value"))){var p;const o=this.entity;return(o==null?void 0:o.id)!==(i==null?void 0:i.id)&&(this.entity=i,a==null||a.add(this,S.Affected),o&&o.type===f.DefinitionEntity&&((p=o.parent)==null?void 0:p.id)===this.id&&(o==null||o.remove({ignoreUpstream:!0},a))),a==null||a.attemptAutoclose("set-data-type-entity-value",this.id),this}isObject(){return!!this.entity&&(this.entity.type===f.DefinitionEntity||this.entity.type===f.BuiltInBaseEntity||this.entity.name===Q.KeyValue)&&!this.isList}canBeObject(){var a;let i=!1;if(this.parent.type!==f.DataType){const o=(a=this.project.requestActiveDynamicValue(this.parent))==null?void 0:a.value;o?!o.valueAsType&&(o.value===""||o.value===null||Ar(o))&&(i=!0):i=!0}return(this.isObject()||!this.entity||this.entity.name===Q.Untyped)&&i}hasStrictObjectStructure(){var i;return this.isObject()&&((i=this.entity)==null?void 0:i.type)===f.DefinitionEntity}isInlineDeclaredEntity(){var i,a;return((i=this.entity)==null?void 0:i.type)===f.DefinitionEntity&&((a=this.entity.parent)==null?void 0:a.id)===(this==null?void 0:this.id)}isIndependentlyUserDeclaredEntity(){var i,a;return((i=this.entity)==null?void 0:i.type)===f.DefinitionEntity&&((a=this.entity)==null?void 0:a.parent)!==this}canModifyObjectStructure(){var a;const i=this.isIndependentlyUserDeclaredEntity();return(this.isInlineDeclaredEntity()||this.canBeObject()||((a=this.entity)==null?void 0:a.name)===Q.KeyValue)&&!i}inferFromInputs(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"infer-data-type-from-inputs"))){var v;const o=[],p=[],e=[],y=[];if(!this.inferred)return a==null||a.attemptAutoclose("infer-data-type-from-inputs",this.id),{updated:[],added:[],removed:[],affected:[],self:this};if(!this.entity&&i.length){const E=ne(this.parent,this.project)+" data type definition",b={id:N.UUID.uuid(),type:f.DefinitionEntity,version:N.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,name:E,description:((v=this.parent)==null?void 0:v.description)||null,codeName:null,static:!0,abstract:!1,properties:[],methods:[],extends:[],implements:[],abstractMethods:[],x:0,y:0,parent:this.toReference()},A=te(b,this.project);A.hydrateAncestors(),A.setParent(this,a),A.initChildren(a),a==null||a.add(A,S.Added),A.metaSync(b,a),this.setEntity(A,a),a==null||a.add(this,S.Updated)}if(this.entity){const{updated:E,added:b,removed:A,affected:$}=this.entity.inferFromInputs(i,a);p.push(...E),o.push(...b),e.push(...A),y.push(...$)}return this.like||this.metaSync({like:!0},a),a==null||a.attemptAutoclose("infer-data-type-from-inputs",this.id),{updated:R(p),added:R(o),removed:R(e),affected:R(y),self:this}}};g(Mt,"repository",{APICreate:async(i,...a)=>i,APIUpdate:async(i,...a)=>i,APIDelete:async(i,...a)=>i,APIClone:async(i,...a)=>{},APILoad:async(i,...a)=>null,APILoadVersion:async(i,a,...o)=>null}),g(Mt,"type",f.DataType),g(Mt,"USER_MANAGED_PARENT_TYPES",[f.Property,f.ArgumentDeclaration,f.ReturnDeclaration,f.VariableDeclaration,f.ValueDescriptor,f.InputMap,f.OutputMap,f.DataType]),g(Mt,"PARENT_TYPES",[...Mt.USER_MANAGED_PARENT_TYPES]),g(Mt,"MUTABLE_BASE_PROPERTIES",["isList","asType","options","parentRelationType","like","implementationChooseOne","staticEntities","interactiveEntities","actionEntities"]),g(Mt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","index","author","previousVersion"]),g(Mt,"BASE_PROPERTIES",[...Mt.MUTABLE_BASE_PROPERTIES,...Mt.INMUTABLE_BASE_PROPERTIES]),g(Mt,"MUTABLE_META_PROPERTIES",[...Mt.MUTABLE_BASE_PROPERTIES,"inferred"]),g(Mt,"INMUTABLE_META_PROPERTIES",[...Mt.INMUTABLE_BASE_PROPERTIES]),g(Mt,"META_PROPERTIES",[...Mt.MUTABLE_META_PROPERTIES,...Mt.INMUTABLE_META_PROPERTIES]),g(Mt,"MUTABLE_UPSTREAM_PROPERTIES",["entity","parent"]),g(Mt,"INMUTABLE_UPSTREAM_PROPERTIES",[]),g(Mt,"UPSTREAM_PROPERTIES",[...Mt.MUTABLE_UPSTREAM_PROPERTIES,...Mt.INMUTABLE_UPSTREAM_PROPERTIES]),g(Mt,"MUTABLE_DOWNSTREAM_PROPERTIES",[]),g(Mt,"INMUTABLE_DOWNSTREAM_PROPERTIES",["andChildrenGroup","orChildrenGroup"]),g(Mt,"DOWNSTREAM_PROPERTIES",[...Mt.MUTABLE_DOWNSTREAM_PROPERTIES,...Mt.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(Mt,"PROPERTIES",[...Mt.META_PROPERTIES,...Mt.UPSTREAM_PROPERTIES,...Mt.DOWNSTREAM_PROPERTIES]);let vs=Mt;function rj(d){var y;const u=Gye(),i=d.toJSON();u.safeParse(i).success;const o=K0e(d),p=Ka(d),e=[...o,...p];return d.outputs.forEach(v=>v.validate()),(y=d.error)==null||y.validate(),Er(d.errors,e)}function K0e(d){const u=[];return d.inputs.forEach(i=>{i.validate()}),Er(d.errors,u)}const k0e=Object.freeze(Object.defineProperty({__proto__:null,validate:rj},Symbol.toStringTag,{value:"Module"}));var ij=(d=>(d.Parent="parent",d))(ij||{});const Bt=class Bt extends Nr{constructor(i,a){super(i);g(this,"initialData");g(this,"id");g(this,"x");g(this,"y");g(this,"type",f.Operation);g(this,"declaration");g(this,"inputs",[]);g(this,"outputs",[]);g(this,"process",null);g(this,"successCalls",[]);g(this,"errorCalls",[]);g(this,"error",null);g(this,"calledBySuccess",[]);g(this,"calledByError",[]);g(this,"calledByEntry",[]);g(this,"parent");g(this,"errors",[]);g(this,"project");g(this,"detachedDependents",{});g(this,"knownVersions",null);g(this,"activeVersion",!1);g(this,"initialized",!1);g(this,"startedInitialization",!1);this.initialData=i,this.project=a,this.id=i.id,this.x=i.x,this.y=i.y}static new(i=null){return{id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.Operation,declaration:null,inputs:[],outputs:[],process:null,error:null,parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],errorCalls:[],successCalls:[],x:0,y:0}}static fromGenerationTarget(i,a){let o=a;if(i.parent){const $=H(i.parent);o=a.get($)}const p=H(i.declaration),e=a.get(p),y=i.calledByEntry.map($=>{const V=H($);return a.get(V)}),v=i.calledBySuccess.map($=>{const V=H($);return a.get(V)}),E=i.calledByError.map($=>{const V=H($);return a.get(V)}),b={id:i.id,version:N.UUID.uuid(),createdAt:L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.Operation,declaration:e,calledByEntry:y,calledBySuccess:v,calledByError:E,errorCalls:[],successCalls:[],inputs:[],outputs:[],process:null,error:null,x:0,y:0,parent:o},A=te(b,a);return A.setParent(o,null),A}static validateGenerationTarget(i,a){let o=JSON.parse(JSON.stringify(i));const p=[],e=li(o,{parent:{list:!1,types:[...Br,f.Project],optional:!0}},a);o=e.modifiedData,p.push(...e.errors,...Ur(o));const y=H(o.declaration);if(y){const v=L5(y,a);p.push(...v)}else{const v=`
|
|
40
40
|
All built-in 'action-descriptor' entity ids are:
|
|
41
41
|
- ${a.operationDeclarations.map(E=>`${E.id} (${ne(E,a)})`).join(`
|
|
42
42
|
- `)}.
|
|
@@ -72,11 +72,11 @@ ${Pm(a)}`})):p.push(new ee({id:`${i.id}--${k.ReferencedEntityNotFound}`,code:k.R
|
|
|
72
72
|
${Pm(a)}`})):p.push(new ee({id:`${i.id}--${ae.InvalidObjectStructure}`,code:ae.InvalidObjectStructure,severity:q.Error,message:`Entity of type '${i.type}' with id '${i.id}' is missing the 'declaration' property. This property is required for a '${i.type}' entity and must point to one of the built-in action descriptors reserved for '${f.Condition}' entities.
|
|
73
73
|
${Pm(a)}`})),{errors:p,modifiedData:o}}static fromReturnDeclarationToBodyArgumentDeclarationName(i){return`Previous iteration results of '${ne(i,i.project)}'`}static fromBodyArgumentDeclarationToReturnDeclarationName(i){const a=i.name.replace("Previous iteration results of '","");return a.slice(0,a.length-1)}static fromReturnDeclarationToLoopOutputDeclarationName(i){return`Result list of '${ne(i,i.project)}'`}static fromLoopOutputDeclarationToReturnDeclarationName(i){const a=i.name.replace("Result list of '","");return a.slice(0,a.length-1)}static fromLoopOutputDeclarationToBodyArgumentDeclarationName(i){return i.name.replace("Result list of '","Previous iteration results of '")}static fromBodyArgumentDeclarationToLoopOutputDeclarationName(i){return i.name.replace("Previous iteration results of '","Result list of '")}get currentIterationNumberArgumentDeclaration(){var o;const i=(o=Ee[f.Loop][this.declaration.id].body.inputs.iterationNumber)==null?void 0:o.id;return this.body.inputs.find(p=>{var e;return!!p.implements&&i===((e=p.implements)==null?void 0:e.id)||p.name===ht.CURRENT_ITERATION_NUMBER_ARG_NAME})}get currentValueArgumentDeclaration(){var o;if(this.declaration.id===ze.ManualFlow||this.declaration.id===ze.Counted)return null;const i=(o=Ee[f.Loop][this.declaration.id].body.inputs.currentValue)==null?void 0:o.id;return this.body.inputs.find(p=>{var e;return!!p.implements&&i===((e=p.implements)==null?void 0:e.id)||p.name===ht.CURRENT_VALUE_ARG_NAME})||null}get continueStatements(){return _t(this.body).filter(o=>o.type===f.ContinueStatement&&o.parent.id===this.id)}get breakStatements(){return _t(this.body).filter(o=>o.type===f.BreakStatement&&o.parent.id===this.id)}validateGeneratedUpdate(i){const a=[];return i.parent&&a.push(new ee({id:`${this.id}--${k.InvalidParentUpdate}`,code:k.InvalidParentUpdate,severity:q.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
|
|
74
74
|
If an entity is called by another, they must be in the same scope, which means they have the same parent.
|
|
75
|
-
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.`})),{errors:a,modifiedData:i}}subscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-dependents"))){const a=[],o=[],p=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),o.push(...v.added),p.push(...v.removed),e.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}onDetachedDependencyRemoved(i,a,o){const p=[],e=[],y=[],v=[];if(a==="parent"){const{updated:E,added:b,removed:A}=this.remove({ignoreUpstream:!1},o);p.push(...E),e.push(...b),y.push(...A)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,o){const p=[],e=[],y=[],v=[];if(a==="parent"){const{updated:E,added:b,removed:A}=this.restore({},o);p.push(...E),e.push(...b),y.push(...A)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){var i;return(i=this.parent)==null||i.unsubscribeDependents([{entity:this,field:"parent"}]),this}subscribeToDependencies(){var i;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"parent"}]),this}increaseVersion(i){if(i&&!L(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&L(i).isSame(L(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=L(i).toISOString()||L().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new ht(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.inputs=[...this.inputs],i.outputs=[...this.outputs],i.error=this.error,i.successCalls=[...this.successCalls],i.errorCalls=[...this.errorCalls],i.declaration=this.declaration,i.outputsDeclarations=[...this.outputsDeclarations],i.body=this.body,i.calledByEntry=[...this.calledByEntry],i.calledBySuccess=[...this.calledBySuccess],i.calledByError=[...this.calledByError],i.process=this.process,i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const a=[],o=[],p=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),o.push(...y.added),p.push(...y.removed)}return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}async restoreVersion(i){var v;const a=[],o=[],p=[],e=[];if(this.version===i)return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[$,V]of A.knownVersions)E.set($,V);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new ht(E,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.inputs=y.inputs,this.outputs=y.outputs,this.error=y.error,this.successCalls=y.successCalls,this.errorCalls=y.errorCalls,this.declaration=y.declaration,this.outputsDeclarations=y.outputsDeclarations,this.body=y.body,this.calledByEntry=y.calledByEntry,this.calledBySuccess=y.calledBySuccess,this.calledByError=y.calledByError,this.process=y.process,this.parent=y.parent,{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"update-with-shallow-transfer"))){if(this.metaSync(i,a),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent){const o=H(i.parent),p=this.project.get(o),e=this.parent;if(e&&e.id!==(p==null?void 0:p.id)&&this.removeFromParent(a),p)this.setParent(p,a);else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${o}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.declaration){const o=H(i.declaration),p=this.project.get(o);p&&this.setDeclaration(p)}return i.calledByEntry.forEach(o=>{const p=H(o),e=this.project.get(p);e&&(this.addEntryCaller(e,a),e.addCall(this,a))}),[...this.calledByEntry].forEach(o=>{i.calledByEntry.find(e=>H(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),i.calledBySuccess.forEach(o=>{const p=H(o),e=this.project.get(p);e&&(this.addSuccessCaller(e,a),e.addSuccessCall(this,a))}),[...this.calledBySuccess].forEach(o=>{i.calledBySuccess.find(e=>H(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),i.calledByError.forEach(o=>{const p=H(o),e=this.project.get(p);e&&(this.addErrorCaller(e,a),e.addErrorCall(this,a))}),[...this.calledBySuccess].forEach(o=>{i.calledBySuccess.find(e=>H(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const i=[],a=[],o=[],p=[];if(this.initialData.parent){const e=H(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' 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 e=H(this.initialData.declaration),y=this.project.get(e);y&&(this.setDeclaration(y),i.push(y))}return this.initialData.calledByEntry.forEach(e=>{const y=H(e),v=this.project.get(y);v&&this.addEntryCaller(v,null)}),this.initialData.calledBySuccess.forEach(e=>{const y=H(e),v=this.project.get(y);v&&this.addSuccessCaller(v,null)}),this.initialData.calledByError.forEach(e=>{const y=H(e),v=this.project.get(y);v&&this.addErrorCaller(v,null)}),{updated:R(i),added:R(a),removed:R(o),affected:R(p),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],o=[],p=[],e=[];this.initialized=!0;const{updated:y,added:v,removed:E}=this.syncChildren(i);return a.push(...y),o.push(...v),p.push(...E),this.captureVersion(),i==null||i.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-self-to-project"))){const a=[this],o=[],p=[],e=[];return this.parent===this.project&&this.project.addLoop(this),this.successCalls.forEach(y=>{y.addSuccessCaller(this,i),a.push(y)}),this.errorCalls.forEach(y=>{y.addErrorCaller(this,i),a.push(y)}),this.calledByEntry.forEach(y=>{y.addCall(this,i),a.push(y)}),this.calledBySuccess.forEach(y=>{y.addSuccessCall(this,i),a.push(y)}),this.calledByError.forEach(y=>{y.addErrorCall(this,i),a.push(y)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-input"))){const o=this.inputs.findIndex(p=>p.id===i.id);return o>-1&&(this.inputs.splice(o,1),a&&(a==null||a.add(this,S.Affected))),a==null||a.attemptAutoclose("remove-input",this.id),this}addInput(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-input"))){return this.inputs.includes(i)?(a==null||a.attemptAutoclose("add-input",this.id),this):(this.inputs.push(i),a==null||a.add(this,S.Affected),a==null||a.attemptAutoclose("add-input",this.id),this)}addOutputDeclaration(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-output-declaration"))){return this.outputsDeclarations.includes(i)?(a==null||a.attemptAutoclose("add-output-declaration",this.id),this):(this.outputsDeclarations.push(i),a==null||a.add(this,S.Affected),a==null||a.attemptAutoclose("add-output-declaration",this.id),this)}removeOutputDeclaration(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-output-declaration"))){const o=this.outputsDeclarations.findIndex(p=>p.id===i.id);return o>-1&&(this.outputsDeclarations.splice(o,1),a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("remove-output-declaration",this.id),this}addOutput(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-output"))){return this.outputs.includes(i)?(a==null||a.attemptAutoclose("add-output",this.id),this):(this.outputs.push(i),a==null||a.add(this,S.Affected),a==null||a.attemptAutoclose("add-output",this.id),this)}removeOutput(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-output"))){const o=this.outputs.findIndex(p=>p.id===i.id);return o>-1&&(this.outputs.splice(o,1),a&&(a==null||a.add(this,S.Affected))),a==null||a.attemptAutoclose("remove-output",this.id),this}setBody(i){return this.body=i,this}detachBody(){return this.body=null,this}addSuccessCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-success-caller")),o=!1){return this.calledBySuccess.find(p=>p.id===i.id)||(this.calledBySuccess.push(i),a==null||a.add(this,S.Updated),o&&We(this,a)),a==null||a.attemptAutoclose("add-success-caller",this.id),this}addErrorCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-error-caller")),o=!1){return this.calledByError.find(p=>p.id===i.id)||(this.calledByError.push(i),a==null||a.add(this,S.Updated),o&&We(this,a)),a==null||a.attemptAutoclose("add-error-caller",this.id),this}addEntryCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-entry-caller")),o=!1){return this.calledByEntry.find(p=>p.id===i.id)||(this.calledByEntry.push(i),a==null||a.add(this,S.Updated),o&&We(this,a)),a==null||a.attemptAutoclose("add-entry-caller",this.id),this}addErrorCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-error-call")),o=!1){return this.errorCalls.find(p=>p.id===i.id)||(this.errorCalls.push(i),o&&We(this,a),a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("add-error-call",this.id),this}addSuccessCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-success-call")),o=!1){return this.successCalls.find(p=>p.id===i.id)||(this.successCalls.push(i),o&&We(this,a),a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("add-success-call",this.id),this}removeCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-call")),o=!1){const p=this.successCalls.findIndex(y=>y.id===i.id);p>-1&&(this.successCalls.splice(p,1),a==null||a.add(this,S.Affected));const e=this.errorCalls.findIndex(y=>y.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),a==null||a.add(this,S.Affected)),o&&We(this,a),a==null||a.attemptAutoclose("remove-call",this.id),this}removeCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-caller")),o=!1){return this.calledBySuccess=this.calledBySuccess.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),this.calledByError=this.calledByError.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),o&&We(this,a),a==null||a.attemptAutoclose("remove-caller",this.id),this}replaceDetachedChild(i,a){const o=this.detachedChildren.indexOf(i);return o!==-1&&(this.detachedChildren[o]=a),this}subscribeDetachedChild(i){return this.detachedChildren.includes(i)||this.detachedChildren.push(i),this}unsubscribeDetachedChild(i){const a=this.detachedChildren.indexOf(i);return a!==-1&&this.detachedChildren.splice(a,1),this}setParent(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-parent"))){var o;return((o=this.parent)==null?void 0:o.id)!==(i==null?void 0:i.id)&&(this.parent=i,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-parent",this.id),this}setDeclaration(i){return this.declaration=i,this}initChildren(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.declaration=te(this.initialData.declaration,this.project),this.successCalls=this.initialData.successCalls.map(a=>{const o=te(a,this.project);if(o.addSuccessCaller(this),[f.BreakStatement,f.ContinueStatement].includes(o.type))o.setParent(this.parent.parent,null),o.initChildren(i);else if(o.type===f.ReturnStatement){const p=Yr(this,this.project);o.setParent(p,null),o.initChildren(i)}else o.type!==f.InternalCall&&(o.setParent(this.parent,null),o.initChildren(i));return o}),this.errorCalls=this.initialData.errorCalls.map(a=>{const o=te(a,this.project);if(o.addErrorCaller(this),[f.BreakStatement,f.ContinueStatement].includes(o.type))o.setParent(this.parent.parent,null),o.initChildren(i);else if(o.type===f.ReturnStatement){const p=Yr(this,this.project);o.setParent(p,null),o.initChildren(i)}else o.type!==f.InternalCall&&(o.setParent(this.parent,null),o.initChildren(i));return o}),this.inputs=this.initialData.inputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),o}),this.outputs=this.initialData.outputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),o}),this.initialData.process&&(this.process=te(this.initialData.process,this.project),this.process.setParent(this,null),this.process.initChildren(i)),this.initialData.body&&(this.body=te(this.initialData.body,this.project),this.body.setParent(this,null),this.body.initChildren(i)),this.initialData.error&&(this.error=te(this.initialData.error,this.project),this.error.setParent(this,null),this.error.initChildren(i)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"meta-sync"))){const o=xr(this,i),p=this.toMeta();return this.x=i.x||p.x,this.y=i.y||p.y,super.metaSync(i),i.deleted===!0&&!p.deleted?a==null||a.add(this,S.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,S.Added):o&&(a==null||a.add(this,S.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ve,...a){return await ht.repository.APILoad(this.id,...a),this}async APICreate(i=ve,...a){return await ht.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ve,...a){return await ht.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ve,...a){return await ht.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ve,...a){return await ht.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ve,a,...o){return await ht.repository.APILoadVersion(this.id,a,...o)}removeFromParent(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-from-parent"))){const a=[],o=[],p=[],e=[];return this.parent.type===f.Project?(this.parent.removeLoop(this),e.push(this.parent)):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose("remove-from-parent",this.id),{added:R(p),updated:R(a),removed:R(o),affected:R(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-entity"))){const o=[],p=[],e=[],y=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(p.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:A}=v.entity.onDetachedDependencyRemoved(this,v.field,a);o.push(...E),p.push(...b),e.push(...A)}),this.inputs.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...b)}),this.outputs.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...b)}),this.body.remove({ignoreUpstream:!0},a),this.error){const{updated:v,removed:E}=this.error.remove({ignoreUpstream:!0},a);o.push(...v),p.push(...E)}if(this.successCalls.forEach(v=>{o.push(v),v.removeCaller(this,a)}),this.errorCalls.forEach(v=>{o.push(v),v.removeCaller(this,a)}),!i){const v=this.removeFromParent(a);e.push(...v.added),o.push(...v.updated),p.push(...v.removed),y.push(...v.affected),this.calledBy.forEach(E=>{o.push(E),E.removeCall(this,a)})}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:R(e),updated:R(o),removed:R(p),affected:R(y),self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"restore-entity"))){const a=[],o=[],p=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),this.inputs.forEach(y=>{const{updated:v}=y.restore({},i);o.push(...v)}),this.outputs.forEach(y=>{const{updated:v}=y.restore({},i);o.push(...v)}),this.body.restore({},i),this.successCalls.forEach(y=>{o.push(y),y.addSuccessCaller(this,i)}),this.errorCalls.forEach(y=>{o.push(y),y.addErrorCaller(this,i)}),this.calledBySuccess.forEach(y=>{o.push(y),y.addSuccessCall(this,i)}),this.calledByError.forEach(y=>{o.push(y),y.addErrorCall(this,i)}),this.calledByEntry.forEach(y=>{o.push(y),y.addCall(this,i)}),i==null||i.attemptAutoclose("restore-entity",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this})}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.inputs.flatMap(o=>o.toFlat(i)),...this.outputs.flatMap(o=>o.toFlat(i)),...this.outputsDeclarations.flatMap(o=>o.toFlat(i)),...this.process?this.process.toFlat(i):[],...this.successCalls.flatMap(o=>o.toFlat(i)),...this.errorCalls.flatMap(o=>o.toFlat(i)),...this.error?this.error.toFlat(i):[],...this.body?this.body.toFlat(i):[],...this.continueStatements.flatMap(o=>o.toFlat(i)),...this.breakStatements.flatMap(o=>o.toFlat(i))])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.inputs.flatMap(o=>o.toFlatIds(i)),...this.outputs.flatMap(o=>o.toFlatIds(i)),...this.process?this.process.toFlatIds(i):[],...this.successCalls.flatMap(o=>o.toFlatIds(i)),...this.errorCalls.flatMap(o=>o.toFlatIds(i)),...this.error?this.error.toFlatIds(i):[],...this.body?this.body.toFlatIds(i):[],...this.continueStatements.flatMap(o=>o.toFlatIds(i)),...this.breakStatements.flatMap(o=>o.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,x:this.x,y:this.y,type:this.type}}toJSON(i=new Set){var a,o;return i.has(this.id)?this.toReference():(i.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,calledBySuccess:this.calledBySuccess.map(p=>p.toReference()),calledByError:this.calledByError.map(p=>p.toReference()),calledByEntry:this.calledByEntry.map(p=>p.toReference()),process:((a=this.process)==null?void 0:a.toJSON(i))||null,declaration:this.declaration.toJSON(i),inputs:this.inputs.map(p=>p.toJSON(i)),outputs:this.outputs.map(p=>p.toJSON(i)),outputsDeclarations:this.outputsDeclarations.map(p=>p.toJSON(i)),successCalls:this.successCalls.map(p=>p.toJSON(i)),errorCalls:this.errorCalls.map(p=>p.toJSON(i)),error:((o=this.error)==null?void 0:o.toJSON(i))||null,body:this.body.toJSON(i),parent:this.parent.toReference()})}toJSONClone(i=ke){var o,p,e,y,v,E,b;let a;return(o=i.seenEntityMaps)!=null&&o.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||Kr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(p=i.seenEntities)!=null&&p.has(a)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(a),(v=i.seenEntities)==null||v.add(this.id),{id:a,version:N.UUID.uuid(),createdAt:i.timestamp||L().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,calledBySuccess:this.calledBySuccess.map(A=>A.toReference({seenEntityMaps:i.seenEntityMaps})),calledByError:this.calledByError.map(A=>A.toReference({seenEntityMaps:i.seenEntityMaps})),calledByEntry:this.calledByEntry.map(A=>A.toReference({seenEntityMaps:i.seenEntityMaps})),process:((E=this.process)==null?void 0:E.toJSONClone({...i,newId:null}))||null,declaration:this.declaration.toJSON(),inputs:this.inputs.map(A=>A.toJSONClone({...i,newId:null})),outputs:this.outputs.map(A=>A.toJSONClone({...i,newId:null})),outputsDeclarations:this.outputsDeclarations.map(A=>A.toJSONClone({...i,newId:null})),successCalls:this.successCalls.map(A=>A.toJSONClone({...i,newId:null})),errorCalls:this.errorCalls.map(A=>A.toJSONClone({...i,newId:null})),error:((b=this.error)==null?void 0:b.toJSONClone({...i,newId:null}))||null,body:this.body.toJSONClone({...i,newId:null}),parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=ke){var o;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+N.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=ke){var o,p,e,y,v;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,declaration:((p=this.declaration)==null?void 0:p.toReference(i))||null,body:((e=this.body)==null?void 0:e.toReference(i))||null,inputs:this.inputs.map(E=>E.toReference(i)),outputs:this.outputs.map(E=>E.toReference(i)),outputsDeclarations:this.outputsDeclarations.map(E=>E.toReference(i)),successCalls:this.successCalls.map(E=>E.toReference(i)),errorCalls:this.errorCalls.map(E=>E.toReference(i)),process:((y=this.process)==null?void 0:y.toReference(i))||null,calledBySuccess:this.calledBySuccess.map(E=>E.toReference(i)),calledByError:this.calledByError.map(E=>E.toReference(i)),calledByEntry:this.calledByEntry.map(E=>E.toReference(i)),error:((v=this.error)==null?void 0:v.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var o;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((o=this.body)==null?void 0:o.toFlatJSON(i))||[],...this.successCalls.flatMap(p=>p.toFlatJSON(i)),...this.errorCalls.flatMap(p=>p.toFlatJSON(i)),...this.inputs.flatMap(p=>p.toFlatJSON(i)),...this.outputs.flatMap(p=>p.toFlatJSON(i)),...this.continueStatements.flatMap(p=>p.toFlatJSON(i)),...this.breakStatements.flatMap(p=>p.toFlatJSON(i)),...this.error?this.error.toFlatJSON(i):[],...this.process?this.process.toFlatJSON(i):[]])}toGenerationTarget(){const i=this.parent.type===f.Project?void 0:this.parent.id;return{id:this.id,type:this.type,calledByEntry:this.calledByEntry.map(a=>a.id),calledBySuccess:this.calledBySuccess.map(a=>a.id),calledByError:this.calledByError.map(a=>a.id),declaration:this.declaration.id,parent:i}}toFlatGenerationTarget(i=new Set){var o;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((o=this.body)==null?void 0:o.toFlatGenerationTarget(i))||[],...this.successCalls.flatMap(p=>p.toFlatGenerationTarget(i)),...this.errorCalls.flatMap(p=>p.toFlatGenerationTarget(i)),...this.inputs.flatMap(p=>p.toFlatGenerationTarget(i)),...this.outputs.flatMap(p=>p.toFlatGenerationTarget(i)),...this.continueStatements.flatMap(p=>p.toFlatGenerationTarget(i)),...this.breakStatements.flatMap(p=>p.toFlatGenerationTarget(i)),...this.error?this.error.toFlatGenerationTarget(i):[],...this.process?this.process.toFlatGenerationTarget(i):[]])}clearErrors(){var i,a;return this.errors=[],this.inputs.forEach(o=>o.clearErrors()),this.outputs.forEach(o=>o.clearErrors()),this.successCalls.forEach(o=>o.clearErrors()),this.errorCalls.forEach(o=>o.clearErrors()),this.continueStatements.forEach(o=>o.clearErrors()),this.breakStatements.forEach(o=>o.clearErrors()),(i=this.process)==null||i.clearErrors(),(a=this.error)==null||a.clearErrors(),this}validate(){const i=TA(this);return this.errors=i,{success:!0}}getErrors(){return[...this.errors,...this.inputs.flatMap(a=>a.getErrors()),...this.outputs.flatMap(a=>a.getErrors()),...this.body?this.body.getErrors():[],...this.error?this.error.getErrors():[],...this.process?this.process.getErrors():[]]}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"clone-entity")),a=null,o=null,p=!0){var B,F;let e=Sr(a,this);const y=this.toJSON(),v=o||N.UUID.uuid();y.inputs=[];const E=v.split("-id"),b=E[E.length-1||0]||v;y.id=v,y.version=N.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||L().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1;const A=dr(y,e);a?A.setParent(a,null):A.setParent(this.parent,null),p&&A.subscribe(),A.initChildren(i),i==null||i.add(A,S.Added);const $=(B=this.inputs)==null?void 0:B.map((K,Z)=>K.clone(i,A,b+"-input-map-"+Z+"-id",p));A.inputs=$;const V=(F=this.outputs)==null?void 0:F.map((K,Z)=>K.clone(i,A,b+"-output-map-"+Z+"-id",p));return A.outputs=V,this.body&&(A.body=this.body.clone(i,A,b+"-body-id",p,!0)),this.error&&(A.error=this.error.clone(i,A,b+"-error-map-id",p)),this.process&&(A.process=this.process.clone(i,A,b+"-process-id",p)),i==null||i.attemptAutoclose("clone-entity",this.id),A}getVariableInstances(){return this.body?vr(this.body).filter(o=>o.type===f.VariableInstance):[]}addReturnStatement(i){return Nt.includes(this.parent.type)&&this.parent.addReturnStatement(i),this}removeReturnStatement(i){return Nt.includes(this.parent.type)&&this.parent.removeReturnStatement(i),this}addBreakStatement(i){return this.breakStatements.includes(i)||this.breakStatements.push(i),this}removeBreakStatement(i){const a=this.breakStatements.indexOf(i);return a!==-1&&this.breakStatements.splice(a,1),this}addContinueStatement(i){return this.continueStatements.includes(i)||this.continueStatements.push(i),this}removeContinueStatement(i){const a=this.continueStatements.indexOf(i);return a!==-1&&this.continueStatements.splice(a,1),this}getUniqueReturnDeclarations(){const i=[];return[...this.breakStatements,...this.continueStatements].forEach(o=>{o.outputs.forEach(e=>{i.find(v=>v===e||ne(v,this.project)===ne(e,this.project)&&en(v.dataType,e.dataType))||i.push(e)})}),R(i)}syncTerminationStatements(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-termination-statements"))){const a=[],o=[],p=[],e=[],y=this.getUniqueReturnDeclarations();return[...this.breakStatements,...this.continueStatements].forEach(E=>{const b=E.outputs,A=y.filter($=>!b.find(V=>ne($,this.project)===ne(V,this.project)&&en($.dataType,V.dataType)));A.length&&(a.push(E),i==null||i.add(E,S.Updated)),A.forEach($=>{const V=$.clone(i,E);i==null||i.add(V,S.Added),V.addSelfToProject(i),o.push(V)})}),i==null||i.attemptAutoclose("sync-termination-statements",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncBodyInputIndexes(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-body-input-indexes"))){const a=[],o=[],p=[],e=[];return this.body.inputs.sort((v,E)=>v.index-E.index),this.body.inputs.forEach((v,E)=>{v.index!==E&&(v.metaSync({index:E},i),a.push(v))}),i==null||i.attemptAutoclose("sync-body-input-indexes",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncBodyArgumentsDeclarations(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-body-arguments-declarations"))){const a=[],o=[],p=[],e=[],{updated:y,added:v,removed:E}=this.syncFixedBodyArgumentDeclarations(i);a.push(...y),o.push(...v),p.push(...E);const b=this.getUniqueReturnDeclarations(),A=this.body.inputs;b.sort((F,K)=>F.index-K.index),b.forEach(F=>{const K=F.getDataType(i);let ie=A.find(J=>ne(J,this.project)===ht.fromReturnDeclarationToBodyArgumentDeclarationName(F)&&en(J.dataType,F.dataType));if(!ie){const J=ht.fromReturnDeclarationToBodyArgumentDeclarationName(F),ce={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.ArgumentDeclaration,name:J,codeName:null,description:`Aggretated list of all previously outputted values from each iteration by the output '${ne(F,this.project)}'`,defaultValue:null,constant:!0,dataType:null,implements:null,index:F.index,required:F.required,parent:this.body.toReference(),writesValues:[]},z=te(ce,this.project);z.setParent(this.body,i),z.initChildren(i),i==null||i.add(z,S.Added),z.addSelfToProject(i),o.push(z),ie=z}const X=this.body.inputs.find(J=>J.index===ie.index&&J!==ie),ue=this.body.inputs.filter(J=>J!==ie);let re=ie.index;X&&(re=Math.max(...ue.map(J=>J.index))+1),ie.index!==re&&(ie.metaSync({index:re},i),a.push(ie));const fe=ie.getDataType(i);let Y=fe;if(K)if(!fe||!en(fe,K)){if(!Y){const J=K.clone(i,ie);i==null||i.add(J,S.Added),J.addSelfToProject(i),Y=J,o.push(J),a.push(ie)}Y.merge(K,i),Y.metaSync({isList:!0},i)}else Y.isList||(Y.metaSync({isList:!0},i),a.push(Y));if(!K&&!Y){const J={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,index:null,parentRelationType:null,staticEntities:null,interactiveEntities:null,actionEntities:null,isList:!0,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:ie.toReference()},ce=te(J,this.project);ce.metaSync({isList:!0},i),ce.setParent(ie,i),ce.initChildren(i),i==null||i.add(ce,S.Added),ce.addSelfToProject(i),o.push(ce)}});const{updated:$,added:V,removed:B}=this.removeExtraBodyArgumentDeclarations(i);return a.push(...$),o.push(...V),p.push(...B),i==null||i.attemptAutoclose("sync-body-arguments-declarations",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncOutputsDeclarations(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-outputs-declarations"))){const a=[],o=[],p=[],e=[],y=this.getUniqueReturnDeclarations(),v=this.outputsDeclarations;return y.forEach((b,A)=>{b.index!==A&&(b.metaSync({index:A},i),a.push(b))}),y.forEach(b=>{const A=b.getDataType(i);let V=v.find(K=>ne(K,this.project)===ht.fromReturnDeclarationToLoopOutputDeclarationName(b)&&en(K.dataType,b.dataType));if(!V){const K=ht.fromReturnDeclarationToLoopOutputDeclarationName(b),Z={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.ValueDescriptor,name:K,codeName:null,description:`Aggretated list of all previously outputted values from each iteration by the output '${ne(b,this.project)}'`,defaultValue:null,dataType:null,index:b.index,required:b.required,parentRelationType:oe.FixedReturns,parent:this.toReference()},ie=te(Z,this.project);ie.setParent(this,i),ie.initChildren(i),i==null||i.add(ie,S.Added),ie.addSelfToProject(i),o.push(ie),V=ie}V.index!==b.index&&(V.metaSync({index:b.index},i),a.push(V));let F=V.getDataType(i);if(A)if(!F||!en(F,A)){if(!F){const K=A.clone(i,V);i==null||i.add(K,S.Added),K.addSelfToProject(i),F=K,o.push(K),a.push(V)}F.merge(A,i),F.metaSync({isList:!0},i)}else F.isList||(F.metaSync({isList:!0},i),a.push(F));if(!A&&!F){const K={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,parentRelationType:null,isList:!0,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:V.toReference()},Z=te(K,this.project);Z.metaSync({isList:!0},i),Z.setParent(V,i),Z.initChildren(i),i==null||i.add(Z,S.Added),Z.addSelfToProject(i),o.push(Z)}}),v.filter(b=>!y.find($=>ne(b,this.project)===ht.fromReturnDeclarationToLoopOutputDeclarationName($))).forEach(b=>{if(!(i!=null&&i.hasRemoved(b.id))&&!b.deleted){const{updated:A,removed:$}=b.remove({ignoreUpstream:!1},i);a.push(...A),p.push(...$)}}),i==null||i.attemptAutoclose("sync-outputs-declarations",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncOutputMaps(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-extended-properties"))){const a=[],o=[],p=[],e=[],y=this.outputsDeclarations,v=this.outputs;return y.forEach(b=>{var V;let $=v.find(B=>{var F,K;return((F=B.declaration)==null?void 0:F.id)===b.id&&en((K=B.declaration)==null?void 0:K.dataType,b.dataType)});if($)((V=$.declaration)==null?void 0:V.id)!==b.id&&($.setDeclaration(b,i),a.push($));else{const B={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.OutputMap,defaultValue:null,index:b.index,declaration:b.toJSON(),writesValues:[],parent:this.toReference()},F=te(B,this.project);F.setParent(this,i),F.initChildren(i),i==null||i.add(F,S.Added),F.addSelfToProject(i),o.push(F),$=F}$.index!==b.index&&($.metaSync({index:b.index},i),a.push($))}),v.filter(b=>!y.find($=>{var V;return((V=b.declaration)==null?void 0:V.id)===$.id})).forEach(b=>{const{updated:A,removed:$}=b.remove({ignoreUpstream:!1},i);a.push(...A),p.push(...$)}),i==null||i.attemptAutoclose("add-extended-properties",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}createCurrentIterationNumberArgumentDeclaration(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"create-current-iteration-number-argument-declaration"))){const a=[],o=[],p=[],e=[];let v=this.body.inputs.find($=>{var V;return $.name===ht.CURRENT_ITERATION_NUMBER_ARG_NAME||$.id===((V=this.currentIterationNumberArgumentDeclaration)==null?void 0:V.id)});const E=this.getCurrentIterationNumberBuiltInValueDescriptor();if(!v){const $={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.ArgumentDeclaration,name:ht.CURRENT_ITERATION_NUMBER_ARG_NAME,codeName:null,description:"The number of the current iteration",defaultValue:null,constant:!0,dataType:null,implements:E==null?void 0:E.toJSON(),index:this.body.inputs.length,required:!0,parent:this.body.toReference(),writesValues:[]},V=te($,this.project);V.setParent(this.body,i),V.initChildren(i),i==null||i.add(V,S.Added),V.addSelfToProject(i),o.push(V),v=V}!v.index&&v.index!==0&&(v.metaSync({index:0},i),a.push(v)),(!v.implements||v.implements.id!==E.id)&&(v.setImplements(E,i),a.push(v));let A=v.getDataType(i);if(!A){const $={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,actionEntities:null,parentRelationType:null,isList:!1,index:null,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:v.toReference()},V=te($,this.project);V.setParent(v,i),V.initChildren(i),i==null||i.add(V,S.Added),V.addSelfToProject(i),o.push(V),A=V}if(!A.entity||A.entity.type!==f.PrimitiveEntity||A.entity.name!==Q.Number||A.entity.id!==Ee["primitive-entity"].number.id){const $=this.project.getBuiltIn(Ee["primitive-entity"].number.id);A.setEntity($,i),a.push(A)}return i==null||i.attemptAutoclose("create-current-iteration-number-argument-declaration",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}removeExtraBodyArgumentDeclarations(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-extra-body-argument-declarations"))){const a=[],o=[],p=[],e=[],y=this.body.inputs,v=this.getUniqueReturnDeclarations();return y.filter(b=>b===this.currentIterationNumberArgumentDeclaration||b===this.currentValueArgumentDeclaration?!1:!v.find($=>ne(b,this.project)===ht.fromReturnDeclarationToBodyArgumentDeclarationName($))).forEach(b=>{const{updated:A,removed:$}=b.remove({ignoreUpstream:!1},i);a.push(...A),p.push(...$)}),i==null||i.attemptAutoclose("remove-extra-body-argument-declarations",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}createCurrentValueInputBasedOnInputMap(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"create-current-value-input-based-on-input-map"))){var b,A,$,V,B,F,K,Z,ie;const a=[],o=[],p=[],e=[];switch(this.declaration.id){case ze.List:{const X=this.body.inputs.find(fe=>{var Y;return((Y=fe.implements)==null?void 0:Y.id)===Ee[f.Loop][ze.List].body.inputs.currentValue.id}),ue=this.inputs.find(fe=>{var Y;return((Y=fe.declaration)==null?void 0:Y.id)===Ee[f.Loop][ze.List].inputs.list.id});if(!ue)break;const re=this.getCurrentValueBuiltInValueDescriptor();if(X){re&&(!X.implements||X.implements.id!==re.id)&&(X.setImplements(re,i),a.push(X));let Y=X.getDataType(i);if(!Y){const ce={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,parentRelationType:null,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:(b=this.currentValueArgumentDeclaration)==null?void 0:b.toReference()},z=te(ce,this.project);z.setParent(this.currentValueArgumentDeclaration,i),z.initChildren(i),i==null||i.add(z,S.Added),z.addSelfToProject(i),o.push(z),Y=z}const J=ue.getDataType(i);Y.merge(J,i),Y.metaSync({isList:!1},i)}else{const fe={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.ArgumentDeclaration,name:ht.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,defaultValue:null,index:this.body.inputs.length,constant:!0,required:!0,implements:re,writesValues:[],dataType:null,parent:this.body.toReference()},Y=te(fe,this.project);Y.setParent(this.body,i),Y.initChildren(i),i==null||i.add(Y,S.Added),Y.addSelfToProject(i),re&&(!Y.implements||Y.implements.id!==re.id)&&(Y.setImplements(re,i),a.push(Y)),o.push(Y)}break}case ze.ManualFlow:break;case ze.Counted:break;case ze.ObjectKeys:{const X=this.body.inputs.find(fe=>{var Y;return((Y=fe.implements)==null?void 0:Y.id)===Ee[f.Loop][ze.ObjectKeys].body.inputs.currentValue.id});if(!this.inputs.find(fe=>{var Y;return((Y=fe.declaration)==null?void 0:Y.id)===Ee[f.Loop][ze.ObjectKeys].inputs.object.id}))break;const re=this.getCurrentValueBuiltInValueDescriptor();if(X){re&&(!X.implements||X.implements.id!==re.id)&&(X.setImplements(re),a.push(X));let Y=X.getDataType(i);if(Y){const J=this.project.getBuiltIn(Ee["primitive-entity"].string.id);(($=Y.entity)==null?void 0:$.id)!==J.id&&(Y.setEntity(J,i),a.push(Y))}else{const J={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,parentRelationType:null,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:(A=this.currentValueArgumentDeclaration)==null?void 0:A.toReference()},ce=te(J,this.project);ce.setParent(this.currentValueArgumentDeclaration,i),ce.initChildren(i),i==null||i.add(ce,S.Added),ce.addSelfToProject(i),Y=ce}}else{const fe={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.ArgumentDeclaration,name:ht.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,defaultValue:null,index:this.body.inputs.length,constant:!0,required:!0,implements:re,writesValues:[],dataType:null,parent:this.body.toReference()},Y=te(fe,this.project);Y.setParent(this.body,i),Y.initChildren(i),i==null||i.add(Y,S.Added),Y.addSelfToProject(i),re&&(!Y.implements||Y.implements.id!==re.id)&&(Y.setImplements(re,i),a.push(Y)),o.push(Y)}break}case ze.ObjectValues:{const X=this.body.inputs.find(fe=>{var Y;return((Y=fe.implements)==null?void 0:Y.id)===Ee[f.Loop][ze.ObjectValues].body.inputs.currentValue.id}),ue=this.inputs.find(fe=>{var Y;return((Y=fe.declaration)==null?void 0:Y.id)===Ee[f.Loop][ze.ObjectValues].inputs.object.id});if(!ue)break;const re=this.getCurrentValueBuiltInValueDescriptor();if(X){re&&(!X.implements||X.implements.id!==re.id)&&(X.setImplements(re,i),a.push(X));let Y=X.getDataType(i);if(Y){const J=ue.getDataType(i),ce=((F=J==null?void 0:J.entity)==null?void 0:F.properties)||[];(K=Y.orChildrenGroup)==null||K.forEach(z=>{const{updated:de,removed:Ae}=z.remove({ignoreUpstream:!1},i);a.push(...de),p.push(...Ae)}),ce.forEach(z=>{if(!z.getDataType(i)){const Ae={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,actionEntities:null,index:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parentRelationType:Ii.OrDataTypeGroup,parent:Y.toReference()},je=te(Ae,this.project);je.setParent(Y,i),je.initChildren(i),i==null||i.add(je,S.Added),je.addSelfToProject(i),o.push(je)}})}else{const J={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,parentRelationType:null,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:(V=this.currentValueArgumentDeclaration)==null?void 0:V.toReference()},ce=te(J,this.project);ce.setParent(this.currentValueArgumentDeclaration,i),ce.initChildren(i),i==null||i.add(ce,S.Added),ce.addSelfToProject(i),Y=ce;const z=ue.getDataType(i);(((B=z==null?void 0:z.entity)==null?void 0:B.properties)||[]).forEach(Ae=>{if(!Ae.getDataType(i)){const Ne={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,actionEntities:null,index:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parentRelationType:Ii.OrDataTypeGroup,parent:ce.toReference()},$e=te(Ne,this.project);$e.setParent(ce,i),$e.initChildren(i),i==null||i.add($e,S.Added),$e.addSelfToProject(i),o.push($e)}})}}else{const fe={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.ArgumentDeclaration,name:ht.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,constant:!0,defaultValue:null,index:this.body.inputs.length,required:!0,implements:re,writesValues:[],dataType:null,parent:this.body.toReference()},Y=te(fe,this.project);Y.setParent(this.body,i),Y.initChildren(i),i==null||i.add(Y,S.Added),Y.addSelfToProject(i),re&&(!Y.implements||Y.implements.id!==re.id)&&(Y.setImplements(re,i),a.push(Y)),o.push(Y)}break}case ze.String:{const X=this.body.inputs.find(fe=>{var Y;return((Y=fe.implements)==null?void 0:Y.id)===Ee[f.Loop][ze.String].body.inputs.currentValue.id});if(!this.inputs.find(fe=>{var Y;return((Y=fe.declaration)==null?void 0:Y.id)===Ee[f.Loop][ze.String].inputs.string.id}))break;const re=this.getCurrentValueBuiltInValueDescriptor();if(X){re&&(!X.implements||X.implements.id!==re.id)&&(X.setImplements(re,i),a.push(X));let Y=X.getDataType(i);if(Y){const J=this.project.getBuiltIn(Ee["primitive-entity"].string.id);((ie=Y.entity)==null?void 0:ie.id)!==J.id&&(Y.setEntity(J,i),a.push(Y))}else{const J={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,parentRelationType:null,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:(Z=this.currentValueArgumentDeclaration)==null?void 0:Z.toReference()},ce=te(J,this.project);ce.setParent(this.currentValueArgumentDeclaration,i),ce.initChildren(i),i==null||i.add(ce,S.Added),ce.addSelfToProject(i),o.push(ce),Y=ce}}else{const fe={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.ArgumentDeclaration,name:ht.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,index:this.body.inputs.length,required:!0,constant:!0,defaultValue:null,implements:re,writesValues:[],dataType:null,parent:this.body.toReference()},Y=te(fe,this.project);Y.setParent(this.body,i),Y.initChildren(i),i==null||i.add(Y,S.Added),Y.addSelfToProject(i),re&&(!Y.implements||Y.implements.id!==re.id)&&(Y.setImplements(re,i),a.push(Y)),o.push(Y)}break}}const{updated:y,added:v,removed:E}=this.removeExtraBodyArgumentDeclarations(i);return a.push(...y),o.push(...v),p.push(...E),i==null||i.attemptAutoclose("create-current-value-input-based-on-input-map",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncFixedBodyArgumentDeclarations(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-fixed-body-argument-declarations"))){const a=[],o=[],p=[],e=[],{updated:y,added:v,removed:E}=this.createCurrentIterationNumberArgumentDeclaration(i);a.push(...y),o.push(...v),p.push(...E);const{updated:b,added:A,removed:$}=this.createCurrentValueInputBasedOnInputMap(i);return a.push(...b),o.push(...A),p.push(...$),i==null||i.attemptAutoclose("sync-fixed-body-argument-declarations",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncInputMaps(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-input-maps"))){const a=[],o=[],p=[],e=[];switch(this.declaration.id){case ze.List:{let y=null;if(this.inputs.forEach(v=>{var E;((E=v.declaration)==null?void 0:E.id)===Ee[f.Loop]["list-loop"].inputs.list.id?y=v:(v.remove({ignoreUpstream:!1},i),p.push(v))}),y){if(y.declaration.id!==Ee[f.Loop]["list-loop"].inputs.list.id){const v=this.project.get(Ee[f.Loop]["list-loop"].inputs.list.id);y.setDeclaration(v,i),a.push(y)}}else{const v=this.project.get(Ee[f.Loop]["list-loop"].inputs.list.id),E={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.InputMap,name:null,codeName:null,description:null,index:0,declaration:v.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=te(E,this.project);b.setParent(this,i),b.initChildren(i),i==null||i.add(b,S.Added),b.addSelfToProject(i),o.push(b)}break}case ze.ManualFlow:{this.inputs.forEach(y=>{y.remove({ignoreUpstream:!1},i),p.push(y)});break}case ze.Counted:{let y=null;if(this.inputs.forEach(v=>{var E;((E=v.declaration)==null?void 0:E.id)===Ee[f.Loop]["counted-loop"].inputs.number.id?y=v:(v.remove({ignoreUpstream:!1},i),p.push(v))}),y){if(y.declaration.id!==Ee[f.Loop]["counted-loop"].inputs.number.id){const v=this.project.get(Ee[f.Loop]["counted-loop"].inputs.number.id);y.setDeclaration(v,i),a.push(y)}}else{const v=this.project.get(Ee[f.Loop]["counted-loop"].inputs.number.id),E={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.InputMap,name:null,codeName:null,description:null,index:0,declaration:v.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=te(E,this.project);b.setParent(this,i),b.initChildren(i),i==null||i.add(b,S.Added),b.addSelfToProject(i),o.push(b)}break}case ze.ObjectKeys:{let y=null;if(this.inputs.forEach(v=>{var E;((E=v.declaration)==null?void 0:E.id)===Ee[f.Loop]["object-keys-loop"].inputs.object.id?y=v:(v.remove({ignoreUpstream:!1},i),p.push(v))}),y){if(y.declaration.id!==Ee[f.Loop]["object-keys-loop"].inputs.object.id){const v=this.project.get(Ee[f.Loop]["object-keys-loop"].inputs.object.id);y.setDeclaration(v,i),a.push(y)}}else{const v=this.project.get(Ee[f.Loop]["object-keys-loop"].inputs.object.id),E={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.InputMap,name:null,codeName:null,description:null,index:0,declaration:v.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=te(E,this.project);b.setParent(this,i),b.initChildren(i),i==null||i.add(b,S.Added),b.addSelfToProject(i),o.push(b)}break}case ze.ObjectValues:{let y=null;if(this.inputs.forEach(v=>{var E;((E=v.declaration)==null?void 0:E.id)===Ee[f.Loop]["object-values-loop"].inputs.object.id?y=v:(v.remove({ignoreUpstream:!1},i),p.push(v))}),y){if(y.declaration.id!==Ee[f.Loop]["object-values-loop"].inputs.object.id){const v=this.project.get(Ee[f.Loop]["object-values-loop"].inputs.object.id);y.setDeclaration(v,i),a.push(y)}}else{const v=this.project.get(Ee[f.Loop]["object-values-loop"].inputs.object.id),E={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.InputMap,name:null,codeName:null,description:null,index:0,declaration:v.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=te(E,this.project);b.setParent(this,i),b.initChildren(i),i==null||i.add(b,S.Added),b.addSelfToProject(i),o.push(b)}break}case ze.String:{let y=null;if(this.inputs.forEach(v=>{var E;((E=v.declaration)==null?void 0:E.id)===Ee[f.Loop]["string-loop"].inputs.string.id?y=v:(v.remove({ignoreUpstream:!1},i),p.push(v))}),y){if(y.declaration.id!==Ee[f.Loop]["string-loop"].inputs.string.id){const v=this.project.get(Ee[f.Loop]["string-loop"].inputs.string.id);y.setDeclaration(v,i),a.push(y)}}else{const v=this.project.get(Ee[f.Loop]["string-loop"].inputs.string.id),E={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.InputMap,name:null,codeName:null,description:null,index:0,declaration:v.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=te(E,this.project);b.setParent(this,i),b.initChildren(i),i==null||i.add(b,S.Added),b.addSelfToProject(i),o.push(b)}break}}return i==null||i.attemptAutoclose("sync-input-maps",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}getCurrentValueBuiltInValueDescriptor(){var a;if(this.declaration.id===ze.ManualFlow||this.declaration.id===ze.Counted)return null;const i=(a=Ee[f.Loop][this.declaration.id].body.inputs.currentValue)==null?void 0:a.id;return i?this.project.get(i):null}getCurrentIterationNumberBuiltInValueDescriptor(){const i=Ee[f.Loop][this.declaration.id].body.inputs.iterationNumber.id;return this.project.get(i)}syncBody(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-body"))){var E;const a=[],o=[],p=[],e=[],y=Ee[f.Loop][this.declaration.id].body.id,v=this.project.getBuiltIn(y);if(this.body)((E=this.body.implements)==null?void 0:E.id)!==v.id&&(this.body.setImplements(v,i),this.body.setParent(this,i),a.push(this.body));else{const b={extends:null,id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.FunctionDeclaration,name:v.name,codeName:null,description:null,inputs:[],index:null,calls:[],collapsed:!1,private:!1,implements:v.toJSON(),x:0,y:0,parent:this.toReference()},A=te(b,this.project);A.setParent(this,i),A.initChildren(i),i==null||i.add(A,S.Added),A.addSelfToProject(i),o.push(A)}return i==null||i.attemptAutoclose("sync-body",this.id),{self:this,updated:R(a),added:R(o),removed:R(p),affected:R(e)}}syncChildren(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-children"))){const a=[],o=[],p=[],e=[],{updated:y,added:v,removed:E}=this.syncBody(i);a.push(...y),o.push(...v),p.push(...E);const{updated:b,added:A,removed:$}=this.syncInputMaps(i);a.push(...b),o.push(...A),p.push(...$);const{updated:V,added:B,removed:F}=this.syncTerminationStatements(i);a.push(...V),o.push(...B),p.push(...F);const{updated:K,added:Z,removed:ie}=this.syncBodyArgumentsDeclarations(i);a.push(...K),o.push(...Z),p.push(...ie);const{updated:X,added:ue,removed:re}=this.syncBodyInputIndexes(i);a.push(...X),o.push(...ue),p.push(...re);const{updated:fe,added:Y,removed:J}=this.syncOutputsDeclarations(i);a.push(...fe),o.push(...Y),p.push(...J);const{updated:ce,added:z,removed:de}=this.syncOutputMaps(i);return a.push(...ce),o.push(...z),p.push(...de),i==null||i.attemptAutoclose("sync-children",this.id),{self:this,updated:R(a),added:R(o),removed:R(p),affected:R(e)}}getUnusedInputs(){return this.inputs.filter(i=>i.suggestion||!i.readsValue&&!i.defaultValue)}getUnusedOutputs(){return this.outputs.filter(i=>i.suggestion||!i.writesValues.length)}getUsedInputs(){return this.inputs.filter(i=>!i.suggestion&&(i.readsValue||i.defaultValue))}getUsedOutputs(){return this.outputs.filter(i=>!i.suggestion&&i.writesValues.length)}};g(ht,"repository",{APICreate:async(i,...a)=>i,APIUpdate:async(i,...a)=>i,APIDelete:async(i,...a)=>i,APIClone:async(i,...a)=>{},APILoad:async(i,...a)=>null,APILoadVersion:async(i,a,...o)=>null}),g(ht,"type",f.Loop),g(ht,"USER_MANAGED_PARENT_TYPES",[...Br,f.Project]),g(ht,"PARENT_TYPES",[...pt.USER_MANAGED_PARENT_TYPES]),g(ht,"CURRENT_ITERATION_NUMBER_ARG_NAME","Current iteration number"),g(ht,"CURRENT_VALUE_ARG_NAME","Current value"),g(ht,"MUTABLE_BASE_PROPERTIES",[]),g(ht,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),g(ht,"BASE_PROPERTIES",[...ht.MUTABLE_BASE_PROPERTIES,...ht.INMUTABLE_BASE_PROPERTIES]),g(ht,"MUTABLE_META_PROPERTIES",[...ht.MUTABLE_BASE_PROPERTIES,"x","y"]),g(ht,"INMUTABLE_META_PROPERTIES",[...ht.INMUTABLE_BASE_PROPERTIES]),g(ht,"META_PROPERTIES",[...ht.MUTABLE_META_PROPERTIES,...ht.INMUTABLE_META_PROPERTIES]),g(ht,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),g(ht,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),g(ht,"UPSTREAM_PROPERTIES",[...ht.MUTABLE_UPSTREAM_PROPERTIES,...ht.INMUTABLE_UPSTREAM_PROPERTIES]),g(ht,"MUTABLE_DOWNSTREAM_PROPERTIES",["body","inputs","outputs","outputsDeclarations","successCalls","errorCalls","error","breakStatements","continueStatements"]),g(ht,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),g(ht,"DOWNSTREAM_PROPERTIES",[...ht.MUTABLE_DOWNSTREAM_PROPERTIES,...ht.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(ht,"PROPERTIES",[...ht.META_PROPERTIES,...ht.UPSTREAM_PROPERTIES,...ht.DOWNSTREAM_PROPERTIES]);let ki=ht;function pj(d){const u=Nye(),i=d.toJSON();u.safeParse(i).success,d.inputs.forEach(e=>e.validate());const p=[...Ka(d)];return Er(d.errors,p)}const X0e=Object.freeze(Object.defineProperty({__proto__:null,validate:pj},Symbol.toStringTag,{value:"Module"}));var fj=(d=>(d.Parent="parent",d))(fj||{});const Xt=class Xt extends Nr{constructor(i,a){super(i);g(this,"initialData");g(this,"id");g(this,"x");g(this,"y");g(this,"type",f.Condition);g(this,"index",null);g(this,"successCalls",[]);g(this,"errorCalls",[]);g(this,"declaration");g(this,"inputs",[]);g(this,"calledBySuccess",[]);g(this,"calledByError",[]);g(this,"calledByEntry",[]);g(this,"andChildrenGroup",null);g(this,"orChildrenGroup",null);g(this,"project");g(this,"errors",[]);g(this,"parent");g(this,"detachedDependents",{});g(this,"knownVersions",null);g(this,"activeVersion",!1);g(this,"initialized",!1);g(this,"startedInitialization",!1);this.initialData=i,this.project=a,this.id=i.id,this.x=i.x,this.y=i.y,this.index=i.index||null}static new(i=null){return{id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.Condition,declaration:null,index:null,inputs:[],parent:null,andChildrenGroup:null,orChildrenGroup:null,calledByEntry:[],calledBySuccess:[],calledByError:[],errorCalls:[],successCalls:[],x:0,y:0}}static fromGenerationTarget(i,a){var $,V;let o=a;if(i.parent){const B=H(i.parent);o=a.get(B)}const p=i.calledByEntry.map(B=>{const F=H(B);return a.get(F)}),e=i.calledBySuccess.map(B=>{const F=H(B);return a.get(F)}),y=i.calledByError.map(B=>{const F=H(B);return a.get(F)});let v;if(i.declaration){const B=H(i.declaration);v=a.get(B)}let E=null;o&&o.type===f.Condition&&((($=o.declaration)==null?void 0:$.id)===Mr.Or?E=(o.orChildrenGroup||[]).length:((V=o.declaration)==null?void 0:V.id)===Mr.And&&(E=(o.andChildrenGroup||[]).length));const b={id:i.id,version:N.UUID.uuid(),createdAt:L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.Condition,index:E,declaration:v,andChildrenGroup:i.andChildrenGroup?i.andChildrenGroup.map(B=>{const F=H(B);return a.get(F)}).filter(B=>!!B):null,orChildrenGroup:i.orChildrenGroup?i.orChildrenGroup.map(B=>{const F=H(B);return a.get(F)}).filter(B=>!!B):null,calledByEntry:p,calledBySuccess:e,calledByError:y,errorCalls:[],successCalls:[],inputs:[],x:0,y:0,parent:o},A=te(b,a);return A.setParent(o,null),A}static validateGenerationTarget(i,a){let o=JSON.parse(JSON.stringify(i));const p=[],e=li(o,{parent:{list:!1,types:[...Br,f.Project],optional:!0}},a);return o=e.modifiedData,p.push(...e.errors,...Ur(o)),i.declaration?a.get(i.declaration)?a.conditionDeclarations.find(E=>E.id===i.declaration)||p.push(new ee({id:`${i.id}--${k.InvalidImplementsReference}`,code:k.InvalidImplementsReference,severity:q.Error,message:`Entity of type '${i.type}' with id '${i.id}' has an 'declaration' property that isn't pointing to an action descriptor reserved for '${f.Condition}' entities.
|
|
75
|
+
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.`})),{errors:a,modifiedData:i}}subscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-dependents"))){const a=[],o=[],p=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),o.push(...v.added),p.push(...v.removed),e.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}onDetachedDependencyRemoved(i,a,o){const p=[],e=[],y=[],v=[];if(a==="parent"){const{updated:E,added:b,removed:A}=this.remove({ignoreUpstream:!1},o);p.push(...E),e.push(...b),y.push(...A)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,o){const p=[],e=[],y=[],v=[];if(a==="parent"){const{updated:E,added:b,removed:A}=this.restore({},o);p.push(...E),e.push(...b),y.push(...A)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){var i;return(i=this.parent)==null||i.unsubscribeDependents([{entity:this,field:"parent"}]),this}subscribeToDependencies(){var i;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"parent"}]),this}increaseVersion(i){if(i&&!L(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&L(i).isSame(L(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=L(i).toISOString()||L().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new ht(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.inputs=[...this.inputs],i.outputs=[...this.outputs],i.error=this.error,i.successCalls=[...this.successCalls],i.errorCalls=[...this.errorCalls],i.declaration=this.declaration,i.outputsDeclarations=[...this.outputsDeclarations],i.body=this.body,i.calledByEntry=[...this.calledByEntry],i.calledBySuccess=[...this.calledBySuccess],i.calledByError=[...this.calledByError],i.process=this.process,i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const a=[],o=[],p=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),o.push(...y.added),p.push(...y.removed)}return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}async restoreVersion(i){var v;const a=[],o=[],p=[],e=[];if(this.version===i)return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[$,V]of A.knownVersions)E.set($,V);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new ht(E,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.inputs=y.inputs,this.outputs=y.outputs,this.error=y.error,this.successCalls=y.successCalls,this.errorCalls=y.errorCalls,this.declaration=y.declaration,this.outputsDeclarations=y.outputsDeclarations,this.body=y.body,this.calledByEntry=y.calledByEntry,this.calledBySuccess=y.calledBySuccess,this.calledByError=y.calledByError,this.process=y.process,this.parent=y.parent,{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"update-with-shallow-transfer"))){if(this.metaSync(i,a),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent){const o=H(i.parent),p=this.project.get(o),e=this.parent;if(e&&e.id!==(p==null?void 0:p.id)&&this.removeFromParent(a),p)this.setParent(p,a);else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${o}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.declaration){const o=H(i.declaration),p=this.project.get(o);p&&this.setDeclaration(p)}return i.calledByEntry.forEach(o=>{const p=H(o),e=this.project.get(p);e&&(this.addEntryCaller(e,a),e.addCall(this,a))}),[...this.calledByEntry].forEach(o=>{i.calledByEntry.find(e=>H(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),i.calledBySuccess.forEach(o=>{const p=H(o),e=this.project.get(p);e&&(this.addSuccessCaller(e,a),e.addSuccessCall(this,a))}),[...this.calledBySuccess].forEach(o=>{i.calledBySuccess.find(e=>H(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),i.calledByError.forEach(o=>{const p=H(o),e=this.project.get(p);e&&(this.addErrorCaller(e,a),e.addErrorCall(this,a))}),[...this.calledBySuccess].forEach(o=>{i.calledBySuccess.find(e=>H(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const i=[],a=[],o=[],p=[];if(this.initialData.parent){const e=H(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' 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 e=H(this.initialData.declaration),y=this.project.get(e);y&&(this.setDeclaration(y),i.push(y))}return this.initialData.calledByEntry.forEach(e=>{const y=H(e),v=this.project.get(y);v&&this.addEntryCaller(v,null)}),this.initialData.calledBySuccess.forEach(e=>{const y=H(e),v=this.project.get(y);v&&this.addSuccessCaller(v,null)}),this.initialData.calledByError.forEach(e=>{const y=H(e),v=this.project.get(y);v&&this.addErrorCaller(v,null)}),{updated:R(i),added:R(a),removed:R(o),affected:R(p),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],o=[],p=[],e=[];this.initialized=!0;const{updated:y,added:v,removed:E}=this.syncChildren(i);return a.push(...y),o.push(...v),p.push(...E),this.captureVersion(),i==null||i.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-self-to-project"))){const a=[this],o=[],p=[],e=[];return this.parent===this.project&&this.project.addLoop(this),this.successCalls.forEach(y=>{y.addSuccessCaller(this,i),a.push(y)}),this.errorCalls.forEach(y=>{y.addErrorCaller(this,i),a.push(y)}),this.calledByEntry.forEach(y=>{y.addCall(this,i),a.push(y)}),this.calledBySuccess.forEach(y=>{y.addSuccessCall(this,i),a.push(y)}),this.calledByError.forEach(y=>{y.addErrorCall(this,i),a.push(y)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-input"))){const o=this.inputs.findIndex(p=>p.id===i.id);return o>-1&&(this.inputs.splice(o,1),a&&(a==null||a.add(this,S.Affected))),a==null||a.attemptAutoclose("remove-input",this.id),this}addInput(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-input"))){return this.inputs.includes(i)?(a==null||a.attemptAutoclose("add-input",this.id),this):(this.inputs.push(i),a==null||a.add(this,S.Affected),a==null||a.attemptAutoclose("add-input",this.id),this)}addOutputDeclaration(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-output-declaration"))){return this.outputsDeclarations.includes(i)?(a==null||a.attemptAutoclose("add-output-declaration",this.id),this):(this.outputsDeclarations.push(i),a==null||a.add(this,S.Affected),a==null||a.attemptAutoclose("add-output-declaration",this.id),this)}removeOutputDeclaration(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-output-declaration"))){const o=this.outputsDeclarations.findIndex(p=>p.id===i.id);return o>-1&&(this.outputsDeclarations.splice(o,1),a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("remove-output-declaration",this.id),this}addOutput(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-output"))){return this.outputs.includes(i)?(a==null||a.attemptAutoclose("add-output",this.id),this):(this.outputs.push(i),a==null||a.add(this,S.Affected),a==null||a.attemptAutoclose("add-output",this.id),this)}removeOutput(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-output"))){const o=this.outputs.findIndex(p=>p.id===i.id);return o>-1&&(this.outputs.splice(o,1),a&&(a==null||a.add(this,S.Affected))),a==null||a.attemptAutoclose("remove-output",this.id),this}setBody(i){return this.body=i,this}detachBody(){return this.body=null,this}addSuccessCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-success-caller")),o=!1){return this.calledBySuccess.find(p=>p.id===i.id)||(this.calledBySuccess.push(i),a==null||a.add(this,S.Updated),o&&We(this,a)),a==null||a.attemptAutoclose("add-success-caller",this.id),this}addErrorCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-error-caller")),o=!1){return this.calledByError.find(p=>p.id===i.id)||(this.calledByError.push(i),a==null||a.add(this,S.Updated),o&&We(this,a)),a==null||a.attemptAutoclose("add-error-caller",this.id),this}addEntryCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-entry-caller")),o=!1){return this.calledByEntry.find(p=>p.id===i.id)||(this.calledByEntry.push(i),a==null||a.add(this,S.Updated),o&&We(this,a)),a==null||a.attemptAutoclose("add-entry-caller",this.id),this}addErrorCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-error-call")),o=!1){return this.errorCalls.find(p=>p.id===i.id)||(this.errorCalls.push(i),o&&We(this,a),a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("add-error-call",this.id),this}addSuccessCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-success-call")),o=!1){return this.successCalls.find(p=>p.id===i.id)||(this.successCalls.push(i),o&&We(this,a),a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("add-success-call",this.id),this}removeCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-call")),o=!1){const p=this.successCalls.findIndex(y=>y.id===i.id);p>-1&&(this.successCalls.splice(p,1),a==null||a.add(this,S.Affected));const e=this.errorCalls.findIndex(y=>y.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),a==null||a.add(this,S.Affected)),o&&We(this,a),a==null||a.attemptAutoclose("remove-call",this.id),this}removeCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-caller")),o=!1){return this.calledBySuccess=this.calledBySuccess.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),this.calledByError=this.calledByError.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),o&&We(this,a),a==null||a.attemptAutoclose("remove-caller",this.id),this}replaceDetachedChild(i,a){const o=this.detachedChildren.indexOf(i);return o!==-1&&(this.detachedChildren[o]=a),this}subscribeDetachedChild(i){return this.detachedChildren.includes(i)||this.detachedChildren.push(i),this}unsubscribeDetachedChild(i){const a=this.detachedChildren.indexOf(i);return a!==-1&&this.detachedChildren.splice(a,1),this}setParent(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-parent"))){var o;return((o=this.parent)==null?void 0:o.id)!==(i==null?void 0:i.id)&&(this.parent=i,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-parent",this.id),this}setDeclaration(i){return this.declaration=i,this}initChildren(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.declaration=te(this.initialData.declaration,this.project),this.successCalls=this.initialData.successCalls.map(a=>{const o=te(a,this.project);if(o.addSuccessCaller(this),[f.BreakStatement,f.ContinueStatement].includes(o.type))o.setParent(this.parent.parent,null),o.initChildren(i);else if(o.type===f.ReturnStatement){const p=Yr(this,this.project);o.setParent(p,null),o.initChildren(i)}else o.type!==f.InternalCall&&(o.setParent(this.parent,null),o.initChildren(i));return o}),this.errorCalls=this.initialData.errorCalls.map(a=>{const o=te(a,this.project);if(o.addErrorCaller(this),[f.BreakStatement,f.ContinueStatement].includes(o.type))o.setParent(this.parent.parent,null),o.initChildren(i);else if(o.type===f.ReturnStatement){const p=Yr(this,this.project);o.setParent(p,null),o.initChildren(i)}else o.type!==f.InternalCall&&(o.setParent(this.parent,null),o.initChildren(i));return o}),this.inputs=this.initialData.inputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),o}),this.outputs=this.initialData.outputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),o}),this.initialData.process&&(this.process=te(this.initialData.process,this.project),this.process.setParent(this,null),this.process.initChildren(i)),this.initialData.body&&(this.body=te(this.initialData.body,this.project),this.body.setParent(this,null),this.body.initChildren(i)),this.initialData.error&&(this.error=te(this.initialData.error,this.project),this.error.setParent(this,null),this.error.initChildren(i)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"meta-sync"))){const o=xr(this,i),p=this.toMeta();return this.x=i.x||p.x,this.y=i.y||p.y,super.metaSync(i),i.deleted===!0&&!p.deleted?a==null||a.add(this,S.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,S.Added):o&&(a==null||a.add(this,S.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ve,...a){return await ht.repository.APILoad(this.id,...a),this}async APICreate(i=ve,...a){return await ht.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ve,...a){return await ht.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ve,...a){return await ht.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ve,...a){return await ht.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ve,a,...o){return await ht.repository.APILoadVersion(this.id,a,...o)}removeFromParent(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-from-parent"))){const a=[],o=[],p=[],e=[];return this.parent.type===f.Project?(this.parent.removeLoop(this),e.push(this.parent)):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose("remove-from-parent",this.id),{added:R(p),updated:R(a),removed:R(o),affected:R(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-entity"))){const o=[],p=[],e=[],y=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(p.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:A}=v.entity.onDetachedDependencyRemoved(this,v.field,a);o.push(...E),p.push(...b),e.push(...A)}),this.inputs.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...b)}),this.outputs.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...b)}),this.body.remove({ignoreUpstream:!0},a),this.error){const{updated:v,removed:E}=this.error.remove({ignoreUpstream:!0},a);o.push(...v),p.push(...E)}if(this.successCalls.forEach(v=>{o.push(v),v.removeCaller(this,a)}),this.errorCalls.forEach(v=>{o.push(v),v.removeCaller(this,a)}),!i){const v=this.removeFromParent(a);e.push(...v.added),o.push(...v.updated),p.push(...v.removed),y.push(...v.affected),this.calledBy.forEach(E=>{o.push(E),E.removeCall(this,a)})}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:R(e),updated:R(o),removed:R(p),affected:R(y),self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"restore-entity"))){const a=[],o=[],p=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),this.inputs.forEach(y=>{const{updated:v}=y.restore({},i);o.push(...v)}),this.outputs.forEach(y=>{const{updated:v}=y.restore({},i);o.push(...v)}),this.body.restore({},i),this.successCalls.forEach(y=>{o.push(y),y.addSuccessCaller(this,i)}),this.errorCalls.forEach(y=>{o.push(y),y.addErrorCaller(this,i)}),this.calledBySuccess.forEach(y=>{o.push(y),y.addSuccessCall(this,i)}),this.calledByError.forEach(y=>{o.push(y),y.addErrorCall(this,i)}),this.calledByEntry.forEach(y=>{o.push(y),y.addCall(this,i)}),i==null||i.attemptAutoclose("restore-entity",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this})}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.inputs.flatMap(o=>o.toFlat(i)),...this.outputs.flatMap(o=>o.toFlat(i)),...this.outputsDeclarations.flatMap(o=>o.toFlat(i)),...this.process?this.process.toFlat(i):[],...this.successCalls.flatMap(o=>o.toFlat(i)),...this.errorCalls.flatMap(o=>o.toFlat(i)),...this.error?this.error.toFlat(i):[],...this.body?this.body.toFlat(i):[],...this.continueStatements.flatMap(o=>o.toFlat(i)),...this.breakStatements.flatMap(o=>o.toFlat(i))])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.inputs.flatMap(o=>o.toFlatIds(i)),...this.outputs.flatMap(o=>o.toFlatIds(i)),...this.process?this.process.toFlatIds(i):[],...this.successCalls.flatMap(o=>o.toFlatIds(i)),...this.errorCalls.flatMap(o=>o.toFlatIds(i)),...this.error?this.error.toFlatIds(i):[],...this.body?this.body.toFlatIds(i):[],...this.continueStatements.flatMap(o=>o.toFlatIds(i)),...this.breakStatements.flatMap(o=>o.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,x:this.x,y:this.y,type:this.type}}toJSON(i=new Set){var a,o;return i.has(this.id)?this.toReference():(i.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,calledBySuccess:this.calledBySuccess.map(p=>p.toReference()),calledByError:this.calledByError.map(p=>p.toReference()),calledByEntry:this.calledByEntry.map(p=>p.toReference()),process:((a=this.process)==null?void 0:a.toJSON(i))||null,declaration:this.declaration.toJSON(i),inputs:this.inputs.map(p=>p.toJSON(i)),outputs:this.outputs.map(p=>p.toJSON(i)),outputsDeclarations:this.outputsDeclarations.map(p=>p.toJSON(i)),successCalls:this.successCalls.map(p=>p.toJSON(i)),errorCalls:this.errorCalls.map(p=>p.toJSON(i)),error:((o=this.error)==null?void 0:o.toJSON(i))||null,body:this.body.toJSON(i),parent:this.parent.toReference()})}toJSONClone(i=ke){var o,p,e,y,v,E,b;let a;return(o=i.seenEntityMaps)!=null&&o.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||Kr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(p=i.seenEntities)!=null&&p.has(a)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(a),(v=i.seenEntities)==null||v.add(this.id),{id:a,version:N.UUID.uuid(),createdAt:i.timestamp||L().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,calledBySuccess:this.calledBySuccess.map(A=>A.toReference({seenEntityMaps:i.seenEntityMaps})),calledByError:this.calledByError.map(A=>A.toReference({seenEntityMaps:i.seenEntityMaps})),calledByEntry:this.calledByEntry.map(A=>A.toReference({seenEntityMaps:i.seenEntityMaps})),process:((E=this.process)==null?void 0:E.toJSONClone({...i,newId:null}))||null,declaration:this.declaration.toJSON(),inputs:this.inputs.map(A=>A.toJSONClone({...i,newId:null})),outputs:this.outputs.map(A=>A.toJSONClone({...i,newId:null})),outputsDeclarations:this.outputsDeclarations.map(A=>A.toJSONClone({...i,newId:null})),successCalls:this.successCalls.map(A=>A.toJSONClone({...i,newId:null})),errorCalls:this.errorCalls.map(A=>A.toJSONClone({...i,newId:null})),error:((b=this.error)==null?void 0:b.toJSONClone({...i,newId:null}))||null,body:this.body.toJSONClone({...i,newId:null}),parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=ke){var o;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+N.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=ke){var o,p,e,y,v;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,declaration:((p=this.declaration)==null?void 0:p.toReference(i))||null,body:((e=this.body)==null?void 0:e.toReference(i))||null,inputs:this.inputs.map(E=>E.toReference(i)),outputs:this.outputs.map(E=>E.toReference(i)),outputsDeclarations:this.outputsDeclarations.map(E=>E.toReference(i)),successCalls:this.successCalls.map(E=>E.toReference(i)),errorCalls:this.errorCalls.map(E=>E.toReference(i)),process:((y=this.process)==null?void 0:y.toReference(i))||null,calledBySuccess:this.calledBySuccess.map(E=>E.toReference(i)),calledByError:this.calledByError.map(E=>E.toReference(i)),calledByEntry:this.calledByEntry.map(E=>E.toReference(i)),error:((v=this.error)==null?void 0:v.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var o;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((o=this.body)==null?void 0:o.toFlatJSON(i))||[],...this.successCalls.flatMap(p=>p.toFlatJSON(i)),...this.errorCalls.flatMap(p=>p.toFlatJSON(i)),...this.inputs.flatMap(p=>p.toFlatJSON(i)),...this.outputs.flatMap(p=>p.toFlatJSON(i)),...this.continueStatements.flatMap(p=>p.toFlatJSON(i)),...this.breakStatements.flatMap(p=>p.toFlatJSON(i)),...this.error?this.error.toFlatJSON(i):[],...this.process?this.process.toFlatJSON(i):[]])}toGenerationTarget(){const i=this.parent.type===f.Project?void 0:this.parent.id;return{id:this.id,type:this.type,calledByEntry:this.calledByEntry.map(a=>a.id),calledBySuccess:this.calledBySuccess.map(a=>a.id),calledByError:this.calledByError.map(a=>a.id),declaration:this.declaration.id,parent:i}}toFlatGenerationTarget(i=new Set){var o;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((o=this.body)==null?void 0:o.toFlatGenerationTarget(i))||[],...this.successCalls.flatMap(p=>p.toFlatGenerationTarget(i)),...this.errorCalls.flatMap(p=>p.toFlatGenerationTarget(i)),...this.inputs.flatMap(p=>p.toFlatGenerationTarget(i)),...this.outputs.flatMap(p=>p.toFlatGenerationTarget(i)),...this.continueStatements.flatMap(p=>p.toFlatGenerationTarget(i)),...this.breakStatements.flatMap(p=>p.toFlatGenerationTarget(i)),...this.error?this.error.toFlatGenerationTarget(i):[],...this.process?this.process.toFlatGenerationTarget(i):[]])}clearErrors(){var i,a;return this.errors=[],this.inputs.forEach(o=>o.clearErrors()),this.outputs.forEach(o=>o.clearErrors()),this.successCalls.forEach(o=>o.clearErrors()),this.errorCalls.forEach(o=>o.clearErrors()),this.continueStatements.forEach(o=>o.clearErrors()),this.breakStatements.forEach(o=>o.clearErrors()),(i=this.process)==null||i.clearErrors(),(a=this.error)==null||a.clearErrors(),this}validate(){const i=TA(this);return this.errors=i,{success:!0}}getErrors(){return[...this.errors,...this.inputs.flatMap(a=>a.getErrors()),...this.outputs.flatMap(a=>a.getErrors()),...this.body?this.body.getErrors():[],...this.error?this.error.getErrors():[],...this.process?this.process.getErrors():[]]}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"clone-entity")),a=null,o=null,p=!0){var B,F;let e=Sr(a,this);const y=this.toJSON(),v=o||N.UUID.uuid();y.inputs=[];const E=v.split("-id"),b=E[E.length-1||0]||v;y.id=v,y.version=N.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||L().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1;const A=dr(y,e);a?A.setParent(a,null):A.setParent(this.parent,null),p&&A.subscribe(),A.initChildren(i),i==null||i.add(A,S.Added);const $=(B=this.inputs)==null?void 0:B.map((K,Z)=>K.clone(i,A,b+"-input-map-"+Z+"-id",p));A.inputs=$;const V=(F=this.outputs)==null?void 0:F.map((K,Z)=>K.clone(i,A,b+"-output-map-"+Z+"-id",p));return A.outputs=V,this.body&&(A.body=this.body.clone(i,A,b+"-body-id",p,!0)),this.error&&(A.error=this.error.clone(i,A,b+"-error-map-id",p)),this.process&&(A.process=this.process.clone(i,A,b+"-process-id",p)),i==null||i.attemptAutoclose("clone-entity",this.id),A}getVariableInstances(){return this.body?vr(this.body).filter(o=>o.type===f.VariableInstance):[]}addReturnStatement(i){return Nt.includes(this.parent.type)&&this.parent.addReturnStatement(i),this}removeReturnStatement(i){return Nt.includes(this.parent.type)&&this.parent.removeReturnStatement(i),this}addBreakStatement(i){return this.breakStatements.includes(i)||this.breakStatements.push(i),this}removeBreakStatement(i){const a=this.breakStatements.indexOf(i);return a!==-1&&this.breakStatements.splice(a,1),this}addContinueStatement(i){return this.continueStatements.includes(i)||this.continueStatements.push(i),this}removeContinueStatement(i){const a=this.continueStatements.indexOf(i);return a!==-1&&this.continueStatements.splice(a,1),this}getUniqueReturnDeclarations(){const i=[];return[...this.breakStatements,...this.continueStatements].forEach(o=>{o.outputs.forEach(e=>{i.find(v=>v===e||ne(v,this.project)===ne(e,this.project)&&en(v.dataType,e.dataType))||i.push(e)})}),R(i)}syncTerminationStatements(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-termination-statements"))){const a=[],o=[],p=[],e=[],y=this.getUniqueReturnDeclarations();return[...this.breakStatements,...this.continueStatements].forEach(E=>{const b=E.outputs,A=y.filter($=>!b.find(V=>ne($,this.project)===ne(V,this.project)&&en($.dataType,V.dataType)));A.length&&(a.push(E),i==null||i.add(E,S.Updated)),A.forEach($=>{const V=$.clone(i,E);i==null||i.add(V,S.Added),V.addSelfToProject(i),o.push(V)})}),i==null||i.attemptAutoclose("sync-termination-statements",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncBodyInputIndexes(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-body-input-indexes"))){const a=[],o=[],p=[],e=[];return this.body.inputs.sort((v,E)=>v.index-E.index),this.body.inputs.forEach((v,E)=>{v.index!==E&&(v.metaSync({index:E},i),a.push(v))}),i==null||i.attemptAutoclose("sync-body-input-indexes",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncBodyArgumentsDeclarations(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-body-arguments-declarations"))){const a=[],o=[],p=[],e=[],{updated:y,added:v,removed:E}=this.syncFixedBodyArgumentDeclarations(i);a.push(...y),o.push(...v),p.push(...E);const b=this.getUniqueReturnDeclarations(),A=this.body.inputs;b.sort((F,K)=>F.index-K.index),b.forEach(F=>{const K=F.getDataType(i);let ie=A.find(J=>ne(J,this.project)===ht.fromReturnDeclarationToBodyArgumentDeclarationName(F)&&en(J.dataType,F.dataType));if(!ie){const J=ht.fromReturnDeclarationToBodyArgumentDeclarationName(F),ce={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.ArgumentDeclaration,name:J,codeName:null,description:`Aggretated list of all previously outputted values from each iteration by the output '${ne(F,this.project)}'`,defaultValue:null,constant:!0,dataType:null,implements:null,index:F.index,required:F.required,parent:this.body.toReference(),writesValues:[]},z=te(ce,this.project);z.setParent(this.body,i),z.initChildren(i),i==null||i.add(z,S.Added),z.addSelfToProject(i),o.push(z),ie=z}const X=this.body.inputs.find(J=>J.index===ie.index&&J!==ie),ue=this.body.inputs.filter(J=>J!==ie);let re=ie.index;X&&(re=Math.max(...ue.map(J=>J.index))+1),ie.index!==re&&(ie.metaSync({index:re},i),a.push(ie));const fe=ie.getDataType(i);let Y=fe;if(K)if(!fe||!en(fe,K)){if(!Y){const J=K.clone(i,ie);i==null||i.add(J,S.Added),J.addSelfToProject(i),Y=J,o.push(J),a.push(ie)}Y.merge(K,i),Y.metaSync({isList:!0},i)}else Y.isList||(Y.metaSync({isList:!0},i),a.push(Y));if(!K&&!Y){const J={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,index:null,parentRelationType:null,staticEntities:null,interactiveEntities:null,actionEntities:null,isList:!0,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:ie.toReference()},ce=te(J,this.project);ce.metaSync({isList:!0},i),ce.setParent(ie,i),ce.initChildren(i),i==null||i.add(ce,S.Added),ce.addSelfToProject(i),o.push(ce)}});const{updated:$,added:V,removed:B}=this.removeExtraBodyArgumentDeclarations(i);return a.push(...$),o.push(...V),p.push(...B),i==null||i.attemptAutoclose("sync-body-arguments-declarations",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncOutputsDeclarations(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-outputs-declarations"))){const a=[],o=[],p=[],e=[],y=this.getUniqueReturnDeclarations(),v=this.outputsDeclarations;return y.forEach((b,A)=>{b.index!==A&&(b.metaSync({index:A},i),a.push(b))}),y.forEach(b=>{const A=b.getDataType(i);let V=v.find(K=>ne(K,this.project)===ht.fromReturnDeclarationToLoopOutputDeclarationName(b)&&en(K.dataType,b.dataType));if(!V){const K=ht.fromReturnDeclarationToLoopOutputDeclarationName(b),Z={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.ValueDescriptor,name:K,codeName:null,description:`Aggretated list of all previously outputted values from each iteration by the output '${ne(b,this.project)}'`,defaultValue:null,dataType:null,index:b.index,required:b.required,parentRelationType:oe.FixedReturns,parent:this.toReference()},ie=te(Z,this.project);ie.setParent(this,i),ie.initChildren(i),i==null||i.add(ie,S.Added),ie.addSelfToProject(i),o.push(ie),V=ie}V.index!==b.index&&(V.metaSync({index:b.index},i),a.push(V));let F=V.getDataType(i);if(A)if(!F||!en(F,A)){if(!F){const K=A.clone(i,V);i==null||i.add(K,S.Added),K.addSelfToProject(i),F=K,o.push(K),a.push(V)}F.merge(A,i),F.metaSync({isList:!0},i)}else F.isList||(F.metaSync({isList:!0},i),a.push(F));if(!A&&!F){const K={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,parentRelationType:null,isList:!0,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:V.toReference()},Z=te(K,this.project);Z.metaSync({isList:!0},i),Z.setParent(V,i),Z.initChildren(i),i==null||i.add(Z,S.Added),Z.addSelfToProject(i),o.push(Z)}}),v.filter(b=>!y.find($=>ne(b,this.project)===ht.fromReturnDeclarationToLoopOutputDeclarationName($))).forEach(b=>{if(!(i!=null&&i.hasRemoved(b.id))&&!b.deleted){const{updated:A,removed:$}=b.remove({ignoreUpstream:!1},i);a.push(...A),p.push(...$)}}),i==null||i.attemptAutoclose("sync-outputs-declarations",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncOutputMaps(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-extended-properties"))){const a=[],o=[],p=[],e=[],y=this.outputsDeclarations,v=this.outputs;return y.forEach(b=>{var V;let $=v.find(B=>{var F,K;return((F=B.declaration)==null?void 0:F.id)===b.id&&en((K=B.declaration)==null?void 0:K.dataType,b.dataType)});if($)((V=$.declaration)==null?void 0:V.id)!==b.id&&($.setDeclaration(b,i),a.push($));else{const B={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.OutputMap,defaultValue:null,index:b.index,declaration:b.toJSON(),writesValues:[],parent:this.toReference()},F=te(B,this.project);F.setParent(this,i),F.initChildren(i),i==null||i.add(F,S.Added),F.addSelfToProject(i),o.push(F),$=F}$.index!==b.index&&($.metaSync({index:b.index},i),a.push($))}),v.filter(b=>!y.find($=>{var V;return((V=b.declaration)==null?void 0:V.id)===$.id})).forEach(b=>{const{updated:A,removed:$}=b.remove({ignoreUpstream:!1},i);a.push(...A),p.push(...$)}),i==null||i.attemptAutoclose("add-extended-properties",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}createCurrentIterationNumberArgumentDeclaration(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"create-current-iteration-number-argument-declaration"))){const a=[],o=[],p=[],e=[];let v=this.body.inputs.find($=>{var V;return $.name===ht.CURRENT_ITERATION_NUMBER_ARG_NAME||$.id===((V=this.currentIterationNumberArgumentDeclaration)==null?void 0:V.id)});const E=this.getCurrentIterationNumberBuiltInValueDescriptor();if(!v){const $={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.ArgumentDeclaration,name:ht.CURRENT_ITERATION_NUMBER_ARG_NAME,codeName:null,description:"The number of the current iteration",defaultValue:null,constant:!0,dataType:null,implements:E==null?void 0:E.toJSON(),index:this.body.inputs.length,required:!0,parent:this.body.toReference(),writesValues:[]},V=te($,this.project);V.setParent(this.body,i),V.initChildren(i),i==null||i.add(V,S.Added),V.addSelfToProject(i),o.push(V),v=V}!v.index&&v.index!==0&&(v.metaSync({index:0},i),a.push(v)),(!v.implements||v.implements.id!==E.id)&&(v.setImplements(E,i),a.push(v));let A=v.getDataType(i);if(!A){const $={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,actionEntities:null,parentRelationType:null,isList:!1,index:null,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:v.toReference()},V=te($,this.project);V.setParent(v,i),V.initChildren(i),i==null||i.add(V,S.Added),V.addSelfToProject(i),o.push(V),A=V}if(!A.entity||A.entity.type!==f.PrimitiveEntity||A.entity.name!==Q.Number||A.entity.id!==Ee["primitive-entity"].number.id){const $=this.project.getBuiltIn(Ee["primitive-entity"].number.id);A.setEntity($,i),a.push(A)}return i==null||i.attemptAutoclose("create-current-iteration-number-argument-declaration",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}removeExtraBodyArgumentDeclarations(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-extra-body-argument-declarations"))){const a=[],o=[],p=[],e=[],y=this.body.inputs,v=this.getUniqueReturnDeclarations();return y.filter(b=>b===this.currentIterationNumberArgumentDeclaration||b===this.currentValueArgumentDeclaration?!1:!v.find($=>ne(b,this.project)===ht.fromReturnDeclarationToBodyArgumentDeclarationName($))).forEach(b=>{const{updated:A,removed:$}=b.remove({ignoreUpstream:!1},i);a.push(...A),p.push(...$)}),i==null||i.attemptAutoclose("remove-extra-body-argument-declarations",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}createCurrentValueInputBasedOnInputMap(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"create-current-value-input-based-on-input-map"))){var b,A,$,V,B,F,K,Z,ie;const a=[],o=[],p=[],e=[];switch(this.declaration.id){case ze.List:{const X=this.body.inputs.find(fe=>{var Y;return((Y=fe.implements)==null?void 0:Y.id)===Ee[f.Loop][ze.List].body.inputs.currentValue.id}),ue=this.inputs.find(fe=>{var Y;return((Y=fe.declaration)==null?void 0:Y.id)===Ee[f.Loop][ze.List].inputs.list.id});if(!ue)break;const re=this.getCurrentValueBuiltInValueDescriptor();if(X){re&&(!X.implements||X.implements.id!==re.id)&&(X.setImplements(re,i),a.push(X));let Y=X.getDataType(i);if(!Y){const ce={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,parentRelationType:null,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:(b=this.currentValueArgumentDeclaration)==null?void 0:b.toReference()},z=te(ce,this.project);z.setParent(this.currentValueArgumentDeclaration,i),z.initChildren(i),i==null||i.add(z,S.Added),z.addSelfToProject(i),o.push(z),Y=z}const J=ue.getDataType(i);Y.merge(J,i),Y.metaSync({isList:!1},i)}else{const fe={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.ArgumentDeclaration,name:ht.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,defaultValue:null,index:this.body.inputs.length,constant:!0,required:!0,implements:re,writesValues:[],dataType:null,parent:this.body.toReference()},Y=te(fe,this.project);Y.setParent(this.body,i),Y.initChildren(i),i==null||i.add(Y,S.Added),Y.addSelfToProject(i),re&&(!Y.implements||Y.implements.id!==re.id)&&(Y.setImplements(re,i),a.push(Y)),o.push(Y)}break}case ze.ManualFlow:break;case ze.Counted:break;case ze.ObjectKeys:{const X=this.body.inputs.find(fe=>{var Y;return((Y=fe.implements)==null?void 0:Y.id)===Ee[f.Loop][ze.ObjectKeys].body.inputs.currentValue.id});if(!this.inputs.find(fe=>{var Y;return((Y=fe.declaration)==null?void 0:Y.id)===Ee[f.Loop][ze.ObjectKeys].inputs.object.id}))break;const re=this.getCurrentValueBuiltInValueDescriptor();if(X){re&&(!X.implements||X.implements.id!==re.id)&&(X.setImplements(re),a.push(X));let Y=X.getDataType(i);if(Y){const J=this.project.getBuiltIn(Ee["primitive-entity"].string.id);(($=Y.entity)==null?void 0:$.id)!==J.id&&(Y.setEntity(J,i),a.push(Y))}else{const J={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,parentRelationType:null,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:(A=this.currentValueArgumentDeclaration)==null?void 0:A.toReference()},ce=te(J,this.project);ce.setParent(this.currentValueArgumentDeclaration,i),ce.initChildren(i),i==null||i.add(ce,S.Added),ce.addSelfToProject(i),Y=ce}}else{const fe={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.ArgumentDeclaration,name:ht.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,defaultValue:null,index:this.body.inputs.length,constant:!0,required:!0,implements:re,writesValues:[],dataType:null,parent:this.body.toReference()},Y=te(fe,this.project);Y.setParent(this.body,i),Y.initChildren(i),i==null||i.add(Y,S.Added),Y.addSelfToProject(i),re&&(!Y.implements||Y.implements.id!==re.id)&&(Y.setImplements(re,i),a.push(Y)),o.push(Y)}break}case ze.ObjectValues:{const X=this.body.inputs.find(fe=>{var Y;return((Y=fe.implements)==null?void 0:Y.id)===Ee[f.Loop][ze.ObjectValues].body.inputs.currentValue.id}),ue=this.inputs.find(fe=>{var Y;return((Y=fe.declaration)==null?void 0:Y.id)===Ee[f.Loop][ze.ObjectValues].inputs.object.id});if(!ue)break;const re=this.getCurrentValueBuiltInValueDescriptor();if(X){re&&(!X.implements||X.implements.id!==re.id)&&(X.setImplements(re,i),a.push(X));let Y=X.getDataType(i);if(Y){const J=ue.getDataType(i),ce=((F=J==null?void 0:J.entity)==null?void 0:F.properties)||[];(K=Y.orChildrenGroup)==null||K.forEach(z=>{const{updated:de,removed:Ae}=z.remove({ignoreUpstream:!1},i);a.push(...de),p.push(...Ae)}),ce.forEach(z=>{if(!z.getDataType(i)){const Ae={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,actionEntities:null,index:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parentRelationType:Ii.OrDataTypeGroup,parent:Y.toReference()},je=te(Ae,this.project);je.setParent(Y,i),je.initChildren(i),i==null||i.add(je,S.Added),je.addSelfToProject(i),o.push(je)}})}else{const J={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,parentRelationType:null,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:(V=this.currentValueArgumentDeclaration)==null?void 0:V.toReference()},ce=te(J,this.project);ce.setParent(this.currentValueArgumentDeclaration,i),ce.initChildren(i),i==null||i.add(ce,S.Added),ce.addSelfToProject(i),Y=ce;const z=ue.getDataType(i);(((B=z==null?void 0:z.entity)==null?void 0:B.properties)||[]).forEach(Ae=>{if(!Ae.getDataType(i)){const Ne={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,actionEntities:null,index:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parentRelationType:Ii.OrDataTypeGroup,parent:ce.toReference()},$e=te(Ne,this.project);$e.setParent(ce,i),$e.initChildren(i),i==null||i.add($e,S.Added),$e.addSelfToProject(i),o.push($e)}})}}else{const fe={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.ArgumentDeclaration,name:ht.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,constant:!0,defaultValue:null,index:this.body.inputs.length,required:!0,implements:re,writesValues:[],dataType:null,parent:this.body.toReference()},Y=te(fe,this.project);Y.setParent(this.body,i),Y.initChildren(i),i==null||i.add(Y,S.Added),Y.addSelfToProject(i),re&&(!Y.implements||Y.implements.id!==re.id)&&(Y.setImplements(re,i),a.push(Y)),o.push(Y)}break}case ze.String:{const X=this.body.inputs.find(fe=>{var Y;return((Y=fe.implements)==null?void 0:Y.id)===Ee[f.Loop][ze.String].body.inputs.currentValue.id});if(!this.inputs.find(fe=>{var Y;return((Y=fe.declaration)==null?void 0:Y.id)===Ee[f.Loop][ze.String].inputs.string.id}))break;const re=this.getCurrentValueBuiltInValueDescriptor();if(X){re&&(!X.implements||X.implements.id!==re.id)&&(X.setImplements(re,i),a.push(X));let Y=X.getDataType(i);if(Y){const J=this.project.getBuiltIn(Ee["primitive-entity"].string.id);((ie=Y.entity)==null?void 0:ie.id)!==J.id&&(Y.setEntity(J,i),a.push(Y))}else{const J={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:[],implementationChooseOne:!1,parentRelationType:null,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:(Z=this.currentValueArgumentDeclaration)==null?void 0:Z.toReference()},ce=te(J,this.project);ce.setParent(this.currentValueArgumentDeclaration,i),ce.initChildren(i),i==null||i.add(ce,S.Added),ce.addSelfToProject(i),o.push(ce),Y=ce}}else{const fe={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.ArgumentDeclaration,name:ht.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,index:this.body.inputs.length,required:!0,constant:!0,defaultValue:null,implements:re,writesValues:[],dataType:null,parent:this.body.toReference()},Y=te(fe,this.project);Y.setParent(this.body,i),Y.initChildren(i),i==null||i.add(Y,S.Added),Y.addSelfToProject(i),re&&(!Y.implements||Y.implements.id!==re.id)&&(Y.setImplements(re,i),a.push(Y)),o.push(Y)}break}}const{updated:y,added:v,removed:E}=this.removeExtraBodyArgumentDeclarations(i);return a.push(...y),o.push(...v),p.push(...E),i==null||i.attemptAutoclose("create-current-value-input-based-on-input-map",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncFixedBodyArgumentDeclarations(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-fixed-body-argument-declarations"))){const a=[],o=[],p=[],e=[],{updated:y,added:v,removed:E}=this.createCurrentIterationNumberArgumentDeclaration(i);a.push(...y),o.push(...v),p.push(...E);const{updated:b,added:A,removed:$}=this.createCurrentValueInputBasedOnInputMap(i);return a.push(...b),o.push(...A),p.push(...$),i==null||i.attemptAutoclose("sync-fixed-body-argument-declarations",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncInputMaps(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-input-maps"))){const a=[],o=[],p=[],e=[];switch(this.declaration.id){case ze.List:{let y=null;if(this.inputs.forEach(v=>{var E;((E=v.declaration)==null?void 0:E.id)===Ee[f.Loop]["list-loop"].inputs.list.id?y=v:(v.remove({ignoreUpstream:!1},i),p.push(v))}),y){if(y.declaration.id!==Ee[f.Loop]["list-loop"].inputs.list.id){const v=this.project.get(Ee[f.Loop]["list-loop"].inputs.list.id);y.setDeclaration(v,i),a.push(y)}}else{const v=this.project.get(Ee[f.Loop]["list-loop"].inputs.list.id),E={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.InputMap,name:null,codeName:null,description:null,index:0,declaration:v.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=te(E,this.project);b.setParent(this,i),b.initChildren(i),i==null||i.add(b,S.Added),b.addSelfToProject(i),o.push(b)}break}case ze.ManualFlow:{this.inputs.forEach(y=>{y.remove({ignoreUpstream:!1},i),p.push(y)});break}case ze.Counted:{let y=null;if(this.inputs.forEach(v=>{var E;((E=v.declaration)==null?void 0:E.id)===Ee[f.Loop]["counted-loop"].inputs.number.id?y=v:(v.remove({ignoreUpstream:!1},i),p.push(v))}),y){if(y.declaration.id!==Ee[f.Loop]["counted-loop"].inputs.number.id){const v=this.project.get(Ee[f.Loop]["counted-loop"].inputs.number.id);y.setDeclaration(v,i),a.push(y)}}else{const v=this.project.get(Ee[f.Loop]["counted-loop"].inputs.number.id),E={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.InputMap,name:null,codeName:null,description:null,index:0,declaration:v.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=te(E,this.project);b.setParent(this,i),b.initChildren(i),i==null||i.add(b,S.Added),b.addSelfToProject(i),o.push(b)}break}case ze.ObjectKeys:{let y=null;if(this.inputs.forEach(v=>{var E;((E=v.declaration)==null?void 0:E.id)===Ee[f.Loop]["object-keys-loop"].inputs.object.id?y=v:(v.remove({ignoreUpstream:!1},i),p.push(v))}),y){if(y.declaration.id!==Ee[f.Loop]["object-keys-loop"].inputs.object.id){const v=this.project.get(Ee[f.Loop]["object-keys-loop"].inputs.object.id);y.setDeclaration(v,i),a.push(y)}}else{const v=this.project.get(Ee[f.Loop]["object-keys-loop"].inputs.object.id),E={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.InputMap,name:null,codeName:null,description:null,index:0,declaration:v.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=te(E,this.project);b.setParent(this,i),b.initChildren(i),i==null||i.add(b,S.Added),b.addSelfToProject(i),o.push(b)}break}case ze.ObjectValues:{let y=null;if(this.inputs.forEach(v=>{var E;((E=v.declaration)==null?void 0:E.id)===Ee[f.Loop]["object-values-loop"].inputs.object.id?y=v:(v.remove({ignoreUpstream:!1},i),p.push(v))}),y){if(y.declaration.id!==Ee[f.Loop]["object-values-loop"].inputs.object.id){const v=this.project.get(Ee[f.Loop]["object-values-loop"].inputs.object.id);y.setDeclaration(v,i),a.push(y)}}else{const v=this.project.get(Ee[f.Loop]["object-values-loop"].inputs.object.id),E={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.InputMap,name:null,codeName:null,description:null,index:0,declaration:v.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=te(E,this.project);b.setParent(this,i),b.initChildren(i),i==null||i.add(b,S.Added),b.addSelfToProject(i),o.push(b)}break}case ze.String:{let y=null;if(this.inputs.forEach(v=>{var E;((E=v.declaration)==null?void 0:E.id)===Ee[f.Loop]["string-loop"].inputs.string.id?y=v:(v.remove({ignoreUpstream:!1},i),p.push(v))}),y){if(y.declaration.id!==Ee[f.Loop]["string-loop"].inputs.string.id){const v=this.project.get(Ee[f.Loop]["string-loop"].inputs.string.id);y.setDeclaration(v,i),a.push(y)}}else{const v=this.project.get(Ee[f.Loop]["string-loop"].inputs.string.id),E={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.InputMap,name:null,codeName:null,description:null,index:0,declaration:v.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=te(E,this.project);b.setParent(this,i),b.initChildren(i),i==null||i.add(b,S.Added),b.addSelfToProject(i),o.push(b)}break}}return i==null||i.attemptAutoclose("sync-input-maps",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}getCurrentValueBuiltInValueDescriptor(){var a;if(this.declaration.id===ze.ManualFlow||this.declaration.id===ze.Counted)return null;const i=(a=Ee[f.Loop][this.declaration.id].body.inputs.currentValue)==null?void 0:a.id;return i?this.project.get(i):null}getCurrentIterationNumberBuiltInValueDescriptor(){const i=Ee[f.Loop][this.declaration.id].body.inputs.iterationNumber.id;return this.project.get(i)}syncBody(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-body"))){var E;const a=[],o=[],p=[],e=[],y=Ee[f.Loop][this.declaration.id].body.id,v=this.project.getBuiltIn(y);if(this.body)((E=this.body.implements)==null?void 0:E.id)!==v.id&&(this.body.setImplements(v,i),this.body.setParent(this,i),a.push(this.body));else{const b={extends:null,id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.FunctionDeclaration,name:v.name,codeName:null,description:null,inputs:[],index:null,calls:[],collapsed:!1,private:!1,implements:v.toJSON(),x:0,y:0,parent:this.toReference()},A=te(b,this.project);A.setParent(this,i),A.initChildren(i),i==null||i.add(A,S.Added),A.addSelfToProject(i),o.push(A)}return i==null||i.attemptAutoclose("sync-body",this.id),{self:this,updated:R(a),added:R(o),removed:R(p),affected:R(e)}}syncChildren(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-children"))){const a=[],o=[],p=[],e=[],{updated:y,added:v,removed:E}=this.syncBody(i);a.push(...y),o.push(...v),p.push(...E);const{updated:b,added:A,removed:$}=this.syncInputMaps(i);a.push(...b),o.push(...A),p.push(...$);const{updated:V,added:B,removed:F}=this.syncTerminationStatements(i);a.push(...V),o.push(...B),p.push(...F);const{updated:K,added:Z,removed:ie}=this.syncBodyArgumentsDeclarations(i);a.push(...K),o.push(...Z),p.push(...ie);const{updated:X,added:ue,removed:re}=this.syncBodyInputIndexes(i);a.push(...X),o.push(...ue),p.push(...re);const{updated:fe,added:Y,removed:J}=this.syncOutputsDeclarations(i);a.push(...fe),o.push(...Y),p.push(...J);const{updated:ce,added:z,removed:de}=this.syncOutputMaps(i);return a.push(...ce),o.push(...z),p.push(...de),i==null||i.attemptAutoclose("sync-children",this.id),{self:this,updated:R(a),added:R(o),removed:R(p),affected:R(e)}}getUnusedInputs(){return this.inputs.filter(i=>i.suggestion||!i.readsValue&&!i.defaultValue)}getUnusedOutputs(){return this.outputs.filter(i=>i.suggestion||!i.writesValues.length)}getUsedInputs(){return this.inputs.filter(i=>!i.suggestion&&(i.readsValue||i.defaultValue))}getUsedOutputs(){return this.outputs.filter(i=>!i.suggestion&&i.writesValues.length)}};g(ht,"repository",{APICreate:async(i,...a)=>i,APIUpdate:async(i,...a)=>i,APIDelete:async(i,...a)=>i,APIClone:async(i,...a)=>{},APILoad:async(i,...a)=>null,APILoadVersion:async(i,a,...o)=>null}),g(ht,"type",f.Loop),g(ht,"USER_MANAGED_PARENT_TYPES",[...Br,f.Project]),g(ht,"PARENT_TYPES",[...pt.USER_MANAGED_PARENT_TYPES]),g(ht,"CURRENT_ITERATION_NUMBER_ARG_NAME","Current iteration number"),g(ht,"CURRENT_VALUE_ARG_NAME","Current value"),g(ht,"MUTABLE_BASE_PROPERTIES",[]),g(ht,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),g(ht,"BASE_PROPERTIES",[...ht.MUTABLE_BASE_PROPERTIES,...ht.INMUTABLE_BASE_PROPERTIES]),g(ht,"MUTABLE_META_PROPERTIES",[...ht.MUTABLE_BASE_PROPERTIES,"x","y"]),g(ht,"INMUTABLE_META_PROPERTIES",[...ht.INMUTABLE_BASE_PROPERTIES]),g(ht,"META_PROPERTIES",[...ht.MUTABLE_META_PROPERTIES,...ht.INMUTABLE_META_PROPERTIES]),g(ht,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),g(ht,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),g(ht,"UPSTREAM_PROPERTIES",[...ht.MUTABLE_UPSTREAM_PROPERTIES,...ht.INMUTABLE_UPSTREAM_PROPERTIES]),g(ht,"MUTABLE_DOWNSTREAM_PROPERTIES",["body","inputs","outputs","outputsDeclarations","successCalls","errorCalls","error","breakStatements","continueStatements"]),g(ht,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),g(ht,"DOWNSTREAM_PROPERTIES",[...ht.MUTABLE_DOWNSTREAM_PROPERTIES,...ht.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(ht,"PROPERTIES",[...ht.META_PROPERTIES,...ht.UPSTREAM_PROPERTIES,...ht.DOWNSTREAM_PROPERTIES]);let ki=ht;function pj(d){const u=Nye(),i=d.toJSON();u.safeParse(i).success,d.inputs.forEach(e=>e.validate());const p=[...Ka(d)];return Er(d.errors,p)}const X0e=Object.freeze(Object.defineProperty({__proto__:null,validate:pj},Symbol.toStringTag,{value:"Module"}));var fj=(d=>(d.Parent="parent",d))(fj||{});const Xt=class Xt extends Nr{constructor(i,a){super(i);g(this,"initialData");g(this,"id");g(this,"x");g(this,"y");g(this,"type",f.Condition);g(this,"index",null);g(this,"successCalls",[]);g(this,"errorCalls",[]);g(this,"declaration");g(this,"inputs",[]);g(this,"calledBySuccess",[]);g(this,"calledByError",[]);g(this,"calledByEntry",[]);g(this,"andChildrenGroup",null);g(this,"orChildrenGroup",null);g(this,"project");g(this,"errors",[]);g(this,"parent");g(this,"detachedDependents",{});g(this,"knownVersions",null);g(this,"activeVersion",!1);g(this,"initialized",!1);g(this,"startedInitialization",!1);this.initialData=i,this.project=a,this.id=i.id,this.x=i.x,this.y=i.y,this.index=i.index??null}static new(i=null){return{id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.Condition,declaration:null,index:null,inputs:[],parent:null,andChildrenGroup:null,orChildrenGroup:null,calledByEntry:[],calledBySuccess:[],calledByError:[],errorCalls:[],successCalls:[],x:0,y:0}}static fromGenerationTarget(i,a){var $,V;let o=a;if(i.parent){const B=H(i.parent);o=a.get(B)}const p=i.calledByEntry.map(B=>{const F=H(B);return a.get(F)}),e=i.calledBySuccess.map(B=>{const F=H(B);return a.get(F)}),y=i.calledByError.map(B=>{const F=H(B);return a.get(F)});let v;if(i.declaration){const B=H(i.declaration);v=a.get(B)}let E=null;o&&o.type===f.Condition&&((($=o.declaration)==null?void 0:$.id)===Mr.Or?E=(o.orChildrenGroup||[]).length:((V=o.declaration)==null?void 0:V.id)===Mr.And&&(E=(o.andChildrenGroup||[]).length));const b={id:i.id,version:N.UUID.uuid(),createdAt:L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.Condition,index:E,declaration:v,andChildrenGroup:i.andChildrenGroup?i.andChildrenGroup.map(B=>{const F=H(B);return a.get(F)}).filter(B=>!!B):null,orChildrenGroup:i.orChildrenGroup?i.orChildrenGroup.map(B=>{const F=H(B);return a.get(F)}).filter(B=>!!B):null,calledByEntry:p,calledBySuccess:e,calledByError:y,errorCalls:[],successCalls:[],inputs:[],x:0,y:0,parent:o},A=te(b,a);return A.setParent(o,null),A}static validateGenerationTarget(i,a){let o=JSON.parse(JSON.stringify(i));const p=[],e=li(o,{parent:{list:!1,types:[...Br,f.Project],optional:!0}},a);return o=e.modifiedData,p.push(...e.errors,...Ur(o)),i.declaration?a.get(i.declaration)?a.conditionDeclarations.find(E=>E.id===i.declaration)||p.push(new ee({id:`${i.id}--${k.InvalidImplementsReference}`,code:k.InvalidImplementsReference,severity:q.Error,message:`Entity of type '${i.type}' with id '${i.id}' has an 'declaration' property that isn't pointing to an action descriptor reserved for '${f.Condition}' entities.
|
|
76
76
|
${Nm(a)}`})):p.push(new ee({id:`${i.id}--${k.ReferencedEntityNotFound}`,code:k.ReferencedEntityNotFound,severity:q.Error,message:`Entity of type '${i.type}' with id '${i.id}' has an 'declaration' property that isn't found in the project. The 'declaration' property must point to one of the built-in action descriptors reserved for '${f.Condition}' entities.
|
|
77
77
|
${Nm(a)}`})):p.push(new ee({id:`${i.id}--${ae.InvalidObjectStructure}`,code:ae.InvalidObjectStructure,severity:q.Error,message:`Entity of type '${i.type}' with id '${i.id}' is missing the 'declaration' property. This property is required for a '${i.type}' entity and must point to one of the built-in action descriptors reserved for '${f.Condition}' entities.
|
|
78
78
|
${Nm(a)}`})),{errors:p,modifiedData:o}}validateGeneratedUpdate(i){const a=[];return i.parent&&a.push(new ee({id:`${this.id}--${k.InvalidParentUpdate}`,code:k.InvalidParentUpdate,severity:q.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
|
|
79
|
-
If an entity is called by another, they must be in the same scope, which means they have the same parent.`})),{errors:a,modifiedData:i}}subscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-dependents"))){const a=[],o=[],p=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),o.push(...v.added),p.push(...v.removed),e.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}onDetachedDependencyRemoved(i,a,o){const p=[],e=[],y=[],v=[];if(a==="parent"){const{updated:E,added:b,removed:A}=this.remove({ignoreUpstream:!1},o);p.push(...E),e.push(...b),y.push(...A)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,o){const p=[],e=[],y=[],v=[];if(a==="parent"){const{updated:E,added:b,removed:A}=this.restore({},o);p.push(...E),e.push(...b),y.push(...A)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){return this.parent.unsubscribeDependents([{entity:this,field:"parent"}]),this}subscribeToDependencies(){var i;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"parent"}]),this}increaseVersion(i){if(i&&!L(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&L(i).isSame(L(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=L(i).toISOString()||L().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new Xt(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.inputs=[...this.inputs],i.declaration=this.declaration,i.andChildrenGroup=this.andChildrenGroup?[...this.andChildrenGroup]:this.andChildrenGroup,i.orChildrenGroup=this.orChildrenGroup?[...this.orChildrenGroup]:this.orChildrenGroup,i.successCalls=[...this.successCalls],i.errorCalls=[...this.errorCalls],i.calledBySuccess=[...this.calledBySuccess],i.calledByError=[...this.calledByError],i.calledByEntry=[...this.calledByEntry],i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const a=[],o=[],p=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),o.push(...y.added),p.push(...y.removed)}return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}async restoreVersion(i){var v;const a=[],o=[],p=[],e=[];if(this.version===i)return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[$,V]of A.knownVersions)E.set($,V);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new Xt(E,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.inputs=y.inputs,this.declaration=y.declaration,this.andChildrenGroup=y.andChildrenGroup,this.orChildrenGroup=y.orChildrenGroup,this.successCalls=y.successCalls,this.errorCalls=y.errorCalls,this.calledBySuccess=y.calledBySuccess,this.calledByError=y.calledByError,this.calledByEntry=y.calledByEntry,this.parent=y.parent,{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"update-with-shallow-transfer"))){if(this.metaSync(i,a),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,i.parent){const o=H(i.parent),p=this.project.get(o),e=this.parent;if(e&&e.id!==(p==null?void 0:p.id)&&this.removeFromParent(a),p)this.setParent(p,a);else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${o}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.declaration){const o=H(i.declaration),p=this.project.get(o);p&&this.setDeclaration(p)}return i.calledByEntry.forEach(o=>{const p=H(o),e=this.project.get(p);e&&(this.addEntryCaller(e,a),e.addCall(this,a))}),[...this.calledByEntry].forEach(o=>{i.calledByEntry.find(e=>H(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),i.calledBySuccess.forEach(o=>{const p=H(o),e=this.project.get(p);e&&(this.addSuccessCaller(e,a),e.addSuccessCall(this,a))}),[...this.calledBySuccess].forEach(o=>{i.calledBySuccess.find(e=>H(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),i.calledByError.forEach(o=>{const p=H(o),e=this.project.get(p);e&&(this.addErrorCaller(e,a),e.addErrorCall(this,a))}),[...this.calledBySuccess].forEach(o=>{i.calledBySuccess.find(e=>H(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const i=[],a=[],o=[],p=[];if(this.initialData.parent){const e=H(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' 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 e=H(this.initialData.declaration),y=this.project.get(e);y&&(this.setDeclaration(y),i.push(y))}return this.initialData.calledByEntry.forEach(e=>{const y=H(e),v=this.project.get(y);v&&this.addEntryCaller(v,null)}),this.initialData.calledBySuccess.forEach(e=>{const y=H(e),v=this.project.get(y);v&&this.addSuccessCaller(v,null)}),this.initialData.calledByError.forEach(e=>{const y=H(e),v=this.project.get(y);v&&this.addErrorCaller(v,null)}),{updated:R(i),added:R(a),removed:R(o),affected:R(p),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],o=[],p=[],e=[];this.initialized=!0;const{updated:y,added:v,removed:E}=this.syncInputs(i);return a.push(...y),o.push(...v),p.push(...E),this.captureVersion(),i==null||i.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-self-to-project"))){const a=[this],o=[],p=[],e=[];return this.parent===this.project?this.project.addCondition(this):this.parent.type===f.Condition&&(this.parent.declaration.id===Mr.And?this.parent.addToAndGroup(this):this.parent.declaration.id===Mr.Or&&this.parent.addToOrGroup(this)),this.successCalls.forEach(y=>{y.addSuccessCaller(this,i),a.push(y)}),this.errorCalls.forEach(y=>{y.addErrorCaller(this,i),a.push(y)}),this.calledByEntry.forEach(y=>{y.addCall(this,i),a.push(y)}),this.calledBySuccess.forEach(y=>{y.addSuccessCall(this,i),a.push(y)}),this.calledByError.forEach(y=>{y.addErrorCall(this,i),a.push(y)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-input"))){const o=this.inputs.findIndex(p=>p.id===i.id);return o>-1&&(this.inputs.splice(o,1),a&&(a==null||a.add(this,S.Affected))),a==null||a.attemptAutoclose("remove-input",this.id),this}addInput(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-input"))){return this.inputs.includes(i)?(a==null||a.attemptAutoclose("add-input",this.id),this):(this.inputs.push(i),a==null||a.add(this,S.Affected),a==null||a.attemptAutoclose("add-input",this.id),this)}addOutput(i){return this}removeOutput(i){return this}addSuccessCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-success-caller")),o=!1){return this.calledBySuccess.find(p=>p.id===i.id)||(this.calledBySuccess.push(i),a==null||a.add(this,S.Updated),o&&We(this,a)),a==null||a.attemptAutoclose("add-success-caller",this.id),this}addErrorCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-error-caller")),o=!1){return this.calledByError.find(p=>p.id===i.id)||(this.calledByError.push(i),a==null||a.add(this,S.Updated),o&&We(this,a)),a==null||a.attemptAutoclose("add-error-caller",this.id),this}addEntryCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-entry-caller")),o=!1){return this.calledByEntry.find(p=>p.id===i.id)||(this.calledByEntry.push(i),a==null||a.add(this,S.Updated),o&&We(this,a)),a==null||a.attemptAutoclose("add-entry-caller",this.id),this}addErrorCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-error-call")),o=!1){return this.errorCalls.find(p=>p.id===i.id)||(this.errorCalls.push(i),o&&We(this,a),a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("add-error-call",this.id),this}addSuccessCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-success-call")),o=!1){return this.successCalls.find(p=>p.id===i.id)||(this.successCalls.push(i),o&&We(this,a),a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("add-success-call",this.id),this}removeCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-call")),o=!1){const p=this.successCalls.findIndex(y=>y.id===i.id);p>-1&&(this.successCalls.splice(p,1),a==null||a.add(this,S.Affected));const e=this.errorCalls.findIndex(y=>y.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),a==null||a.add(this,S.Affected)),o&&We(this,a),a==null||a.attemptAutoclose("remove-call",this.id),this}removeCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-caller")),o=!1){return this.calledBySuccess=this.calledBySuccess.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),this.calledByError=this.calledByError.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),o&&We(this,a),a==null||a.attemptAutoclose("remove-caller",this.id),this}setParent(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-parent"))){var o;return((o=this.parent)==null?void 0:o.id)!==(i==null?void 0:i.id)&&(this.parent=i,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-parent",this.id),this}removeChildGroup(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-child-group"))){if(this.andChildrenGroup){const o=this.andChildrenGroup.findIndex(p=>p.id===i.id);o!==-1&&(this.andChildrenGroup.splice(o,1),a==null||a.add(this,S.Updated))}if(this.orChildrenGroup){const o=this.orChildrenGroup.findIndex(p=>p.id===i.id);o!==-1&&(this.orChildrenGroup.splice(o,1),a==null||a.add(this,S.Updated))}return a==null||a.attemptAutoclose("remove-child-group",this.id),this}setDeclaration(i){return this.declaration=i,this}initChildren(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.declaration=te(this.initialData.declaration,this.project),this.initialData.andChildrenGroup&&(this.andChildrenGroup=this.initialData.andChildrenGroup.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),o})),this.initialData.orChildrenGroup&&(this.orChildrenGroup=this.initialData.orChildrenGroup.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),o})),this.successCalls=this.initialData.successCalls.map(a=>{const o=te(a,this.project);if(o.addSuccessCaller(this),[f.BreakStatement,f.ContinueStatement].includes(o.type))o.setParent(this.parent.parent,null),o.initChildren(i);else if(o.type===f.ReturnStatement){const p=Yr(this,this.project);o.setParent(p,null),o.initChildren(i)}else o.type!==f.InternalCall&&(o.setParent(this.parent,null),o.initChildren(i));return o}),this.errorCalls=this.initialData.errorCalls.map(a=>{const o=te(a,this.project);if(o.addErrorCaller(this),[f.BreakStatement,f.ContinueStatement].includes(o.type))o.setParent(this.parent.parent,null),o.initChildren(i);else if(o.type===f.ReturnStatement){const p=Yr(this,this.project);o.setParent(p,null),o.initChildren(i)}else o.type!==f.InternalCall&&(o.setParent(this.parent,null),o.initChildren(i));return o}),this.inputs=this.initialData.inputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),o}),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"meta-sync"))){const o=xr(this,i),p=this.toMeta();return this.x=i.x!==void 0?i.x:p.x,this.y=i.y!==void 0?i.y:p.y,this.index=i.index!==void 0?i.index:p.index,super.metaSync(i),i.deleted===!0&&!p.deleted?a==null||a.add(this,S.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,S.Added):o&&(a==null||a.add(this,S.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ve,...a){return await Xt.repository.APILoad(this.id,...a),this}async APICreate(i=ve,...a){return await Xt.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ve,...a){return await Xt.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ve,...a){return await Xt.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ve,...a){return await Xt.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ve,a,...o){return await Xt.repository.APILoadVersion(this.id,a,...o)}removeFromParent(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-from-parent"))){var y;const a=[],o=[],p=[],e=[];return this.parent.type===f.Project?(this.parent.removeCondition(this),e.push(this.parent)):((y=this.parent)==null?void 0:y.type)===f.Condition?this.parent.removeChildGroup(this):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose("remove-from-parent",this.id),{added:R(p),updated:R(a),removed:R(o),affected:R(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-entity"))){const o=[],p=[],e=[],y=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(p.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:A}=v.entity.onDetachedDependencyRemoved(this,v.field,a);o.push(...E),p.push(...b),e.push(...A)}),this.andChildrenGroup&&this.andChildrenGroup.forEach(v=>{const{removed:E,updated:b}=v.remove({ignoreUpstream:!0},a);p.push(...E),o.push(...b)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(v=>{const{removed:E,updated:b}=v.remove({ignoreUpstream:!0},a);p.push(...E),o.push(...b)}),this.inputs.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...b)}),this.successCalls.forEach(v=>{o.push(v),v.removeCaller(this,a)}),this.errorCalls.forEach(v=>{o.push(v),v.removeCaller(this,a)}),!i){const v=this.removeFromParent(a);e.push(...v.added),o.push(...v.updated),p.push(...v.removed),y.push(...v.affected),this.calledBy.forEach(E=>{o.push(E),E.removeCall(this,a)})}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:R(e),updated:R(o),removed:R(p),affected:R(y),self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"restore-entity"))){const a=[],o=[],p=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(y=>{const{updated:v,removed:E,added:b}=y.entity.onDetachedDependencyRestored(this,y.field,i);o.push(...v),p.push(...E),a.push(...b)}),this.andChildrenGroup&&this.andChildrenGroup.forEach(y=>{const{updated:v,added:E}=y.restore({},i);o.push(...v),a.push(...E)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(y=>{const{updated:v,added:E}=y.restore({},i);o.push(...v),a.push(...E)}),this.inputs.forEach(y=>{const{updated:v}=y.restore({},i);o.push(...v)}),this.successCalls.forEach(y=>{o.push(y),y.addSuccessCaller(this,i)}),this.errorCalls.forEach(y=>{o.push(y),y.addErrorCaller(this,i)}),this.calledBySuccess.forEach(y=>{o.push(y),y.addSuccessCall(this,i)}),this.calledByError.forEach(y=>{o.push(y),y.addErrorCall(this,i)}),this.calledByEntry.forEach(y=>{o.push(y),y.addCall(this,i)}),this.parent.type===f.Project&&this.project.addCondition(this),i==null||i.attemptAutoclose("restore-entity",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this})}toFlat(i=new Set){var o,p;return i.has(this.id)?[]:(i.add(this.id),[this,...((o=this.andChildrenGroup)==null?void 0:o.flatMap(e=>e.toFlat(i)))||[],...((p=this.orChildrenGroup)==null?void 0:p.flatMap(e=>e.toFlat(i)))||[],...this.inputs.flatMap(e=>e.toFlat(i)),...this.successCalls.flatMap(e=>e.toFlat(i)),...this.errorCalls.flatMap(e=>e.toFlat(i)),...this.calledBy.flatMap(e=>e.toFlat(i))])}toFlatIds(i=new Set){var o,p;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((o=this.andChildrenGroup)==null?void 0:o.flatMap(e=>e.toFlatIds(i)))||[],...((p=this.orChildrenGroup)==null?void 0:p.flatMap(e=>e.toFlatIds(i)))||[],...this.inputs.flatMap(e=>e.toFlatIds(i)),...this.successCalls.flatMap(e=>e.toFlatIds(i)),...this.errorCalls.flatMap(e=>e.toFlatIds(i)),...this.calledBy.flatMap(e=>e.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,index:this.index,x:this.x,y:this.y,type:this.type}}toJSON(i=new Set){var a,o;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,index:this.index,x:this.x,y:this.y,declaration:this.declaration.toJSON(i),andChildrenGroup:((a=this.andChildrenGroup)==null?void 0:a.map(p=>p.toJSON(i)))||null,orChildrenGroup:((o=this.orChildrenGroup)==null?void 0:o.map(p=>p.toJSON(i)))||null,successCalls:this.successCalls.map(p=>p.toJSON(i)),errorCalls:this.errorCalls.map(p=>p.toJSON(i)),calledBySuccess:this.calledBySuccess.map(p=>p.toReference()),calledByError:this.calledByError.map(p=>p.toReference()),calledByEntry:this.calledByEntry.map(p=>p.toReference()),inputs:this.inputs.map(p=>p.toJSON(i)),parent:this.parent.toReference()})}toJSONClone(i=ke){var o,p,e,y,v,E,b;let a;return(o=i.seenEntityMaps)!=null&&o.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||Kr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(p=i.seenEntities)!=null&&p.has(a)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(a),(v=i.seenEntities)==null||v.add(this.id),{id:a,version:N.UUID.uuid(),createdAt:i.timestamp||L().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,index:this.index,x:this.x,y:this.y,declaration:this.declaration.toJSON(),andChildrenGroup:((E=this.andChildrenGroup)==null?void 0:E.map(A=>A.toJSONClone({...i,newId:null})))||null,orChildrenGroup:((b=this.orChildrenGroup)==null?void 0:b.map(A=>A.toJSONClone({...i,newId:null})))||null,successCalls:this.successCalls.map(A=>A.toJSONClone({...i,newId:null})),errorCalls:this.errorCalls.map(A=>A.toJSONClone({...i,newId:null})),calledBySuccess:this.calledBySuccess.map(A=>A.toReference({seenEntityMaps:i.seenEntityMaps})),calledByError:this.calledByError.map(A=>A.toReference({seenEntityMaps:i.seenEntityMaps})),calledByEntry:this.calledByEntry.map(A=>A.toReference({seenEntityMaps:i.seenEntityMaps})),inputs:this.inputs.map(A=>A.toJSONClone({...i,newId:null})),parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=ke){var o;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+N.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=ke){var o,p,e;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,index:this.index,x:this.x,y:this.y,declaration:this.declaration.toReference(i),andChildrenGroup:((p=this.andChildrenGroup)==null?void 0:p.map(y=>y.toReference(i)))||null,orChildrenGroup:((e=this.orChildrenGroup)==null?void 0:e.map(y=>y.toReference(i)))||null,inputs:this.inputs.map(y=>y.toReference(i)),successCalls:this.successCalls.map(y=>y.toReference(i)),errorCalls:this.errorCalls.map(y=>y.toReference(i)),calledBySuccess:this.calledBySuccess.map(y=>y.toReference(i)),calledByError:this.calledByError.map(y=>y.toReference(i)),calledByEntry:this.calledByEntry.map(y=>y.toReference(i)),parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var o,p;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((o=this.andChildrenGroup)==null?void 0:o.flatMap(e=>e.toFlatJSON(i)))||[],...((p=this.orChildrenGroup)==null?void 0:p.flatMap(e=>e.toFlatJSON(i)))||[],...this.inputs.flatMap(e=>e.toFlatJSON(i)),...this.successCalls.flatMap(e=>e.toFlatJSON(i)),...this.errorCalls.flatMap(e=>e.toFlatJSON(i)),...this.calledBy.flatMap(e=>e.toFlatJSON(i))])}toGenerationTarget(){const i=this.parent.type===f.Project?void 0:this.parent.id;return{id:this.id,type:this.type,declaration:this.declaration.id,calledByEntry:this.calledByEntry.map(a=>a.id),calledBySuccess:this.calledBySuccess.map(a=>a.id),calledByError:this.calledByError.map(a=>a.id),parent:i}}toFlatGenerationTarget(i=new Set){var o,p;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((o=this.andChildrenGroup)==null?void 0:o.flatMap(e=>e.toFlatGenerationTarget(i)))||[],...((p=this.orChildrenGroup)==null?void 0:p.flatMap(e=>e.toFlatGenerationTarget(i)))||[],...this.inputs.flatMap(e=>e.toFlatGenerationTarget(i)),...this.successCalls.flatMap(e=>e.toFlatGenerationTarget(i)),...this.errorCalls.flatMap(e=>e.toFlatGenerationTarget(i))])}clearErrors(){var i,a;return this.errors=[],(i=this.andChildrenGroup)==null||i.forEach(o=>o.clearErrors()),(a=this.orChildrenGroup)==null||a.forEach(o=>o.clearErrors()),this.inputs.forEach(o=>o.clearErrors()),this.successCalls.forEach(o=>o.clearErrors()),this.errorCalls.forEach(o=>o.clearErrors()),this}validate(){const i=pj(this);return this.errors=i,{success:!0}}getErrors(){return[...this.errors,...this.inputs.flatMap(a=>a.getErrors())]}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"clone-entity")),a=null,o=null,p=!0){var F,K,Z;let e=Sr(a,this);const y=this.toJSON(),v=o||N.UUID.uuid();y.inputs=[];const E=v.split("-id"),b=E[E.length-1||0]||v;y.id=v,y.version=N.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||L().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1;const A=dr(y,e);a?A.setParent(a,null):A.setParent(this.parent,null),p&&A.subscribe(),A.initChildren(i),i==null||i.add(A,S.Added);const $=(F=this.andChildrenGroup)==null?void 0:F.map(ie=>ie.clone(i,A,N.UUID.uuid(),p)),V=(K=this.orChildrenGroup)==null?void 0:K.map(ie=>ie.clone(i,A,N.UUID.uuid(),p));A.andChildrenGroup=$||null,A.orChildrenGroup=V||null;const B=(Z=this.inputs)==null?void 0:Z.map((ie,X)=>ie.clone(i,A,b+"-input-map-"+X+"-id",p));return A.inputs=B,i==null||i.attemptAutoclose("clone-entity",this.id),A}addToAndGroup(i){return this.andChildrenGroup||(this.andChildrenGroup=[]),this.andChildrenGroup.includes(i)||this.andChildrenGroup.push(i),this}addToOrGroup(i){return this.orChildrenGroup||(this.orChildrenGroup=[]),this.orChildrenGroup.includes(i)||this.orChildrenGroup.push(i),this}removeUnrecognizedInputs(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-unrecognized-inputs"))){const a=[],o=[],p=[],e=[];return this.inputs.forEach(v=>{if(!this.declaration.inputs.find(b=>{var A;return b.id===((A=v.declaration)==null?void 0:A.id)})){const b=v.remove({ignoreUpstream:!1},i);p.push(...b.removed),a.push(...b.updated)}}),this.inputs.filter((v,E)=>{const b=this.inputs.findIndex($=>$.declaration===v.declaration&&$!==v);if(b===-1)return!1;const A=this.inputs[b];return L(A==null?void 0:A.createdAt).isSame(L(v.createdAt))?E>b:!!L(A==null?void 0:A.createdAt).isAfter(v.createdAt)}).forEach(v=>{const E=v.remove({ignoreUpstream:!1},i);p.push(...E.removed),a.push(...E.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-inputs",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncInputs(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-missing-fixed-inputs"))){const a=[],o=[],p=[],e=[],y=this.declaration.inputs.filter(A=>A.parentRelationType===oe.FixedArguments&&!this.inputs.find($=>$.declaration.id===A.id));this.inputs.sort((A,$)=>A.index-$.index),y.forEach(A=>{this.inputs.forEach(B=>{B.index>=A.index&&B.metaSync({index:B.index+1},i)});const $={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.InputMap,declaration:A.toJSON(),readsValue:null,defaultValue:null,index:A.index,name:null,codeName:null,description:null,parent:this.toReference()},V=te($,this.project);V.setParent(this,i),V.initChildren(i),i==null||i.add(V,S.Added),V.addSelfToProject(i)}),this.inputs.sort((A,$)=>A.index-$.index);const{updated:v,added:E,removed:b}=this.removeUnrecognizedInputs(i);return a.push(...v),o.push(...E),p.push(...b),i==null||i.attemptAutoclose("sync-missing-fixed-inputs",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}getUnusedInputs(){return this.inputs.filter(i=>i.suggestion||!i.readsValue&&!i.defaultValue)}getUnusedOutputs(){return[]}getUsedInputs(){return this.inputs.filter(i=>!i.suggestion&&(i.readsValue||i.defaultValue))}getUsedOutputs(){return[]}};g(Xt,"repository",{APICreate:async(i,...a)=>i,APIUpdate:async(i,...a)=>i,APIDelete:async(i,...a)=>i,APIClone:async(i,...a)=>{},APILoad:async(i,...a)=>null,APILoadVersion:async(i,a,...o)=>null}),g(Xt,"type",f.Condition),g(Xt,"USER_MANAGED_PARENT_TYPES",[...Br,f.Project,f.Condition]),g(Xt,"PARENT_TYPES",[...Xt.USER_MANAGED_PARENT_TYPES]),g(Xt,"MUTABLE_BASE_PROPERTIES",["operator"]),g(Xt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion","index"]),g(Xt,"BASE_PROPERTIES",[...Xt.MUTABLE_BASE_PROPERTIES,...Xt.INMUTABLE_BASE_PROPERTIES]),g(Xt,"MUTABLE_META_PROPERTIES",["x","y"]),g(Xt,"INMUTABLE_META_PROPERTIES",[...Xt.INMUTABLE_BASE_PROPERTIES]),g(Xt,"META_PROPERTIES",[...Xt.MUTABLE_META_PROPERTIES,...Xt.INMUTABLE_META_PROPERTIES]),g(Xt,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","parent"]),g(Xt,"INMUTABLE_UPSTREAM_PROPERTIES",[]),g(Xt,"UPSTREAM_PROPERTIES",[...Xt.MUTABLE_UPSTREAM_PROPERTIES,...Xt.INMUTABLE_UPSTREAM_PROPERTIES]),g(Xt,"MUTABLE_DOWNSTREAM_PROPERTIES",["andChildrenGroup","orChildrenGroup","successCalls","errorCalls","inputsDeclarations","inputs"]),g(Xt,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),g(Xt,"DOWNSTREAM_PROPERTIES",[...Xt.MUTABLE_DOWNSTREAM_PROPERTIES,...Xt.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(Xt,"PROPERTIES",[...Xt.META_PROPERTIES,...Xt.UPSTREAM_PROPERTIES,...Xt.DOWNSTREAM_PROPERTIES]);let ho=Xt;function hj(d){var y;const u=u0e(),i=d.toJSON();u.safeParse(i).success,(y=d.dataType)==null||y.validate(),d.inputs.forEach(v=>v.validate()),d.outputs.forEach(v=>v.validate()),d.internalCalls.forEach(v=>v.validate());const p=[...Ka(d),...go(d),...yj(d)],e=xb(d);return p.push(...e),Er(d.errors,p)}function yj(d){const u=[],i=d.name;if(!i){const $=mt({id:`${d.id}--${ae.EmptyName}`,message:`Variable declaration "${ne(d,d.project)}" with id "${d.id}" does not have a name. Entities of type ${d.type} must have valid names.`,severity:q.Error,code:ae.EmptyName,entity:d});return u.push($.error),u}const o=[...d.project.functions,...d.project.entities.flatMap($=>$.methods)].filter($=>$.id!==d.id),p=i.trim(),e=!o.some($=>$.name===i||$.name===p);if(!e){const $=mt({id:`${d.id}--${ae.NameNotUniqueInScope}`,message:`Variable declaration "${ne(d,d.project)}" with id "${d.id}" does not have a unique name. Entities of type ${d.type} must have valid names among all other entities of its type.`,severity:q.Error,code:ae.NameNotUniqueInScope,entity:d});u.push($.error)}const y=jr(i);if(!!o.some($=>jr($.name)===y)&&e){const $=mt({id:`${d.id}--${ae.NameAsResolvedCodeNameNotUniqueInScope}`,message:`Variable declaration "${ne(d,d.project)}" with id "${d.id}" does not have a unique name once it is resolved as it will appear in code: "${y}". Entities of type ${d.type} must have valid names including their code name form.`,severity:q.Error,code:ae.NameAsResolvedCodeNameNotUniqueInScope,entity:d});u.push($.error)}if(!/^[a-zA-Z_]/.test(i)){const $=mt({id:`${d.id}--${ae.NameMustStartWithLetterOrUnderscore}`,message:`Variable declaration "${ne(d,d.project)}" with id "${d.id}" has a name that does not start with a letter or underscore.`,severity:q.Error,code:ae.NameMustStartWithLetterOrUnderscore,entity:d});u.push($.error)}const b=i.substring(1);if(!/^[a-zA-Z0-9_ ]*$/.test(b)){const $=mt({id:`${d.id}--${ae.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces}`,message:`Variable declaration "${ne(d,d.project)}" with id "${d.id}" has a name that contains invalid characters. It can only contain letters, numbers, underscores and spaces.`,severity:q.Error,code:ae.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces,entity:d});u.push($.error)}return u}const Q0e=Object.freeze(Object.defineProperty({__proto__:null,validate:hj,validateVariableDeclarationName:yj},Symbol.toStringTag,{value:"Module"}));function mj(d){const u=Lme(),i=d.toJSON();u.safeParse(i).success,d.inputs.forEach(y=>y.validate()),d.outputs.forEach(y=>y.validate()),d.internalCalls.forEach(y=>y.validate());const p=[...Ka(d),...go(d)],e=xb(d);return p.push(...e),Er(d.errors,p)}const eve=Object.freeze(Object.defineProperty({__proto__:null,validate:mj},Symbol.toStringTag,{value:"Module"}));var IA=(d=>(d.Parent="parent",d.DataTypeEntity="data-type-entity",d.VarDeclaration="var-declaration",d))(IA||{});const Gt=class Gt extends Nr{constructor(i,a){super(i);g(this,"initialData");g(this,"id");g(this,"x");g(this,"y");g(this,"type",f.VariableInstance);g(this,"defaultValue",null);g(this,"writesValues",[]);g(this,"readsValue",null);g(this,"declaration");g(this,"inputs",[]);g(this,"outputs",[]);g(this,"calledBySuccess",[]);g(this,"calledByError",[]);g(this,"calledByEntry",[]);g(this,"successCalls",[]);g(this,"errorCalls",[]);g(this,"internalCalls",[]);g(this,"project");g(this,"errors",[]);g(this,"parent");g(this,"detachedDependents",{});g(this,"knownVersions",null);g(this,"activeVersion",!1);g(this,"initialized",!1);g(this,"startedInitialization",!1);g(this,"suggestion",!1);g(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=a,this.id=i.id,this.x=i.x,this.y=i.y}static new(i=null){return{id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.VariableInstance,declaration:null,internalCalls:[],successCalls:[],errorCalls:[],readsValue:null,writesValues:[],defaultValue:null,inputs:[],outputs:[],parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],x:0,y:0}}static fromGenerationTarget(i,a){let o=a;if(i.parent){const V=H(i.parent);o=a.get(V)}const p=H(i.declaration),e=a.get(p),y=i.calledByEntry.map(V=>{const B=H(V);return a.get(B)}),v=i.calledBySuccess.map(V=>{const B=H(V);return a.get(B)}),E=i.calledByError.map(V=>{const B=H(V);return a.get(B)});let b=null;if(i.readsValue){const V=H(i.readsValue);b=a.get(V)}const A={id:i.id,version:N.UUID.uuid(),createdAt:L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.VariableInstance,declaration:e.toReference(),calledByEntry:y,calledBySuccess:v,calledByError:E,defaultValue:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:b,inputs:[],outputs:[],writesValues:[],x:0,y:0,parent:o},$=te(A,a);return $.setParent(o,null),$}static validateGenerationTarget(i,a){let o=JSON.parse(JSON.stringify(i));const p=[],e=li(o,{parent:{list:!1,types:[...Br,f.Project],optional:!0},declaration:{list:!1,types:[f.VariableDeclaration]}},a);return o=e.modifiedData,p.push(...e.errors,...Ur(o)),{errors:p,modifiedData:o}}get codeName(){var i;return(i=this.declaration)==null?void 0:i.codeName}get codeNativeValueValidation(){var i;return this._codeNativeValueValidation||((i=this.declaration)==null?void 0:i.codeNativeValueValidation)||null}validateGeneratedUpdate(i){const a=[];let o=JSON.parse(JSON.stringify(i));const p=sf(o,this);return o=p.modifiedData,a.push(...p.errors),i.parent&&a.push(new ee({id:`${this.id}--${k.InvalidParentUpdate}`,code:k.InvalidParentUpdate,severity:q.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
|
|
79
|
+
If an entity is called by another, they must be in the same scope, which means they have the same parent.`})),{errors:a,modifiedData:i}}subscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-dependents"))){const a=[],o=[],p=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),o.push(...v.added),p.push(...v.removed),e.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}onDetachedDependencyRemoved(i,a,o){const p=[],e=[],y=[],v=[];if(a==="parent"){const{updated:E,added:b,removed:A}=this.remove({ignoreUpstream:!1},o);p.push(...E),e.push(...b),y.push(...A)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,o){const p=[],e=[],y=[],v=[];if(a==="parent"){const{updated:E,added:b,removed:A}=this.restore({},o);p.push(...E),e.push(...b),y.push(...A)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){return this.parent.unsubscribeDependents([{entity:this,field:"parent"}]),this}subscribeToDependencies(){var i;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"parent"}]),this}increaseVersion(i){if(i&&!L(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&L(i).isSame(L(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=L(i).toISOString()||L().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new Xt(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.inputs=[...this.inputs],i.declaration=this.declaration,i.andChildrenGroup=this.andChildrenGroup?[...this.andChildrenGroup]:this.andChildrenGroup,i.orChildrenGroup=this.orChildrenGroup?[...this.orChildrenGroup]:this.orChildrenGroup,i.successCalls=[...this.successCalls],i.errorCalls=[...this.errorCalls],i.calledBySuccess=[...this.calledBySuccess],i.calledByError=[...this.calledByError],i.calledByEntry=[...this.calledByEntry],i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const a=[],o=[],p=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),o.push(...y.added),p.push(...y.removed)}return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}async restoreVersion(i){var v;const a=[],o=[],p=[],e=[];if(this.version===i)return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[$,V]of A.knownVersions)E.set($,V);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new Xt(E,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.inputs=y.inputs,this.declaration=y.declaration,this.andChildrenGroup=y.andChildrenGroup,this.orChildrenGroup=y.orChildrenGroup,this.successCalls=y.successCalls,this.errorCalls=y.errorCalls,this.calledBySuccess=y.calledBySuccess,this.calledByError=y.calledByError,this.calledByEntry=y.calledByEntry,this.parent=y.parent,{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"update-with-shallow-transfer"))){if(this.metaSync(i,a),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,i.parent){const o=H(i.parent),p=this.project.get(o),e=this.parent;if(e&&e.id!==(p==null?void 0:p.id)&&this.removeFromParent(a),p)this.setParent(p,a),this.addSelfToProject(a);else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${o}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.declaration){const o=H(i.declaration),p=this.project.get(o);p&&this.setDeclaration(p)}return i.andChildrenGroup&&(this.andChildrenGroup=i.andChildrenGroup.map(o=>{const p=H(o),e=this.project.get(p);if(e&&!(e.type===f.Condition&&e.parent===this))return e}).filter(o=>!!o)),i.orChildrenGroup&&(this.orChildrenGroup=i.orChildrenGroup.map(o=>{const p=H(o),e=this.project.get(p);if(e&&!(e.type===f.Condition&&e.parent===this))return e}).filter(o=>!!o)),i.calledByEntry.forEach(o=>{const p=H(o),e=this.project.get(p);e&&(this.addEntryCaller(e,a),e.addCall(this,a))}),[...this.calledByEntry].forEach(o=>{i.calledByEntry.find(e=>H(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),i.calledBySuccess.forEach(o=>{const p=H(o),e=this.project.get(p);e&&(this.addSuccessCaller(e,a),e.addSuccessCall(this,a))}),[...this.calledBySuccess].forEach(o=>{i.calledBySuccess.find(e=>H(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),i.calledByError.forEach(o=>{const p=H(o),e=this.project.get(p);e&&(this.addErrorCaller(e,a),e.addErrorCall(this,a))}),[...this.calledBySuccess].forEach(o=>{i.calledBySuccess.find(e=>H(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const i=[],a=[],o=[],p=[];if(this.initialData.parent){const e=H(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' 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 e=H(this.initialData.declaration),y=this.project.get(e);y&&(this.setDeclaration(y),i.push(y))}return this.initialData.calledByEntry.forEach(e=>{const y=H(e),v=this.project.get(y);v&&this.addEntryCaller(v,null)}),this.initialData.calledBySuccess.forEach(e=>{const y=H(e),v=this.project.get(y);v&&this.addSuccessCaller(v,null)}),this.initialData.calledByError.forEach(e=>{const y=H(e),v=this.project.get(y);v&&this.addErrorCaller(v,null)}),{updated:R(i),added:R(a),removed:R(o),affected:R(p),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],o=[],p=[],e=[];this.initialized=!0;const{updated:y,added:v,removed:E}=this.syncInputs(i);return a.push(...y),o.push(...v),p.push(...E),this.captureVersion(),i==null||i.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-self-to-project"))){const a=[this],o=[],p=[],e=[];return this.parent===this.project?this.project.addCondition(this):this.parent.type===f.Condition&&(this.parent.declaration.id===Mr.And?this.parent.addToAndGroup(this):this.parent.declaration.id===Mr.Or&&this.parent.addToOrGroup(this)),this.successCalls.forEach(y=>{y.addSuccessCaller(this,i),a.push(y)}),this.errorCalls.forEach(y=>{y.addErrorCaller(this,i),a.push(y)}),this.calledByEntry.forEach(y=>{y.addCall(this,i),a.push(y)}),this.calledBySuccess.forEach(y=>{y.addSuccessCall(this,i),a.push(y)}),this.calledByError.forEach(y=>{y.addErrorCall(this,i),a.push(y)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-input"))){const o=this.inputs.findIndex(p=>p.id===i.id);return o>-1&&(this.inputs.splice(o,1),a&&(a==null||a.add(this,S.Affected))),a==null||a.attemptAutoclose("remove-input",this.id),this}addInput(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-input"))){return this.inputs.includes(i)?(a==null||a.attemptAutoclose("add-input",this.id),this):(this.inputs.push(i),a==null||a.add(this,S.Affected),a==null||a.attemptAutoclose("add-input",this.id),this)}addOutput(i){return this}removeOutput(i){return this}addSuccessCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-success-caller")),o=!1){return this.calledBySuccess.find(p=>p.id===i.id)||(this.calledBySuccess.push(i),a==null||a.add(this,S.Updated),o&&We(this,a)),a==null||a.attemptAutoclose("add-success-caller",this.id),this}addErrorCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-error-caller")),o=!1){return this.calledByError.find(p=>p.id===i.id)||(this.calledByError.push(i),a==null||a.add(this,S.Updated),o&&We(this,a)),a==null||a.attemptAutoclose("add-error-caller",this.id),this}addEntryCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-entry-caller")),o=!1){return this.calledByEntry.find(p=>p.id===i.id)||(this.calledByEntry.push(i),a==null||a.add(this,S.Updated),o&&We(this,a)),a==null||a.attemptAutoclose("add-entry-caller",this.id),this}addErrorCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-error-call")),o=!1){return this.errorCalls.find(p=>p.id===i.id)||(this.errorCalls.push(i),o&&We(this,a),a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("add-error-call",this.id),this}addSuccessCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-success-call")),o=!1){return this.successCalls.find(p=>p.id===i.id)||(this.successCalls.push(i),o&&We(this,a),a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("add-success-call",this.id),this}removeCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-call")),o=!1){const p=this.successCalls.findIndex(y=>y.id===i.id);p>-1&&(this.successCalls.splice(p,1),a==null||a.add(this,S.Affected));const e=this.errorCalls.findIndex(y=>y.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),a==null||a.add(this,S.Affected)),o&&We(this,a),a==null||a.attemptAutoclose("remove-call",this.id),this}removeCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-caller")),o=!1){return this.calledBySuccess=this.calledBySuccess.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),this.calledByError=this.calledByError.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),o&&We(this,a),a==null||a.attemptAutoclose("remove-caller",this.id),this}setParent(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-parent"))){var o;return((o=this.parent)==null?void 0:o.id)!==(i==null?void 0:i.id)&&(this.parent=i,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-parent",this.id),this}removeChildGroup(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-child-group"))){if(this.andChildrenGroup){const o=this.andChildrenGroup.findIndex(p=>p.id===i.id);o!==-1&&(this.andChildrenGroup.splice(o,1),a==null||a.add(this,S.Updated))}if(this.orChildrenGroup){const o=this.orChildrenGroup.findIndex(p=>p.id===i.id);o!==-1&&(this.orChildrenGroup.splice(o,1),a==null||a.add(this,S.Updated))}return a==null||a.attemptAutoclose("remove-child-group",this.id),this}setDeclaration(i){return this.declaration=i,this}initChildren(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.declaration=te(this.initialData.declaration,this.project),this.initialData.andChildrenGroup&&(this.andChildrenGroup=this.initialData.andChildrenGroup.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),o})),this.initialData.orChildrenGroup&&(this.orChildrenGroup=this.initialData.orChildrenGroup.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),o})),this.successCalls=this.initialData.successCalls.map(a=>{const o=te(a,this.project);if(o.addSuccessCaller(this),[f.BreakStatement,f.ContinueStatement].includes(o.type))o.setParent(this.parent.parent,null),o.initChildren(i);else if(o.type===f.ReturnStatement){const p=Yr(this,this.project);o.setParent(p,null),o.initChildren(i)}else o.type!==f.InternalCall&&(o.setParent(this.parent,null),o.initChildren(i));return o}),this.errorCalls=this.initialData.errorCalls.map(a=>{const o=te(a,this.project);if(o.addErrorCaller(this),[f.BreakStatement,f.ContinueStatement].includes(o.type))o.setParent(this.parent.parent,null),o.initChildren(i);else if(o.type===f.ReturnStatement){const p=Yr(this,this.project);o.setParent(p,null),o.initChildren(i)}else o.type!==f.InternalCall&&(o.setParent(this.parent,null),o.initChildren(i));return o}),this.inputs=this.initialData.inputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),o}),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"meta-sync"))){const o=xr(this,i),p=this.toMeta();return this.x=i.x!==void 0?i.x:p.x,this.y=i.y!==void 0?i.y:p.y,this.index=i.index!==void 0?i.index:p.index,super.metaSync(i),i.deleted===!0&&!p.deleted?a==null||a.add(this,S.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,S.Added):o&&(a==null||a.add(this,S.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ve,...a){return await Xt.repository.APILoad(this.id,...a),this}async APICreate(i=ve,...a){return await Xt.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ve,...a){return await Xt.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ve,...a){return await Xt.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ve,...a){return await Xt.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ve,a,...o){return await Xt.repository.APILoadVersion(this.id,a,...o)}removeFromParent(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-from-parent"))){var y;const a=[],o=[],p=[],e=[];return this.parent.type===f.Project?(this.parent.removeCondition(this),e.push(this.parent)):((y=this.parent)==null?void 0:y.type)===f.Condition?this.parent.removeChildGroup(this):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose("remove-from-parent",this.id),{added:R(p),updated:R(a),removed:R(o),affected:R(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-entity"))){const o=[],p=[],e=[],y=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(p.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:A}=v.entity.onDetachedDependencyRemoved(this,v.field,a);o.push(...E),p.push(...b),e.push(...A)}),this.andChildrenGroup&&this.andChildrenGroup.forEach(v=>{const{removed:E,updated:b}=v.remove({ignoreUpstream:!0},a);p.push(...E),o.push(...b)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(v=>{const{removed:E,updated:b}=v.remove({ignoreUpstream:!0},a);p.push(...E),o.push(...b)}),this.inputs.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...b)}),this.successCalls.forEach(v=>{o.push(v),v.removeCaller(this,a)}),this.errorCalls.forEach(v=>{o.push(v),v.removeCaller(this,a)}),!i){const v=this.removeFromParent(a);e.push(...v.added),o.push(...v.updated),p.push(...v.removed),y.push(...v.affected),this.calledBy.forEach(E=>{o.push(E),E.removeCall(this,a)})}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:R(e),updated:R(o),removed:R(p),affected:R(y),self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"restore-entity"))){const a=[],o=[],p=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(y=>{const{updated:v,removed:E,added:b}=y.entity.onDetachedDependencyRestored(this,y.field,i);o.push(...v),p.push(...E),a.push(...b)}),this.andChildrenGroup&&this.andChildrenGroup.forEach(y=>{const{updated:v,added:E}=y.restore({},i);o.push(...v),a.push(...E)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(y=>{const{updated:v,added:E}=y.restore({},i);o.push(...v),a.push(...E)}),this.inputs.forEach(y=>{const{updated:v}=y.restore({},i);o.push(...v)}),this.successCalls.forEach(y=>{o.push(y),y.addSuccessCaller(this,i)}),this.errorCalls.forEach(y=>{o.push(y),y.addErrorCaller(this,i)}),this.calledBySuccess.forEach(y=>{o.push(y),y.addSuccessCall(this,i)}),this.calledByError.forEach(y=>{o.push(y),y.addErrorCall(this,i)}),this.calledByEntry.forEach(y=>{o.push(y),y.addCall(this,i)}),this.parent.type===f.Project&&this.project.addCondition(this),i==null||i.attemptAutoclose("restore-entity",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this})}toFlat(i=new Set){var o,p;return i.has(this.id)?[]:(i.add(this.id),[this,...((o=this.andChildrenGroup)==null?void 0:o.flatMap(e=>e.toFlat(i)))||[],...((p=this.orChildrenGroup)==null?void 0:p.flatMap(e=>e.toFlat(i)))||[],...this.inputs.flatMap(e=>e.toFlat(i)),...this.successCalls.flatMap(e=>e.toFlat(i)),...this.errorCalls.flatMap(e=>e.toFlat(i)),...this.calledBy.flatMap(e=>e.toFlat(i))])}toFlatIds(i=new Set){var o,p;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((o=this.andChildrenGroup)==null?void 0:o.flatMap(e=>e.toFlatIds(i)))||[],...((p=this.orChildrenGroup)==null?void 0:p.flatMap(e=>e.toFlatIds(i)))||[],...this.inputs.flatMap(e=>e.toFlatIds(i)),...this.successCalls.flatMap(e=>e.toFlatIds(i)),...this.errorCalls.flatMap(e=>e.toFlatIds(i)),...this.calledBy.flatMap(e=>e.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,index:this.index,x:this.x,y:this.y,type:this.type}}toJSON(i=new Set){var a,o;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,index:this.index,x:this.x,y:this.y,declaration:this.declaration.toJSON(i),andChildrenGroup:((a=this.andChildrenGroup)==null?void 0:a.map(p=>p.toJSON(i)))||null,orChildrenGroup:((o=this.orChildrenGroup)==null?void 0:o.map(p=>p.toJSON(i)))||null,successCalls:this.successCalls.map(p=>p.toJSON(i)),errorCalls:this.errorCalls.map(p=>p.toJSON(i)),calledBySuccess:this.calledBySuccess.map(p=>p.toReference()),calledByError:this.calledByError.map(p=>p.toReference()),calledByEntry:this.calledByEntry.map(p=>p.toReference()),inputs:this.inputs.map(p=>p.toJSON(i)),parent:this.parent.toReference()})}toJSONClone(i=ke){var o,p,e,y,v,E,b;let a;return(o=i.seenEntityMaps)!=null&&o.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||Kr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(p=i.seenEntities)!=null&&p.has(a)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(a),(v=i.seenEntities)==null||v.add(this.id),{id:a,version:N.UUID.uuid(),createdAt:i.timestamp||L().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,index:this.index,x:this.x,y:this.y,declaration:this.declaration.toJSON(),andChildrenGroup:((E=this.andChildrenGroup)==null?void 0:E.map(A=>A.toJSONClone({...i,newId:null})))||null,orChildrenGroup:((b=this.orChildrenGroup)==null?void 0:b.map(A=>A.toJSONClone({...i,newId:null})))||null,successCalls:this.successCalls.map(A=>A.toJSONClone({...i,newId:null})),errorCalls:this.errorCalls.map(A=>A.toJSONClone({...i,newId:null})),calledBySuccess:this.calledBySuccess.map(A=>A.toReference({seenEntityMaps:i.seenEntityMaps})),calledByError:this.calledByError.map(A=>A.toReference({seenEntityMaps:i.seenEntityMaps})),calledByEntry:this.calledByEntry.map(A=>A.toReference({seenEntityMaps:i.seenEntityMaps})),inputs:this.inputs.map(A=>A.toJSONClone({...i,newId:null})),parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=ke){var o;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+N.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=ke){var o,p,e;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,index:this.index,x:this.x,y:this.y,declaration:this.declaration.toReference(i),andChildrenGroup:((p=this.andChildrenGroup)==null?void 0:p.map(y=>y.toReference(i)))||null,orChildrenGroup:((e=this.orChildrenGroup)==null?void 0:e.map(y=>y.toReference(i)))||null,inputs:this.inputs.map(y=>y.toReference(i)),successCalls:this.successCalls.map(y=>y.toReference(i)),errorCalls:this.errorCalls.map(y=>y.toReference(i)),calledBySuccess:this.calledBySuccess.map(y=>y.toReference(i)),calledByError:this.calledByError.map(y=>y.toReference(i)),calledByEntry:this.calledByEntry.map(y=>y.toReference(i)),parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var o,p;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((o=this.andChildrenGroup)==null?void 0:o.flatMap(e=>e.toFlatJSON(i)))||[],...((p=this.orChildrenGroup)==null?void 0:p.flatMap(e=>e.toFlatJSON(i)))||[],...this.inputs.flatMap(e=>e.toFlatJSON(i)),...this.successCalls.flatMap(e=>e.toFlatJSON(i)),...this.errorCalls.flatMap(e=>e.toFlatJSON(i)),...this.calledBy.flatMap(e=>e.toFlatJSON(i))])}toGenerationTarget(){const i=this.parent.type===f.Project?void 0:this.parent.id;return{id:this.id,type:this.type,declaration:this.declaration.id,calledByEntry:this.calledByEntry.map(a=>a.id),calledBySuccess:this.calledBySuccess.map(a=>a.id),calledByError:this.calledByError.map(a=>a.id),parent:i}}toFlatGenerationTarget(i=new Set){var o,p;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((o=this.andChildrenGroup)==null?void 0:o.flatMap(e=>e.toFlatGenerationTarget(i)))||[],...((p=this.orChildrenGroup)==null?void 0:p.flatMap(e=>e.toFlatGenerationTarget(i)))||[],...this.inputs.flatMap(e=>e.toFlatGenerationTarget(i)),...this.successCalls.flatMap(e=>e.toFlatGenerationTarget(i)),...this.errorCalls.flatMap(e=>e.toFlatGenerationTarget(i))])}clearErrors(){var i,a;return this.errors=[],(i=this.andChildrenGroup)==null||i.forEach(o=>o.clearErrors()),(a=this.orChildrenGroup)==null||a.forEach(o=>o.clearErrors()),this.inputs.forEach(o=>o.clearErrors()),this.successCalls.forEach(o=>o.clearErrors()),this.errorCalls.forEach(o=>o.clearErrors()),this}validate(){const i=pj(this);return this.errors=i,{success:!0}}getErrors(){return[...this.errors,...this.inputs.flatMap(a=>a.getErrors())]}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"clone-entity")),a=null,o=null,p=!0){var F,K,Z;let e=Sr(a,this);const y=this.toJSON(),v=o||N.UUID.uuid();y.inputs=[];const E=v.split("-id"),b=E[E.length-1||0]||v;y.id=v,y.version=N.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||L().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1;const A=dr(y,e);a?A.setParent(a,null):A.setParent(this.parent,null),p&&A.subscribe(),A.initChildren(i),i==null||i.add(A,S.Added);const $=(F=this.andChildrenGroup)==null?void 0:F.map(ie=>ie.clone(i,A,N.UUID.uuid(),p)),V=(K=this.orChildrenGroup)==null?void 0:K.map(ie=>ie.clone(i,A,N.UUID.uuid(),p));A.andChildrenGroup=$||null,A.orChildrenGroup=V||null;const B=(Z=this.inputs)==null?void 0:Z.map((ie,X)=>ie.clone(i,A,b+"-input-map-"+X+"-id",p));return A.inputs=B,i==null||i.attemptAutoclose("clone-entity",this.id),A}addToAndGroup(i){return this.andChildrenGroup||(this.andChildrenGroup=[]),this.andChildrenGroup.includes(i)||this.andChildrenGroup.push(i),this}addToOrGroup(i){return this.orChildrenGroup||(this.orChildrenGroup=[]),this.orChildrenGroup.includes(i)||this.orChildrenGroup.push(i),this}removeUnrecognizedInputs(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-unrecognized-inputs"))){const a=[],o=[],p=[],e=[];return this.inputs.forEach(v=>{if(!this.declaration.inputs.find(b=>{var A;return b.id===((A=v.declaration)==null?void 0:A.id)})){const b=v.remove({ignoreUpstream:!1},i);p.push(...b.removed),a.push(...b.updated)}}),this.inputs.filter((v,E)=>{const b=this.inputs.findIndex($=>$.declaration===v.declaration&&$!==v);if(b===-1)return!1;const A=this.inputs[b];return L(A==null?void 0:A.createdAt).isSame(L(v.createdAt))?E>b:!!L(A==null?void 0:A.createdAt).isAfter(v.createdAt)}).forEach(v=>{const E=v.remove({ignoreUpstream:!1},i);p.push(...E.removed),a.push(...E.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-inputs",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncInputs(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-missing-fixed-inputs"))){const a=[],o=[],p=[],e=[],y=this.declaration.inputs.filter(A=>A.parentRelationType===oe.FixedArguments&&!this.inputs.find($=>$.declaration.id===A.id));this.inputs.sort((A,$)=>A.index-$.index),y.forEach(A=>{this.inputs.forEach(B=>{B.index>=A.index&&B.metaSync({index:B.index+1},i)});const $={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.InputMap,declaration:A.toJSON(),readsValue:null,defaultValue:null,index:A.index,name:null,codeName:null,description:null,parent:this.toReference()},V=te($,this.project);V.setParent(this,i),V.initChildren(i),i==null||i.add(V,S.Added),V.addSelfToProject(i)}),this.inputs.sort((A,$)=>A.index-$.index);const{updated:v,added:E,removed:b}=this.removeUnrecognizedInputs(i);return a.push(...v),o.push(...E),p.push(...b),i==null||i.attemptAutoclose("sync-missing-fixed-inputs",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}getUnusedInputs(){return this.inputs.filter(i=>i.suggestion||!i.readsValue&&!i.defaultValue)}getUnusedOutputs(){return[]}getUsedInputs(){return this.inputs.filter(i=>!i.suggestion&&(i.readsValue||i.defaultValue))}getUsedOutputs(){return[]}};g(Xt,"repository",{APICreate:async(i,...a)=>i,APIUpdate:async(i,...a)=>i,APIDelete:async(i,...a)=>i,APIClone:async(i,...a)=>{},APILoad:async(i,...a)=>null,APILoadVersion:async(i,a,...o)=>null}),g(Xt,"type",f.Condition),g(Xt,"USER_MANAGED_PARENT_TYPES",[...Br,f.Project,f.Condition]),g(Xt,"PARENT_TYPES",[...Xt.USER_MANAGED_PARENT_TYPES]),g(Xt,"MUTABLE_BASE_PROPERTIES",["operator"]),g(Xt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion","index"]),g(Xt,"BASE_PROPERTIES",[...Xt.MUTABLE_BASE_PROPERTIES,...Xt.INMUTABLE_BASE_PROPERTIES]),g(Xt,"MUTABLE_META_PROPERTIES",["x","y"]),g(Xt,"INMUTABLE_META_PROPERTIES",[...Xt.INMUTABLE_BASE_PROPERTIES]),g(Xt,"META_PROPERTIES",[...Xt.MUTABLE_META_PROPERTIES,...Xt.INMUTABLE_META_PROPERTIES]),g(Xt,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","parent"]),g(Xt,"INMUTABLE_UPSTREAM_PROPERTIES",[]),g(Xt,"UPSTREAM_PROPERTIES",[...Xt.MUTABLE_UPSTREAM_PROPERTIES,...Xt.INMUTABLE_UPSTREAM_PROPERTIES]),g(Xt,"MUTABLE_DOWNSTREAM_PROPERTIES",["andChildrenGroup","orChildrenGroup","successCalls","errorCalls","inputsDeclarations","inputs"]),g(Xt,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),g(Xt,"DOWNSTREAM_PROPERTIES",[...Xt.MUTABLE_DOWNSTREAM_PROPERTIES,...Xt.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(Xt,"PROPERTIES",[...Xt.META_PROPERTIES,...Xt.UPSTREAM_PROPERTIES,...Xt.DOWNSTREAM_PROPERTIES]);let ho=Xt;function hj(d){var y;const u=u0e(),i=d.toJSON();u.safeParse(i).success,(y=d.dataType)==null||y.validate(),d.inputs.forEach(v=>v.validate()),d.outputs.forEach(v=>v.validate()),d.internalCalls.forEach(v=>v.validate());const p=[...Ka(d),...go(d),...yj(d)],e=xb(d);return p.push(...e),Er(d.errors,p)}function yj(d){const u=[],i=d.name;if(!i){const $=mt({id:`${d.id}--${ae.EmptyName}`,message:`Variable declaration "${ne(d,d.project)}" with id "${d.id}" does not have a name. Entities of type ${d.type} must have valid names.`,severity:q.Error,code:ae.EmptyName,entity:d});return u.push($.error),u}const o=[...d.project.functions,...d.project.entities.flatMap($=>$.methods)].filter($=>$.id!==d.id),p=i.trim(),e=!o.some($=>$.name===i||$.name===p);if(!e){const $=mt({id:`${d.id}--${ae.NameNotUniqueInScope}`,message:`Variable declaration "${ne(d,d.project)}" with id "${d.id}" does not have a unique name. Entities of type ${d.type} must have valid names among all other entities of its type.`,severity:q.Error,code:ae.NameNotUniqueInScope,entity:d});u.push($.error)}const y=jr(i);if(!!o.some($=>jr($.name)===y)&&e){const $=mt({id:`${d.id}--${ae.NameAsResolvedCodeNameNotUniqueInScope}`,message:`Variable declaration "${ne(d,d.project)}" with id "${d.id}" does not have a unique name once it is resolved as it will appear in code: "${y}". Entities of type ${d.type} must have valid names including their code name form.`,severity:q.Error,code:ae.NameAsResolvedCodeNameNotUniqueInScope,entity:d});u.push($.error)}if(!/^[a-zA-Z_]/.test(i)){const $=mt({id:`${d.id}--${ae.NameMustStartWithLetterOrUnderscore}`,message:`Variable declaration "${ne(d,d.project)}" with id "${d.id}" has a name that does not start with a letter or underscore.`,severity:q.Error,code:ae.NameMustStartWithLetterOrUnderscore,entity:d});u.push($.error)}const b=i.substring(1);if(!/^[a-zA-Z0-9_ ]*$/.test(b)){const $=mt({id:`${d.id}--${ae.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces}`,message:`Variable declaration "${ne(d,d.project)}" with id "${d.id}" has a name that contains invalid characters. It can only contain letters, numbers, underscores and spaces.`,severity:q.Error,code:ae.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces,entity:d});u.push($.error)}return u}const Q0e=Object.freeze(Object.defineProperty({__proto__:null,validate:hj,validateVariableDeclarationName:yj},Symbol.toStringTag,{value:"Module"}));function mj(d){const u=Lme(),i=d.toJSON();u.safeParse(i).success,d.inputs.forEach(y=>y.validate()),d.outputs.forEach(y=>y.validate()),d.internalCalls.forEach(y=>y.validate());const p=[...Ka(d),...go(d)],e=xb(d);return p.push(...e),Er(d.errors,p)}const eve=Object.freeze(Object.defineProperty({__proto__:null,validate:mj},Symbol.toStringTag,{value:"Module"}));var IA=(d=>(d.Parent="parent",d.DataTypeEntity="data-type-entity",d.VarDeclaration="var-declaration",d))(IA||{});const Gt=class Gt extends Nr{constructor(i,a){super(i);g(this,"initialData");g(this,"id");g(this,"x");g(this,"y");g(this,"type",f.VariableInstance);g(this,"defaultValue",null);g(this,"writesValues",[]);g(this,"readsValue",null);g(this,"declaration");g(this,"inputs",[]);g(this,"outputs",[]);g(this,"calledBySuccess",[]);g(this,"calledByError",[]);g(this,"calledByEntry",[]);g(this,"successCalls",[]);g(this,"errorCalls",[]);g(this,"internalCalls",[]);g(this,"project");g(this,"errors",[]);g(this,"parent");g(this,"detachedDependents",{});g(this,"knownVersions",null);g(this,"activeVersion",!1);g(this,"initialized",!1);g(this,"startedInitialization",!1);g(this,"suggestion",!1);g(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=a,this.id=i.id,this.x=i.x,this.y=i.y}static new(i=null){return{id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.VariableInstance,declaration:null,internalCalls:[],successCalls:[],errorCalls:[],readsValue:null,writesValues:[],defaultValue:null,inputs:[],outputs:[],parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],x:0,y:0}}static fromGenerationTarget(i,a){let o=a;if(i.parent){const V=H(i.parent);o=a.get(V)}const p=H(i.declaration),e=a.get(p),y=i.calledByEntry.map(V=>{const B=H(V);return a.get(B)}),v=i.calledBySuccess.map(V=>{const B=H(V);return a.get(B)}),E=i.calledByError.map(V=>{const B=H(V);return a.get(B)});let b=null;if(i.readsValue){const V=H(i.readsValue);b=a.get(V)}const A={id:i.id,version:N.UUID.uuid(),createdAt:L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.VariableInstance,declaration:e.toReference(),calledByEntry:y,calledBySuccess:v,calledByError:E,defaultValue:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:b,inputs:[],outputs:[],writesValues:[],x:0,y:0,parent:o},$=te(A,a);return $.setParent(o,null),$}static validateGenerationTarget(i,a){let o=JSON.parse(JSON.stringify(i));const p=[],e=li(o,{parent:{list:!1,types:[...Br,f.Project],optional:!0},declaration:{list:!1,types:[f.VariableDeclaration]}},a);return o=e.modifiedData,p.push(...e.errors,...Ur(o)),{errors:p,modifiedData:o}}get codeName(){var i;return(i=this.declaration)==null?void 0:i.codeName}get codeNativeValueValidation(){var i;return this._codeNativeValueValidation||((i=this.declaration)==null?void 0:i.codeNativeValueValidation)||null}validateGeneratedUpdate(i){const a=[];let o=JSON.parse(JSON.stringify(i));const p=sf(o,this);return o=p.modifiedData,a.push(...p.errors),i.parent&&a.push(new ee({id:`${this.id}--${k.InvalidParentUpdate}`,code:k.InvalidParentUpdate,severity:q.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
|
|
80
80
|
If an entity is called by another, they must be in the same scope, which means they have the same parent.
|
|
81
81
|
Specifically for variables, their scope is also calculated from their value readers and value writters.
|
|
82
82
|
You shouldn't have to manually update a 'parent' property. The equivalent result is to change its value readers, value writters, or callers.`})),{errors:a,modifiedData:o}}subscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-dependents"))){const a=[],o=[],p=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),o.push(...v.added),p.push(...v.removed),e.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}onDetachedDependencyRemoved(i,a,o){const p=[],e=[],y=[],v=[];if(a==="parent"){const{updated:E,added:b,removed:A}=this.remove({ignoreUpstream:!1},o);p.push(...E),e.push(...b),y.push(...A)}if(a==="var-declaration"){const{updated:E,added:b,removed:A}=this.remove({ignoreUpstream:!1},o);p.push(...E),e.push(...b),y.push(...A)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,o){const p=[],e=[],y=[],v=[];if(a==="parent"){const{updated:E,added:b,removed:A}=this.restore({},o);p.push(...E),e.push(...b),y.push(...A)}if(a==="var-declaration"){const{updated:E,added:b,removed:A}=this.restore({},o);p.push(...E),e.push(...b),y.push(...A)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){var i,a,o,p,e,y,v;return(a=(i=this.parent)==null?void 0:i.unsubscribeDependents)==null||a.call(i,[{entity:this,field:"parent"}]),(e=(p=(o=this.declaration.dataType)==null?void 0:o.entity)==null?void 0:p.unsubscribeDependents)==null||e.call(p,[{entity:this,field:"data-type-entity"}]),(v=(y=this.declaration)==null?void 0:y.unsubscribeDependents)==null||v.call(y,[{entity:this,field:"var-declaration"}]),this}subscribeToDependencies(){var i,a,o,p;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"parent"}]),(p=(o=(a=this.declaration.dataType)==null?void 0:a.entity)==null?void 0:o.subscribeDependents)==null||p.call(o,[{entity:this,field:"data-type-entity"}]),this.declaration.subscribeDependents([{entity:this,field:"var-declaration"}]),this}increaseVersion(i){if(i&&!L(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&L(i).isSame(L(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=L(i).toISOString()||L().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new Gt(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.inputs=[...this.inputs],i.outputs=[...this.outputs],i.internalCalls=[...this.internalCalls],i.successCalls=[...this.successCalls],i.errorCalls=[...this.errorCalls],i.writesValues=[...this.writesValues],i.readsValue=this.readsValue,i.defaultValue=this.defaultValue,i.declaration=this.declaration,i.calledBySuccess=[...this.calledBySuccess],i.calledByError=[...this.calledByError],i.calledByEntry=[...this.calledByEntry],i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const a=[],o=[],p=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),o.push(...y.added),p.push(...y.removed)}return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}async restoreVersion(i){var v;const a=[],o=[],p=[],e=[];if(this.version===i)return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[$,V]of A.knownVersions)E.set($,V);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new Gt(E,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.inputs=y.inputs,this.outputs=y.outputs,this.internalCalls=y.internalCalls,this.successCalls=y.successCalls,this.errorCalls=y.errorCalls,this.writesValues=y.writesValues,this.readsValue=y.readsValue,this.defaultValue=y.defaultValue,this.declaration=y.declaration,this.calledBySuccess=y.calledBySuccess,this.calledByError=y.calledByError,this.calledByEntry=y.calledByEntry,this.parent=y.parent,{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"update-with-shallow-transfer"))){if(this.metaSync(i,a),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent){const o=H(i.parent),p=this.project.get(o),e=this.parent;if(e&&e.id!==(p==null?void 0:p.id)&&this.removeFromParent(a),p)this.setParent(p,a);else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${o}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.readsValue){const o=H(i.readsValue),p=this.project.get(o),e=this.readsValue;e&&e.id!==(p==null?void 0:p.id)&&this.removeValueWriter(a),p&&this.setValueWriter(p,a)}if(i.declaration){const o=H(i.declaration),p=this.project.get(o);p&&this.setDeclaration(p)}return i.calledByEntry.forEach(o=>{const p=H(o),e=this.project.get(p);e&&(this.addEntryCaller(e,a),e.addCall(this,a))}),[...this.calledByEntry].forEach(o=>{i.calledByEntry.find(e=>H(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),i.calledBySuccess.forEach(o=>{const p=H(o),e=this.project.get(p);e&&(this.addSuccessCaller(e,a),e.addSuccessCall(this,a))}),[...this.calledBySuccess].forEach(o=>{i.calledBySuccess.find(e=>H(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),i.calledByError.forEach(o=>{const p=H(o),e=this.project.get(p);e&&(this.addErrorCaller(e,a),e.addErrorCall(this,a))}),[...this.calledBySuccess].forEach(o=>{i.calledBySuccess.find(e=>H(e)===o.id)||(this.removeCaller(o,a),o.removeCall(this,a))}),this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const i=[],a=[],o=[],p=[];if(this.initialData.parent){const e=H(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.readsValue){const e=H(this.initialData.readsValue),y=this.project.get(e);y&&(this.setValueWriter(y,null),i.push(y))}if(this.initialData.declaration){const e=H(this.initialData.declaration),y=this.project.get(e);y&&(this.setDeclaration(y),i.push(y))}return this.initialData.calledByEntry.forEach(e=>{const y=H(e),v=this.project.get(y);v&&this.addEntryCaller(v,null)}),this.initialData.calledBySuccess.forEach(e=>{const y=H(e),v=this.project.get(y);v&&this.addSuccessCaller(v,null)}),this.initialData.calledByError.forEach(e=>{const y=H(e),v=this.project.get(y);v&&this.addErrorCaller(v,null)}),{updated:R(i),added:R(a),removed:R(o),affected:R(p),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"after-all-children-initialized"))){var $e;const a=[],o=[],p=[],e=[];if(this.initialized=!0,!this.declaration.dataType||($e=this.declaration.dataType)!=null&&$e.inferred){const{added:Pe,updated:Ze,removed:Ge,affected:ut}=this.declaration.inferDataTypeAndSyncInstancesInputsAndOutputs(i);o.push(...Pe),a.push(...Ze),p.push(...Ge),e.push(...ut)}const{added:y,updated:v,removed:E,affected:b}=this.syncInputs(i);o.push(...y),a.push(...v),p.push(...E),e.push(...b);const{added:A,updated:$,removed:V,affected:B}=this.syncOutputs(i);o.push(...A),a.push(...$),p.push(...V),e.push(...B);const{added:F,updated:K,removed:Z,affected:ie}=this.generateUnusedInternalCalls(i);o.push(...F),a.push(...K),p.push(...Z),e.push(...ie);const{added:X,updated:ue,removed:re,affected:fe}=this.removeUnrecognizedInputs(i);o.push(...X),a.push(...ue),p.push(...re),e.push(...fe);const{added:Y,updated:J,removed:ce,affected:z}=this.removeUnrecognizedOutputs(i);o.push(...Y),a.push(...J),p.push(...ce),e.push(...z);const{added:de,updated:Ae,removed:je,affected:Ne}=this.removeUnrecognizedInternalCalls(i);return o.push(...de),a.push(...Ae),p.push(...je),e.push(...Ne),this.captureVersion(),i==null||i.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-self-to-project"))){const a=[this],o=[],p=[],e=[];return this.parent===this.project&&this.project.addVariableInstance(this),this.readsValue&&(this.readsValue.addValueReader(this,i),a.push(this.readsValue)),this.writesValues.forEach(y=>{y.setValueWriter(this,i),a.push(y)}),this.successCalls.forEach(y=>{y.addSuccessCaller(this,i),a.push(y)}),this.errorCalls.forEach(y=>{y.addErrorCaller(this,i),a.push(y)}),this.calledBySuccess.forEach(y=>{y.addSuccessCall(this,i),a.push(y)}),this.calledByError.forEach(y=>{y.addErrorCall(this,i),a.push(y)}),this.calledByEntry.forEach(y=>{y.addCall(this,i),a.push(y)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}get usedInputs(){return this.inputs.filter(i=>i.readsValue||i.defaultValue)}get unusedInputs(){return this.inputs.filter(i=>!i.readsValue&&!i.defaultValue)}get usedOutputs(){return this.outputs.filter(i=>i.writesValues.length)}get unusedOutputs(){return this.outputs.filter(i=>!i.writesValues.length)}get usedInternalCalls(){return this.internalCalls.filter(i=>!!i.calledBy.length)}get unusedInternalCalls(){const i=this.usedInternalCalls;return this.internalCalls.filter(o=>!(i.find(y=>y.id===o.id)||i.find(y=>y.declaration===o.declaration)))}removeInternalCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-variable-instance-internal-call"))){const o=this.internalCalls.findIndex(p=>p.id===i.id);return o>-1&&(this.internalCalls.splice(o,1),a&&(a==null||a.add(this,S.Affected))),a==null||a.attemptAutoclose("remove-variable-instance-internal-call",this.id),this}removeInput(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-input"))){const o=this.inputs.findIndex(p=>p.id===i.id);return o>-1&&(this.inputs.splice(o,1),a&&(a==null||a.add(this,S.Affected))),a==null||a.attemptAutoclose("remove-input",this.id),this}addInput(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-input"))){return this.inputs.includes(i)?(a==null||a.attemptAutoclose("add-input",this.id),this):(this.inputs.push(i),a==null||a.add(this,S.Affected),a==null||a.attemptAutoclose("add-input",this.id),this)}addOutput(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-output"))){return this.outputs.includes(i)?(a==null||a.attemptAutoclose("add-output",this.id),this):(this.outputs.push(i),a==null||a.add(this,S.Affected),a==null||a.attemptAutoclose("add-output",this.id),this)}removeOutput(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-output"))){const o=this.outputs.findIndex(p=>p.id===i.id);return o>-1&&(this.outputs.splice(o,1),a&&(a==null||a.add(this,S.Affected))),a==null||a.attemptAutoclose("remove-output",this.id),this}addSuccessCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-success-caller")),o=!1){return this.calledBySuccess.find(p=>p.id===i.id)||(this.calledBySuccess.push(i),a==null||a.add(this,S.Updated),o&&We(this,a)),a==null||a.attemptAutoclose("add-success-caller",this.id),this}addErrorCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-error-caller")),o=!1){return this.calledByError.find(p=>p.id===i.id)||(this.calledByError.push(i),a==null||a.add(this,S.Updated),o&&We(this,a)),a==null||a.attemptAutoclose("add-error-caller",this.id),this}addEntryCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-entry-caller")),o=!1){return this.calledByEntry.find(p=>p.id===i.id)||(this.calledByEntry.push(i),a==null||a.add(this,S.Updated),o&&We(this,a)),a==null||a.attemptAutoclose("add-entry-caller",this.id),this}addErrorCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-error-call")),o=!1){return this.errorCalls.find(p=>p.id===i.id)||(this.errorCalls.push(i),o&&We(this,a),a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("add-error-call",this.id),this}addSuccessCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-success-call")),o=!1){return this.successCalls.find(p=>p.id===i.id)||(this.successCalls.push(i),o&&We(this,a),a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("add-success-call",this.id),this}removeCall(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-call")),o=!1){const p=this.successCalls.findIndex(y=>y.id===i.id);p>-1&&(this.successCalls.splice(p,1),a==null||a.add(this,S.Affected));const e=this.errorCalls.findIndex(y=>y.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),a==null||a.add(this,S.Affected)),o&&We(this,a),a==null||a.attemptAutoclose("remove-call",this.id),this}removeCaller(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-caller")),o=!1){return this.calledBySuccess=this.calledBySuccess.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),this.calledByError=this.calledByError.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,S.Updated),a==null||a.add(p,S.Affected),!1)),o&&We(this,a),a==null||a.attemptAutoclose("remove-caller",this.id),this}addValueReader(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-value-reader"))){return this.writesValues.includes(i)?(a==null||a.attemptAutoclose("add-value-reader",this.id),this):(this.writesValues.push(i),a==null||a.add(this,S.Affected),this)}setParent(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-parent"))){var o;return((o=this.parent)==null?void 0:o.id)!==(i==null?void 0:i.id)&&(this.parent=i,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-parent",this.id),this}initChildren(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=te(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(i)),this.initialData.declaration.type===f.GenericReference){const a=this.project.findSubscribedInstanceFromReference(this.initialData.declaration);if(!a)return this;this.declaration=a}else this.declaration=te(this.initialData.declaration,this.project),this.declaration.initChildren(i);return mf.initWritesValues(this,this.parent),yf.initReadsValue(this),this.initialData.inputs.forEach(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),this.addInput(o,null),o}),this.initialData.outputs.forEach(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),this.addOutput(o,i),o}),this.successCalls=this.initialData.successCalls.map(a=>{const o=te(a,this.project);if(o.addSuccessCaller(this),[f.BreakStatement,f.ContinueStatement].includes(o.type))o.setParent(this.parent.parent,null),o.initChildren(i);else if(o.type===f.ReturnStatement){const p=Yr(this,this.project);o.setParent(p,null),o.initChildren(i)}else o.type!==f.InternalCall&&(o.setParent(this.parent,null),o.initChildren(i));return o}),this.errorCalls=this.initialData.errorCalls.map(a=>{const o=te(a,this.project);if(o.addErrorCaller(this),[f.BreakStatement,f.ContinueStatement].includes(o.type))o.setParent(this.parent.parent,null),o.initChildren(i);else if(o.type===f.ReturnStatement){const p=Yr(this,this.project);o.setParent(p,null),o.initChildren(i)}else o.type!==f.InternalCall&&(o.setParent(this.parent,null),o.initChildren(i));return o}),this.internalCalls=this.initialData.internalCalls.reduce((a,o)=>{if(o.type===f.GenericReference){const p=this.project.findSubscribedInstanceFromReference(o);if(!p)return a;const e=p;return e.setParent(this,null),[...a,e]}else{const p=te(o,this.project);return p.setParent(this,null),p.initChildren(i),[...a,p]}},[]),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this}setValueWriter(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-value-writer"))){return this.readsValue!==i&&(this.readsValue=i,a==null||a.add(this,S.Updated)),a==null||a.attemptAutoclose("set-value-writer",this.id),this}removeValueWriter(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-value-writer"))){return this.readsValue&&(this.readsValue=null,i==null||i.add(this,S.Updated)),i==null||i.attemptAutoclose("remove-value-writer",this.id),this}removeValueReader(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-value-reader"))){return this.writesValues.includes(i)?(this.writesValues=this.writesValues.filter(o=>o.id!==i.id),a==null||a.add(this,S.Affected),this):(a==null||a.attemptAutoclose("remove-value-reader",this.id),this)}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"meta-sync"))){const o=xr(this,i),p=this.toMeta();return this.x=i.x||p.x,this.y=i.y||p.y,super.metaSync(i),i.deleted===!0&&!p.deleted?a==null||a.add(this,S.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,S.Added):o&&(a==null||a.add(this,S.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ve,...a){return await Gt.repository.APILoad(this.id,...a),this}async APICreate(i=ve,...a){return await Gt.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ve,...a){return await Gt.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ve,...a){return await Gt.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ve,...a){return await Gt.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ve,a,...o){return await Gt.repository.APILoadVersion(this.id,a,...o)}removeFromParent(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-from-parent"))){const a=[],o=[],p=[],e=[];return this.parent.type===f.Project?(this.parent.removeVariableInstance(this),e.push(this.parent)):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose("remove-from-parent",this.id),{added:R(p),updated:R(a),removed:R(o),affected:R(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-entity"))){const o=[],p=[],e=[],y=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(p.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:A}=v.entity.onDetachedDependencyRemoved(this,v.field,a);o.push(...E),p.push(...b),e.push(...A)}),this.defaultValue){const{updated:v,removed:E}=this.defaultValue.remove({ignoreUpstream:!0},a);o.push(...v),p.push(...E)}if(this.readsValue&&(o.push(this.readsValue),this.readsValue.removeValueReader(this,a)),this.writesValues.forEach(v=>{o.push(v),v.setValueWriter(null,a)}),this.inputs.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...b)}),this.outputs.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...b)}),this.successCalls.forEach(v=>{o.push(v),v.removeCaller(this,a)}),this.errorCalls.forEach(v=>{o.push(v),v.removeCaller(this,a)}),this.internalCalls.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...b)}),!i){const v=this.removeFromParent(a);e.push(...v.added),o.push(...v.updated),p.push(...v.removed),y.push(...v.affected),this.calledBy.forEach(E=>{o.push(E),E.removeCall(this,a)})}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:R(e),updated:R(o),removed:R(p),affected:R(y),self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"restore-entity"))){const a=[],o=[],p=[],e=[];if(i!=null&&i.hasAdded(this.id))return i==null||i.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(y=>{const{updated:v,removed:E,added:b}=y.entity.onDetachedDependencyRestored(this,y.field,i);o.push(...v),p.push(...E),a.push(...b)}),this.defaultValue){const{updated:y}=this.defaultValue.restore({},i);o.push(...y)}return this.readsValue&&(o.push(this.readsValue),this.readsValue.addValueReader(this,i)),this.writesValues.forEach(y=>{o.push(y),y.setValueWriter(this,i)}),this.inputs.forEach(y=>{const{updated:v}=y.restore({},i);o.push(...v)}),this.outputs.forEach(y=>{const{updated:v}=y.restore({},i);o.push(...v)}),this.successCalls.forEach(y=>{o.push(y),y.addSuccessCaller(this,i)}),this.errorCalls.forEach(y=>{o.push(y),y.addErrorCaller(this,i)}),this.internalCalls.forEach(y=>{const{updated:v}=y.restore({},i);o.push(...v)}),this.calledBySuccess.forEach(y=>{o.push(y),y.addSuccessCall(this,i)}),this.calledByError.forEach(y=>{o.push(y),y.addErrorCall(this,i)}),this.calledByEntry.forEach(y=>{o.push(y),y.addCall(this,i)}),i==null||i.attemptAutoclose("restore-entity",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this}}toFlat(i=new Set){var o,p;return i.has(this.id)?[]:(i.add(this.id),[this,...((o=this.defaultValue)==null?void 0:o.toFlat(i))||[],...this.writesValues.flatMap(e=>e.toFlat(i)),...((p=this.readsValue)==null?void 0:p.toFlat(i))||[],...this.successCalls.flatMap(e=>e.toFlat(i)),...this.errorCalls.flatMap(e=>e.toFlat(i)),...this.inputs.flatMap(e=>e.toFlat(i)),...this.outputs.flatMap(e=>e.toFlat(i)),...this.internalCalls.flatMap(e=>e.toFlat(i))])}toFlatIds(i=new Set){var o;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((o=this.defaultValue)==null?void 0:o.toFlatIds(i))||[],...this.writesValues.flatMap(p=>p.toFlatIds(i)),...this.successCalls.flatMap(p=>p.toFlatIds(i)),...this.errorCalls.flatMap(p=>p.toFlatIds(i)),...this.inputs.flatMap(p=>p.toFlatIds(i)),...this.outputs.flatMap(p=>p.toFlatIds(i)),...this.internalCalls.flatMap(p=>p.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,x:this.x,y:this.y,type:this.type}}toJSON(i=new Set){var a,o;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,declaration:this.declaration.toJSON(i),defaultValue:((a=this.defaultValue)==null?void 0:a.toJSON(i))||null,readsValue:((o=this.readsValue)==null?void 0:o.toReference())||null,writesValues:this.writesValues.map(p=>p.toJSON(i)),inputs:this.inputs.map(p=>p.toJSON(i)),outputs:this.outputs.map(p=>p.toJSON(i)),successCalls:this.successCalls.map(p=>p.toJSON(i)),errorCalls:this.errorCalls.map(p=>p.toJSON(i)),internalCalls:this.internalCalls.map(p=>p.toJSON(i)),calledBySuccess:this.calledBySuccess.map(p=>p.toReference()),calledByError:this.calledByError.map(p=>p.toReference()),calledByEntry:this.calledByEntry.map(p=>p.toReference()),parent:this.parent.toReference(),x:this.x,y:this.y})}toJSONClone(i=ke){var o,p,e,y,v,E,b;let a;return(o=i.seenEntityMaps)!=null&&o.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||Kr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(p=i.seenEntities)!=null&&p.has(a)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(a),(v=i.seenEntities)==null||v.add(this.id),{id:a,version:N.UUID.uuid(),createdAt:i.timestamp||L().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,defaultValue:((E=this.defaultValue)==null?void 0:E.toJSONClone({...i,newId:null}))||null,declaration:this.declaration.toReference({seenEntityMaps:i.seenEntityMaps}),readsValue:((b=this.readsValue)==null?void 0:b.toReference({seenEntityMaps:i.seenEntityMaps}))||null,writesValues:this.writesValues.map(A=>A.toJSONClone({...i,newId:null})),inputs:this.inputs.map(A=>A.toJSONClone({...i,newId:null})),outputs:this.outputs.map(A=>A.toJSONClone({...i,newId:null})),successCalls:this.successCalls.map(A=>A.toJSONClone({...i,newId:null})),errorCalls:this.errorCalls.map(A=>A.toJSONClone({...i,newId:null})),internalCalls:this.internalCalls.map(A=>this.calledBy.length||this.readsValue?A.toJSONClone({...i,newId:null}):A.toReference({seenEntityMaps:i.seenEntityMaps})),calledBySuccess:this.calledBySuccess.map(A=>A.toReference({seenEntityMaps:i.seenEntityMaps})),calledByError:this.calledByError.map(A=>A.toReference({seenEntityMaps:i.seenEntityMaps})),calledByEntry:this.calledByEntry.map(A=>A.toReference({seenEntityMaps:i.seenEntityMaps})),parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps}),x:this.x,y:this.y})}toReference(i=ke){var o;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+N.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=ke){var o,p,e,y;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,defaultValue:((p=this.defaultValue)==null?void 0:p.toReference(i))||null,declaration:((e=this.declaration)==null?void 0:e.toReference(i))||null,readsValue:((y=this.readsValue)==null?void 0:y.toReference(i))||null,writesValues:this.writesValues.map(v=>v.toReference(i)),inputs:this.inputs.map(v=>v.toReference(i)),outputs:this.outputs.map(v=>v.toReference(i)),successCalls:this.successCalls.map(v=>v.toReference(i)),errorCalls:this.errorCalls.map(v=>v.toReference(i)),calledBySuccess:this.calledBySuccess.map(v=>v.toReference(i)),calledByError:this.calledByError.map(v=>v.toReference(i)),calledByEntry:this.calledByEntry.map(v=>v.toReference(i)),internalCalls:this.internalCalls.map(v=>v.toReference(i)),parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var o,p;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((o=this.defaultValue)==null?void 0:o.toFlatJSON(i))||[],...((p=this.declaration)==null?void 0:p.toFlatJSON(i))||[],...this.writesValues.flatMap(e=>e.toFlatJSON(i)),...this.successCalls.flatMap(e=>e.toFlatJSON(i)),...this.errorCalls.flatMap(e=>e.toFlatJSON(i)),...this.inputs.flatMap(e=>e.toFlatJSON(i)),...this.outputs.flatMap(e=>e.toFlatJSON(i)),...this.internalCalls.flatMap(e=>e.toFlatJSON(i)),...this.calledBy.flatMap(e=>e.toFlatJSON(i))])}toGenerationTarget(){const i=this.parent.type===f.Project?void 0:this.parent.id;return{id:this.id,type:this.type,declaration:this.declaration.id,calledByEntry:this.calledByEntry.map(a=>a.id),calledBySuccess:this.calledBySuccess.map(a=>a.id),calledByError:this.calledByError.map(a=>a.id),parent:i}}toFlatGenerationTarget(i=new Set){var o,p,e;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((o=this.defaultValue)==null?void 0:o.toFlatGenerationTarget(i))||[],...((p=this.declaration)==null?void 0:p.toFlatGenerationTarget(i))||[],...((e=this.readsValue)==null?void 0:e.toFlatGenerationTarget(i))||[],...this.writesValues.flatMap(y=>y.toFlatGenerationTarget(i)),...this.successCalls.flatMap(y=>y.toFlatGenerationTarget(i)),...this.errorCalls.flatMap(y=>y.toFlatGenerationTarget(i)),...this.inputs.flatMap(y=>y.toFlatGenerationTarget(i)),...this.outputs.flatMap(y=>y.toFlatGenerationTarget(i)),...this.internalCalls.flatMap(y=>y.toFlatGenerationTarget(i))])}clearErrors(){var i;return this.errors=[],(i=this.defaultValue)==null||i.clearErrors(),this.inputs.forEach(a=>a.clearErrors()),this.outputs.forEach(a=>a.clearErrors()),this.successCalls.forEach(a=>a.clearErrors()),this.errorCalls.forEach(a=>a.clearErrors()),this.internalCalls.forEach(a=>a.clearErrors()),this}validate(){const i=mj(this);return this.errors=i,{success:!0}}getErrors(){var a,o;return[...this.errors,...((a=this.defaultValue)==null?void 0:a.getErrors())||[],...this.inputs.flatMap(p=>p.getErrors()),...this.internalCalls.flatMap(p=>p.getErrors()),...this.outputs.flatMap(p=>p.getErrors()),...((o=this.readsValue)==null?void 0:o.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var i;return this.defaultValue||((i=this.declaration)==null?void 0:i.defaultValue)||null}setDefaultValue(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-default-value"))){const o=this.defaultValue;return(o==null?void 0:o.id)!==(i==null?void 0:i.id)&&(o==null||o.remove({ignoreUpstream:!0},a),this.defaultValue=i,a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("set-default-value",this.id),this}clone(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"clone-entity")),a=null,o=null,p=!0){var B,F,K,Z;let e=Sr(a,this);const y=this.toJSON(),v=o||N.UUID.uuid();y.inputs=[],y.id=v,y.version=N.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||L().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1;const E=dr(y,e);a?E.setParent(a,null):E.setParent(this.parent,null),p&&E.subscribe(),E.initChildren(i),i==null||i.add(E,S.Added);const b=(B=this.defaultValue)==null?void 0:B.clone(i,E,N.UUID.uuid(),p);E.defaultValue=b||null;const A=(F=this.inputs)==null?void 0:F.map(ie=>ie.clone(i,E,N.UUID.uuid(),p));E.inputs=A;const $=(K=this.outputs)==null?void 0:K.map(ie=>ie.clone(i,E,N.UUID.uuid(),p));E.outputs=$;const V=(Z=this.internalCalls)==null?void 0:Z.map(ie=>ie.clone(i,E,N.UUID.uuid(),p));return E.internalCalls=V,i==null||i.attemptAutoclose("clone-entity",this.id),E}addInternalCall(i){return this.internalCalls.find(a=>a===i)||this.internalCalls.push(i),this}setDeclaration(i){return this.declaration!==i&&(this.declaration=i),this}removeUnrecognizedInputs(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-unrecognized-variable-instance-inputs"))){const a=[],o=[],p=[],e=[];return this.declaration.dataType&&!this.declaration.dataType.isObject()?[...this.inputs].forEach(y=>{const v=y.remove({ignoreUpstream:!1},i);p.push(...v.removed),a.push(...v.updated)}):this.declaration.dataType&&this.declaration.dataType.hasStrictObjectStructure()&&[...this.inputs].forEach(y=>{var E;if(!y.declaration){const b=y.remove({ignoreUpstream:!1},i);p.push(...b.removed),a.push(...b.updated);return}if(![...((E=this.declaration.dataType)==null?void 0:E.entity).allProperties].find(b=>y.declaration===b)){const b=y.remove({ignoreUpstream:!1},i);p.push(...b.removed),a.push(...b.updated)}}),i==null||i.attemptAutoclose("remove-unrecognized-variable-instance-inputs",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}removeUnrecognizedOutputs(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-unrecognized-variable-instance-outputs"))){const a=[],o=[],p=[],e=[];return this.declaration.dataType&&!this.declaration.dataType.isObject()?[...this.outputs].forEach(y=>{const v=y.remove({ignoreUpstream:!1},i);p.push(...v.removed),a.push(...v.updated)}):this.declaration.dataType&&this.declaration.dataType.hasStrictObjectStructure()&&[...this.outputs].forEach(y=>{var E;if(!y.declaration){const b=y.remove({ignoreUpstream:!1},i);p.push(...b.removed),a.push(...b.updated);return}if(![...((E=this.declaration.dataType)==null?void 0:E.entity).allProperties].find(b=>y.declaration===b)){const b=y.remove({ignoreUpstream:!1},i);p.push(...b.removed),a.push(...b.updated)}}),i==null||i.attemptAutoclose("remove-unrecognized-variable-instance-outputs",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}removeUnrecognizedInternalCalls(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-unrecognized-variable-declaration-internal-calls"))){var v;const a=[],o=[],p=[],e=[];if(!this.declaration.dataType||!this.declaration.dataType.entity||![f.DefinitionEntity,f.PrimitiveEntity,f.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type))[...this.internalCalls].forEach(E=>{const b=E.remove({ignoreUpstream:!1},i);p.push(...b.removed),a.push(...b.updated)});else if(this.declaration.dataType&&this.declaration.dataType.entity&&[f.DefinitionEntity,f.PrimitiveEntity,f.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)){const E=[...((v=this.declaration.dataType)==null?void 0:v.entity).allMethods];[...this.internalCalls].forEach(b=>{if(!b.declaration){const $=b.remove({ignoreUpstream:!1},i);p.push(...$.removed),a.push(...$.updated);return}if(!E.find($=>b.declaration===$)){const $=b.remove({ignoreUpstream:!1},i);p.push(...$.removed),a.push(...$.updated);return}})}return this.internalCalls.filter((E,b)=>{const A=this.internalCalls.findIndex(V=>V.declaration===E.declaration&&V!==E);if(A===-1)return!1;const $=this.internalCalls[A];return L($==null?void 0:$.createdAt).isSame(L(E.createdAt))?b>A:!!L($==null?void 0:$.createdAt).isAfter(E.createdAt)}).forEach(E=>{const b=E.remove({ignoreUpstream:!1},i);p.push(...b.removed),a.push(...b.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-variable-declaration-internal-calls",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncInputs(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-variable-instance-inputs"))){const a=[],o=[],p=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity){if([f.DefinitionEntity,f.PrimitiveEntity,f.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList){const y=[...this.declaration.dataType.entity.properties];y.filter(A=>!A.getDataType(i)).forEach(A=>{const $=this.inputs.find(F=>ne(F,this.project)===ne(A,this.project));if(!$)return;const V=this.declaration.getMasterInputWithValueWritterFromAllInstances($);if(!V)return;const B=bn(V);A.setDataType(B,i),$.setDeclaration(A,i)}),y.filter(A=>!this.inputs.find($=>{var V;return((V=$.declaration)==null?void 0:V.id)===A.id})).forEach(A=>{const $={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.InputMap,parent:this.toReference(),name:null,description:null,codeName:null,declaration:A,defaultValue:null,index:A.index,readsValue:null},V=te($,this.project);return V.setParent(this,i),V.initChildren(i),i==null||i.add(V,S.Added),this.addInput(V,i),V}),this.inputs.filter(A=>!A.declaration).forEach(A=>{const $=y.find(V=>ne(V,this.project)===ne(A,this.project));$&&A.setDeclaration($,i)})}}else return i==null||i.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this}}syncOutputs(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-variable-instance-outputs"))){const a=[],o=[],p=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity)[f.DefinitionEntity,f.PrimitiveEntity,f.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList&&[...this.declaration.dataType.entity.properties].filter(E=>!this.outputs.find(b=>b.declaration===E)).map(E=>{const b={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.OutputMap,parent:this.toReference(),defaultValue:null,declaration:E,index:E.index,writesValues:[]},A=te(b,this.project);return A.setParent(this,i),A.initChildren(i),i==null||i.add(A,S.Added),this.addOutput(A,i),A});else return i==null||i.attemptAutoclose("sync-variable-instance-outputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose("sync-variable-instance-outputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose("sync-variable-instance-outputs",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this}}generateUnusedInternalCalls(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"generate-unused-internal-calls"))){const a=[],o=[],p=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity)[f.DefinitionEntity,f.PrimitiveEntity,f.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList&&[...this.declaration.dataType.entity.getAllInteractiveMethods()].filter(E=>!this.internalCalls.find(A=>{var V,B,F,K,Z;return(((V=A.declaration)==null?void 0:V.id)||((F=(B=A.initialData)==null?void 0:B.declaration)==null?void 0:F.entityId)||((Z=(K=A.initialData)==null?void 0:K.declaration)==null?void 0:Z.id))===E.id})).map(E=>{const b=E.createInternalCall(i,this);return i==null||i.add(b,S.Added),this.addInternalCall(b),b});else return i==null||i.attemptAutoclose("generate-unused-internal-calls",this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose("generate-unused-internal-calls",this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose("generate-unused-internal-calls",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this}}getDataType(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"get-data-type"))){var a;return((a=this.declaration)==null?void 0:a.getDataType(i))||null}getUnusedInputs(){return this.inputs.filter(i=>i.suggestion||!i.readsValue&&!i.defaultValue)}getUnusedOutputs(){return this.outputs.filter(i=>i.suggestion||!i.writesValues.length)}getUsedInputs(){return this.inputs.filter(i=>!i.suggestion&&(i.readsValue||i.defaultValue))}getUsedOutputs(){return this.outputs.filter(i=>!i.suggestion&&i.writesValues.length)}};g(Gt,"repository",{APICreate:async(i,...a)=>i,APIUpdate:async(i,...a)=>i,APIDelete:async(i,...a)=>i,APIClone:async(i,...a)=>{},APILoad:async(i,...a)=>null,APILoadVersion:async(i,a,...o)=>null}),g(Gt,"type",f.VariableInstance),g(Gt,"USER_MANAGED_PARENT_TYPES",[...Br,f.Project]),g(Gt,"PARENT_TYPES",[...Gt.USER_MANAGED_PARENT_TYPES]),g(Gt,"MUTABLE_BASE_PROPERTIES",[]),g(Gt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),g(Gt,"BASE_PROPERTIES",[...Gt.MUTABLE_BASE_PROPERTIES,...Gt.INMUTABLE_BASE_PROPERTIES]),g(Gt,"MUTABLE_META_PROPERTIES",[...Gt.MUTABLE_BASE_PROPERTIES,"x","y"]),g(Gt,"INMUTABLE_META_PROPERTIES",[...Gt.INMUTABLE_BASE_PROPERTIES]),g(Gt,"META_PROPERTIES",[...Gt.MUTABLE_META_PROPERTIES,...Gt.INMUTABLE_META_PROPERTIES]),g(Gt,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","readsValue"]),g(Gt,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),g(Gt,"UPSTREAM_PROPERTIES",[...Gt.MUTABLE_UPSTREAM_PROPERTIES,...Gt.INMUTABLE_UPSTREAM_PROPERTIES]),g(Gt,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues","inputs","outputs","successCalls","errorCalls","internalCalls"]),g(Gt,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),g(Gt,"DOWNSTREAM_PROPERTIES",[...Gt.MUTABLE_DOWNSTREAM_PROPERTIES,...Gt.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(Gt,"PROPERTIES",[...Gt.META_PROPERTIES,...Gt.UPSTREAM_PROPERTIES,...Gt.DOWNSTREAM_PROPERTIES]);let yo=Gt;var vj=(d=>(d.Parent="parent",d.DataTypeEntity="variable-data-type-entity",d.DataType="variable-data-type",d))(vj||{});const Ft=class Ft extends Nr{constructor(i,a){super(i);g(this,"initialData");g(this,"id");g(this,"name");g(this,"codeName",null);g(this,"description",null);g(this,"required",!1);g(this,"constant",!1);g(this,"x");g(this,"y");g(this,"type",f.VariableDeclaration);g(this,"defaultValue",null);g(this,"dataType",null);g(this,"writesValues",[]);g(this,"readsValue",null);g(this,"inputs",[]);g(this,"outputs",[]);g(this,"calledBySuccess",[]);g(this,"calledByError",[]);g(this,"calledByEntry",[]);g(this,"successCalls",[]);g(this,"errorCalls",[]);g(this,"internalCalls",[]);g(this,"parent");g(this,"errors",[]);g(this,"project");g(this,"detachedDependents",{});g(this,"knownVersions",null);g(this,"activeVersion",!1);g(this,"initialized",!1);g(this,"startedInitialization",!1);g(this,"suggestion",!1);g(this,"codeNativeValueValidation",null);this.initialData=i,this.project=a,this.id=i.id,this.name=i.name,this.description=i.description,this.constant=i.constant,this.codeName=i.codeName,this.required=i.required,this.x=i.x,this.y=i.y}static new(i=null){return{id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.VariableDeclaration,name:"",codeName:null,description:"",dataType:null,internalCalls:[],successCalls:[],errorCalls:[],readsValue:null,writesValues:[],defaultValue:null,constant:!1,required:!1,inputs:[],outputs:[],parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],x:0,y:0}}static fromGenerationTarget(i,a){let o=a;if(i.parent){const A=H(i.parent);o=a.get(A)}const p=i.calledByEntry.map(A=>{const $=H(A);return a.get($)}),e=i.calledBySuccess.map(A=>{const $=H(A);return a.get($)}),y=i.calledByError.map(A=>{const $=H(A);return a.get($)});let v=null;if(i.readsValue){const A=H(i.readsValue);v=a.get(A)}const E={id:i.id,version:N.UUID.uuid(),createdAt:L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.VariableDeclaration,name:i.name,defaultValue:null,codeName:i.codeName||null,description:i.description||null,constant:i.constant||!1,required:i.required||!1,calledByEntry:p,calledBySuccess:e,calledByError:y,dataType:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:v,inputs:[],outputs:[],writesValues:[],x:0,y:0,parent:o},b=te(E,a);return b.setParent(o,null),b}static validateGenerationTarget(i,a){let o=JSON.parse(JSON.stringify(i));const p=[],e=li(o,{parent:{list:!1,types:[...Br,f.Project],optional:!0}},a);o=e.modifiedData;const y=ow(o,a);return p.push(...e.errors,...y,...Ur(o)),{errors:p,modifiedData:o}}get variableInstances(){const i=[];return Object.values(this.detachedDependents).forEach(a=>{a.field===IA.VarDeclaration&&!i.includes(a.entity)&&i.push(a.entity)}),i}validateGeneratedUpdate(i){const a=[];let o=JSON.parse(JSON.stringify(i));const p=sf(o,this);return o=p.modifiedData,a.push(...p.errors),i.parent&&a.push(new ee({id:`${this.id}--${k.InvalidParentUpdate}`,code:k.InvalidParentUpdate,severity:q.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
|
|
@@ -406,4 +406,4 @@ ${Om}`})),{errors:a,modifiedData:i}}onProjectInitialized(i,a=this.project.addCha
|
|
|
406
406
|
You can inspect the existing 'entity' field with the 'describe_entity' action. Like so:
|
|
407
407
|
${aa({describe_entity:E.entity.id})}
|
|
408
408
|
Alternatively you can update the parent data-type entity with 'update' action to remove the existing value of the field.`}))}return{errors:p,modifiedData:o}}get interactive(){return this.implements.length?this.implements.every(i=>i.interactive):!0}get allMethods(){return R([...this.ownDeclaredMethods,...this.allBaseMethodsFromOriginalParents])}get allProperties(){return R([...this.ownDeclaredProperties,...this.allBasePropertiesFromOriginalParents])}get allBaseMethodsFromOriginalParents(){return R([...this.extends.flatMap(i=>i.allMethods,[]),...this.implements.flatMap(i=>i.allMethods,[])])}get allBasePropertiesFromOriginalParents(){return R([...this.extends.flatMap(i=>i.allProperties,[]),...this.implements.flatMap(i=>i.allProperties,[])])}get allBasePropertiesFromExtendedAndImplementedEntities(){return R([...this.extends.reduce((i,a)=>[...[...a.ownDeclaredProperties,...a.allBasePropertiesFromExtendedAndImplementedEntities].filter(p=>!p.abstract),...i],[]),...this.implements.reduce((i,a)=>[...[...a.ownDeclaredProperties,...a.allBasePropertiesFromExtendedAndImplementedEntities].filter(p=>!p.abstract),...i],[])])}get allBaseMethodsFromExtendedAndImplementedEntities(){return R([...this.extends.reduce((i,a)=>a.type!==f.DefinitionEntity?[]:[...[...a.ownDeclaredMethods,...a.allBaseMethodsFromExtendedAndImplementedEntities].filter(p=>p.type!==f.ActionDescriptor),...i],[]),...this.implements.reduce((i,a)=>a.type!==f.DefinitionEntity?a.abstractMethods:[...[...a.ownDeclaredMethods,...a.allBaseMethodsFromExtendedAndImplementedEntities].filter(p=>p.type!==f.ActionDescriptor),...i],[])])}get extendedPropertiesFromOriginalParents(){return R(this.extends.reduce((i,a)=>{const o=[...a.ownDeclaredProperties,...a.extendedPropertiesFromOriginalParents].filter(p=>!p.abstract);return[...i,...o]},[]))}get implementedPropertiesFromOriginalParents(){return R([...this.extends.reduce((i,a)=>{const o=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(e=>!!e.abstract&&!o.find(y=>y.name===e.name));return[...o,...p,...i]},[]),...this.implements.reduce((i,a)=>{const o=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(e=>!!e.abstract&&!o.find(y=>y.name===e.name));return[...o,...p,...i]},[])].filter(i=>!!i.abstract))}get extendedMethodsFromOriginalParents(){return R(this.extends.reduce((i,a)=>{if(a.type!==f.DefinitionEntity)return[];const o=[...a.ownDeclaredMethods,...a.extendedMethodsFromOriginalParents].filter(p=>p.type!==f.ActionDescriptor);return[...i,...o]},[]))}get implementedMethodsFromOriginalParents(){return R([...this.extends.reduce((i,a)=>{const o=a.type===f.DefinitionEntity?a.methods:[],p=[...a.abstractMethods].filter(e=>!o.find(y=>y.name===e.name));return[...o,...p,...i]},[]),...this.implements.reduce((i,a)=>[...a.abstractMethods,...i],[])].filter(i=>i.type===f.ActionDescriptor))}get extendedProperties(){return this.properties.filter(i=>i.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(i=>!i.isExtendedProperty)}get extendedMethods(){return this.methods.filter(i=>i.isExtendedMethod)}get ownDeclaredMethods(){return this.methods.filter(i=>!i.isExtendedMethod)}validateGeneratedUpdate(i){const a=[];return i.parent&&a.push(new ee({id:`${this.id}--${k.InvalidParentUpdate}`,code:k.InvalidParentUpdate,severity:q.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.`})),{errors:a,modifiedData:i}}subscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-dependents"))){const a=[],o=[],p=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),o.push(...v.added),p.push(...v.removed),e.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}onDetachedDependencyRemoved(i,a,o){const p=[],e=[],y=[],v=[];return a==="implements"&&this.removeImplementation(i),a==="extends"&&this.removeExtension(i),{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,o){const p=[],e=[],y=[],v=[];return a==="implements"&&this.addImplementation(i),a==="extends"&&this.addExtension(i),{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){return this.implements.forEach(i=>{Yi.includes(i.type)||i.unsubscribeDependents([{entity:this,field:"implements"}])}),this}subscribeToDependencies(){return this.implements.forEach(i=>{Yi.includes(i.type)||i.subscribeDependents([{entity:this,field:"implements"}])}),this.extends.forEach(i=>{Yi.includes(i.type)||i.subscribeDependents([{entity:this,field:"extends"}])}),this}increaseVersion(i){if(i&&!L(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&L(i).isSame(L(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=L(i).toISOString()||L().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new Ht(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.properties=[...this.properties],i.methods=[...this.methods],i.abstractMethods=[...this.abstractMethods],i.extends=[...this.extends],i.implements=[...this.implements],i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const a=[],o=[],p=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),o.push(...y.added),p.push(...y.removed)}return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}async restoreVersion(i){var v;const a=[],o=[],p=[],e=[];if(this.version===i)return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[$,V]of A.knownVersions)E.set($,V);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new Ht(E,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.properties=y.properties,this.methods=y.methods,this.abstractMethods=y.abstractMethods,this.extends=y.extends,this.implements=y.implements,this.parent=y.parent,{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"update-with-shallow-transfer"))){if(this.metaSync(i,a),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent){const o=H(i.parent),p=this.project.get(o),e=this.parent;if(e&&e.id!==(p==null?void 0:p.id)&&this.removeFromParent(a),p)this.setParent(p,a);else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${o}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);return i.extends.forEach(o=>{const p=H(o),e=this.project.get(p);e&&this.addExtension(e)}),i.implements.forEach(o=>{const p=H(o),e=this.project.get(p);e&&this.addImplementation(e)}),this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const i=[],a=[],o=[],p=[];if(this.initialData.parent){const e=H(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' 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(e=>{const y=H(e),v=this.project.get(y);v&&(this.addExtension(v),v.type!==f.BuiltInBaseEntity&&i.push(v))}),this.initialData.implements.forEach(e=>{const y=H(e),v=this.project.get(y);v&&(this.addImplementation(v),v.type!==f.BuiltInBaseEntity&&i.push(v))}),{updated:R(i),added:R(a),removed:R(o),affected:R(p),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],o=[],p=[],e=[];this.initialized=!0;const{updated:y,added:v,removed:E,affected:b}=this.syncImplementationProperties(i);a.push(...y),o.push(...v),p.push(...E),e.push(...b);const{updated:A,added:$,removed:V,affected:B}=this.addExtendedProperties(i);a.push(...A),o.push(...$),p.push(...V),e.push(...B);const{updated:F,added:K,removed:Z}=this.removeUnrecognizedProperties(i);a.push(...F),o.push(...K),p.push(...Z);const{updated:ie,added:X,removed:ue,affected:re}=this.syncImplementationMethods(i);a.push(...ie),o.push(...X),p.push(...ue),e.push(...re);const{updated:fe,added:Y,removed:J,affected:ce}=this.addExtendedMethods(i);a.push(...fe),o.push(...Y),p.push(...J),e.push(...ce);const{updated:z,added:de,removed:Ae}=this.removeUnrecognizedMethods(i);return a.push(...z),o.push(...de),p.push(...Ae),this.addSuggestions(),this.captureVersion(),i==null||i.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-self-to-project"))){const a=[this],o=[],p=[],e=[];if(this.parent.type===f.DataType){const y=this.parent;y.entity=this,a.push(y)}else this.project.addDefinitionEntity(this);return this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}setParent(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-parent"))){var o;return((o=this.parent)==null?void 0:o.id)!==(i==null?void 0:i.id)&&(this.parent=i,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-parent",this.id),this}addExtension(i){return this.extends.includes(i)||this.extends.push(i),this}removeExtension(i){return this.extends=this.extends.filter(a=>a.id!==i.id),this}addImplementation(i){return this.implements.includes(i)||this.implements.push(i),this}removeImplementation(i){return this.implements=this.implements.filter(a=>a.id!==i.id),this}removeProperty(i){return this.properties=this.properties.filter(a=>a.id!==i.id),this}addMethod(i){return this.methods.includes(i)||(this.methods.push(i),this.suggestedMethods=this.suggestedMethods.filter(a=>a.name!==i.name)),this}removeMethod(i){return this.methods=this.methods.filter(a=>a.id!==i.id),this}addProperty(i){return this.properties.includes(i)||(this.properties.push(i),this.suggestedProperties=this.suggestedProperties.filter(a=>a.name!==i.name)),this}addSuggestedProperty(i){return this.suggestedProperties.includes(i)||this.suggestedProperties.push(i),this}addSuggestedMethod(i){return this.suggestedMethods.includes(i)||this.suggestedMethods.push(i),this}removeSuggestedProperty(i){return this.suggestedProperties=this.suggestedProperties.filter(a=>a.id!==i.id),this}removeSuggestedMethod(i){return this.suggestedMethods=this.suggestedMethods.filter(a=>a.id!==i.id),this}addAbstractMethod(i){return this.abstractMethods.includes(i)||this.abstractMethods.push(i),this}removeAbstractMethod(i){return this.abstractMethods=this.abstractMethods.filter(a=>a.id!==i.id),this}initChildren(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.properties=this.initialData.properties.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),o}),this.methods=this.initialData.methods.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),o}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(i),o}),this.extends=this.initialData.extends.map(a=>te(a,this.project)),this.implements=this.initialData.implements.map(a=>te(a,this.project)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}removeUnrecognizedProperties(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-unrecognized-properties"))){const a=[],o=[],p=[],e=[];let y=[...this.properties];y=y.filter(E=>E.parent.id===this.id),y=y.filter(E=>!E.isExtendedProperty);const v=this.implementedPropertiesFromOriginalParents;return y=y.filter(E=>this.interactive&&!E.implements?!1:!v.find(b=>{var A;return b.id===((A=E.implements)==null?void 0:A.id)})),y.forEach(E=>{const b=E.remove({ignoreUpstream:!1},i);p.push(...b.removed),a.push(...b.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-properties",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}removeUnrecognizedMethods(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-unrecognized-methods"))){const a=[],o=[],p=[],e=[];let y=[...this.methods];y=y.filter(E=>E.parent.id===this.id),y=y.filter(E=>!E.isExtendedMethod);const v=this.implementedMethodsFromOriginalParents;return y=y.filter(E=>this.interactive&&!E.implements?!1:!v.find(b=>{var A;return b.id===((A=E.implements)==null?void 0:A.id)})),y.forEach(E=>{const b=E.remove({ignoreUpstream:!1},i);p.push(...b.removed),a.push(...b.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-methods",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncImplementationMethods(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-implementation-methods"))){const a=[],o=[],p=[],e=[],y=this.methods,v=this.implementedMethodsFromOriginalParents,E=[...this.allBaseMethodsFromExtendedAndImplementedEntities,...y];return v.filter(A=>!E.find(V=>{var B;return((B=V.implements)==null?void 0:B.id)===A.id})).forEach(A=>{if(this.methods.find(F=>{var K;return((K=F.implements)==null?void 0:K.id)===A.id}))return;const V=this.methods.find(F=>{var ue,re;if(F.name===A.name&&!F.implements)return!0;const K=As(this,Ue.CRON_JOB),Z=As(this,Ue.HTTP_ENDPOINT),ie=((ue=F.implements)==null?void 0:ue.id)===Ee["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id,X=((re=F.implements)==null?void 0:re.id)===Ee["built-in-base-entity"].BUILT_IN_CRON_JOB_ENTITY.methods.handler.id;return!!(K&&!X&&!Z&&ie||Z&&!ie&&!K&&X)});if(V&&V.type===f.FunctionDeclaration){V.setImplements(A,i),V.metaSync({name:A.name},i),i==null||i.add(V,S.Updated),i==null||i.add(this,S.Updated);return}const B=A.implementAsFunctionDeclaration(i,this);o.push(B),i==null||i.add(B,S.Added),this.addMethod(B)}),i==null||i.attemptAutoclose("sync-implementation-methods",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}syncImplementationProperties(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-implementation-properties"))){const a=[],o=[],p=[],e=[],y=this.properties,v=this.implementedPropertiesFromOriginalParents,E=[...this.allBasePropertiesFromExtendedAndImplementedEntities,...y];return v.filter(A=>!E.find(V=>{var B;return((B=V.implements)==null?void 0:B.id)===A.id})).forEach(A=>{if(this.properties.find(F=>{var K;return((K=F.implements)==null?void 0:K.id)===A.id}))return;const V=this.properties.find(F=>F.name===A.name&&!!F.abstract&&!F.implements);if(V){V.setImplements(A,i),V.metaSync({abstract:!1},i),V.afterAllChildrenInitialized(i);return}const B=A.implement(this,i,N.UUID.uuid());o.push(B),i==null||i.add(B,S.Added)}),i==null||i.attemptAutoclose("sync-implementation-properties",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}addExtendedMethods(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-extended-methods"))){const a=[],o=[],p=[],e=[],y=this.methods,E=this.extendedMethodsFromOriginalParents.filter(A=>A.type===f.FunctionDeclaration),b=new Set(y.filter(A=>{var $;return!!(($=A.extends)!=null&&$.id)}).map(A=>A.extends.id));return E.forEach(A=>{if(b.has(A.id))return;b.add(A.id);const $=A.clone(i,this,N.UUID.uuid());$.setExtends(A,i),$.initChildren(i),o.push($),i==null||i.add($,S.Added),this.addMethod($)}),i==null||i.attemptAutoclose("add-extended-methods",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}addExtendedProperties(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-extended-properties"))){const a=[],o=[],p=[],e=[],y=this.properties,v=this.extendedPropertiesFromOriginalParents,E=v.filter(A=>v.find(V=>{var B;return((B=V.implements)==null?void 0:B.id)===A.id})?!1:!A.abstract),b=new Set(y.filter(A=>{var $;return!!(($=A.extends)!=null&&$.id)}).map(A=>A.extends.id));return E.forEach(A=>{if(b.has(A.id))return;b.add(A.id);const $=A.clone(i,this,N.UUID.uuid());$.setExtends(A,i),$.initChildren(i),o.push($),i==null||i.add($,S.Added),this.addProperty($)}),i==null||i.attemptAutoclose("add-extended-properties",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}addSuggestions(){return this.implements.forEach(i=>{lK(this,i).forEach(p=>{const e=p.toJSON();e.id=`_suggestion--parent--${this.id}--${p.id}`;const y=te(e,this.project);y.suggestion=!0,y.setParent(this,null),y.initChildren(null),this.addSuggestedProperty(y)}),dK(this,i).forEach(p=>{const e=`_suggestion--parent--${this.id}--${p.id}`,y=p.implementAsFunctionDeclaration(null,this,e),v=te(y,this.project);if(v.suggestion=!0,v.setParent(this,null),v.initChildren(null),this.methods=this.methods.filter(E=>E.id!==e),v.inputs.forEach(E=>{E.suggestion=!0}),v.returnStatements.length){const E=v.returnStatements[0];E.suggestion=!0,E.outputs.forEach(b=>{b.suggestion=!0})}this.addSuggestedMethod(v)})}),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"meta-sync"))){const o=xr(this,i),p=this.toMeta();return this.name=i.name!==void 0?i.name:p.name,this.codeName=i.codeName!==void 0?i.codeName:p.codeName,this.description=i.description!==void 0?i.description:p.description,this.x=i.x||p.x,this.y=i.y||p.y,this.static=i.static!==void 0?i.static:this.static,this.abstract=i.abstract!==void 0?i.abstract:this.abstract,super.metaSync(i),i.deleted===!0&&!p.deleted?a==null||a.add(this,S.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,S.Added):o&&(a==null||a.add(this,S.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ve,...a){return await Ht.repository.APILoad(this.id,...a),this}async APICreate(i=ve,...a){return await Ht.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ve,...a){return await Ht.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ve,...a){return await Ht.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ve,...a){return await Ht.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ve,a,...o){return await Ht.repository.APILoadVersion(this.id,a,...o)}removeFromParent(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-from-parent"))){const a=[],o=[],p=[],e=[];if(this.parent.type===f.Project)this.parent.removeDefinitionEntity(this);else if(this.parent.type===f.DataType&&this.parent.entity&&this.parent.entity.id===this.id){const y=this.parent.setEntity(null,i);a.push(y)}return i==null||i.attemptAutoclose("remove-from-parent",this.id),{added:R(p),updated:R(a),removed:R(o),affected:R(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-entity"))){const o=[],p=[],e=[],y=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(p.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:A}=v.entity.onDetachedDependencyRemoved(this,v.field,a);o.push(...E),p.push(...b),e.push(...A)}),this.properties.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...b)}),this.methods.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...b)}),this.abstractMethods.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...b)}),this.suggestedProperties.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...b)}),this.suggestedMethods.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},a);o.push(...E),p.push(...b)}),!i){const v=this.removeFromParent(a);e.push(...v.added),o.push(...v.updated),p.push(...v.removed),y.push(...v.affected)}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:R(e),updated:R(o),removed:R(p),affected:R(y),self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"restore-entity"))){const a=[],o=[],p=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(y=>{const{updated:v,removed:E,added:b}=y.entity.onDetachedDependencyRestored(this,y.field,i);o.push(...v),p.push(...E),a.push(...b)}),this.properties.forEach(y=>{const{updated:v}=y.restore({},i);o.push(...v)}),this.methods.forEach(y=>{const{updated:v}=y.restore({},i);o.push(...v)}),this.abstractMethods.forEach(y=>{const{updated:v}=y.restore({},i);o.push(...v)}),this.suggestedProperties.forEach(y=>{const{updated:v}=y.restore({},i);o.push(...v)}),this.suggestedMethods.forEach(y=>{const{updated:v}=y.restore({},i);o.push(...v)}),i==null||i.attemptAutoclose("restore-entity",this.id),{added:R(a),updated:R(o),removed:R(p),affected:R(e),self:this})}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.extends.flatMap(o=>o.toFlat(i)),...this.implements.flatMap(o=>o.toFlat(i)),...this.properties.flatMap(o=>o.toFlat(i)),...this.methods.flatMap(o=>o.toFlat(i)),...this.abstractMethods.flatMap(o=>o.toFlat(i)),...this.parent.toFlat(i)])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.extends.flatMap(o=>o.toFlatIds(i)),...this.implements.flatMap(o=>o.toFlatIds(i)),...this.properties.flatMap(o=>o.toFlatIds(i)),...this.methods.flatMap(o=>o.toFlatIds(i)),...this.abstractMethods.flatMap(o=>o.toFlatIds(i)),...this.parent.toFlatIds(i)])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,codeName:this.codeName,description:this.description,static:this.static,abstract:this.abstract,x:this.x,y:this.y,type:this.type,name:this.name}}toJSON(i=new Set){return i.has(this.id)?this.toReference():(i.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,codeName:this.codeName,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(a=>a.toJSON(i)),methods:this.methods.map(a=>a.toJSON(i)),abstractMethods:this.abstractMethods.map(a=>a.toJSON(i)),implements:this.implements.map(a=>a.toJSON(i)),extends:this.extends.map(a=>a.toJSON(i)),parent:this.parent.toReference()})}toJSONClone(i=ke){var o,p,e,y,v;let a;return(o=i.seenEntityMaps)!=null&&o.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||Kr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(p=i.seenEntities)!=null&&p.has(a)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(a),(v=i.seenEntities)==null||v.add(this.id),{id:a,version:N.UUID.uuid(),createdAt:i.timestamp||L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:this.type,name:this.name,codeName:this.codeName,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(E=>E.toJSONClone({...i,newId:null})),methods:this.methods.map(E=>E.toJSONClone({...i,newId:null})),abstractMethods:this.abstractMethods.map(E=>E.toJSONClone({...i,newId:null})),implements:this.implements.map(E=>E.type===f.BuiltInBaseEntity?E.toJSON(i.seenEntities):E.toJSONClone({...i,newId:null})),extends:this.extends.map(E=>E.type===f.BuiltInBaseEntity?E.toJSON(i.seenEntities):E.toJSONClone({...i,newId:null})),parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=ke){var o;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+N.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=ke){var o;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,name:this.name,codeName:this.codeName,description:this.description,type:this.type,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(p=>p.toReference(i)),methods:this.methods.map(p=>p.toReference(i)),abstractMethods:this.abstractMethods.map(p=>p.toReference(i)),implements:this.implements.map(p=>p.toReference(i)),extends:this.extends.map(p=>p.toReference(i)),parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(o=>o.toFlatJSON(i)),...this.methods.flatMap(o=>o.toFlatJSON(i)),...this.abstractMethods.flatMap(o=>o.toFlatJSON(i)),...this.implements.flatMap(o=>o.toFlatJSON(i)),...this.extends.flatMap(o=>o.toFlatJSON(i)),...this.parent.toFlatJSON(i)])}toGenerationTarget(){const i=this.parent.type===f.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(a=>a.id),implements:this.implements.map(a=>a.id),parent:i}}toFlatGenerationTarget(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(o=>o.toFlatGenerationTarget(i)),...this.methods.flatMap(o=>o.toFlatGenerationTarget(i)),...this.abstractMethods.flatMap(o=>o.toFlatGenerationTarget(i)),...this.implements.filter(o=>o.type===f.DefinitionEntity).flatMap(o=>o.toFlatGenerationTarget(i)),...this.implements.filter(o=>o.type===f.DefinitionEntity).flatMap(o=>o.toFlatGenerationTarget(i)),...this.parent.toFlatGenerationTarget(i)])}clearErrors(){return this.errors=[],this.properties.forEach(i=>i.clearErrors()),this.methods.forEach(i=>i.clearErrors()),this.abstractMethods.forEach(i=>i.clearErrors()),this}validate(){return this.errors=oK(this),{success:!0}}getErrors(){return[...this.errors,...this.properties.flatMap(a=>a.getErrors()),...this.methods.flatMap(a=>a.getErrors()),...this.abstractMethods.flatMap(a=>a.getErrors())]}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"clone-entity")),a=null,o=null,p=!0){var F,K,Z;let e=Sr(a,this);const y=this.toJSON(),v=o||N.UUID.uuid();y.properties=[],y.methods=[],y.abstractMethods=[];const E=v.split("-id"),b=E[E.length-1||0]||v;y.id=v,y.version=N.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||L().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1;const A=dr(y,e);a&&A.setParent(a,null),p&&A.subscribe(),A.initChildren(i),i==null||i.add(A,S.Added);const $=(F=this.properties)==null?void 0:F.map(ie=>ie.clone(i,A,N.UUID.uuid(),p));A.properties=$;const V=(K=this.methods)==null?void 0:K.map((ie,X)=>ie.clone(i,A,b+"-method-"+X+"-id",p));A.methods=V;const B=(Z=this.abstractMethods)==null?void 0:Z.map((ie,X)=>ie.clone(i,A,b+"-abstract-method-"+X+"-id",p));return A.abstractMethods=B,i==null||i.attemptAutoclose("clone-entity",this.id),A}getFunctionDeclaration(i){return this.methods.find(a=>a.id===i)}implement(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"implement-definition-entity")),o){const p=Vm(this,i,a,o);return a==null||a.attemptAutoclose("implement-definition-entity",this.id),p}getAllInteractiveMethods(){const i=this.implements.filter(o=>o.type===f.DefinitionEntity||o.type===f.BuiltInBaseEntity&&o.interactive);return R([...this.methods,...this.extends.flatMap(o=>o.getAllInteractiveMethods()),...i.flatMap(o=>o.getAllInteractiveMethods())])}inferFromInputs(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"infer-definition-entity-from-inputs"))){const o=[],p=[],e=[],y=[];if(this.parent.type!==f.DataType||!this.parent.inferred)return a==null||a.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};const v=[];i.forEach(A=>{v.find(V=>ne(V,this.project)===ne(A,this.project))||v.push(A)});const E=this.properties.filter(A=>!A.dataType);v.forEach(A=>{var ie,X,ue;const $=E.find(re=>ne(re,this.project)===ne(A,this.project));if(!$)return;const B=Bi(A.parent).getMasterInputWithValueWritterFromAllInstances(A),F=bn(B,a),K=F==null?void 0:F.clone(a,$,N.UUID.uuid(),!0);K&&((ie=$.dataType)==null||ie.merge(K,a),K.id!==((X=$.dataType)==null?void 0:X.id)&&K.remove({ignoreUpstream:!1},a),$.dataType&&($.dataType.metaSync({inferred:!0,like:!0},a),$.setDataType($.dataType,a),a==null||a.add($,S.Affected)));let Z=null;if(A.declaration&&$.id!==((ue=A.declaration)==null?void 0:ue.id)&&(Z=A.declaration),A.setDeclaration($,a),a==null||a.add(A,S.Updated),Z){const{updated:re,removed:fe}=Z.remove({ignoreUpstream:!1},a);p.push(...re),e.push(...fe)}});const b=[];return v.forEach(A=>{if(!A.declaration){b.push(A);return}}),b.length===0?(a==null||a.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(b.forEach(A=>{var X,ue,re,fe;const $=this.properties.find(Y=>ne(Y,this.project)===ne(A,this.project));if($){if(A.setDeclaration($,a),!$.getDataType(a)){const J=Bi(A.parent).getMasterInputWithValueWritterFromAllInstances(A),ce=bn(J),z=ce==null?void 0:ce.clone(a,$,N.UUID.uuid(),!0);z&&((X=$.dataType)==null||X.merge(z,a),z.id!==((ue=$.dataType)==null?void 0:ue.id)&&z.remove({ignoreUpstream:!1},a),$.dataType&&($.dataType.metaSync({inferred:!0,like:!0},a),$.setDataType($.dataType,a),a==null||a.add($,S.Affected)))}return}const V=la.new(a);V.parent=this.toReference(),V.index=A.index,V.name=ne(A,this.project),V.codeName=A.codeName,V.description=A.description;const B=te(V,this.project);B.hydrateAncestors(),a==null||a.add(B,S.Added),B.setParent(this,a),B.initChildren(a);const K=Bi(A.parent).getMasterInputWithValueWritterFromAllInstances(A),Z=bn(K),ie=Z==null?void 0:Z.clone(a,B,N.UUID.uuid(),!0);return ie&&((re=B.dataType)==null||re.merge(ie,a),ie.id!==((fe=B.dataType)==null?void 0:fe.id)&&ie.remove({ignoreUpstream:!1},a),B.dataType&&(B.dataType.metaSync({inferred:!0,like:!0},a),B.setDataType(B.dataType,a),a==null||a.add(B,S.Affected))),this.addProperty(B),A.setDeclaration(B,a),a==null||a.add(A,S.Updated),B}),a==null||a.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:R(o),updated:R(p),removed:R(e),affected:R(y),self:this})}getRawDefaultValue(){const i={};return this.properties.forEach(a=>{var p;if(!sw(a))return;const o=jr(a.name);i[o]=((p=a.getDefaultValue())==null?void 0:p.value)||null}),i}getActiveRawDefaultValue(){const i={};return this.properties.forEach(a=>{var e;if(!sw(a))return;const o=jr(a.name),p=(e=this.project.requestActiveDynamicValue(a))==null?void 0:e.value;i[o]=(p==null?void 0:p.value)||null}),i}};g(Ht,"repository",{APICreate:async(i,...a)=>i,APIUpdate:async(i,...a)=>i,APIDelete:async(i,...a)=>i,APIClone:async(i,...a)=>{},APILoad:async(i,...a)=>null,APILoadVersion:async(i,a,...o)=>null}),g(Ht,"type",f.DefinitionEntity),g(Ht,"USER_MANAGED_PARENT_TYPES",[f.Project,f.DataType]),g(Ht,"PARENT_TYPES",[...Ht.USER_MANAGED_PARENT_TYPES]),g(Ht,"MUTABLE_BASE_PROPERTIES",["name","codeName","description","static","abstract"]),g(Ht,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),g(Ht,"BASE_PROPERTIES",[...Ht.MUTABLE_BASE_PROPERTIES,...Ht.INMUTABLE_BASE_PROPERTIES]),g(Ht,"MUTABLE_META_PROPERTIES",[...Ht.MUTABLE_BASE_PROPERTIES,"x","y"]),g(Ht,"INMUTABLE_META_PROPERTIES",[...Ht.INMUTABLE_BASE_PROPERTIES]),g(Ht,"META_PROPERTIES",[...Ht.MUTABLE_META_PROPERTIES,...Ht.INMUTABLE_META_PROPERTIES]),g(Ht,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),g(Ht,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),g(Ht,"UPSTREAM_PROPERTIES",[...Ht.MUTABLE_UPSTREAM_PROPERTIES,...Ht.INMUTABLE_UPSTREAM_PROPERTIES]),g(Ht,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),g(Ht,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),g(Ht,"DOWNSTREAM_PROPERTIES",[...Ht.MUTABLE_DOWNSTREAM_PROPERTIES,...Ht.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(Ht,"PROPERTIES",[...Ht.META_PROPERTIES,...Ht.UPSTREAM_PROPERTIES,...Ht.DOWNSTREAM_PROPERTIES]);let da=Ht;function Vbe(d){const u=mye(),i=d.toJSON();u.safeParse(i).success;const o=[];return Er(d.errors,o)}const Ef=class Ef extends Nr{constructor(i,a){super(i);g(this,"initialData");g(this,"id");g(this,"version");g(this,"name");g(this,"description",null);g(this,"type",f.BuiltInBaseEntity);g(this,"abstract",!1);g(this,"static");g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"interactive",!1);g(this,"errors",[]);g(this,"project");this.initialData=this.initialData||i,this.project=this.project||a,this.id=this.id||i.id,this.version=this.version||i.version,this.name=this.name||i.name,this.static=this.static||i.static,this.interactive=this.interactive||i.interactive,this.abstract=i.abstract,this.properties=this.initialData.properties.map(o=>{const p=te(o,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.methods=this.initialData.methods.map(o=>{const p=te(o,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.abstractMethods=this.initialData.abstractMethods.map(o=>{const p=te(o,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.extends=this.initialData.extends.map(o=>te(o,this.project))}get allMethods(){return R([...this.ownDeclaredMethods,...this.allBaseMethodsFromOriginalParents])}get allProperties(){return R([...this.ownDeclaredProperties,...this.allBasePropertiesFromOriginalParents])}get allBaseMethodsFromOriginalParents(){return R([...this.extends.flatMap(i=>i.allMethods,[])])}get allBasePropertiesFromOriginalParents(){return R([...this.extends.flatMap(i=>i.allProperties,[])])}get allBasePropertiesFromExtendedAndImplementedEntities(){return R(this.extends.reduce((i,a)=>{const o=[...a.ownDeclaredProperties,...a.allBasePropertiesFromExtendedAndImplementedEntities].filter(p=>!p.abstract);return[...i,...o]},[]))}get extendedPropertiesFromOriginalParents(){return R(this.extends.reduce((i,a)=>{const o=[...a.ownDeclaredProperties,...a.extendedPropertiesFromOriginalParents].filter(p=>!p.abstract);return[...i,...o]},[]))}get implementedPropertiesFromOriginalParents(){return R([...this.extends.reduce((i,a)=>{const o=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(e=>!!e.abstract&&!o.find(y=>y.name===e.name));return[...o,...p,...i]},[])])}get extendedProperties(){return this.properties.filter(i=>i.isExtendedProperty)}get ownDeclaredMethods(){return this.methods.filter(i=>!i.isExtendedMethod)}get ownDeclaredProperties(){return this.properties.filter(i=>!i.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(i=ve,...a){return await Ef.repository.APILoad(this.id,...a),this}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.properties.flatMap(o=>o.toFlat(i)),...this.methods.flatMap(o=>o.toFlat(i)),...this.abstractMethods.flatMap(o=>o.toFlat(i)),...this.extends.flatMap(o=>o.toFlat(i))])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.properties.flatMap(o=>o.toFlatIds(i)),...this.methods.flatMap(o=>o.toFlatIds(i)),...this.abstractMethods.flatMap(o=>o.toFlatIds(i)),...this.extends.flatMap(o=>o.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,interactive:this.interactive,abstract:this.abstract,static:this.static,type:this.type,name:this.name}}toJSON(i=new Set){return i.has(this.id)?this.toReference():(i.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(a=>a.toJSON(i)),methods:this.methods.map(a=>a.toJSON(i)),abstractMethods:this.abstractMethods.map(a=>a.toJSON(i)),extends:this.extends.map(a=>a.toJSON(i))})}toReference(i=ke){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:f.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(i=ke){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(a=>a.toReference()),methods:this.methods.map(a=>a.toReference()),abstractMethods:this.abstractMethods.map(a=>a.toReference()),extends:this.extends.map(a=>a.toReference())}}toFlatJSON(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(o=>o.toFlatJSON(i)),...this.methods.flatMap(o=>o.toFlatJSON(i)),...this.abstractMethods.flatMap(o=>o.toFlatJSON(i))])}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(i=>i.id)}}toFlatGenerationTarget(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(o=>o.toFlatGenerationTarget(i)),...this.methods.flatMap(o=>o.toFlatGenerationTarget(i)),...this.abstractMethods.flatMap(o=>o.toFlatGenerationTarget(i))])}clearErrors(){return this.errors=[],this.properties.forEach(i=>i.clearErrors()),this.methods.forEach(i=>i.clearErrors()),this.abstractMethods.forEach(i=>i.clearErrors()),this}validate(){const i=Vbe(this);return this.errors=i,{success:!0}}getErrors(){return[...this.errors,...this.properties.flatMap(a=>a.getErrors()),...this.methods.flatMap(a=>a.getErrors()),...this.abstractMethods.flatMap(a=>a.getErrors())]}getShallowErrors(){return this.errors}implement(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),null,!0,"implement-built-in-base-entity")),o){const p=Vm(this,i,a,o);return a==null||a.attemptAutoclose("implement-built-in-base-entity",this.id),p}getAllInteractiveMethods(){const i=[];return this.interactive&&(i.push(...this.methods),this.extends.filter(o=>o.type===f.BuiltInBaseEntity&&o.interactive||o.type===f.PrimitiveEntity).forEach(o=>{o instanceof Ef&&i.push(...o.getAllInteractiveMethods())})),R(i)}};g(Ef,"repository",{APILoad:async(i,...a)=>null});let ua=Ef;function Lbe(d){const u=oye(),i=d.toJSON();u.safeParse(i).success;const o=[];return Er(d.errors,o)}const r0=class r0 extends Nr{constructor(i,a){super(i);g(this,"initialData");g(this,"id");g(this,"name");g(this,"description",null);g(this,"type",f.PrimitiveEntity);g(this,"static");g(this,"abstract");g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"errors",[]);g(this,"project");this.initialData=i,this.project=a,this.id=i.id,this.name=i.name,this.static=i.static,this.abstract=i.abstract,this.properties=this.initialData.properties.map(o=>{const p=te(o,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.methods=this.initialData.methods.map(o=>{const p=te(o,this.project);return p.parent=this,p}),this.abstractMethods=this.initialData.abstractMethods.map(o=>{const p=te(o,this.project);return p.parent=this,p})}get allMethods(){return R([...this.ownDeclaredMethods,...this.allBaseMethodsFromOriginalParents])}get allProperties(){return R([...this.ownDeclaredProperties,...this.allBasePropertiesFromOriginalParents])}get allBaseMethodsFromOriginalParents(){return R([...this.extends.flatMap(i=>i.allMethods,[])])}get allBasePropertiesFromOriginalParents(){return R([...this.extends.flatMap(i=>i.allProperties,[])])}get allBasePropertiesFromExtendedAndImplementedEntities(){return R(this.extends.reduce((i,a)=>{const o=[...a.ownDeclaredProperties,...a.allBasePropertiesFromExtendedAndImplementedEntities].filter(p=>!p.abstract);return[...i,...o]},[]))}get extendedPropertiesFromOriginalParents(){return R(this.extends.reduce((i,a)=>{const o=[...a.ownDeclaredProperties,...a.extendedPropertiesFromOriginalParents].filter(p=>!p.abstract);return[...i,...o]},[]))}get implementedPropertiesFromOriginalParents(){return R([...this.extends.reduce((i,a)=>{const o=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(e=>!!e.abstract&&!o.find(y=>y.name===e.name));return[...o,...p,...i]},[])])}get extendedProperties(){return this.properties.filter(i=>i.isExtendedProperty)}get ownDeclaredMethods(){return this.methods.filter(i=>!i.isExtendedMethod)}get ownDeclaredProperties(){return this.properties.filter(i=>!i.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(i=ve,...a){return await r0.repository.APILoad(this.id,...a),this}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.properties.flatMap(o=>o.toFlat(i)),...this.methods.flatMap(o=>o.toFlat(i)),...this.abstractMethods.flatMap(o=>o.toFlat(i))])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.properties.flatMap(o=>o.toFlatIds(i)),...this.methods.flatMap(o=>o.toFlatIds(i)),...this.abstractMethods.flatMap(o=>o.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,static:this.static,abstract:this.abstract,type:this.type,name:this.name}}toJSON(i=new Set){return i.has(this.id)?this.toReference():(i.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(a=>a.toJSON(i)),methods:this.methods.map(a=>a.toJSON(i)),abstractMethods:this.abstractMethods.map(a=>a.toJSON(i)),extends:this.extends.map(a=>a.toJSON(i))})}toReference(i=ke){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:f.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(i=ke){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(a=>a.toReference()),methods:this.methods.map(a=>a.toReference()),abstractMethods:this.abstractMethods.map(a=>a.toReference()),extends:this.extends.map(a=>a.toReference())}}toFlatJSON(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(o=>o.toFlatJSON(i)),...this.methods.flatMap(o=>o.toFlatJSON(i)),...this.abstractMethods.flatMap(o=>o.toFlatJSON(i))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,extends:this.extends.map(i=>i.id)}}toFlatGenerationTarget(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(o=>o.toFlatGenerationTarget(i)),...this.methods.flatMap(o=>o.toFlatGenerationTarget(i)),...this.abstractMethods.flatMap(o=>o.toFlatGenerationTarget(i))])}clearErrors(){return this.errors=[],this.properties.forEach(i=>i.clearErrors()),this.methods.forEach(i=>i.clearErrors()),this.abstractMethods.forEach(i=>i.clearErrors()),this}validate(){const i=Lbe(this);return this.errors=i,{success:!0}}getErrors(){return[...this.errors,...this.properties.flatMap(a=>a.getErrors()),...this.methods.flatMap(a=>a.getErrors()),...this.abstractMethods.flatMap(a=>a.getErrors())]}getShallowErrors(){return this.errors}getAllInteractiveMethods(){const i=[];return i.push(...this.methods),this.extends.filter(o=>o.type===f.BuiltInBaseEntity&&o.interactive||o.type===f.PrimitiveEntity).forEach(o=>{o instanceof ua&&i.push(...o.getAllInteractiveMethods())}),R(i)}};g(r0,"repository",{APILoad:async(i,...a)=>null});let ns=r0;function dr(d,u){if(!d)throw new Error("Entity is null");const i=u.get(d.id);switch(d.type){case f.LiteralValue:return i||new Zi(d,u);case f.DefinitionEntity:return i||new da(d,u);case f.PrimitiveEntity:return i||new ns(d,u);case f.FunctionDeclaration:return i||new uo(d,u);case f.GlobalEvent:return i||new fo(d,u);case f.DataType:return i||new vs(d,u);case f.Property:return i||new la(d,u);case f.FunctionCall:return i||new Do(d,u);case f.Condition:return i||new ho(d,u);case f.Operation:return i||new co(d,u);case f.VariableDeclaration:return i||new mo(d,u);case f.VariableInstance:return i||new yo(d,u);case f.OutputMap:return i||new wn(d,u);case f.ReturnDeclaration:return i||new ss(d,u);case f.ArgumentDeclaration:return i||new ea(d,u);case f.InputMap:return i||new ia(d,u);case f.Project:return i||new N(d);case f.InstalledProject:return i||new Eo(d,u);case f.ActionDescriptor:return i||new pt(d,u);case f.ReturnStatement:return i||new po(d,u);case f.Loop:return i||new ki(d,u);case f.Search:return i||new vo(d,u);case f.ValueDescriptor:return i||new Rn(d,u);case f.BuiltInBaseEntity:return i||new ua(d,u);case f.InternalCall:return i||new To(d,u);case f.ContinueStatement:return i||new Mi(d,u);case f.BreakStatement:return i||new Io(d,u);case f.GenericReference:return u.get(d.entityId);default:throw new Error("Invalid entity type: "+d.type)}}function te(d,u){if(!d)throw new Error("Entity is null");const i=dr(d,u);return i.subscribe(),i}function Mbe(d,u){if(!d)throw new Error("Entity is null");switch(d.type){case f.LiteralValue:return Zi.fromGenerationTarget(d,u);case f.DefinitionEntity:return da.fromGenerationTarget(d,u);case f.FunctionDeclaration:return uo.fromGenerationTarget(d,u);case f.GlobalEvent:return fo.fromGenerationTarget(d,u);case f.DataType:return vs.fromGenerationTarget(d,u);case f.Property:return la.fromGenerationTarget(d,u);case f.FunctionCall:return Do.fromGenerationTarget(d,u);case f.Condition:return ho.fromGenerationTarget(d,u);case f.Operation:return co.fromGenerationTarget(d,u);case f.VariableDeclaration:return mo.fromGenerationTarget(d,u);case f.VariableInstance:return yo.fromGenerationTarget(d,u);case f.OutputMap:return wn.fromGenerationTarget(d,u);case f.ReturnDeclaration:return ss.fromGenerationTarget(d,u);case f.ArgumentDeclaration:return ea.fromGenerationTarget(d,u);case f.InputMap:return ia.fromGenerationTarget(d,u);case f.InstalledProject:return Eo.fromGenerationTarget(d,u);case f.ReturnStatement:return po.fromGenerationTarget(d,u);case f.Loop:return ki.fromGenerationTarget(d,u);case f.Search:return vo.fromGenerationTarget(d,u);case f.ActionDescriptor:return pt.fromGenerationTarget(d,u);case f.ValueDescriptor:return Rn.fromGenerationTarget(d,u);case f.InternalCall:return To.fromGenerationTarget(d,u);case f.ContinueStatement:return Mi.fromGenerationTarget(d,u);case f.BreakStatement:return Io.fromGenerationTarget(d,u);default:throw new Error("Invalid entity type: "+d.type)}}const ke={seenEntityMaps:new Map,seenEntities:new Set,timestamp:L().toISOString()};class cK{constructor(){g(this,"initialData")}}const ve={cascade:!1},pK={APILoad:async(d,...u)=>null},Bbe={APICreate:async(d,...u)=>d,APIUpdate:async(d,...u)=>d,APIDelete:async(d,...u)=>d,APIClone:async(d,...u)=>{},APILoadVersion:async(d,u,...i)=>null,...pK};class Ube{}class xbe extends cK{}class jbe{}class Gbe{}class Fbe{}class fw{}class Sbe extends fw{}class Kbe extends fw{}class kbe{}class yf{static initReadsValue(u){if(u.initialData.readsValue&&u.initialData.readsValue.type!==f.GenericReference)u.readsValue=te(u.initialData.readsValue,u.project);else if(u.initialData.readsValue&&u.initialData.readsValue.type===f.GenericReference){const i=Wi(u.initialData.readsValue,u.project);i&&(u.readsValue=i)}if(u.readsValue){if(Tt.includes(u.readsValue.type)){let i=u.parent;Br.includes(i.type)||(i=i.parent);const a=u.type===f.InputMap&&u.parent.type===f.Loop;a&&(i=u.parent.parent),u.readsValue.setParent(i,null),u.readsValue.initChildren(null),i&&i.type!==f.Project&&!a&&i.detachedChildren.includes(u)?i.replaceDetachedChild(u,u.readsValue):i&&i.type!==f.Project&&!a&&i.subscribeDetachedChild(u.readsValue)}u.readsValue.addValueReader(u,null)}return u.readsValue}}class mf{static initWritesValues(u,i){const a=u.initialData.writesValues.reduce((p,e)=>{if(e.type===f.GenericReference||u.writesValues.some(v=>v.id===e.id))return p;const y=te(e,u.project);return y.setValueWriter(u,null),Tt.includes(y.type)&&(y.setParent(i,null),y.initChildren(null)),[...p,y]},[]),o=[...u.writesValues];return u.writesValues=R([...o,...a]),u.writesValues}}class qbe{}var Vr=(d=>(d.PROJECT_INITIALIZED="project-initialized",d.CHANGE_SET_CLOSED="change-set-closed",d.EXPLICIT_DEFINITION_ENTITY_ADDED="explicit-definition-entity-added",d.EXPLICIT_DEFINITION_ENTITY_REMOVED="explicit-definition-entity-removed",d.EXPLICIT_DEFINITION_ENTITY_UPDATED="explicit-definition-entity-updated",d.PERSISTED_DEFINITION_ENTITY_ADDED="persisted-definition-entity-added",d.PERSISTED_DEFINITION_ENTITY_REMOVED="persisted-definition-entity-removed",d.PERSISTED_DEFINITION_ENTITY_UPDATED="persisted-definition-entity-updated",d.RELATIONAL_DATABASE_DEFINITION_ENTITY_ADDED="relational-database-definition-entity-added",d.RELATIONAL_DATABASE_DEFINITION_ENTITY_REMOVED="relational-database-definition-entity-removed",d.RELATIONAL_DATABASE_DEFINITION_ENTITY_UPDATED="relational-database-definition-entity-updated",d))(Vr||{});const hw={...pb,events:new Yp},fK={requestActiveDynamicValue:d=>null,...hw},yt=class yt extends Nr{constructor(i,a={...fK,events:new Yp}){super(i);g(this,"initialData");g(this,"id");g(this,"type",f.Project);g(this,"name",null);g(this,"description",null);g(this,"x");g(this,"y");g(this,"entities",[]);g(this,"projects",[]);g(this,"functions",[]);g(this,"events",[]);g(this,"variableDeclarations",[]);g(this,"variableInstances",[]);g(this,"conditions",[]);g(this,"operations",[]);g(this,"functionCalls",[]);g(this,"loops",[]);g(this,"searches",[]);g(this,"primitives",[]);g(this,"builtInBaseEntities",[]);g(this,"operationDeclarations",[]);g(this,"globalEventActionDescriptors",[]);g(this,"loopDeclarations",[]);g(this,"loopDeclarationsBodies",[]);g(this,"conditionDeclarations",[]);g(this,"valueDescriptors",[]);g(this,"dataTypes",[]);g(this,"project");g(this,"instances",{});g(this,"builtInInstances",{});g(this,"deletedInstances",{});g(this,"errors",[]);g(this,"references",[]);g(this,"history",[]);g(this,"undoableStackValueIndex",-1);g(this,"detachedDependents",{});g(this,"knownVersions",null);g(this,"activeVersion",!1);g(this,"initialized",!1);g(this,"startedInitialization",!1);g(this,"onCloseChangeSetCallback",null);g(this,"onAddChangeSetCallback",null);g(this,"onDiscardChangeSetCallback",null);if(this.parentContext=a,this.initialData=i,this.id=i.id,this.name=i.name,this.description=i.description,this.x=0,this.y=0,this.instances[this.id]=this,!yt.UUID)throw new Error("UUID module is already initialized. Please inject a valid UUID module.")}static get UUID(){return this.parentContext.requestModule("uuid")}static new(i=null){return{id:yt.UUID.uuid(),version:yt.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||yt.sessionAuthor,previousVersion:null,deleted:!1,type:f.Project,name:"",description:"",entities:[],functions:[],events:[],projects:[],variableDeclarations:[],variableInstances:[],conditions:[],operations:[],functionCalls:[],loops:[],searches:[]}}static validateGenerationTarget(i,a){let o=JSON.parse(JSON.stringify(i));const p=[];return p.push(...Ur(o)),{errors:p,modifiedData:o}}get off(){return this.parentContext.events.off}get on(){return this.parentContext.events.on}get emit(){return this.parentContext.events.emit}async closePendingChangeSets(){const i=this.history.find(a=>a.dirty&&!a.open);i&&await this.closeChangeSet(i)}async onCloseChangeSet(i){this.onCloseChangeSetCallback=i,await this.closePendingChangeSets()}onAddChangeSet(i){this.onAddChangeSetCallback=i}onDiscardChangeSet(i){this.onDiscardChangeSetCallback=i}async closeChangeSet(i){const a=this.history.findIndex(e=>e.id===i.id),o=this.history.slice(0,a),p=o[o.length-1];if(!(p!=null&&p.dirty)&&this.onCloseChangeSetCallback){(await this.onCloseChangeSetCallback(i)).success&&(i.dirty=!1,this.emit("change-set-closed",i),this.closePendingChangeSets());return}}toLatestChangeSet(i,a,o,p=!1,e="here-this"){if(!this.history.length)return new G(this,i,a,o,p,e);const y=this.history[this.history.length-1];return y.open?y:this.addChangeSet(new G(this,i,a,o,p,e))}addChangeSet(i){var p,e;if(!this.history.length)return this.undoableStackValueIndex=mA(this.undoableStackValueIndex,this.history,i),(p=this.onAddChangeSetCallback)==null||p.call(this,i,this.undoableStackValueIndex),i;const a=this.history.find(y=>y.id===(i==null?void 0:i.id));if(a)return a;const o=this.history.find(y=>y.open);if(o)throw Me.warn("Previous still open: ",o),Me.warn("New change set: ",i),new Error(`There is already an open change-set with id '${o.id}'.`);return this.undoableStackValueIndex=mA(this.undoableStackValueIndex,this.history,i),(e=this.onAddChangeSetCallback)==null||e.call(this,i,this.undoableStackValueIndex),i}discardChangeSet(i){var o;const a=this.history.findIndex(p=>p.id===(i==null?void 0:i.id));return a!==-1&&(this.history.splice(a,1),this.undoableStackValueIndex=this.undoableStackValueIndex-1,(o=this.onDiscardChangeSetCallback)==null||o.call(this,i)),this}validateGeneratedUpdate(i){return{errors:[],modifiedData:i}}subscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new G(this.project,yt.sessionAuthor,L().toISOString(),this,!0,"sync-dependents"))){const a=[],o=[],p=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),o.push(...v.added),p.push(...v.removed),e.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}onDetachedDependencyRemoved(i,a,o){const p=[],e=[],y=[],v=[];return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,o){const p=[],e=[],y=[],v=[];return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){return this}subscribeToDependencies(){return this}increaseVersion(i){if(i&&!L(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&L(i).isSame(L(this.createdAt))?this:(this.previousVersion=this.version,this.version=yt.UUID.uuid(),this.createdAt=L(i).toISOString()||L().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new yt(this);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.entities=[...this.entities],i.projects=[...this.projects],i.functions=[...this.functions],i.events=[...this.events],i.variableDeclarations=[...this.variableDeclarations],i.variableInstances=[...this.variableInstances],i.conditions=[...this.conditions],i.operations=[...this.operations],i.functionCalls=[...this.functionCalls],i.loops=[...this.loops],i.searches=[...this.searches],this}recursiveCaptureUpstreamVersions(i){const a=[],o=[],p=[],e=[];return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}async restoreVersion(i){var v;const a=[],o=[],p=[],e=[];if(this.version===i)return{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[$,V]of A.knownVersions)E.set($,V);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new yt(E)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.entities=y.entities,this.projects=y.projects,this.functions=y.functions,this.events=y.events,this.variableDeclarations=y.variableDeclarations,this.variableInstances=y.variableInstances,this.conditions=y.conditions,this.operations=y.operations,this.functionCalls=y.functionCalls,this.loops=y.loops,this.searches=y.searches,{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,yt.sessionAuthor,L().toISOString(),this,!0,"update-with-shallow-transfer"))){return this.metaSync(i,a),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const i=[],a=[],o=[],p=[];return{updated:R(i),added:R(a),removed:R(o),affected:R(p),self:this}}afterAllChildrenInitialized(i=null){const a=[],o=[],p=[],e=[];return this.initialized||(this.initialized=!0,this.emit("project-initialized",this,i)),this.validate(),this.captureVersion(),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}addSelfToProject(i){const a=[],o=[],p=[],e=[];return this.subscribe(),this.subscribeToDependencies(),{updated:R(a),added:R(o),removed:R(p),affected:R(e),self:this}}get instancesList(){return Object.values(this.instances)}isOperationDeclaration(i){return this.operationDeclarations.includes(i)}isGlobalEventActionDescriptor(i){return this.globalEventActionDescriptors.includes(i)}isLoopDeclaration(i){return this.loopDeclarations.includes(i)}isConditionDeclaration(i){return this.conditionDeclarations.includes(i)}initChildren(i=this.project.addChangeSet(new G(this.project,yt.sessionAuthor,L().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.entities=this.initialData.entities.map(a=>{const o=te(a,this);return o.setParent(this,null),o.initChildren(i),o}),this.projects=this.initialData.projects.map(a=>{const o=te(a,this);return o.setParent(this,null),o.initChildren(i),o}),this.variableDeclarations=this.initialData.variableDeclarations.map(a=>{const o=te(a,this);return o.setParent(this,null),o.initChildren(i),o}),this.variableInstances=this.initialData.variableInstances.map(a=>{const o=te(a,this);return o.setParent(this,null),o.initChildren(i),o}),this.conditions=this.initialData.conditions.map(a=>{const o=te(a,this);return o.setParent(this,null),o.initChildren(i),o}),this.operations=this.initialData.operations.map(a=>{const o=te(a,this);return o.setParent(this,null),o.initChildren(i),o}),this.functions=this.initialData.functions.map(a=>{const o=te(a,this);return o.setParent(this,null),o.initChildren(i),o}),this.events=this.initialData.events.map(a=>{const o=te(a,this);return o.setParent(this,null),o.initChildren(i),o}),this.functionCalls=this.initialData.functionCalls.map(a=>{const o=te(a,this);return o.setParent(this,null),o.initChildren(i),o}),this.loops=this.initialData.loops.map(a=>{const o=te(a,this);return o.setParent(this,null),o.initChildren(i),o}),this.searches=this.initialData.searches.map(a=>{const o=te(a,this);return o.setParent(this,null),o.initChildren(i),o}),this.attachOrphanReferences(),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}subscribeInstance(i){return(!this.instances[i.id]||this.instances[i.id]!==i)&&(this.instances[i.id]=i),this}subscribeDeletedInstance(i){return(!this.deletedInstances[i.id]||this.deletedInstances[i.id]!==i)&&(this.deletedInstances[i.id]=i),this}subscribeBuiltInInstance(i){return(!this.builtInInstances[i.id]||this.builtInInstances[i.id]!==i)&&(this.builtInInstances[i.id]=i),this}subscribe(){return this}unsubscribe(){return this}unsubscribeInstance(i){return delete this.instances[i.id],this}unsubscribeDeletedInstance(i){return delete this.deletedInstances[i.id],this}findSubscribedBuiltInInstance(i){return this.builtInInstances[i.id]||null}get(i){return this.instances[i]||this.builtInInstances[i]||null}getDeleted(i){return this.deletedInstances[i]||null}getManaged(i){return this.getBuiltIn(i)?null:this.instances[i]||null}getBuiltIn(i){return this.builtInInstances[i]||null}findSubscribedInstanceFromReference(i){return this.instances[i.entityId]||null}findSubscribedBuiltInInstanceFromReference(i){return this.builtInInstances[i.entityId]||null}metaSync(i,a=this.project.addChangeSet(new G(this.project,yt.sessionAuthor,L().toISOString(),this,!0,"meta-sync"))){const o=xr(this,i),p=this.toMeta();return this.name=i.name!==void 0?i.name:p.name,this.description=i.description!==void 0?i.description:p.description,this.x=i.x||p.x,this.y=i.y||p.y,super.metaSync(i),i.deleted===!0&&!p.deleted?a==null||a.add(this,S.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,S.Added):o&&(a==null||a.add(this,S.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ve,...a){return await yt.repository.APILoad(this.id,...a),this}async APICreate(i=ve,...a){return await yt.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ve,...a){return await yt.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ve,...a){return await yt.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ve,...a){return await yt.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ve,a,...o){return await yt.repository.APILoadVersion(this.id,a,...o)}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,yt.sessionAuthor,L().toISOString(),this,!0,"remove-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,yt.sessionAuthor,L().toISOString(),this,!0,"restore-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}getAllBuiltInIds(){const i=new Set;return[...this.primitives.flatMap(a=>a.toFlatIds(i)),...this.builtInBaseEntities.flatMap(a=>a.toFlatIds(i)),...this.operationDeclarations.flatMap(a=>a.toFlatIds(i)),...this.globalEventActionDescriptors.flatMap(a=>a.toFlatIds(i)),...this.loopDeclarations.flatMap(a=>a.toFlatIds(i)),...this.conditionDeclarations.flatMap(a=>a.toFlatIds(i)),...this.valueDescriptors.flatMap(a=>a.toFlatIds(i)),...this.dataTypes.flatMap(a=>a.toFlatIds(i))]}getAllBuiltIn(){const i=new Set;return[...this.primitives.flatMap(a=>a.toFlat(i)),...this.builtInBaseEntities.flatMap(a=>a.toFlat(i)),...this.operationDeclarations.flatMap(a=>a.toFlat(i)),...this.globalEventActionDescriptors.flatMap(a=>a.toFlat(i)),...this.loopDeclarations.flatMap(a=>a.toFlat(i)),...this.conditionDeclarations.flatMap(a=>a.toFlat(i)),...this.valueDescriptors.flatMap(a=>a.toFlat(i)),...this.dataTypes.flatMap(a=>a.toFlat(i))]}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.entities.flatMap(o=>o.toFlat(i)),...this.functions.flatMap(o=>o.toFlat(i)),...this.events.flatMap(o=>o.toFlat(i)),...this.projects.flatMap(o=>o.toFlat(i)),...this.variableDeclarations.flatMap(o=>o.toFlat(i)),...this.variableInstances.flatMap(o=>o.toFlat(i)),...this.conditions.flatMap(o=>o.toFlat(i)),...this.operations.flatMap(o=>o.toFlat(i)),...this.functionCalls.flatMap(o=>o.toFlat(i)),...this.loops.flatMap(o=>o.toFlat(i)),...this.searches.flatMap(o=>o.toFlat(i))])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.entities.flatMap(o=>o.toFlatIds(i)),...this.functions.flatMap(o=>o.toFlatIds(i)),...this.events.flatMap(o=>o.toFlatIds(i)),...this.projects.flatMap(o=>o.toFlatIds(i)),...this.variableDeclarations.flatMap(o=>o.toFlatIds(i)),...this.variableInstances.flatMap(o=>o.toFlatIds(i)),...this.conditions.flatMap(o=>o.toFlatIds(i)),...this.operations.flatMap(o=>o.toFlatIds(i)),...this.functionCalls.flatMap(o=>o.toFlatIds(i)),...this.loops.flatMap(o=>o.toFlatIds(i)),...this.searches.flatMap(o=>o.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,type:this.type,name:this.name}}toJSON(i=new Set){return i.has(this.id)?this.toReference():(i.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(a=>a.toJSON(i)),variableDeclarations:this.variableDeclarations.map(a=>a.toJSON(i)),variableInstances:this.variableInstances.map(a=>a.toJSON(i)),conditions:this.conditions.map(a=>a.toJSON(i)),operations:this.operations.map(a=>a.toJSON(i)),loops:this.loops.map(a=>a.toJSON(i)),searches:this.searches.map(a=>a.toJSON(i)),functions:this.functions.map(a=>a.toJSON(i)),events:this.events.map(a=>a.toJSON(i)),projects:this.projects.map(a=>a.toJSON(i)),functionCalls:this.functionCalls.map(a=>a.toJSON(i))})}toJSONClone(i={uuidStrategy:"uuid"}){const a=new Map,o=new Set,p=this.getAllBuiltInIds();return Object.keys(this.instances).forEach(e=>{if(p.includes(e)){a.set(e,e);return}a.set(e,yt.UUID.uuid())}),o.add(this.id),{id:a.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(e=>e.toJSONClone({...i,seenEntityMaps:a,seenEntities:o,newId:null})),projects:this.projects.map(e=>e.toJSONClone({...i,seenEntityMaps:a,seenEntities:o,newId:null})),variableDeclarations:this.variableDeclarations.map(e=>e.toJSONClone({...i,seenEntityMaps:a,seenEntities:o,newId:null})),variableInstances:this.variableInstances.map(e=>e.toJSONClone({...i,seenEntityMaps:a,seenEntities:o,newId:null})),conditions:this.conditions.map(e=>e.toJSONClone({...i,seenEntityMaps:a,seenEntities:o,newId:null})),operations:this.operations.map(e=>e.toJSONClone({...i,seenEntityMaps:a,seenEntities:o,newId:null})),functions:this.functions.map(e=>e.toJSONClone({...i,seenEntityMaps:a,seenEntities:o,newId:null})),events:this.events.map(e=>e.toJSONClone({...i,seenEntityMaps:a,seenEntities:o,newId:null})),functionCalls:this.functionCalls.map(e=>e.toJSONClone({...i,seenEntityMaps:a,seenEntities:o,newId:null})),loops:this.loops.map(e=>e.toJSONClone({...i,seenEntityMaps:a,seenEntities:o,newId:null})),searches:this.searches.map(e=>e.toJSONClone({...i,seenEntityMaps:a,seenEntities:o,newId:null}))}}toReference(i=ke){var o;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+yt.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=ke){var o;let a=this.id;return(o=i.seenEntityMaps)!=null&&o.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,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(p=>p.toReference(i)),functions:this.functions.map(p=>p.toReference(i)),events:this.events.map(p=>p.toReference(i)),projects:this.projects.map(p=>p.toReference(i)),variableDeclarations:this.variableDeclarations.map(p=>p.toReference(i)),variableInstances:this.variableInstances.map(p=>p.toReference(i)),conditions:this.conditions.map(p=>p.toReference(i)),operations:this.operations.map(p=>p.toReference(i)),functionCalls:this.functionCalls.map(p=>p.toReference(i)),loops:this.loops.map(p=>p.toReference(i)),searches:this.searches.map(p=>p.toReference(i))}}toFlatJSON(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.entities.flatMap(o=>o.toFlatJSON(i)),...this.functions.flatMap(o=>o.toFlatJSON(i)),...this.events.flatMap(o=>o.toFlatJSON(i)),...this.projects.flatMap(o=>o.toFlatJSON(i)),...this.variableDeclarations.flatMap(o=>o.toFlatJSON(i)),...this.variableInstances.flatMap(o=>o.toFlatJSON(i)),...this.conditions.flatMap(o=>o.toFlatJSON(i)),...this.operations.flatMap(o=>o.toFlatJSON(i)),...this.functionCalls.flatMap(o=>o.toFlatJSON(i)),...this.loops.flatMap(o=>o.toFlatJSON(i)),...this.searches.flatMap(o=>o.toFlatJSON(i))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description}}toFlatGenerationTarget(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[...this.entities.flatMap(o=>o.toFlatGenerationTarget(i)),...this.functions.flatMap(o=>o.toFlatGenerationTarget(i)),...this.events.flatMap(o=>o.toFlatGenerationTarget(i)),...this.projects.flatMap(o=>o.toFlatGenerationTarget(i)),...this.variableDeclarations.flatMap(o=>o.toFlatGenerationTarget(i)),...this.variableInstances.flatMap(o=>o.toFlatGenerationTarget(i)),...this.conditions.flatMap(o=>o.toFlatGenerationTarget(i)),...this.operations.flatMap(o=>o.toFlatGenerationTarget(i)),...this.functionCalls.flatMap(o=>o.toFlatGenerationTarget(i)),...this.loops.flatMap(o=>o.toFlatGenerationTarget(i)),...this.searches.flatMap(o=>o.toFlatGenerationTarget(i))])}clearErrors(){return this.errors=[],this.entities.forEach(i=>i.clearErrors()),this.projects.forEach(i=>i.clearErrors()),this.functions.forEach(i=>i.clearErrors()),this.events.forEach(i=>i.clearErrors()),this.variableDeclarations.forEach(i=>i.clearErrors()),this.variableInstances.forEach(i=>i.clearErrors()),this.conditions.forEach(i=>i.clearErrors()),this.operations.forEach(i=>i.clearErrors()),this.functionCalls.forEach(i=>i.clearErrors()),this.loops.forEach(i=>i.clearErrors()),this.searches.forEach(i=>i.clearErrors()),this}validate(){return this.validateChildren(),uI([...this.errors]),{success:!0}}validateChildren(){this.entities.forEach(i=>i.validate()),this.projects.forEach(i=>i.validate()),this.functions.forEach(i=>i.validate()),this.events.forEach(i=>i.validate()),this.variableDeclarations.forEach(i=>i.validate()),this.variableInstances.forEach(i=>i.validate()),this.conditions.forEach(i=>i.validate()),this.operations.forEach(i=>i.validate()),this.functionCalls.forEach(i=>i.validate()),this.loops.forEach(i=>i.validate()),this.searches.forEach(i=>i.validate())}getErrors(){return[...this.errors,...this.entities.flatMap(a=>a.getErrors()),...this.projects.flatMap(a=>a.getErrors()),...this.functions.flatMap(a=>a.getErrors()),...this.events.flatMap(a=>a.getErrors()),...this.variableDeclarations.flatMap(a=>a.getErrors()),...this.variableInstances.flatMap(a=>a.getErrors()),...this.conditions.flatMap(a=>a.getErrors()),...this.operations.flatMap(a=>a.getErrors()),...this.functionCalls.flatMap(a=>a.getErrors()),...this.loops.flatMap(a=>a.getErrors()),...this.searches.flatMap(a=>a.getErrors())]}getShallowErrors(){return this.errors}clone(){return this}getDefinitionEntity(i){return this.entities.find(a=>a.id===i)||null}addDefinitionEntity(i){return this.entities.includes(i)||this.entities.push(i),i}addFunctionDeclaration(i){return this.functions.includes(i)||this.functions.push(i),i}addFunctionCall(i){return this.functionCalls.includes(i)||this.functionCalls.push(i),i}addVariableDeclaration(i){return this.variableDeclarations.includes(i)||this.variableDeclarations.push(i),i}addVariableInstance(i){return this.variableInstances.includes(i)||this.variableInstances.push(i),i}addInstalledProject(i){return this.projects.includes(i)||this.projects.push(i),this}addGlobalEvent(i){return this.events.includes(i)||this.events.push(i),this}addCondition(i){return this.conditions.includes(i)||this.conditions.push(i),this}addOperation(i){return this.operations.includes(i)||this.operations.push(i),this}addLoop(i){return this.loops.includes(i)||this.loops.push(i),this}addSearch(i){return this.searches.includes(i)||this.searches.push(i),this}removeDefinitionEntity(i){const a=this.entities.findIndex(o=>o.id===i.id);if(a>-1){const o=this.entities[a];return this.entities.splice(a,1),o}return null}removeCondition(i){const a=this.conditions.findIndex(o=>o.id===i.id);if(a>-1){const o=this.conditions[a];return this.conditions.splice(a,1),o}return null}removeOperation(i){const a=this.operations.findIndex(o=>o.id===i.id);if(a>-1){const o=this.operations[a];return this.operations.splice(a,1),o}return null}removeLoop(i){const a=this.loops.findIndex(o=>o.id===i.id);if(a>-1){const o=this.loops[a];return this.loops.splice(a,1),o}return null}removeSearch(i){const a=this.searches.findIndex(o=>o.id===i.id);if(a>-1){const o=this.searches[a];return this.searches.splice(a,1),o}return null}removeFunctionCall(i){const a=this.functionCalls.findIndex(o=>o.id===i.id);if(a>-1){const o=this.functionCalls[a];return this.functionCalls.splice(a,1),o}return null}removeVariableInstance(i){const a=this.variableInstances.findIndex(o=>o.id===i.id);if(a>-1){const o=this.variableInstances[a];return this.variableInstances.splice(a,1),o}return null}removeVariableDeclaration(i){const a=this.variableDeclarations.findIndex(o=>o.id===i.id);if(a>-1){const o=this.variableDeclarations[a];return this.variableDeclarations.splice(a,1),o}return null}removeFunctionDeclaration(i){const a=this.functions.findIndex(o=>o.id===i.id);if(a>-1){const o=this.functions[a];return this.functions.splice(a,1),o}return null}removeInstalledProject(i){const a=this.projects.findIndex(o=>o.id===i.id);if(a>-1){const o=this.projects[a];return this.projects.splice(a,1),o}return null}removeGlobalEvent(i){const a=this.events.findIndex(o=>o.id===i.id);if(a>-1){const o=this.events[a];return this.events.splice(a,1),o}return null}removeTopLevelVariableDeclaration(i){if(i.type!==f.VariableDeclaration)return null;const a=this.variableDeclarations.findIndex(o=>o.id===i.id);if(a>-1){const o=this.variableDeclarations[a];return this.variableDeclarations.splice(a,1),o}return null}getEntryPoints(){return[...this.functions,...this.events,...this.entities.flatMap(a=>a.methods)]}getTerminationStatements(){return[...this.getEntryPoints().reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.ReturnStatement||e.type===f.ContinueStatement||e.type===f.BreakStatement)]},[])]}getFunctionDeclaration(i){return this.functions.find(a=>a.id===i)||null}getConditions(){return[...this.conditions,...this.getEntryPoints().reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Condition)]},[]),...this.functionCalls.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Condition)]},[]),...this.operations.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Condition)]},[]),...this.loops.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Condition)]},[]),...this.searches.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Operation)]},[]),...this.functionCalls.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Operation)]},[]),...this.conditions.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Operation)]},[]),...this.loops.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Operation)]},[]),...this.searches.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.FunctionCall)]},[]),...this.conditions.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.FunctionCall)]},[]),...this.operations.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.FunctionCall)]},[]),...this.loops.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.FunctionCall)]},[]),...this.searches.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((a,o)=>{const p=vr(o);return[...a,...p]},[]),...this.functionCalls.reduce((a,o)=>{const p=vr(o);return[...a,...p]},[]),...this.conditions.reduce((a,o)=>{const p=vr(o);return[...a,...p]},[]),...this.operations.reduce((a,o)=>{const p=vr(o);return[...a,...p]},[]),...this.loops.reduce((a,o)=>{const p=vr(o);return[...a,...p]},[]),...this.searches.reduce((a,o)=>{const p=vr(o);return[...a,...p]},[])]}getVariableInstances(){return[...this.variableInstances,...this.entities.reduce((a,o)=>[...a,...o.methods.flatMap(p=>{const y=_t(p).filter(v=>v.type===f.VariableInstance);return[...a,...y]})],[]),...this.getEntryPoints().reduce((a,o)=>{const e=vr(o).filter(y=>y.type===f.VariableInstance);return[...a,...e]},[]),...this.functionCalls.reduce((a,o)=>{const e=vr(o).filter(y=>y.type===f.VariableInstance);return[...a,...e]},[]),...this.conditions.reduce((a,o)=>{const e=vr(o).filter(y=>y.type===f.VariableInstance);return[...a,...e]},[]),...this.operations.reduce((a,o)=>{const e=vr(o).filter(y=>y.type===f.VariableInstance);return[...a,...e]},[]),...this.loops.reduce((a,o)=>{const e=vr(o).filter(y=>y.type===f.VariableInstance);return[...a,...e]},[]),...this.searches.reduce((a,o)=>{const e=vr(o).filter(y=>y.type===f.VariableInstance);return[...a,...e]},[])]}getVariableDeclarations(){return R([...this.variableDeclarations,...this.entities.reduce((a,o)=>[...a,...o.methods.flatMap(p=>{const y=_t(p).filter(v=>v.type===f.VariableDeclaration);return[...a,...y]})],[]),...this.getEntryPoints().reduce((a,o)=>{const e=vr(o).filter(y=>y.type===f.VariableDeclaration);return[...a,...e]},[]),...this.functionCalls.reduce((a,o)=>{const e=vr(o).filter(y=>y.type===f.VariableDeclaration);return[...a,...e]},[]),...this.conditions.reduce((a,o)=>{const e=vr(o).filter(y=>y.type===f.VariableDeclaration);return[...a,...e]},[]),...this.operations.reduce((a,o)=>{const e=vr(o).filter(y=>y.type===f.VariableDeclaration);return[...a,...e]},[]),...this.loops.reduce((a,o)=>{const e=vr(o).filter(y=>y.type===f.VariableDeclaration);return[...a,...e]},[]),...this.searches.reduce((a,o)=>{const e=vr(o).filter(y=>y.type===f.VariableDeclaration);return[...a,...e]},[])])}getLoops(){return[...this.loops,...this.getEntryPoints().reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Loop)]},[]),...this.functionCalls.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Loop)]},[]),...this.conditions.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Loop)]},[]),...this.operations.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Loop)]},[]),...this.searches.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Loop)]},[])]}getSearches(){return[...this.searches,...this.getEntryPoints().reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Search)]},[]),...this.functionCalls.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Search)]},[]),...this.conditions.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Search)]},[]),...this.operations.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Search)]},[]),...this.loops.reduce((a,o)=>{const p=_t(o);return[...a,...p.filter(e=>e.type===f.Search)]},[])]}attachOrphanReferences(){const i=this.getVariableInstances(),a=this.getVariableDeclarations();return i.forEach(o=>{if(!o.declaration){const p=o.initialData,e=p.declaration.entityId||p.declaration.id,y=a.find(v=>v.id===e);y&&o.setDeclaration(y)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(i=>i.name===Ue.PERSISTED_ENTITY)||null}requestActiveDynamicValue(i){var o,p;const a=(p=(o=this.parentContext).requestActiveDynamicValue)==null?void 0:p.call(o,i);if(!a){const e=i.getDefaultValue();return e?{value:e,type:be.DefaultValue,inheritanceLink:null,valueOwner:i}:null}return a||null}requestModule(i){if(this.parentContext.requestModule){const a=this.parentContext.requestModule(i);return!a&&i==="uuid"?ec:a||null}return i==="uuid"?ec:null}undo(){Me.log("Undoing, from: ",this.undoableStackValueIndex),this.undoableStackValueIndex=this.undoableStackValueIndex-1,Me.log("To: ",this.undoableStackValueIndex);const i=this.history[this.undoableStackValueIndex+1],a=this.history[this.undoableStackValueIndex];return Me.log("Current change set: ",i==null?void 0:i.toJSON()),Me.log("Change set to restore: ",a==null?void 0:a.toJSON()),hA(i||"initial",a||"initial",this)}redo(){Me.log("Undoing, from: ",this.undoableStackValueIndex),this.undoableStackValueIndex=this.undoableStackValueIndex+1,Me.log("To: ",this.undoableStackValueIndex);const i=this.history[this.undoableStackValueIndex-1],a=this.history[this.undoableStackValueIndex];return Me.log("Current change set: ",i==null?void 0:i.toJSON()),Me.log("Change set to restore: ",a.toJSON()),hA(i||"initial",a||"initial",this)}applyExternalChangeSet(i){const a=i.payload,o=this.addChangeSet(new G(this,i.userAuthor,i.emittedAt,this)),p=a.updated[this.id];if(!p)throw new Error("Project root not found in change set transfer. Cannot apply changes.");const e={...a.added,...a.updated,...a.removed},y=[...Object.keys(a.added),...Object.keys(a.updated),...Object.keys(a.removed)];y.forEach(E=>{var b;if(!e[E]){Me.warn(`Entity '${E}' not found in change set transfer. Cannot apply changes.`);const A=(b=this.get(E))==null?void 0:b.toShallowJSON();throw A?Me.warn("Entity in project: ",A):Me.warn("Entity not in project"),new Error(`Entity '${E}' not found in change set transfer. Cannot apply changes.`)}});const v=new oa(p);return v.flatRecord=e,v.order=y,v.orderEntities(),Me.log("All entities: ",v.order.map((E,b)=>`${b+1}: ${e[E].type} - ${E}`).join(`,
|
|
409
|
-
`)),Me.log("Persisting new additions"),v.visit(async(E,b)=>{if(a.added[E.id]){Me.log("Adding: ",E.id);try{const A=te(E,this);if(A.hydrateAncestors(),A.addSelfToProject(o),o.add(A,S.Added),!this.get(E.id))throw new Error(`Entity ${E.id} was not added to the project`)}catch(A){Me.error("Error: ",A),Me.error("Errored entity: ",E)}}}),Me.log("Persisting updates"),v.visit(async(E,b)=>{if(a.updated[E.id]){Me.log("Updating: ",E.id);try{const A=this.get(E.id);A?(A.updateWithShallowTransfer(E,o),o.add(A,S.Updated)):Me.warn(`Active version of ${E.id} not found when applying external changes`)}catch(A){Me.error("Error: ",A),Me.error("Errored entity: ",E)}}}),Me.log("Persisting removals"),v.visit(async(E,b)=>{if(a.removed[E.id]){Me.log("Removing: ",E.id);try{const A=this.get(E.id);A&&A.remove({ignoreUpstream:!1},o)}catch(A){Me.error("Error: ",A),Me.error("Errored entity: ",E)}}}),o}toFullProjectTransfer(){const i=new oa(this),a={};return i.visit(o=>{const p=o.toShallowJSON();a[o.id]=p}),{order:i.order,size:i.order.length,record:a}}};g(yt,"parentContext",hw),g(yt,"sessionAuthor","1"),g(yt,"repository",{APICreate:async(i,...a)=>i,APIUpdate:async(i,...a)=>i,APIDelete:async(i,...a)=>i,APIClone:async(i,...a)=>{},APILoad:async(i,...a)=>null,APILoadVersion:async(i,a,...o)=>null}),g(yt,"type",f.Project),g(yt,"USER_MANAGED_PARENT_TYPES",[]),g(yt,"PARENT_TYPES",[...yt.USER_MANAGED_PARENT_TYPES]),g(yt,"MUTABLE_BASE_PROPERTIES",["name","description"]),g(yt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),g(yt,"BASE_PROPERTIES",[...yt.MUTABLE_BASE_PROPERTIES,...yt.INMUTABLE_BASE_PROPERTIES]),g(yt,"MUTABLE_META_PROPERTIES",[...yt.MUTABLE_BASE_PROPERTIES,"x","y"]),g(yt,"INMUTABLE_META_PROPERTIES",[...yt.INMUTABLE_BASE_PROPERTIES]),g(yt,"META_PROPERTIES",[...yt.MUTABLE_META_PROPERTIES,...yt.INMUTABLE_META_PROPERTIES]),g(yt,"MUTABLE_UPSTREAM_PROPERTIES",[]),g(yt,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),g(yt,"UPSTREAM_PROPERTIES",[...yt.MUTABLE_UPSTREAM_PROPERTIES,...yt.INMUTABLE_UPSTREAM_PROPERTIES]),g(yt,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),g(yt,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),g(yt,"DOWNSTREAM_PROPERTIES",[...yt.MUTABLE_DOWNSTREAM_PROPERTIES,...yt.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(yt,"PROPERTIES",[...yt.META_PROPERTIES,...yt.UPSTREAM_PROPERTIES,...yt.DOWNSTREAM_PROPERTIES]);let N=yt;class hK extends pt{constructor(i){super(En,i);g(this,"id",ir.Parallel);g(this,"name",ir.Parallel);g(this,"description","Programmatically execute a list of actions one after the other");g(this,"version","1");g(this,"autoexecutable",!0);g(this,"initialData",En);g(this,"type",f.ActionDescriptor);g(this,"inputs",[]);g(this,"outputs",[]);g(this,"error",null);g(this,"project");this.project=i,this.inputs=En.inputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(null),o}),this.outputs=En.outputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(null),o}),this.error=En.error?te(En.error,this.project):null}}class yK extends pt{constructor(i){super(zi,i);g(this,"id",zi.id);g(this,"name",zi.name);g(this,"description",zi.description);g(this,"version",zi.version);g(this,"autoexecutable",!1);g(this,"initialData",zi);g(this,"type",f.ActionDescriptor);g(this,"inputs",[]);g(this,"outputs",[]);g(this,"error",null);g(this,"project");this.project=i,this.inputs=zi.inputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(null),o}),this.outputs=zi.outputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(null),o}),this.error=zi.error?te(zi.error,this.project):null}}class mK extends pt{constructor(i){super(Pa,i);g(this,"id",ir.Sequential);g(this,"name",ir.Sequential);g(this,"description","Programmatically execute a list of actions one after the other");g(this,"version","1");g(this,"autoexecutable",!0);g(this,"initialData",Pa);g(this,"type",f.ActionDescriptor);g(this,"inputs",[]);g(this,"outputs",[]);g(this,"error",null);g(this,"project");this.project=i,this.inputs=Pa.inputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(null),o}),this.outputs=Pa.outputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(null),o}),this.error=Pa.error?te(Pa.error,this.project):null}}class Zbe extends pt{constructor(u){super(ic,u)}}class Hbe extends pt{constructor(u){super(Jo,u)}}class Jbe extends pt{constructor(i){super(Wo,i);g(this,"autoexecutable",!0)}getEntityToMatchInputMap(i){return i.inputs.find(a=>{var o;return((o=a.declaration)==null?void 0:o.id)===Ee.operation[fr.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(i){return i.inputs.find(a=>{var o;return((o=a.declaration)==null?void 0:o.id)===Ee.operation[fr.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(i){return i.outputs.find(a=>{var o;return((o=a.declaration)==null?void 0:o.id)===Ee.operation[fr.Validate].outputs.outputEntity.id})||null}getEntityToMatch(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"get-entity-to-match-validate-data"))){var e;const o=((e=this.project.requestActiveDynamicValue(i))==null?void 0:e.value)||null,p=o==null?void 0:o.valueAsTypeSingle;return a==null||a.attemptAutoclose("get-entity-to-match-validate-data",this.id),p}syncOperationInstance(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-operation-instance-validate-data"))){const o=[],p=[],e=[],y=[],v=this.getEntityToMatchInputMap(i);if(v){const{added:A,updated:$,removed:V,affected:B}=this.syncEntityToMatchInputMapDataType(v,a);o.push(...$),p.push(...A),e.push(...V),y.push(...B)}const E=this.getDataToValidateInputMap(i);if(E){const{added:A,updated:$,removed:V,affected:B}=this.syncDataToValidateInputMapDataType(E,a);o.push(...$),p.push(...A),e.push(...V),y.push(...B)}const b=this.getOutputDataOutputMap(i);if(b){const{added:A,updated:$,removed:V,affected:B}=this.syncOutputDataOutputMapDataType(b,a);o.push(...$),p.push(...A),e.push(...V),y.push(...B)}return a==null||a.attemptAutoclose("sync-operation-instance-validate-data",this.id),{updated:R(o),added:R(p),removed:R(e),affected:R(y),self:i}}syncEntityToMatchInputMapDataType(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-entity-to-match-input-map-data-type"))){var b,A,$,V,B,F,K,Z,ie,X,ue,re,fe,Y,J,ce,z;const o=[],p=[],e=[],y=[];if(((b=i.declaration)==null?void 0:b.id)!==Ee.operation[fr.Validate].inputs.entityToMatch.id)return a==null||a.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const v=((A=this.project.requestActiveDynamicValue(i))==null?void 0:A.value)||null,E=v==null?void 0:v.valueAsTypeSingle;if(!i.dataType){const de={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,parentRelationType:null,options:(($=i.declaration.dataType)==null?void 0:$.options)||null,implementationChooseOne:((V=i.declaration.dataType)==null?void 0:V.implementationChooseOne)||!1,staticEntities:((B=i.declaration.dataType)==null?void 0:B.staticEntities)??null,interactiveEntities:((F=i.declaration.dataType)==null?void 0:F.interactiveEntities)??null,actionEntities:((K=i.declaration.dataType)==null?void 0:K.actionEntities)??null,index:((Z=i.declaration.dataType)==null?void 0:Z.index)||null,isList:((ie=i.declaration.dataType)==null?void 0:ie.isList)||!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:(E==null?void 0:E.toJSON())||null,like:!0,inferred:!0,parent:i.toReference()},Ae=te(de,i.project);Ae.hydrateAncestors(),Ae.setParent(i,a),Ae.initChildren(a),Ae.setEntity(E,a),a==null||a.add(Ae,S.Added),o.push(Ae),i.setDataType(Ae,a)}return(ce=i.dataType)==null||ce.metaSync({inferred:!0,like:!1,asType:!0,options:((X=i.declaration.dataType)==null?void 0:X.options)||null,implementationChooseOne:((ue=i.declaration.dataType)==null?void 0:ue.implementationChooseOne)||!1,staticEntities:((re=i.declaration.dataType)==null?void 0:re.staticEntities)??null,interactiveEntities:((fe=i.declaration.dataType)==null?void 0:fe.interactiveEntities)??null,actionEntities:((Y=i.declaration.dataType)==null?void 0:Y.actionEntities)??null,isList:((J=i.declaration.dataType)==null?void 0:J.isList)||!1},a),(z=i.dataType)==null||z.setEntity(E,a),i.dataType&&p.push(i.dataType),a==null||a.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:R(p),added:R(o),removed:R(e),affected:R(y),self:i.dataType}}syncDataToValidateInputMapDataType(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-data-to-validate-input-map-data-type"))){var A,$,V;const o=[],p=[],e=[],y=[];if(((A=i.declaration)==null?void 0:A.id)!==Ee.operation[fr.Validate].inputs.dataToValidate.id)return a==null||a.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const v=this.getEntityToMatchInputMap(i.parent);if(!v)return a==null||a.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(v,a))return a==null||a.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!i.dataType){const B={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,index:null,parentRelationType:null,options:null,implementationChooseOne:!1,isList:!1,andChildrenGroup:null,orChildrenGroup:null,staticEntities:null,interactiveEntities:null,actionEntities:null,asType:!1,entity:null,like:!0,inferred:!0,parent:i.toReference()},F=te(B,i.project);F.setParent(i,a),F.initChildren(a),a==null||a.add(F,S.Added),o.push(F),i.setDataType(F,a)}($=i.dataType)==null||$.metaSync({inferred:!0,like:!0,asType:!1},a);const b=this.getEntityToMatch(v,a);return(V=i.dataType)==null||V.setEntity(b,a),i.dataType&&p.push(i.dataType),a==null||a.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:R(p),added:R(o),removed:R(e),affected:R(y),self:i.dataType}}syncOutputDataOutputMapDataType(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-output-data-output-map-data-type"))){var $,V,B,F;const o=[],p=[],e=[],y=[];if((($=i.declaration)==null?void 0:$.id)!==Ee.operation[fr.Validate].outputs.outputEntity.id)return a==null||a.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const v=this.getEntityToMatchInputMap(i.parent);if(!v)return a==null||a.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(v,a))return a==null||a.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const b=((V=this.project.requestActiveDynamicValue(v))==null?void 0:V.value)||null,A=(b==null?void 0:b.valueAsTypeSingle)||null;if(!i.dataType){const K={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:(A==null?void 0:A.toJSON())||null,like:!0,inferred:!0,parent:i.toReference()},Z=te(K,i.project);Z.hydrateAncestors(),Z.setParent(i,a),Z.initChildren(a),Z.setEntity(A,a),a==null||a.add(Z,S.Added),o.push(Z),i.setDataType(Z,a)}return(B=i.dataType)==null||B.metaSync({inferred:!0,like:!0,asType:!1},a),(F=i.dataType)==null||F.setEntity(A,a),i.dataType&&p.push(i.dataType),a==null||a.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:R(p),added:R(o),removed:R(e),affected:R(y),self:i.dataType}}inferInputMapDataType(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"infer-input-map-data-type-validate-data"))){var p,e,y;if(((p=i.declaration)==null?void 0:p.id)===Ee.operation[fr.Validate].inputs.entityToMatch.id){const{added:v,updated:E,removed:b,affected:A}=this.syncEntityToMatchInputMapDataType(i,a);return a==null||a.attemptAutoclose("infer-input-map-data-type",this.id),{updated:R(E),added:R(v),removed:R(b),affected:R(A),self:i.dataType}}if(((e=i.declaration)==null?void 0:e.id)===Ee.operation[fr.Validate].inputs.dataToValidate.id){const{added:v,updated:E,removed:b,affected:A}=this.syncDataToValidateInputMapDataType(i,a);return a==null||a.attemptAutoclose("infer-input-map-data-type",this.id),{updated:R(E),added:R(v),removed:R(b),affected:R(A),self:i.dataType}}const o=(y=i.declaration)==null?void 0:y.getDataType(a);if(o&&o.isResolved)return a==null||a.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:o};if(i.readsValue){const v=bn(i.readsValue,a);return a==null||a.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:v}}return a==null||a.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:null}}inferOutputMapDataType(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"infer-output-map-data-type-validate-data"))){var o;if(((o=i.declaration)==null?void 0:o.id)===Ee.operation[fr.Validate].outputs.outputEntity.id){const{added:p,updated:e,removed:y,affected:v}=this.syncOutputDataOutputMapDataType(i,a);return a==null||a.attemptAutoclose("infer-output-map-data-type-validate-data",this.id),{updated:R(e),added:R(p),removed:R(y),affected:R(v),self:i.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}}class Wbe extends pt{constructor(u){super(tE,u)}}class Ybe extends pt{constructor(u){super(iE,u)}}class zbe extends pt{constructor(u){super(sE,u)}}class Xbe extends pt{constructor(u){super(yh,u)}}class Qbe extends pt{constructor(u){super(ph,u)}}class ewe extends pt{constructor(u){super(rc,u)}}function twe(d){const u=[new mK(d),new hK(d),new yK(d),new Zbe(d),new Hbe(d),new Jbe(d),new Xbe(d),new Wbe(d),new zbe(d),new Ybe(d),new Qbe(d),new ewe(d),new pt(eE,d),new pt(Qv,d),new pt(hE,d),new pt(yE,d),new pt(mE,d),new pt(vE,d),new pt(EE,d),new pt(TE,d),new pt(IE,d),new pt(AE,d),new pt(bE,d),new pt(wE,d)];return u.forEach(i=>{i.initChildren(null),d.subscribeBuiltInInstance(i)}),d.operationDeclarations=u,u}class vK extends ua{constructor(i){super($i,i);g(this,"initialData");g(this,"id",Ue.PERSISTED_ENTITY);g(this,"version","1");g(this,"name",Ue.PERSISTED_ENTITY);g(this,"description",$i.description);g(this,"type",f.BuiltInBaseEntity);g(this,"abstract",$i.abstract);g(this,"static",$i.static);g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"errors",[]);g(this,"project");this.initialData=$i,this.project=i,this.id=$i.id,this.version=$i.version,this.name=$i.name,this.static=$i.static,this.abstract=$i.abstract,this.properties=this.initialData.properties.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(null),o}),this.methods=this.initialData.methods.map(a=>{const o=te(a,this.project);return o.parent=this,o}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const o=te(a,this.project);return o.parent=this,o}),this.extends=this.initialData.extends.map(a=>te(a,this.project))}}var EK=(d=>(d.StatusCodeMustBeNumber="status-code-must-be-number",d.StatusCodeMustBeBetween100And599="status-code-must-be-between-100-and-599",d))(EK||{});function TK(d,u){const i=[];if(typeof u!="number"){const a=new ur({id:d.id+"--status-code-must-be-number",message:`Entity of type ${d.type} with id "${d.id}" has an invalid value "${u}". The value must be a number.`,severity:q.Error,code:"status-code-must-be-number",entity:d});return i.push(a),{errors:i,override:u}}if(u<100){const a=new ur({id:d.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${d.type} with id "${d.id}" has an invalid value "${u}". The value must be a number between 100 and 599.`,severity:q.Error,code:"status-code-must-be-between-100-and-599",entity:d});i.push(a)}if(u>599){const a=new ur({id:d.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${d.type} with id "${d.id}" has an invalid value "${u}". The value must be a number between 100 and 599.`,severity:q.Error,code:"status-code-must-be-between-100-and-599",entity:d});i.push(a)}return{errors:i,override:u}}class IK extends ua{constructor(i){super(ps,i);g(this,"initialData");g(this,"id",Ue.PERSISTED_ENTITY);g(this,"version","1");g(this,"name",Ue.PERSISTED_ENTITY);g(this,"description",ps.description);g(this,"type",f.BuiltInBaseEntity);g(this,"abstract",ps.abstract);g(this,"static",ps.static);g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"errors",[]);g(this,"project");this.initialData=ps,this.project=i,this.id=ps.id,this.version=ps.version,this.name=ps.name,this.static=ps.static,this.abstract=ps.abstract,this.properties=this.initialData.properties.map(e=>{const y=te(e,this.project);return y.setParent(this,null),y.initChildren(null),y}),this.methods=this.initialData.methods.map(e=>{const y=te(e,this.project);return y.parent=this,y}),this.abstractMethods=this.initialData.abstractMethods.map(e=>{const y=te(e,this.project);return y.parent=this,y}),this.extends=this.initialData.extends.map(e=>te(e,this.project));const a=this.properties.find(e=>e.id===Ee["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id);if(!a)throw new Error("Path property not found in endpoint entity");a._codeNativeValueValidation=(e,y)=>S5(e,y);const o=this.abstractMethods.find(e=>e.id===Ee["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id);if(!o)throw new Error("Handler method not found in endpoint entity");const p=o.outputs.find(e=>e.id===Ee["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.outputs.statusCode.id);if(!p)throw new Error("Status code output not found in handler method");p.codeNativeValueValidation=(e,y)=>TK(e,y)}}const rwe="test_primitive_entities_export";class iwe extends ua{constructor(i){super(wi,i);g(this,"initialData");g(this,"id",Ue.PERSISTED_ENTITY);g(this,"version","1");g(this,"name",Ue.PERSISTED_ENTITY);g(this,"description",wi.description);g(this,"type",f.BuiltInBaseEntity);g(this,"abstract",wi.abstract);g(this,"static",wi.static);g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"errors",[]);g(this,"project");this.initialData=wi,this.project=i,this.id=wi.id,this.version=wi.version,this.name=wi.name,this.static=wi.static,this.abstract=wi.abstract,this.properties=this.initialData.properties.map(o=>{const p=te(o,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.methods=this.initialData.methods.map(o=>{const p=te(o,this.project);return p.parent=this,p}),this.abstractMethods=this.initialData.abstractMethods.map(o=>{const p=te(o,this.project);return p.parent=this,p}),this.extends=this.initialData.extends.map(o=>te(o,this.project));const a=this.properties.find(o=>o.id===Ee["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id);if(!a)throw new Error("Path property not found in endpoint entity");a._codeNativeValueValidation=(o,p)=>K5(o,p)}}function swe(d){const u=[new vK(d),new IK(d),new iwe(d),new ua(Bh,d)];return u.forEach(i=>{d.subscribeBuiltInInstance(i)}),d.builtInBaseEntities=u,u}function nwe(d){const u=[new ns(Ye,d),new ns(Da,d),new ns(lt,d),new ns(Hv,d),new ns(bi,d),new ns(Oa,d),new ns(Sn,d),new ns(Ca,d),new ns(nd,d)];return u.forEach(i=>{d.subscribeBuiltInInstance(i)}),d.primitives=u,u}function awe(d){const u=[new pt(Gh,d)];return u.forEach(i=>{i.initChildren(null),d.subscribeBuiltInInstance(i)}),d.globalEventActionDescriptors=u,u}function owe(d){const u=[new pt(oc,d),new pt(Qa,d),new pt(nc,d),new pt(ld,d),new pt(dd,d),new pt(Dh,d)];u.forEach(a=>{a.initChildren(null),d.subscribeBuiltInInstance(a)}),d.loopDeclarations=u;const i=[new pt(Ph,d),new pt(ac,d),new pt(Ch,d),new pt(OE,d),new pt($E,d),new pt(Oh,d)];return i.forEach(a=>{a.initChildren(null),d.subscribeBuiltInInstance(a)}),d.loopDeclarationsBodies=i,u}function lwe(d){const u=[new Rn(Fh,d),new Rn(zE,d)];return u.forEach(i=>{i.initChildren(null),d.subscribeBuiltInInstance(i)}),d.valueDescriptors=u,u}function dwe(d){const u=[new pt(s2,d),new pt(i2,d),new pt(sl,d),new pt(JE,d),new pt(A2,d),new pt(b2,d),new pt(T2,d),new pt(I2,d),new pt(hd,d),new pt(E2,d)];return u.forEach(i=>{i.initChildren(null),d.subscribeBuiltInInstance(i)}),d.conditionDeclarations=u,u}const Pl={},Qm={},vf={empty:!1,enrich:!0,mock:!1,ignoreCache:!1,onFetch:async()=>null,manuallyInit:!1};function AK(d,u={enrich:!0,shallowErrors:!1},i){const a={enrich:!0,shallowErrors:!1,...u},{enrich:o,shallowErrors:p}=a,e=d.project,y=d.record,v=new oa(e),E=new Set;y[e.id]=e,E.add(e.id);const b=L().toISOString();Object.values(y).forEach(V=>{!V||v.allBuiltInEntityIds.includes(V.id)||E.add(V.id)}),v.order=Array.from(E),v.flatRecord=y,v.orderEntities();const A=e0(d.project,i);A.instances[e.id]=A;const $=o?A.addChangeSet(new G(A,N.sessionAuthor,b,A,!0,"project-init-from-fetch-result")):null;return v.visit(V=>{if(V.id===A.id)return;const B=te(V,A);try{B.hydrateAncestors(),B.addSelfToProject(null);const F=su(V);Object.keys(F.downstream).forEach(K=>{const Z=A.get(K);Z&&Z.hydrateAncestors()})}catch(F){if(p)Me.error("Error hydrating ancestors: ",F);else throw F}}),o?(v.visit(V=>{if(V.id===A.id)return;const B=A.get(V.id);B&&B.afterAllChildrenInitialized($)}),A.afterAllChildrenInitialized($)):t0(A,b).forEach(B=>{B.remove({ignoreUpstream:!0},null)}),A.instancesList.forEach(V=>{V.previousVersion=null}),$==null||$.attemptAutoclose("project-init-from-fetch-result",A.id),A}async function uwe(d,u=vf){const i={...vf,...u};if(i.empty)return{data:{project:{id:d.id,type:f.Project,version:N.UUID.uuid(),createdAt:L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]},record:{}}};if(i.mock){const o={...dI};return o.id=d.id,{data:{project:o,record:{}}}}return Me.log("Fetching project from external API"),new Promise(async o=>{try{if(i.onFetch){const p=await i.onFetch(d.id);if(p){o({data:p});return}}else o({data:null})}catch(p){Me.error("Error fetching project: ",p),o({data:null})}})}function e0(d,u){const i=new N(d,u);return nwe(i),swe(i),twe(i),awe(i),owe(i),lwe(i),dwe(i),Array.from(new Set([...i.getAllBuiltInIds(),...rn()])).forEach(o=>{if(!i.builtInInstances[o]&&i.instances[o])i.builtInInstances[o]=i.instances[o],delete i.instances[o];else if(!i.builtInInstances[o])throw new Error(`Built in entity was not properly initialized: ${o}`)}),i.instances[i.id]=i,i}function t0(d,u){return d.instancesList.filter(a=>L(a.createdAt).isAfter(L(u)||!!a.previousVersion))}function cwe(d,{enrich:u}={enrich:!0},i){const a=new Map,o=new Map,p=Array.from(new Set([...d.getAllBuiltInIds(),...rn()]));Object.keys(d.instances).forEach(A=>{if(p.includes(A)){a.set(A,A),o.set(A,A);return}const $=d.get(A);if(!Jm($,{...d.instances,...d.builtInInstances}).every(K=>!p.includes(K))){a.set(A,A),o.set(A,A);return}const F=N.UUID.uuid();a.set(A,F),o.set(F,A)});const e=L().toISOString(),y=d.toShallowJSON({seenEntityMaps:a});y.previousVersion=null,y.createdAt=e,y.version=N.UUID.uuid();const v=e0(y,i);v.instances[v.id]=v;const E=u?v.addChangeSet(new G(v,N.sessionAuthor,e,v,!0,"project-clone")):null,b=new oa(d);return b.visit(A=>{const $=A.toShallowJSON({seenEntityMaps:a});$.previousVersion=null,$.createdAt=e,$.version=N.UUID.uuid();const V=su($,nS(b.flatRecord,a));if(Object.keys(V.upstream).length){let F=!1;if(Object.keys(V.upstream).forEach(K=>{if(!F&&(!v.get(K)||v.getDeleted(K))){F=!0;return}}),F)return}const B=te($,v);B.hydrateAncestors(),B.addSelfToProject(E),E==null||E.add(B,S.Added)}),u?(b.visit(A=>{if(A.id===v.id)return;const $=v.get(a.get(A.id));$&&$.afterAllChildrenInitialized(E)}),v.afterAllChildrenInitialized(E)):t0(v,e).forEach($=>{$.remove({ignoreUpstream:!0},null)}),v.instancesList.forEach(A=>{A.previousVersion=null}),E==null||E.attemptAutoclose("project-clone",v.id),v}function bK(d,{enrich:u}={enrich:!0},i){const a=e0(d,i),o=L().toISOString(),p=u?a.addChangeSet(new G(a,N.sessionAuthor,o,a,!0,"project-init")):null;p&&(p.type=fA.Automatic);const e=new oa(d);return e.visit(y=>{const v=te(y,a);v.hydrateAncestors(),v.addSelfToProject(p)}),u?(e.visit(y=>{if(y.id===a.id)return;const v=a.get(y.id);v&&v.afterAllChildrenInitialized(p)}),a.afterAllChildrenInitialized(p)):(t0(a,o).forEach(E=>{E.remove({ignoreUpstream:!0},null)}),new oa(a).visit(E=>{E.initialized=!0,E.captureVersion()})),a.initialized=!0,p==null||p.attemptAutoclose("project-init",a.id),a}async function pwe(d,u=vf,i){const a={...vf,...u};if(d.id&&Pl[d.id]&&!a.ignoreCache)return Pl[d.id];if(d.id&&Qm[d.id]&&!a.ignoreCache)return await Qm[d.id],Pl[d.id];const o=uwe(d,a);d.id&&(Qm[d.id]=o);const p=await o;if(p.data){let e;return a.mock?e=bK(dI,{enrich:!!a.enrich},i):p.data instanceof N?e=p.data:e=AK(p.data,{enrich:!!a.enrich},i),Pl[d.id]=e,d.id&&delete Qm[d.id],e}return null}function fwe(d){return Pl[d.id]&&delete Pl[d.id],null}D.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=Bb,D.ALL_BUILT_IN_BASE_ENTITIES=r2,D.ALL_BUILT_IN_CONDITION_ENTITIES=_2,D.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=D2,D.ALL_BUILT_IN_LOOP_BODY_ENTITIES=DV,D.ALL_BUILT_IN_LOOP_ENTITIES=gV,D.ALL_BUILT_IN_OPERATION_ENTITIES=xP,D.ALL_BUILT_IN_PRIMITIVE_ENTITIES=Kg,D.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=V2,D.ALL_BUILT_IN_VALUE_DESCRIPTORS=N2,D.ALL_CONNECTION_DISABLED_REASONS=sAe,D.ALL_OTHER_DISABLED_REASONS=aAe,D.ALL_TESTING_DISABLED_REASONS=nAe,D.ActionDescriptorState=pt,D.ActionInputMapState=XEe,D.ActionOutputMapState=tTe,D.AppendToListOperationInputIds=zD,D.AppendToListOperationOutputIds=XD,D.Area=gi,D.ArgumentDeclarationDependencyField=zx,D.ArgumentDeclarationState=ea,D.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=Nb,D.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PREFIX=dt,D.BUILT_IN_BASE_ENTITY_IDS=Ee,D.BUILT_IN_ENTITY_TYPES=Yi,D.BUILT_IN_FUNCTION_IMPLEMENTATIONS__PREFIX=Xd,D.BaseCanvasDraggableState=jbe,D.BaseEntityNames=Ue,D.BaseRegisteredExtension=st,D.BaseState=xbe,D.BaseValueDescriptorIds=sd,D.BreakStatementDependencyField=JG,D.BreakStatementState=Io,D.BuiltInBaseEntityState=ua,D.BuiltInFunctionIds=Qr,D.BuiltInFunctionImplementationAbortExecutionModule=fF,D.BuiltInFunctionImplementationCreatePersistedEntityModule=yF,D.BuiltInFunctionImplementationDeletePersistedEntityModule=hF,D.BuiltInFunctionImplementationUpdatePersistedEntityModule=mF,D.CACHED_PROJECTS_BY_ID=Pl,D.CALLABLE_ENTITIES_EXPLANATION=IAe,D.CALLABLE_TYPES=Ai,D.CALLER_ENTITIES_EXPLANATION=g5,D.CALLER_TYPES=Oi,D.CALLS_UPDATE_EXPLANATION=Ro,D.CANVAS_BASE_X=h5,D.CANVAS_BASE_Y=y5,D.CANVAS_CARD_HEADER_CENTER_HEIGHT=ru,D.CANVAS_CARD_WIDTH=c5,D.CANVAS_COMPLEX_CARD_HEIGHT=XIe,D.CANVAS_HORIZONTAL_BUFFER_BETWEEN_CARDS=Ib,D.CANVAS_SIMPLE_CARD_HEIGHT=Eb,D.CANVAS_SIZE=vb,D.CANVAS_VERTICAL_BUFFER_BETWEEN_CARDS=Rm,D.CARD_FOOTER_HEIGHT=wm,D.CARD_PROPERTIES_SECTION_PADDING=Sa,D.CARD_PROPERTIES_SECTION_SINGLE_PADDING=Tb,D.CHILDREN_TYPES=JZ,D.COMPARISON_CONDITIONS=w2,D.CONDITIONS=R2,D.CUSTOM_ENTITY_OPERATIONS=vC,D.CallableEntityClass=Fbe,D.CallerEntityClass=fw,D.CanvasEntityConnectionDisabledReason=Ab,D.CanvasEntityOtherDisabledReason=wb,D.CanvasEntityTestingDisabledReason=bb,D.ChangeSet=G,D.ChangeSetChangeCaptureType=fA,D.ChangeSetEntityChangeType=S,D.ChildEntityBaseClass=Gbe,D.CommonStringValidationErrorCodes=F5,D.ComparisonOperatorTypes=nt,D.ConditionDependencyField=fj,D.ConditionState=ho,D.ContinueStatementDependencyField=lj,D.ContinueStatementState=Mi,D.CreateNewInputIds=qO,D.CreateNewOutputIds=ZO,D.DEFAULT_BASE_EXTENSIONS_CONTEXT=pb,D.DEFAULT_EXECUTION_INSTANCE_PARENT_CONTEXT=d5,D.DEFAULT_MODULE_IDS=tt,D.DEFAULT_PROJECT_INSTANCE_PARENT_CONTEXT=fK,D.DEFAULT_PROJECT_STATIC_PARENT_CONTEXT=hw,D.DEFAULT_UUID_MODULE=ec,D.DRAGGABLE_CALLABLE_TYPES=qv,D.DRAGGABLE_CALLER_TYPES=Lg,D.DRAGGABLE_ELEMENT_TYPES=ch,D.DRAGGABLE_EXECUTABLE_TYPES=ZZ,D.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=uh,D.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=kv,D.DataTypeCompatibilityTypes=Qs,D.DataTypeDependencyField=vA,D.DataTypeParentChildRelation=Ii,D.DataTypeState=vs,D.DefaultEditorContext=cb,D.DefaultProjectLogicContext=JA,D.DefinitionEntityDependencyField=Xm,D.DefinitionEntityState=da,D.DynamicValueTypes=be,D.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=Bbe,D.ENTITIES_WITH_VALLUES_EXPLANATION=Om,D.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=ve,D.ENTITY_RECUSION_OPTIONS_DEFAULTS=ke,D.ENTITY_TYPES=HZ,D.ENTITY_WITH_CODE_NAMES_TYPES=Bg,D.ENTITY_WITH_DECLARATION_TYPES=qZ,D.ENTITY_WITH_LOGIC_SCOPE_TYPES=Br,D.ENTITY_WITH_NAMES_TYPES=Mg,D.ENTITY_WITH_PARENT_TYPES=KZ,D.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=Ng,D.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=kZ,D.ENTITY_WITH_VALUE_TYPES=Kv,D.ENTRY_POINT_ENTITIES_EXPLANATION=rf,D.ENTRY_POINT_TYPES=Nt,D.ERROR_PROPERTY_HEIGHT=bm,D.EVENT_TYPES=Zo,D.EXECUTABLE_TYPES=Zv,D.EXECUTION_OPERATIONS=kO,D.EfimeralValueStore=Sp,D.EndpointEntity=IK,D.EntityError=ur,D.EntityErrorSeverity=q,D.EntityGenerationError=ee,D.EntityGenerationErrorCode=k,D.EntityInstanceErrorCode=le,D.EntityOperations=fr,D.EntityType=f,D.EntityWithLogicScopeClass=qbe,D.EntityWithValueClass=kbe,D.EntryPointEntityClass=Sbe,D.Execution=tn,D.ExecutionOperations=ir,D.ExecutionState=fb,D.ExecutionTerminationType=se,D.ExplicitInfrastructureResource=Db,D.ExtensionContextBase=HA,D.ExtensionContextType=we,D.ExtensionPermissions=et,D.ExtensionsRegistry=l5,D.ExtentionPriority=Xe,D.FunctionCallDependencyField=U5,D.FunctionCallState=Do,D.FunctionDeclarationDependencyField=ej,D.FunctionDeclarationState=uo,D.GET_PROJECT_OPTIONS_DEFAULTS=vf,D.GLOBAL_EVENT_DECLARATIONS=g2,D.GetLastInListOperationInputIds=jD,D.GetLastInListOperationOutputIds=GD,D.GlobalEventNames=ga,D.GlobalEventState=fo,D.GroupOperatorTypes=Mr,D.HTTPOperations=Ti,D.HTTPStatucCodeValidationErrorCodes=EK,D.HTTP_OPERATIONS=zC,D.ImplicitGlobalInfrastructureResource=Ob,D.InfrastructureResource=gb,D.InfrastructureResourceStatus=b5,D.InputMapDependencyField=SG,D.InputMapState=ia,D.InstalledProjectState=Eo,D.InternalCallDependencyField=GG,D.InternalCallState=To,D.JoinListOperationInputIds=nD,D.JoinListOperationOutputIds=aD,D.LIST_OPERATIONS=cO,D.ListOperations=He,D.LiteralValueDependencyField=ZG,D.LiteralValueState=Zi,D.Logger=Me,D.LoopDependencyField=cj,D.LoopState=ki,D.LoopTypes=ze,D.MAIN_VALUE_PROPERTY_HEADER_HEIGHT=Am,D.MAIN_VALUE_SUB_PROPERTY_HEIGHT=QIe,D.NESTED_PROPERTY_HEIGHT=p5,D.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=_o,D.NUMBER_OPERATIONS=T1,D.NumberOperations=Jt,D.OPERATION_DECLARATIONS=UP,D.OperationDependencyField=ij,D.OperationState=co,D.OperationsImplementationsEntityCreateNewInstanceModule=n5,D.OperationsImplementationsEntityValidateModule=a5,D.OperationsImplementationsExecutionParallelModule=r5,D.OperationsImplementationsExecutionSequentialModule=i5,D.OperationsImplementationsExecutionWaitModule=s5,D.OperationsImplementationsHttpRequestModule=o5,D.OperationsImplementationsListAddIndexModule=H6,D.OperationsImplementationsListAppendModule=e5,D.OperationsImplementationsListDeleteFirstModule=Z6,D.OperationsImplementationsListDeleteLastModule=q6,D.OperationsImplementationsListGetFirstModule=X6,D.OperationsImplementationsListGetIndexItemModule=z6,D.OperationsImplementationsListGetLastModule=Q6,D.OperationsImplementationsListJoinModule=S6,D.OperationsImplementationsListPrependModule=t5,D.OperationsImplementationsListReplaceFirstModule=W6,D.OperationsImplementationsListReplaceIndexModule=J6,D.OperationsImplementationsListReplaceLastModule=Y6,D.OperationsImplementationsListReverseModule=k6,D.OperationsImplementationsListSplitModule=K6,D.OperationsImplementationsNumberAdditionModule=a6,D.OperationsImplementationsNumberDivisionModule=d6,D.OperationsImplementationsNumberExponentiationModule=c6,D.OperationsImplementationsNumberMultiplicationModule=l6,D.OperationsImplementationsNumberRemainderModule=u6,D.OperationsImplementationsNumberSubstractionModule=o6,D.OperationsImplementationsRandomGenerateHexadecimalTokenModule=A6,D.OperationsImplementationsRandomGenerateIdentifierModule=E6,D.OperationsImplementationsRandomGenerateShortIdentifierModule=I6,D.OperationsImplementationsRandomGenerateUUIDv4Module=T6,D.OperationsImplementationsRandomnessGenerateRandomAlphaNumericModule=v6,D.OperationsImplementationsRandomnessGenerateRandomBase62Module=y6,D.OperationsImplementationsRandomnessGenerateRandomBase64Module=m6,D.OperationsImplementationsRandomnessGenerateRandomFloatModule=f6,D.OperationsImplementationsRandomnessGenerateRandomHexadecimalModule=h6,D.OperationsImplementationsRandomnessGenerateRandomIntegerModule=p6,D.OperationsImplementationsStringAddIndexModule=$6,D.OperationsImplementationsStringAppendModule=G6,D.OperationsImplementationsStringDeleteFirstModule=_6,D.OperationsImplementationsStringDeleteIndexModule=C6,D.OperationsImplementationsStringDeleteLastModule=R6,D.OperationsImplementationsStringGetFirstModule=U6,D.OperationsImplementationsStringGetIndexItemModule=B6,D.OperationsImplementationsStringGetIndexOfModule=j6,D.OperationsImplementationsStringGetLastModule=x6,D.OperationsImplementationsStringJoinModule=b6,D.OperationsImplementationsStringPrependModule=F6,D.OperationsImplementationsStringReplaceAllMatchesModule=M6,D.OperationsImplementationsStringReplaceFirstModule=P6,D.OperationsImplementationsStringReplaceIndexModule=V6,D.OperationsImplementationsStringReplaceLastModule=N6,D.OperationsImplementationsStringReplaceSingleMatchModule=L6,D.OperationsImplementationsStringReverseModule=g6,D.OperationsImplementationsStringSplitModule=w6,D.OperationsImplementationsStringToLowerCaseModule=D6,D.OperationsImplementationsStringToUpperCaseModule=O6,D.OutputMapDependencyField=kG,D.OutputMapParentChildRelation=id,D.OutputMapState=wn,D.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=Cm,D.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=wo,D.PASS_THROUGH_CALLABLE_TYPES=hr,D.PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=Vg,D.PLACEHOLDER_VALUE_STORE_CLIENT=zG,D.PROPERTY_HEIGHT=Im,D.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=Mb,D.PUBLISHING_DISABLED_REASONS=w5,D.ParallelExecutionOperation=hK,D.PassThroughCallableEntityClass=Kbe,D.PersistedEntity=vK,D.PrimitiveEntityState=ns,D.PrimitiveTypes=Q,D.ProjectState=N,D.ProjectStateEvents=Vr,D.PropertyDependencyField=aK,D.PropertyState=la,D.PublicationRun=cAe,D.PublicationStep=A5,D.RANDOMNESS_OPERATIONS=BP,D.READABLE_ENTITY_TYPES=hb,D.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=pK,D.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=AAe,D.RandomnessOperations=De,D.ReturnDeclarationDependencyField=nj,D.ReturnDeclarationState=ss,D.ReturnStatementDependencyField=EA,D.ReturnStatementState=po,D.SQLAST=SEe,D.STANDALONE_CONDITIONS=d2,D.STATIC_PROPERTY_HEIGHT=f5,D.STRING_OPERATIONS=sD,D.ScopeCompatibilityType=Zm,D.SearchDependencyField=CG,D.SearchNodeImplementationModule=vF,D.SearchState=vo,D.SequentialExecutionOperation=mK,D.SequentialExecutionOperationInputIds=PO,D.SequentialExecutionOperationOutputIds=NO,D.SharedEntityErrorCode=ae,D.SharedStateFunctionality=cK,D.SplitListOperationInputIds=AD,D.SplitListOperationOutputIds=bD,D.StandaloneOperatorTypes=Xr,D.StringOperations=Se,D.TERMINATION_TYPES=Ir,D.Traverser=oa,D.USER_MANAGED_ENTITY_TYPES=Ug,D.UUIDModule=EF,D.UserManagedEntityStateTemplate=Ube,D.VALUE_READING_ENTITIES_EXPLANATION=Lb,D.VALUE_READING_TYPES=vn,D.VALUE_WRITING_ENTITIES_EXPLANATION=D5,D.VALUE_WRITING_TYPES=Fr,D.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=Vb,D.VARIABLE_TYPES=Tt,D.ValueAutogenerationType=Zr,D.ValueDescriptorDependencyField=YG,D.ValueDescriptorParentChildRelation=oe,D.ValueDescriptorState=Rn,D.ValueReadingEntityClass=yf,D.ValueWritingEntityClass=mf,D.VariableDeclarationDependencyField=vj,D.VariableDeclarationState=mo,D.VariableInputMapState=zEe,D.VariableInstanceDependencyField=IA,D.VariableInstanceState=yo,D.VariableOutputMapState=eTe,D.WaitOperation=yK,D.actionDescriptorValidation=z0e,D.addDisabledReasons=lAe,D.afterLiteralValueAsTypeChangeSideEffects=cF,D.afterLiteralValueAsTypeDeleteSideEffects=uF,D.afterLiteralValueChangeSideEffects=lF,D.afterLiteralValueDeleteSideEffects=oF,D.aggregateVariableInputsNextValues=kp,D.aggregateVariableInputsValues=em,D.appendToListOperation=yh,D.appendToListOperationElementToAppendArgument=aE,D.appendToListOperationElementToAppendArgumentParentRef=aO,D.appendToListOperationElementToAppendArgumentRef=tO,D.appendToListOperationError=uO,D.appendToListOperationErrorParentRef=dO,D.appendToListOperationListArgument=nE,D.appendToListOperationListArgumentParentRef=nO,D.appendToListOperationListArgumentRef=QD,D.appendToListOperationListDataType=eO,D.appendToListOperationResultListDataType=sO,D.appendToListOperationResultListReturn=lO,D.appendToListOperationResultListReturnParentRef=oO,D.appendToListOperationResultListReturnRef=iO,D.appendToListOperationSecondListDataType=rO,D.applyNewScope=We,D.argumentDeclarationValidation=B0e,D.asGenerationActionExample=aa,D.assembleAndAddLiteralValueFromDataType=_n,D.assembleStandaloneLiteralValueFromDataType=ct,D.booleanPrototype=Da,D.breakStatementValidation=sTe,D.calculateCardSize=v5,D.calculateMethodCardSize=m5,D.calculateNewParentBasedOnCallers=nf,D.capitalizeFirstLetter=Ri,D.changeSetJSONRecordToUniqueIds=U0e,D.checkAreDataTypesCompatible=en,D.checkAreDefinitionEntitiesCompatibleAsDataType=LG,D.checkArePropertiesCompatibleAsDataType=VG,D.checkExtendsBaseEntity=Hm,D.checkHasBaseEntity=As,D.checkHasMetadataChanged=xr,D.checkImplementationsOverlap=ka,D.checkImplementsBaseEntity=sbe,D.checkIsBranchDependentButNotDirectlyOnBranch=$l,D.checkIsBranchDependentOnBranch=Jb,D.checkIsBuiltIn=iw,D.checkIsCallableEntityReachable=ff,D.checkIsCallerBranchDependentOnBranch=xAe,D.checkIsCanvasEntity=rbe,D.checkIsDefEntityInlineDeclaredForSearchOutputType=UA,D.checkIsDetachedBranch=FS,D.checkIsDetachedBranchShallow=tw,D.checkIsEmptyValue=Qy,D.checkIsGlobalVariable=ebe,D.checkIsGloballyDeclared=ew,D.checkIsLiteralValueEmpty=Kp,D.checkIsMethod=rw,D.checkIsNestedScope=qm,D.checkIsRequiredValue=sa,D.checkScopeCompatibility=sn,D.checkShouldInputOrOutputBePartOfFinalVariableObjectValue=hf,D.checkShouldPropertyBePartOfFinalVariableObjectValue=sw,D.cloneProject=cwe,D.conditionValidation=X0e,D.continueStatementValidation=H0e,D.convertToAbstract=VAe,D.convertToNonAbstract=LAe,D.convertToNonStatic=BAe,D.convertToStatic=MAe,D.countedLoopActionDescriptor=oc,D.countedLoopActionDescriptorDynamicReturnDeclaration=EV,D.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=vV,D.countedLoopActionDescriptorStringArgumentDeclaration=mV,D.countedLoopActionDescriptorStringArgumentDeclarationDataType=hV,D.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=pV,D.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=cV,D.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=fV,D.countedLoopActionDescriptorStringArgumentDeclarationParentRef=yV,D.countedLoopBodyActionDescriptor=Ph,D.countedLoopBodyActionDescriptorAnyDynamicArgument=wV,D.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=bV,D.countedLoopBodyActionDescriptorAnyDynamicReturn=_V,D.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=RV,D.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=NE,D.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=IV,D.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=TV,D.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=AV,D.createDefinitionEntityFromJSONObject=Lm,D.createEntityError=mt,D.createNestedDataTypeForEntity=G5,D.createNewInstanceOperation=Jo,D.createNewInstanceOperationEntityToInstanciateArgument=eC,D.createNewInstanceOperationEntityToInstanciateArgumentRef=zO,D.createNewInstanceOperationEntityToInstanciateDataType=XO,D.createNewInstanceOperationError=sC,D.createNewInstanceOperationErrorParentRef=iC,D.createNewInstanceOperationNewEntityDataArgument=YO,D.createNewInstanceOperationNewEntityDataArgumentDataType=WO,D.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=JO,D.createNewInstanceOperationNewEntityDataArgumentParentRef=HO,D.createNewInstanceOperationOutputEntityDeclaration=rC,D.createNewInstanceOperationOutputEntityDeclarationParentRef=tC,D.createNewInstanceOperationRef=QO,D.createPersistedEntityMethod=LL,D.createPersistedEntityMethodParentRef=VL,D.createSemanticId=tK,D.createStateFromGenerationTargetType=Mbe,D.createStateFromType=dr,D.createStateFromTypeAndSubscribe=te,D.cronJobBuiltInBaseEntity=Bh,D.cronJobBuiltInBaseEntityExpressionProperty=e2,D.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=tH,D.cronJobBuiltInBaseEntityExpressionPropertyRef=XL,D.cronJobBuiltInBaseEntityRef=QL,D.cronJobTriggeredFunctionDeclarationBlueprint=ZE,D.cronJobTriggeredFunctionDeclarationBlueprintParentRef=YL,D.dataTypeCompatibilityToErrorExplanation=M5,D.dataTypeValidation=F0e,D.datePrototype=Sn,D.dateValueAutogenerationSchema=FI,D.definitionEntityToZodSchema=ET,D.definitionEntityValidation=Pbe,D.deletePersistedEntityMethod=qE,D.deletePersistedEntityMethodParentRef=NL,D.deleteRootProject=fwe,D.emitSideEffects=Yx,D.emptyCondition=JE,D.emptyConditionArgument=l2,D.emptyConditionRef=o2,D.endpointBuiltInBaseEntity=ps,D.endpointBuiltInBaseEntityRef=PV,D.endpointBuiltInBaseEntityRefFour=fL,D.endpointBuiltInBaseEntityRefThree=GV,D.endpointBuiltInBaseEntityRefTwo=BV,D.endpointBuiltInCorsProperty=NV,D.endpointBuiltInCorsPropertyDataType=$V,D.endpointBuiltInCorsPropertyDataTypeRef=OV,D.endpointBuiltInCorsPropertyRef=CV,D.endpointBuiltInMethodProperty=LE,D.endpointBuiltInMethodPropertyDataType=jV,D.endpointBuiltInMethodPropertyDataTypeRef=UV,D.endpointBuiltInMethodPropertyRef=xV,D.endpointBuiltInPathProperty=VE,D.endpointBuiltInPathPropertyDataType=MV,D.endpointBuiltInPathPropertyDataTypeRef=VV,D.endpointBuiltInPathPropertyRef=LV,D.endpointPathParamsArgumentDeclaration=BE,D.endpointPathParamsArgumentDeclarationRef=YV,D.endpointPathParamsVariableDataType=zV,D.endpointPathParamsVariableDataTypeRef=WV,D.endpointReachedTriggerActionDescriptor=SE,D.endpointReachedTriggerActionDescriptorRef=XV,D.endpointReachedTriggerActionDescriptorRefFour=tL,D.endpointReachedTriggerActionDescriptorRefThree=eL,D.endpointReachedTriggerActionDescriptorRefTwo=QV,D.endpointRequestBodyArgumentDeclaration=xE,D.endpointRequestBodyArgumentDeclarationRef=kV,D.endpointRequestBodyVariableDataType=qV,D.endpointRequestHeadersArgumentDeclaration=ME,D.endpointRequestHeadersArgumentDeclarationRef=SV,D.endpointRequestHeadersVariableDataType=KV,D.endpointRequestHeadersVariableDataTypeRef=FV,D.endpointRequestQueryParamsArgumentDeclaration=UE,D.endpointRequestQueryParamsArgumentDeclarationRef=HV,D.endpointRequestQueryParamsVariableDataType=JV,D.endpointRequestQueryParamsVariableDataTypeRef=ZV,D.endpointResponseBodyDataType=cL,D.endpointResponseBodyReturnDeclaration=FE,D.endpointResponseBodyReturnDeclarationRef=uL,D.endpointResponseCodeDataType=iL,D.endpointResponseCodeReturnDeclaration=jE,D.endpointResponseCodeReturnDeclarationDefaultValueParentRef=nL,D.endpointResponseCodeReturnDeclarationRef=rL,D.endpointResponseHeadersDataType=lL,D.endpointResponseHeadersDataTypeRef=aL,D.endpointResponseHeadersReturnDeclaration=GE,D.endpointResponseHeadersReturnDeclarationRef=oL,D.endpointReturnStatementRef=sL,D.endpointReturnStatementRefThree=pL,D.endpointReturnStatementRefTwo=dL,D.enerateRandomIntegerOperationError=c$,D.enerateRandomIntegerOperationErrorParentRef=u$,D.enrichFromKnownEntities=of,D.enumOptionsProperty=Sg,D.enumOptionsPropertyDataType=Gg,D.enumOptionsPropertyDataTypeRef=xg,D.enumOptionsPropertyRef=jg,D.enumPrototype=Oa,D.enumPrototypeRef=Fg,D.errorCodeToMessage=ef,D.executionBuiltInBaseEntity=Uh,D.executionBuiltInEntityAbortMethod=HE,D.executionBuiltInEntityAbortMethodParentRef=t2,D.filterOutDuplicateEntities=R,D.filterOutDuplicateErrors=uI,D.findEntityFromKeys=Gb,D.findNextIndividualCommonCallerAncestorFromGiven=kb,D.findReferenceToSelfInList=sS,D.findReferencesToSelfInProject=HAe,D.flattenActionDescriptor=aS,D.flattenArgumentDeclaration=oS,D.flattenBreakStatement=lS,D.flattenBuiltInBaseEntity=dS,D.flattenCallerAncestorsUntil=Cl,D.flattenCalls=Ui,D.flattenCanvasAncestorsUntil=iu,D.flattenCondition=uS,D.flattenContinueStatement=cS,D.flattenDataType=fS,D.flattenDefinitionEntity=pS,D.flattenDefinitionEntityExtensionAndImplementationTypes=ou,D.flattenDefinitionEntityExtensionTypes=df,D.flattenDefinitionEntityExtensions=zb,D.flattenDefinitionEntityImplementations=Xb,D.flattenDefinitionEntityImplementionTypes=lf,D.flattenDerivedCanvasEntities=Is,D.flattenDetachedBranch=KS,D.flattenElementCalls=_t,D.flattenElementCallsOnTheSameScope=ZAe,D.flattenElementCallsWithCallType=Mm,D.flattenEntity=me,D.flattenFunctionCall=hS,D.flattenFunctionDeclaration=yS,D.flattenGlobalEvent=mS,D.flattenInputMap=vS,D.flattenInstalledProject=ES,D.flattenInternalCall=TS,D.flattenLiteralValue=IS,D.flattenLoop=AS,D.flattenOperation=bS,D.flattenOutputMap=wS,D.flattenPrimitiveEntity=RS,D.flattenProject=_S,D.flattenProjectElements=iS,D.flattenProperty=gS,D.flattenRelatedCallableElementsOnTheRight=jS,D.flattenRelatedCanvasElementsOnTheLeft=GS,D.flattenRelatedCanvasElementsOnTheRight=Km,D.flattenReturnDeclaration=DS,D.flattenReturnStatement=OS,D.flattenSearch=CS,D.flattenValueDescriptor=$S,D.flattenVariableDeclaration=PS,D.flattenVariableInstance=NS,D.flattenVariableReads=rS,D.flattenVariableWrites=tS,D.flattenVariables=vr,D.flattenWrites=Hb,D.fromChangeSetToRecordChangeSet=ube,D.fromLiteralValueTypeToPrimitiveType=MA,D.fromPublishingDisabledCodeToReadable=hAe,D.fromZodParseToEntityGenerationErrors=Cb,D.functionCallValidation=$Ae,D.functionDeclarationValidation=G0e,D.generate=Hh,D.generateActionExample=bAe,D.generateExecutionDataType=JEe,D.generateHexadecimalTokenOperation=wE,D.generateHexadecimalTokenOperationError=MP,D.generateHexadecimalTokenOperationErrorParentRef=LP,D.generateHexadecimalTokenOperationResultStringDataType=PP,D.generateHexadecimalTokenOperationResultStringDataTypeParentRef=$P,D.generateHexadecimalTokenOperationResultStringOutput=VP,D.generateHexadecimalTokenOperationResultStringOutputParentRef=NP,D.generateIdFromStrategy=Kr,D.generateIdentifierOperation=IE,D.generateIdentifierOperationAlphabetInput=cP,D.generateIdentifierOperationAlphabetInputParentRef=lP,D.generateIdentifierOperationAlphabetInputType=uP,D.generateIdentifierOperationAlphabetInputTypeParentRef=dP,D.generateIdentifierOperationError=vP,D.generateIdentifierOperationErrorParentRef=mP,D.generateIdentifierOperationLengthInput=oP,D.generateIdentifierOperationLengthInputParentRef=sP,D.generateIdentifierOperationLengthInputType=aP,D.generateIdentifierOperationLengthInputTypeParentRef=nP,D.generateIdentifierOperationResultStringDataType=hP,D.generateIdentifierOperationResultStringDataTypeParentRef=fP,D.generateIdentifierOperationResultStringOutput=yP,D.generateIdentifierOperationResultStringOutputParentRef=pP,D.generateMutablePropertiesExplanation=_m,D.generatePlaceholderValueStore=aTe,D.generateRandomAlphanumericOperation=TE,D.generateRandomAlphanumericOperationError=iP,D.generateRandomAlphanumericOperationErrorParentRef=rP,D.generateRandomAlphanumericOperationLengthInput=z$,D.generateRandomAlphanumericOperationLengthInputParentRef=J$,D.generateRandomAlphanumericOperationLengthInputType=Y$,D.generateRandomAlphanumericOperationLengthInputTypeParentRef=W$,D.generateRandomAlphanumericOperationResultStringDataType=Q$,D.generateRandomAlphanumericOperationResultStringDataTypeParentRef=X$,D.generateRandomAlphanumericOperationResultStringOutput=tP,D.generateRandomAlphanumericOperationResultStringOutputParentRef=eP,D.generateRandomBase62Operation=vE,D.generateRandomBase62OperationError=U$,D.generateRandomBase62OperationErrorParentRef=B$,D.generateRandomBase62OperationLengthInput=P$,D.generateRandomBase62OperationLengthInputParentRef=O$,D.generateRandomBase62OperationLengthInputType=$$,D.generateRandomBase62OperationLengthInputTypeParentRef=C$,D.generateRandomBase62OperationResultStringDataType=V$,D.generateRandomBase62OperationResultStringDataTypeParentRef=N$,D.generateRandomBase62OperationResultStringOutput=M$,D.generateRandomBase62OperationResultStringOutputParentRef=L$,D.generateRandomBase64Operation=EE,D.generateRandomBase64OperationError=H$,D.generateRandomBase64OperationErrorParentRef=Z$,D.generateRandomBase64OperationLengthInput=F$,D.generateRandomBase64OperationLengthInputParentRef=x$,D.generateRandomBase64OperationLengthInputType=G$,D.generateRandomBase64OperationLengthInputTypeParentRef=j$,D.generateRandomBase64OperationResultStringDataType=K$,D.generateRandomBase64OperationResultStringDataTypeParentRef=S$,D.generateRandomBase64OperationResultStringOutput=q$,D.generateRandomBase64OperationResultStringOutputParentRef=k$,D.generateRandomBoolean=tM,D.generateRandomDate=q2,D.generateRandomDateAfter=S2,D.generateRandomDateBefore=K2,D.generateRandomDateBetweenRange=k2,D.generateRandomFloatOperation=yE,D.generateRandomFloatOperationError=v$,D.generateRandomFloatOperationErrorParentRef=m$,D.generateRandomFloatOperationResultNumberDataType=f$,D.generateRandomFloatOperationResultNumberDataTypeParentRef=p$,D.generateRandomFloatOperationResultNumberOutput=y$,D.generateRandomFloatOperationResultNumberOutputParentRef=h$,D.generateRandomHexadecimalOperation=mE,D.generateRandomHexadecimalOperationError=D$,D.generateRandomHexadecimalOperationErrorParentRef=g$,D.generateRandomHexadecimalOperationLengthInput=A$,D.generateRandomHexadecimalOperationLengthInputParentRef=E$,D.generateRandomHexadecimalOperationLengthInputType=I$,D.generateRandomHexadecimalOperationLengthInputTypeParentRef=T$,D.generateRandomHexadecimalOperationResultStringDataType=w$,D.generateRandomHexadecimalOperationResultStringDataTypeParentRef=b$,D.generateRandomHexadecimalOperationResultStringOutput=_$,D.generateRandomHexadecimalOperationResultStringOutputParentRef=R$,D.generateRandomIntegerOperation=hE,D.generateRandomIntegerOperationMaxValueInput=n$,D.generateRandomIntegerOperationMaxValueInputParentRef=r$,D.generateRandomIntegerOperationMaxValueInputType=s$,D.generateRandomIntegerOperationMaxValueInputTypeParentRef=i$,D.generateRandomIntegerOperationMinValueInput=d$,D.generateRandomIntegerOperationMinValueInputParentRef=a$,D.generateRandomIntegerOperationMinValueInputType=l$,D.generateRandomIntegerOperationMinValueInputTypeParentRef=o$,D.generateRandomIntegerOperationResultNumberDataType=QC,D.generateRandomIntegerOperationResultNumberDataTypeParentRef=XC,D.generateRandomIntegerOperationResultNumberOutput=t$,D.generateRandomIntegerOperationResultNumberOutputParentRef=e$,D.generateRandomNumber=Y2,D.generateRandomNumberAfter=H2,D.generateRandomNumberBefore=J2,D.generateRandomNumberBetweenRange=W2,D.generateRandomText=eM,D.generateRandomTextAfter=z2,D.generateRandomTextBefore=X2,D.generateRandomTextBetweenRange=Q2,D.generateRandomUUIDv4Operation=AE,D.generateRandomUUIDv4OperationError=wP,D.generateRandomUUIDv4OperationErrorParentRef=bP,D.generateRandomUUIDv4OperationResultStringDataType=TP,D.generateRandomUUIDv4OperationResultStringDataTypeParentRef=EP,D.generateRandomUUIDv4OperationResultStringOutput=AP,D.generateRandomUUIDv4OperationResultStringOutputParentRef=IP,D.generateShortIdentifierOperation=bE,D.generateShortIdentifierOperationError=CP,D.generateShortIdentifierOperationErrorParentRef=OP,D.generateShortIdentifierOperationResultStringDataType=_P,D.generateShortIdentifierOperationResultStringDataTypeParentRef=RP,D.generateShortIdentifierOperationResultStringOutput=DP,D.generateShortIdentifierOperationResultStringOutputParentRef=gP,D.generateStandaloneIfDefault=oTe,D.generateUniqueUUID=Z2,D.getAllActionDescriptorsForConditions=Nm,D.getAllActionDescriptorsForGlobalEvents=$m,D.getAllActionDescriptorsForLoops=Pm,D.getAllActionDescriptorsForOperations=gAe,D.getAllBuiltInEntityIds=rn,D.getAllGloballyDeclaredFunctionDeclarationsExplanation=N5,D.getAllVariablesInScope=fbe,D.getBaseBuiltInEntities=xi,D.getBaseSchemaBasedOnType=R5,D.getBuiltInEntityOwner=Co,D.getCallableEntitiesDerivedFromInternalCalls=US,D.getCallableEntitiesDerivedFromWrites=au,D.getCallableEntityReferenceSchema=_i,D.getCallableEntityTypeSchema=Zx,D.getCalledBy=xs,D.getCallerEntityReferenceSchema=h0e,D.getCallerEntityTypeSchema=f0e,D.getCalls=xm,D.getCanvasEntitiesDerivedFromInternalCalls=BS,D.getCanvasEntitiesDerivedFromWrites=nu,D.getCanvasEntityDerivedFromValueReadingEntity=Fm,D.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=MS,D.getCanvasEntityReferenceSchema=P0e,D.getCanvasEntityTypeSchema=$0e,D.getChildrenEntityWithValues=GAe,D.getColumnProperties=lu,D.getCommonAncestor=Wb,D.getCommonChildren=Bm,D.getDatabaseEntities=abe,D.getDatabaseEntity=lbe,D.getDeclaration=Bi,D.getDeclarationOutputedError=pbe,D.getDeepestScope=qS,D.getDefaultRelationalDatabaseEntityOrFirst=HS,D.getDraggableCallableEntityReferenceSchema=Jx,D.getDraggableCallableEntityTypeSchema=Hx,D.getDraggableCallerEntityReferenceSchema=m0e,D.getDraggableCallerEntityTypeSchema=y0e,D.getDraggableExecutableEntityReferenceSchema=I0e,D.getDraggableExecutableEntityTypeSchema=T0e,D.getDraggablePassThroughCallableEntityReferenceSchema=xy,D.getDraggablePassThroughCallableEntityTypeSchema=Uy,D.getDraggablePlayableEntityReferenceSchema=_0e,D.getDraggablePlayableEntityTypeSchema=R0e,D.getEarliestCommonAncestorOfAllCallers=k5,D.getEarliestCommonCallerAncestor=jAe,D.getEarliestIndividualCommonCallerAncestor=qb,D.getEarliestSingleCallerAncestorOfValueWriterAndItsValueReaders=UAe,D.getEntitiesCreatedSinceInitialization=t0,D.getEntitiesToPropagateValuesTo=gn,D.getEntityArgumentDeclarations=Yb,D.getEntityInputMaps=VS,D.getEntityOutputMaps=zAe,D.getEntityReferenceSchema=C0e,D.getEntityReturnDeclarations=LS,D.getEntityTypeSchema=O0e,D.getEntityWithLogicScopeReferenceSchema=Ga,D.getEntityWithLogicScopeTypeSchema=A0e,D.getEntityWithValueReferenceSchema=qx,D.getEntityWithValueTypeSchema=p0e,D.getEntryPointEntityReferenceSchema=fi,D.getEntryPointEntityTypeSchema=lo,D.getEventEntityReferenceSchema=My,D.getEventEntityTypeSchema=Ly,D.getEventNameFromDefinition=fAe,D.getExecutableEntityReferenceSchema=E0e,D.getExecutableEntityTypeSchema=v0e,D.getExtendedBuiltInEntity=XAe,D.getExtendedDefinitionEntity=km,D.getFirstNonLoopScopeOwner=Yr,D.getFirstParentExecutableEntity=xS,D.getGenerationTargetSchemaBasedOnType=_5,D.getHTTPAPINameFromProjectId=T5,D.getHeadIfPartOfDetachedBranch=SS,D.getHighestScope=kS,D.getImplementedBuiltInEntity=QAe,D.getIsInteractive=uf,D.getLastInListOperation=sE,D.getLastInListOperationError=YD,D.getLastInListOperationErrorParentRef=WD,D.getLastInListOperationInputListArgument=ZD,D.getLastInListOperationInputListArgumentParentRef=qD,D.getLastInListOperationInputListArgumentRef=FD,D.getLastInListOperationInputListDataType=SD,D.getLastInListOperationOutputElementDataType=kD,D.getLastInListOperationOutputElementReturn=JD,D.getLastInListOperationOutputElementReturnParentRef=HD,D.getLastInListOperationOutputElementReturnRef=KD,D.getLinkedEntitiesFromArgumentDeclaration=qAe,D.getLiteralValueNameFromDataType=bl,D.getLowestPersistedEntityImplementation=Qb,D.getOnlyRelevantErrorsForPublication=CAe,D.getParentCallableEntity=q5,D.getParentCallerEntity=H5,D.getParentCanvasEntities=ri,D.getParentCanvasEntity=Tr,D.getParentCanvasEntityFromTransfer=Um,D.getParentEntryPoint=af,D.getParentExecutableEntity=Zb,D.getParentPassthroughCallableEntity=Z5,D.getPassThroughCallableEntityReferenceSchema=Dr,D.getPassThroughCallableEntityTypeSchema=By,D.getPeristedEntities=nbe,D.getPlayableEntityReferenceSchema=w0e,D.getPlayableEntityTypeSchema=b0e,D.getProject=pwe,D.getPrototypeByType=cf,D.getRecordOrderForTraversal=NAe,D.getRecusriveParentsIds=Jm,D.getReferenceEntityId=H,D.getReferencedEntitiesStateOrErrors=Dm,D.getReferencedEntityStateOrErrors=$b,D.getReferencedIds=su,D.getRelatedCallableElementsOnTheRight=Sm,D.getRelatedCanvasElementsOnTheLeft=Oo,D.getRelatedCanvasElementsOnTheLeftFromTransfer=JAe,D.getRelatedCanvasElementsOnTheRight=$n,D.getRelationalDBInstanceNameFromEntityId=I5,D.getRootEntryPointScopeOwner=pf,D.getScopeOwner=Ji,D.getStateClassFromType=dbe,D.getStepNameFromDefinition=pAe,D.getTerminationReferenceSchema=D0e,D.getTerminationTypeSchema=g0e,D.getTopLevelParentEntityId=JS,D.getTouchedCanvasEntitiesFromChangeSet=cbe,D.getUsedArgFromDeclaration=WAe,D.getUsedReturnFromDeclaration=YAe,D.getValueReadingEntityReferenceSchema=kx,D.getValueReadingEntityTypeSchema=ja,D.getValueWritingEntityReferenceSchema=c0e,D.getValueWritingEntityTypeSchema=Sc,D.getVariableFromInputMapping=W5,D.getVariableFromReturnVariablePointer=X5,D.getVariableReferenceSchema=oo,D.getVariableTypeSchema=El,D.getVariablesFromArgumentDeclarations=Gm,D.getVariablesFromInputMaps=Y5,D.getVariablesFromOutputMapping=Q5,D.getVariablesFromOutputMaps=eS,D.getVariablesFromReturnDeclarations=z5,D.getVariablesInSameOrHigherScope=SA,D.getWrites=jm,D.globalEventValidation=J0e,D.groupCallsBasedOnParallelizableExecution=SAe,D.handleAfterEntityImplementationSideEffects=j5,D.handleBeforeEntityImplementationSideEffects=x5,D.handleLiteralValueChange=lTe,D.handleLiteralValueDelete=dF,D.handleValueAsTypeChange=dTe,D.handleValueAsTypeDelete=pF,D.httpRequestBodyArgument=Th,D.httpRequestBodyArgumentRef=$C,D.httpRequestBodyDataType=PC,D.httpRequestHeadersArgument=Eh,D.httpRequestHeadersArgumentRef=OC,D.httpRequestHeadersDataType=CC,D.httpRequestMethodArgument=mh,D.httpRequestMethodArgumentRef=gC,D.httpRequestMethodDataType=DC,D.httpRequestMethodDataTypeRef=RC,D.httpRequestOperation=ic,D.httpRequestOperationErrorValueDescriptor=fE,D.httpRequestOperationErrorValueDescriptorDatatype=YC,D.httpRequestOperationErrorValueDescriptorRef=WC,D.httpRequestOperationRef=qC,D.httpRequestOperationRefEight=HC,D.httpRequestOperationRefFive=KC,D.httpRequestOperationRefFour=SC,D.httpRequestOperationRefNine=JC,D.httpRequestOperationRefSeven=ZC,D.httpRequestOperationRefSix=kC,D.httpRequestOperationRefThree=FC,D.httpRequestOperationRefTwo=GC,D.httpRequestQueryParamsArgument=pE,D.httpRequestQueryParamsArgumentRef=bC,D.httpRequestQueryParamsDataType=wC,D.httpRequestVariableURLArgument=vh,D.httpRequestVariableURLArgumentRef=IC,D.httpRequestVariableURLDataType=AC,D.httpRequestVariableURLDataTypeRef=EC,D.httpResponseBodyReturnDataType=jC,D.httpResponseBodyReturnDataTypeRef=UC,D.httpResponseBodyReturnReturn=bh,D.httpResponseBodyReturnReturnRef=xC,D.httpResponseCodeDataType=VC,D.httpResponseCodeReturn=Ih,D.httpResponseCodeReturnRef=NC,D.httpResponseHeadersDataType=BC,D.httpResponseHeadersDataTypeRef=LC,D.httpResponseHeadersReturn=Ah,D.httpResponseHeadersReturnRef=MC,D.httpStatusCodeValueValidation=TK,D.hydrateOrDiscardLiteralValue=XG,D.implement=Vm,D.inferArgumentDeclarationDataType=MG,D.inferDataType=bn,D.inferInputMapDataType=jA,D.inferOutputMapDataType=FA,D.inferPropertyDataType=xG,D.inferReturnDeclarationDataType=GA,D.inferValueDescriptorDataType=jG,D.inferVariableDeclarationDataType=UG,D.inferVariableInstanceDataType=BG,D.initBaseProjectEntity=e0,D.initProject=bK,D.initProjectFromFetchResult=AK,D.inputMapValidation=WEe,D.installedProjectValidation=ZEe,D.internalCallValidation=HEe,D.isPromise=jb,D.isUUID=rK,D.iterateOverListActionDescriptorListArgumentDeclaration=yN,D.iterateOverListActionDescriptorListArgumentDeclarationDataType=fN,D.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=pN,D.iterateOverListActionDescriptorListArgumentDeclarationParentRef=hN,D.iterateOverListLoopActionDescriptor=Qa,D.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=vN,D.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=mN,D.iterateOverListLoopBodyActionDescriptor=ac,D.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=gN,D.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=_N,D.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=ON,D.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=DN,D.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=$h,D.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=TN,D.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=EN,D.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=IN,D.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=RN,D.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=bN,D.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=AN,D.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=wN,D.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=VN,D.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=PN,D.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=$N,D.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=NN,D.iterateOverObjectKeysLoopActionDescriptor=ld,D.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=MN,D.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=LN,D.iterateOverObjectKeysLoopBodyActionDescriptor=OE,D.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=kN,D.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=KN,D.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=ZN,D.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=qN,D.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=DE,D.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=UN,D.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=BN,D.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=xN,D.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=SN,D.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=GN,D.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=jN,D.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=FN,D.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=zN,D.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=WN,D.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=JN,D.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=YN,D.iterateOverObjectValuesLoopActionDescriptor=dd,D.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=QN,D.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=XN,D.iterateOverObjectValuesLoopBodyActionDescriptor=$E,D.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=lV,D.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=oV,D.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=uV,D.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=dV,D.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=CE,D.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=tV,D.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=eV,D.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=rV,D.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=aV,D.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=sV,D.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=iV,D.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=nV,D.iterateOverStringActionDescriptorDynamicReturnDeclaration=eN,D.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=QP,D.iterateOverStringActionDescriptorStringArgumentDeclaration=XP,D.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=YP,D.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=WP,D.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=zP,D.iterateOverStringLoopActionDescriptor=nc,D.iterateOverStringLoopBodyActionDescriptor=Ch,D.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=lN,D.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=oN,D.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=uN,D.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=dN,D.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=_E,D.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=rN,D.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=tN,D.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=iN,D.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=gE,D.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=nN,D.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=sN,D.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=aN,D.joinListOperation=tE,D.joinListOperationError=ID,D.joinListOperationErrorParentRef=TD,D.joinListOperationFirstListArgument=hD,D.joinListOperationFirstListArgumentParentRef=fD,D.joinListOperationFirstListArgumentRef=oD,D.joinListOperationFirstListDataType=lD,D.joinListOperationResultListDataType=pD,D.joinListOperationResultListReturn=ED,D.joinListOperationResultListReturnParentRef=vD,D.joinListOperationResultListReturnRef=cD,D.joinListOperationSecondListArgument=mD,D.joinListOperationSecondListArgumentParentRef=yD,D.joinListOperationSecondListArgumentRef=dD,D.joinListOperationSecondListDataType=uD,D.joinListWithLastSeparator=ot,D.joinStringsOperation=rc,D.joinStringsOperationDynamicStringArgument=G1,D.joinStringsOperationDynamicStringArgumentParentRef=j1,D.joinStringsOperationDynamicStringArgumentRef=U1,D.joinStringsOperationDynamicStringDataType=x1,D.joinStringsOperationError=B1,D.joinStringsOperationErrorParentRef=M1,D.joinStringsOperationFirstStringArgument=fh,D.joinStringsOperationFirstStringArgumentParentRef=g1,D.joinStringsOperationFirstStringArgumentRef=I1,D.joinStringsOperationFirstStringDataType=A1,D.joinStringsOperationResultStringDataType=_1,D.joinStringsOperationResultStringReturn=tc,D.joinStringsOperationResultStringReturnParentRef=L1,D.joinStringsOperationResultStringReturnRef=R1,D.joinStringsOperationSecondStringArgument=hh,D.joinStringsOperationSecondStringArgumentParentRef=V1,D.joinStringsOperationSecondStringArgumentRef=b1,D.joinStringsOperationSecondStringDataType=w1,D.joinStringsOperationSeparatorStringArgument=N1,D.joinStringsOperationSeparatorStringArgumentParentRef=P1,D.joinStringsOperationSeparatorStringArgumentRef=D1,D.joinStringsOperationSeparatorStringDataType=$1,D.joinStringsOperationSeparatorStringDataTypeDefaultValue=C1,D.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=O1,D.keyValuePrototype=nd,D.literalValueValidation=rTe,D.loopValidation=Y0e,D.lowercaseFirstLetter=Ld,D.manualFlowActionDescriptorDeclarationArgumentDeclaration=RE,D.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=SP,D.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=FP,D.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=KP,D.manualFlowLoopActionDescriptor=Dh,D.manualFlowLoopActionDescriptorDynamicReturnDeclaration=GP,D.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=jP,D.manualFlowLoopBodyActionDescriptor=Oh,D.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=qP,D.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=kP,D.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=HP,D.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=ZP,D.mapActionDescriptorToTypeItRepresents=ibe,D.mapRecord=nS,D.mergeArraysOfStringsWithoutDuplicates=oAe,D.mergeEntityErrorsList=dfe,D.mergeListOfEntities=tbe,D.methodDefaultValue=_C,D.mockClientProject=dI,D.moreThanOrEqualCondition=hd,D.moreThanOrEqualConditionLeftHandArgument=f2,D.moreThanOrEqualConditionLeftHandArgumentDataType=c2,D.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=u2,D.moreThanOrEqualConditionLeftHandArgumentParentRef=p2,D.moreThanOrEqualConditionRightHandArgument=v2,D.moreThanOrEqualConditionRightHandArgumentDataType=y2,D.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=h2,D.moreThanOrEqualConditionRightHandArgumentParentRef=m2,D.noSpacesOrDashesValueValidation=K5,D.noSpacesValueValidation=S5,D.notEmptyCondition=sl,D.notEmptyConditionArgument=a2,D.notEmptyConditionRef=n2,D.nullPrototype=Hv,D.numberAdditionOperation=ph,D.numberAdditionOperationDynamicSummandArgument=r1,D.numberAdditionOperationDynamicSummandArgumentType=t1,D.numberAdditionOperationDynamicSummandArgumentTypeParentRef=e1,D.numberAdditionOperationError=Qg,D.numberAdditionOperationErrorParentRef=Xg,D.numberAdditionOperationFirstNumberArgument=Jv,D.numberAdditionOperationFirstNumberArgumentRef=kg,D.numberAdditionOperationFirstNumberDataType=qg,D.numberAdditionOperationRef=Yg,D.numberAdditionOperationRefThree=Yv,D.numberAdditionOperationRefTwo=zg,D.numberAdditionOperationResultNumberDataType=Wg,D.numberAdditionOperationResultNumberReturn=zv,D.numberAdditionOperationResultNumberReturnRef=Jg,D.numberAdditionOperationSecondNumberArgument=Wv,D.numberAdditionOperationSecondNumberArgumentRef=Zg,D.numberAdditionOperationSecondNumberDataType=Hg,D.numberPrototype=lt,D.numberSubtractionOperation=Qv,D.numberSubtractionOperationDynamicSubtrahendArgument=E1,D.numberSubtractionOperationDynamicSubtrahendArgumentType=v1,D.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=m1,D.numberSubtractionOperationError=y1,D.numberSubtractionOperationErrorParentRef=h1,D.numberSubtractionOperationFirstNumberArgument=d1,D.numberSubtractionOperationFirstNumberArgumentRef=i1,D.numberSubtractionOperationFirstNumberDataType=s1,D.numberSubtractionOperationRef=Xv,D.numberSubtractionOperationRefThree=p1,D.numberSubtractionOperationRefTwo=u1,D.numberSubtractionOperationResultNumberDataType=l1,D.numberSubtractionOperationResultNumberReturn=f1,D.numberSubtractionOperationResultNumberReturnRef=o1,D.numberSubtractionOperationSecondNumberArgument=c1,D.numberSubtractionOperationSecondNumberArgumentRef=n1,D.numberSubtractionOperationSecondNumberDataType=a1,D.numberValueAutogenerationSchema=GI,D.operationValidation=k0e,D.orderEntitiesForTraversal=PAe,D.outputMapValidation=QEe,D.parallelExecutionOperation=En,D.parallelExecutionOperationError=_O,D.parallelExecutionOperationErrorParentRef=RO,D.parallelExecutionOperationListOfExecutionResultsDataType=AO,D.parallelExecutionOperationListOfExecutionResultsReturn=lE,D.parallelExecutionOperationListOfExecutionResultsReturnRef=IO,D.parallelExecutionOperationListOfFunctionsArgument=oE,D.parallelExecutionOperationListOfFunctionsArgumentDatatype=TO,D.parallelExecutionOperationListOfFunctionsArgumentRef=EO,D.parallelExecutionOperationListOfFunctionsBlueprint=vO,D.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=yO,D.parallelExecutionOperationListOfFunctionsBlueprintDynamicInputParentRef=hO,D.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=fO,D.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutputParentRef=pO,D.parallelExecutionOperationListOfFunctionsBlueprintParentRef=mO,D.parallelExecutionOperationRef=bO,D.parallelExecutionOperationRefThree=wO,D.persistedBuiltInBaseEntity=$i,D.persistedBuiltInBaseEntityDatabaseProperty=cd,D.persistedBuiltInBaseEntityDatabasePropertyDataType=jL,D.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=QZ,D.persistedBuiltInBaseEntityDatabasePropertyParentRef=GL,D.persistedBuiltInBaseEntityDatabasePropertyRef=xL,D.persistedBuiltInBaseEntityPrimaryKeyProperty=pd,D.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=JL,D.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=SL,D.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=FL,D.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=WL,D.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=HL,D.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=kL,D.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=KL,D.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=ZL,D.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=qL,D.printEntity=Sb,D.processOutputGlobalValueDescriptorDataType=C2,D.processOutputGlobalValueDescriptorReturn=Fh,D.processOutputGlobalValueDescriptorReturnRef=O2,D.projectPublicationCompletedGlobalEvent=Gh,D.propagateNewInputOrOutputMapValueAsTypeToParentVariable=Wp,D.propagateNewInputOrOutputMapValueToParentVariable=Jp,D.propagateNewStaticPropertyValueAsTypeToVariables=_l,D.propagateNewStaticPropertyValueToVariables=Rl,D.propertyToZodSchema=F2,D.propertyValidation=Tbe,D.readValueFromWritter=zd,D.rebaseStack=mA,D.relationalDatabaseBuiltInBaseEntity=wi,D.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=kE,D.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=$L,D.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=CL,D.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=PL,D.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=OL,D.relationalDatabaseBuiltInBaseEntityDefaultProperty=KE,D.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=DL,D.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=_L,D.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=gL,D.relationalDatabaseBuiltInBaseEntityIdentifierProperty=Nh,D.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=mL,D.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=hL,D.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=yL,D.relationalDatabaseBuiltInBaseEntityMinSizeProperty=Mh,D.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=RL,D.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=bL,D.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=wL,D.relationalDatabaseBuiltInBaseEntityPasswordProperty=Lh,D.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=IL,D.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=XZ,D.relationalDatabaseBuiltInBaseEntityPasswordPropertyDefaultValueParentRef=AL,D.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=TL,D.relationalDatabaseBuiltInBaseEntityRef=ud,D.relationalDatabaseBuiltInBaseEntityUsernameProperty=Vh,D.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=EL,D.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=zZ,D.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=vL,D.removeDisabledReasons=dAe,D.resolveActionDescriptorName=eK,D.resolveArgumentDeclarationValue=kA,D.resolveBaseEntityName=YS,D.resolveBuiltInBaseEntityDataTypeLabel=zS,D.resolveCardSubheader=YIe,D.resolveClonedEntityProject=Sr,D.resolveConditionOperatorLabel=zm,D.resolveDataType=Xy,D.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=Fb,D.resolveDataTypeLabel=uu,D.resolveDatatypeIconName=WIe,D.resolveDefinitionEntityDataTypeLabel=mbe,D.resolveDefinitionEntitySubheader=yb,D.resolveEntityCodeName=cw,D.resolveEntityDataTypeLabel=ybe,D.resolveEntityName=ne,D.resolveEntitySubheader=zIe,D.resolveFirstCallsSecond=KAe,D.resolveFirstWritesSecond=kAe,D.resolveFunctionDeclarationCardSubheader=mb,D.resolveInputMapNextStandaloneValue=Zp,D.resolveInputMapNextValue=rm,D.resolveInputMapNextValueAsPropertyOfAnObject=rF,D.resolveInputMapStandaloneValue=Hp,D.resolveInputMapValue=sF,D.resolveInputMapValueAsPropertyOfAnObject=iF,D.resolveMethodCardSubheader=u5,D.resolveNextValue=im,D.resolveOutputMapValue=ZA,D.resolvePersistedDefinitionEntityDatabaseEntity=ZS,D.resolvePrimaryKeyProperty=obe,D.resolvePrimitiveEntityForSearchLiteralValueType=BA,D.resolvePrimitiveEntityName=QS,D.resolvePropertyValue=nF,D.resolvePublicationStepStatusFromType=mAe,D.resolveResourceNameFromType=yAe,D.resolveReturnDeclarationValue=qA,D.resolveSearchName=XS,D.resolveValue=wl,D.resolveValueDescriptorValue=aF,D.resolveVarDeclarationAggregateObjectValue=eF,D.resolveVarDeclarationNextAggregateObjectValue=QG,D.resolveVarDeclarationNextValue=qp,D.resolveVarDeclarationValue=KA,D.resolveVarInstanceNextValue=tm,D.resolveVarInstanceValue=tF,D.resolveVariableScope=YEe,D.returnDeclarationValidation=q0e,D.returnStatementValidation=Z0e,D.searchStatementErrorGlobalValueDescriptor=zE,D.searchStatementErrorGlobalValueDescriptorDataType=P2,D.searchStatementErrorGlobalValueDescriptorRef=$2,D.searchStatementState=KEe,D.searchStatementUtils=qEe,D.searchValidation=tve,D.sequentialExecutionOperation=Pa,D.sequentialExecutionOperationError=KO,D.sequentialExecutionOperationErrorParentRef=SO,D.sequentialExecutionOperationListOfExecutionResultsDataType=jO,D.sequentialExecutionOperationListOfExecutionResultsReturn=cE,D.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=FO,D.sequentialExecutionOperationListOfExecutionResultsReturnRef=xO,D.sequentialExecutionOperationListOfFunctionsArgument=uE,D.sequentialExecutionOperationListOfFunctionsArgumentDatatype=UO,D.sequentialExecutionOperationListOfFunctionsArgumentParentRef=GO,D.sequentialExecutionOperationListOfFunctionsArgumentRef=BO,D.sequentialExecutionOperationListOfFunctionsBlueprint=MO,D.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=LO,D.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=VO,D.sortCallsBasedOnExecutionDependencies=J5,D.sortChildrenEntitiesBasedOnExecutionDependencies=FAe,D.splitListOperation=iE,D.splitListOperationError=xD,D.splitListOperationErrorParentRef=UD,D.splitListOperationFirstOutputListDataType=DD,D.splitListOperationFirstOutputListReturn=VD,D.splitListOperationFirstOutputListReturnParentRef=ND,D.splitListOperationFirstOutputListReturnRef=rE,D.splitListOperationInputListArgument=CD,D.splitListOperationInputListArgumentParentRef=OD,D.splitListOperationInputListArgumentRef=wD,D.splitListOperationInputListDataType=RD,D.splitListOperationSecondOutputListDataType=LD,D.splitListOperationSecondOutputListReturn=BD,D.splitListOperationSecondOutputListReturnParentRef=MD,D.splitListOperationSplitIndexArgument=PD,D.splitListOperationSplitIndexArgumentParentRef=$D,D.splitListOperationSplitIndexArgumentRef=_D,D.splitListOperationSplitIndexDataType=gD,D.splitStringOperation=eE,D.splitStringOperationError=iD,D.splitStringOperationErrorParentRef=rD,D.splitStringOperationFirstPartResultStringDataType=Z1,D.splitStringOperationFirstPartResultStringReturn=tD,D.splitStringOperationFirstPartResultStringReturnParentRef=eD,D.splitStringOperationFirstPartResultStringReturnRef=q1,D.splitStringOperationIndexArgument=X1,D.splitStringOperationIndexArgumentParentRef=z1,D.splitStringOperationIndexArgumentRef=K1,D.splitStringOperationIndexDataType=k1,D.splitStringOperationSecondPartResultStringDataType=J1,D.splitStringOperationSecondPartResultStringReturn=WZ,D.splitStringOperationSecondPartResultStringReturnParentRef=Q1,D.splitStringOperationSecondPartResultStringReturnRef=H1,D.splitStringOperationStringArgument=Y1,D.splitStringOperationStringArgumentParentRef=W1,D.splitStringOperationStringArgumentRef=F1,D.splitStringOperationStringDataType=S1,D.stringPrototype=Ye,D.stringValueAutogenerationSchema=jI,D.suggestNewIdForEntity=pw,D.syncSearchEntityOutput=xA,D.test_primitive_entities_export=rwe,D.toCamelCase=jr,D.toEditorContext=HIe,D.toEntityState=Wi,D.toKebabCase=WS,D.toLowerCaseKebabCase=Ym,D.toPascalCase=du,D.toProjectLogicContext=fTe,D.toSnakeCase=hbe,D.transitionProjectVersion=hA,D.translateLogicErrorCode=eAe,D.translateLogicErrorCodeShort=tAe,D.translateLogicErrorCodeShortWithEntityName=rAe,D.translateLogicErrorCodeWithEntityName=iAe,D.traverseChangeSet=yA,D.untypedDataPrototype=bi,D.updateErrorsList=Er,D.updatePersistedEntityMethod=BL,D.updatePersistedEntityMethodParentRef=ML,D.urlDefaultValue=TC,D.uuidPrototype=Ca,D.validateArgumentDeclarationName=dw,D.validateCalledByErrorIdInAction=RAe,D.validateCalledByIdInAction=wAe,D.validateCallers=P5,D.validateConditionEntityDeclaration=DAe,D.validateDataOperation=Wo,D.validateDataOperationDataToValidateArgument=lC,D.validateDataOperationDataToValidateArgumentParentRef=oC,D.validateDataOperationDataToValidateArgumentRef=nC,D.validateDataOperationDataToValidateDataType=aC,D.validateDataOperationEntityToMatchTypeArgument=pC,D.validateDataOperationEntityToMatchTypeArgumentParentRef=cC,D.validateDataOperationEntityToMatchTypeArgumentRef=dC,D.validateDataOperationEntityToMatchTypeDataType=uC,D.validateDataOperationError=mC,D.validateDataOperationErrorParentRef=yC,D.validateDataOperationOutputEntityDeclaration=hC,D.validateDataOperationOutputEntityDeclarationParentRef=fC,D.validateDefinitionEntityName=nw,D.validateEntryCaller=$5,D.validateErrorCaller=C5,D.validateFunctionCallDeclaration=V5,D.validateFunctionDeclarationName=aw,D.validateGeneratedEntityParentIsNotBuiltInEntity=TAe,D.validateGeneration=vAe,D.validateGenerationTarget=Ur,D.validateGenerationUpdate=EAe,D.validateLoopEntityDeclaration=OAe,D.validateMissingValue=go,D.validateName=vbe,D.validateOperationEntityDeclaration=L5,D.validatePropertyName=lw,D.validateReachability=Ka,D.validateReadsValueInActionPayload=_Ae,D.validateReferenceObject=gm,D.validateReferenceToOne=Pb,D.validateReferences=li,D.validateReturnDeclarationName=uw,D.validateSuccessCaller=O5,D.validateValueReaderGenerationUpdate=sf,D.validateValueWritter=Ub,D.validateVariableDeclarationName=ow,D.validateVariableInternalCallUse=xb,D.valueAutogenerationCurrentDateAndTimeSchema=Ix,D.valueAutogenerationGenericSchema=vy,D.valueAutogenerationOptions=SI,D.valueAutogenerationOptionsSchema=Tx,D.valueAutogenerationRandomBooleanSchema=xI,D.valueAutogenerationRandomDateBetweenSchema=Cx,D.valueAutogenerationRandomDateFromSchema=Dx,D.valueAutogenerationRandomDateSchema=Iy,D.valueAutogenerationRandomDateUntilSchema=Ox,D.valueAutogenerationRandomNumberBetweenSchema=wx,D.valueAutogenerationRandomNumberFromSchema=Ax,D.valueAutogenerationRandomNumberSchema=Ey,D.valueAutogenerationRandomNumberUntilSchema=bx,D.valueAutogenerationRandomSchema=Nc,D.valueAutogenerationRandomTextBetweenSchema=gx,D.valueAutogenerationRandomTextFromSchema=Rx,D.valueAutogenerationRandomTextSchema=Ty,D.valueAutogenerationRandomTextUntilSchema=_x,D.valueAutogenerationRangeValueTypesSchema=Pc,D.valueAutogenerationUniqueSchema=UI,D.valueDescriptorValidation=nTe,D.variableDeclarationValidation=Q0e,D.variableInstanceValidation=eve,D.waitOperation=zi,D.waitOperationMillisecondsNumberArgument=Ho,D.waitOperationMillisecondsNumberArgumentRef=gO,D.waitOperationMillisecondsNumberDataType=DO,D.waitOperationOperationError=$O,D.waitOperationOperationErrorParentRef=CO,D.waitOperationRef=OO,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})});
|
|
409
|
+
`)),Me.log("Persisting new additions"),v.visit(async(E,b)=>{if(a.added[E.id]){Me.log("Adding: ",E.id);try{const A=te(E,this);if(A.hydrateAncestors(),A.addSelfToProject(o),o.add(A,S.Added),!this.get(E.id))throw new Error(`Entity ${E.id} was not added to the project`)}catch(A){Me.error("Error: ",A),Me.error("Errored entity: ",E)}}}),Me.log("Persisting updates"),v.visit(async(E,b)=>{if(a.updated[E.id]){Me.log("Updating: ",E.id);try{const A=this.get(E.id);A?(A.updateWithShallowTransfer(E,o),o.add(A,S.Updated)):Me.warn(`Active version of ${E.id} not found when applying external changes`)}catch(A){Me.error("Error: ",A),Me.error("Errored entity: ",E)}}}),Me.log("Persisting removals"),v.visit(async(E,b)=>{if(a.removed[E.id]){Me.log("Removing: ",E.id);try{const A=this.get(E.id);A&&A.remove({ignoreUpstream:!1},o)}catch(A){Me.error("Error: ",A),Me.error("Errored entity: ",E)}}}),o}toFullProjectTransfer(){const i=new oa(this),a={};return i.visit(o=>{const p=o.toShallowJSON();a[o.id]=p}),{order:i.order,size:i.order.length,record:a}}};g(yt,"parentContext",hw),g(yt,"sessionAuthor","1"),g(yt,"repository",{APICreate:async(i,...a)=>i,APIUpdate:async(i,...a)=>i,APIDelete:async(i,...a)=>i,APIClone:async(i,...a)=>{},APILoad:async(i,...a)=>null,APILoadVersion:async(i,a,...o)=>null}),g(yt,"type",f.Project),g(yt,"USER_MANAGED_PARENT_TYPES",[]),g(yt,"PARENT_TYPES",[...yt.USER_MANAGED_PARENT_TYPES]),g(yt,"MUTABLE_BASE_PROPERTIES",["name","description"]),g(yt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),g(yt,"BASE_PROPERTIES",[...yt.MUTABLE_BASE_PROPERTIES,...yt.INMUTABLE_BASE_PROPERTIES]),g(yt,"MUTABLE_META_PROPERTIES",[...yt.MUTABLE_BASE_PROPERTIES,"x","y"]),g(yt,"INMUTABLE_META_PROPERTIES",[...yt.INMUTABLE_BASE_PROPERTIES]),g(yt,"META_PROPERTIES",[...yt.MUTABLE_META_PROPERTIES,...yt.INMUTABLE_META_PROPERTIES]),g(yt,"MUTABLE_UPSTREAM_PROPERTIES",[]),g(yt,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),g(yt,"UPSTREAM_PROPERTIES",[...yt.MUTABLE_UPSTREAM_PROPERTIES,...yt.INMUTABLE_UPSTREAM_PROPERTIES]),g(yt,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),g(yt,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),g(yt,"DOWNSTREAM_PROPERTIES",[...yt.MUTABLE_DOWNSTREAM_PROPERTIES,...yt.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(yt,"PROPERTIES",[...yt.META_PROPERTIES,...yt.UPSTREAM_PROPERTIES,...yt.DOWNSTREAM_PROPERTIES]);let N=yt;class hK extends pt{constructor(i){super(En,i);g(this,"id",ir.Parallel);g(this,"name",ir.Parallel);g(this,"description","Programmatically execute a list of actions one after the other");g(this,"version","1");g(this,"autoexecutable",!0);g(this,"initialData",En);g(this,"type",f.ActionDescriptor);g(this,"inputs",[]);g(this,"outputs",[]);g(this,"error",null);g(this,"project");this.project=i,this.inputs=En.inputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(null),o}),this.outputs=En.outputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(null),o}),this.error=En.error?te(En.error,this.project):null}}class yK extends pt{constructor(i){super(zi,i);g(this,"id",zi.id);g(this,"name",zi.name);g(this,"description",zi.description);g(this,"version",zi.version);g(this,"autoexecutable",!1);g(this,"initialData",zi);g(this,"type",f.ActionDescriptor);g(this,"inputs",[]);g(this,"outputs",[]);g(this,"error",null);g(this,"project");this.project=i,this.inputs=zi.inputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(null),o}),this.outputs=zi.outputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(null),o}),this.error=zi.error?te(zi.error,this.project):null}}class mK extends pt{constructor(i){super(Pa,i);g(this,"id",ir.Sequential);g(this,"name",ir.Sequential);g(this,"description","Programmatically execute a list of actions one after the other");g(this,"version","1");g(this,"autoexecutable",!0);g(this,"initialData",Pa);g(this,"type",f.ActionDescriptor);g(this,"inputs",[]);g(this,"outputs",[]);g(this,"error",null);g(this,"project");this.project=i,this.inputs=Pa.inputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(null),o}),this.outputs=Pa.outputs.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(null),o}),this.error=Pa.error?te(Pa.error,this.project):null}}class Zbe extends pt{constructor(u){super(ic,u)}}class Hbe extends pt{constructor(u){super(Jo,u)}}class Jbe extends pt{constructor(i){super(Wo,i);g(this,"autoexecutable",!0)}getEntityToMatchInputMap(i){return i.inputs.find(a=>{var o;return((o=a.declaration)==null?void 0:o.id)===Ee.operation[fr.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(i){return i.inputs.find(a=>{var o;return((o=a.declaration)==null?void 0:o.id)===Ee.operation[fr.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(i){return i.outputs.find(a=>{var o;return((o=a.declaration)==null?void 0:o.id)===Ee.operation[fr.Validate].outputs.outputEntity.id})||null}getEntityToMatch(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"get-entity-to-match-validate-data"))){var e;const o=((e=this.project.requestActiveDynamicValue(i))==null?void 0:e.value)||null,p=o==null?void 0:o.valueAsTypeSingle;return a==null||a.attemptAutoclose("get-entity-to-match-validate-data",this.id),p}syncOperationInstance(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-operation-instance-validate-data"))){const o=[],p=[],e=[],y=[],v=this.getEntityToMatchInputMap(i);if(v){const{added:A,updated:$,removed:V,affected:B}=this.syncEntityToMatchInputMapDataType(v,a);o.push(...$),p.push(...A),e.push(...V),y.push(...B)}const E=this.getDataToValidateInputMap(i);if(E){const{added:A,updated:$,removed:V,affected:B}=this.syncDataToValidateInputMapDataType(E,a);o.push(...$),p.push(...A),e.push(...V),y.push(...B)}const b=this.getOutputDataOutputMap(i);if(b){const{added:A,updated:$,removed:V,affected:B}=this.syncOutputDataOutputMapDataType(b,a);o.push(...$),p.push(...A),e.push(...V),y.push(...B)}return a==null||a.attemptAutoclose("sync-operation-instance-validate-data",this.id),{updated:R(o),added:R(p),removed:R(e),affected:R(y),self:i}}syncEntityToMatchInputMapDataType(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-entity-to-match-input-map-data-type"))){var b,A,$,V,B,F,K,Z,ie,X,ue,re,fe,Y,J,ce,z;const o=[],p=[],e=[],y=[];if(((b=i.declaration)==null?void 0:b.id)!==Ee.operation[fr.Validate].inputs.entityToMatch.id)return a==null||a.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const v=((A=this.project.requestActiveDynamicValue(i))==null?void 0:A.value)||null,E=v==null?void 0:v.valueAsTypeSingle;if(!i.dataType){const de={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,parentRelationType:null,options:(($=i.declaration.dataType)==null?void 0:$.options)||null,implementationChooseOne:((V=i.declaration.dataType)==null?void 0:V.implementationChooseOne)||!1,staticEntities:((B=i.declaration.dataType)==null?void 0:B.staticEntities)??null,interactiveEntities:((F=i.declaration.dataType)==null?void 0:F.interactiveEntities)??null,actionEntities:((K=i.declaration.dataType)==null?void 0:K.actionEntities)??null,index:((Z=i.declaration.dataType)==null?void 0:Z.index)??null,isList:((ie=i.declaration.dataType)==null?void 0:ie.isList)||!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:(E==null?void 0:E.toJSON())||null,like:!0,inferred:!0,parent:i.toReference()},Ae=te(de,i.project);Ae.hydrateAncestors(),Ae.setParent(i,a),Ae.initChildren(a),Ae.setEntity(E,a),a==null||a.add(Ae,S.Added),o.push(Ae),i.setDataType(Ae,a)}return(ce=i.dataType)==null||ce.metaSync({inferred:!0,like:!1,asType:!0,options:((X=i.declaration.dataType)==null?void 0:X.options)||null,implementationChooseOne:((ue=i.declaration.dataType)==null?void 0:ue.implementationChooseOne)||!1,staticEntities:((re=i.declaration.dataType)==null?void 0:re.staticEntities)??null,interactiveEntities:((fe=i.declaration.dataType)==null?void 0:fe.interactiveEntities)??null,actionEntities:((Y=i.declaration.dataType)==null?void 0:Y.actionEntities)??null,isList:((J=i.declaration.dataType)==null?void 0:J.isList)||!1},a),(z=i.dataType)==null||z.setEntity(E,a),i.dataType&&p.push(i.dataType),a==null||a.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:R(p),added:R(o),removed:R(e),affected:R(y),self:i.dataType}}syncDataToValidateInputMapDataType(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-data-to-validate-input-map-data-type"))){var A,$,V;const o=[],p=[],e=[],y=[];if(((A=i.declaration)==null?void 0:A.id)!==Ee.operation[fr.Validate].inputs.dataToValidate.id)return a==null||a.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const v=this.getEntityToMatchInputMap(i.parent);if(!v)return a==null||a.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(v,a))return a==null||a.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!i.dataType){const B={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,index:null,parentRelationType:null,options:null,implementationChooseOne:!1,isList:!1,andChildrenGroup:null,orChildrenGroup:null,staticEntities:null,interactiveEntities:null,actionEntities:null,asType:!1,entity:null,like:!0,inferred:!0,parent:i.toReference()},F=te(B,i.project);F.setParent(i,a),F.initChildren(a),a==null||a.add(F,S.Added),o.push(F),i.setDataType(F,a)}($=i.dataType)==null||$.metaSync({inferred:!0,like:!0,asType:!1},a);const b=this.getEntityToMatch(v,a);return(V=i.dataType)==null||V.setEntity(b,a),i.dataType&&p.push(i.dataType),a==null||a.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:R(p),added:R(o),removed:R(e),affected:R(y),self:i.dataType}}syncOutputDataOutputMapDataType(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-output-data-output-map-data-type"))){var $,V,B,F;const o=[],p=[],e=[],y=[];if((($=i.declaration)==null?void 0:$.id)!==Ee.operation[fr.Validate].outputs.outputEntity.id)return a==null||a.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const v=this.getEntityToMatchInputMap(i.parent);if(!v)return a==null||a.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(v,a))return a==null||a.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const b=((V=this.project.requestActiveDynamicValue(v))==null?void 0:V.value)||null,A=(b==null?void 0:b.valueAsTypeSingle)||null;if(!i.dataType){const K={id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:(A==null?void 0:A.toJSON())||null,like:!0,inferred:!0,parent:i.toReference()},Z=te(K,i.project);Z.hydrateAncestors(),Z.setParent(i,a),Z.initChildren(a),Z.setEntity(A,a),a==null||a.add(Z,S.Added),o.push(Z),i.setDataType(Z,a)}return(B=i.dataType)==null||B.metaSync({inferred:!0,like:!0,asType:!1},a),(F=i.dataType)==null||F.setEntity(A,a),i.dataType&&p.push(i.dataType),a==null||a.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:R(p),added:R(o),removed:R(e),affected:R(y),self:i.dataType}}inferInputMapDataType(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"infer-input-map-data-type-validate-data"))){var p,e,y;if(((p=i.declaration)==null?void 0:p.id)===Ee.operation[fr.Validate].inputs.entityToMatch.id){const{added:v,updated:E,removed:b,affected:A}=this.syncEntityToMatchInputMapDataType(i,a);return a==null||a.attemptAutoclose("infer-input-map-data-type",this.id),{updated:R(E),added:R(v),removed:R(b),affected:R(A),self:i.dataType}}if(((e=i.declaration)==null?void 0:e.id)===Ee.operation[fr.Validate].inputs.dataToValidate.id){const{added:v,updated:E,removed:b,affected:A}=this.syncDataToValidateInputMapDataType(i,a);return a==null||a.attemptAutoclose("infer-input-map-data-type",this.id),{updated:R(E),added:R(v),removed:R(b),affected:R(A),self:i.dataType}}const o=(y=i.declaration)==null?void 0:y.getDataType(a);if(o&&o.isResolved)return a==null||a.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:o};if(i.readsValue){const v=bn(i.readsValue,a);return a==null||a.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:v}}return a==null||a.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:null}}inferOutputMapDataType(i,a=this.project.addChangeSet(new G(this.project,N.sessionAuthor,L().toISOString(),this,!0,"infer-output-map-data-type-validate-data"))){var o;if(((o=i.declaration)==null?void 0:o.id)===Ee.operation[fr.Validate].outputs.outputEntity.id){const{added:p,updated:e,removed:y,affected:v}=this.syncOutputDataOutputMapDataType(i,a);return a==null||a.attemptAutoclose("infer-output-map-data-type-validate-data",this.id),{updated:R(e),added:R(p),removed:R(y),affected:R(v),self:i.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}}class Wbe extends pt{constructor(u){super(tE,u)}}class Ybe extends pt{constructor(u){super(iE,u)}}class zbe extends pt{constructor(u){super(sE,u)}}class Xbe extends pt{constructor(u){super(yh,u)}}class Qbe extends pt{constructor(u){super(ph,u)}}class ewe extends pt{constructor(u){super(rc,u)}}function twe(d){const u=[new mK(d),new hK(d),new yK(d),new Zbe(d),new Hbe(d),new Jbe(d),new Xbe(d),new Wbe(d),new zbe(d),new Ybe(d),new Qbe(d),new ewe(d),new pt(eE,d),new pt(Qv,d),new pt(hE,d),new pt(yE,d),new pt(mE,d),new pt(vE,d),new pt(EE,d),new pt(TE,d),new pt(IE,d),new pt(AE,d),new pt(bE,d),new pt(wE,d)];return u.forEach(i=>{i.initChildren(null),d.subscribeBuiltInInstance(i)}),d.operationDeclarations=u,u}class vK extends ua{constructor(i){super($i,i);g(this,"initialData");g(this,"id",Ue.PERSISTED_ENTITY);g(this,"version","1");g(this,"name",Ue.PERSISTED_ENTITY);g(this,"description",$i.description);g(this,"type",f.BuiltInBaseEntity);g(this,"abstract",$i.abstract);g(this,"static",$i.static);g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"errors",[]);g(this,"project");this.initialData=$i,this.project=i,this.id=$i.id,this.version=$i.version,this.name=$i.name,this.static=$i.static,this.abstract=$i.abstract,this.properties=this.initialData.properties.map(a=>{const o=te(a,this.project);return o.setParent(this,null),o.initChildren(null),o}),this.methods=this.initialData.methods.map(a=>{const o=te(a,this.project);return o.parent=this,o}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const o=te(a,this.project);return o.parent=this,o}),this.extends=this.initialData.extends.map(a=>te(a,this.project))}}var EK=(d=>(d.StatusCodeMustBeNumber="status-code-must-be-number",d.StatusCodeMustBeBetween100And599="status-code-must-be-between-100-and-599",d))(EK||{});function TK(d,u){const i=[];if(typeof u!="number"){const a=new ur({id:d.id+"--status-code-must-be-number",message:`Entity of type ${d.type} with id "${d.id}" has an invalid value "${u}". The value must be a number.`,severity:q.Error,code:"status-code-must-be-number",entity:d});return i.push(a),{errors:i,override:u}}if(u<100){const a=new ur({id:d.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${d.type} with id "${d.id}" has an invalid value "${u}". The value must be a number between 100 and 599.`,severity:q.Error,code:"status-code-must-be-between-100-and-599",entity:d});i.push(a)}if(u>599){const a=new ur({id:d.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${d.type} with id "${d.id}" has an invalid value "${u}". The value must be a number between 100 and 599.`,severity:q.Error,code:"status-code-must-be-between-100-and-599",entity:d});i.push(a)}return{errors:i,override:u}}class IK extends ua{constructor(i){super(ps,i);g(this,"initialData");g(this,"id",Ue.PERSISTED_ENTITY);g(this,"version","1");g(this,"name",Ue.PERSISTED_ENTITY);g(this,"description",ps.description);g(this,"type",f.BuiltInBaseEntity);g(this,"abstract",ps.abstract);g(this,"static",ps.static);g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"errors",[]);g(this,"project");this.initialData=ps,this.project=i,this.id=ps.id,this.version=ps.version,this.name=ps.name,this.static=ps.static,this.abstract=ps.abstract,this.properties=this.initialData.properties.map(e=>{const y=te(e,this.project);return y.setParent(this,null),y.initChildren(null),y}),this.methods=this.initialData.methods.map(e=>{const y=te(e,this.project);return y.parent=this,y}),this.abstractMethods=this.initialData.abstractMethods.map(e=>{const y=te(e,this.project);return y.parent=this,y}),this.extends=this.initialData.extends.map(e=>te(e,this.project));const a=this.properties.find(e=>e.id===Ee["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id);if(!a)throw new Error("Path property not found in endpoint entity");a._codeNativeValueValidation=(e,y)=>S5(e,y);const o=this.abstractMethods.find(e=>e.id===Ee["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id);if(!o)throw new Error("Handler method not found in endpoint entity");const p=o.outputs.find(e=>e.id===Ee["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.outputs.statusCode.id);if(!p)throw new Error("Status code output not found in handler method");p.codeNativeValueValidation=(e,y)=>TK(e,y)}}const rwe="test_primitive_entities_export";class iwe extends ua{constructor(i){super(wi,i);g(this,"initialData");g(this,"id",Ue.PERSISTED_ENTITY);g(this,"version","1");g(this,"name",Ue.PERSISTED_ENTITY);g(this,"description",wi.description);g(this,"type",f.BuiltInBaseEntity);g(this,"abstract",wi.abstract);g(this,"static",wi.static);g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"errors",[]);g(this,"project");this.initialData=wi,this.project=i,this.id=wi.id,this.version=wi.version,this.name=wi.name,this.static=wi.static,this.abstract=wi.abstract,this.properties=this.initialData.properties.map(o=>{const p=te(o,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.methods=this.initialData.methods.map(o=>{const p=te(o,this.project);return p.parent=this,p}),this.abstractMethods=this.initialData.abstractMethods.map(o=>{const p=te(o,this.project);return p.parent=this,p}),this.extends=this.initialData.extends.map(o=>te(o,this.project));const a=this.properties.find(o=>o.id===Ee["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id);if(!a)throw new Error("Path property not found in endpoint entity");a._codeNativeValueValidation=(o,p)=>K5(o,p)}}function swe(d){const u=[new vK(d),new IK(d),new iwe(d),new ua(Bh,d)];return u.forEach(i=>{d.subscribeBuiltInInstance(i)}),d.builtInBaseEntities=u,u}function nwe(d){const u=[new ns(Ye,d),new ns(Da,d),new ns(lt,d),new ns(Hv,d),new ns(bi,d),new ns(Oa,d),new ns(Sn,d),new ns(Ca,d),new ns(nd,d)];return u.forEach(i=>{d.subscribeBuiltInInstance(i)}),d.primitives=u,u}function awe(d){const u=[new pt(Gh,d)];return u.forEach(i=>{i.initChildren(null),d.subscribeBuiltInInstance(i)}),d.globalEventActionDescriptors=u,u}function owe(d){const u=[new pt(oc,d),new pt(Qa,d),new pt(nc,d),new pt(ld,d),new pt(dd,d),new pt(Dh,d)];u.forEach(a=>{a.initChildren(null),d.subscribeBuiltInInstance(a)}),d.loopDeclarations=u;const i=[new pt(Ph,d),new pt(ac,d),new pt(Ch,d),new pt(OE,d),new pt($E,d),new pt(Oh,d)];return i.forEach(a=>{a.initChildren(null),d.subscribeBuiltInInstance(a)}),d.loopDeclarationsBodies=i,u}function lwe(d){const u=[new Rn(Fh,d),new Rn(zE,d)];return u.forEach(i=>{i.initChildren(null),d.subscribeBuiltInInstance(i)}),d.valueDescriptors=u,u}function dwe(d){const u=[new pt(s2,d),new pt(i2,d),new pt(sl,d),new pt(JE,d),new pt(A2,d),new pt(b2,d),new pt(T2,d),new pt(I2,d),new pt(hd,d),new pt(E2,d)];return u.forEach(i=>{i.initChildren(null),d.subscribeBuiltInInstance(i)}),d.conditionDeclarations=u,u}const Pl={},Qm={},vf={empty:!1,enrich:!0,mock:!1,ignoreCache:!1,onFetch:async()=>null,manuallyInit:!1};function AK(d,u={enrich:!0,shallowErrors:!1},i){const a={enrich:!0,shallowErrors:!1,...u},{enrich:o,shallowErrors:p}=a,e=d.project,y=d.record,v=new oa(e),E=new Set;y[e.id]=e,E.add(e.id);const b=L().toISOString();Object.values(y).forEach(V=>{!V||v.allBuiltInEntityIds.includes(V.id)||E.add(V.id)}),v.order=Array.from(E),v.flatRecord=y,v.orderEntities();const A=e0(d.project,i);A.instances[e.id]=A;const $=o?A.addChangeSet(new G(A,N.sessionAuthor,b,A,!0,"project-init-from-fetch-result")):null;return v.visit(V=>{if(V.id===A.id)return;const B=te(V,A);try{B.hydrateAncestors(),B.addSelfToProject(null);const F=su(V);Object.keys(F.downstream).forEach(K=>{const Z=A.get(K);Z&&Z.hydrateAncestors()})}catch(F){if(p)Me.error("Error hydrating ancestors: ",F);else throw F}}),o?(v.visit(V=>{if(V.id===A.id)return;const B=A.get(V.id);B&&B.afterAllChildrenInitialized($)}),A.afterAllChildrenInitialized($)):t0(A,b).forEach(B=>{B.remove({ignoreUpstream:!0},null)}),A.instancesList.forEach(V=>{V.previousVersion=null}),$==null||$.attemptAutoclose("project-init-from-fetch-result",A.id),A}async function uwe(d,u=vf){const i={...vf,...u};if(i.empty)return{data:{project:{id:d.id,type:f.Project,version:N.UUID.uuid(),createdAt:L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]},record:{}}};if(i.mock){const o={...dI};return o.id=d.id,{data:{project:o,record:{}}}}return Me.log("Fetching project from external API"),new Promise(async o=>{try{if(i.onFetch){const p=await i.onFetch(d.id);if(p){o({data:p});return}}else o({data:null})}catch(p){Me.error("Error fetching project: ",p),o({data:null})}})}function e0(d,u){const i=new N(d,u);return nwe(i),swe(i),twe(i),awe(i),owe(i),lwe(i),dwe(i),Array.from(new Set([...i.getAllBuiltInIds(),...rn()])).forEach(o=>{if(!i.builtInInstances[o]&&i.instances[o])i.builtInInstances[o]=i.instances[o],delete i.instances[o];else if(!i.builtInInstances[o])throw new Error(`Built in entity was not properly initialized: ${o}`)}),i.instances[i.id]=i,i}function t0(d,u){return d.instancesList.filter(a=>L(a.createdAt).isAfter(L(u)||!!a.previousVersion))}function cwe(d,{enrich:u}={enrich:!0},i){const a=new Map,o=new Map,p=Array.from(new Set([...d.getAllBuiltInIds(),...rn()]));Object.keys(d.instances).forEach(A=>{if(p.includes(A)){a.set(A,A),o.set(A,A);return}const $=d.get(A);if(!Jm($,{...d.instances,...d.builtInInstances}).every(K=>!p.includes(K))){a.set(A,A),o.set(A,A);return}const F=N.UUID.uuid();a.set(A,F),o.set(F,A)});const e=L().toISOString(),y=d.toShallowJSON({seenEntityMaps:a});y.previousVersion=null,y.createdAt=e,y.version=N.UUID.uuid();const v=e0(y,i);v.instances[v.id]=v;const E=u?v.addChangeSet(new G(v,N.sessionAuthor,e,v,!0,"project-clone")):null,b=new oa(d);return b.visit(A=>{const $=A.toShallowJSON({seenEntityMaps:a});$.previousVersion=null,$.createdAt=e,$.version=N.UUID.uuid();const V=su($,nS(b.flatRecord,a));if(Object.keys(V.upstream).length){let F=!1;if(Object.keys(V.upstream).forEach(K=>{if(!F&&(!v.get(K)||v.getDeleted(K))){F=!0;return}}),F)return}const B=te($,v);B.hydrateAncestors(),B.addSelfToProject(E),E==null||E.add(B,S.Added)}),u?(b.visit(A=>{if(A.id===v.id)return;const $=v.get(a.get(A.id));$&&$.afterAllChildrenInitialized(E)}),v.afterAllChildrenInitialized(E)):t0(v,e).forEach($=>{$.remove({ignoreUpstream:!0},null)}),v.instancesList.forEach(A=>{A.previousVersion=null}),E==null||E.attemptAutoclose("project-clone",v.id),v}function bK(d,{enrich:u}={enrich:!0},i){const a=e0(d,i),o=L().toISOString(),p=u?a.addChangeSet(new G(a,N.sessionAuthor,o,a,!0,"project-init")):null;p&&(p.type=fA.Automatic);const e=new oa(d);return e.visit(y=>{const v=te(y,a);v.hydrateAncestors(),v.addSelfToProject(p)}),u?(e.visit(y=>{if(y.id===a.id)return;const v=a.get(y.id);v&&v.afterAllChildrenInitialized(p)}),a.afterAllChildrenInitialized(p)):(t0(a,o).forEach(E=>{E.remove({ignoreUpstream:!0},null)}),new oa(a).visit(E=>{E.initialized=!0,E.captureVersion()})),a.initialized=!0,p==null||p.attemptAutoclose("project-init",a.id),a}async function pwe(d,u=vf,i){const a={...vf,...u};if(d.id&&Pl[d.id]&&!a.ignoreCache)return Pl[d.id];if(d.id&&Qm[d.id]&&!a.ignoreCache)return await Qm[d.id],Pl[d.id];const o=uwe(d,a);d.id&&(Qm[d.id]=o);const p=await o;if(p.data){let e;return a.mock?e=bK(dI,{enrich:!!a.enrich},i):p.data instanceof N?e=p.data:e=AK(p.data,{enrich:!!a.enrich},i),Pl[d.id]=e,d.id&&delete Qm[d.id],e}return null}function fwe(d){return Pl[d.id]&&delete Pl[d.id],null}D.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=Bb,D.ALL_BUILT_IN_BASE_ENTITIES=r2,D.ALL_BUILT_IN_CONDITION_ENTITIES=_2,D.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=D2,D.ALL_BUILT_IN_LOOP_BODY_ENTITIES=DV,D.ALL_BUILT_IN_LOOP_ENTITIES=gV,D.ALL_BUILT_IN_OPERATION_ENTITIES=xP,D.ALL_BUILT_IN_PRIMITIVE_ENTITIES=Kg,D.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=V2,D.ALL_BUILT_IN_VALUE_DESCRIPTORS=N2,D.ALL_CONNECTION_DISABLED_REASONS=sAe,D.ALL_OTHER_DISABLED_REASONS=aAe,D.ALL_TESTING_DISABLED_REASONS=nAe,D.ActionDescriptorState=pt,D.ActionInputMapState=XEe,D.ActionOutputMapState=tTe,D.AppendToListOperationInputIds=zD,D.AppendToListOperationOutputIds=XD,D.Area=gi,D.ArgumentDeclarationDependencyField=zx,D.ArgumentDeclarationState=ea,D.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=Nb,D.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PREFIX=dt,D.BUILT_IN_BASE_ENTITY_IDS=Ee,D.BUILT_IN_ENTITY_TYPES=Yi,D.BUILT_IN_FUNCTION_IMPLEMENTATIONS__PREFIX=Xd,D.BaseCanvasDraggableState=jbe,D.BaseEntityNames=Ue,D.BaseRegisteredExtension=st,D.BaseState=xbe,D.BaseValueDescriptorIds=sd,D.BreakStatementDependencyField=JG,D.BreakStatementState=Io,D.BuiltInBaseEntityState=ua,D.BuiltInFunctionIds=Qr,D.BuiltInFunctionImplementationAbortExecutionModule=fF,D.BuiltInFunctionImplementationCreatePersistedEntityModule=yF,D.BuiltInFunctionImplementationDeletePersistedEntityModule=hF,D.BuiltInFunctionImplementationUpdatePersistedEntityModule=mF,D.CACHED_PROJECTS_BY_ID=Pl,D.CALLABLE_ENTITIES_EXPLANATION=IAe,D.CALLABLE_TYPES=Ai,D.CALLER_ENTITIES_EXPLANATION=g5,D.CALLER_TYPES=Oi,D.CALLS_UPDATE_EXPLANATION=Ro,D.CANVAS_BASE_X=h5,D.CANVAS_BASE_Y=y5,D.CANVAS_CARD_HEADER_CENTER_HEIGHT=ru,D.CANVAS_CARD_WIDTH=c5,D.CANVAS_COMPLEX_CARD_HEIGHT=XIe,D.CANVAS_HORIZONTAL_BUFFER_BETWEEN_CARDS=Ib,D.CANVAS_SIMPLE_CARD_HEIGHT=Eb,D.CANVAS_SIZE=vb,D.CANVAS_VERTICAL_BUFFER_BETWEEN_CARDS=Rm,D.CARD_FOOTER_HEIGHT=wm,D.CARD_PROPERTIES_SECTION_PADDING=Sa,D.CARD_PROPERTIES_SECTION_SINGLE_PADDING=Tb,D.CHILDREN_TYPES=JZ,D.COMPARISON_CONDITIONS=w2,D.CONDITIONS=R2,D.CUSTOM_ENTITY_OPERATIONS=vC,D.CallableEntityClass=Fbe,D.CallerEntityClass=fw,D.CanvasEntityConnectionDisabledReason=Ab,D.CanvasEntityOtherDisabledReason=wb,D.CanvasEntityTestingDisabledReason=bb,D.ChangeSet=G,D.ChangeSetChangeCaptureType=fA,D.ChangeSetEntityChangeType=S,D.ChildEntityBaseClass=Gbe,D.CommonStringValidationErrorCodes=F5,D.ComparisonOperatorTypes=nt,D.ConditionDependencyField=fj,D.ConditionState=ho,D.ContinueStatementDependencyField=lj,D.ContinueStatementState=Mi,D.CreateNewInputIds=qO,D.CreateNewOutputIds=ZO,D.DEFAULT_BASE_EXTENSIONS_CONTEXT=pb,D.DEFAULT_EXECUTION_INSTANCE_PARENT_CONTEXT=d5,D.DEFAULT_MODULE_IDS=tt,D.DEFAULT_PROJECT_INSTANCE_PARENT_CONTEXT=fK,D.DEFAULT_PROJECT_STATIC_PARENT_CONTEXT=hw,D.DEFAULT_UUID_MODULE=ec,D.DRAGGABLE_CALLABLE_TYPES=qv,D.DRAGGABLE_CALLER_TYPES=Lg,D.DRAGGABLE_ELEMENT_TYPES=ch,D.DRAGGABLE_EXECUTABLE_TYPES=ZZ,D.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=uh,D.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=kv,D.DataTypeCompatibilityTypes=Qs,D.DataTypeDependencyField=vA,D.DataTypeParentChildRelation=Ii,D.DataTypeState=vs,D.DefaultEditorContext=cb,D.DefaultProjectLogicContext=JA,D.DefinitionEntityDependencyField=Xm,D.DefinitionEntityState=da,D.DynamicValueTypes=be,D.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=Bbe,D.ENTITIES_WITH_VALLUES_EXPLANATION=Om,D.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=ve,D.ENTITY_RECUSION_OPTIONS_DEFAULTS=ke,D.ENTITY_TYPES=HZ,D.ENTITY_WITH_CODE_NAMES_TYPES=Bg,D.ENTITY_WITH_DECLARATION_TYPES=qZ,D.ENTITY_WITH_LOGIC_SCOPE_TYPES=Br,D.ENTITY_WITH_NAMES_TYPES=Mg,D.ENTITY_WITH_PARENT_TYPES=KZ,D.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=Ng,D.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=kZ,D.ENTITY_WITH_VALUE_TYPES=Kv,D.ENTRY_POINT_ENTITIES_EXPLANATION=rf,D.ENTRY_POINT_TYPES=Nt,D.ERROR_PROPERTY_HEIGHT=bm,D.EVENT_TYPES=Zo,D.EXECUTABLE_TYPES=Zv,D.EXECUTION_OPERATIONS=kO,D.EfimeralValueStore=Sp,D.EndpointEntity=IK,D.EntityError=ur,D.EntityErrorSeverity=q,D.EntityGenerationError=ee,D.EntityGenerationErrorCode=k,D.EntityInstanceErrorCode=le,D.EntityOperations=fr,D.EntityType=f,D.EntityWithLogicScopeClass=qbe,D.EntityWithValueClass=kbe,D.EntryPointEntityClass=Sbe,D.Execution=tn,D.ExecutionOperations=ir,D.ExecutionState=fb,D.ExecutionTerminationType=se,D.ExplicitInfrastructureResource=Db,D.ExtensionContextBase=HA,D.ExtensionContextType=we,D.ExtensionPermissions=et,D.ExtensionsRegistry=l5,D.ExtentionPriority=Xe,D.FunctionCallDependencyField=U5,D.FunctionCallState=Do,D.FunctionDeclarationDependencyField=ej,D.FunctionDeclarationState=uo,D.GET_PROJECT_OPTIONS_DEFAULTS=vf,D.GLOBAL_EVENT_DECLARATIONS=g2,D.GetLastInListOperationInputIds=jD,D.GetLastInListOperationOutputIds=GD,D.GlobalEventNames=ga,D.GlobalEventState=fo,D.GroupOperatorTypes=Mr,D.HTTPOperations=Ti,D.HTTPStatucCodeValidationErrorCodes=EK,D.HTTP_OPERATIONS=zC,D.ImplicitGlobalInfrastructureResource=Ob,D.InfrastructureResource=gb,D.InfrastructureResourceStatus=b5,D.InputMapDependencyField=SG,D.InputMapState=ia,D.InstalledProjectState=Eo,D.InternalCallDependencyField=GG,D.InternalCallState=To,D.JoinListOperationInputIds=nD,D.JoinListOperationOutputIds=aD,D.LIST_OPERATIONS=cO,D.ListOperations=He,D.LiteralValueDependencyField=ZG,D.LiteralValueState=Zi,D.Logger=Me,D.LoopDependencyField=cj,D.LoopState=ki,D.LoopTypes=ze,D.MAIN_VALUE_PROPERTY_HEADER_HEIGHT=Am,D.MAIN_VALUE_SUB_PROPERTY_HEIGHT=QIe,D.NESTED_PROPERTY_HEIGHT=p5,D.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=_o,D.NUMBER_OPERATIONS=T1,D.NumberOperations=Jt,D.OPERATION_DECLARATIONS=UP,D.OperationDependencyField=ij,D.OperationState=co,D.OperationsImplementationsEntityCreateNewInstanceModule=n5,D.OperationsImplementationsEntityValidateModule=a5,D.OperationsImplementationsExecutionParallelModule=r5,D.OperationsImplementationsExecutionSequentialModule=i5,D.OperationsImplementationsExecutionWaitModule=s5,D.OperationsImplementationsHttpRequestModule=o5,D.OperationsImplementationsListAddIndexModule=H6,D.OperationsImplementationsListAppendModule=e5,D.OperationsImplementationsListDeleteFirstModule=Z6,D.OperationsImplementationsListDeleteLastModule=q6,D.OperationsImplementationsListGetFirstModule=X6,D.OperationsImplementationsListGetIndexItemModule=z6,D.OperationsImplementationsListGetLastModule=Q6,D.OperationsImplementationsListJoinModule=S6,D.OperationsImplementationsListPrependModule=t5,D.OperationsImplementationsListReplaceFirstModule=W6,D.OperationsImplementationsListReplaceIndexModule=J6,D.OperationsImplementationsListReplaceLastModule=Y6,D.OperationsImplementationsListReverseModule=k6,D.OperationsImplementationsListSplitModule=K6,D.OperationsImplementationsNumberAdditionModule=a6,D.OperationsImplementationsNumberDivisionModule=d6,D.OperationsImplementationsNumberExponentiationModule=c6,D.OperationsImplementationsNumberMultiplicationModule=l6,D.OperationsImplementationsNumberRemainderModule=u6,D.OperationsImplementationsNumberSubstractionModule=o6,D.OperationsImplementationsRandomGenerateHexadecimalTokenModule=A6,D.OperationsImplementationsRandomGenerateIdentifierModule=E6,D.OperationsImplementationsRandomGenerateShortIdentifierModule=I6,D.OperationsImplementationsRandomGenerateUUIDv4Module=T6,D.OperationsImplementationsRandomnessGenerateRandomAlphaNumericModule=v6,D.OperationsImplementationsRandomnessGenerateRandomBase62Module=y6,D.OperationsImplementationsRandomnessGenerateRandomBase64Module=m6,D.OperationsImplementationsRandomnessGenerateRandomFloatModule=f6,D.OperationsImplementationsRandomnessGenerateRandomHexadecimalModule=h6,D.OperationsImplementationsRandomnessGenerateRandomIntegerModule=p6,D.OperationsImplementationsStringAddIndexModule=$6,D.OperationsImplementationsStringAppendModule=G6,D.OperationsImplementationsStringDeleteFirstModule=_6,D.OperationsImplementationsStringDeleteIndexModule=C6,D.OperationsImplementationsStringDeleteLastModule=R6,D.OperationsImplementationsStringGetFirstModule=U6,D.OperationsImplementationsStringGetIndexItemModule=B6,D.OperationsImplementationsStringGetIndexOfModule=j6,D.OperationsImplementationsStringGetLastModule=x6,D.OperationsImplementationsStringJoinModule=b6,D.OperationsImplementationsStringPrependModule=F6,D.OperationsImplementationsStringReplaceAllMatchesModule=M6,D.OperationsImplementationsStringReplaceFirstModule=P6,D.OperationsImplementationsStringReplaceIndexModule=V6,D.OperationsImplementationsStringReplaceLastModule=N6,D.OperationsImplementationsStringReplaceSingleMatchModule=L6,D.OperationsImplementationsStringReverseModule=g6,D.OperationsImplementationsStringSplitModule=w6,D.OperationsImplementationsStringToLowerCaseModule=D6,D.OperationsImplementationsStringToUpperCaseModule=O6,D.OutputMapDependencyField=kG,D.OutputMapParentChildRelation=id,D.OutputMapState=wn,D.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=Cm,D.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=wo,D.PASS_THROUGH_CALLABLE_TYPES=hr,D.PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=Vg,D.PLACEHOLDER_VALUE_STORE_CLIENT=zG,D.PROPERTY_HEIGHT=Im,D.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=Mb,D.PUBLISHING_DISABLED_REASONS=w5,D.ParallelExecutionOperation=hK,D.PassThroughCallableEntityClass=Kbe,D.PersistedEntity=vK,D.PrimitiveEntityState=ns,D.PrimitiveTypes=Q,D.ProjectState=N,D.ProjectStateEvents=Vr,D.PropertyDependencyField=aK,D.PropertyState=la,D.PublicationRun=cAe,D.PublicationStep=A5,D.RANDOMNESS_OPERATIONS=BP,D.READABLE_ENTITY_TYPES=hb,D.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=pK,D.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=AAe,D.RandomnessOperations=De,D.ReturnDeclarationDependencyField=nj,D.ReturnDeclarationState=ss,D.ReturnStatementDependencyField=EA,D.ReturnStatementState=po,D.SQLAST=SEe,D.STANDALONE_CONDITIONS=d2,D.STATIC_PROPERTY_HEIGHT=f5,D.STRING_OPERATIONS=sD,D.ScopeCompatibilityType=Zm,D.SearchDependencyField=CG,D.SearchNodeImplementationModule=vF,D.SearchState=vo,D.SequentialExecutionOperation=mK,D.SequentialExecutionOperationInputIds=PO,D.SequentialExecutionOperationOutputIds=NO,D.SharedEntityErrorCode=ae,D.SharedStateFunctionality=cK,D.SplitListOperationInputIds=AD,D.SplitListOperationOutputIds=bD,D.StandaloneOperatorTypes=Xr,D.StringOperations=Se,D.TERMINATION_TYPES=Ir,D.Traverser=oa,D.USER_MANAGED_ENTITY_TYPES=Ug,D.UUIDModule=EF,D.UserManagedEntityStateTemplate=Ube,D.VALUE_READING_ENTITIES_EXPLANATION=Lb,D.VALUE_READING_TYPES=vn,D.VALUE_WRITING_ENTITIES_EXPLANATION=D5,D.VALUE_WRITING_TYPES=Fr,D.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=Vb,D.VARIABLE_TYPES=Tt,D.ValueAutogenerationType=Zr,D.ValueDescriptorDependencyField=YG,D.ValueDescriptorParentChildRelation=oe,D.ValueDescriptorState=Rn,D.ValueReadingEntityClass=yf,D.ValueWritingEntityClass=mf,D.VariableDeclarationDependencyField=vj,D.VariableDeclarationState=mo,D.VariableInputMapState=zEe,D.VariableInstanceDependencyField=IA,D.VariableInstanceState=yo,D.VariableOutputMapState=eTe,D.WaitOperation=yK,D.actionDescriptorValidation=z0e,D.addDisabledReasons=lAe,D.afterLiteralValueAsTypeChangeSideEffects=cF,D.afterLiteralValueAsTypeDeleteSideEffects=uF,D.afterLiteralValueChangeSideEffects=lF,D.afterLiteralValueDeleteSideEffects=oF,D.aggregateVariableInputsNextValues=kp,D.aggregateVariableInputsValues=em,D.appendToListOperation=yh,D.appendToListOperationElementToAppendArgument=aE,D.appendToListOperationElementToAppendArgumentParentRef=aO,D.appendToListOperationElementToAppendArgumentRef=tO,D.appendToListOperationError=uO,D.appendToListOperationErrorParentRef=dO,D.appendToListOperationListArgument=nE,D.appendToListOperationListArgumentParentRef=nO,D.appendToListOperationListArgumentRef=QD,D.appendToListOperationListDataType=eO,D.appendToListOperationResultListDataType=sO,D.appendToListOperationResultListReturn=lO,D.appendToListOperationResultListReturnParentRef=oO,D.appendToListOperationResultListReturnRef=iO,D.appendToListOperationSecondListDataType=rO,D.applyNewScope=We,D.argumentDeclarationValidation=B0e,D.asGenerationActionExample=aa,D.assembleAndAddLiteralValueFromDataType=_n,D.assembleStandaloneLiteralValueFromDataType=ct,D.booleanPrototype=Da,D.breakStatementValidation=sTe,D.calculateCardSize=v5,D.calculateMethodCardSize=m5,D.calculateNewParentBasedOnCallers=nf,D.capitalizeFirstLetter=Ri,D.changeSetJSONRecordToUniqueIds=U0e,D.checkAreDataTypesCompatible=en,D.checkAreDefinitionEntitiesCompatibleAsDataType=LG,D.checkArePropertiesCompatibleAsDataType=VG,D.checkExtendsBaseEntity=Hm,D.checkHasBaseEntity=As,D.checkHasMetadataChanged=xr,D.checkImplementationsOverlap=ka,D.checkImplementsBaseEntity=sbe,D.checkIsBranchDependentButNotDirectlyOnBranch=$l,D.checkIsBranchDependentOnBranch=Jb,D.checkIsBuiltIn=iw,D.checkIsCallableEntityReachable=ff,D.checkIsCallerBranchDependentOnBranch=xAe,D.checkIsCanvasEntity=rbe,D.checkIsDefEntityInlineDeclaredForSearchOutputType=UA,D.checkIsDetachedBranch=FS,D.checkIsDetachedBranchShallow=tw,D.checkIsEmptyValue=Qy,D.checkIsGlobalVariable=ebe,D.checkIsGloballyDeclared=ew,D.checkIsLiteralValueEmpty=Kp,D.checkIsMethod=rw,D.checkIsNestedScope=qm,D.checkIsRequiredValue=sa,D.checkScopeCompatibility=sn,D.checkShouldInputOrOutputBePartOfFinalVariableObjectValue=hf,D.checkShouldPropertyBePartOfFinalVariableObjectValue=sw,D.cloneProject=cwe,D.conditionValidation=X0e,D.continueStatementValidation=H0e,D.convertToAbstract=VAe,D.convertToNonAbstract=LAe,D.convertToNonStatic=BAe,D.convertToStatic=MAe,D.countedLoopActionDescriptor=oc,D.countedLoopActionDescriptorDynamicReturnDeclaration=EV,D.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=vV,D.countedLoopActionDescriptorStringArgumentDeclaration=mV,D.countedLoopActionDescriptorStringArgumentDeclarationDataType=hV,D.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=pV,D.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=cV,D.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=fV,D.countedLoopActionDescriptorStringArgumentDeclarationParentRef=yV,D.countedLoopBodyActionDescriptor=Ph,D.countedLoopBodyActionDescriptorAnyDynamicArgument=wV,D.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=bV,D.countedLoopBodyActionDescriptorAnyDynamicReturn=_V,D.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=RV,D.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=NE,D.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=IV,D.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=TV,D.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=AV,D.createDefinitionEntityFromJSONObject=Lm,D.createEntityError=mt,D.createNestedDataTypeForEntity=G5,D.createNewInstanceOperation=Jo,D.createNewInstanceOperationEntityToInstanciateArgument=eC,D.createNewInstanceOperationEntityToInstanciateArgumentRef=zO,D.createNewInstanceOperationEntityToInstanciateDataType=XO,D.createNewInstanceOperationError=sC,D.createNewInstanceOperationErrorParentRef=iC,D.createNewInstanceOperationNewEntityDataArgument=YO,D.createNewInstanceOperationNewEntityDataArgumentDataType=WO,D.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=JO,D.createNewInstanceOperationNewEntityDataArgumentParentRef=HO,D.createNewInstanceOperationOutputEntityDeclaration=rC,D.createNewInstanceOperationOutputEntityDeclarationParentRef=tC,D.createNewInstanceOperationRef=QO,D.createPersistedEntityMethod=LL,D.createPersistedEntityMethodParentRef=VL,D.createSemanticId=tK,D.createStateFromGenerationTargetType=Mbe,D.createStateFromType=dr,D.createStateFromTypeAndSubscribe=te,D.cronJobBuiltInBaseEntity=Bh,D.cronJobBuiltInBaseEntityExpressionProperty=e2,D.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=tH,D.cronJobBuiltInBaseEntityExpressionPropertyRef=XL,D.cronJobBuiltInBaseEntityRef=QL,D.cronJobTriggeredFunctionDeclarationBlueprint=ZE,D.cronJobTriggeredFunctionDeclarationBlueprintParentRef=YL,D.dataTypeCompatibilityToErrorExplanation=M5,D.dataTypeValidation=F0e,D.datePrototype=Sn,D.dateValueAutogenerationSchema=FI,D.definitionEntityToZodSchema=ET,D.definitionEntityValidation=Pbe,D.deletePersistedEntityMethod=qE,D.deletePersistedEntityMethodParentRef=NL,D.deleteRootProject=fwe,D.emitSideEffects=Yx,D.emptyCondition=JE,D.emptyConditionArgument=l2,D.emptyConditionRef=o2,D.endpointBuiltInBaseEntity=ps,D.endpointBuiltInBaseEntityRef=PV,D.endpointBuiltInBaseEntityRefFour=fL,D.endpointBuiltInBaseEntityRefThree=GV,D.endpointBuiltInBaseEntityRefTwo=BV,D.endpointBuiltInCorsProperty=NV,D.endpointBuiltInCorsPropertyDataType=$V,D.endpointBuiltInCorsPropertyDataTypeRef=OV,D.endpointBuiltInCorsPropertyRef=CV,D.endpointBuiltInMethodProperty=LE,D.endpointBuiltInMethodPropertyDataType=jV,D.endpointBuiltInMethodPropertyDataTypeRef=UV,D.endpointBuiltInMethodPropertyRef=xV,D.endpointBuiltInPathProperty=VE,D.endpointBuiltInPathPropertyDataType=MV,D.endpointBuiltInPathPropertyDataTypeRef=VV,D.endpointBuiltInPathPropertyRef=LV,D.endpointPathParamsArgumentDeclaration=BE,D.endpointPathParamsArgumentDeclarationRef=YV,D.endpointPathParamsVariableDataType=zV,D.endpointPathParamsVariableDataTypeRef=WV,D.endpointReachedTriggerActionDescriptor=SE,D.endpointReachedTriggerActionDescriptorRef=XV,D.endpointReachedTriggerActionDescriptorRefFour=tL,D.endpointReachedTriggerActionDescriptorRefThree=eL,D.endpointReachedTriggerActionDescriptorRefTwo=QV,D.endpointRequestBodyArgumentDeclaration=xE,D.endpointRequestBodyArgumentDeclarationRef=kV,D.endpointRequestBodyVariableDataType=qV,D.endpointRequestHeadersArgumentDeclaration=ME,D.endpointRequestHeadersArgumentDeclarationRef=SV,D.endpointRequestHeadersVariableDataType=KV,D.endpointRequestHeadersVariableDataTypeRef=FV,D.endpointRequestQueryParamsArgumentDeclaration=UE,D.endpointRequestQueryParamsArgumentDeclarationRef=HV,D.endpointRequestQueryParamsVariableDataType=JV,D.endpointRequestQueryParamsVariableDataTypeRef=ZV,D.endpointResponseBodyDataType=cL,D.endpointResponseBodyReturnDeclaration=FE,D.endpointResponseBodyReturnDeclarationRef=uL,D.endpointResponseCodeDataType=iL,D.endpointResponseCodeReturnDeclaration=jE,D.endpointResponseCodeReturnDeclarationDefaultValueParentRef=nL,D.endpointResponseCodeReturnDeclarationRef=rL,D.endpointResponseHeadersDataType=lL,D.endpointResponseHeadersDataTypeRef=aL,D.endpointResponseHeadersReturnDeclaration=GE,D.endpointResponseHeadersReturnDeclarationRef=oL,D.endpointReturnStatementRef=sL,D.endpointReturnStatementRefThree=pL,D.endpointReturnStatementRefTwo=dL,D.enerateRandomIntegerOperationError=c$,D.enerateRandomIntegerOperationErrorParentRef=u$,D.enrichFromKnownEntities=of,D.enumOptionsProperty=Sg,D.enumOptionsPropertyDataType=Gg,D.enumOptionsPropertyDataTypeRef=xg,D.enumOptionsPropertyRef=jg,D.enumPrototype=Oa,D.enumPrototypeRef=Fg,D.errorCodeToMessage=ef,D.executionBuiltInBaseEntity=Uh,D.executionBuiltInEntityAbortMethod=HE,D.executionBuiltInEntityAbortMethodParentRef=t2,D.filterOutDuplicateEntities=R,D.filterOutDuplicateErrors=uI,D.findEntityFromKeys=Gb,D.findNextIndividualCommonCallerAncestorFromGiven=kb,D.findReferenceToSelfInList=sS,D.findReferencesToSelfInProject=HAe,D.flattenActionDescriptor=aS,D.flattenArgumentDeclaration=oS,D.flattenBreakStatement=lS,D.flattenBuiltInBaseEntity=dS,D.flattenCallerAncestorsUntil=Cl,D.flattenCalls=Ui,D.flattenCanvasAncestorsUntil=iu,D.flattenCondition=uS,D.flattenContinueStatement=cS,D.flattenDataType=fS,D.flattenDefinitionEntity=pS,D.flattenDefinitionEntityExtensionAndImplementationTypes=ou,D.flattenDefinitionEntityExtensionTypes=df,D.flattenDefinitionEntityExtensions=zb,D.flattenDefinitionEntityImplementations=Xb,D.flattenDefinitionEntityImplementionTypes=lf,D.flattenDerivedCanvasEntities=Is,D.flattenDetachedBranch=KS,D.flattenElementCalls=_t,D.flattenElementCallsOnTheSameScope=ZAe,D.flattenElementCallsWithCallType=Mm,D.flattenEntity=me,D.flattenFunctionCall=hS,D.flattenFunctionDeclaration=yS,D.flattenGlobalEvent=mS,D.flattenInputMap=vS,D.flattenInstalledProject=ES,D.flattenInternalCall=TS,D.flattenLiteralValue=IS,D.flattenLoop=AS,D.flattenOperation=bS,D.flattenOutputMap=wS,D.flattenPrimitiveEntity=RS,D.flattenProject=_S,D.flattenProjectElements=iS,D.flattenProperty=gS,D.flattenRelatedCallableElementsOnTheRight=jS,D.flattenRelatedCanvasElementsOnTheLeft=GS,D.flattenRelatedCanvasElementsOnTheRight=Km,D.flattenReturnDeclaration=DS,D.flattenReturnStatement=OS,D.flattenSearch=CS,D.flattenValueDescriptor=$S,D.flattenVariableDeclaration=PS,D.flattenVariableInstance=NS,D.flattenVariableReads=rS,D.flattenVariableWrites=tS,D.flattenVariables=vr,D.flattenWrites=Hb,D.fromChangeSetToRecordChangeSet=ube,D.fromLiteralValueTypeToPrimitiveType=MA,D.fromPublishingDisabledCodeToReadable=hAe,D.fromZodParseToEntityGenerationErrors=Cb,D.functionCallValidation=$Ae,D.functionDeclarationValidation=G0e,D.generate=Hh,D.generateActionExample=bAe,D.generateExecutionDataType=JEe,D.generateHexadecimalTokenOperation=wE,D.generateHexadecimalTokenOperationError=MP,D.generateHexadecimalTokenOperationErrorParentRef=LP,D.generateHexadecimalTokenOperationResultStringDataType=PP,D.generateHexadecimalTokenOperationResultStringDataTypeParentRef=$P,D.generateHexadecimalTokenOperationResultStringOutput=VP,D.generateHexadecimalTokenOperationResultStringOutputParentRef=NP,D.generateIdFromStrategy=Kr,D.generateIdentifierOperation=IE,D.generateIdentifierOperationAlphabetInput=cP,D.generateIdentifierOperationAlphabetInputParentRef=lP,D.generateIdentifierOperationAlphabetInputType=uP,D.generateIdentifierOperationAlphabetInputTypeParentRef=dP,D.generateIdentifierOperationError=vP,D.generateIdentifierOperationErrorParentRef=mP,D.generateIdentifierOperationLengthInput=oP,D.generateIdentifierOperationLengthInputParentRef=sP,D.generateIdentifierOperationLengthInputType=aP,D.generateIdentifierOperationLengthInputTypeParentRef=nP,D.generateIdentifierOperationResultStringDataType=hP,D.generateIdentifierOperationResultStringDataTypeParentRef=fP,D.generateIdentifierOperationResultStringOutput=yP,D.generateIdentifierOperationResultStringOutputParentRef=pP,D.generateMutablePropertiesExplanation=_m,D.generatePlaceholderValueStore=aTe,D.generateRandomAlphanumericOperation=TE,D.generateRandomAlphanumericOperationError=iP,D.generateRandomAlphanumericOperationErrorParentRef=rP,D.generateRandomAlphanumericOperationLengthInput=z$,D.generateRandomAlphanumericOperationLengthInputParentRef=J$,D.generateRandomAlphanumericOperationLengthInputType=Y$,D.generateRandomAlphanumericOperationLengthInputTypeParentRef=W$,D.generateRandomAlphanumericOperationResultStringDataType=Q$,D.generateRandomAlphanumericOperationResultStringDataTypeParentRef=X$,D.generateRandomAlphanumericOperationResultStringOutput=tP,D.generateRandomAlphanumericOperationResultStringOutputParentRef=eP,D.generateRandomBase62Operation=vE,D.generateRandomBase62OperationError=U$,D.generateRandomBase62OperationErrorParentRef=B$,D.generateRandomBase62OperationLengthInput=P$,D.generateRandomBase62OperationLengthInputParentRef=O$,D.generateRandomBase62OperationLengthInputType=$$,D.generateRandomBase62OperationLengthInputTypeParentRef=C$,D.generateRandomBase62OperationResultStringDataType=V$,D.generateRandomBase62OperationResultStringDataTypeParentRef=N$,D.generateRandomBase62OperationResultStringOutput=M$,D.generateRandomBase62OperationResultStringOutputParentRef=L$,D.generateRandomBase64Operation=EE,D.generateRandomBase64OperationError=H$,D.generateRandomBase64OperationErrorParentRef=Z$,D.generateRandomBase64OperationLengthInput=F$,D.generateRandomBase64OperationLengthInputParentRef=x$,D.generateRandomBase64OperationLengthInputType=G$,D.generateRandomBase64OperationLengthInputTypeParentRef=j$,D.generateRandomBase64OperationResultStringDataType=K$,D.generateRandomBase64OperationResultStringDataTypeParentRef=S$,D.generateRandomBase64OperationResultStringOutput=q$,D.generateRandomBase64OperationResultStringOutputParentRef=k$,D.generateRandomBoolean=tM,D.generateRandomDate=q2,D.generateRandomDateAfter=S2,D.generateRandomDateBefore=K2,D.generateRandomDateBetweenRange=k2,D.generateRandomFloatOperation=yE,D.generateRandomFloatOperationError=v$,D.generateRandomFloatOperationErrorParentRef=m$,D.generateRandomFloatOperationResultNumberDataType=f$,D.generateRandomFloatOperationResultNumberDataTypeParentRef=p$,D.generateRandomFloatOperationResultNumberOutput=y$,D.generateRandomFloatOperationResultNumberOutputParentRef=h$,D.generateRandomHexadecimalOperation=mE,D.generateRandomHexadecimalOperationError=D$,D.generateRandomHexadecimalOperationErrorParentRef=g$,D.generateRandomHexadecimalOperationLengthInput=A$,D.generateRandomHexadecimalOperationLengthInputParentRef=E$,D.generateRandomHexadecimalOperationLengthInputType=I$,D.generateRandomHexadecimalOperationLengthInputTypeParentRef=T$,D.generateRandomHexadecimalOperationResultStringDataType=w$,D.generateRandomHexadecimalOperationResultStringDataTypeParentRef=b$,D.generateRandomHexadecimalOperationResultStringOutput=_$,D.generateRandomHexadecimalOperationResultStringOutputParentRef=R$,D.generateRandomIntegerOperation=hE,D.generateRandomIntegerOperationMaxValueInput=n$,D.generateRandomIntegerOperationMaxValueInputParentRef=r$,D.generateRandomIntegerOperationMaxValueInputType=s$,D.generateRandomIntegerOperationMaxValueInputTypeParentRef=i$,D.generateRandomIntegerOperationMinValueInput=d$,D.generateRandomIntegerOperationMinValueInputParentRef=a$,D.generateRandomIntegerOperationMinValueInputType=l$,D.generateRandomIntegerOperationMinValueInputTypeParentRef=o$,D.generateRandomIntegerOperationResultNumberDataType=QC,D.generateRandomIntegerOperationResultNumberDataTypeParentRef=XC,D.generateRandomIntegerOperationResultNumberOutput=t$,D.generateRandomIntegerOperationResultNumberOutputParentRef=e$,D.generateRandomNumber=Y2,D.generateRandomNumberAfter=H2,D.generateRandomNumberBefore=J2,D.generateRandomNumberBetweenRange=W2,D.generateRandomText=eM,D.generateRandomTextAfter=z2,D.generateRandomTextBefore=X2,D.generateRandomTextBetweenRange=Q2,D.generateRandomUUIDv4Operation=AE,D.generateRandomUUIDv4OperationError=wP,D.generateRandomUUIDv4OperationErrorParentRef=bP,D.generateRandomUUIDv4OperationResultStringDataType=TP,D.generateRandomUUIDv4OperationResultStringDataTypeParentRef=EP,D.generateRandomUUIDv4OperationResultStringOutput=AP,D.generateRandomUUIDv4OperationResultStringOutputParentRef=IP,D.generateShortIdentifierOperation=bE,D.generateShortIdentifierOperationError=CP,D.generateShortIdentifierOperationErrorParentRef=OP,D.generateShortIdentifierOperationResultStringDataType=_P,D.generateShortIdentifierOperationResultStringDataTypeParentRef=RP,D.generateShortIdentifierOperationResultStringOutput=DP,D.generateShortIdentifierOperationResultStringOutputParentRef=gP,D.generateStandaloneIfDefault=oTe,D.generateUniqueUUID=Z2,D.getAllActionDescriptorsForConditions=Nm,D.getAllActionDescriptorsForGlobalEvents=$m,D.getAllActionDescriptorsForLoops=Pm,D.getAllActionDescriptorsForOperations=gAe,D.getAllBuiltInEntityIds=rn,D.getAllGloballyDeclaredFunctionDeclarationsExplanation=N5,D.getAllVariablesInScope=fbe,D.getBaseBuiltInEntities=xi,D.getBaseSchemaBasedOnType=R5,D.getBuiltInEntityOwner=Co,D.getCallableEntitiesDerivedFromInternalCalls=US,D.getCallableEntitiesDerivedFromWrites=au,D.getCallableEntityReferenceSchema=_i,D.getCallableEntityTypeSchema=Zx,D.getCalledBy=xs,D.getCallerEntityReferenceSchema=h0e,D.getCallerEntityTypeSchema=f0e,D.getCalls=xm,D.getCanvasEntitiesDerivedFromInternalCalls=BS,D.getCanvasEntitiesDerivedFromWrites=nu,D.getCanvasEntityDerivedFromValueReadingEntity=Fm,D.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=MS,D.getCanvasEntityReferenceSchema=P0e,D.getCanvasEntityTypeSchema=$0e,D.getChildrenEntityWithValues=GAe,D.getColumnProperties=lu,D.getCommonAncestor=Wb,D.getCommonChildren=Bm,D.getDatabaseEntities=abe,D.getDatabaseEntity=lbe,D.getDeclaration=Bi,D.getDeclarationOutputedError=pbe,D.getDeepestScope=qS,D.getDefaultRelationalDatabaseEntityOrFirst=HS,D.getDraggableCallableEntityReferenceSchema=Jx,D.getDraggableCallableEntityTypeSchema=Hx,D.getDraggableCallerEntityReferenceSchema=m0e,D.getDraggableCallerEntityTypeSchema=y0e,D.getDraggableExecutableEntityReferenceSchema=I0e,D.getDraggableExecutableEntityTypeSchema=T0e,D.getDraggablePassThroughCallableEntityReferenceSchema=xy,D.getDraggablePassThroughCallableEntityTypeSchema=Uy,D.getDraggablePlayableEntityReferenceSchema=_0e,D.getDraggablePlayableEntityTypeSchema=R0e,D.getEarliestCommonAncestorOfAllCallers=k5,D.getEarliestCommonCallerAncestor=jAe,D.getEarliestIndividualCommonCallerAncestor=qb,D.getEarliestSingleCallerAncestorOfValueWriterAndItsValueReaders=UAe,D.getEntitiesCreatedSinceInitialization=t0,D.getEntitiesToPropagateValuesTo=gn,D.getEntityArgumentDeclarations=Yb,D.getEntityInputMaps=VS,D.getEntityOutputMaps=zAe,D.getEntityReferenceSchema=C0e,D.getEntityReturnDeclarations=LS,D.getEntityTypeSchema=O0e,D.getEntityWithLogicScopeReferenceSchema=Ga,D.getEntityWithLogicScopeTypeSchema=A0e,D.getEntityWithValueReferenceSchema=qx,D.getEntityWithValueTypeSchema=p0e,D.getEntryPointEntityReferenceSchema=fi,D.getEntryPointEntityTypeSchema=lo,D.getEventEntityReferenceSchema=My,D.getEventEntityTypeSchema=Ly,D.getEventNameFromDefinition=fAe,D.getExecutableEntityReferenceSchema=E0e,D.getExecutableEntityTypeSchema=v0e,D.getExtendedBuiltInEntity=XAe,D.getExtendedDefinitionEntity=km,D.getFirstNonLoopScopeOwner=Yr,D.getFirstParentExecutableEntity=xS,D.getGenerationTargetSchemaBasedOnType=_5,D.getHTTPAPINameFromProjectId=T5,D.getHeadIfPartOfDetachedBranch=SS,D.getHighestScope=kS,D.getImplementedBuiltInEntity=QAe,D.getIsInteractive=uf,D.getLastInListOperation=sE,D.getLastInListOperationError=YD,D.getLastInListOperationErrorParentRef=WD,D.getLastInListOperationInputListArgument=ZD,D.getLastInListOperationInputListArgumentParentRef=qD,D.getLastInListOperationInputListArgumentRef=FD,D.getLastInListOperationInputListDataType=SD,D.getLastInListOperationOutputElementDataType=kD,D.getLastInListOperationOutputElementReturn=JD,D.getLastInListOperationOutputElementReturnParentRef=HD,D.getLastInListOperationOutputElementReturnRef=KD,D.getLinkedEntitiesFromArgumentDeclaration=qAe,D.getLiteralValueNameFromDataType=bl,D.getLowestPersistedEntityImplementation=Qb,D.getOnlyRelevantErrorsForPublication=CAe,D.getParentCallableEntity=q5,D.getParentCallerEntity=H5,D.getParentCanvasEntities=ri,D.getParentCanvasEntity=Tr,D.getParentCanvasEntityFromTransfer=Um,D.getParentEntryPoint=af,D.getParentExecutableEntity=Zb,D.getParentPassthroughCallableEntity=Z5,D.getPassThroughCallableEntityReferenceSchema=Dr,D.getPassThroughCallableEntityTypeSchema=By,D.getPeristedEntities=nbe,D.getPlayableEntityReferenceSchema=w0e,D.getPlayableEntityTypeSchema=b0e,D.getProject=pwe,D.getPrototypeByType=cf,D.getRecordOrderForTraversal=NAe,D.getRecusriveParentsIds=Jm,D.getReferenceEntityId=H,D.getReferencedEntitiesStateOrErrors=Dm,D.getReferencedEntityStateOrErrors=$b,D.getReferencedIds=su,D.getRelatedCallableElementsOnTheRight=Sm,D.getRelatedCanvasElementsOnTheLeft=Oo,D.getRelatedCanvasElementsOnTheLeftFromTransfer=JAe,D.getRelatedCanvasElementsOnTheRight=$n,D.getRelationalDBInstanceNameFromEntityId=I5,D.getRootEntryPointScopeOwner=pf,D.getScopeOwner=Ji,D.getStateClassFromType=dbe,D.getStepNameFromDefinition=pAe,D.getTerminationReferenceSchema=D0e,D.getTerminationTypeSchema=g0e,D.getTopLevelParentEntityId=JS,D.getTouchedCanvasEntitiesFromChangeSet=cbe,D.getUsedArgFromDeclaration=WAe,D.getUsedReturnFromDeclaration=YAe,D.getValueReadingEntityReferenceSchema=kx,D.getValueReadingEntityTypeSchema=ja,D.getValueWritingEntityReferenceSchema=c0e,D.getValueWritingEntityTypeSchema=Sc,D.getVariableFromInputMapping=W5,D.getVariableFromReturnVariablePointer=X5,D.getVariableReferenceSchema=oo,D.getVariableTypeSchema=El,D.getVariablesFromArgumentDeclarations=Gm,D.getVariablesFromInputMaps=Y5,D.getVariablesFromOutputMapping=Q5,D.getVariablesFromOutputMaps=eS,D.getVariablesFromReturnDeclarations=z5,D.getVariablesInSameOrHigherScope=SA,D.getWrites=jm,D.globalEventValidation=J0e,D.groupCallsBasedOnParallelizableExecution=SAe,D.handleAfterEntityImplementationSideEffects=j5,D.handleBeforeEntityImplementationSideEffects=x5,D.handleLiteralValueChange=lTe,D.handleLiteralValueDelete=dF,D.handleValueAsTypeChange=dTe,D.handleValueAsTypeDelete=pF,D.httpRequestBodyArgument=Th,D.httpRequestBodyArgumentRef=$C,D.httpRequestBodyDataType=PC,D.httpRequestHeadersArgument=Eh,D.httpRequestHeadersArgumentRef=OC,D.httpRequestHeadersDataType=CC,D.httpRequestMethodArgument=mh,D.httpRequestMethodArgumentRef=gC,D.httpRequestMethodDataType=DC,D.httpRequestMethodDataTypeRef=RC,D.httpRequestOperation=ic,D.httpRequestOperationErrorValueDescriptor=fE,D.httpRequestOperationErrorValueDescriptorDatatype=YC,D.httpRequestOperationErrorValueDescriptorRef=WC,D.httpRequestOperationRef=qC,D.httpRequestOperationRefEight=HC,D.httpRequestOperationRefFive=KC,D.httpRequestOperationRefFour=SC,D.httpRequestOperationRefNine=JC,D.httpRequestOperationRefSeven=ZC,D.httpRequestOperationRefSix=kC,D.httpRequestOperationRefThree=FC,D.httpRequestOperationRefTwo=GC,D.httpRequestQueryParamsArgument=pE,D.httpRequestQueryParamsArgumentRef=bC,D.httpRequestQueryParamsDataType=wC,D.httpRequestVariableURLArgument=vh,D.httpRequestVariableURLArgumentRef=IC,D.httpRequestVariableURLDataType=AC,D.httpRequestVariableURLDataTypeRef=EC,D.httpResponseBodyReturnDataType=jC,D.httpResponseBodyReturnDataTypeRef=UC,D.httpResponseBodyReturnReturn=bh,D.httpResponseBodyReturnReturnRef=xC,D.httpResponseCodeDataType=VC,D.httpResponseCodeReturn=Ih,D.httpResponseCodeReturnRef=NC,D.httpResponseHeadersDataType=BC,D.httpResponseHeadersDataTypeRef=LC,D.httpResponseHeadersReturn=Ah,D.httpResponseHeadersReturnRef=MC,D.httpStatusCodeValueValidation=TK,D.hydrateOrDiscardLiteralValue=XG,D.implement=Vm,D.inferArgumentDeclarationDataType=MG,D.inferDataType=bn,D.inferInputMapDataType=jA,D.inferOutputMapDataType=FA,D.inferPropertyDataType=xG,D.inferReturnDeclarationDataType=GA,D.inferValueDescriptorDataType=jG,D.inferVariableDeclarationDataType=UG,D.inferVariableInstanceDataType=BG,D.initBaseProjectEntity=e0,D.initProject=bK,D.initProjectFromFetchResult=AK,D.inputMapValidation=WEe,D.installedProjectValidation=ZEe,D.internalCallValidation=HEe,D.isPromise=jb,D.isUUID=rK,D.iterateOverListActionDescriptorListArgumentDeclaration=yN,D.iterateOverListActionDescriptorListArgumentDeclarationDataType=fN,D.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=pN,D.iterateOverListActionDescriptorListArgumentDeclarationParentRef=hN,D.iterateOverListLoopActionDescriptor=Qa,D.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=vN,D.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=mN,D.iterateOverListLoopBodyActionDescriptor=ac,D.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=gN,D.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=_N,D.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=ON,D.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=DN,D.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=$h,D.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=TN,D.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=EN,D.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=IN,D.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=RN,D.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=bN,D.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=AN,D.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=wN,D.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=VN,D.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=PN,D.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=$N,D.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=NN,D.iterateOverObjectKeysLoopActionDescriptor=ld,D.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=MN,D.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=LN,D.iterateOverObjectKeysLoopBodyActionDescriptor=OE,D.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=kN,D.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=KN,D.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=ZN,D.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=qN,D.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=DE,D.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=UN,D.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=BN,D.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=xN,D.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=SN,D.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=GN,D.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=jN,D.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=FN,D.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=zN,D.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=WN,D.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=JN,D.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=YN,D.iterateOverObjectValuesLoopActionDescriptor=dd,D.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=QN,D.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=XN,D.iterateOverObjectValuesLoopBodyActionDescriptor=$E,D.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=lV,D.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=oV,D.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=uV,D.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=dV,D.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=CE,D.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=tV,D.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=eV,D.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=rV,D.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=aV,D.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=sV,D.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=iV,D.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=nV,D.iterateOverStringActionDescriptorDynamicReturnDeclaration=eN,D.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=QP,D.iterateOverStringActionDescriptorStringArgumentDeclaration=XP,D.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=YP,D.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=WP,D.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=zP,D.iterateOverStringLoopActionDescriptor=nc,D.iterateOverStringLoopBodyActionDescriptor=Ch,D.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=lN,D.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=oN,D.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=uN,D.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=dN,D.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=_E,D.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=rN,D.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=tN,D.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=iN,D.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=gE,D.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=nN,D.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=sN,D.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=aN,D.joinListOperation=tE,D.joinListOperationError=ID,D.joinListOperationErrorParentRef=TD,D.joinListOperationFirstListArgument=hD,D.joinListOperationFirstListArgumentParentRef=fD,D.joinListOperationFirstListArgumentRef=oD,D.joinListOperationFirstListDataType=lD,D.joinListOperationResultListDataType=pD,D.joinListOperationResultListReturn=ED,D.joinListOperationResultListReturnParentRef=vD,D.joinListOperationResultListReturnRef=cD,D.joinListOperationSecondListArgument=mD,D.joinListOperationSecondListArgumentParentRef=yD,D.joinListOperationSecondListArgumentRef=dD,D.joinListOperationSecondListDataType=uD,D.joinListWithLastSeparator=ot,D.joinStringsOperation=rc,D.joinStringsOperationDynamicStringArgument=G1,D.joinStringsOperationDynamicStringArgumentParentRef=j1,D.joinStringsOperationDynamicStringArgumentRef=U1,D.joinStringsOperationDynamicStringDataType=x1,D.joinStringsOperationError=B1,D.joinStringsOperationErrorParentRef=M1,D.joinStringsOperationFirstStringArgument=fh,D.joinStringsOperationFirstStringArgumentParentRef=g1,D.joinStringsOperationFirstStringArgumentRef=I1,D.joinStringsOperationFirstStringDataType=A1,D.joinStringsOperationResultStringDataType=_1,D.joinStringsOperationResultStringReturn=tc,D.joinStringsOperationResultStringReturnParentRef=L1,D.joinStringsOperationResultStringReturnRef=R1,D.joinStringsOperationSecondStringArgument=hh,D.joinStringsOperationSecondStringArgumentParentRef=V1,D.joinStringsOperationSecondStringArgumentRef=b1,D.joinStringsOperationSecondStringDataType=w1,D.joinStringsOperationSeparatorStringArgument=N1,D.joinStringsOperationSeparatorStringArgumentParentRef=P1,D.joinStringsOperationSeparatorStringArgumentRef=D1,D.joinStringsOperationSeparatorStringDataType=$1,D.joinStringsOperationSeparatorStringDataTypeDefaultValue=C1,D.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=O1,D.keyValuePrototype=nd,D.literalValueValidation=rTe,D.loopValidation=Y0e,D.lowercaseFirstLetter=Ld,D.manualFlowActionDescriptorDeclarationArgumentDeclaration=RE,D.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=SP,D.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=FP,D.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=KP,D.manualFlowLoopActionDescriptor=Dh,D.manualFlowLoopActionDescriptorDynamicReturnDeclaration=GP,D.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=jP,D.manualFlowLoopBodyActionDescriptor=Oh,D.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=qP,D.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=kP,D.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=HP,D.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=ZP,D.mapActionDescriptorToTypeItRepresents=ibe,D.mapRecord=nS,D.mergeArraysOfStringsWithoutDuplicates=oAe,D.mergeEntityErrorsList=dfe,D.mergeListOfEntities=tbe,D.methodDefaultValue=_C,D.mockClientProject=dI,D.moreThanOrEqualCondition=hd,D.moreThanOrEqualConditionLeftHandArgument=f2,D.moreThanOrEqualConditionLeftHandArgumentDataType=c2,D.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=u2,D.moreThanOrEqualConditionLeftHandArgumentParentRef=p2,D.moreThanOrEqualConditionRightHandArgument=v2,D.moreThanOrEqualConditionRightHandArgumentDataType=y2,D.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=h2,D.moreThanOrEqualConditionRightHandArgumentParentRef=m2,D.noSpacesOrDashesValueValidation=K5,D.noSpacesValueValidation=S5,D.notEmptyCondition=sl,D.notEmptyConditionArgument=a2,D.notEmptyConditionRef=n2,D.nullPrototype=Hv,D.numberAdditionOperation=ph,D.numberAdditionOperationDynamicSummandArgument=r1,D.numberAdditionOperationDynamicSummandArgumentType=t1,D.numberAdditionOperationDynamicSummandArgumentTypeParentRef=e1,D.numberAdditionOperationError=Qg,D.numberAdditionOperationErrorParentRef=Xg,D.numberAdditionOperationFirstNumberArgument=Jv,D.numberAdditionOperationFirstNumberArgumentRef=kg,D.numberAdditionOperationFirstNumberDataType=qg,D.numberAdditionOperationRef=Yg,D.numberAdditionOperationRefThree=Yv,D.numberAdditionOperationRefTwo=zg,D.numberAdditionOperationResultNumberDataType=Wg,D.numberAdditionOperationResultNumberReturn=zv,D.numberAdditionOperationResultNumberReturnRef=Jg,D.numberAdditionOperationSecondNumberArgument=Wv,D.numberAdditionOperationSecondNumberArgumentRef=Zg,D.numberAdditionOperationSecondNumberDataType=Hg,D.numberPrototype=lt,D.numberSubtractionOperation=Qv,D.numberSubtractionOperationDynamicSubtrahendArgument=E1,D.numberSubtractionOperationDynamicSubtrahendArgumentType=v1,D.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=m1,D.numberSubtractionOperationError=y1,D.numberSubtractionOperationErrorParentRef=h1,D.numberSubtractionOperationFirstNumberArgument=d1,D.numberSubtractionOperationFirstNumberArgumentRef=i1,D.numberSubtractionOperationFirstNumberDataType=s1,D.numberSubtractionOperationRef=Xv,D.numberSubtractionOperationRefThree=p1,D.numberSubtractionOperationRefTwo=u1,D.numberSubtractionOperationResultNumberDataType=l1,D.numberSubtractionOperationResultNumberReturn=f1,D.numberSubtractionOperationResultNumberReturnRef=o1,D.numberSubtractionOperationSecondNumberArgument=c1,D.numberSubtractionOperationSecondNumberArgumentRef=n1,D.numberSubtractionOperationSecondNumberDataType=a1,D.numberValueAutogenerationSchema=GI,D.operationValidation=k0e,D.orderEntitiesForTraversal=PAe,D.outputMapValidation=QEe,D.parallelExecutionOperation=En,D.parallelExecutionOperationError=_O,D.parallelExecutionOperationErrorParentRef=RO,D.parallelExecutionOperationListOfExecutionResultsDataType=AO,D.parallelExecutionOperationListOfExecutionResultsReturn=lE,D.parallelExecutionOperationListOfExecutionResultsReturnRef=IO,D.parallelExecutionOperationListOfFunctionsArgument=oE,D.parallelExecutionOperationListOfFunctionsArgumentDatatype=TO,D.parallelExecutionOperationListOfFunctionsArgumentRef=EO,D.parallelExecutionOperationListOfFunctionsBlueprint=vO,D.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=yO,D.parallelExecutionOperationListOfFunctionsBlueprintDynamicInputParentRef=hO,D.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=fO,D.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutputParentRef=pO,D.parallelExecutionOperationListOfFunctionsBlueprintParentRef=mO,D.parallelExecutionOperationRef=bO,D.parallelExecutionOperationRefThree=wO,D.persistedBuiltInBaseEntity=$i,D.persistedBuiltInBaseEntityDatabaseProperty=cd,D.persistedBuiltInBaseEntityDatabasePropertyDataType=jL,D.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=QZ,D.persistedBuiltInBaseEntityDatabasePropertyParentRef=GL,D.persistedBuiltInBaseEntityDatabasePropertyRef=xL,D.persistedBuiltInBaseEntityPrimaryKeyProperty=pd,D.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=JL,D.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=SL,D.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=FL,D.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=WL,D.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=HL,D.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=kL,D.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=KL,D.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=ZL,D.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=qL,D.printEntity=Sb,D.processOutputGlobalValueDescriptorDataType=C2,D.processOutputGlobalValueDescriptorReturn=Fh,D.processOutputGlobalValueDescriptorReturnRef=O2,D.projectPublicationCompletedGlobalEvent=Gh,D.propagateNewInputOrOutputMapValueAsTypeToParentVariable=Wp,D.propagateNewInputOrOutputMapValueToParentVariable=Jp,D.propagateNewStaticPropertyValueAsTypeToVariables=_l,D.propagateNewStaticPropertyValueToVariables=Rl,D.propertyToZodSchema=F2,D.propertyValidation=Tbe,D.readValueFromWritter=zd,D.rebaseStack=mA,D.relationalDatabaseBuiltInBaseEntity=wi,D.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=kE,D.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=$L,D.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=CL,D.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=PL,D.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=OL,D.relationalDatabaseBuiltInBaseEntityDefaultProperty=KE,D.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=DL,D.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=_L,D.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=gL,D.relationalDatabaseBuiltInBaseEntityIdentifierProperty=Nh,D.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=mL,D.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=hL,D.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=yL,D.relationalDatabaseBuiltInBaseEntityMinSizeProperty=Mh,D.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=RL,D.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=bL,D.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=wL,D.relationalDatabaseBuiltInBaseEntityPasswordProperty=Lh,D.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=IL,D.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=XZ,D.relationalDatabaseBuiltInBaseEntityPasswordPropertyDefaultValueParentRef=AL,D.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=TL,D.relationalDatabaseBuiltInBaseEntityRef=ud,D.relationalDatabaseBuiltInBaseEntityUsernameProperty=Vh,D.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=EL,D.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=zZ,D.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=vL,D.removeDisabledReasons=dAe,D.resolveActionDescriptorName=eK,D.resolveArgumentDeclarationValue=kA,D.resolveBaseEntityName=YS,D.resolveBuiltInBaseEntityDataTypeLabel=zS,D.resolveCardSubheader=YIe,D.resolveClonedEntityProject=Sr,D.resolveConditionOperatorLabel=zm,D.resolveDataType=Xy,D.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=Fb,D.resolveDataTypeLabel=uu,D.resolveDatatypeIconName=WIe,D.resolveDefinitionEntityDataTypeLabel=mbe,D.resolveDefinitionEntitySubheader=yb,D.resolveEntityCodeName=cw,D.resolveEntityDataTypeLabel=ybe,D.resolveEntityName=ne,D.resolveEntitySubheader=zIe,D.resolveFirstCallsSecond=KAe,D.resolveFirstWritesSecond=kAe,D.resolveFunctionDeclarationCardSubheader=mb,D.resolveInputMapNextStandaloneValue=Zp,D.resolveInputMapNextValue=rm,D.resolveInputMapNextValueAsPropertyOfAnObject=rF,D.resolveInputMapStandaloneValue=Hp,D.resolveInputMapValue=sF,D.resolveInputMapValueAsPropertyOfAnObject=iF,D.resolveMethodCardSubheader=u5,D.resolveNextValue=im,D.resolveOutputMapValue=ZA,D.resolvePersistedDefinitionEntityDatabaseEntity=ZS,D.resolvePrimaryKeyProperty=obe,D.resolvePrimitiveEntityForSearchLiteralValueType=BA,D.resolvePrimitiveEntityName=QS,D.resolvePropertyValue=nF,D.resolvePublicationStepStatusFromType=mAe,D.resolveResourceNameFromType=yAe,D.resolveReturnDeclarationValue=qA,D.resolveSearchName=XS,D.resolveValue=wl,D.resolveValueDescriptorValue=aF,D.resolveVarDeclarationAggregateObjectValue=eF,D.resolveVarDeclarationNextAggregateObjectValue=QG,D.resolveVarDeclarationNextValue=qp,D.resolveVarDeclarationValue=KA,D.resolveVarInstanceNextValue=tm,D.resolveVarInstanceValue=tF,D.resolveVariableScope=YEe,D.returnDeclarationValidation=q0e,D.returnStatementValidation=Z0e,D.searchStatementErrorGlobalValueDescriptor=zE,D.searchStatementErrorGlobalValueDescriptorDataType=P2,D.searchStatementErrorGlobalValueDescriptorRef=$2,D.searchStatementState=KEe,D.searchStatementUtils=qEe,D.searchValidation=tve,D.sequentialExecutionOperation=Pa,D.sequentialExecutionOperationError=KO,D.sequentialExecutionOperationErrorParentRef=SO,D.sequentialExecutionOperationListOfExecutionResultsDataType=jO,D.sequentialExecutionOperationListOfExecutionResultsReturn=cE,D.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=FO,D.sequentialExecutionOperationListOfExecutionResultsReturnRef=xO,D.sequentialExecutionOperationListOfFunctionsArgument=uE,D.sequentialExecutionOperationListOfFunctionsArgumentDatatype=UO,D.sequentialExecutionOperationListOfFunctionsArgumentParentRef=GO,D.sequentialExecutionOperationListOfFunctionsArgumentRef=BO,D.sequentialExecutionOperationListOfFunctionsBlueprint=MO,D.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=LO,D.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=VO,D.sortCallsBasedOnExecutionDependencies=J5,D.sortChildrenEntitiesBasedOnExecutionDependencies=FAe,D.splitListOperation=iE,D.splitListOperationError=xD,D.splitListOperationErrorParentRef=UD,D.splitListOperationFirstOutputListDataType=DD,D.splitListOperationFirstOutputListReturn=VD,D.splitListOperationFirstOutputListReturnParentRef=ND,D.splitListOperationFirstOutputListReturnRef=rE,D.splitListOperationInputListArgument=CD,D.splitListOperationInputListArgumentParentRef=OD,D.splitListOperationInputListArgumentRef=wD,D.splitListOperationInputListDataType=RD,D.splitListOperationSecondOutputListDataType=LD,D.splitListOperationSecondOutputListReturn=BD,D.splitListOperationSecondOutputListReturnParentRef=MD,D.splitListOperationSplitIndexArgument=PD,D.splitListOperationSplitIndexArgumentParentRef=$D,D.splitListOperationSplitIndexArgumentRef=_D,D.splitListOperationSplitIndexDataType=gD,D.splitStringOperation=eE,D.splitStringOperationError=iD,D.splitStringOperationErrorParentRef=rD,D.splitStringOperationFirstPartResultStringDataType=Z1,D.splitStringOperationFirstPartResultStringReturn=tD,D.splitStringOperationFirstPartResultStringReturnParentRef=eD,D.splitStringOperationFirstPartResultStringReturnRef=q1,D.splitStringOperationIndexArgument=X1,D.splitStringOperationIndexArgumentParentRef=z1,D.splitStringOperationIndexArgumentRef=K1,D.splitStringOperationIndexDataType=k1,D.splitStringOperationSecondPartResultStringDataType=J1,D.splitStringOperationSecondPartResultStringReturn=WZ,D.splitStringOperationSecondPartResultStringReturnParentRef=Q1,D.splitStringOperationSecondPartResultStringReturnRef=H1,D.splitStringOperationStringArgument=Y1,D.splitStringOperationStringArgumentParentRef=W1,D.splitStringOperationStringArgumentRef=F1,D.splitStringOperationStringDataType=S1,D.stringPrototype=Ye,D.stringValueAutogenerationSchema=jI,D.suggestNewIdForEntity=pw,D.syncSearchEntityOutput=xA,D.test_primitive_entities_export=rwe,D.toCamelCase=jr,D.toEditorContext=HIe,D.toEntityState=Wi,D.toKebabCase=WS,D.toLowerCaseKebabCase=Ym,D.toPascalCase=du,D.toProjectLogicContext=fTe,D.toSnakeCase=hbe,D.transitionProjectVersion=hA,D.translateLogicErrorCode=eAe,D.translateLogicErrorCodeShort=tAe,D.translateLogicErrorCodeShortWithEntityName=rAe,D.translateLogicErrorCodeWithEntityName=iAe,D.traverseChangeSet=yA,D.untypedDataPrototype=bi,D.updateErrorsList=Er,D.updatePersistedEntityMethod=BL,D.updatePersistedEntityMethodParentRef=ML,D.urlDefaultValue=TC,D.uuidPrototype=Ca,D.validateArgumentDeclarationName=dw,D.validateCalledByErrorIdInAction=RAe,D.validateCalledByIdInAction=wAe,D.validateCallers=P5,D.validateConditionEntityDeclaration=DAe,D.validateDataOperation=Wo,D.validateDataOperationDataToValidateArgument=lC,D.validateDataOperationDataToValidateArgumentParentRef=oC,D.validateDataOperationDataToValidateArgumentRef=nC,D.validateDataOperationDataToValidateDataType=aC,D.validateDataOperationEntityToMatchTypeArgument=pC,D.validateDataOperationEntityToMatchTypeArgumentParentRef=cC,D.validateDataOperationEntityToMatchTypeArgumentRef=dC,D.validateDataOperationEntityToMatchTypeDataType=uC,D.validateDataOperationError=mC,D.validateDataOperationErrorParentRef=yC,D.validateDataOperationOutputEntityDeclaration=hC,D.validateDataOperationOutputEntityDeclarationParentRef=fC,D.validateDefinitionEntityName=nw,D.validateEntryCaller=$5,D.validateErrorCaller=C5,D.validateFunctionCallDeclaration=V5,D.validateFunctionDeclarationName=aw,D.validateGeneratedEntityParentIsNotBuiltInEntity=TAe,D.validateGeneration=vAe,D.validateGenerationTarget=Ur,D.validateGenerationUpdate=EAe,D.validateLoopEntityDeclaration=OAe,D.validateMissingValue=go,D.validateName=vbe,D.validateOperationEntityDeclaration=L5,D.validatePropertyName=lw,D.validateReachability=Ka,D.validateReadsValueInActionPayload=_Ae,D.validateReferenceObject=gm,D.validateReferenceToOne=Pb,D.validateReferences=li,D.validateReturnDeclarationName=uw,D.validateSuccessCaller=O5,D.validateValueReaderGenerationUpdate=sf,D.validateValueWritter=Ub,D.validateVariableDeclarationName=ow,D.validateVariableInternalCallUse=xb,D.valueAutogenerationCurrentDateAndTimeSchema=Ix,D.valueAutogenerationGenericSchema=vy,D.valueAutogenerationOptions=SI,D.valueAutogenerationOptionsSchema=Tx,D.valueAutogenerationRandomBooleanSchema=xI,D.valueAutogenerationRandomDateBetweenSchema=Cx,D.valueAutogenerationRandomDateFromSchema=Dx,D.valueAutogenerationRandomDateSchema=Iy,D.valueAutogenerationRandomDateUntilSchema=Ox,D.valueAutogenerationRandomNumberBetweenSchema=wx,D.valueAutogenerationRandomNumberFromSchema=Ax,D.valueAutogenerationRandomNumberSchema=Ey,D.valueAutogenerationRandomNumberUntilSchema=bx,D.valueAutogenerationRandomSchema=Nc,D.valueAutogenerationRandomTextBetweenSchema=gx,D.valueAutogenerationRandomTextFromSchema=Rx,D.valueAutogenerationRandomTextSchema=Ty,D.valueAutogenerationRandomTextUntilSchema=_x,D.valueAutogenerationRangeValueTypesSchema=Pc,D.valueAutogenerationUniqueSchema=UI,D.valueDescriptorValidation=nTe,D.variableDeclarationValidation=Q0e,D.variableInstanceValidation=eve,D.waitOperation=zi,D.waitOperationMillisecondsNumberArgument=Ho,D.waitOperationMillisecondsNumberArgumentRef=gO,D.waitOperationMillisecondsNumberDataType=DO,D.waitOperationOperationError=$O,D.waitOperationOperationErrorParentRef=CO,D.waitOperationRef=OO,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})});
|