@elyx-code/project-logic-tree 0.0.6355 → 0.0.6356
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.d.ts +1 -0
- package/dist/index.js +1815 -1814
- package/dist/index.umd.cjs +2 -2
- package/package.json +2 -2
package/dist/index.umd.cjs
CHANGED
|
@@ -400,5 +400,5 @@ If an entity is called by another, they must be in the same scope, which means t
|
|
|
400
400
|
You shouldn't have to manually update a 'parent' property. The equivalent result is to change its callers, the value writters of its inputs, or the value readers of its outputs.`,issue:null})),{errors: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,P.sessionAuthor,N().toISOString(),this,!0,"sync-dependents"))){const a=[],l=[],p=[],t=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),l.push(...v.added),p.push(...v.removed),t.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}onDetachedDependencyRemoved(i,a,l){const p=[],t=[],y=[],v=[];if(a==="declaration"){const{updated:b,added:w,removed:A}=this.remove({ignoreUpstream:!1},l);p.push(...b),t.push(...w),y.push(...A)}if(a==="parent"){const{updated:b,added:w,removed:A}=this.remove({ignoreUpstream:!1},l);p.push(...b),t.push(...w),y.push(...A)}return{updated:R(p),added:R(t),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,l){const p=[],t=[],y=[],v=[];if(a==="declaration"){const{updated:b,added:w,removed:A}=this.restore({},l);p.push(...b),t.push(...w),y.push(...A)}if(a==="parent"){const{updated:b,added:w,removed:A}=this.restore({},l);p.push(...b),t.push(...w),y.push(...A)}return{updated:R(p),added:R(t),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){var i;return(i=this.parent)==null||i.unsubscribeDependents([{entity:this,field:"parent"}]),this.declaration.unsubscribeDependents([{entity:this,field:"declaration"}]),this}subscribeToDependencies(){var i;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"parent"}]),this.declaration.subscribeDependents([{entity:this,field:"declaration"}]),this}increaseVersion(i){if(i&&!N(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&N(i).isSame(N(this.createdAt))?this:(this.previousVersion=this.version,this.version=P.UUID.uuid(),this.createdAt=N(i).toISOString()||N().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new jt(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.process=this.process,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=[],l=[],p=[],t=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),l.push(...y.added),p.push(...y.removed)}return{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}async restoreVersion(i){var v;const a=[],l=[],p=[],t=[];if(this.version===i)return{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this};if(!this.knownVersions){const b=new Map;for(const[w,A]of this.knownVersions||new Map){if(b.set(w,A),A.activeVersion=!1,A.knownVersions)for(const[V,L]of A.knownVersions)b.set(V,L);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const b=await this.APILoadVersion({},i);if(!b)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new jt(b,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.process=y.process,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(l),removed:R(p),affected:R(t),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().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 l=W(i.parent),p=this.project.get(l),t=this.parent;if(t&&t.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 '${l}' 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 l=W(i.declaration),p=this.project.get(l);p&&this.setDeclaration(p)}return i.calledByEntry.forEach(l=>{const p=W(l),t=this.project.get(p);t&&(this.addEntryCaller(t,a),t.addCall(this,a))}),[...this.calledByEntry].forEach(l=>{i.calledByEntry.find(t=>W(t)===l.id)||(this.removeCaller(l,a),l.removeCall(this,a))}),i.calledBySuccess.forEach(l=>{const p=W(l),t=this.project.get(p);t&&(this.addSuccessCaller(t,a),t.addSuccessCall(this,a))}),[...this.calledBySuccess].forEach(l=>{i.calledBySuccess.find(t=>W(t)===l.id)||(this.removeCaller(l,a),l.removeCall(this,a))}),i.calledByError.forEach(l=>{const p=W(l),t=this.project.get(p);t&&(this.addErrorCaller(t,a),t.addErrorCall(this,a))}),[...this.calledBySuccess].forEach(l=>{i.calledBySuccess.find(t=>W(t)===l.id)||(this.removeCaller(l,a),l.removeCall(this,a))}),this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const i=[],a=[],l=[],p=[];if(this.initialData.parent){const t=W(this.initialData.parent),y=this.project.get(t);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${t}' 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 t=W(this.initialData.declaration),y=this.project.get(t);y&&(this.setDeclaration(y),i.push(y))}return this.initialData.calledByEntry.forEach(t=>{const y=W(t),v=this.project.get(y);v&&this.addEntryCaller(v,null)}),this.initialData.calledBySuccess.forEach(t=>{const y=W(t),v=this.project.get(y);v&&this.addSuccessCaller(v,null)}),this.initialData.calledByError.forEach(t=>{const y=W(t),v=this.project.get(y);v&&this.addErrorCaller(v,null)}),{updated:R(i),added:R(a),removed:R(l),affected:R(p),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],l=[],p=[],t=[];this.initialized=!0;const{updated:y,added:v,removed:b}=this.syncInputs(i),{updated:w,added:A,removed:V}=this.syncOutputs(i);return a.push(...y,...w),l.push(...v,...A),p.push(...b,...V),this.captureVersion(),i==null||i.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}addSelfToProject(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-self-to-project"))){var y;const a=[this],l=[],p=[],t=[];return this.parent===this.project&&this.project.addFunctionCall(this),(y=this.process)==null||y.writesValues.forEach(v=>{v.setValueWriter(this.process,i),a.push(v)}),this.successCalls.forEach(v=>{v.addSuccessCaller(this,i),a.push(v)}),this.errorCalls.forEach(v=>{v.addErrorCaller(this,i),a.push(v)}),this.calledBySuccess.forEach(v=>{v.addSuccessCall(this,i),a.push(v)}),this.calledByError.forEach(v=>{v.addErrorCall(this,i),a.push(v)}),this.calledByEntry.forEach(v=>{v.addCall(this,i),a.push(v)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-input"))){const l=this.inputs.findIndex(p=>p.id===i.id);return l>-1&&(this.inputs.splice(l,1),a&&(a==null||a.add(this,K.Affected))),a==null||a.attemptAutoclose("remove-input",this.id),this}addInput(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().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,K.Affected),a==null||a.attemptAutoclose("add-input",this.id),this)}addOutput(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().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,K.Affected),a==null||a.attemptAutoclose("add-output",this.id),this)}removeOutput(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-output"))){const l=this.outputs.findIndex(p=>p.id===i.id);return l>-1&&(this.outputs.splice(l,1),a&&(a==null||a.add(this,K.Affected))),a==null||a.attemptAutoclose("remove-output",this.id),this}addValueReader(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-value-reader"))){var l;return this.process&&!this.process.writesValues.includes(i)&&((l=this.process)==null||l.addValueReader(i,a),a==null||a.add(this,K.Affected)),a==null||a.attemptAutoclose("add-value-reader",this.id),this}removeValueReader(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-value-reader"))){var l;return this.process&&this.process.writesValues.includes(i)&&((l=this.process)==null||l.removeValueReader(i,a),a==null||a.add(this,K.Affected)),a==null||a.attemptAutoclose("remove-value-reader",this.id),this}addSuccessCaller(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-success-caller")),l=!1){return this.calledBySuccess.find(p=>p.id===i.id)||(this.calledBySuccess.push(i),a==null||a.add(this,K.Updated),l&&Ue(this,a)),a==null||a.attemptAutoclose("add-success-caller",this.id),this}addErrorCaller(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-error-caller")),l=!1){return this.calledByError.find(p=>p.id===i.id)||(this.calledByError.push(i),a==null||a.add(this,K.Updated),l&&Ue(this,a)),a==null||a.attemptAutoclose("add-error-caller",this.id),this}addEntryCaller(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-entry-caller")),l=!1){return this.calledByEntry.find(p=>p.id===i.id)||(this.calledByEntry.push(i),a==null||a.add(this,K.Updated),l&&Ue(this,a)),a==null||a.attemptAutoclose("add-entry-caller",this.id),this}addErrorCall(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-error-call")),l=!1){return this.errorCalls.find(p=>p.id===i.id)||(this.errorCalls.push(i),l&&Ue(this,a),a==null||a.add(this,K.Affected)),a==null||a.attemptAutoclose("add-error-call",this.id),this}addSuccessCall(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-success-call")),l=!1){return this.successCalls.find(p=>p.id===i.id)||(this.successCalls.push(i),l&&Ue(this,a),a==null||a.add(this,K.Affected)),a==null||a.attemptAutoclose("add-success-call",this.id),this}removeCall(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-call")),l=!1){const p=this.successCalls.findIndex(y=>y.id===i.id);p>-1&&(this.successCalls.splice(p,1),a==null||a.add(this,K.Affected));const t=this.errorCalls.findIndex(y=>y.id===i.id);return t>-1&&(this.errorCalls.splice(t,1),a==null||a.add(this,K.Affected)),l&&Ue(this,a),a==null||a.attemptAutoclose("remove-call",this.id),this}removeCaller(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-caller")),l=!1){return this.calledBySuccess=this.calledBySuccess.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,K.Updated),a==null||a.add(p,K.Affected),!1)),this.calledByError=this.calledByError.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,K.Updated),a==null||a.add(p,K.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(p=>p.id!==i.id?!0:(a==null||a.add(this,K.Updated),a==null||a.add(p,K.Affected),!1)),l&&Ue(this,a),a==null||a.attemptAutoclose("remove-caller",this.id),this}setParent(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"set-parent"))){var l;return((l=this.parent)==null?void 0:l.id)!==(i==null?void 0:i.id)&&(this.parent=i,a&&(a==null||a.add(this,K.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,P.sessionAuthor,N().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.declaration.type===f.FunctionDeclaration){const a=ee(this.initialData.declaration,this.project);this.declaration=a}else{const a=W(this.initialData.declaration),l=this.project.get(a);this.declaration=l}return this.successCalls=this.initialData.successCalls.map(a=>{const l=ee(a,this.project);if(l.addSuccessCaller(this),[f.BreakStatement,f.ContinueStatement].includes(l.type))l.setParent(this.parent.parent,null),l.initChildren(i);else if(l.type===f.ReturnStatement){const p=Vr(this,this.project);l.setParent(p,null),l.initChildren(i)}else l.type!==f.InternalCall&&(l.setParent(this.parent,null),l.initChildren(i));return l}),this.errorCalls=this.initialData.errorCalls.map(a=>{const l=ee(a,this.project);if(l.addErrorCaller(this),[f.BreakStatement,f.ContinueStatement].includes(l.type))l.setParent(this.parent.parent,null),l.initChildren(i);else if(l.type===f.ReturnStatement){const p=Vr(this,this.project);l.setParent(p,null),l.initChildren(i)}else l.type!==f.InternalCall&&(l.setParent(this.parent,null),l.initChildren(i));return l}),this.inputs=this.initialData.inputs.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(i),l}),this.initialData.process&&(this.process=ee(this.initialData.process,this.project),this.process.setParent(this,null),this.process.initChildren(i)),this.initialData.error&&(this.error=ee(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,P.sessionAuthor,N().toISOString(),this,!0,"meta-sync"))){const l=Tr(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,K.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,K.Added):l&&(a==null||a.add(this,K.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ye,...a){return await jt.repository.APILoad(this.id,...a),this}async APICreate(i=ye,...a){return await jt.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ye,...a){return await jt.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ye,...a){return await jt.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ye,...a){return await jt.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ye,a,...l){return await jt.repository.APILoadVersion(this.id,a,...l)}removeFromParent(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-from-parent"))){const a=[],l=[],p=[],t=[];return this.parent.type===f.Project?(this.parent.removeFunctionCall(this),t.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(l),affected:R(t),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-entity"))){var v;const l=[],p=[],t=[],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(b=>{const{updated:w,removed:A,added:V}=b.entity.onDetachedDependencyRemoved(this,b.field,a);l.push(...w),p.push(...A),t.push(...V)}),this.process){const{updated:b,removed:w}=(v=this.process)==null?void 0:v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(...w)}if(this.inputs.forEach(b=>{const{updated:w,removed:A}=b.remove({ignoreUpstream:!0},a);l.push(...w),p.push(...A)}),this.outputs.forEach(b=>{const{updated:w,removed:A}=b.remove({ignoreUpstream:!0},a);l.push(...w),p.push(...A)}),this.error){const{updated:b,removed:w}=this.error.remove({ignoreUpstream:!0},a);l.push(...b),p.push(...w)}if(this.successCalls.forEach(b=>{l.push(b),b.removeCaller(this,a)}),this.errorCalls.forEach(b=>{l.push(b),b.removeCaller(this,a)}),!i){const b=this.removeFromParent(a);t.push(...b.added),l.push(...b.updated),p.push(...b.removed),y.push(...b.affected),this.calledBy.forEach(w=>{l.push(w),w.removeCall(this,a)})}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:R(t),updated:R(l),removed:R(p),affected:R(y),self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"restore-entity"))){const a=[],l=[],p=[],t=[];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:b,added:w}=y.entity.onDetachedDependencyRestored(this,y.field,i);l.push(...v),p.push(...b),a.push(...w)}),this.process){const{updated:y}=this.process.restore({},i);l.push(...y)}return this.inputs.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),this.outputs.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),this.successCalls.forEach(y=>{l.push(y),y.addSuccessCaller(this,i)}),this.errorCalls.forEach(y=>{l.push(y),y.addErrorCaller(this,i)}),this.calledBySuccess.forEach(y=>{l.push(y),y.addSuccessCall(this,i)}),this.calledByError.forEach(y=>{l.push(y),y.addErrorCall(this,i)}),this.calledByEntry.forEach(y=>{l.push(y),y.addCall(this,i)}),i==null||i.attemptAutoclose("restore-entity",this.id),{added:R(a),updated:R(l),removed:R(p),affected:R(t),self:this}}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.successCalls.flatMap(l=>l.toFlat(i)),...this.errorCalls.flatMap(l=>l.toFlat(i)),...this.inputs.flatMap(l=>l.toFlat(i)),...this.outputs.flatMap(l=>l.toFlat(i)),...this.process?this.process.toFlat(i):[],...this.error?this.error.toFlat(i):[],...this.calledBy.flatMap(l=>l.toFlat(i))])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.successCalls.flatMap(l=>l.toFlatIds(i)),...this.errorCalls.flatMap(l=>l.toFlatIds(i)),...this.inputs.flatMap(l=>l.toFlatIds(i)),...this.outputs.flatMap(l=>l.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,l;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,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()),process:(a=this.process)==null?void 0:a.toJSON(i),declaration:this.declaration.toJSON(i),inputs:this.inputs.map(p=>p.toJSON(i)),outputs:this.outputs.map(p=>p.toJSON(i)),parent:this.parent.toReference(),error:(l=this.error)==null?void 0:l.toJSON(i)})}toJSONClone(i=Ne){var l,p,t,y,v,b,w;let a;return(l=i.seenEntityMaps)!=null&&l.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||Ir(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(p=i.seenEntities)!=null&&p.has(a)||(t=i.seenEntities)!=null&&t.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:P.UUID.uuid(),createdAt:i.timestamp||N().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,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})),process:(b=this.process)==null?void 0:b.toJSONClone({...i,newId:null}),declaration:this.declaration.toJSONClone({...i,newId:null}),inputs:this.inputs.map(A=>A.toJSONClone({...i,newId:null})),outputs:this.outputs.map(A=>A.toJSONClone({...i,newId:null})),error:(w=this.error)==null?void 0:w.toJSONClone({...i,newId:null}),parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=Ne){var l;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+P.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=Ne){var l;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.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,process:this.process?this.process.toReference(i):null,inputs:this.inputs.map(p=>p.toReference(i)),outputs:this.outputs.map(p=>p.toReference(i)),declaration:this.declaration.toReference(i),successCalls:this.successCalls.map(p=>p.toReference(i)),errorCalls:this.errorCalls.map(p=>p.toReference(i)),calledBySuccess:this.calledBySuccess.map(p=>p.toReference(i)),calledByError:this.calledByError.map(p=>p.toReference(i)),calledByEntry:this.calledByEntry.map(p=>p.toReference(i)),error:this.error?this.error.toReference(i):null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.successCalls.flatMap(l=>l.toFlatJSON(i)),...this.errorCalls.flatMap(l=>l.toFlatJSON(i)),...this.inputs.flatMap(l=>l.toFlatJSON(i)),...this.outputs.flatMap(l=>l.toFlatJSON(i)),...this.process?this.process.toFlatJSON(i):[],...this.error?this.error.toFlatJSON(i):[]])}toGenerationTarget(){const i=this.parent.type===f.Project?void 0:this.parent.id;return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,calledByEntry:this.calledByEntry.map(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){return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.successCalls.flatMap(l=>l.toFlatGenerationTarget(i)),...this.errorCalls.flatMap(l=>l.toFlatGenerationTarget(i)),...this.inputs.flatMap(l=>l.toFlatGenerationTarget(i)),...this.outputs.flatMap(l=>l.toFlatGenerationTarget(i)),...this.process?this.process.toFlatGenerationTarget(i):[],...this.error?this.error.toFlatGenerationTarget(i):[]])}clearErrors(){var i,a;return this.errors=[],this.inputs.forEach(l=>l.clearErrors()),this.outputs.forEach(l=>l.clearErrors()),this.successCalls.forEach(l=>l.clearErrors()),this.errorCalls.forEach(l=>l.clearErrors()),(i=this.process)==null||i.clearErrors(),(a=this.error)==null||a.clearErrors(),this}validate(){const i=Bj(this);return this.errors=i,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.inputs.flatMap(a=>a.getErrors()),...this.outputs.flatMap(a=>a.getErrors()),...this.error?this.error.getErrors():[],...this.process?this.process.getErrors():[]]}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"clone-entity")),a=null,l=null,p=!0){var U,k;let t=wr(a,this);const y=this.toJSON(),v=l||P.UUID.uuid();y.inputs=[];const b=v.split("-id"),w=b[b.length-1||0]||v;y.id=v,y.version=P.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||N().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1;const A=kt(y,t);a?A.setParent(a,null):A.setParent(this.parent,null),p&&A.subscribe(),A.initChildren(i),i==null||i.add(A,K.Added);const V=(U=this.inputs)==null?void 0:U.map((q,H)=>q.clone(i,A,w+"-input-map-"+H+"-id",p));A.inputs=V;const L=(k=this.outputs)==null?void 0:k.map((q,H)=>q.clone(i,A,w+"-output-map-"+H+"-id",p));return A.outputs=L,this.error&&(A.error=this.error.clone(i,A,w+"-error-map-id",p)),this.process&&(A.process=this.process.clone(i,A,w+"-process-id",p)),i==null||i.attemptAutoclose("clone-entity",this.id),A}removeUnrecognizedInputs(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-unrecognized-inputs"))){const a=[],l=[],p=[],t=[];return this.inputs.forEach(v=>{if(!this.declaration.inputs.find(w=>{var A;return w.id===((A=v.declaration)==null?void 0:A.id)})){const w=v.remove({ignoreUpstream:!1},i);p.push(...w.removed),a.push(...w.updated)}}),this.inputs.filter((v,b)=>{const w=this.inputs.findIndex(V=>V.declaration===v.declaration&&V!==v);if(w===-1)return!1;const A=this.inputs[w];return N(A==null?void 0:A.createdAt).isSame(N(v.createdAt))?b>w:!!N(A==null?void 0:A.createdAt).isAfter(v.createdAt)}).forEach(v=>{const b=v.remove({ignoreUpstream:!1},i);p.push(...b.removed),a.push(...b.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-inputs",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}removeUnrecognizedOutputs(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-unrecognized-outputs"))){const a=[],l=[],p=[],t=[];return this.outputs.forEach(v=>{if(!this.declaration.getUniqueReturnDeclarations().find(w=>{var A;return w.id===((A=v.declaration)==null?void 0:A.id)})){const w=v.remove({ignoreUpstream:!1},i);p.push(...w.removed),a.push(...w.updated)}}),this.outputs.filter((v,b)=>{const w=this.outputs.findIndex(V=>V.declaration===v.declaration&&V!==v);if(w===-1)return!1;const A=this.outputs[w];return N(A==null?void 0:A.createdAt).isSame(N(v.createdAt))?b>w:!!N(A==null?void 0:A.createdAt).isAfter(v.createdAt)}).forEach(v=>{const b=v.remove({ignoreUpstream:!1},i);p.push(...b.removed),a.push(...b.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-outputs",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}syncInputs(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-missing-fixed-inputs"))){const a=[],l=[],p=[],t=[],y=this.declaration.inputs.filter(A=>!this.inputs.find(V=>V.declaration.id===A.id));this.inputs.sort((A,V)=>A.index-V.index),y.forEach(A=>{this.inputs.forEach(U=>{U.index>=A.index&&U.metaSync({index:U.index+1},i)});const V={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||N().toISOString(),author:P.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()},L=ee(V,this.project);L.setParent(this,i),L.initChildren(i),i==null||i.add(L,K.Added),L.addSelfToProject(i),l.push(L)}),this.inputs.sort((A,V)=>A.index-V.index);const{updated:v,added:b,removed:w}=this.removeUnrecognizedInputs(i);return a.push(...v),l.push(...b),p.push(...w),i==null||i.attemptAutoclose("sync-missing-fixed-inputs",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}syncOutputs(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-missing-fixed-outputs"))){const a=[],l=[],p=[],t=[],y=[];this.outputs=this.initialData.outputs.reduce((V,L)=>{if(L.type===f.GenericReference){const k=wi(L,this.project);return k?[...V,k]:V}const U=ee(L,this.project);return y.push(U.index),U.setParent(this,null),U.initChildren(i),[...V,U]},[]);const v=this.declaration.getUniqueReturnDeclarations().filter(V=>!this.outputs.find(L=>L.declaration.id===V.id));this.outputs.sort((V,L)=>V.index-L.index),v.forEach((V,L)=>{this.outputs.forEach(H=>{H.index>=V.index&&H.index++});const U=y.includes(V.index)?this.outputs.length-1+L:V.index,k={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||N().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.OutputMap,declaration:V.toJSON(),defaultValue:null,writesValues:[],index:U,parent:this.toReference()},q=ee(k,this.project);q.setParent(this,i),q.initChildren(i),i==null||i.add(q,K.Added),q.addSelfToProject(i)}),this.outputs.sort((V,L)=>V.index-L.index);const{updated:b,added:w,removed:A}=this.removeUnrecognizedOutputs(i);return a.push(...b),l.push(...w),p.push(...A),i==null||i.attemptAutoclose("sync-missing-fixed-outputs",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}};D(jt,"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,...l)=>null}),D(jt,"type",f.FunctionCall),D(jt,"USER_MANAGED_PARENT_TYPES",[...Ar,f.Project]),D(jt,"PARENT_TYPES",[...jt.USER_MANAGED_PARENT_TYPES]),D(jt,"MUTABLE_BASE_PROPERTIES",[]),D(jt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),D(jt,"BASE_PROPERTIES",[...jt.MUTABLE_BASE_PROPERTIES,...jt.INMUTABLE_BASE_PROPERTIES]),D(jt,"MUTABLE_META_PROPERTIES",["x","y"]),D(jt,"INMUTABLE_META_PROPERTIES",[...jt.INMUTABLE_BASE_PROPERTIES]),D(jt,"META_PROPERTIES",[...jt.MUTABLE_META_PROPERTIES,...jt.INMUTABLE_META_PROPERTIES]),D(jt,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),D(jt,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),D(jt,"UPSTREAM_PROPERTIES",[...jt.MUTABLE_UPSTREAM_PROPERTIES,...jt.INMUTABLE_UPSTREAM_PROPERTIES]),D(jt,"MUTABLE_DOWNSTREAM_PROPERTIES",["successCalls","errorCalls","writesValues","inputs","outputs","error"]),D(jt,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),D(jt,"DOWNSTREAM_PROPERTIES",[...jt.MUTABLE_DOWNSTREAM_PROPERTIES,...jt.INMUTABLE_DOWNSTREAM_PROPERTIES]),D(jt,"PROPERTIES",[...jt.META_PROPERTIES,...jt.UPSTREAM_PROPERTIES,...jt.DOWNSTREAM_PROPERTIES]);let Za=jt;function Ob(d){return d&&typeof d.then=="function"}function Mhe(d){const u=new ca(d[0]),i=d.map(l=>l.id),a={};return d.forEach(l=>{a[l.id]=l}),u.order=i,u.flatRecord=a,u.orderEntities(),u.order.map(l=>u.flatRecord[l])}class ca{constructor(u){D(this,"order",[]);D(this,"flatRecord",{});D(this,"allBuiltInEntityIds",Os());D(this,"onGoingVisits",{});u&&(this.flatten(u),this.orderEntities())}flatten(u){const i=new Set(Os()),a=R(he(u,i,{ignoreBuiltInBaseEntities:!0})),l=new Set;for(const p of a)this.flatRecord[p.id]=p,l.add(p.id);this.order=Array.from(l)}moveEntityAfterDependencies(u){const{upstream:i}=Ed(u,this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds});for(const a of Object.keys(i)){const l=this.order.indexOf(a),p=this.order.indexOf(u.id);if(l>p)return this.order.splice(p,1),this.order.splice(l,0,u.id),!0}return!1}orderEntities(){let u=!1;for(let i=0;i<this.order.length;i++){const a=this.order[i],l=this.flatRecord[a];if(l||console.warn(`Entity with id ${a} not found in flatRecord. Skipping...`),this.moveEntityAfterDependencies(l)){u=!0;break}}u&&this.orderEntities()}getUpstreamOngoingDependenciesVisits(u,i){const{upstream:a}=Ed(this.flatRecord[u],this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds}),l={};return Object.entries(this.onGoingVisits[i]||{}).forEach(([p,t])=>{Object.keys(a).includes(p)&&(l[p]=t)}),l}getDownstreamOngoingDependenciesVisits(u,i){const a=Object.keys(this.onGoingVisits[i]||{}),l=new Set(a.flatMap(t=>Object.keys(Ed(this.flatRecord[t],this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds}).downstream))),p={};return Array.from(l).forEach(t=>{t===u&&(p[t]=this.onGoingVisits[i][t])}),p}async settlePromises(u,i){const a=Object.values(u);a.length&&await Promise.all(a),Object.keys(u).forEach(l=>{delete this.onGoingVisits[i][l]})}visit(u){const i=this.order;for(const a of i)u(this.flatRecord[a],this.flatRecord);return this}reverseVisit(u){const i=this.order.slice().reverse();for(const a of i)u(this.flatRecord[a],this.flatRecord);return this}async visitAsync(u){const i=this.order,a=Math.random().toString(36).substring(7);this.onGoingVisits[a]={};for(const l of i){const p=this.getUpstreamOngoingDependenciesVisits(l,a);Object.keys(p).length&&await this.settlePromises(p,a);const t=u(this.flatRecord[l],this.flatRecord);Ob(t)&&(this.onGoingVisits[a][l]=t)}return await this.settlePromises(this.onGoingVisits[a],a),this.onGoingVisits[a]={},this}async reverseVisitAsync(u){const i=this.order.slice().reverse(),a=Math.random().toString(36).substring(7);this.onGoingVisits[a]={};for(const l of i){const p=this.getDownstreamOngoingDependenciesVisits(l,a);Object.keys(p).length&&await this.settlePromises(p,a);const t=u(this.flatRecord[l],this.flatRecord);Ob(t)&&(this.onGoingVisits[a][l]=t)}return await this.settlePromises(this.onGoingVisits[a],a),this.onGoingVisits[a]={},this}}function jj(d,u){switch(d.id){case ve["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const i=d.project.entities.filter(v=>!!v.implements.find(b=>b.id===ve["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)),a=i.find(v=>{const b=v.properties.find(V=>V.implements&&V.implements.id===ve["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),w=b==null?void 0:b.getDefaultValue();return(w==null?void 0:w.value)===!0});if(!a&&i.length){const b=i[0].properties.find(A=>A.implements&&A.implements.id===ve["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),w=b==null?void 0:b.defaultValue;if(w)w.metaSync({value:!0},u);else if(b!=null&&b.dataType){const A={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(u==null?void 0:u.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.LiteralValue,standaloneParent:null,name:X.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:b==null?void 0:b.toReference()},V=ee(A,d.project);return V.setParent(b,u),V.initChildren(u),u==null||u.add(V,K.Added),V.addSelfToProject(u),{newEntities:[V]}}return{newEntities:[]}}else if(a)return{newEntities:[]};const l=d.project.get(ve["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),p=Ty(l,"Main database",u);if(p.errors.length>0)return{newEntities:[]};const t=p.properties.find(v=>v.implements&&v.implements.id===ve["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),y=t==null?void 0:t.defaultValue;if(y)y.metaSync({value:!0},u);else if(t!=null&&t.dataType){const v={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(u==null?void 0:u.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.LiteralValue,standaloneParent:null,name:X.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:t==null?void 0:t.toReference()},b=ee(v,d.project);b.setParent(t,u),b.initChildren(u),u==null||u.add(b,K.Added),b.addSelfToProject(u)}return{newEntities:[p]}}}return{newEntities:[]}}function Uj(d,u){const i=[],a=[],l=[],p=[];return d.implements.filter(y=>y.type===f.BuiltInBaseEntity).forEach(y=>{var v;switch(y.id){case ve["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const b=d.project.entities.filter(L=>L.implements.find(U=>U.id===ve["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));let w=b.find(L=>!!L.properties.find(U=>{var k;return U.implements&&U.implements.id===ve["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((k=U.getDefaultValue())==null?void 0:k.value)===!0}));if(!w&&b.length)w=b[0];else if(!w&&!b.length){w=d.project.getBuiltIn(ve["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id).implement("Relational database",u);const U=w.properties.find(k=>{var q;return((q=k.implements)==null?void 0:q.id)===ve["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id});(v=U==null?void 0:U.defaultValue)==null||v.metaSync({value:!0},u),a.push(w)}const A=d.properties.find(L=>L.implements&&L.implements.id===ve["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id),V=A==null?void 0:A.defaultValue;if(A&&!V){const L={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(u==null?void 0:u.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.LiteralValue,standaloneParent:null,name:X.EntityTemplate,autogeneration:null,value:null,valueAsTypeSingle:(w==null?void 0:w.toJSON())||null,valueAsTypeList:null,parent:A==null?void 0:A.toReference()},U=ee(L,d.project);U.hydrateAncestors(),U.setParent(A,u),U.addSelfToProject(u),U.initChildren(u),u==null||u.add(U,K.Added),a.push(U);return}else V&&!V.valueAsTypeSingle&&V.setValueAsTypeSingle(w||null,u);return}}}),{self:d,updated:R(i),added:R(a),removed:R(l),affected:R(p)}}function Ty(d,u,i,a){const l=a||P.UUID.uuid(),p=P.UUID.uuid(),t={id:l,version:p,createdAt:(i==null?void 0:i.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,name:u,type:f.DefinitionEntity,codeName:null,description:null,static:d.static,abstract:!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[d.toJSON()],x:0,y:0,parent:d.project.toReference()};jj(d,i);const y=ee(t,d.project);return y.hydrateAncestors(),i==null||i.add(y,K.Added),y.addSelfToProject(i),y.addImplementation(d),y.setParent(d.project,i),y.initChildren(i),Uj(y,i),y}function $b(d,u){return u.entities.find(l=>{const p=l.properties,t=p.map(A=>A.name),y=d.every(A=>t.includes(A)),v=t.filter(A=>!d.includes(A)),b=p.every(A=>!v.includes(A.name)||!A.required);return y&&b})||null}function xj(d,u,i,a=Hr.OrDataTypeGroup){const l=[],p=[],t=[],y=[],b={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:null,implementationChooseOne:!1,entity:d.toJSON(),isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,staticEntities:null,interactiveEntities:null,actionEntities:null,like:!0,inferred:!1,parentRelationType:a,parent:u.toReference()},w=ee(b,d.project);return p.push(w),w.setParent(u,i),w.initChildren(i),i==null||i.add(w,K.Added),w.setEntity(d,i),w.addSelfToProject(i),{updated:R(l),added:R(p),removed:R(t),affected:R(y),self:w}}function Pb(d,u,i,a,l){var b,w,A,V,L,U,k,q;const p=[],t=[],y=[],v=[];switch(typeof d){case"string":let H=!1;const ie=new Date(d);if(ie instanceof Date&&!isNaN(ie.valueOf())&&(H=!0),H){const te=u.project.getBuiltIn(ve[f.PrimitiveEntity][X.Date].id);u.setEntity(te,a);break}else{const te=u.project.getBuiltIn(ve[f.PrimitiveEntity][X.String].id);u.setEntity(te,a);break}case"number":u.setEntity(u.project.getBuiltIn(ve[f.PrimitiveEntity][X.Number].id),a);break;case"boolean":u.setEntity(u.project.getBuiltIn(ve[f.PrimitiveEntity][X.Boolean].id),a);break;case"object":if(d===null){u.setEntity(u.project.getBuiltIn(ve[f.PrimitiveEntity][X.Null].id),a);break}else if(Array.isArray(d))if(u.metaSync({isList:!0},a),d.length>0){const te=d.slice(0,5).filter(ne=>ne!==void 0);if(te.every(ne=>typeof ne==typeof te[0])&&(typeof te[0]!="object"||te[0]===null))switch(typeof te[0]){case"string":u.setEntity(u.project.getBuiltIn(ve[f.PrimitiveEntity][X.String].id),a);break;case"number":u.setEntity(u.project.getBuiltIn(ve[f.PrimitiveEntity][X.Number].id),a);break;case"boolean":u.setEntity(u.project.getBuiltIn(ve[f.PrimitiveEntity][X.Boolean].id),a);break;case"object":u.setEntity(u.project.getBuiltIn(ve[f.PrimitiveEntity][X.Null].id),a);break}else{const ne=[];let me=!1;te.forEach(ae=>{var ce,Y,de,Ee;if(Array.isArray(ae)&&(me=!0),typeof ae=="object"&&!Array.isArray(ae)&&ae!==null){const Pe=by(ae,u.project,{...i,id:P.UUID.uuid()},a,l);Pe.hasCreated&&ne.push((ce=Pe.changeSet)==null?void 0:ce.self),p.push(...(Y=Pe.changeSet)==null?void 0:Y.updated),t.push(...(de=Pe.changeSet)==null?void 0:de.added),y.push(...(Ee=Pe.changeSet)==null?void 0:Ee.removed)}});const J=R(ne);if(!J.length&&!me){te.forEach(ae=>{const ce={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:null,implementationChooseOne:!1,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,staticEntities:!1,interactiveEntities:!0,actionEntities:!1,like:!0,inferred:!1,parentRelationType:Hr.OrDataTypeGroup,parent:u.toReference()},Y=ee(ce,u.project);switch(Y.setParent(u,a),Y.initChildren(a),a==null||a.add(Y,K.Added),Y.addSelfToProject(a),typeof ae){case"string":Y.setEntity(Y.project.getBuiltIn(ve[f.PrimitiveEntity][X.String].id),a);break;case"number":Y.setEntity(Y.project.getBuiltIn(ve[f.PrimitiveEntity][X.Number].id),a);break;case"boolean":Y.setEntity(Y.project.getBuiltIn(ve[f.PrimitiveEntity][X.Boolean].id),a);break;case"object":Y.setEntity(Y.project.getBuiltIn(ve[f.PrimitiveEntity][X.Null].id),a);break}});break}else J.length===1&&!me?u.setEntity(J[0],a):te.forEach(ae=>{if(typeof ae=="object"&&!Array.isArray(ae)&&ae!==null){const ce=$b(Object.keys(ae),u.project);if(ce){const Y=xj(ce||J[0],u,a,Hr.OrDataTypeGroup);p.push(...Y.updated),t.push(...Y.added),y.push(...Y.removed)}}else{const ce={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:null,implementationChooseOne:!1,entity:null,isList:Array.isArray(ae),asType:null,andChildrenGroup:null,orChildrenGroup:null,staticEntities:!1,interactiveEntities:!0,actionEntities:!1,like:!0,inferred:!1,parentRelationType:Hr.OrDataTypeGroup,parent:u.toReference()},Y=ee(ce,u.project);Y.setParent(u,a),Y.initChildren(a),a==null||a.add(Y,K.Added),Y.addSelfToProject(a);const de=Pb(ae,Y,{...i,id:P.UUID.uuid()},a,l);p.push(...de.updated),t.push(...de.added),y.push(...de.removed)}})}}else{const te=by(d[0],u.project,{...i},a,l);u.setEntity((b=te.changeSet)==null?void 0:b.self,a),p.push(...(w=te.changeSet)==null?void 0:w.updated),t.push(...(A=te.changeSet)==null?void 0:A.added),y.push(...(V=te.changeSet)==null?void 0:V.removed);break}else{const te=by(d,u.project,{...i},a,l);u.setEntity((L=te.changeSet)==null?void 0:L.self,a),p.push(...(U=te.changeSet)==null?void 0:U.updated),t.push(...(k=te.changeSet)==null?void 0:k.added),y.push(...(q=te.changeSet)==null?void 0:q.removed);break}}return{updated:R(p),added:R(t),removed:R(y),affected:R(v),self:u}}function by(d,u,i,a,l){const p=[],t=[],y=[],v=[],b=Object.keys(d),w=$b(b,u);if(w)return{hasCreated:!1,changeSet:{updated:[],added:[],removed:[],affected:[],self:w}};const A=l?i.name+" of "+l.name:i.name,L={id:i.id||P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,name:A,codeName:null,type:f.DefinitionEntity,description:i.description||null,static:i.static||!1,abstract:i.abstract||!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[],x:0,y:0,parent:u.toReference()},U=ee(L,u);return U.setParent(u,a),U.initChildren(a),a==null||a.add(U,K.Added),U.addSelfToProject(a),t.push(U),b.forEach((k,q)=>{const ie={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,name:k,type:f.Property,codeName:k,description:null,static:!1,abstract:!1,defaultValue:null,constant:!1,dataType:null,implements:null,extends:null,index:q,hidden:!1,private:!1,required:!0,parent:U.toReference()},te=ee(ie,u);te.setParent(U,a),te.initChildren(a),a==null||a.add(te,K.Added),te.addSelfToProject(a),t.push(te);const pe=d[k],me={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,staticEntities:!1,interactiveEntities:!0,actionEntities:!1,like:!0,inferred:!1,parent:te.toReference()},J=ee(me,u);J.setParent(te,a),J.initChildren(a),a==null||a.add(J,K.Added),J.addSelfToProject(a),t.push(J);const ae=Pb(pe,J,{...i,name:k,id:P.UUID.uuid()},a,l||U);p.push(...ae.updated),t.push(...ae.added),y.push(...ae.removed)}),{hasCreated:!0,changeSet:{updated:R(p),added:R(t),removed:R(y),affected:R(v),self:U}}}function pa(d,u,i,a){const l=[];return!d.length||!u.length?{errors:l,overlap:!1}:(d.length>u.length?d.forEach(p=>{const t=u.find(v=>v.name===p.name),y=u.find(v=>{var b,w;return!!p.implements&&((b=v.implements)==null?void 0:b.id)===((w=p.implements)==null?void 0:w.id)});if(t){const v=new St({id:p.id+"--"+t.id+"--"+a,message:`Entity of type ${p.type} named "${p.name}" with id "${p.id}" overrides a base ${t.type} ${t.name} with id "${t.id}" that has the same name`,issue:null,severity:Z.Error,code:a,entity:p,firstRelationship:t});l.push(v)}if(y){const v=new St({id:p.id+"--"+y.id+"--"+i,message:`Entity of type ${p.type} named "${p.name}" with id "${p.id}" overrides a base ${y.type} ${y.name} with id "${y.id}" that implements the same base descriptor`,issue:null,severity:Z.Error,code:i,entity:p,firstRelationship:y});l.push(v)}}):u.forEach(p=>{var v;const t=d.find(b=>b.name===p.name),y=d.find(b=>{var w,A;return!!b.implements&&((w=b.implements)==null?void 0:w.id)===((A=p.implements)==null?void 0:A.id)});if(t){const b=new St({id:t.id+"--"+p.id+"--"+a,message:`Entity of type ${t.type} named "${t.name}" with id "${t.id}" overrides a base entity ${p.name} with id "${p.id}" that has the same name`,issue:null,severity:Z.Error,code:a,entity:t,firstRelationship:p});l.push(b)}if(y){const b=new St({id:y.id+"--"+p.id+"--"+i,message:`Entity of type ${y.type} named "${y.name}" with id "${y.id}" overrides a base entity ${p.name} with id "${p.id}" that implements the same base ${(v=y==null?void 0:y.implements)==null?void 0:v.type}`,issue:null,severity:Z.Error,code:i,entity:y,firstRelationship:p});l.push(b)}}),{errors:l,overlap:!!l.length})}function jhe(d,u){return d.abstract||(d.properties.forEach(a=>{a.abstract||a.metaSync({abstract:!0},u)}),Object.values(d.detachedDependents).forEach(a=>{a.field===zT.Entity&&a.entity.remove({ignoreUpstream:!1},u)}),d.metaSync({abstract:!0},u)),d}function Uhe(d,u){return d.abstract&&(d.properties.forEach(a=>{a.abstract&&a.metaSync({abstract:!1},u)}),Object.values(d.detachedDependents).forEach(a=>{(a.field===Vy.Implements||a.field===Vy.Extends)&&a.entity.onDetachedDependencyRemoved(d,a.field,u)}),d.metaSync({abstract:!1},u)),d}function xhe(d,u){return d.static||(d.properties.forEach(a=>{a.static||a.metaSync({static:!0},u)}),d.metaSync({static:!0},u)),d}function Fhe(d,u){return d.static&&d.metaSync({static:!1},u),d}var Fj=(d=>(d.StringValueMustNotHaveSpaces="string-value-must-not-have-spaces",d.StringValueMustNotHaveDashes="string-value-must-not-have-dashes",d))(Fj||{});function Gj(d,u){const i=[],a=u;if(!a)return{errors:i,override:u};if(typeof a!="string")return{errors:[],override:u};if(a.includes(" ")){const l=new St({id:d.id+"--string-value-must-not-have-spaces",message:`Entity of type ${d.type} with id "${d.id}" has an invalid value "${u}". The value cannot contain spaces.`,issue:null,severity:Z.Error,code:"string-value-must-not-have-spaces",entity:d});i.push(l)}return{errors:i,override:a.replace(/\s/g,"-")}}function Kj(d,u){const i=[],a=u;if(!a)return{errors:i,override:u};if(typeof a!="string")return{errors:[],override:u};if(a.includes(" ")){const l=new St({id:d.id+"--string-value-must-not-have-spaces",message:`Entity of type ${d.type} with id "${d.id}" has an invalid value "${u}". The value cannot contain spaces or dashes.`,issue:null,severity:Z.Error,code:"string-value-must-not-have-spaces",entity:d});i.push(l)}if(a.includes("-")){const l=new St({id:d.id+"--string-value-must-not-have-dashes",message:`Entity of type ${d.type} with id "${d.id}" has an invalid value "${u}". The value cannot contain spaces or dashes.`,issue:null,severity:Z.Error,code:"string-value-must-not-have-dashes",entity:d});i.push(l)}return{errors:i,override:a.replace(/\s|-/g,"_")}}function Vb(d,u){var i;if(d.type===f.LiteralValue){let a=(i=d.value)==null?void 0:i.toString();try{a=JSON.stringify(d.value,null,2)}catch{}return`${d.type}: ${d.id} (${re(d,u)}) = ${a}`}if(d.type===f.DataType){if(d instanceof Ji||d.increaseVersion)return`${d.type}: ${d.id} (${dd(d)})`;try{const a=dd(d);return`${d.type}: ${d.id} (${a})`}catch{}}return`${d.type}: ${d.id} (${re(d,u)})`}function vd(d,u){const i=Ja(d);if(i.length===0)return{list:[],last:null};let a=null;return{list:i.flatMap(p=>{if(p===u)return a=p,[p];const t=vd(p,u);return t.last&&(a=t.last),[p,...t.list]}),last:a}}function Nb(d){const u=d.calledBy;if(u.length===0)return d.project;const i=u.reduce((a,l)=>{const p=Ii(l,d.project);return!p||p.type===f.Project?a:a.type===f.Project||vd(p,a).last?p:(vd(a,p).last,a)},d.project);return i.type===f.FunctionDeclaration&&i.parent.type===f.Loop?i.parent:i}function Ue(d,u){var l,p;let i=Nb(d);if(d.type===f.InternalCall)(l=d.parent)==null||l.setParent(i,u),(p=d.parent)==null||p.addSelfToProject(u);else if((d.type===f.ContinueStatement||d.type===f.BreakStatement)&&i.type!==f.Loop){d.remove({ignoreUpstream:!1},u);return}else if(d.type===f.ReturnStatement&&!Ar.includes(i.type)){d.remove({ignoreUpstream:!1},u);return}else d.setParent(i,u),d.addSelfToProject(u);if(ir.includes(d.type))return;ct(d).forEach(t=>{var v,b;const y=Nb(t);if(t.type===f.InternalCall)(v=t.parent)==null||v.setParent(y,u),(b=t.parent)==null||b.addSelfToProject(u);else if((t.type===f.ContinueStatement||t.type===f.BreakStatement)&&y.type!==f.Loop){t.remove({ignoreUpstream:!1},u);return}else if(t.type===f.ReturnStatement&&!Ar.includes(y.type)){t.remove({ignoreUpstream:!1},u);return}else t.setParent(y,u),t.addSelfToProject(u)})}function Ay(d,u,i=new Set){const a=Xs(d),l=Xs(u),p=a.filter(v=>!l.includes(v)),t=a.filter(v=>l.includes(v)),y=p.reduce((v,b)=>i.has(b.id)?v:(i.add(b.id),R([...v,...Ay(b,u,i)])),[]);return R([...t,...y])}function Ko(d,u){const i=vd(d,u);return i.last===u&&i.list.length>0&&i.list[0]!==u}function Lb(d,u){return!!vd(d,u).last}function Ghe(d){if(Ht.includes(d.type))return d;if([...Fs,f.VariableDeclaration].includes(d.type)){const u=d.parent;return Ht.includes(u.type)?u:null}return null}function Bb(d,u){if(!d||!u)throw new Error("Both entities must be defined to find a common ancestor");if(d===u)return d;const i=d.parent;if(i){if(i===u)return u;if(i.type===f.Project)return null}else return null;const a=u.parent;if(a){if(a===d)return d;if(a.type===f.Project)return null}else return null;return Bb(i,a)}function cr(d){if(Rf.includes(d.type)){if(d.type===f.FunctionDeclaration){const u=d.parent;if(u.type===f.DefinitionEntity)return cr(u);if(u.type===f.Loop)return u}return d.type===f.DefinitionEntity&&d.parent.type===f.DataType?cr(d.parent):d}else{const u=d.parent;return u?cr(u):null}}function Iy(d,u){const i=hp(d,u);if(!i)return null;if(Rf.includes(i.type)){if(i.type===f.FunctionDeclaration){const a=hp(i.parent,u);if(a){if(a.type===f.DefinitionEntity)return a;if(a.type===f.Loop)return a}}return i}else{const a=i.parent?hp(i.parent,u):null;return a?Iy(a,u):null}}function kj(d){if(!d)return null;if(Fs.includes(d.type))return d;const u=d.parent;return u?kj(u):null}function qj(d){if(!d)return null;if(Qt.includes(d.type))return d;const u=d.parent;return u?qj(u):null}function Sj(d){if(!d)return null;if(Gs.includes(d.type))return d;const u=d.parent;return u?Sj(u):null}function Zj(d){return d.type===f.VariableDeclaration?[d]:Qt.includes(d.type)?[...d.inputs,...d.outputs||[]]:ir.includes(d.type)?d.outputs:Al.includes(d.type)||d.type===f.FunctionDeclaration?d.inputs:[]}function Khe(d){const u=Xs(d),i=[],a=[];jR.includes(d.type)&&i.push(...wy(d));const l=u.filter(p=>{const t=i.includes(p);return t?!1:Fs.includes(p.type)&&!t?(a.push(p),!1):!0});return i.sort((p,t)=>Ko(t,p)?-1:0),a.sort((p,t)=>Ko(t,p)?-1:0),[...i,...a,...l]}function Jj(d){return[...d].sort((u,i)=>Ko(i,u)?-1:0)}function Mb(d){const u=Jj(d),i=[];return u.forEach(a=>{const l=i[i.length-1];if(l){const p=l[l.length-1];Ko(a,p)?i.push([a]):l.push(a)}else i.push([a])}),i}function ei(d){const u=d.map(i=>cr(i));return R(u)}function wy(d){return Qt.includes(d.type)?[...ei(d.successCalls),...ei(d.errorCalls)]:Ht.includes(d.type)?ei(d.calls):[]}function khe(d,u){return wy(d).includes(u)}function jb(d){return d.writesValues||[]}function qhe(d,u){return jb(d).includes(u)}function Wj(d){var u;return rt.includes((u=d==null?void 0:d.readsValue)==null?void 0:u.type)?d.readsValue:null}function She(d){return d.writesValues}function Hj(d=[]){return d.map(Wj).filter(u=>!!u)}function Ry(d=[]){return d.map(u=>u.writesValues).flat().filter(u=>rt.includes(u.type))}function Yj(d=[]){return d.map(u=>u.readsValue).filter(u=>!!u&&rt.includes(u.type))}function zj(d){return rt.includes(d.type)?d:null}function Xj(d){return d.writesValues.map(zj).filter(u=>!!u)}function Qj(d=[]){return d.reduce((u,i)=>i.type===f.OutputMap?[...u,...Xj(i)]:u,[])}function ct(d){return d.type===f.Loop?R([...Cs(ei(d.successCalls)),...Cs(ei(d.errorCalls)),...d.body?ct(d.body):[]]):Qt.includes(d.type)?R([...Cs(ei(d.successCalls)),...Cs(ei(d.errorCalls))]):Ht.includes(d.type)?R(Cs(ei(d.calls))):[]}function Zhe(d){return Qt.includes(d.type)?[...Cs(ei(d.successCalls)),...Cs(ei(d.errorCalls))]:Ht.includes(d.type)?Cs(ei(d.calls)):[]}function eU(d,u=new Set){return d.writesValues.filter(a=>rt.includes(a.type)&&!u.has(a.id)).reduce((a,l)=>u.has(l.id)?a:[...a,...zt(l,u)],[])}function tU(d,u=new Set){var a;return(((a=d.readsValue)==null?void 0:a.writesValues)||[]).filter(l=>rt.includes(l.type)&&!u.has(l.id)).reduce((l,p)=>u.has(p.id)?l:[...l,...zt(p,u)],[])}function zt(d,u=new Set){if(u.has(d.id))return[];if(d.type===f.ReturnStatement)return Yj(d.outputs).reduce((a,l)=>[...a,...zt(l,u)],[]);if(d.type===f.FunctionCall||d.type===f.Operation||d.type===f.Condition)return[...ct(d).reduce((p,t)=>{const y=cr(t);return[...p,...zt(y||t,u)]},[]),...Hj(d.inputs),...Qj(d.outputs)].reduce((p,t)=>[...p,...zt(t,u)],[]);if(Al.includes(d.type)){const i=Ry(d.inputs),l=ct(d).reduce((p,t)=>{const y=cr(t);return[...p,...zt(y||t,u)]},[]);return i.push(...l),i.reduce((p,t)=>[...p,...zt(t,u)],[])}if(d.type===f.FunctionDeclaration){const i=[...Ry(d.inputs)],l=ct(d).reduce((p,t)=>{const y=cr(t);return[...p,...zt(y||t,u)]},[]);return i.push(...l),i.reduce((p,t)=>[...p,...zt(t)],[])}if(rt.includes(d.type)){u.add(d.id);const a=ct(d).reduce((l,p)=>{const t=cr(p);return[...l,...zt(t||p,u)]},[]);return[d,...a,...tU(d,u),...eU(d,u)]}return[]}function Hi(d,u=new Set){return u.has(d.id)?[]:(u.add(d.id),[...Xs(d).reduce((l,p)=>[...l,p,...Hi(p,u)],[])])}function Cs(d){return d.reduce((u,i)=>i.type===f.ReturnStatement||i.type===f.ContinueStatement||i.type===f.BreakStatement?[...u,i]:[...u,i,...ct(i)],[])}function rU(d){const u=d.entities||[],i=[...u,...d.functions||[],...d.events||[],...d.projects||[]],a=u.reduce((v,b)=>[...v,...b.properties],[]),l=u.reduce((v,b)=>[...v,...b.methods],[]),p=l.reduce((v,b)=>[...v,...Ry(b.inputs),...Cs(ei(b.calls)),...b.returnStatements],[]),t=d.functions.reduce((v,b)=>[...v,...Cs(ei(b.calls)),...b.returnStatements],[]),y=d.events.reduce((v,b)=>[...v,...Cs(ei(b.calls)),...b.returnStatements],[]);return[...i,...a,...l,...p,...t,...y]}function iU(d,u){return u.filter(a=>{if(!a)return!1;switch(a.type){case f.FunctionCall:return a.inputs.find(l=>l.id===d.id)!==void 0||a.outputs.find(l=>l.id===d.id)!==void 0;case f.Condition:return a.successCalls.find(l=>l.id===d.id)!==void 0||a.errorCalls.find(l=>l.id===d.id)!==void 0||a.inputs.find(l=>l.id===d.id)!==void 0;case f.Operation:return a.outputs.find(l=>l.id===d.id)!==void 0;case f.VariableDeclaration:return Qt.includes(d.type)?VU(d).find(p=>{var t;return((t=p.readsValue)==null?void 0:t.id)===a.id})!==void 0:!1;case f.DefinitionEntity:return a.properties.find(l=>l.id===d.id)!==void 0||a.methods.find(l=>l.id===d.id)!==void 0;case f.FunctionDeclaration:return a.inputs.find(l=>l.id===d.id)!==void 0||(a.returnStatements.map(l=>l.outputs).flat()||[]).find(l=>l.id===d.id)!==void 0;default:return!1}})}function Jhe(d){const u=rU(d.project);return iU(d,u)}function hp(d,u){return d?typeof d=="string"?u[d]:d.type===f.GenericReference?u[d.entityId]:u[d.id]?u[d.id]:null:null}function sU(d={},u){const i={};return Object.keys(d).forEach(a=>{const l=u.get(a)||a,p=d[a];i[l]=p}),i}function Ed(d,u={},i={}){const a={ignoreBuiltInBaseEntities:!1,allBuiltInEntityIds:[],entityMaps:new Map,...i};if(a.ignoreBuiltInBaseEntities&&(Fi.includes(d.type)||(a.allBuiltInEntityIds||[]).includes(d.id)))return{upstream:{},downstream:{}};const l=d,p=d,t=d,y=d,v=d,b=d,w=d,A=d,V=d,L=d,U=d,k=d,q=d,H=[...q.readsValue?[q.readsValue]:[],...q.declaration?[q.declaration]:[],...(k.calledByEntry||[]).flatMap(ne=>ne),...(k.calledBySuccess||[]).flatMap(ne=>ne),...(k.calledByError||[]).flatMap(ne=>ne),...L.parent?[L.parent]:[]];Array.isArray(t.implements)?H.push(...t.implements.flatMap(ne=>ne)):V.implements&&H.push(V.implements),Array.isArray(t.extends)?H.push(...t.extends.flatMap(ne=>ne)):V.extends&&H.push(V.extends),v.valueAsTypeList&&Array.isArray(v.valueAsTypeList)&&H.push(...v.valueAsTypeList.flatMap(ne=>ne)),v.valueAsTypeSingle&&H.push(v.valueAsTypeSingle);const ie=[...(l.inputs||[]).flatMap(ne=>ne),...(U.inputsDeclarations||[]).flatMap(ne=>ne),...(l.outputs||[]).flatMap(ne=>ne),...(U.outputsDeclarations||[]).flatMap(ne=>ne),...(q.internalCalls||[]).flatMap(ne=>ne),...q.writesValues||[],...k.dataType?[k.dataType]:[],...b.body?[b.body]:[],...k.defaultValue?[k.defaultValue]:[],...(k.successCalls||[]).flatMap(ne=>ne),...(k.errorCalls||[]).flatMap(ne=>ne),...(t.properties||[]).flatMap(ne=>ne),...(t.methods||[]).flatMap(ne=>ne),...(t.abstractMethods||[]).flatMap(ne=>ne),...w.error?[w.error]:[],...w.process?[w.process]:[],...L.throws?[L.throws]:[],...(p.andChildrenGroup||[]).flatMap(ne=>ne),...(p.orChildrenGroup||[]).flatMap(ne=>ne),...(A.entities||[]).flatMap(ne=>ne),...(A.functions||[]).flatMap(ne=>ne),...(A.functionCalls||[]).flatMap(ne=>ne),...(A.events||[]).flatMap(ne=>ne),...(A.conditions||[]).flatMap(ne=>ne),...(A.operations||[]).flatMap(ne=>ne),...(A.loops||[]).flatMap(ne=>ne),...(A.variableDeclarations||[]).flatMap(ne=>ne),...(A.variableInstances||[]).flatMap(ne=>ne),...(A.searches||[]).flatMap(ne=>ne),...(A.projects||[]).flatMap(ne=>ne),...(y.calls||[]).flatMap(ne=>ne)];d.type===f.DataType&&(p.entity&&u[W(p.entity)]&&u[W(p.entity)].parent&&W(u[W(p.entity)].parent)===d.id?ie.push(p.entity):p.entity&&H.push(p.entity));const te={},pe={};return H.forEach(ne=>{var ae;const me=W(ne);if(me&&a.ignoreBuiltInBaseEntities&&(Fi.includes(ne.type)||(a.allBuiltInEntityIds||[]).includes(me)))return;const J=ne.version;if(me){const ce=((ae=a.entityMaps)==null?void 0:ae.get(me))||me;te[ce]=J}}),ie.forEach(ne=>{var ae;const me=W(ne);if(me&&a.ignoreBuiltInBaseEntities&&(Fi.includes(ne.type)||(a.allBuiltInEntityIds||[]).includes(me)))return;const J=ne.version;if(me){const ce=((ae=a.entityMaps)==null?void 0:ae.get(me))||me;pe[ce]=J}}),{upstream:te,downstream:pe}}function Whe(d,u){const i=[];if(Fs.includes(d.type)){fs(d).forEach(p=>{const t=Iy(p,u);t&&i.push(t)});const l=[...d.inputs||[],...d.outputs||[]].map(p=>{const t=hp(p,u);return t?LU(t,u):null}).filter(p=>p!==null);i.push(...R(l))}if(rt.includes(d.type)){const a=_y(d);a&&i.push(a)}return R(i)}function Ja(d){const u=[];if(Fs.includes(d.type)){d.calledBy.forEach(l=>{const p=cr(l);p&&u.push(p)});const a=[...d.inputs||[],...d.outputs||[]].map(l=>_y(l)).filter(l=>l!==null);u.push(...R(a))}if(rt.includes(d.type)){const i=_y(d);i&&u.push(i)}return R(u)}function fs(d){return[...d.calledByEntry||[],...d.calledByError||[],...d.calledBySuccess||[]].filter(u=>u.type!==f.GenericReference)}function nU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.ActionDescriptor)throw new Error("Entity must be an action descriptor to be flattened");return[d,...d.inputs.flatMap(a=>he(a,u,i)),...d.outputs.flatMap(a=>he(a,u,i)),...d.error?he(d.error,u,i):[],...d.parent?he(d.parent,u,i):[]]}function aU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.ArgumentDeclaration)throw new Error("Entity must be an argument declaration to be flattened");return[d,...d.defaultValue?he(d.defaultValue,u):[],...d.writesValues.flatMap(a=>he(a,u,i)),...d.dataType?he(d.dataType,u,i):[],...d.parent?he(d.parent,u,i):[]]}function oU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.BreakStatement)throw new Error("Entity must be a break statement to be flattened");return[d,...d.outputs.flatMap(a=>he(a,u,i)),...d.throws?he(d.throws,u,i):[],...(fs(d)||[]).flatMap(a=>he(a,u,i)),...d.parent?he(d.parent,u,i):[]]}function lU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.BuiltInBaseEntity)throw new Error("Entity must be a built-in base entity to be flattened");return[d,...(d.properties||[]).flatMap(a=>he(a,u,i)),...(d.methods||[]).flatMap(a=>he(a,u,i)),...(d.abstractMethods||[]).flatMap(a=>he(a,u,i)),...(d.extends||[]).flatMap(a=>he(a,u,i))]}function dU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.Condition)throw new Error("Entity must be a condition to be flattened");return[d,...(d.inputs||[]).flatMap(a=>he(a,u,i)),...(d.successCalls||[]).flatMap(a=>he(a,u,i)),...(d.errorCalls||[]).flatMap(a=>he(a,u,i)),...(fs(d)||[]).flatMap(a=>he(a,u,i)),...d.parent?he(d.parent,u,i):[]]}function uU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.ContinueStatement)throw new Error("Entity must be a continue statement to be flattened");return[d,...d.outputs.flatMap(a=>he(a,u,i)),...d.throws?he(d.throws,u,i):[],...(fs(d)||[]).flatMap(a=>he(a,u,i)),...d.parent?he(d.parent,u,i):[]]}function cU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.DefinitionEntity)throw new Error("Entity must be a definition entity to be flattened");return[d,...(d.extends||[]).flatMap(a=>he(a,u,i)),...(d.implements||[]).flatMap(a=>he(a,u,i)),...(d.properties||[]).flatMap(a=>he(a,u,i)),...(d.methods||[]).flatMap(a=>he(a,u,i)),...(d.abstractMethods||[]).flatMap(a=>he(a,u,i)),...d.parent?he(d.parent,u,i):[]]}function pU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.DataType)throw new Error("Entity must be a data type to be flattened");return[d,...(d.andChildrenGroup||[]).flatMap(a=>he(a,u,i)),...(d.orChildrenGroup||[]).flatMap(a=>he(a,u,i)),...d.entity?he(d.entity,u,i):[],...d.parent?he(d.parent,u,i):[]]}function fU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.FunctionCall)throw new Error("Entity must be a function call to be flattened");return[d,...(d.inputs||[]).flatMap(a=>he(a,u,i)),...(d.outputs||[]).flatMap(a=>he(a,u,i)),...d.error?he(d.error,u,i):[],...d.process?he(d.process,u,i):[],...(fs(d)||[]).flatMap(a=>he(a,u,i)),...(d.successCalls||[]).flatMap(a=>he(a,u,i)),...(d.errorCalls||[]).flatMap(a=>he(a,u,i)),...d.parent?he(d.parent,u,i):[]]}function hU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.FunctionDeclaration)throw new Error("Entity must be a function declaration to be flattened");return[d,...(d.inputs||[]).flatMap(a=>he(a,u,i)),...(d.calls||[]).flatMap(a=>he(a,u,i)),...d.implements?he(d.implements,u,i):[],...d.parent?he(d.parent,u,i):[]]}function yU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.GlobalEvent)throw new Error("Entity must be a global event to be flattened");return[d,...(d.inputs||[]).flatMap(a=>he(a,u,i)),...(d.calls||[]).flatMap(a=>he(a,u,i)),...d.implements?he(d.implements,u,i):[],...d.parent?he(d.parent,u,i):[]]}function mU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.InputMap)throw new Error("Entity must be an input map to be flattened");return[d,...d.readsValue?he(d.readsValue,u,i):[],...d.declaration?he(d.declaration,u,i):[],...d.defaultValue?he(d.defaultValue,u,i):[],...d.parent?he(d.parent,u,i):[]]}function vU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.InstalledProject)throw new Error("Entity must be an installed project to be flattened");return[d,...(d.functions||[]).flatMap(a=>he(a,u,i)),...(d.events||[]).flatMap(a=>he(a,u,i)),...d.parent?he(d.parent,u,i):[]]}function EU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.InternalCall)throw new Error("Entity must be an internal call to be flattened");return[d,...(d.successCalls||[]).flatMap(a=>he(a,u,i)),...(d.errorCalls||[]).flatMap(a=>he(a,u,i)),...(d.inputs||[]).flatMap(a=>he(a,u,i)),...(d.outputs||[]).flatMap(a=>he(a,u,i)),...(fs(d)||[]).flatMap(a=>he(a,u,i)),...d.error?he(d.error,u,i):[],...d.process?he(d.process,u,i):[],...d.parent?he(d.parent,u,i):[]]}function TU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.LiteralValue)throw new Error("Entity must be a literal value to be flattened");return[d,...d.valueAsTypeSingle?he(d.valueAsTypeSingle,u,i):[],...d.valueAsTypeList&&Array.isArray(d.valueAsTypeList)?d.valueAsTypeList.flatMap(a=>he(a,u,i)):[],...d.parent?he(d.parent,u,i):[]]}function bU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.Loop)throw new Error("Entity must be a loop to be flattened");return[d,...(d.inputs||[]).flatMap(a=>he(a,u,i)),...(d.outputs||[]).flatMap(a=>he(a,u,i)),...(d.successCalls||[]).flatMap(a=>he(a,u,i)),...(d.errorCalls||[]).flatMap(a=>he(a,u,i)),...d.error?he(d.error,u,i):[],...d.process?he(d.process,u,i):[],...d.body?he(d.body,u,i):[],...(fs(d)||[]).flatMap(a=>he(a,u,i)),...d.parent?he(d.parent,u,i):[]]}function AU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.Operation)throw new Error("Entity must be an operation to be flattened");return[d,...(d.successCalls||[]).flatMap(a=>he(a,u,i)),...(d.errorCalls||[]).flatMap(a=>he(a,u,i)),...(d.inputs||[]).flatMap(a=>he(a,u,i)),...(d.outputs||[]).flatMap(a=>he(a,u,i)),...d.error?he(d.error,u,i):[],...d.process?he(d.process,u,i):[],...(fs(d)||[]).flatMap(a=>he(a,u,i)),...d.parent?he(d.parent,u,i):[]]}function IU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.OutputMap)throw new Error("Entity must be an output map to be flattened");return[d,...(d.writesValues||[]).flatMap(a=>he(a,u,i)),...d.declaration?he(d.declaration,u,i):[],...d.defaultValue?he(d.defaultValue,u,i):[],...d.parent?he(d.parent,u,i):[]]}function wU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.PrimitiveEntity)throw new Error("Entity must be a primitive entity to be flattened");return[d,...(d.properties||[]).flatMap(a=>he(a,u,i)),...(d.methods||[]).flatMap(a=>he(a,u,i)),...(d.abstractMethods||[]).flatMap(a=>he(a,u,i))]}function RU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.Project)throw new Error("Entity must be a project to be flattened");return[d,...(d.entities||[]).flatMap(a=>he(a,u,i)),...(d.functions||[]).flatMap(a=>he(a,u,i)),...(d.events||[]).flatMap(a=>he(a,u,i)),...(d.projects||[]).flatMap(a=>he(a,u,i)),...(d.variableDeclarations||[]).flatMap(a=>he(a,u,i)),...(d.variableInstances||[]).flatMap(a=>he(a,u,i)),...(d.operations||[]).flatMap(a=>he(a,u,i)),...(d.conditions||[]).flatMap(a=>he(a,u,i)),...(d.functionCalls||[]).flatMap(a=>he(a,u,i)),...(d.projects||[]).flatMap(a=>he(a,u,i)),...(d.loops||[]).flatMap(a=>he(a,u,i)),...(d.searches||[]).flatMap(a=>he(a,u,i))]}function _U(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.Property)throw new Error("Entity must be a property to be flattened");return[d,...d.defaultValue?he(d.defaultValue,u,i):[],...d.dataType?he(d.dataType,u,i):[],...d.parent?he(d.parent,u,i):[]]}function gU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.ReturnDeclaration)throw new Error("Entity must be a return declaration to be flattened");return[d,...d.readsValue?he(d.readsValue,u,i):[],...d.defaultValue?he(d.defaultValue,u,i):[],...d.dataType?he(d.dataType,u,i):[],...d.parent?he(d.parent,u,i):[]]}function DU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.ReturnStatement)throw new Error("Entity must be a return statement to be flattened");return[d,...(d.outputs||[]).flatMap(a=>he(a,u,i)),...d.throws?he(d.throws,u,i):[],...(fs(d)||[]).flatMap(a=>he(a,u,i)),...d.parent?he(d.parent,u,i):[]]}function CU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.Search)throw new Error("Entity must be a search to be flattened");return[d,...(d.successCalls||[]).flatMap(a=>he(a,u,i)),...(d.errorCalls||[]).flatMap(a=>he(a,u,i)),...(d.inputsDeclarations||[]).flatMap(a=>he(a,u,i)),...(d.inputs||[]).flatMap(a=>he(a,u,i)),...(d.outputsDeclarations||[]).flatMap(a=>he(a,u,i)),...(d.outputs||[]).flatMap(a=>he(a,u,i)),...d.error?he(d.error,u,i):[],...(fs(d)||[]).flatMap(a=>he(a,u,i)),...d.parent?he(d.parent,u,i):[]]}function OU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.ValueDescriptor)throw new Error("Entity must be a value descriptor to be flattened");return[d,...d.defaultValue?he(d.defaultValue,u,i):[],...d.dataType?he(d.dataType,u,i):[],...d.parent?he(d.parent,u,i):[]]}function $U(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.VariableDeclaration)throw new Error("Entity must be a variable declaration to be flattened");return[d,...(d.successCalls||[]).flatMap(a=>he(a,u,i)),...(d.errorCalls||[]).flatMap(a=>he(a,u,i)),...(d.inputs||[]).flatMap(a=>he(a,u,i)),...(d.outputs||[]).flatMap(a=>he(a,u,i)),...(d.internalCalls||[]).flatMap(a=>he(a,u,i)),...(d.writesValues||[]).flatMap(a=>he(a,u,i)),...d.readsValue?he(d.readsValue,u,i):[],...d.defaultValue?he(d.defaultValue,u,i):[],...(fs(d)||[]).flatMap(a=>he(a,u,i)),...d.dataType?he(d.dataType,u,i):[],...d.parent?he(d.parent,u,i):[]]}function PU(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(u.has(d.id))return[];if(u.add(d.id),d.type!==f.VariableInstance)throw new Error("Entity must be a variable instance to be flattened");return[d,...(d.successCalls||[]).flatMap(a=>he(a,u,i)),...(d.errorCalls||[]).flatMap(a=>he(a,u,i)),...(d.inputs||[]).flatMap(a=>he(a,u,i)),...(d.outputs||[]).flatMap(a=>he(a,u,i)),...(d.internalCalls||[]).flatMap(a=>he(a,u,i)),...(d.writesValues||[]).flatMap(a=>he(a,u,i)),...d.readsValue?he(d.readsValue,u,i):[],...d.defaultValue?he(d.defaultValue,u,i):[],...(fs(d)||[]).flatMap(a=>he(a,u,i)),...d.declaration?he(d.declaration,u,i):[],...d.parent?he(d.parent,u,i):[]]}function Os(){const d=new Set,u=kP.flatMap(i=>he(i,d)).map(i=>i.id);if(!u.includes("http-request-error-return-delaration-id"))throw new Error("Built-in base entities must be included in the list");return u}function he(d,u=new Set,i={ignoreBuiltInBaseEntities:!1}){if(!d)throw new Error("Entity must be defined to be flattened");if(d.type===f.GenericReference)return[];if(i.ignoreBuiltInBaseEntities&&(Fi.includes(d.type)||Os().includes(d.id)))return[];if(u.has(d.id))return[];switch(d.type){case f.FunctionCall:return fU(d,u,i);case f.Operation:return AU(d,u,i);case f.Condition:return dU(d,u,i);case f.Loop:return bU(d,u,i);case f.Search:return CU(d,u,i);case f.GlobalEvent:return yU(d,u,i);case f.ReturnStatement:return DU(d,u,i);case f.ContinueStatement:return uU(d,u,i);case f.BreakStatement:return oU(d,u,i);case f.VariableDeclaration:return $U(d,u,i);case f.DefinitionEntity:return cU(d,u,i);case f.FunctionDeclaration:return hU(d,u,i);case f.Project:return RU(d,u,i);case f.ActionDescriptor:return nU(d,u,i);case f.ArgumentDeclaration:return aU(d,u,i);case f.ReturnDeclaration:return gU(d,u,i);case f.ValueDescriptor:return OU(d,u,i);case f.InputMap:return mU(d,u,i);case f.OutputMap:return IU(d,u,i);case f.DataType:return pU(d,u,i);case f.InstalledProject:return vU(d,u,i);case f.InternalCall:return EU(d,u,i);case f.LiteralValue:return TU(d,u,i);case f.Property:return _U(d,u,i);case f.VariableInstance:return PU(d,u,i);case f.BuiltInBaseEntity:return i.ignoreBuiltInBaseEntities?[]:lU(d,u,i);case f.PrimitiveEntity:return i.ignoreBuiltInBaseEntities?[]:wU(d,u,i)}return[]}function Ub(d){return d.type===f.FunctionCall||d.type===f.InternalCall||[f.Operation,f.Condition,f.Loop].includes(d.type)?d.declaration.inputs:d.type===f.FunctionDeclaration||Al.includes(d.type)?d.inputs:d.type===f.Search?d.inputsDeclarations:[]}function Hhe(d,u){return u.type===f.Condition?u.inputs.find(i=>i.declaration.id===d.id):u.type===f.FunctionCall||u.type===f.Operation?u.inputs.find(i=>i.declaration.id===d.id):null}function VU(d){return Qt.includes(d.type)?d.inputs:[]}function NU(d){var u;return d.type===f.FunctionCall?((u=d.declaration.returnStatements[0])==null?void 0:u.outputs)||[]:[f.Operation,f.Condition,f.Loop].includes(d.type)?d.declaration.outputs:d.type===f.Search?d.outputsDeclarations:ir.includes(d.type)?d.outputs:[]}function Yhe(d,u){return u.type===f.Condition?null:u.type===f.FunctionCall||u.type===f.Operation?u.outputs.find(i=>i.declaration.id===d.id):null}function zhe(d){return d.type===f.Condition?[]:Qt.includes(d.type)?d.outputs:[]}function _y(d){const u=d.readsValue;return u?cr(u):null}function LU(d,u){const i=d.readsValue;return i?Iy(i,u):null}function BU(d){const u=d.internalCalls||[];return R(ei(R(u.flatMap(i=>[...i.successCalls,...i.errorCalls]))))}function Td(d){const u=jb(d),i=[];return u.forEach(a=>{if(rt.includes(a.type))i.push(a);else if(qn.includes(a.type)){const l=a.parent;i.push(l)}}),i}function R(d){const u=new Set;return d.filter(i=>!i||u.has(i.id)?!1:(u.add(i.id),!0))}function Xs(d,u=!1){const i=[];if(d.type===f.Project&&i.push(...(d==null?void 0:d.entities)||[],...(d==null?void 0:d.functions)||[],...(d==null?void 0:d.variableDeclarations)||[],...(d==null?void 0:d.variableInstances)||[],...(d==null?void 0:d.searches)||[],...(d==null?void 0:d.loops)||[],...(d==null?void 0:d.operations)||[],...(d==null?void 0:d.conditions)||[],...(d==null?void 0:d.functionCalls)||[],...(d==null?void 0:d.events)||[],...(d==null?void 0:d.projects)||[]),Ar.includes(d.type)&&i.push(...(d==null?void 0:d.detachedChildren)||[]),d.type===f.DefinitionEntity){const a=[...d.suggestedMethods,...d.methods].flatMap(l=>l.collapsed&&u?[]:Xs(l));i.push(...a)}if(d.type===f.Condition){const a=d.successCalls.map(p=>cr(p)),l=d.errorCalls.map(p=>cr(p));i.push(...a,...l)}if(Al.includes(d.type)){if(d.collapsed&&u)return[];const a=d.inputs.map(p=>Td(p)).flat(),l=d.calls.map(p=>cr(p));i.push(...R(a),...l)}if(Qt.includes(d.type)&&d.type!==f.Condition&&d.type!==f.Loop){const a=d==null?void 0:d.outputs.map(t=>Td(t)).flat(),l=d.successCalls.map(t=>cr(t)),p=d.errorCalls.map(t=>cr(t));i.push(...R(a),...l,...p)}if(rt.includes(d.type)){const a=Td(d),l=BU(d);i.push(...a,...l)}if(d.type===f.Loop){const a=d.outputs.map(t=>Td(t)).flat();if(d.body){const t=Xs(d.body,u);i.push(...t)}const l=d.errorCalls.map(t=>cr(t)),p=d.successCalls.map(t=>cr(t));i.push(...R(a),...p,...l)}if(d.type===f.FunctionDeclaration){if(d.collapsed&&u)return[];const a=d.inputs.map(p=>Td(p)).flat(),l=d.calls.map(p=>cr(p));i.push(...R(a),...l)}return R(i)}function gy(d,u=!1){const i=Xs(d,u),a=[...i,...i.reduce((l,p)=>[...l,...gy(p,u)],[])];return R(a)}function MU(d){const u=Ja(d),i=[...u,...u.reduce((a,l)=>[...a,...MU(l)],[])];return R(i)}function yp(d){return d.implements.reduce((u,i)=>i.type===f.DefinitionEntity?[...u,f.DefinitionEntity,...yp(i),...mp(i)]:[...u,i.name],[])}function mp(d){return d.extends.reduce((u,i)=>i.type===f.DefinitionEntity?[...u,f.DefinitionEntity,...mp(i),...yp(i)]:[...u,i.name],[])}function xb(d){return d.extends.reduce((u,i)=>i.type===f.DefinitionEntity?[...u,i,...xb(i),...Fb(i)]:[...u,i],[])}function Fb(d){return d.implements.reduce((u,i)=>i.type===f.DefinitionEntity?[...u,i,...Fb(i),...xb(i)]:[...u,i],[])}function bd(d){return[...mp(d),...yp(d)].filter((i,a,l)=>l.indexOf(i)===a)}function Gb(d){return d.implements.length===0&&d.extends.length===0?null:d.implements.find(a=>a.type===f.BuiltInBaseEntity&&a.name===Oe.PERSISTED_ENTITY)?d:[...d.implements,...d.extends].reduce((a,l)=>{if(l.type===f.DefinitionEntity){const p=Gb(l);if(p)return p}return a},null)}function Xhe(d){const u=d.extends.find(i=>i.type===f.BuiltInBaseEntity);return u&&u.type===f.BuiltInBaseEntity?u:null}function Qhe(d){const u=d.implements.find(i=>i.type===f.BuiltInBaseEntity);return u&&u.type===f.BuiltInBaseEntity?u:null}function Dy(d){const u=d.extends.find(i=>i.type===f.DefinitionEntity);return u&&u.type===f.DefinitionEntity?u:null}function Ai(d){if(d.type===f.BuiltInBaseEntity)return[d];const u=[...d.implements,...d.extends].reduce((i,a)=>a.type===f.BuiltInBaseEntity?[...i,a]:a.type===f.DefinitionEntity?[...i,...Ai(a)]:i,[]);return R(u)}function vp(d){return d.type===f.PrimitiveEntity?!0:d.type===f.BuiltInBaseEntity?d.interactive:!Ai(d).find(a=>!a.interactive)}function eye(d){return d.parent===d.project&&d.project.variableDeclarations.includes(d)}function Kb(d){return d.parent!==d.project?!1:f.VariableDeclaration===d.type?d.project.variableDeclarations.includes(d):f.VariableInstance===d.type?d.project.variableInstances.includes(d):f.FunctionCall===d.type?d.project.functionCalls.includes(d):f.Condition===d.type?d.project.conditions.includes(d):f.Operation===d.type?d.project.operations.includes(d):f.Loop===d.type?d.project.loops.includes(d):f.Search===d.type?d.project.searches.includes(d):!1}function jU(d){if([...Ht,f.DefinitionEntity,f.InstalledProject,f.Project].includes(d.type)||Kb(d))return!1;const u=Ja(d);return u.length===0?!0:u.some(i=>jU(i))}function kb(d){return[...Ht,f.DefinitionEntity,f.InstalledProject,f.Project].includes(d.type)||Kb(d)?!1:Ja(d).length===0}function UU(d,u=0){if(kb(d)){const i=Ja(d);return i.length===0?d:i.map(l=>UU(l,u+1)).reduce((l,p)=>l?p&&p.x<l.x?p:l:p,null)}return null}function xU(d){const u=[];if(kb(d))u.push(d);else return[];return Ja(d).forEach(a=>{u.push(...xU(a))}),u}function qb(d){return d.type===f.FunctionDeclaration&&d.parent!==d.project&&!![f.DefinitionEntity,f.Loop,f.InstalledProject].includes(d.parent.type)}function tye(d,u){const i=new Map;return d.forEach(a=>{i.set(a.id,a)}),u.forEach(a=>{i.set(a.id,a)}),Array.from(i.values())}function Ep(d){switch(d){case f.DefinitionEntity:return fa;case f.FunctionDeclaration:return Va;case f.VariableDeclaration:return Ua;case f.VariableInstance:return ja;case f.FunctionCall:return Za;case f.Operation:return Na;case f.Condition:return Ma;case f.ReturnStatement:return La;case f.Loop:return Ti;case f.Search:return xa;case f.InputMap:return Ds;case f.OutputMap:return Ys;case f.ArgumentDeclaration:return da;case f.ReturnDeclaration:return Pi;case f.Property:return oa;case f.InstalledProject:return Fa;case f.Project:return P;case f.DataType:return Ji;case f.GlobalEvent:return Ba;case f.InternalCall:return Ga;case f.ValueDescriptor:return zs;case f.BuiltInBaseEntity:return gn;case f.PrimitiveEntity:return Vi;case f.ActionDescriptor:return Ut;case f.LiteralValue:return Ei;case f.ContinueStatement:return ui;case f.BreakStatement:return Ka;default:return null}}function Ii(d,u,i=null){const a=d!=null&&d.parent?W(d==null?void 0:d.parent):null;let l=a?u.get(a):null,p=i||d;if(d.type===f.ReturnStatement)return Vr(d,u,p);if(d.type===f.FunctionDeclaration&&(l==null?void 0:l.type)===f.Loop)return l;if(Ht.includes(d.type))return d;if(d.type===f.Loop)return p.id===d.id?l:d;if(Fi.includes(d.type))return null;const t=d.parent;if(!t)return null;if(t.type===f.GenericReference){const y=W(t);if(!y)return null;const v=u.get(y);return v?Ii(v,u,p):null}else return t===u?u:Ii(t,u,p)}function Vr(d,u,i=null){const a=d!=null&&d.parent?W(d==null?void 0:d.parent):null;let l=a?u.get(a):null,p=i||d;if(d.type===f.FunctionDeclaration&&(l==null?void 0:l.type)===f.Loop)return Vr(l.parent,u,p);if(Ht.includes(d.type))return d;if(Fi.includes(d.type))return null;const t=d.parent;if(!t)return null;if(t.type===f.GenericReference){const y=W(t);if(!y)return null;const v=u.get(y);return v?Vr(v,u,p):null}else return t===u?u:Vr(t,u,p)}function Sb(d,u){if(Fi.includes(d.type)||u.getBuiltIn(d.id))return null;const i=wi(d.parent,u);return i?i===u?Ar.includes(d.type)?d:null:i.type===f.DefinitionEntity?d:Sb(i,u):null}function Cy(d,u,i){if(d===u||u===i||d===i)return!1;const a=Ii(u.parent,i);return a===d?!0:Cy(a,u,i)}var Oy=(d=>(d.SameBothLocal="same-both-local",d.AInB="a-in-b",d.BInA="b-in-a",d.ParallelInCommonParent="parallel-in-common-parent",d.ParallelInProject="parallel-in-project",d.AIsGlobalBIsNot="a-is-global-b-is-not",d.BIsGlobalAIsNot="b-is-global-a-is-not",d.SameBothGlobal="same-both-global",d))(Oy||{});function Tp(d,u,i){const a=Ii(d,i),l=Ii(u,i);if(!a)throw new Error("Could not find scope owner for the entity: "+d.id);if(!l)throw new Error("Could not find scope owner for the entity: "+u.id);if(a===l&&a.type!==f.Project)return{compatible:!0,type:"same-both-local",commonAncestorScope:a};if(a===l&&a.type===f.Project)return{compatible:!0,type:"same-both-global",commonAncestorScope:a};if(a.type===f.Project&&l.type!==f.Project)return{compatible:!1,type:"a-is-global-b-is-not",commonAncestorScope:a};if(a.type!==f.Project&&l.type===f.Project)return{compatible:!1,type:"b-is-global-a-is-not",commonAncestorScope:l};if(Cy(a,l,i))return{compatible:!0,type:"b-in-a",commonAncestorScope:a};if(Cy(l,a,i))return{compatible:!0,type:"a-in-b",commonAncestorScope:l};const y=Bb(a,l);return y===i?{compatible:!1,type:"parallel-in-project",commonAncestorScope:y}:y?{compatible:!1,type:"parallel-in-common-parent",commonAncestorScope:Ii(y,i)}:{compatible:!1,type:"parallel-in-project",commonAncestorScope:i}}function FU(d,u,i){const a=Tp(d,u,i);if(!a.compatible||a.type!=="same-both-local")return null;if(d===u)return d;let l=Ii(d.parent,i);if(l){if(l===u)return u;if(l.type===f.Project)return d}else return d;for(;l;){if(l){if(l===u)return u;if(l.type===f.Project)return d}else return d;l=Ii(l.parent,i)}let p=Ii(u.parent,i);if(p){if(p===d)return d;if(p.type===f.Project)return u}else return u;for(;p;){if(p){if(p===d)return d;if(p.type===f.Project)return u}else return u;p=Ii(p.parent,i)}return null}function GU(d){return d.length===0?null:d.length===1?d[0]:d.reduce((i,a)=>{const l=FU(i,a,a.project);return!l||l===a?i:a},d[0])}function wi(d,u){if(!d)return null;let i;return typeof d=="string"?i=d:d.type===f.GenericReference?i=W(d):i=d.id,i===u.id?u:u.get(i)}function Wa(d){if(!d)return null;if(Fi.includes(d.type))return d;if(d.type===f.Project)return null;if(d.project.getBuiltIn(d.id))return d;const u=d.parent;return!u||u.type===f.Project?null:Wa(u)}function bp(d){const u=[];function i(p,t){return u.some(y=>y.blockedByCaller===p&&y.blockedByCalling===t)}function a(p,t){i(p,t)||u.push({blockedByCaller:p,blockedByCalling:t})}const l=Sb(d,d.project);return d.calledBySuccess.forEach(p=>{[...p.successCalls||[]].forEach(v=>{ir.includes(v.type)&&v!==d&&(ct(d).find(A=>A===v)||a(p,v))});let y;if(Qt.includes(p.type)&&(y=p),y){const v=bp(y);v.reachable||ct(d).find(A=>A===p)||v.blocks.forEach(A=>{a(p,A.blockedByCalling)})}}),d.calledByError.forEach(p=>{[...p.errorCalls||[]].forEach(v=>{ir.includes(v.type)&&v!==d&&(ct(d).find(A=>A===v)||a(p,v))});let y;if(Qt.includes(p.type)&&(y=p),y){const v=bp(y);v.reachable||ct(d).find(A=>A===p)||v.blocks.forEach(A=>{a(p,A.blockedByCalling)})}}),d.calledByEntry.forEach(p=>{if([...p.calls||[]].forEach(v=>{ir.includes(v.type)&&v!==d&&(ct(d).find(A=>A===v)||a(p,v))}),p===l)return;let y;if(p.type===f.FunctionDeclaration){const v=cr(p);if(v.type===f.DefinitionEntity)return;v.type===f.Loop&&(y=v)}if(y){const v=bp(y);v.reachable||v.blocks.forEach(b=>{a(p,b.blockedByCalling)})}}),{reachable:u.length===0,entryPoint:l,blocks:u}}function rye(d){return Rf.includes(d.type)?d.type===f.FunctionDeclaration?!qb(d):!0:!1}function iye(d){if(f.ActionDescriptor===d.type){if(d.project.operationDeclarations.find(p=>p.id===d.id))return f.Operation;if(d.project.globalEventActionDescriptors.find(p=>p.id===d.id))return f.GlobalEvent;if(d.project.loopDeclarations.find(p=>p.id===d.id))return f.Loop;if(d.project.conditionDeclarations.find(p=>p.id===d.id))return f.Condition}return d.type}function $y(d,u){return d.type===f.BuiltInBaseEntity?d.name===u:!!mp(d).includes(u)}function sye(d,u){return d.type===f.BuiltInBaseEntity?d.name===u:!!yp(d).includes(u)}function Yi(d,u){return d.type===f.BuiltInBaseEntity?d.name===u:!!bd(d).includes(u)}function nye(d){const u=[];return d.entities.forEach(i=>{if($y(i,Oe.PERSISTED_ENTITY)){u.push(i);return}}),R(u)}function aye(d){const u=[];return d.entities.forEach(i=>{if($y(i,Oe.RELATIONAL_DATABASE)){u.push(i);return}}),R(u)}function oye(d){return d.type!==f.DefinitionEntity||d.abstract||!$y(d,Oe.PERSISTED_ENTITY)?null:(d==null?void 0:d.properties.find(i=>{var a;return((a=i.implements)==null?void 0:a.id)===ve[f.BuiltInBaseEntity][Oe.PERSISTED_ENTITY].properties.primaryKey.id&&!i.abstract}))||null}function KU(d){var a;const u=Gb(d);if(!u)return null;const i=u.properties.find(l=>{var p;return((p=l.implements)==null?void 0:p.id)===ve[f.BuiltInBaseEntity][Oe.PERSISTED_ENTITY].properties.database.id});return i?(a=i.getDefaultValue())==null?void 0:a.valueAsType:null}function Ad(d){if(d.type!==f.DefinitionEntity)return[];if(d.abstract)return[];if(!Yi(d,Oe.PERSISTED_ENTITY))return[];const u=[],i=d.properties.filter(a=>{var l;return((l=a.implements)==null?void 0:l.id)!==ve[f.BuiltInBaseEntity][Oe.PERSISTED_ENTITY].properties.database.id&&!a.abstract});return u.push(...i),u}function lye(d){var i;if(!d||d.type!==f.DefinitionEntity||!Yi(d,Oe.PERSISTED_ENTITY))return null;const u=d.properties.find(a=>{var l;return((l=a.implements)==null?void 0:l.id)===ve[f.BuiltInBaseEntity][Oe.PERSISTED_ENTITY].properties.database.id});return(i=u==null?void 0:u.getDefaultValue())==null?void 0:i.valueAsTypeSingle}function wr(d,u){var a;if(!FR.includes(u.type)||!d)return u.project||null;let i=u.project;return d.type===f.Project?i=d:((a=u.project)==null?void 0:a.id)!==d.project.id&&(i=d.project),i}function dye(d){switch(d){case f.Project:return P;case f.InstalledProject:return Fa;case f.DefinitionEntity:return fa;case f.FunctionDeclaration:return Va;case f.GlobalEvent:return Ba;case f.VariableInstance:return ja;case f.VariableDeclaration:return Ua;case f.InputMap:return Ds;case f.OutputMap:return Ys;case f.Condition:return Ma;case f.Operation:return Na;case f.FunctionCall:return Za;case f.ReturnDeclaration:return Pi;case f.ArgumentDeclaration:return da;case f.PrimitiveEntity:return Vi;case f.DataType:return Ji;case f.Property:return oa;case f.ActionDescriptor:return Ut;case f.ReturnStatement:return La;case f.ContinueStatement:return ui;case f.BreakStatement:return Ka;case f.Loop:return Ti;case f.Search:return xa;case f.ValueDescriptor:return zs;case f.InternalCall:return Ga;case f.LiteralValue:return Ei}return null}function uye(d){const u={added:{},updated:{},removed:{},affected:[],seenEntities:[],self:d==null?void 0:d.self};return d==null||d.added.forEach(i=>{u.added[i.id]=i}),d==null||d.updated.forEach(i=>{u.updated[i.id]=i}),d==null||d.removed.forEach(i=>{u.removed[i.id]=i}),u.affected=Array.from(new Set(d==null?void 0:d.affected.map(i=>i.id))),u}function Tr(d,u){const i=Ep(d.type);return i?!i.MUTABLE_META_PROPERTIES.every(l=>{const p=d[l],t=u[l];return t===void 0||p===t?!0:Array.isArray(p)&&Array.isArray(t)?p.length!==t.length?!1:p.every((y,v)=>y===t[v]):!1}):!1}function Py(d,u={}){if(d.type===f.Project)return[];if(!d.parent)return[];const i=W(d.parent);if(!i)return[];const a=u[i];return a?[a.id,...Py(a,u)]:[]}function cye(d){const u=[],i=new Set;return[...d.listAdded,...d.listUpdated,...d.listAffected].forEach(a=>{const l=cr(a);!l||i.has(l.id)||(i.add(l.id),u.push(l))}),R(u)}function pye(d){if(d.type===f.Condition)return null;if(d.type===f.Search)return d.project.getBuiltIn(ve["value-descriptor"][Il.SearchErrorOutputDescriptor].id)||null;if(d.type===f.Operation)return d.declaration.error;if(d.type===f.FunctionCall){const i=d.declaration.returnStatements.find(a=>!!a.throws);return(i==null?void 0:i.throws)||null}return null}function kU(d){const u=d.entities.filter(l=>!!l.implements.find(p=>p.id===ve["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)),i=u.find(l=>{const p=l.properties.find(v=>v.implements&&v.implements.id===ve["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),t=p==null?void 0:p.getDefaultValue();return(t==null?void 0:t.value)===!0});return i||u[0]||null}function Zb(d,u){const i=Array.from(new Set([...u.getAllBuiltInIds(),...Os()]));return!!(i.includes(d.id)||!Py(d,{...u.instances,...u.builtInInstances}).every(p=>!i.includes(p)))}function qU(d){if(!d)return null;if(d.type===f.Project)return d.id;const u=d.parent;return u?qU(u):d.id}function SU(d){const u=rue(),i=d.toJSON();u.safeParse(i).success;const l=d.implements.flatMap(w=>fye(d,w)),p=d.extends.flatMap(w=>hye(d,w)),t=mye(d),y=yye(d);d.methods.flatMap(w=>w.validate());const v=[...l,...p,...t,...y];return Xt(d.errors,v)}function ZU(d,u){const i=u.properties.filter(p=>p.abstract),a=[];let l=[...d.properties];return i.forEach(p=>{const t=l.find(y=>{var v;return((v=y.implements)==null?void 0:v.id)===p.id});t?l=l.filter(y=>y.id!==t.id):a.push(p)}),a}function JU(d,u){const i=u.abstractMethods,a=[];let l=[...d.methods];return i.forEach(p=>{const t=l.find(y=>{var v;return((v=y.implements)==null?void 0:v.id)===p.id});t?l=l.filter(y=>y.id!==t.id):a.push(p)}),a}function fye(d,u){const i=[];if(!u.abstract){const w=nt({id:d.id+"--"+se.ImplementingNonAbstractEntity,message:`Entity "${d.name}" with id "${d.id}" is implementing a non-abstract entity "${u.name}" with id "${u.id}"`,issue:null,severity:Z.Error,code:se.ImplementingNonAbstractEntity,entity:d});return i.push(w.error),i}const a=u.properties.filter(w=>w.abstract),l=[];let p=[...d.properties];a.forEach(w=>{const A=p.find(V=>{var L;return((L=V.implements)==null?void 0:L.id)===w.id});A?p=p.filter(V=>V.id!==A.id):l.push(w)}),l.length&&l.forEach(w=>{const A=nt({id:d.id+"--"+se.MissingPropertyImplementation+"--"+w.id,message:`Property "${w.name}" with id "${w.id}" of entity "${u.name}" with id "${u.id}" is not implemented when entity "${d.name}" with id "${d.id}" implements it`,issue:null,severity:Z.Error,code:se.MissingPropertyImplementation,entity:d});i.push(A.error)});const t=[];let y=[...d.methods];u.abstractMethods.forEach(w=>{const A=y.find(V=>{var L;return((L=V.implements)==null?void 0:L.id)===w.id});A?y=y.filter(V=>V.id!==A.id):t.push(w)}),t.length&&t.forEach(w=>{const A=nt({id:d.id+"--"+se.MissingMethodImplementation+"--"+w.id,message:`Method "${w.name}" with id "${w.id}" of entity "${u.name}" with id "${u.id}" is not implemented when entity "${d.name}" with id "${d.id}" implements it`,issue:null,severity:Z.Error,code:se.MissingMethodImplementation,entity:d});i.push(A.error)});const v=[];u.properties.forEach(w=>{const A=p.find(V=>V.name===w.name);A&&v.push([A,w])}),v.length&&v.forEach(([w])=>{const A=nt({id:d.id+"--"+oe.PropertyOverwritesOtherSiblingWithSameName+"--"+w.id,message:`Property "${w.name}" with id "${w.id}" of entity "${d.name}" with id "${d.id}" overwrites the property with the same name from the base entity "${u.name}" with id "${u.id}"`,issue:null,severity:Z.Error,code:oe.PropertyOverwritesOtherSiblingWithSameName,entity:d});i.push(A.error)});const b=[];return u.methods.forEach(w=>{const A=y.find(V=>V.name===w.name);A&&b.push([A,w])}),b.length&&b.forEach(([w])=>{const A=nt({id:d.id+"--"+oe.MethodOverwritesOtherSiblingWithSameName+"--"+w.id,message:`Method "${w.name}" with id "${w.id}" of entity "${d.name}" with id "${d.id}" overwrites the method with the same name from the base entity "${u.name}" with id "${u.id}"`,issue:null,severity:Z.Error,code:oe.MethodOverwritesOtherSiblingWithSameName,entity:d});i.push(A.error)}),i}function hye(d,u){const i=[],a=[];if(!d.abstract&&u.abstract){const p=nt({id:d.id+"--"+u.id+"--"+se.NonAbstractExtendingAbstractEntity,message:`Entity "${d.name}" with id "${d.id}" is not-abstract but is extending an abstract entity "${u.name}" with id "${u.id}"`,issue:null,severity:Z.Error,code:se.NonAbstractExtendingAbstractEntity,entity:d,firstRelationship:u});return i.push(p.error),i}if(d.abstract&&!u.abstract){const p=nt({id:d.id+"--"+u.id+"--"+se.AbstractExtendingNonAbstractEntity,message:`Entity "${d.name}" with id "${d.id}" is abstract but is extending an non-abstract entity "${u.name}" with id "${u.id}"`,issue:null,severity:Z.Error,code:se.AbstractExtendingNonAbstractEntity,entity:d,firstRelationship:u});return i.push(p.error),i}d.properties.forEach(p=>{var y;const t=u.properties.find(v=>{var b;return v.name===p.name&&((b=p.extends)==null?void 0:b.id)!==v.id});((y=p.implements)==null?void 0:y.id)!==(t==null?void 0:t.id)&&t&&a.push(p)}),a.length&&a.forEach(p=>{const t=nt({id:d.id+"--"+oe.PropertyOverwritesOtherSiblingWithSameName,message:`Property "${p.name}" with id "${p.id}" of entity "${d.name}" with id "${d.id}" overwrites the property with the same name from the extended entity "${u.name}" with id "${u.id}"`,issue:null,severity:Z.Error,code:oe.PropertyOverwritesOtherSiblingWithSameName,entity:d});i.push(t.error)});const l=[];return d.methods.forEach(p=>{var y;const t=u.methods.find(v=>{var b;return v.name===p.name&&((b=p.extends)==null?void 0:b.id)!==v.id});((y=p.implements)==null?void 0:y.id)!==(t==null?void 0:t.id)&&t&&l.push(p)}),l.length&&l.forEach(p=>{const t=nt({id:d.id+"--"+oe.MethodOverwritesOtherSiblingWithSameName,message:`Method "${p.name}" with id "${p.id}" of entity "${d.name}" with id "${d.id}" overwrites the method with the same name from the extended entity "${u.name}" with id "${u.id}"`,issue:null,severity:Z.Error,code:oe.MethodOverwritesOtherSiblingWithSameName,entity:d});i.push(t.error)}),i}function yye(d){const u=[];if(!d.properties.length){const i=nt({id:d.id+"--"+se.NoProperties,message:"No properties implemented",issue:null,severity:Z.Warning,code:se.NoProperties,entity:d});u.push(i.error)}return d.properties.forEach(i=>{i.validate()}),u}function mye(d){const u=[];if(d.abstract){if(d.methods.length){const i=nt({id:d.id+"--"+se.AbstractEntityWithNonAbstractMethods,message:`Entity "${d.name}" with id "${d.id}" is marked as abstract but has non-abstract methods`,issue:null,severity:Z.Error,code:se.AbstractEntityWithNonAbstractMethods,entity:d});u.push(i.error)}if(d.properties.some(i=>!i.abstract)){const i=nt({id:d.id+"--"+se.AbstractEntityWithNonAbstractProperties,message:`Entity "${d.name}" with id "${d.id}" is marked as abstract but has non-abstract properties`,issue:null,severity:Z.Error,code:se.AbstractEntityWithNonAbstractProperties,entity:d});u.push(i.error),d.properties.forEach(a=>{if(!a.abstract){const l=nt({id:d.id+"--"+se.StaticEntityWithNonStaticProperties+"--"+a.id,message:`Property "${a.name}" with id "${a.id}" of entity "${d.name}" with id "${d.id}" is not marked as abstract but the entity is marked as abstract`,issue:null,severity:Z.Error,code:se.StaticEntityWithNonStaticProperties,entity:d});u.push(l.error)}})}}else{if(d.abstractMethods.length){const i=nt({id:d.id+"--"+se.AbstractPropertyInNonAbstractEntity,message:`Entity "${d.name}" with id "${d.id}" is not marked as abstract but has abstract methods`,issue:null,severity:Z.Error,code:se.AbstractPropertyInNonAbstractEntity,entity:d});u.push(i.error)}d.properties.some(i=>i.abstract)&&d.properties.forEach(i=>{if(i.abstract){const a=nt({id:d.id+"--"+se.AbstractPropertyInNonAbstractEntity+"--"+i.id,message:`Property "${i.name}" with id "${i.id}" of entity "${d.name}" with id "${d.id}" is marked as abstract but the entity is not marked as abstract`,issue:null,severity:Z.Error,code:se.AbstractPropertyInNonAbstractEntity,entity:d,firstRelationship:i});u.push(a.error)}})}return d.static&&d.properties.some(i=>!i.static)&&d.properties.forEach(i=>{if(!i.static){const a=nt({id:d.id+"--"+se.NonStaticPropertyInStaticEntity+"--"+i.id,message:`Property "${i.name}" with id "${i.id}" of entity "${d.name}" with id "${d.id}" is not marked as static but the entity is marked as static`,issue:null,severity:Z.Error,code:se.NonStaticPropertyInStaticEntity,entity:d,firstRelationship:i});u.push(a.error)}}),u}function vye(d,u){const i=[],a=Ai(u);if(!u.abstract){const t=new St({id:d.id+"--"+u.id+"--"+se.ImplementingNonAbstractEntity,message:`Entity "${d.name}" with id "${d.id}" is implementing a non-abstract built-in entity "${u.name}" with id "${u.id}"`,issue:null,severity:Z.Error,code:se.ImplementingNonAbstractEntity,entity:d,firstRelationship:u});i.push(t)}const l=d.implements.filter(t=>t.id!==u.id);if(d.abstract){const t=new St({id:d.id+"--"+u.id+"--"+se.AbstractEntityImplements,message:`Entity "${d.name}" with id "${d.id}" is marked as abstract and cannot implement built-in entity "${u.name}" with id "${u.id}"`,issue:null,severity:Z.Error,code:se.AbstractEntityImplements,entity:d,firstRelationship:u});i.push(t)}if(d.static&&!u.static){const t=new St({id:d.id+"--"+u.id+"--"+se.StaticImplementingNonStaticEntity,message:`Entity "${d.name}" with id "${d.id}" is marked as static and cannot implement non-static built-in entity "${u.name}" with id "${u.id}"`,issue:null,severity:Z.Error,code:se.StaticImplementingNonStaticEntity,entity:d,firstRelationship:u});i.push(t)}if(!d.static&&u.static){const t=new St({id:d.id+"--"+u.id+"--"+se.NonStaticImplementingStaticEntity,message:`Entity "${d.name}" with id "${d.id}" is not marked as static and cannot implement static built-in entity "${u.name}" with id "${u.id}"`,issue:null,severity:Z.Error,code:se.NonStaticImplementingStaticEntity,entity:d,firstRelationship:u});i.push(t)}return l.length&&l.forEach(t=>{if(t.type===f.BuiltInBaseEntity){const y=a.filter(v=>v.id!==t.id);y.length&&y.forEach(v=>{if(v.id!==t.id){const b=new St({id:d.id+"--"+v.id+"--"+t.id+"--"+se.ImplementsIncompatibleEntities,message:`Entity "${d.name}" with id "${d.id}" is implementing built-in entity "${v.name}" with id "${v.id}" but also implements entity "${t.name}" with id "${t.id}" which is incompatible`,issue:null,severity:Z.Error,code:se.ImplementsIncompatibleEntities,entity:d,firstRelationship:v,secondRelationship:t});i.push(b)}})}else{Ai(t).forEach(w=>{const A=a.filter(V=>V.id!==w.id);A.length&&A.forEach(V=>{if(V.id!==w.id){const L=new St({id:d.id+"--"+V.id+"--"+w.id+"--"+se.ImplementsIncompatibleEntities,message:`Entity "${d.name}" with id "${d.id}" is implementing built-in entity "${V.name}" with id "${V.id}" but also implements entity "${w.name}" with id "${w.id}" which is incompatible`,issue:null,severity:Z.Error,code:se.ImplementsIncompatibleEntities,entity:d,firstRelationship:V,secondRelationship:w});i.push(L)}})});const v=pa(u.ownDeclaredProperties,t.ownDeclaredProperties,oe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation,oe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameName);i.push(...v.errors);const b=pa(u.abstractMethods,[...t.abstractMethods,...t.methods],oe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation,oe.MethodOverwritesOtherImplementedEntitysMethodWithSameName);i.push(...b.errors)}}),R(d.extends.flatMap(t=>Ai(t))).forEach(t=>{if(!a.find(y=>y.id===t.id)){const y=new St({id:d.id+"--"+u.id+"--"+t.id+"--"+se.ExtendsIncompatibleEntities,message:`Entity "${d.name}" with id "${d.id}" is implementing built-in entity "${u.name}" with id "${u.id}" but also extends entity "${t.name}" with id "${t.id}" which is incompatible`,issue:null,severity:Z.Error,code:se.ExtendsIncompatibleEntities,entity:d,firstRelationship:u,secondRelationship:t});i.push(y)}}),i}function Eye(d,u,i=!1){const a=[],l=Ai(u);if(!d.abstract&&u.abstract){const w=nt({id:d.id+"--"+u.id+"--"+se.NonAbstractExtendingAbstractEntity,message:`Entity "${d.name}" with id "${d.id}" is not-abstract but is extending an abstract entity "${u.name}" with id "${u.id}"`,issue:null,severity:Z.Error,code:se.NonAbstractExtendingAbstractEntity,entity:d,firstRelationship:u});a.push(w.error)}if(d.abstract&&!u.abstract){const w=nt({id:d.id+"--"+u.id+"--"+se.AbstractExtendingNonAbstractEntity,message:`Entity "${d.name}" with id "${d.id}" is abstract but is extending an non-abstract entity "${u.name}" with id "${u.id}"`,issue:null,severity:Z.Error,code:se.AbstractExtendingNonAbstractEntity,entity:d,firstRelationship:u});a.push(w.error)}if(!d.static&&u.static){const w=nt({id:d.id+"--"+u.id+"--"+se.NonStaticExtendingStaticEntity,message:`Entity "${d.name}" with id "${d.id}" is not static but is extending a static entity "${u.name}" with id "${u.id}"`,issue:null,severity:Z.Error,code:se.NonStaticExtendingStaticEntity,entity:d,firstRelationship:u});a.push(w.error)}if(d.static&&!u.static){const w=nt({id:d.id+"--"+u.id+"--"+se.StaticExtendingNonStaticEntity,message:`Entity "${d.name}" with id "${d.id}" is static but is extending an non-static entity "${u.name}" with id "${u.id}"`,issue:null,severity:Z.Error,code:se.StaticExtendingNonStaticEntity,entity:d,firstRelationship:u});a.push(w.error)}if(!vp(u)){const w=nt({id:d.id+"--"+u.id+"--"+se.ExtendingNonInteractiveEntity,message:`Entity "${d.name}" with id "${d.id}" is extending an non-interactive entity "${u.name}" with id "${u.id}"`,issue:null,severity:Z.Error,code:se.ExtendingNonInteractiveEntity,entity:d,firstRelationship:u});a.push(w.error)}const t=d.extends.filter(w=>w.id!==u.id);t.length&&t.forEach(w=>{if(w.type===f.BuiltInBaseEntity){const A=l.filter(V=>V.id!==w.id);A.length&&A.forEach(V=>{if(V.id!==w.id){const L=nt({id:d.id+"--"+V.id+"--"+w.id+"--"+se.ExtendsIncompatibleEntities,message:`Entity "${d.name}" with id "${d.id}" is extending built-in entity "${V.name}" with id "${V.id}" but also extends entity "${w.name}" with id "${w.id}" which is incompatible`,issue:null,severity:Z.Error,code:se.ExtendsIncompatibleEntities,entity:d,firstRelationship:V,secondRelationship:w});a.push(L.error)}})}else{Ai(w).forEach(H=>{const ie=l.filter(te=>te.id!==H.id);ie.length&&ie.forEach(te=>{if(te.id!==H.id){const pe=new St({id:d.id+"--"+te.id+"--"+H.id+"--"+se.ImplementsIncompatibleEntities,message:`Entity "${d.name}" with id "${d.id}" is extending built-in entity "${te.name}" with id "${te.id}" but also extends or implements entity "${H.name}" with id "${H.id}" which is incompatible`,issue:null,severity:Z.Error,code:se.ImplementsIncompatibleEntities,entity:d,firstRelationship:te,secondRelationship:H});a.push(pe)}})});const V=!!Ai(w).find(H=>H.id===u.id);let L=[...w.properties];V&&(L=L.filter(H=>!u.properties.find(ie=>{var te;return ie.id===H.id||ie.name===H.name||ie.id===((te=H.implements)==null?void 0:te.id)})));let U=[...w.methods];V&&(U=U.filter(H=>!u.methods.find(ie=>{var te;return ie.id===H.id||ie.name===H.name||ie.id===((te=H.implements)==null?void 0:te.id)})));const k=pa(u.ownDeclaredProperties,L,oe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation,oe.PropertyOverwritesOtherExtendedEntitysPropertyWithSameName);a.push(...k.errors);const q=pa(u.abstractMethods,U,oe.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation,oe.MethodOverwritesOtherExtendedEntitysMethodWithSameName);a.push(...q.errors)}}),i&&console.log("self.implements.length",d.implements.length),d.implements.length&&d.implements.forEach(w=>{if(w.type===f.BuiltInBaseEntity){const A=l.filter(V=>V.id!==w.id);A.length&&A.forEach(V=>{if(V.id!==w.id){const L=new St({id:d.id+"--"+V.id+"--"+w.id+"--"+se.ImplementsIncompatibleEntities,message:`Entity "${d.name}" with id "${d.id}" is implementing built-in entity "${V.name}" with id "${V.id}" but also implements entity "${w.name}" with id "${w.id}" which is incompatible`,issue:null,severity:Z.Error,code:se.ImplementsIncompatibleEntities,entity:d,firstRelationship:V,secondRelationship:w});a.push(L)}})}else{Ai(w).forEach(U=>{const k=l.filter(q=>q.id!==U.id);k.length&&k.forEach(q=>{if(q.id!==U.id){const H=new St({id:d.id+"--"+q.id+"--"+U.id+"--"+se.ImplementsIncompatibleEntities,message:`Entity "${d.name}" with id "${d.id}" is implementing built-in entity "${q.name}" with id "${q.id}" but also implements entity "${U.name}" with id "${U.id}" which is incompatible`,issue:null,severity:Z.Error,code:se.ImplementsIncompatibleEntities,entity:d,firstRelationship:q,secondRelationship:U});a.push(H)}})});const V=pa(u.ownDeclaredProperties,w.ownDeclaredProperties,oe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation,oe.PropertyOverwritesOtherImplementedEntitysPropertyWithSameName);a.push(...V.errors);const L=pa(u.abstractMethods,[...w.abstractMethods,...w.methods],oe.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation,oe.MethodOverwritesOtherImplementedEntitysMethodWithSameName);a.push(...L.errors)}});const y=pa(d.ownDeclaredProperties,u.ownDeclaredProperties,oe.PropertyOverwritesOtherSiblingWithSameImplementation,oe.PropertyOverwritesOtherSiblingWithSameName);a.push(...y.errors);const v=pa(u.methods,u.abstractMethods,oe.MethodOverwritesOtherSiblingWithSameImplementation,oe.MethodOverwritesOtherSiblingWithSameName);return a.push(...v.errors),R(d.extends.flatMap(w=>Ai(w))).forEach(w=>{if(!l.find(A=>A.id===w.id)){const A=new St({id:d.id+"--"+u.id+"--"+w.id+"--"+se.ImplementsIncompatibleEntities,message:`Entity "${d.name}" with id "${d.id}" is extending built-in entity "${u.name}" with id "${u.id}" but also extends entity "${w.name}" with id "${w.id}" which is incompatible`,issue:null,severity:Z.Error,code:se.ImplementsIncompatibleEntities,entity:d,firstRelationship:u,secondRelationship:w});a.push(A)}}),a}function Tye(d){const u=[];return d.implements.forEach(i=>{if(!i.static){const a=new St({id:d.id+"--"+i.id+"--"+se.StaticImplementingNonStaticEntity,message:`Entity "${d.name}" with id "${d.id}" is static but implements entity "${i.name}" with id "${i.id}" which is non-static`,issue:null,severity:Z.Error,code:se.StaticImplementingNonStaticEntity,entity:d,firstRelationship:i});u.push(a)}}),d.extends.forEach(i=>{if(!i.static){const a=new St({id:d.id+"--"+i.id+"--"+se.StaticExtendingNonStaticEntity,message:`Entity "${d.name}" with id "${d.id}" is static but extends entity "${i.name}" with id "${i.id}" which is non-static`,issue:null,severity:Z.Error,code:se.StaticExtendingNonStaticEntity,entity:d,firstRelationship:i});u.push(a)}}),u}function bye(d){const u=[];if(d.implements.length){const i=new St({id:d.id+"--"+se.AbstractEntityImplements,message:`Entity "${d.name}" with id "${d.id}" cannot be marked as abstract because it implements other entities`,issue:null,severity:Z.Error,code:se.AbstractEntityImplements,entity:d});u.push(i)}return d.extends.forEach(i=>{if(!i.abstract){const a=new St({id:d.id+"--"+i.id+"--"+se.AbstractExtendingNonAbstractEntity,message:`Entity "${d.name}" with id "${d.id}" is abstract but extends entity "${i.name}" with id "${i.id}" which is non-abstract`,issue:null,severity:Z.Error,code:se.AbstractExtendingNonAbstractEntity,entity:d,firstRelationship:i});u.push(a)}}),u}function Aye(d){const u=[];return d.extends.forEach(i=>{if(i.static){const a=new St({id:d.id+"--"+i.id+"--"+se.NonStaticExtendingStaticEntity,message:`Entity "${d.name}" with id "${d.id}" is non-static but extends entity "${i.name}" with id "${i.id}" which is static`,issue:null,severity:Z.Error,code:se.NonStaticExtendingStaticEntity,entity:d,firstRelationship:i});u.push(a)}}),u}function Iye(d){const u=[];return d.extends.forEach(i=>{if(i.abstract){const a=new St({id:d.id+"--"+i.id+"--"+se.NonAbstractExtendingAbstractEntity,message:`Entity "${d.name}" with id "${d.id}" is non-abstract but extends entity "${i.name}" with id "${i.id}" which is abstract`,issue:null,severity:Z.Error,code:se.NonAbstractExtendingAbstractEntity,entity:d,firstRelationship:i});u.push(a)}}),u}const wye=Object.freeze(Object.defineProperty({__proto__:null,getBaseMethodsNotImplemented:JU,getBasePropertiesNotImplemented:ZU,validate:SU,validateCanBecomeAbstract:bye,validateCanBecomeNonAbstract:Iye,validateCanBecomeNonStatic:Aye,validateCanBecomeStatic:Tye,validateCanExtendEntity:Eye,validateCanImplementEntity:vye},Symbol.toStringTag,{value:"Module"}));function Rye(d,u){const i=[];if(d.parent)if(d.id===d.parent)i.push(new Q({id:`${d.id}--${d.parent}--${S.SelfReference}`,code:S.SelfReference,severity:Z.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.`,issue:null}));else{const a=u.get(d.parent);a?[f.Project,f.DataType].includes(a.type)||i.push(new Q({id:`${d.id}--${d.parent}--${S.InvalidParentReference}`,code:S.InvalidParentReference,severity:Z.Error,message:`Entity of type "${d.type}" with id "${d.id}", has a parent reference that isn't pointing to an entity of type 'project' or 'data-type'.`,issue:null})):i.push(new Q({id:`${d.id}--${d.parent}--${S.ReferencedEntityNotFound}`,code:S.ReferencedEntityNotFound,severity:Z.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.`,issue:null}))}return d.implements&&Array.isArray(d.implements)?d.implements.forEach(a=>{if(d.id===a){i.push(new Q({id:`${d.id}--${a}--${S.SelfReference}`,code:S.SelfReference,severity:Z.Error,message:`Entity of type "${d.type}" with id "${d.id}", has a reference to itself at one of the 'implements' references. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));return}const l=u.get(a);l?[f.DefinitionEntity,f.BuiltInBaseEntity].includes(l.type)?l.abstract||i.push(new Q({id:`${d.id}--${a}--${S.InvalidImplementsReference}`,code:S.InvalidImplementsReference,severity:Z.Error,message:`Entity of type "${d.type}" with id "${d.id}", has an 'implements' reference that isn't pointing to an abstract entity.`,issue:null})):i.push(new Q({id:`${d.id}--${a}--${S.InvalidImplementsReference}`,code:S.InvalidImplementsReference,severity:Z.Error,message:`Entity of type "${d.type}" with id "${d.id}", has an 'implements' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):i.push(new Q({id:`${d.id}--${a}--${S.ReferencedEntityNotFound}`,code:S.ReferencedEntityNotFound,severity:Z.Error,message:`Entity of type "${d.type}" with id "${d.id}", is referencing an entity with id "${a}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}):i.push(new Q({id:`${d.id}--${oe.InvalidObjectStructure}`,code:oe.InvalidObjectStructure,severity:Z.Error,message:`Entity of type "${d.type}" with id "${d.id}", has an 'implements' property that isn't an array.`,issue:null})),d.extends&&Array.isArray(d.extends)&&d.extends.forEach(a=>{const l=u.get(a);l?[f.DefinitionEntity,f.BuiltInBaseEntity].includes(l.type)?l.abstract&&i.push(new Q({id:`${d.id}--${a}--${S.InvalidExtendsReference}`,code:S.InvalidExtendsReference,severity:Z.Error,message:`Entity of type "${d.type}" with id "${d.id}", has an 'extends' reference that isn't pointing to a non-abstract entity. Did you want to use the property 'implements', which holds a list of references to absract entities, instead?`,issue:null})):i.push(new Q({id:`${d.id}--${a}--${S.InvalidExtendsReference}`,code:S.InvalidExtendsReference,severity:Z.Error,message:`Entity of type "${d.type}" with id "${d.id}", has an 'extends' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):i.push(new Q({id:`${d.id}--${a}--${S.ReferencedEntityNotFound}`,code:S.ReferencedEntityNotFound,severity:Z.Error,message:`Entity of type "${d.type}" with id "${d.id}", is referencing an entity with id "${a}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}),i}var Vy=(d=>(d.Extends="extends",d.Implements="implements",d))(Vy||{});const $t=class $t extends yr{constructor(i,a){super(i);D(this,"initialData");D(this,"id");D(this,"name");D(this,"codeName",null);D(this,"description",null);D(this,"x");D(this,"y");D(this,"static");D(this,"abstract");D(this,"type",f.DefinitionEntity);D(this,"properties",[]);D(this,"methods",[]);D(this,"abstractMethods",[]);D(this,"extends",[]);D(this,"implements",[]);D(this,"project");D(this,"errors",[]);D(this,"parent");D(this,"detachedDependents",{});D(this,"knownVersions",null);D(this,"activeVersion",!1);D(this,"initialized",!1);D(this,"startedInitialization",!1);D(this,"suggestedProperties",[]);D(this,"suggestedMethods",[]);this.initialData=i,this.project=a,this.id=i.id,this.name=i.name,this.description=i.description,this.x=i.x,this.y=i.y,this.codeName=i.codeName,this.static=i.static,this.abstract=i.abstract}static new(i=null){return{id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||N().toISOString(),author:(i==null?void 0:i.author)||P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DefinitionEntity,name:"",codeName:null,description:"",static:!1,abstract:!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[],x:0,y:0,parent:null}}static fromGenerationTarget(i,a){let l=a;if(i.parent){const b=W(i.parent);l=a.get(b)}const p=[];i.implements&&i.implements.forEach(b=>{p.push(a.get(b)||a.getBuiltIn(b))});const t=[];i.extends&&i.extends.forEach(b=>{t.push(a.get(b)||a.getBuiltIn(b))});const y={id:i.id,version:P.UUID.uuid(),createdAt:N().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,name:i.name,type:f.DefinitionEntity,codeName:i.codeName||null,description:i.description,static:i.static,abstract:i.abstract,properties:[],methods:[],abstractMethods:[],extends:t,implements:p,x:0,y:0,parent:l},v=ee(y,a);return v.setParent(l,null),v}static validateGenerationTarget(i,a){let l=JSON.parse(JSON.stringify(i));const p=[],t=Rye(l,a),y=xT(l,a);p.push(...t,...y,...Er(l));const v=l.parent?a.get(l.parent):null;if(v&&v.type===f.DataType){const b=v;b.entity&&p.push(new Q({id:`${i.id}--${S.NewEntityWouldOverriteExisting}`,code:S.NewEntityWouldOverriteExisting,severity:Z.Error,message:`The entity of type '${i.type}' with id '${i.id}' can't be added to the 'parent' entity with id '${b.id}' because it already has an 'entity' child. Data type entities can only have one 'entity' as children.
|
|
401
401
|
You can inspect the existing 'entity' field with the 'describe_entity' action. Like so:
|
|
402
402
|
${_n({describe_entity:b.entity.id})}
|
|
403
|
-
Alternatively you can update the parent data-type entity with 'update' action to remove the existing value of the field.`,issue:null}))}return{errors:p,modifiedData:l}}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 l=[...a.ownDeclaredProperties,...a.extendedPropertiesFromOriginalParents].filter(p=>!p.abstract);return[...i,...l]},[]))}get implementedPropertiesFromOriginalParents(){return R([...this.extends.reduce((i,a)=>{const l=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(t=>!!t.abstract&&!l.find(y=>y.name===t.name));return[...l,...p,...i]},[]),...this.implements.reduce((i,a)=>{const l=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(t=>!!t.abstract&&!l.find(y=>y.name===t.name));return[...l,...p,...i]},[])].filter(i=>!!i.abstract))}get extendedMethodsFromOriginalParents(){return R(this.extends.reduce((i,a)=>{if(a.type!==f.DefinitionEntity)return[];const l=[...a.ownDeclaredMethods,...a.extendedMethodsFromOriginalParents].filter(p=>p.type!==f.ActionDescriptor);return[...i,...l]},[]))}get implementedMethodsFromOriginalParents(){return R([...this.extends.reduce((i,a)=>{const l=a.type===f.DefinitionEntity?a.methods:[],p=[...a.abstractMethods].filter(t=>!l.find(y=>y.name===t.name));return[...l,...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 Q({id:`${this.id}--${S.InvalidParentUpdate}`,code:S.InvalidParentUpdate,severity:Z.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on an '${this.type}', must be the root project as it is a globally declared entity.`,issue:null})),{errors: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,P.sessionAuthor,N().toISOString(),this,!0,"sync-dependents"))){const a=[],l=[],p=[],t=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),l.push(...v.added),p.push(...v.removed),t.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}onDetachedDependencyRemoved(i,a,l){const p=[],t=[],y=[],v=[];return a==="implements"&&this.removeImplementation(i),a==="extends"&&this.removeExtension(i),{updated:R(p),added:R(t),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,l){const p=[],t=[],y=[],v=[];return a==="implements"&&this.addImplementation(i),a==="extends"&&this.addExtension(i),{updated:R(p),added:R(t),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){return this.implements.forEach(i=>{Fi.includes(i.type)||i.unsubscribeDependents([{entity:this,field:"implements"}])}),this}subscribeToDependencies(){return this.implements.forEach(i=>{Fi.includes(i.type)||i.subscribeDependents([{entity:this,field:"implements"}])}),this.extends.forEach(i=>{Fi.includes(i.type)||i.subscribeDependents([{entity:this,field:"extends"}])}),this}increaseVersion(i){if(i&&!N(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&N(i).isSame(N(this.createdAt))?this:(this.previousVersion=this.version,this.version=P.UUID.uuid(),this.createdAt=N(i).toISOString()||N().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new $t(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=[],l=[],p=[],t=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),l.push(...y.added),p.push(...y.removed)}return{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}async restoreVersion(i){var v;const a=[],l=[],p=[],t=[];if(this.version===i)return{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this};if(!this.knownVersions){const b=new Map;for(const[w,A]of this.knownVersions||new Map){if(b.set(w,A),A.activeVersion=!1,A.knownVersions)for(const[V,L]of A.knownVersions)b.set(V,L);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const b=await this.APILoadVersion({},i);if(!b)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new $t(b,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(l),removed:R(p),affected:R(t),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().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 l=W(i.parent),p=this.project.get(l),t=this.parent;if(t&&t.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 '${l}' 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(l=>{const p=W(l),t=this.project.get(p);t&&this.addExtension(t)}),i.implements.forEach(l=>{const p=W(l),t=this.project.get(p);t&&this.addImplementation(t)}),this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const i=[],a=[],l=[],p=[];if(this.initialData.parent){const t=W(this.initialData.parent),y=this.project.get(t);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${t}' 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(t=>{const y=W(t),v=this.project.get(y);v&&(this.addExtension(v),v.type!==f.BuiltInBaseEntity&&i.push(v))}),this.initialData.implements.forEach(t=>{const y=W(t),v=this.project.get(y);v&&(this.addImplementation(v),v.type!==f.BuiltInBaseEntity&&i.push(v))}),{updated:R(i),added:R(a),removed:R(l),affected:R(p),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],l=[],p=[],t=[];this.initialized=!0;const{updated:y,added:v,removed:b,affected:w}=this.syncImplementationProperties(i);a.push(...y),l.push(...v),p.push(...b),t.push(...w);const{updated:A,added:V,removed:L,affected:U}=this.addExtendedProperties(i);a.push(...A),l.push(...V),p.push(...L),t.push(...U);const{updated:k,added:q,removed:H}=this.removeUnrecognizedProperties(i);a.push(...k),l.push(...q),p.push(...H);const{updated:ie,added:te,removed:pe,affected:ne}=this.syncImplementationMethods(i);a.push(...ie),l.push(...te),p.push(...pe),t.push(...ne);const{updated:me,added:J,removed:ae,affected:ce}=this.addExtendedMethods(i);a.push(...me),l.push(...J),p.push(...ae),t.push(...ce);const{updated:Y,added:de,removed:Ee}=this.removeUnrecognizedMethods(i);return a.push(...Y),l.push(...de),p.push(...Ee),this.addSuggestions(),this.captureVersion(),i==null||i.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}addSelfToProject(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-self-to-project"))){const a=[this],l=[],p=[],t=[];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(l),removed:R(p),affected:R(t),self:this}}setParent(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"set-parent"))){var l;return((l=this.parent)==null?void 0:l.id)!==(i==null?void 0:i.id)&&(this.parent=i,a&&(a==null||a.add(this,K.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,P.sessionAuthor,N().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.properties=this.initialData.properties.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(i),l}),this.methods=this.initialData.methods.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(i),l}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(i),l}),this.extends=this.initialData.extends.map(a=>ee(a,this.project)),this.implements=this.initialData.implements.map(a=>ee(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,P.sessionAuthor,N().toISOString(),this,!0,"remove-unrecognized-properties"))){const a=[],l=[],p=[],t=[];let y=[...this.properties];y=y.filter(b=>b.parent.id===this.id),y=y.filter(b=>!b.isExtendedProperty);const v=this.implementedPropertiesFromOriginalParents;return y=y.filter(b=>this.interactive&&!b.implements?!1:!v.find(w=>{var A;return w.id===((A=b.implements)==null?void 0:A.id)})),y.forEach(b=>{const w=b.remove({ignoreUpstream:!1},i);p.push(...w.removed),a.push(...w.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-properties",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}removeUnrecognizedMethods(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-unrecognized-methods"))){const a=[],l=[],p=[],t=[];let y=[...this.methods];y=y.filter(b=>b.parent.id===this.id),y=y.filter(b=>!b.isExtendedMethod);const v=this.implementedMethodsFromOriginalParents;return y=y.filter(b=>this.interactive&&!b.implements?!1:!v.find(w=>{var A;return w.id===((A=b.implements)==null?void 0:A.id)})),y.forEach(b=>{const w=b.remove({ignoreUpstream:!1},i);p.push(...w.removed),a.push(...w.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-methods",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}syncImplementationMethods(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-implementation-methods"))){const a=[],l=[],p=[],t=[],y=this.methods,v=this.implementedMethodsFromOriginalParents,b=[...this.allBaseMethodsFromExtendedAndImplementedEntities,...y];return v.filter(A=>!b.find(L=>{var U;return((U=L.implements)==null?void 0:U.id)===A.id})).forEach(A=>{if(this.methods.find(k=>{var q;return((q=k.implements)==null?void 0:q.id)===A.id}))return;const L=this.methods.find(k=>{var pe,ne;if(k.name===A.name&&!k.implements)return!0;const q=Yi(this,Oe.CRON_JOB),H=Yi(this,Oe.HTTP_ENDPOINT),ie=((pe=k.implements)==null?void 0:pe.id)===ve["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id,te=((ne=k.implements)==null?void 0:ne.id)===ve["built-in-base-entity"].BUILT_IN_CRON_JOB_ENTITY.methods.handler.id;return!!(q&&!te&&!H&&ie||H&&!ie&&!q&&te)});if(L&&L.type===f.FunctionDeclaration){L.setImplements(A),L.metaSync({name:A.name},i),i==null||i.add(L,K.Updated),i==null||i.add(this,K.Updated);return}const U=A.implementAsFunctionDeclaration(i,this);l.push(U),i==null||i.add(U,K.Added),this.addMethod(U)}),i==null||i.attemptAutoclose("sync-implementation-methods",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}syncImplementationProperties(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-implementation-properties"))){const a=[],l=[],p=[],t=[],y=this.properties,v=this.implementedPropertiesFromOriginalParents,b=[...this.allBasePropertiesFromExtendedAndImplementedEntities,...y];return v.filter(A=>!b.find(L=>{var U;return((U=L.implements)==null?void 0:U.id)===A.id})).forEach(A=>{if(this.properties.find(k=>{var q;return((q=k.implements)==null?void 0:q.id)===A.id}))return;const L=this.properties.find(k=>k.name===A.name&&!!k.abstract&&!k.implements);if(L){L.setImplements(A,i),L.metaSync({abstract:!1},i),L.afterAllChildrenInitialized(i);return}const U=A.implement(this,i,P.UUID.uuid());l.push(U),i==null||i.add(U,K.Added)}),i==null||i.attemptAutoclose("sync-implementation-properties",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}addExtendedMethods(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-extended-methods"))){const a=[],l=[],p=[],t=[],y=this.methods,b=this.extendedMethodsFromOriginalParents.filter(A=>A.type===f.FunctionDeclaration),w=new Set(y.filter(A=>{var V;return!!((V=A.extends)!=null&&V.id)}).map(A=>A.extends.id));return b.forEach(A=>{if(w.has(A.id))return;w.add(A.id);const V=A.clone(i,this,P.UUID.uuid());V.setExtends(A,i),V.initChildren(i),l.push(V),i==null||i.add(V,K.Added),this.addMethod(V)}),i==null||i.attemptAutoclose("add-extended-methods",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}addExtendedProperties(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-extended-properties"))){const a=[],l=[],p=[],t=[],y=this.properties,v=this.extendedPropertiesFromOriginalParents,b=v.filter(A=>v.find(L=>{var U;return((U=L.implements)==null?void 0:U.id)===A.id})?!1:!A.abstract),w=new Set(y.filter(A=>{var V;return!!((V=A.extends)!=null&&V.id)}).map(A=>A.extends.id));return b.forEach(A=>{if(w.has(A.id))return;w.add(A.id);const V=A.clone(i,this,P.UUID.uuid());V.setExtends(A,i),V.initChildren(i),l.push(V),i==null||i.add(V,K.Added),this.addProperty(V)}),i==null||i.attemptAutoclose("add-extended-properties",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}addSuggestions(){return this.implements.forEach(i=>{ZU(this,i).forEach(p=>{const t=p.toJSON();t.id=`_suggestion--parent--${this.id}--${p.id}`;const y=ee(t,this.project);y.suggestion=!0,y.setParent(this,null),y.initChildren(null),this.addSuggestedProperty(y)}),JU(this,i).forEach(p=>{const t=`_suggestion--parent--${this.id}--${p.id}`,y=p.implementAsFunctionDeclaration(null,this,t),v=ee(y,this.project);if(v.suggestion=!0,v.setParent(this,null),v.initChildren(null),this.methods=this.methods.filter(b=>b.id!==t),v.inputs.forEach(b=>{b.suggestion=!0}),v.returnStatements.length){const b=v.returnStatements[0];b.suggestion=!0,b.outputs.forEach(w=>{w.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,P.sessionAuthor,N().toISOString(),this,!0,"meta-sync"))){const l=Tr(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,K.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,K.Added):l&&(a==null||a.add(this,K.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ye,...a){return await $t.repository.APILoad(this.id,...a),this}async APICreate(i=ye,...a){return await $t.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ye,...a){return await $t.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ye,...a){return await $t.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ye,...a){return await $t.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ye,a,...l){return await $t.repository.APILoadVersion(this.id,a,...l)}removeFromParent(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-from-parent"))){const a=[],l=[],p=[],t=[];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(l),affected:R(t),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-entity"))){const l=[],p=[],t=[],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:b,removed:w,added:A}=v.entity.onDetachedDependencyRemoved(this,v.field,a);l.push(...b),p.push(...w),t.push(...A)}),this.properties.forEach(v=>{const{updated:b,removed:w}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(...w)}),this.methods.forEach(v=>{const{updated:b,removed:w}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(...w)}),this.abstractMethods.forEach(v=>{const{updated:b,removed:w}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(...w)}),this.suggestedProperties.forEach(v=>{const{updated:b,removed:w}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(...w)}),this.suggestedMethods.forEach(v=>{const{updated:b,removed:w}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(...w)}),!i){const v=this.removeFromParent(a);t.push(...v.added),l.push(...v.updated),p.push(...v.removed),y.push(...v.affected)}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:R(t),updated:R(l),removed:R(p),affected:R(y),self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"restore-entity"))){const a=[],l=[],p=[],t=[];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:b,added:w}=y.entity.onDetachedDependencyRestored(this,y.field,i);l.push(...v),p.push(...b),a.push(...w)}),this.properties.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),this.methods.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),this.abstractMethods.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),this.suggestedProperties.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),this.suggestedMethods.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),i==null||i.attemptAutoclose("restore-entity",this.id),{added:R(a),updated:R(l),removed:R(p),affected:R(t),self:this})}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.extends.flatMap(l=>l.toFlat(i)),...this.implements.flatMap(l=>l.toFlat(i)),...this.properties.flatMap(l=>l.toFlat(i)),...this.methods.flatMap(l=>l.toFlat(i)),...this.abstractMethods.flatMap(l=>l.toFlat(i)),...this.parent.toFlat(i)])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.extends.flatMap(l=>l.toFlatIds(i)),...this.implements.flatMap(l=>l.toFlatIds(i)),...this.properties.flatMap(l=>l.toFlatIds(i)),...this.methods.flatMap(l=>l.toFlatIds(i)),...this.abstractMethods.flatMap(l=>l.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=Ne){var l,p,t,y,v;let a;return(l=i.seenEntityMaps)!=null&&l.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||Ir(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(p=i.seenEntities)!=null&&p.has(a)||(t=i.seenEntities)!=null&&t.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:P.UUID.uuid(),createdAt:i.timestamp||N().toISOString(),author:P.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(b=>b.toJSONClone({...i,newId:null})),methods:this.methods.map(b=>b.toJSONClone({...i,newId:null})),abstractMethods:this.abstractMethods.map(b=>b.toJSONClone({...i,newId:null})),implements:this.implements.map(b=>b.type===f.BuiltInBaseEntity?b.toJSON():b.toJSONClone({...i,newId:null})),extends:this.extends.map(b=>b.type===f.BuiltInBaseEntity?b.toJSON():b.toJSONClone({...i,newId:null})),parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=Ne){var l;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+P.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=Ne){var l;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.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(l=>l.toFlatJSON(i)),...this.methods.flatMap(l=>l.toFlatJSON(i)),...this.abstractMethods.flatMap(l=>l.toFlatJSON(i)),...this.implements.flatMap(l=>l.toFlatJSON(i)),...this.extends.flatMap(l=>l.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(l=>l.toFlatGenerationTarget(i)),...this.methods.flatMap(l=>l.toFlatGenerationTarget(i)),...this.abstractMethods.flatMap(l=>l.toFlatGenerationTarget(i)),...this.implements.filter(l=>l.type===f.DefinitionEntity).flatMap(l=>l.toFlatGenerationTarget(i)),...this.implements.filter(l=>l.type===f.DefinitionEntity).flatMap(l=>l.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=SU(this),{success:!0,error:null,data:null}}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,P.sessionAuthor,N().toISOString(),this,!0,"clone-entity")),a=null,l=null,p=!0){var k,q,H;let t=wr(a,this);const y=this.toJSON(),v=l||P.UUID.uuid();y.properties=[],y.methods=[],y.abstractMethods=[];const b=v.split("-id"),w=b[b.length-1||0]||v;y.id=v,y.version=P.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||N().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1;const A=kt(y,t);a&&A.setParent(a,null),p&&A.subscribe(),A.initChildren(i),i==null||i.add(A,K.Added);const V=(k=this.properties)==null?void 0:k.map(ie=>ie.clone(i,A,P.UUID.uuid(),p));A.properties=V;const L=(q=this.methods)==null?void 0:q.map((ie,te)=>ie.clone(i,A,w+"-method-"+te+"-id",p));A.methods=L;const U=(H=this.abstractMethods)==null?void 0:H.map((ie,te)=>ie.clone(i,A,w+"-abstract-method-"+te+"-id",p));return A.abstractMethods=U,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,P.sessionAuthor,N().toISOString(),this,!0,"implement-definition-entity")),l){const p=Ty(this,i,a,l);return a==null||a.attemptAutoclose("implement-definition-entity",this.id),p}getAllInteractiveMethods(){const i=this.implements.filter(l=>l.type===f.DefinitionEntity||l.type===f.BuiltInBaseEntity&&l.interactive);return R([...this.methods,...this.extends.flatMap(l=>l.getAllInteractiveMethods()),...i.flatMap(l=>l.getAllInteractiveMethods())])}inferFromInputs(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"infer-definition-entity-from-inputs"))){const l=[],p=[],t=[],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(L=>re(L,this.project)===re(A,this.project))||v.push(A)});const b=this.properties.filter(A=>!A.dataType);v.forEach(A=>{var H,ie;const V=b.find(te=>re(te,this.project)===re(A,this.project));if(!V)return;const U=di(A.parent).getMasterInputWithValueWritterFromAllInstances(A),k=Ws(U,a),q=k==null?void 0:k.clone(a,V,P.UUID.uuid(),!0);q&&((H=V.dataType)==null||H.merge(q,a),q.id!==((ie=V.dataType)==null?void 0:ie.id)&&q.remove({ignoreUpstream:!1},a),V.dataType&&(V.dataType.metaSync({inferred:!0,like:!0},a),V.setDataType(V.dataType,a),a==null||a.add(V,K.Affected))),A.setDeclaration(V),a==null||a.add(A,K.Updated)});const w=[];return v.forEach(A=>{if(!A.declaration){w.push(A);return}}),w.length===0?(a==null||a.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(w.forEach(A=>{var te,pe,ne,me;const V=this.properties.find(J=>re(J,this.project)===re(A,this.project));if(V){if(A.setDeclaration(V),!V.getDataType(a)){const ae=di(A.parent).getMasterInputWithValueWritterFromAllInstances(A),ce=Ws(ae),Y=ce==null?void 0:ce.clone(a,V,P.UUID.uuid(),!0);Y&&((te=V.dataType)==null||te.merge(Y,a),Y.id!==((pe=V.dataType)==null?void 0:pe.id)&&Y.remove({ignoreUpstream:!1},a),V.dataType&&(V.dataType.metaSync({inferred:!0,like:!0},a),V.setDataType(V.dataType,a),a==null||a.add(V,K.Affected)))}return}const L={id:P.UUID.uuid(),type:f.Property,version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||N().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,name:re(A,this.project),codeName:A.codeName,description:A.description,defaultValue:null,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,constant:!0,index:A.index,implements:null,extends:null,dataType:null,parent:this.toReference()},U=ee(L,this.project);U.setParent(this,a),U.initChildren(a),a==null||a.add(U,K.Added);const q=di(A.parent).getMasterInputWithValueWritterFromAllInstances(A),H=Ws(q),ie=H==null?void 0:H.clone(a,U,P.UUID.uuid(),!0);return ie&&((ne=U.dataType)==null||ne.merge(ie,a),ie.id!==((me=U.dataType)==null?void 0:me.id)&&ie.remove({ignoreUpstream:!1},a),U.dataType&&(U.dataType.metaSync({inferred:!0,like:!0},a),U.setDataType(U.dataType,a),a==null||a.add(U,K.Affected))),this.addProperty(U),A.setDeclaration(U),a==null||a.add(A,K.Updated),U}),a==null||a.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:R(l),updated:R(p),removed:R(t),affected:R(y),self:this})}getRawDefaultValue(){const i={};return this.properties.forEach(a=>{var p;const l=Zr(a.name);i[l]=((p=a.getDefaultValue())==null?void 0:p.value)||null}),i}getActiveRawDefaultValue(){const i={};return this.properties.forEach(a=>{const l=Zr(a.name),p=this.project.requestActiveValue(a);i[l]=(p==null?void 0:p.value)||null}),i}};D($t,"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,...l)=>null}),D($t,"type",f.DefinitionEntity),D($t,"USER_MANAGED_PARENT_TYPES",[f.Project,f.DataType]),D($t,"PARENT_TYPES",[...$t.USER_MANAGED_PARENT_TYPES]),D($t,"MUTABLE_BASE_PROPERTIES",["name","codeName","description","static","abstract"]),D($t,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),D($t,"BASE_PROPERTIES",[...$t.MUTABLE_BASE_PROPERTIES,...$t.INMUTABLE_BASE_PROPERTIES]),D($t,"MUTABLE_META_PROPERTIES",[...$t.MUTABLE_BASE_PROPERTIES,"x","y"]),D($t,"INMUTABLE_META_PROPERTIES",[...$t.INMUTABLE_BASE_PROPERTIES]),D($t,"META_PROPERTIES",[...$t.MUTABLE_META_PROPERTIES,...$t.INMUTABLE_META_PROPERTIES]),D($t,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),D($t,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),D($t,"UPSTREAM_PROPERTIES",[...$t.MUTABLE_UPSTREAM_PROPERTIES,...$t.INMUTABLE_UPSTREAM_PROPERTIES]),D($t,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),D($t,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),D($t,"DOWNSTREAM_PROPERTIES",[...$t.MUTABLE_DOWNSTREAM_PROPERTIES,...$t.INMUTABLE_DOWNSTREAM_PROPERTIES]),D($t,"PROPERTIES",[...$t.META_PROPERTIES,...$t.UPSTREAM_PROPERTIES,...$t.DOWNSTREAM_PROPERTIES]);let fa=$t;function _ye(d){const u=Boe(),i=d.toJSON();u.safeParse(i).success;const l=[];return Xt(d.errors,l)}const Vp=class Vp extends yr{constructor(i,a){super(i);D(this,"initialData");D(this,"id");D(this,"version");D(this,"name");D(this,"description",null);D(this,"type",f.BuiltInBaseEntity);D(this,"abstract",!1);D(this,"static");D(this,"properties",[]);D(this,"methods",[]);D(this,"abstractMethods",[]);D(this,"extends",[]);D(this,"interactive",!1);D(this,"errors",[]);D(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(l=>{const p=ee(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.methods=this.initialData.methods.map(l=>{const p=ee(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.abstractMethods=this.initialData.abstractMethods.map(l=>{const p=ee(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.extends=this.initialData.extends.map(l=>ee(l,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 l=[...a.ownDeclaredProperties,...a.allBasePropertiesFromExtendedAndImplementedEntities].filter(p=>!p.abstract);return[...i,...l]},[]))}get extendedPropertiesFromOriginalParents(){return R(this.extends.reduce((i,a)=>{const l=[...a.ownDeclaredProperties,...a.extendedPropertiesFromOriginalParents].filter(p=>!p.abstract);return[...i,...l]},[]))}get implementedPropertiesFromOriginalParents(){return R([...this.extends.reduce((i,a)=>{const l=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(t=>!!t.abstract&&!l.find(y=>y.name===t.name));return[...l,...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=ye,...a){return await Vp.repository.APILoad(this.id,...a),this}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.properties.flatMap(l=>l.toFlat(i)),...this.methods.flatMap(l=>l.toFlat(i)),...this.abstractMethods.flatMap(l=>l.toFlat(i)),...this.extends.flatMap(l=>l.toFlat(i))])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.properties.flatMap(l=>l.toFlatIds(i)),...this.methods.flatMap(l=>l.toFlatIds(i)),...this.abstractMethods.flatMap(l=>l.toFlatIds(i)),...this.extends.flatMap(l=>l.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=Ne){return{id:this.id+"--"+P.UUID.uuid()+"--ref",type:f.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(i=Ne){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(l=>l.toFlatJSON(i)),...this.methods.flatMap(l=>l.toFlatJSON(i)),...this.abstractMethods.flatMap(l=>l.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(l=>l.toFlatGenerationTarget(i)),...this.methods.flatMap(l=>l.toFlatGenerationTarget(i)),...this.abstractMethods.flatMap(l=>l.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=_ye(this);return this.errors=i,{success:!0,error:null,data:this.toJSON()}}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,P.sessionAuthor,N().toISOString(),null,!0,"implement-built-in-base-entity")),l){const p=Ty(this,i,a,l);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(l=>l.type===f.BuiltInBaseEntity&&l.interactive||l.type===f.PrimitiveEntity).forEach(l=>{l instanceof Vp&&i.push(...l.getAllInteractiveMethods())})),R(i)}};D(Vp,"repository",{APILoad:async(i,...a)=>null});let gn=Vp;function gye(d){const u=goe(),i=d.toJSON();u.safeParse(i).success;const l=[];return Xt(d.errors,l)}const qy=class qy extends yr{constructor(i,a){super(i);D(this,"initialData");D(this,"id");D(this,"name");D(this,"description",null);D(this,"type",f.PrimitiveEntity);D(this,"static");D(this,"abstract");D(this,"properties",[]);D(this,"methods",[]);D(this,"abstractMethods",[]);D(this,"extends",[]);D(this,"errors",[]);D(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(l=>{const p=ee(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.methods=this.initialData.methods.map(l=>{const p=ee(l,this.project);return p.parent=this,p}),this.abstractMethods=this.initialData.abstractMethods.map(l=>{const p=ee(l,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 l=[...a.ownDeclaredProperties,...a.allBasePropertiesFromExtendedAndImplementedEntities].filter(p=>!p.abstract);return[...i,...l]},[]))}get extendedPropertiesFromOriginalParents(){return R(this.extends.reduce((i,a)=>{const l=[...a.ownDeclaredProperties,...a.extendedPropertiesFromOriginalParents].filter(p=>!p.abstract);return[...i,...l]},[]))}get implementedPropertiesFromOriginalParents(){return R([...this.extends.reduce((i,a)=>{const l=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(t=>!!t.abstract&&!l.find(y=>y.name===t.name));return[...l,...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=ye,...a){return await qy.repository.APILoad(this.id,...a),this}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.properties.flatMap(l=>l.toFlat(i)),...this.methods.flatMap(l=>l.toFlat(i)),...this.abstractMethods.flatMap(l=>l.toFlat(i))])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.properties.flatMap(l=>l.toFlatIds(i)),...this.methods.flatMap(l=>l.toFlatIds(i)),...this.abstractMethods.flatMap(l=>l.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=Ne){return{id:this.id+"--"+P.UUID.uuid()+"--ref",type:f.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(i=Ne){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(l=>l.toFlatJSON(i)),...this.methods.flatMap(l=>l.toFlatJSON(i)),...this.abstractMethods.flatMap(l=>l.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(l=>l.toFlatGenerationTarget(i)),...this.methods.flatMap(l=>l.toFlatGenerationTarget(i)),...this.abstractMethods.flatMap(l=>l.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=gye(this);return this.errors=i,{success:!0,error:null,data:this.toJSON()}}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(l=>l.type===f.BuiltInBaseEntity&&l.interactive||l.type===f.PrimitiveEntity).forEach(l=>{l instanceof gn&&i.push(...l.getAllInteractiveMethods())}),R(i)}};D(qy,"repository",{APILoad:async(i,...a)=>null});let Vi=qy;function kt(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 Ei(d,u);case f.DefinitionEntity:return i||new fa(d,u);case f.PrimitiveEntity:return i||new Vi(d,u);case f.FunctionDeclaration:return i||new Va(d,u);case f.GlobalEvent:return i||new Ba(d,u);case f.DataType:return i||new Ji(d,u);case f.Property:return i||new oa(d,u);case f.FunctionCall:return i||new Za(d,u);case f.Condition:return i||new Ma(d,u);case f.Operation:return i||new Na(d,u);case f.VariableDeclaration:return i||new Ua(d,u);case f.VariableInstance:return i||new ja(d,u);case f.OutputMap:return i||new Ys(d,u);case f.ReturnDeclaration:return i||new Pi(d,u);case f.ArgumentDeclaration:return i||new da(d,u);case f.InputMap:return i||new Ds(d,u);case f.Project:return i||new P(d);case f.InstalledProject:return i||new Fa(d,u);case f.ActionDescriptor:return i||new Ut(d,u);case f.ReturnStatement:return i||new La(d,u);case f.Loop:return i||new Ti(d,u);case f.Search:return i||new xa(d,u);case f.ValueDescriptor:return i||new zs(d,u);case f.BuiltInBaseEntity:return i||new gn(d,u);case f.InternalCall:return i||new Ga(d,u);case f.ContinueStatement:return i||new ui(d,u);case f.BreakStatement:return i||new Ka(d,u);case f.GenericReference:return u.get(d.entityId);default:throw new Error("Invalid entity type: "+d.type)}}function ee(d,u){if(!d)throw new Error("Entity is null");const i=kt(d,u);return i.subscribe(),i}function Dye(d,u){if(!d)throw new Error("Entity is null");switch(d.type){case f.LiteralValue:return Ei.fromGenerationTarget(d,u);case f.DefinitionEntity:return fa.fromGenerationTarget(d,u);case f.FunctionDeclaration:return Va.fromGenerationTarget(d,u);case f.GlobalEvent:return Ba.fromGenerationTarget(d,u);case f.DataType:return Ji.fromGenerationTarget(d,u);case f.Property:return oa.fromGenerationTarget(d,u);case f.FunctionCall:return Za.fromGenerationTarget(d,u);case f.Condition:return Ma.fromGenerationTarget(d,u);case f.Operation:return Na.fromGenerationTarget(d,u);case f.VariableDeclaration:return Ua.fromGenerationTarget(d,u);case f.VariableInstance:return ja.fromGenerationTarget(d,u);case f.OutputMap:return Ys.fromGenerationTarget(d,u);case f.ReturnDeclaration:return Pi.fromGenerationTarget(d,u);case f.ArgumentDeclaration:return da.fromGenerationTarget(d,u);case f.InputMap:return Ds.fromGenerationTarget(d,u);case f.InstalledProject:return Fa.fromGenerationTarget(d,u);case f.ReturnStatement:return La.fromGenerationTarget(d,u);case f.Loop:return Ti.fromGenerationTarget(d,u);case f.Search:return xa.fromGenerationTarget(d,u);case f.ActionDescriptor:return Ut.fromGenerationTarget(d,u);case f.ValueDescriptor:return zs.fromGenerationTarget(d,u);case f.InternalCall:return Ga.fromGenerationTarget(d,u);case f.ContinueStatement:return ui.fromGenerationTarget(d,u);case f.BreakStatement:return Ka.fromGenerationTarget(d,u);default:throw new Error("Invalid entity type: "+d.type)}}const Ne={seenEntityMaps:new Map,seenEntities:new Set,timestamp:N().toISOString()};class WU{constructor(){D(this,"initialData")}}const ye={cascade:!1},HU={APILoad:async(d,...u)=>null},Cye={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,...HU};class Oye{}class $ye extends WU{}class Pye{}class Vye{}class Nye{}class Jb{}class Lye extends Jb{}class Bye extends Jb{}class Mye{}class Ap{static initReadsValue(u){if(u.initialData.readsValue&&u.initialData.readsValue.type!==f.GenericReference)u.readsValue=ee(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(rt.includes(u.readsValue.type)){let i=u.parent;Ar.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 Ip{static initWritesValues(u,i){const a=u.initialData.writesValues.reduce((p,t)=>{if(t.type===f.GenericReference||u.writesValues.some(v=>v.id===t.id))return p;const y=ee(t,u.project);return y.setValueWriter(u,null),rt.includes(y.type)&&(y.setParent(i,null),y.initChildren(null)),[...p,y]},[]),l=[...u.writesValues];return u.writesValues=R([...l,...a]),u.writesValues}}class jye{}var Uye=Object.defineProperty,xye=(d,u,i)=>u in d?Uye(d,u,{enumerable:!0,configurable:!0,writable:!0,value:i}):d[u]=i,ko=(d,u,i)=>(xye(d,typeof u!="symbol"?u+"":u,i),i);let Fye=class{constructor(u){ko(this,"eventName"),ko(this,"callbacks",[]),this.eventName=u,this.on=this.on.bind(this),this.off=this.off.bind(this),this.destroy=this.destroy.bind(this)}on(u){if(typeof u!="function")throw new Error("Event callback must be a function");this.callbacks.includes(u)||this.callbacks.push(u)}off(u){if(typeof u!="function")throw new Error("Event callback must be a function");this.callbacks=this.callbacks.filter(i=>i!==u)}destroy(){this.callbacks=[]}};class Wb{constructor(){ko(this,"subscribedEvents",{}),ko(this,"on",this._on),ko(this,"emit",this._emit),ko(this,"off",this._off),ko(this,"destroy",this._destroy),this.getEvent=this.getEvent.bind(this),this._on=this._on.bind(this),this._emit=this._emit.bind(this),this._off=this._off.bind(this),this._destroy=this._destroy.bind(this),this.on=this.on.bind(this),this.emit=this.emit.bind(this),this.off=this.off.bind(this),this.destroy=this.destroy.bind(this)}getEvent(u){return this.subscribedEvents[u]||(this.subscribedEvents[u]=new Fye(u)),this.subscribedEvents[u]}_on(u,i){this.getEvent(u).on(i)}_emit(u,...i){const a=this.getEvent(u);a&&a.callbacks.forEach(l=>{l.apply(null,i)})}_off(u,i){const a=this.getEvent(u);a&&(i?a.off(i):(a.destroy(),delete this.subscribedEvents[u]))}_destroy(){Object.keys(this.subscribedEvents).forEach(u=>{this._off(u)}),this.subscribedEvents={}}}var mr=(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))(mr||{});const We=class We extends yr{constructor(i){super(i);D(this,"initialData");D(this,"id");D(this,"type",f.Project);D(this,"name",null);D(this,"description",null);D(this,"x");D(this,"y");D(this,"entities",[]);D(this,"projects",[]);D(this,"functions",[]);D(this,"events",[]);D(this,"variableDeclarations",[]);D(this,"variableInstances",[]);D(this,"conditions",[]);D(this,"operations",[]);D(this,"functionCalls",[]);D(this,"loops",[]);D(this,"searches",[]);D(this,"primitives",[]);D(this,"builtInBaseEntities",[]);D(this,"operationDeclarations",[]);D(this,"globalEventActionDescriptors",[]);D(this,"loopDeclarations",[]);D(this,"loopDeclarationsBodies",[]);D(this,"conditionDeclarations",[]);D(this,"valueDescriptors",[]);D(this,"dataTypes",[]);D(this,"project");D(this,"instances",{});D(this,"builtInInstances",{});D(this,"deletedInstances",{});D(this,"errors",[]);D(this,"references",[]);D(this,"history",[]);D(this,"undoableStackValueIndex",-1);D(this,"detachedDependents",{});D(this,"knownVersions",null);D(this,"activeVersion",!1);D(this,"initialized",!1);D(this,"startedInitialization",!1);D(this,"_eventsHub",new Wb);D(this,"onCloseChangeSetCallback",null);D(this,"onAddChangeSetCallback",null);D(this,"onDiscardChangeSetCallback",null);D(this,"onRequestActiveValueCallback",null);if(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,!We.UUID)throw new Error("UUID module is already initialized. Please inject a valid UUID module.")}static get UUID(){return this._UUIDModule}static injectUUIDModule(i){this._UUIDModule=i}static new(i=null){return{id:We.UUID.uuid(),version:We.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||N().toISOString(),author:(i==null?void 0:i.author)||We.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 l=JSON.parse(JSON.stringify(i));const p=[];return p.push(...Er(l)),{errors:p,modifiedData:l}}get off(){return this._eventsHub.off}get on(){return this._eventsHub.on}get emit(){return this._eventsHub.emit}async closePendingChangeSets(){const i=this.history.find(a=>a.dirty&&!a.open);i&&await this.closeChangeSet(i)}onRequestActiveValue(i){this.onRequestActiveValueCallback=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(t=>t.id===i.id),l=this.history.slice(0,a),p=l[l.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,l,p=!1,t="here-this"){if(!this.history.length)return new G(this,i,a,l,p,t);const y=this.history[this.history.length-1];return y.open?y:this.addChangeSet(new G(this,i,a,l,p,t))}addChangeSet(i){var p,t;if(!this.history.length)return this.undoableStackValueIndex=YT(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 l=this.history.find(y=>y.open);if(l)throw console.warn("Previous still open: ",l),console.warn("New change set: ",i),new Error(`There is already an open change-set with id '${l.id}'.`);return this.undoableStackValueIndex=YT(this.undoableStackValueIndex,this.history,i),(t=this.onAddChangeSetCallback)==null||t.call(this,i,this.undoableStackValueIndex),i}discardChangeSet(i){var l;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,(l=this.onDiscardChangeSetCallback)==null||l.call(this,i)),this}async inject(...i){return await Promise.all(i.map(a=>new Promise(async l=>{await a.init(this),l(null)}))),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,We.sessionAuthor,N().toISOString(),this,!0,"sync-dependents"))){const a=[],l=[],p=[],t=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),l.push(...v.added),p.push(...v.removed),t.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}onDetachedDependencyRemoved(i,a,l){const p=[],t=[],y=[],v=[];return{updated:R(p),added:R(t),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,l){const p=[],t=[],y=[],v=[];return{updated:R(p),added:R(t),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){return this}subscribeToDependencies(){return this}increaseVersion(i){if(i&&!N(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&N(i).isSame(N(this.createdAt))?this:(this.previousVersion=this.version,this.version=We.UUID.uuid(),this.createdAt=N(i).toISOString()||N().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new We(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=[],l=[],p=[],t=[];return{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}async restoreVersion(i){var v;const a=[],l=[],p=[],t=[];if(this.version===i)return{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this};if(!this.knownVersions){const b=new Map;for(const[w,A]of this.knownVersions||new Map){if(b.set(w,A),A.activeVersion=!1,A.knownVersions)for(const[V,L]of A.knownVersions)b.set(V,L);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const b=await this.APILoadVersion({},i);if(!b)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new We(b)}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(l),removed:R(p),affected:R(t),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,We.sessionAuthor,N().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=[],l=[],p=[];return{updated:R(i),added:R(a),removed:R(l),affected:R(p),self:this}}afterAllChildrenInitialized(i=null){const a=[],l=[],p=[],t=[];return this.initialized||(this.initialized=!0,this.emit("project-initialized",this,i)),this.validate(),this.captureVersion(),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}addSelfToProject(i){const a=[],l=[],p=[],t=[];return this.subscribe(),this.subscribeToDependencies(),{updated:R(a),added:R(l),removed:R(p),affected:R(t),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,We.sessionAuthor,N().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.entities=this.initialData.entities.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.projects=this.initialData.projects.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.variableDeclarations=this.initialData.variableDeclarations.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.variableInstances=this.initialData.variableInstances.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.conditions=this.initialData.conditions.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.operations=this.initialData.operations.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.functions=this.initialData.functions.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.events=this.initialData.events.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.functionCalls=this.initialData.functionCalls.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.loops=this.initialData.loops.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.searches=this.initialData.searches.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),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,We.sessionAuthor,N().toISOString(),this,!0,"meta-sync"))){const l=Tr(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,K.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,K.Added):l&&(a==null||a.add(this,K.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ye,...a){return await We.repository.APILoad(this.id,...a),this}async APICreate(i=ye,...a){return await We.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ye,...a){return await We.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ye,...a){return await We.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ye,...a){return await We.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ye,a,...l){return await We.repository.APILoadVersion(this.id,a,...l)}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,We.sessionAuthor,N().toISOString(),this,!0,"remove-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,We.sessionAuthor,N().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(l=>l.toFlat(i)),...this.functions.flatMap(l=>l.toFlat(i)),...this.events.flatMap(l=>l.toFlat(i)),...this.projects.flatMap(l=>l.toFlat(i)),...this.variableDeclarations.flatMap(l=>l.toFlat(i)),...this.variableInstances.flatMap(l=>l.toFlat(i)),...this.conditions.flatMap(l=>l.toFlat(i)),...this.operations.flatMap(l=>l.toFlat(i)),...this.functionCalls.flatMap(l=>l.toFlat(i)),...this.loops.flatMap(l=>l.toFlat(i)),...this.searches.flatMap(l=>l.toFlat(i))])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.entities.flatMap(l=>l.toFlatIds(i)),...this.functions.flatMap(l=>l.toFlatIds(i)),...this.events.flatMap(l=>l.toFlatIds(i)),...this.projects.flatMap(l=>l.toFlatIds(i)),...this.variableDeclarations.flatMap(l=>l.toFlatIds(i)),...this.variableInstances.flatMap(l=>l.toFlatIds(i)),...this.conditions.flatMap(l=>l.toFlatIds(i)),...this.operations.flatMap(l=>l.toFlatIds(i)),...this.functionCalls.flatMap(l=>l.toFlatIds(i)),...this.loops.flatMap(l=>l.toFlatIds(i)),...this.searches.flatMap(l=>l.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,l=new Set,p=this.getAllBuiltInIds();return Object.keys(this.instances).forEach(t=>{if(p.includes(t)){a.set(t,t);return}a.set(t,We.UUID.uuid())}),l.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(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),projects:this.projects.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),variableDeclarations:this.variableDeclarations.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),variableInstances:this.variableInstances.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),conditions:this.conditions.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),operations:this.operations.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),functions:this.functions.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),events:this.events.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),functionCalls:this.functionCalls.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),loops:this.loops.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),searches:this.searches.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null}))}}toReference(i=Ne){var l;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+We.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=Ne){var l;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.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(l=>l.toFlatJSON(i)),...this.functions.flatMap(l=>l.toFlatJSON(i)),...this.events.flatMap(l=>l.toFlatJSON(i)),...this.projects.flatMap(l=>l.toFlatJSON(i)),...this.variableDeclarations.flatMap(l=>l.toFlatJSON(i)),...this.variableInstances.flatMap(l=>l.toFlatJSON(i)),...this.conditions.flatMap(l=>l.toFlatJSON(i)),...this.operations.flatMap(l=>l.toFlatJSON(i)),...this.functionCalls.flatMap(l=>l.toFlatJSON(i)),...this.loops.flatMap(l=>l.toFlatJSON(i)),...this.searches.flatMap(l=>l.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(l=>l.toFlatGenerationTarget(i)),...this.functions.flatMap(l=>l.toFlatGenerationTarget(i)),...this.events.flatMap(l=>l.toFlatGenerationTarget(i)),...this.projects.flatMap(l=>l.toFlatGenerationTarget(i)),...this.variableDeclarations.flatMap(l=>l.toFlatGenerationTarget(i)),...this.variableInstances.flatMap(l=>l.toFlatGenerationTarget(i)),...this.conditions.flatMap(l=>l.toFlatGenerationTarget(i)),...this.operations.flatMap(l=>l.toFlatGenerationTarget(i)),...this.functionCalls.flatMap(l=>l.toFlatGenerationTarget(i)),...this.loops.flatMap(l=>l.toFlatGenerationTarget(i)),...this.searches.flatMap(l=>l.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(){const i=zde(),a=this.toJSON();return i.safeParse(a),this.validateChildren(),{success:!0,error:null,data:a}}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(l=>l.id===i.id);if(a>-1){const l=this.entities[a];return this.entities.splice(a,1),l}return null}removeCondition(i){const a=this.conditions.findIndex(l=>l.id===i.id);if(a>-1){const l=this.conditions[a];return this.conditions.splice(a,1),l}return null}removeOperation(i){const a=this.operations.findIndex(l=>l.id===i.id);if(a>-1){const l=this.operations[a];return this.operations.splice(a,1),l}return null}removeLoop(i){const a=this.loops.findIndex(l=>l.id===i.id);if(a>-1){const l=this.loops[a];return this.loops.splice(a,1),l}return null}removeSearch(i){const a=this.searches.findIndex(l=>l.id===i.id);if(a>-1){const l=this.searches[a];return this.searches.splice(a,1),l}return null}removeFunctionCall(i){const a=this.functionCalls.findIndex(l=>l.id===i.id);if(a>-1){const l=this.functionCalls[a];return this.functionCalls.splice(a,1),l}return null}removeVariableInstance(i){const a=this.variableInstances.findIndex(l=>l.id===i.id);if(a>-1){const l=this.variableInstances[a];return this.variableInstances.splice(a,1),l}return null}removeVariableDeclaration(i){const a=this.variableDeclarations.findIndex(l=>l.id===i.id);if(a>-1){const l=this.variableDeclarations[a];return this.variableDeclarations.splice(a,1),l}return null}removeFunctionDeclaration(i){const a=this.functions.findIndex(l=>l.id===i.id);if(a>-1){const l=this.functions[a];return this.functions.splice(a,1),l}return null}removeInstalledProject(i){const a=this.projects.findIndex(l=>l.id===i.id);if(a>-1){const l=this.projects[a];return this.projects.splice(a,1),l}return null}removeGlobalEvent(i){const a=this.events.findIndex(l=>l.id===i.id);if(a>-1){const l=this.events[a];return this.events.splice(a,1),l}return null}removeTopLevelVariableDeclaration(i){if(i.type!==f.VariableDeclaration)return null;const a=this.variableDeclarations.findIndex(l=>l.id===i.id);if(a>-1){const l=this.variableDeclarations[a];return this.variableDeclarations.splice(a,1),l}return null}getEntryPoints(){return[...this.functions,...this.events,...this.entities.flatMap(a=>a.methods)]}getTerminationStatements(){return[...this.getEntryPoints().reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.ReturnStatement||t.type===f.ContinueStatement||t.type===f.BreakStatement)]},[])]}getFunctionDeclaration(i){return this.functions.find(a=>a.id===i)||null}getConditions(){return[...this.conditions,...this.getEntryPoints().reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[]),...this.functionCalls.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[]),...this.operations.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[]),...this.loops.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[]),...this.searches.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[]),...this.functionCalls.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[]),...this.conditions.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[]),...this.loops.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[]),...this.searches.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[]),...this.conditions.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[]),...this.operations.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[]),...this.loops.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[]),...this.searches.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((a,l)=>{const p=zt(l);return[...a,...p]},[]),...this.functionCalls.reduce((a,l)=>{const p=zt(l);return[...a,...p]},[]),...this.conditions.reduce((a,l)=>{const p=zt(l);return[...a,...p]},[]),...this.operations.reduce((a,l)=>{const p=zt(l);return[...a,...p]},[]),...this.loops.reduce((a,l)=>{const p=zt(l);return[...a,...p]},[]),...this.searches.reduce((a,l)=>{const p=zt(l);return[...a,...p]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableInstance);return[...a,...t]},[]),...this.functionCalls.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableInstance);return[...a,...t]},[]),...this.conditions.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableInstance);return[...a,...t]},[]),...this.operations.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableInstance);return[...a,...t]},[]),...this.loops.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableInstance);return[...a,...t]},[]),...this.searches.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableInstance);return[...a,...t]},[])]}getVariableDeclarations(){return R([...this.variableDeclarations,...this.getEntryPoints().reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableDeclaration);return[...a,...t]},[]),...this.functionCalls.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableDeclaration);return[...a,...t]},[]),...this.conditions.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableDeclaration);return[...a,...t]},[]),...this.operations.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableDeclaration);return[...a,...t]},[]),...this.loops.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableDeclaration);return[...a,...t]},[]),...this.searches.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableDeclaration);return[...a,...t]},[])])}getLoops(){return[...this.loops,...this.getEntryPoints().reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[]),...this.functionCalls.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[]),...this.conditions.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[]),...this.operations.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[]),...this.searches.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[])]}getSearches(){return[...this.searches,...this.getEntryPoints().reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Search)]},[]),...this.functionCalls.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Search)]},[]),...this.conditions.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Search)]},[]),...this.operations.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Search)]},[]),...this.loops.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Search)]},[])]}attachOrphanReferences(){const i=this.getVariableInstances(),a=this.getVariableDeclarations();return i.forEach(l=>{if(!l.declaration){const p=l.initialData,t=p.declaration.entityId||p.declaration.id,y=a.find(v=>v.id===t);y&&l.setDeclaration(y)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(i=>i.name===Oe.PERSISTED_ENTITY)||null}requestActiveValue(i){var l;const a=(l=this.onRequestActiveValueCallback)==null?void 0:l.call(this,i);return a?a||null:i.getDefaultValue()}undo(){console.log("Undoing, from: ",this.undoableStackValueIndex),this.undoableStackValueIndex=this.undoableStackValueIndex-1,console.log("To: ",this.undoableStackValueIndex);const i=this.history[this.undoableStackValueIndex+1],a=this.history[this.undoableStackValueIndex];return console.log("Current change set: ",i),console.log("Change set to restore: ",a==null?void 0:a.toJSON()),WT(i||"initial",a||"initial",this)}redo(){console.log("Undoing, from: ",this.undoableStackValueIndex),this.undoableStackValueIndex=this.undoableStackValueIndex+1,console.log("To: ",this.undoableStackValueIndex);const i=this.history[this.undoableStackValueIndex-1],a=this.history[this.undoableStackValueIndex];return console.log("Current change set: ",i),console.log("Change set to restore: ",a.toJSON()),WT(i||"initial",a||"initial",this)}applyExternalChangeSet(i){const a=i.payload,l=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 t={...a.added,...a.updated,...a.removed},y=[...Object.keys(a.added),...Object.keys(a.updated),...Object.keys(a.removed)];y.forEach(b=>{var w;if(!t[b]){console.warn(`Entity '${b}' not found in change set transfer. Cannot apply changes.`);const A=(w=this.get(b))==null?void 0:w.toShallowJSON();throw A?console.warn("Entity in project: ",A):console.warn("Entity not in project"),new Error(`Entity '${b}' not found in change set transfer. Cannot apply changes.`)}});const v=new ca(p);return v.flatRecord=t,v.order=y,v.orderEntities(),console.log("All entities: ",v.order.map((b,w)=>`${w+1}: ${t[b].type} - ${b}`).join(`,
|
|
404
|
-
`)),console.log("Persisting new additions"),v.visit(async(b,w)=>{if(a.added[b.id]){console.log("Adding: ",b.id);try{const A=ee(b,this);if(A.hydrateAncestors(),A.addSelfToProject(l),l.add(A,K.Added),!this.get(b.id))throw new Error(`Entity ${b.id} was not added to the project`)}catch(A){console.error("Error: ",A),console.error("Errored entity: ",b)}}}),console.log("Persisting updates"),v.visit(async(b,w)=>{if(a.updated[b.id]){console.log("Updating: ",b.id);try{const A=this.get(b.id);A?(A.updateWithShallowTransfer(b,l),l.add(A,K.Updated)):console.warn(`Active version of ${b.id} not found when applying external changes`)}catch(A){console.error("Error: ",A),console.error("Errored entity: ",b)}}}),console.log("Persisting removals"),v.visit(async(b,w)=>{if(a.removed[b.id]){console.log("Removing: ",b.id);try{const A=this.get(b.id);A&&A.remove({ignoreUpstream:!1},l)}catch(A){console.error("Error: ",A),console.error("Errored entity: ",b)}}}),l}toFullProjectTransfer(){const i=new ca(this),a={};return i.visit(l=>{const p=l.toShallowJSON();a[l.id]=p}),{order:i.order,size:i.order.length,record:a}}};D(We,"_UUIDModule",uV),D(We,"sessionAuthor","1"),D(We,"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,...l)=>null}),D(We,"type",f.Project),D(We,"USER_MANAGED_PARENT_TYPES",[]),D(We,"PARENT_TYPES",[...We.USER_MANAGED_PARENT_TYPES]),D(We,"MUTABLE_BASE_PROPERTIES",["name","description"]),D(We,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),D(We,"BASE_PROPERTIES",[...We.MUTABLE_BASE_PROPERTIES,...We.INMUTABLE_BASE_PROPERTIES]),D(We,"MUTABLE_META_PROPERTIES",[...We.MUTABLE_BASE_PROPERTIES,"x","y"]),D(We,"INMUTABLE_META_PROPERTIES",[...We.INMUTABLE_BASE_PROPERTIES]),D(We,"META_PROPERTIES",[...We.MUTABLE_META_PROPERTIES,...We.INMUTABLE_META_PROPERTIES]),D(We,"MUTABLE_UPSTREAM_PROPERTIES",[]),D(We,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),D(We,"UPSTREAM_PROPERTIES",[...We.MUTABLE_UPSTREAM_PROPERTIES,...We.INMUTABLE_UPSTREAM_PROPERTIES]),D(We,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),D(We,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),D(We,"DOWNSTREAM_PROPERTIES",[...We.MUTABLE_DOWNSTREAM_PROPERTIES,...We.INMUTABLE_DOWNSTREAM_PROPERTIES]),D(We,"PROPERTIES",[...We.META_PROPERTIES,...We.UPSTREAM_PROPERTIES,...We.DOWNSTREAM_PROPERTIES]);let P=We;class YU extends Ut{constructor(i){super(Ks,i);D(this,"id",tr.Parallel);D(this,"name",tr.Parallel);D(this,"description","Programmatically execute a list of actions one after the other");D(this,"version","1");D(this,"autoexecutable",!0);D(this,"initialData",Ks);D(this,"type",f.ActionDescriptor);D(this,"inputs",[]);D(this,"outputs",[]);D(this,"error",null);D(this,"project");this.project=i,this.inputs=Ks.inputs.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.outputs=Ks.outputs.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.error=Ks.error?ee(Ks.error,this.project):null}}class zU extends Ut{constructor(i){super(Ri,i);D(this,"id",Ri.id);D(this,"name",Ri.name);D(this,"description",Ri.description);D(this,"version",Ri.version);D(this,"autoexecutable",!1);D(this,"initialData",Ri);D(this,"type",f.ActionDescriptor);D(this,"inputs",[]);D(this,"outputs",[]);D(this,"error",null);D(this,"project");this.project=i,this.inputs=Ri.inputs.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.outputs=Ri.outputs.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.error=Ri.error?ee(Ri.error,this.project):null}}class XU extends Ut{constructor(i){super(Hn,i);D(this,"id",tr.Sequential);D(this,"name",tr.Sequential);D(this,"description","Programmatically execute a list of actions one after the other");D(this,"version","1");D(this,"autoexecutable",!0);D(this,"initialData",Hn);D(this,"type",f.ActionDescriptor);D(this,"inputs",[]);D(this,"outputs",[]);D(this,"error",null);D(this,"project");this.project=i,this.inputs=Hn.inputs.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.outputs=Hn.outputs.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.error=Hn.error?ee(Hn.error,this.project):null}}class Gye extends Ut{constructor(u){super(vu,u)}}class Kye extends Ut{constructor(u){super(yo,u)}}class kye extends Ut{constructor(i){super(mo,i);D(this,"autoexecutable",!0)}getEntityToMatchInputMap(i){return i.inputs.find(a=>{var l;return((l=a.declaration)==null?void 0:l.id)===ve.operation[rr.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(i){return i.inputs.find(a=>{var l;return((l=a.declaration)==null?void 0:l.id)===ve.operation[rr.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(i){return i.outputs.find(a=>{var l;return((l=a.declaration)==null?void 0:l.id)===ve.operation[rr.Validate].outputs.outputEntity.id})||null}getEntityToMatch(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"get-entity-to-match-validate-data"))){const l=this.project.requestActiveValue(i),p=l==null?void 0:l.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,P.sessionAuthor,N().toISOString(),this,!0,"sync-operation-instance-validate-data"))){const l=[],p=[],t=[],y=[],v=this.getEntityToMatchInputMap(i);if(v){const{added:A,updated:V,removed:L,affected:U}=this.syncEntityToMatchInputMapDataType(v,a);l.push(...V),p.push(...A),t.push(...L),y.push(...U)}const b=this.getDataToValidateInputMap(i);if(b){const{added:A,updated:V,removed:L,affected:U}=this.syncDataToValidateInputMapDataType(b,a);l.push(...V),p.push(...A),t.push(...L),y.push(...U)}const w=this.getOutputDataOutputMap(i);if(w){const{added:A,updated:V,removed:L,affected:U}=this.syncOutputDataOutputMapDataType(w,a);l.push(...V),p.push(...A),t.push(...L),y.push(...U)}return a==null||a.attemptAutoclose("sync-operation-instance-validate-data",this.id),{updated:R(l),added:R(p),removed:R(t),affected:R(y),self:i}}syncEntityToMatchInputMapDataType(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-entity-to-match-input-map-data-type"))){var w,A,V,L,U,k,q,H,ie,te,pe,ne,me,J,ae;const l=[],p=[],t=[],y=[];if(((w=i.declaration)==null?void 0:w.id)!==ve.operation[rr.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=this.project.requestActiveValue(i),b=v==null?void 0:v.valueAsTypeSingle;if(!i.dataType){const ce={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,parentRelationType:null,options:((A=i.declaration.dataType)==null?void 0:A.options)||null,implementationChooseOne:((V=i.declaration.dataType)==null?void 0:V.implementationChooseOne)||!1,staticEntities:((L=i.declaration.dataType)==null?void 0:L.staticEntities)??null,interactiveEntities:((U=i.declaration.dataType)==null?void 0:U.interactiveEntities)??null,actionEntities:((k=i.declaration.dataType)==null?void 0:k.actionEntities)??null,isList:((q=i.declaration.dataType)==null?void 0:q.isList)||!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:(b==null?void 0:b.toJSON())||null,like:!0,inferred:!0,parent:i.toReference()},Y=ee(ce,i.project);Y.hydrateAncestors(),Y.setParent(i,a),Y.initChildren(a),Y.setEntity(b,a),a==null||a.add(Y,K.Added),l.push(Y),i.setDataType(Y,a)}return(J=i.dataType)==null||J.metaSync({inferred:!0,like:!1,asType:!0,options:((H=i.declaration.dataType)==null?void 0:H.options)||null,implementationChooseOne:((ie=i.declaration.dataType)==null?void 0:ie.implementationChooseOne)||!1,staticEntities:((te=i.declaration.dataType)==null?void 0:te.staticEntities)??null,interactiveEntities:((pe=i.declaration.dataType)==null?void 0:pe.interactiveEntities)??null,actionEntities:((ne=i.declaration.dataType)==null?void 0:ne.actionEntities)??null,isList:((me=i.declaration.dataType)==null?void 0:me.isList)||!1},a),(ae=i.dataType)==null||ae.setEntity(b,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(l),removed:R(t),affected:R(y),self:i.dataType}}syncDataToValidateInputMapDataType(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-data-to-validate-input-map-data-type"))){var A,V,L;const l=[],p=[],t=[],y=[];if(((A=i.declaration)==null?void 0:A.id)!==ve.operation[rr.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 U={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,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()},k=ee(U,i.project);k.setParent(i,a),k.initChildren(a),a==null||a.add(k,K.Added),l.push(k),i.setDataType(k,a)}(V=i.dataType)==null||V.metaSync({inferred:!0,like:!0,asType:!1},a);const w=this.getEntityToMatch(v,a);return(L=i.dataType)==null||L.setEntity(w,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(l),removed:R(t),affected:R(y),self:i.dataType}}syncOutputDataOutputMapDataType(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-output-data-output-map-data-type"))){var V,L,U;const l=[],p=[],t=[],y=[];if(((V=i.declaration)==null?void 0:V.id)!==ve.operation[rr.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 w=this.project.requestActiveValue(v),A=(w==null?void 0:w.valueAsTypeSingle)||null;if(!i.dataType){const k={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,staticEntities:null,interactiveEntities: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()},q=ee(k,i.project);q.hydrateAncestors(),q.setParent(i,a),q.initChildren(a),q.setEntity(A,a),a==null||a.add(q,K.Added),l.push(q),i.setDataType(q,a)}return(L=i.dataType)==null||L.metaSync({inferred:!0,like:!0,asType:!1},a),(U=i.dataType)==null||U.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(l),removed:R(t),affected:R(y),self:i.dataType}}inferInputMapDataType(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"infer-input-map-data-type-validate-data"))){var p,t,y;if(((p=i.declaration)==null?void 0:p.id)===ve.operation[rr.Validate].inputs.entityToMatch.id){const{added:v,updated:b,removed:w,affected:A}=this.syncEntityToMatchInputMapDataType(i,a);return a==null||a.attemptAutoclose("infer-input-map-data-type",this.id),{updated:R(b),added:R(v),removed:R(w),affected:R(A),self:i.dataType}}if(((t=i.declaration)==null?void 0:t.id)===ve.operation[rr.Validate].inputs.dataToValidate.id){const{added:v,updated:b,removed:w,affected:A}=this.syncDataToValidateInputMapDataType(i,a);return a==null||a.attemptAutoclose("infer-input-map-data-type",this.id),{updated:R(b),added:R(v),removed:R(w),affected:R(A),self:i.dataType}}const l=(y=i.declaration)==null?void 0:y.getDataType(a);if(l&&l.isResolved)return a==null||a.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:l};if(i.readsValue){const v=Ws(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,P.sessionAuthor,N().toISOString(),this,!0,"infer-output-map-data-type-validate-data"))){var l;if(((l=i.declaration)==null?void 0:l.id)===ve.operation[rr.Validate].outputs.outputEntity.id){const{added:p,updated:t,removed:y,affected:v}=this.syncOutputDataOutputMapDataType(i,a);return a==null||a.attemptAutoclose("infer-output-map-data-type-validate-data",this.id),{updated:R(t),added:R(p),removed:R(y),affected:R(v),self:i.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}}class qye extends Ut{constructor(u){super(q0,u)}}class Sye extends Ut{constructor(u){super(Z0,u)}}class Zye extends Ut{constructor(u){super(J0,u)}}class Jye extends Ut{constructor(u){super(Cf,u)}}class Wye extends Ut{constructor(u){super(_f,u)}}class Hye extends Ut{constructor(u){super(mu,u)}}function Yye(d){const u=[new XU(d),new YU(d),new zU(d),new Gye(d),new Kye(d),new kye(d),new Jye(d),new qye(d),new Zye(d),new Sye(d),new Wye(d),new Hye(d),new Ut(k0,d),new Ut(K0,d)];return u.forEach(i=>{i.initChildren(null),d.subscribeBuiltInInstance(i)}),d.operationDeclarations=u,u}class QU extends gn{constructor(i){super(si,i);D(this,"initialData");D(this,"id",Oe.PERSISTED_ENTITY);D(this,"version","1");D(this,"name",Oe.PERSISTED_ENTITY);D(this,"description",si.description);D(this,"type",f.BuiltInBaseEntity);D(this,"abstract",si.abstract);D(this,"static",si.static);D(this,"properties",[]);D(this,"methods",[]);D(this,"abstractMethods",[]);D(this,"extends",[]);D(this,"errors",[]);D(this,"project");this.initialData=si,this.project=i,this.id=si.id,this.version=si.version,this.name=si.name,this.static=si.static,this.abstract=si.abstract,this.properties=this.initialData.properties.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.methods=this.initialData.methods.map(a=>{const l=ee(a,this.project);return l.parent=this,l}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const l=ee(a,this.project);return l.parent=this,l}),this.extends=this.initialData.extends.map(a=>ee(a,this.project))}}var ex=(d=>(d.StatusCodeMustBeNumber="status-code-must-be-number",d.StatusCodeMustBeBetween100And599="status-code-must-be-between-100-and-599",d))(ex||{});function tx(d,u){const i=[];if(typeof u!="number"){const a=new St({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.`,issue:null,severity:Z.Error,code:"status-code-must-be-number",entity:d});return i.push(a),{errors:i,override:u}}if(u<100){const a=new St({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.`,issue:null,severity:Z.Error,code:"status-code-must-be-between-100-and-599",entity:d});i.push(a)}if(u>599){const a=new St({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.`,issue:null,severity:Z.Error,code:"status-code-must-be-between-100-and-599",entity:d});i.push(a)}return{errors:i,override:u}}class rx extends gn{constructor(i){super(Gi,i);D(this,"initialData");D(this,"id",Oe.PERSISTED_ENTITY);D(this,"version","1");D(this,"name",Oe.PERSISTED_ENTITY);D(this,"description",Gi.description);D(this,"type",f.BuiltInBaseEntity);D(this,"abstract",Gi.abstract);D(this,"static",Gi.static);D(this,"properties",[]);D(this,"methods",[]);D(this,"abstractMethods",[]);D(this,"extends",[]);D(this,"errors",[]);D(this,"project");this.initialData=Gi,this.project=i,this.id=Gi.id,this.version=Gi.version,this.name=Gi.name,this.static=Gi.static,this.abstract=Gi.abstract,this.properties=this.initialData.properties.map(t=>{const y=ee(t,this.project);return y.setParent(this,null),y.initChildren(null),y}),this.methods=this.initialData.methods.map(t=>{const y=ee(t,this.project);return y.parent=this,y}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const y=ee(t,this.project);return y.parent=this,y}),this.extends=this.initialData.extends.map(t=>ee(t,this.project));const a=this.properties.find(t=>t.id===ve["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=(t,y)=>Gj(t,y);const l=this.abstractMethods.find(t=>t.id===ve["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id);if(!l)throw new Error("Handler method not found in endpoint entity");const p=l.outputs.find(t=>t.id===ve["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=(t,y)=>tx(t,y)}}const zye="test_primitive_entities_export";class Xye extends gn{constructor(i){super(zr,i);D(this,"initialData");D(this,"id",Oe.PERSISTED_ENTITY);D(this,"version","1");D(this,"name",Oe.PERSISTED_ENTITY);D(this,"description",zr.description);D(this,"type",f.BuiltInBaseEntity);D(this,"abstract",zr.abstract);D(this,"static",zr.static);D(this,"properties",[]);D(this,"methods",[]);D(this,"abstractMethods",[]);D(this,"extends",[]);D(this,"errors",[]);D(this,"project");this.initialData=zr,this.project=i,this.id=zr.id,this.version=zr.version,this.name=zr.name,this.static=zr.static,this.abstract=zr.abstract,this.properties=this.initialData.properties.map(l=>{const p=ee(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.methods=this.initialData.methods.map(l=>{const p=ee(l,this.project);return p.parent=this,p}),this.abstractMethods=this.initialData.abstractMethods.map(l=>{const p=ee(l,this.project);return p.parent=this,p}),this.extends=this.initialData.extends.map(l=>ee(l,this.project));const a=this.properties.find(l=>l.id===ve["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=(l,p)=>Kj(l,p)}}function Qye(d){const u=[new QU(d),new rx(d),new Xye(d),new gn(Sf,d)];return u.forEach(i=>{d.subscribeBuiltInInstance(i)}),d.builtInBaseEntities=u,u}function eme(d){const u=[new Vi(qe,d),new Vi(Sn,d),new Vi(ut,d),new Vi(M0,d),new Vi(Yr,d),new Vi(Zn,d),new Vi(pn,d),new Vi(Jn,d),new Vi(wl,d)];return u.forEach(i=>{d.subscribeBuiltInInstance(i)}),d.primitives=u,u}function tme(d){const u=[new Ut(Jf,d)];return u.forEach(i=>{i.initChildren(null),d.subscribeBuiltInInstance(i)}),d.globalEventActionDescriptors=u,u}function rme(d){const u=[new Ut(Au,d),new Ut(Ia,d),new Ut(Tu,d),new Ut(gl,d),new Ut(Dl,d),new Ut(Mf,d)];u.forEach(a=>{a.initChildren(null),d.subscribeBuiltInInstance(a)}),d.loopDeclarations=u;const i=[new Ut(Ff,d),new Ut(bu,d),new Ut(Uf,d),new Ut(av,d),new Ut(lv,d),new Ut(jf,d)];return i.forEach(a=>{a.initChildren(null),d.subscribeBuiltInInstance(a)}),d.loopDeclarationsBodies=i,u}function ime(d){const u=[new zs(Wf,d),new zs(Ov,d)];return u.forEach(i=>{i.initChildren(null),d.subscribeBuiltInInstance(i)}),d.valueDescriptors=u,u}function sme(d){const u=[new Ut(Ao,d),new Ut(gv,d),new Ut(Vl,d)];return u.forEach(i=>{i.initChildren(null),d.subscribeBuiltInInstance(i)}),d.conditionDeclarations=u,u}const qo={},Ny={},wp={empty:!1,enrich:!0,mock:!1,ignoreCache:!1,onFetch:async()=>null,manuallyInit:!1};function ix(d,u={enrich:!0,shallowErrors:!1}){const i={enrich:!0,shallowErrors:!1,...u},{enrich:a,shallowErrors:l}=i,p=d.project,t=d.record,y=new ca(p),v=new Set;t[p.id]=p,v.add(p.id);const b=N().toISOString();Object.values(t).forEach(V=>{!V||y.allBuiltInEntityIds.includes(V.id)||v.add(V.id)}),y.order=Array.from(v),y.flatRecord=t,y.orderEntities();const w=Ly(d.project);w.instances[p.id]=w;const A=a?w.addChangeSet(new G(w,P.sessionAuthor,b,w,!0,"project-init-from-fetch-result")):null;return y.visit(V=>{if(V.id===w.id)return;const L=ee(V,w);try{L.hydrateAncestors(),L.addSelfToProject(null);const U=Ed(V);Object.keys(U.downstream).forEach(k=>{const q=w.get(k);q&&q.hydrateAncestors()})}catch(U){if(l)console.error("Error hydrating ancestors: ",U);else throw U}}),a?(y.visit(V=>{if(V.id===w.id)return;const L=w.get(V.id);L&&L.afterAllChildrenInitialized(A)}),w.afterAllChildrenInitialized(A)):By(w,b).forEach(L=>{L.remove({ignoreUpstream:!0},null)}),w.instancesList.forEach(V=>{V.previousVersion=null}),A==null||A.attemptAutoclose("project-init-from-fetch-result",w.id),w}async function nme(d,u=wp){const i={...wp,...u};if(i.empty)return{data:{project:{id:d.id,type:f.Project,version:P.UUID.uuid(),createdAt:N().toISOString(),author:P.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 l={...CE};return l.id=d.id,{data:{project:l,record:{}}}}return console.log("Fetching project from external API"),new Promise(async l=>{try{if(i.onFetch){const p=await i.onFetch(d.id);if(p){l({data:p});return}}else l({data:null})}catch(p){console.error("Error fetching project: ",p),l({data:null})}})}function Ly(d){const u=new P(d);return eme(u),Qye(u),Yye(u),tme(u),rme(u),ime(u),sme(u),Array.from(new Set([...u.getAllBuiltInIds(),...Os()])).forEach(a=>{if(!u.builtInInstances[a]&&u.instances[a])u.builtInInstances[a]=u.instances[a],delete u.instances[a];else if(!u.builtInInstances[a])throw new Error(`Built in entity was not properly initialized: ${a}`)}),u.instances[u.id]=u,u}function By(d,u){return d.instancesList.filter(a=>N(a.createdAt).isAfter(N(u)||!!a.previousVersion))}function ame(d,{enrich:u}={enrich:!0}){const i=new Map,a=new Map,l=Array.from(new Set([...d.getAllBuiltInIds(),...Os()]));Object.keys(d.instances).forEach(w=>{if(l.includes(w)){i.set(w,w),a.set(w,w);return}const A=d.get(w);if(!Py(A,{...d.instances,...d.builtInInstances}).every(k=>!l.includes(k))){i.set(w,w),a.set(w,w);return}const U=P.UUID.uuid();i.set(w,U),a.set(U,w)});const p=N().toISOString(),t=d.toShallowJSON({seenEntityMaps:i});t.previousVersion=null,t.createdAt=p,t.version=P.UUID.uuid();const y=Ly(t);y.instances[y.id]=y;const v=u?y.addChangeSet(new G(y,P.sessionAuthor,p,y,!0,"project-clone")):null,b=new ca(d);return b.visit(w=>{const A=w.toShallowJSON({seenEntityMaps:i});A.previousVersion=null,A.createdAt=p,A.version=P.UUID.uuid();const V=Ed(A,sU(b.flatRecord,i));if(Object.keys(V.upstream).length){let U=!1;if(Object.keys(V.upstream).forEach(k=>{if(!U&&(!y.get(k)||y.getDeleted(k))){U=!0;return}}),U)return}const L=ee(A,y);L.hydrateAncestors(),L.addSelfToProject(v),v==null||v.add(L,K.Added)}),u?(b.visit(w=>{if(w.id===y.id)return;const A=y.get(i.get(w.id));A&&A.afterAllChildrenInitialized(v)}),y.afterAllChildrenInitialized(v)):By(y,p).forEach(A=>{A.remove({ignoreUpstream:!0},null)}),y.instancesList.forEach(w=>{w.previousVersion=null}),v==null||v.attemptAutoclose("project-clone",y.id),y}function sx(d,{enrich:u}={enrich:!0}){const i=Ly(d),a=N().toISOString(),l=u?i.addChangeSet(new G(i,P.sessionAuthor,a,i,!0,"project-init")):null;l&&(l.type=JT.Automatic);const p=new ca(d);return p.visit(t=>{const y=ee(t,i);y.hydrateAncestors(),y.addSelfToProject(l)}),u?(p.visit(t=>{if(t.id===i.id)return;const y=i.get(t.id);y&&y.afterAllChildrenInitialized(l)}),i.afterAllChildrenInitialized(l)):(By(i,a).forEach(v=>{v.remove({ignoreUpstream:!0},null)}),new ca(i).visit(v=>{v.initialized=!0,v.captureVersion()})),i.initialized=!0,l==null||l.attemptAutoclose("project-init",i.id),i}async function ome(d,u=wp){const i={...wp,...u};if(d.id&&qo[d.id]&&!i.ignoreCache)return qo[d.id];if(d.id&&Ny[d.id]&&!i.ignoreCache)return await Ny[d.id],qo[d.id];const a=nme(d,i);d.id&&(Ny[d.id]=a);const l=await a;if(l.data){let p;return i.mock?p=sx(CE,{enrich:!!i.enrich}):l.data instanceof P?p=l.data:p=ix(l.data,{enrich:!!i.enrich}),qo[d.id]=p,d.id&&delete Ny[d.id],p}return null}function lme(d){return qo[d.id]&&delete qo[d.id],null}var Ae=(d=>(d.Inherited="inherited",d.DefaultValue="default-value",d.Missing="missing",d.Empty="empty",d.AutoCalculated="auto-calculated",d.QueuedAutocalculation="queued-autocalculation",d.External="external",d.Testing="testing",d.ExecutionResult="execution-result",d))(Ae||{});const nx={initialized:!1,id:"",project:null,values:{},onWriteCallback:()=>{},onRemoveCallback:()=>{},onWrite:()=>{},onRemove:()=>{},init:()=>{},toJSON:()=>({}),writeValue:()=>{},readValue:()=>null,removeValue:()=>{},clear:()=>{}};function dme(d,u){return{...nx,id:d,project:u}}class Rp{constructor(u,i){D(this,"initialized",!1);D(this,"id");D(this,"project");D(this,"values",{});D(this,"onWriteCallback",()=>{});D(this,"onRemoveCallback",()=>{});this.id=u,this.project=i,this.init()}onWrite(u){this.onWriteCallback=u}onRemove(u){this.onRemoveCallback=u}init(){if(!this.project.id||this.initialized)return;const u={},i={};Object.keys(u).forEach(a=>{const l=u[a],p=new Ei(l,this.project);try{if(l.parent){const v=this.project.findSubscribedInstanceFromReference(l.parent);if(!v)return;p.setParent(v,null),p.hydrateAncestors(),p.initChildren(null)}else if(l.standaloneParent){const v=this.project.findSubscribedInstanceFromReference(l.standaloneParent);if(!v)return;p.standalone=!0,p.setStandaloneParent(v),p.hydrateAncestors(),p.initChildren(null)}i[a]=p;const t=p.parent||p.standaloneParent,y=ox(p,t,this.project);y?i[a]=y:delete u[a]}catch(t){console.error("Error hydrating ancestors: ",t),delete u[a]}}),this.values={...this.values,...i},this.initialized=!0}toJSON(){const u={};return Object.keys(this.values).forEach(i=>{u[i]=this.values[i].toJSON()}),u}writeValue(u,i){if(!u)throw new Error("The value owner entity is required when writing a value to a value store");let l=this.values[u.id];if(!l)if(i instanceof Ei)l=i;else if(i)l=kt(i,this.project);else{const p={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:new Date().toISOString(),author:P.sessionAuthor,deleted:!1,previousVersion:null,value:null,type:f.LiteralValue,standaloneParent:u.toReference(),parent:null,valueAsTypeSingle:null,valueAsTypeList:null,autogeneration:null,name:Fo(u.getDataType(null))};l=kt(p,this.project)}l.standalone=!0,l.initialData.standaloneParent||console.warn("instance.initialData: ",l.initialData),l.setStandaloneParent(u),l.hydrateAncestors(),l.initChildren(null),i&&(l.metaSync({...i},null),l.setValueAsType(i.valueAsType,null)),this.values[u.id]=l,this.onWriteCallback(u,l)}readValue(u){return this.values[u]||null}removeValue(u){if(!this.values[u])return;delete this.values[u];const i=this.project.get(u);i&&this.onRemoveCallback(i)}clear(){this.values={}}}function So(d){var u;return!!(d.required||(u=d.declaration)!=null&&u.required)}function ax(d){return cB(d)||d===void 0||d===""}function Hb(d){return d?d.valueAsType?!1:ax(d.value):!0}function Qs(d,u,i,a){var y;let l;if(((y=d==null?void 0:d.entity)==null?void 0:y.type)===f.PrimitiveEntity)switch(d.entity.name){case X.EntityTemplate:l=X.EntityTemplate;break;case X.String:l=X.String;break;case X.Number:l=X.Number;break;case X.Boolean:l=X.Boolean;break;case X.Null:l=X.Null;break;case X.Enum:l=X.Enum;break;case X.KeyValue:l=X.KeyValue;break;case X.Untyped:l=X.Untyped;break;case X.KeyValue:l=X.KeyValue;break;case X.Date:l=X.Date;break;case X.UUID:l=X.UUID;break;case X.File:l=X.File;break;default:throw new Error(`Primitive type ${re(d.entity,i)} is not supported`)}else l=X.Untyped;const p=Ei.new();p.name=l,p.parent=u.toReference();const t=ee(p,i);return t.hydrateAncestors(),a==null||a.add(t,K.Added),t.addSelfToProject(a),t.initChildren(a),t}function en(d,u,i=new Set){var a;if(i.has(d.id))return[];if(i.add(d.id),d.type===f.ReturnDeclaration){const l=[d,...d.getCounterparts()];return console.log("Resolved counterparts for return declaration: ",`${d.name} ${d.id}`),console.log("equivalentReturnDeclarations: ",l.map(p=>`${p.name} ${p.id}`)),R([...l,...l.flatMap(p=>en(p,u,i))])}else if(rt.includes(d.type)){const l=di(d);return R([l,...[l].flatMap(p=>en(p,u,i))])}else if(d.type===f.OutputMap){if(rt.includes(d.parent.type)&&d.declaration.type===f.Property&&d.declaration.static)return R([d,d.declaration,...[d,d.declaration].flatMap(l=>en(l,u,i))])}else if(d.type===f.InputMap&&rt.includes(d.parent.type)&&((a=d.declaration)==null?void 0:a.type)===f.Property&&d.declaration.static)return R([d.declaration,...[d.declaration].flatMap(l=>en(l,u,i))]);return[d]}function ox(d,u,i){return d}function Id(d,u){const i=d.readsValue;let a=null;if((i==null?void 0:i.type)===f.VariableDeclaration){const p=gp(i,u);if(p&&p.value){const t={sources:[p],target:d};a={value:p.value,valueOwner:d,type:Ae.Inherited,inheritanceLink:t}}}else if((i==null?void 0:i.type)===f.VariableInstance){const p=jy(i,u);if(p&&p.value){const t={sources:[p],target:d};a={value:p.value,valueOwner:d,type:Ae.Inherited,inheritanceLink:t}}}else if((i==null?void 0:i.type)===f.OutputMap){const p=Qb(i,u);if(p&&p.value){const t={sources:[p],target:d};a={value:p.value,valueOwner:d,type:Ae.Inherited,inheritanceLink:t}}}else if((i==null?void 0:i.type)===f.ArgumentDeclaration){const p=zb(i,u);if(p){const t={sources:[p],target:d};a={value:p.value,valueOwner:d,type:Ae.Inherited,inheritanceLink:t}}}return a}function Ye(d,u,i){var t;if(!u)return null;let a;if(((t=d==null?void 0:d.entity)==null?void 0:t.type)===f.PrimitiveEntity)switch(d.entity.name){case X.EntityTemplate:a=X.EntityTemplate;break;case X.String:a=X.String;break;case X.Number:a=X.Number;break;case X.Boolean:a=X.Boolean;break;case X.Null:a=X.Null;break;case X.Enum:a=X.Enum;break;case X.KeyValue:a=X.KeyValue;break;case X.Untyped:a=X.Untyped;break;case X.KeyValue:a=X.KeyValue;break;case X.Date:a=X.Date;break;case X.UUID:a=X.UUID;break;case X.File:a=X.File;break;default:throw new Error(`Primitive type ${re(d.entity,i)} is not supported`)}else a=X.Untyped;const l=Ei.new();l.name=a,l.standaloneParent=u.toReference();let p=new Ei(l,i);return p.hydrateAncestors(),p.standalone=!0,p.setStandaloneParent(u),p.initChildren(null),p}function My(d,u,i){var p;const a={...d},l=u.inputs;if(!l)return a;for(const t of l){const y=tA(t,i);if(y&&y.value){const v=re(t,i.project),b=Zr(v);a[b]=(p=y==null?void 0:y.value)==null?void 0:p.value}}return a}function _p(d,u,i){var p;const a={...d},l=u.inputs;if(!l)return a;for(const t of l){const y=eA(t,i);if(y&&y.value){const v=re(t,i.project),b=Zr(v);a[b]=(p=y==null?void 0:y.value)==null?void 0:p.value}}return a}function lx(d,u){var y,v,b,w,A,V,L;let i={};if(((v=(y=d.dataType)==null?void 0:y.entity)==null?void 0:v.type)===f.DefinitionEntity&&(i={...i,...d.dataType.entity.getActiveRawDefaultValue()}),u.execution&&u.execution.hasEntity(d)){const U=(b=u.lastExecutionResults)==null?void 0:b.readValue(d.id);if(U){if(sr(U.value)){const q={...i,...U.value},H={..._p(q,d,u)};d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("1- newRawValue",H),U.metaSync({value:H},null)}return{value:U,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}}const a=!!((w=u.execution)!=null&&w.entities.length),l=(A=u.execution)==null?void 0:A.hasEntity(d),p=d.readsValue;let t=null;if(p){const U=(V=u.execution)==null?void 0:V.hasEntity(p);if((!a||a&&U&&l||a&&!U&&!l)&&(t=Id(d,u),t&&t.value&&sr(t.value.value))){const q={...i,...t.value.value},H={..._p(q,d,u)};d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("2- newRawValue",H),t.value.metaSync({value:H},null)}}if(!t&&d.defaultValue){const U=d.defaultValue;if(U.value===null&&U.autogeneration){const k=nh(U);if(U.metaSync({value:k},null),sr(k)){const q={..._p(k,d,u)};d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("3- newRawValue",q),U.metaSync({value:q},null)}}t={value:U,valueOwner:d,type:U.value===null?Ae.Empty:Ae.DefaultValue,inheritanceLink:null}}if(!t||t.type===Ae.DefaultValue){const U=(L=u.localTestValues)==null?void 0:L.readValue(d.id);if(U){if(sr(U.value)){const k={...i,...U.value},q={..._p(k,d,u)};d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("4- newRawValue",q),U.metaSync({value:q},null)}return{value:U,valueOwner:d,type:Ae.Testing,inheritanceLink:null}}}return t||{value:null,valueOwner:d,type:Ae.Empty,inheritanceLink:null}}function dx(d,u){var l,p,t,y,v;let i={};if(((p=(l=d.dataType)==null?void 0:l.entity)==null?void 0:p.type)===f.DefinitionEntity&&(i={...i,...d.dataType.entity.getActiveRawDefaultValue()},d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("initialDefaultValue",i)),u.execution&&u.execution.hasEntity(d)){const b=(t=u.lastExecutionResults)==null?void 0:t.readValue(d.id);if(b){if(sr(b.value)){const A={...i,...b.value};b.metaSync({value:{...My(A,d,u)}},null)}return{value:b,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}}const a=(y=u.localTestValues)==null?void 0:y.readValue(d.id);if(d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("testValue",a),a){if(sr(a.value)){const w={...i,...a.value};a.metaSync({value:{...My(w,d,u)}},null)}return{value:a,valueOwner:d,type:Ae.Testing,inheritanceLink:null}}if((v=d.dataType)!=null&&v.entity&&d.dataType.entity.type===f.DefinitionEntity&&d.dataType.isObject()){const b=Ye(d.dataType,d,u.project);return b==null||b.metaSync({value:My(i,d,u)},null),{value:b,valueOwner:d,type:Ae.DefaultValue,inheritanceLink:null}}return null}function gp(d,u){var y,v,b,w,A,V;if((y=d.dataType)!=null&&y.isObject())return lx(d,u);const i=cr(d),a=!!((v=u.execution)!=null&&v.entities.length),l=(b=u.execution)==null?void 0:b.hasEntity(i),p=d.readsValue;let t=null;if(p){const L=(w=u.execution)==null?void 0:w.hasEntity(p);(!a||a&&L&&l||a&&!L&&!l)&&(t=Id(d,u))}if(!t&&d.defaultValue){const L=d.defaultValue;if(L.value===null&&L.autogeneration){const U=nh(L);L.metaSync({value:U},null)}t={value:L,valueOwner:d,type:L.value===null?Ae.Empty:Ae.DefaultValue,inheritanceLink:null}}return(!t||t.type===Ae.DefaultValue)&&(A=u.localTestValues)!=null&&A.values[d.id]?{value:(V=u.localTestValues)==null?void 0:V.values[d.id],valueOwner:d,type:Ae.Testing,inheritanceLink:null}:t||{value:null,valueOwner:d,type:Ae.Empty,inheritanceLink:null}}function Yb(d,u){var a,l,p,t;if(d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("resolveVarDeclarationValue",d),(a=d.dataType)!=null&&a.isObject())return d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("current value is object"),dx(d,u);if(u.execution&&u.execution.hasEntity(d)){const y=(l=u.lastExecutionResults)==null?void 0:l.readValue(d.id);if(y)return{value:y,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}const i=(p=u.localTestValues)==null?void 0:p.readValue(d.id);if(i)return{value:i,valueOwner:d,type:Ae.Testing,inheritanceLink:null};if((t=d.dataType)!=null&&t.entity&&d.dataType.entity.type===f.DefinitionEntity&&d.dataType.isObject()){const y=Ye(d.dataType,d,u.project),v=d.dataType.entity.getActiveRawDefaultValue();return d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("resolvedRawValue",v),y==null||y.metaSync({value:v},null),{value:y,valueOwner:d,type:Ae.DefaultValue,inheritanceLink:null}}return null}function jy(d,u){var b,w,A,V,L;d.id==="e749df9b-6b68-4baf-a3c5-59ca15c2492f"&&console.log("resolveVarInstanceNextValue");const i=!!((b=u.execution)!=null&&b.entities.length),a=(w=u.execution)==null?void 0:w.hasEntity(d);let l=null;const p=d.readsValue;if(p){const U=(A=u.execution)==null?void 0:A.hasEntity(p);(!i||i&&U&&a||i&&!U&&!a)&&(l=Id(d,u))}const t=d.declaration;if(!l&&t){d.id==="e749df9b-6b68-4baf-a3c5-59ca15c2492f"&&console.log("resolveVarInstanceNextValue resolveVarDeclarationNextValue");const U=gp(t,u);U&&U.value&&(l=U)}if((!l||l.type===Ae.DefaultValue)&&(V=u.localTestValues)!=null&&V.values[d.id])return{value:(L=u.localTestValues)==null?void 0:L.values[d.id],valueOwner:d,type:Ae.Testing,inheritanceLink:null};const y=So(d);return y&&a&&!l?{value:null,valueOwner:d,type:Ae.Missing,inheritanceLink:null}:a&&!y&&!l?{value:null,valueOwner:d,type:Ae.Empty,inheritanceLink:null}:l||{value:null,valueOwner:d,type:Ae.External,inheritanceLink:null}}function ux(d,u){return Yb(d.declaration,u)}function zb(d,u){var v,b,w,A,V;if(u.execution&&u.execution.hasEntity(d)){const L=(v=u.lastExecutionResults)==null?void 0:v.readValue(d.id);if(L)return{value:L,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}const i=cr(d),a=d.parent.type===f.FunctionDeclaration&&d.parent.parent.type===f.Loop?d.parent:null,l=!!((b=u.execution)!=null&&b.hasEntity(i))||!!a&&!!((w=u.execution)!=null&&w.hasEntity(a));let p=null;if(d.defaultValue){const L=d.defaultValue;if(L.value===null&&L.autogeneration){const U=nh(L);L.metaSync({value:U},null)}p={value:L,valueOwner:d,type:L.value===null?Ae.Empty:Ae.DefaultValue,inheritanceLink:null}}if((!p||p.type===Ae.DefaultValue)&&(A=u.localTestValues)!=null&&A.values[d.id])return{value:(V=u.localTestValues)==null?void 0:V.values[d.id],valueOwner:d,type:Ae.Testing,inheritanceLink:null};const t=So(d);let y=t&&l&&!p;return i.type===f.Loop&&l&&(y=!1),y?{value:null,valueOwner:d,type:Ae.Missing,inheritanceLink:null}:l&&!t&&!p?{value:null,valueOwner:d,type:Ae.Empty,inheritanceLink:null}:p||{value:null,valueOwner:d,type:Ae.External,inheritanceLink:null}}function Xb(d,u){var b,w,A,V,L,U;if(u.execution&&u.execution.hasEntity(d)){const k=(b=u.lastExecutionResults)==null?void 0:b.readValue(d.id);if(k)return{value:k,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}const i=cr(d),a=!!((w=u.execution)!=null&&w.entities.length),l=(A=u.execution)==null?void 0:A.hasEntity(i),p=d.readsValue;let t=null;if(p){const k=(V=u.execution)==null?void 0:V.hasEntity(p);(!a||a&&k&&l||a&&!k&&!l)&&(t=Id(d,u))}if(!t&&d.defaultValue&&(t={value:d.defaultValue,valueOwner:d,type:Ae.DefaultValue,inheritanceLink:null}),(!t||t.type===Ae.DefaultValue)&&(L=u.localTestValues)!=null&&L.values[d.id])return{value:(U=u.localTestValues)==null?void 0:U.values[d.id],valueOwner:d,type:Ae.Testing,inheritanceLink:null};const y=So(d);return y&&!t?{value:null,valueOwner:d,type:Ae.Missing,inheritanceLink:null}:!y&&!t?{value:null,valueOwner:d,type:Ae.Empty,inheritanceLink:null}:t}function Qb(d,u){var y,v,b,w,A;if(u.execution&&u.execution.hasEntity(d)){const V=(y=u.lastExecutionResults)==null?void 0:y.readValue(d.id);if(V)return{value:V,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}const i=cr(d);if(rt.includes(i.type)){const V=Ha(i,u),L=Zr(re(d,u.project));if(V!=null&&V.value&&sr(V.value.value)){const U=V.value.value[L],k=Ye(d.getDataType(null),d,u.project);return k==null||k.metaSync({value:U},null),{value:k,valueOwner:d,type:V.type,inheritanceLink:{sources:[V],target:d}}}return null}const a=(v=u.execution)==null?void 0:v.hasEntity(i),l=((b=u.execution)==null?void 0:b.state)===rA.Running;if((w=u.persistedExecutionResults)!=null&&w.values[d.id]&&!a&&!l){const V=(A=u.persistedExecutionResults)==null?void 0:A.readValue(d.id);if((V==null?void 0:V.value)!==null||V.valueAsType!==null)return{value:V,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}const p=d.getDefaultValue();if(p&&(p.value!==null||p.valueAsType!==null))return{value:p,valueOwner:d,type:Ae.DefaultValue,inheritanceLink:null};const t=d.parent;if(!t)throw new Error(`Couldn't find the parent that generates the output ${d.id}`);switch(t.type){case f.VariableInstance:{const L=jy(t,u);if(L&&L.value){const k=d.declaration;if(sr(L.value.value)){const q=L.value.value[k.name],H=Ye(d.declaration.dataType,d,u.project);return H==null||H.metaSync({value:q},null),{value:H,valueOwner:d,type:Ae.Inherited,inheritanceLink:{sources:[L],target:d}}}}const U=Ye(d.declaration.dataType,d,u.project);return U==null||U.metaSync({value:null},null),{value:U,valueOwner:d,type:Ae.Inherited,inheritanceLink:{sources:L?[L]:[],target:d}}}case f.VariableDeclaration:{const L=gp(t,u);if(L&&L.value){const k=d.declaration;if(sr(L.value.value)){const q=L.value.value[k.name],H=Ye(d.declaration.dataType,d,u.project);return H==null||H.metaSync({value:q},null),{value:H,valueOwner:d,type:Ae.Inherited,inheritanceLink:{sources:[L],target:d}}}}const U=Ye(d.declaration.dataType,d,u.project);return U==null||U.metaSync({value:null},null),{value:U,valueOwner:d,type:Ae.Inherited,inheritanceLink:{sources:L?[L]:[],target:d}}}case f.Operation:{const V=t.outputs.map(U=>{var q,H;if((q=u.persistedExecutionResults)!=null&&q.values[U.id]){const ie=(H=u.persistedExecutionResults)==null?void 0:H.values[U.id];if(ie.value!==null||ie.valueAsType!==null)return{value:ie,valueOwner:U,type:Ae.ExecutionResult,inheritanceLink:null}}const k=U.getDefaultValue();if(k&&(k.value!==null||k.valueAsType!==null))return{value:k,valueOwner:U,type:Ae.DefaultValue,inheritanceLink:null}}).filter(U=>!!U),L=Ye(d.declaration.dataType,d,u.project);return L==null||L.metaSync({value:null},null),{value:L,valueOwner:d,type:Ae.QueuedAutocalculation,inheritanceLink:V.length?{sources:V,target:d}:null}}case f.FunctionCall:{const V=t.inputs.map(U=>Dp(U,u)).filter(U=>!!U),L=Ye(d.declaration.dataType,d,u.project);return L==null||L.metaSync({value:null},null),{value:L,valueOwner:d,type:Ae.QueuedAutocalculation,inheritanceLink:V.length?{sources:V,target:d}:null}}case f.Loop:{const V=t.inputs.map(U=>Dp(U,u)).filter(U=>!!U),L=Ye(d.declaration.dataType,d,u.project);return L==null||L.metaSync({value:null},null),{value:L,valueOwner:d,type:Ae.QueuedAutocalculation,inheritanceLink:V.length?{sources:V,target:d}:null}}}return null}function cx(d,u){var y,v;if(!rt.includes(d.parent.type))return null;if(((y=d.declaration)==null?void 0:y.type)===f.Property&&d.declaration.static)return Ha(d.declaration,u);const i=di(d.parent),a=Uy(i,u),l=Zr(re(d,u.project)),p=Ye(d.getDataType(null),d,u.project),t=(v=a==null?void 0:a.value)==null?void 0:v.value;return t&&sr(t)?(p==null||p.metaSync({value:t[l]||null},null),{value:p,valueOwner:d,type:a.type,inheritanceLink:{sources:a?[a]:[],target:d}}):null}function px(d,u){var y,v;if(!rt.includes(d.parent.type))return null;if(((y=d.declaration)==null?void 0:y.type)===f.Property&&d.declaration.static)return Ha(d.declaration,u);const i=di(d.parent),a=Ha(i,u),l=Zr(re(d,u.project)),p=Ye(d.getDataType(null),d,u.project),t=(v=a==null?void 0:a.value)==null?void 0:v.value;return t&&sr(t)?(p==null||p.metaSync({value:t[l]||null},null),{value:p,valueOwner:d,type:a.type,inheritanceLink:{sources:[a],target:d}}):null}function eA(d,u){var b,w,A,V,L;const i=cr(d),a=!!((b=u.execution)!=null&&b.entities.length),l=(w=u.execution)==null?void 0:w.hasEntity(i),p=d.readsValue;let t=null;if(p){const U=(A=u.execution)==null?void 0:A.hasEntity(p);(!a||a&&U&&l||a&&!U&&!l)&&(d.id==="c1b53d2e-0916-48c6-a2fa-0d488af73a93"&&console.log("Here input-map is property of object -- resolving from writter"),t=Id(d,u),d.id==="c1b53d2e-0916-48c6-a2fa-0d488af73a93"&&console.log("Here input-map is property of object -- resolved from writter: ",t))}if(!t&&d.defaultValue){const U=d.defaultValue;U&&(t={value:U,valueOwner:d,type:Ae.DefaultValue,inheritanceLink:null})}if(!t&&d.declaration){const U=Ha(d.declaration,u);U&&U.value&&(t={...U,valueOwner:d,type:Ae.DefaultValue})}if((!t||t.type===Ae.DefaultValue||(t==null?void 0:t.type)===Ae.Empty)&&(V=u.localTestValues)!=null&&V.values[d.id])return{value:(L=u.localTestValues)==null?void 0:L.values[d.id],valueOwner:d,type:Ae.Testing,inheritanceLink:null};const y=So(d);return y&&!t||(t==null?void 0:t.type)===Ae.Empty?{value:null,valueOwner:d,type:Ae.Missing,inheritanceLink:(t==null?void 0:t.inheritanceLink)||null}:!y&&(!t||t.type===Ae.Inherited)&&!(t!=null&&t.inheritanceLink)?{value:null,valueOwner:d,type:Ae.Empty,inheritanceLink:null}:t}function tA(d,u){var a;if(u.execution&&u.execution.hasEntity(d)){const l=(a=u.lastExecutionResults)==null?void 0:a.readValue(d.id);if(l)return{value:l,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}return Dp(d,u)}function Dp(d,u){var i;return rt.includes(d.parent.type)&&(i=di(d.parent).dataType)!=null&&i.isObject()?cx(d,u):eA(d,u)}function fx(d,u){var i;return rt.includes(d.parent.type)&&(i=di(d.parent).dataType)!=null&&i.isObject()?px(d,u):tA(d,u)}function hx(d,u){var t,y,v;if(!d.static)return null;if(u.execution){const b=(t=u.lastExecutionResults)==null?void 0:t.readValue(d.id);if(b)return{value:b,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}if((y=u.localTestValues)!=null&&y.values[d.id])return{value:(v=u.localTestValues)==null?void 0:v.values[d.id],valueOwner:d,type:Ae.Testing,inheritanceLink:null};const i=d.getDefaultValue();let a=null;return i&&(a={value:i,valueOwner:d,type:Ae.DefaultValue,inheritanceLink:null}),So(d)&&Hb(a==null?void 0:a.value)?{value:null,valueOwner:d,type:Ae.Missing,inheritanceLink:null}:Hb(a==null?void 0:a.value)?{value:null,valueOwner:d,type:Ae.Empty,inheritanceLink:null}:a}function yx(d,u){var t,y,v,b,w,A,V;if(u.execution&&u.execution.hasEntity(d)){const L=(t=u.lastExecutionResults)==null?void 0:t.readValue(d.id);if(L)return{value:L,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}if((y=u.localTestValues)!=null&&y.values[d.id])return{value:(v=u.localTestValues)==null?void 0:v.values[d.id],valueOwner:d,type:Ae.Testing,inheritanceLink:null};const i=d.getDefaultValue();let a=null;return i&&(a={value:i,valueOwner:d,type:Ae.DefaultValue,inheritanceLink:null}),So(d)&&!((b=a==null?void 0:a.value)!=null&&b.value)&&!((w=a==null?void 0:a.value)!=null&&w.valueAsType)?{value:null,valueOwner:d,type:Ae.Missing,inheritanceLink:null}:!((A=a==null?void 0:a.value)!=null&&A.value)&&!((V=a==null?void 0:a.value)!=null&&V.valueAsType)?{value:null,valueOwner:d,type:Ae.Empty,inheritanceLink:null}:a}function Ha(d,u){switch(d.type){case f.ArgumentDeclaration:return zb(d,u);case f.InputMap:return fx(d,u);case f.VariableDeclaration:return Yb(d,u);case f.VariableInstance:return ux(d,u);case f.OutputMap:return Qb(d,u);case f.ReturnDeclaration:return Xb(d,u);case f.Property:return hx(d,u);case f.ValueDescriptor:return yx(d,u);default:return null}}function Uy(d,u){switch(d.type){case f.InputMap:return Dp(d,u);case f.VariableDeclaration:return gp(d,u);case f.VariableInstance:return jy(d,u);case f.ReturnDeclaration:return Xb(d,u);default:return null}}function ume(d){var u;if(d&&d.type===Ae.DefaultValue&&d.value&&d.valueOwner&&((u=d.valueOwner.defaultValue)==null?void 0:u.id)===d.value.id){const i=Ye(d.valueOwner.getDataType(null),d.valueOwner,d.valueOwner.project);return{type:Ae.DefaultValue,value:i,valueOwner:d.valueOwner,inheritanceLink:null}}return d}function Zo(d,u,i,a){let l=!1,p=null,t=null;a instanceof G?(l=!0,p=a,t=null):(p=null,t=a);const y=d.parent;return u.getVariableDeclarations().forEach(b=>{var A,V,L,U;const w=b.getDataType(null);if(((A=w==null?void 0:w.entity)==null?void 0:A.id)===y.id){let k=l?b.defaultValue:t==null?void 0:t.readValue(b.id);k?!l&&k&&k.id===((V=b.defaultValue)==null?void 0:V.id)&&(k=Ye(b.getDataType(null),b,u)):l?k=Qs(b.getDataType(null),b,u,p):k=Ye(b.getDataType(null),b,u);const q=re(d,u),H=Zr(q);let ie={};((U=(L=b.dataType)==null?void 0:L.entity)==null?void 0:U.type)===f.DefinitionEntity&&(ie={...ie,...b.dataType.entity.getActiveRawDefaultValue()}),sr(k==null?void 0:k.value)&&(ie={...ie,...k.value}),ie[H]=i,k==null||k.metaSync({value:ie},p),l||t==null||t.writeValue(b,k);return}}),p}function Cp(d,u,i,a){var L,U,k;let l=!1,p=null,t=null;a instanceof G?(l=!0,p=a,t=null):(p=null,t=a);const y=di(d.parent),v=y.getDataType(null);if(!(v!=null&&v.isObject()))return p;let b=l?y.defaultValue:t==null?void 0:t.readValue(y.id);b?!l&&b&&b.id===((L=y.defaultValue)==null?void 0:L.id)&&(b=Ye(y.getDataType(null),y,u)):l?b=Qs(y.getDataType(null),y,u,p):b=Ye(y.getDataType(null),y,u);const w=re(d,u),A=Zr(w);let V={};if(((k=(U=y.dataType)==null?void 0:U.entity)==null?void 0:k.type)===f.DefinitionEntity&&(V={...V,...y.dataType.entity.getActiveRawDefaultValue()}),sr(b==null?void 0:b.value)&&(V={...V,...b==null?void 0:b.value}),V[A]=i,b==null||b.metaSync({value:V},p),l||t==null||t.writeValue(y,b),(i===""||i===null||i===void 0)&&d.type===f.OutputMap){const q=y.inputs.find(H=>{var ie;return((ie=H.declaration)==null?void 0:ie.id)===d.declaration.id||re(H,u)===w});if(q){let H=l?q.defaultValue:t==null?void 0:t.readValue(q.id);H&&H.metaSync({value:null},p),l||t==null||t.removeValue(q.id)}}return p}function mx(d,u,i){var t,y,v,b;let a=!1,l=null,p=null;if(i instanceof G?(a=!0,l=i,p=null):(l=null,p=i),rt.includes(d.type)){const w=di(d);(t=w.dataType)!=null&&t.isObject()&&w.inputs.forEach(A=>{var V,L,U,k;if(((V=A.declaration)==null?void 0:V.type)===f.Property&&A.declaration.static){let q=a?d.defaultValue:p==null?void 0:p.readValue(A.declaration.id);q?!a&&q&&q.id===((L=A.declaration.defaultValue)==null?void 0:L.id)&&(q=Ye(A.declaration.getDataType(null),A.declaration,u)):a?q=Qs(A.declaration.getDataType(null),A.declaration,u,l):q=Ye(A.declaration.getDataType(null),A.declaration,u),q==null||q.metaSync({value:null},l),a||p==null||p.removeValue((U=A.declaration)==null?void 0:U.id)}else if(((k=A.declaration)==null?void 0:k.type)===f.Property){let q=a?d.defaultValue:p==null?void 0:p.readValue(A.id);q&&q.metaSync({value:null},l),a||p==null||p.removeValue(A.id)}})}else d.type===f.InputMap?((y=d.declaration)==null?void 0:y.type)===f.Property&&d.declaration.static?Zo(d.declaration,u,null,i):rt.includes(d.parent.type)&&((v=d.declaration)==null?void 0:v.type)===f.Property&&Cp(d,u,null,i):d.type===f.OutputMap?((b=d.declaration)==null?void 0:b.type)===f.Property&&d.declaration.static?Zo(d.declaration,u,null,i):rt.includes(d.parent.type)&&d.declaration.type===f.Property&&Cp(d,u,null,i):d.type===f.Property&&d.static&&Zo(d,u,null,i);return l}function vx(d,u,i,a){var y,v,b,w,A,V;let l=!1,p=null,t=null;if(a instanceof G?(l=!0,p=a,t=null):(p=null,t=a),rt.includes(u.type)){const L=di(u);if((y=L.dataType)!=null&&y.isObject()){let U={};((b=(v=L.dataType)==null?void 0:v.entity)==null?void 0:b.type)===f.DefinitionEntity&&(U={...U,...L.dataType.entity.getActiveRawDefaultValue()});const k=sr(d)?d:U;L.inputs.forEach(q=>{var H,ie,te;if(((H=q.declaration)==null?void 0:H.type)===f.Property&&q.declaration.static){let pe=l?u.defaultValue:t==null?void 0:t.readValue(q.declaration.id);pe?!l&&pe&&pe.id===((ie=q.declaration.defaultValue)==null?void 0:ie.id)&&(pe=Ye(q.declaration.getDataType(null),q.declaration,i)):l?pe=Qs(q.declaration.getDataType(null),q.declaration,i,p):pe=Ye(q.declaration.getDataType(null),q.declaration,i);const ne=re(q,i),me=Zr(ne),J=k[me];pe==null||pe.metaSync({value:J},p),l||t==null||t.writeValue(q.declaration,pe)}else if(((te=q.declaration)==null?void 0:te.type)===f.Property){let pe=l?u.defaultValue:t==null?void 0:t.readValue(q.id);pe&&pe.metaSync({value:null},p),l||t==null||t.removeValue(q.id)}})}}else u.type===f.InputMap?((w=u.declaration)==null?void 0:w.type)===f.Property&&u.declaration.static?Zo(u.declaration,i,d,a):rt.includes(u.parent.type)&&((A=u.declaration)==null?void 0:A.type)===f.Property&&Cp(u,i,d,a):u.type===f.OutputMap?((V=u.declaration)==null?void 0:V.type)===f.Property&&u.declaration.static?Zo(u.declaration,i,null,a):rt.includes(u.parent.type)&&u.declaration.type===f.Property&&Cp(u,i,null,a):u.type===f.Property&&u.static&&Zo(u,i,d,a);return p}function Ex(d,u,i){const a=en(d,u);let l=!1,p=null,t=null;return i instanceof G?(l=!0,p=i,t=null):(p=null,t=i),a.forEach(y=>{var b;let v=l?y.defaultValue:t==null?void 0:t.readValue(y.id);v?!l&&v&&v.id===((b=y.defaultValue)==null?void 0:b.id)&&(v=Ye(d.getDataType(null),d,d.project)):l?v=Qs(y.getDataType(null),y,u,p):v=Ye(y.getDataType(null),y,u),v==null||v.metaSync({value:null},p),l||t==null||t.removeValue(y.id),mx(y,u,i)}),p}function cme(d,u,i,a){if(d===""||d===null||d===void 0)return Ex(u,i,a);const l=en(u,i);let p=!1,t=null,y=null;return a instanceof G?(p=!0,t=a,y=null):(t=null,y=a),l.forEach(v=>{var w;let b=p?u.defaultValue:y==null?void 0:y.readValue(u.id);b?!p&&b&&b.id===((w=v.defaultValue)==null?void 0:w.id)&&(b=Ye(v.getDataType(null),v,i)):p?b=Qs(v.getDataType(null),v,i,t):b=Ye(v.getDataType(null),v,i),b==null||b.metaSync({value:d},t),p||y==null||y.writeValue(v,b),vx(d,v,i,a)}),t}function Jo(d,u,i,a){let l=!1,p=null,t=null;a instanceof G?(l=!0,p=a,t=null):(p=null,t=a);const y=d.parent;return u.getVariableDeclarations().forEach(b=>{var A,V,L,U;const w=b.getDataType(null);if(((A=w==null?void 0:w.entity)==null?void 0:A.id)===y.id){let k=l?b.defaultValue:t==null?void 0:t.readValue(b.id);k?!l&&k&&k.id===((V=b.defaultValue)==null?void 0:V.id)&&(k=Ye(b.getDataType(null),b,u)):l?k=Qs(b.getDataType(null),b,u,p):k=Ye(b.getDataType(null),b,u);const q=re(d,u),H=Zr(q);let ie={};((U=(L=b.dataType)==null?void 0:L.entity)==null?void 0:U.type)===f.DefinitionEntity&&(ie={...ie,...b.dataType.entity.getActiveRawDefaultValue()}),sr(k==null?void 0:k.value)&&(ie={...ie,...k.value}),Array.isArray(i)?ie[H]=(i==null?void 0:i.map(te=>te.toShallowJSON()))||null:ie[H]=(i==null?void 0:i.toShallowJSON())||null,k==null||k.metaSync({value:ie},p),l||t==null||t.writeValue(b,k);return}}),p}function Op(d,u,i,a){var L,U,k;let l=!1,p=null,t=null;a instanceof G?(l=!0,p=a,t=null):(p=null,t=a);const y=di(d.parent),v=y.getDataType(null);if(!(v!=null&&v.isObject()))return p;let b=l?y.defaultValue:t==null?void 0:t.readValue(y.id);b?!l&&b&&b.id===((L=y.defaultValue)==null?void 0:L.id)&&(b=Ye(y.getDataType(null),y,u)):l?b=Qs(y.getDataType(null),y,u,p):b=Ye(y.getDataType(null),y,u);const w=re(d,u),A=Zr(w);let V={};if(((k=(U=y.dataType)==null?void 0:U.entity)==null?void 0:k.type)===f.DefinitionEntity&&(V={...V,...y.dataType.entity.getActiveRawDefaultValue()}),sr(b==null?void 0:b.value)&&(V={...V,...b.value}),Array.isArray(i)?V[A]=(i==null?void 0:i.map(q=>q.toShallowJSON()))||null:V[A]=(i==null?void 0:i.toShallowJSON())||null,b==null||b.metaSync({value:V},p),l||t==null||t.writeValue(y,b),i==null&&d.type===f.OutputMap){const q=y.inputs.find(H=>{var ie;return((ie=H.declaration)==null?void 0:ie.id)===d.declaration.id||re(H,u)===w});if(q){let H=l?q.defaultValue:t==null?void 0:t.readValue(q.id);H&&(Array.isArray(i)?H==null||H.setValueAsTypeList(i,p):H==null||H.setValueAsTypeSingle(i,p)),l||t==null||t.removeValue(q.id)}}return p}function Tx(d,u,i){var a,l,p;return d.type===f.InputMap?((a=d.declaration)==null?void 0:a.type)===f.Property&&d.declaration.static?Jo(d.declaration,u,null,i):rt.includes(d.parent.type)&&((l=d.declaration)==null?void 0:l.type)===f.Property&&Op(d,u,null,i):d.type===f.OutputMap?((p=d.declaration)==null?void 0:p.type)===f.Property&&d.declaration.static?Jo(d.declaration,u,null,i):rt.includes(d.parent.type)&&d.declaration.type===f.Property&&Op(d,u,null,i):d.type===f.Property&&d.static&&Jo(d,u,null,i),i}function bx(d,u,i,a){var l,p,t;return u.type===f.InputMap?((l=u.declaration)==null?void 0:l.type)===f.Property&&u.declaration.static?Jo(u.declaration,i,d,a):rt.includes(u.parent.type)&&((p=u.declaration)==null?void 0:p.type)===f.Property&&Op(u,i,d,a):u.type===f.OutputMap?((t=u.declaration)==null?void 0:t.type)===f.Property&&u.declaration.static?Jo(u.declaration,i,null,a):rt.includes(u.parent.type)&&u.declaration.type===f.Property&&Op(u,i,null,a):u.type===f.Property&&u.static&&Jo(u,i,d,a),a}function Ax(d,u,i){const a=en(d,u);let l=!1,p=null,t=null;return i instanceof G?(l=!0,p=i,t=null):(p=null,t=i),a.forEach(y=>{var b;let v=l?y.defaultValue:t==null?void 0:t.readValue(y.id);v?!l&&v&&v.id===((b=y.defaultValue)==null?void 0:b.id)&&(v=Ye(y.getDataType(null),y,y.project)):l?v=Qs(y.getDataType(null),y,u,p):v=Ye(y.getDataType(null),y,u),v==null||v.setValueAsTypeSingle(null,p),v==null||v.setValueAsTypeList(null,p),l||t==null||t.removeValue(y.id),Tx(y,u,i)}),p}function pme(d,u,i,a){if(d==null)return Ax(u,i,a);const l=en(u,i);let p=!1,t=null,y=null;return a instanceof G?(p=!0,t=a,y=null):(t=null,y=a),l.forEach(v=>{var w;let b=p?v.defaultValue:y==null?void 0:y.readValue(v.id);b?!p&&b&&b.id===((w=v.defaultValue)==null?void 0:w.id)&&(b=Ye(v.getDataType(null),v,v.project)):p?b=Qs(v.getDataType(null),v,i,t):b=Ye(v.getDataType(null),v,i),Array.isArray(d)?b==null||b.setValueAsTypeList(d,t):b==null||b.setValueAsTypeSingle(d,t),p||y==null||y.writeValue(v,b),bx(d,v,i,a)}),t}function Ix(d,u){return Zj(d).map(a=>Ha(a,u))}function fme(d,u){return d.reduce((a,l)=>{const p=Ix(l,u);return[...a,...p.filter(t=>(t==null?void 0:t.type)===Ae.Missing)]},[])}const Wo={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var rA=(d=>(d.FinishedSuccess="finished-success",d.FinishedError="finished-error",d.Running="running",d.Paused="paused",d.Stopped="stopped",d.NotStarted="not-started",d))(rA||{});const hs=class hs extends Wb{constructor(i,a,l,p=null){super();D(this,"project");D(this,"entryPoint");D(this,"state","not-started");D(this,"events",new Wb);D(this,"entities",[]);D(this,"parentExecution",null);D(this,"executing",[]);D(this,"executed",[]);D(this,"skipped",[]);D(this,"localTestValues");D(this,"resolvedValues");D(this,"persistedExecutionResults");D(this,"lastExecutionResults");D(this,"onAddToSkippedListCallback",null);D(this,"onRemoveFromSkippedListCallback",null);D(this,"onAddEntityCallback",null);D(this,"onRemoveEntityCallback",null);this.entities=a,this.entryPoint=l,this.project=i,this.parentExecution=p,this.localTestValues=new Rp(P.UUID.uuid(),this.project),this.resolvedValues=new Rp(P.UUID.uuid(),this.project),this.persistedExecutionResults=new Rp(P.UUID.uuid(),this.project),this.lastExecutionResults=new Rp(P.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults}}static injectSearchImplementation(i){hs.searchImplementation=i}mergeExernalValuesWithInternalInputs(i,a){const l=[];return[...Qt,...Ht].includes(a.type)?l.push(...a.inputs):ir.includes(a.type)&&l.push(...a.outputs),l.map(t=>{var v;let y=i.find(b=>b.valueOwner.id===t.id);if(y)return y;if(!y&&Ht.includes(a.type)&&(y=i.find(b=>{var w;return((w=b.valueOwner.declaration)==null?void 0:w.id)===t.id})),y){const b=(v=y.value)==null?void 0:v.clone(null);return b==null||b.setStandaloneParent(t),{...y,valueOwner:t,value:b||null,inheritanceLink:{sources:[y],target:t}}}return qn.includes(t.type)?Uy(t,this.valueResolutionContext):Ha(t,this.valueResolutionContext)}).reduce((t,y)=>{const v=en(y==null?void 0:y.valueOwner,this.project),b=y?[y]:[];return v.forEach(w=>{var L,U,k;if(w.id===(y==null?void 0:y.valueOwner.id))return;const A=Ye(w.getDataType(null),w,this.project);A==null||A.metaSync({value:(L=y==null?void 0:y.value)==null?void 0:L.value},null),A==null||A.setValueAsTypeList(((U=y==null?void 0:y.value)==null?void 0:U.valueAsTypeList)||null),A==null||A.setValueAsTypeSingle(((k=y==null?void 0:y.value)==null?void 0:k.valueAsTypeSingle)||null);const V={...y,valueOwner:w,value:A};b.push(V)}),[...t,...b]},[])}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}static async executeOperation(i,a,l){var p,t;try{let y={value:Se.Success,error:null,results:[]};a.sort((w,A)=>w.valueOwner.index-A.valueOwner.index),i.declaration.implementation&&(y=await i.declaration.implementation(...a.map(w=>{var A,V;return((A=w==null?void 0:w.value)==null?void 0:A.valueAsType)||((V=w==null?void 0:w.value)==null?void 0:V.value)})));const v=i.outputs.map((w,A)=>{const V=w==null?void 0:w.getDataType(null),L=Ye(V,w,l);return V!=null&&V.asType?L==null||L.setValueAsTypeSingle(y.results[A]):L==null||L.metaSync({value:y.results[A]},null),{valueOwner:w,type:Ae.ExecutionResult,inheritanceLink:null,value:L}});let b=null;if(y.error&&i.error){console.warn("Raw error executing entity: ",y.error);const w=((p=i.error)==null?void 0:p.getDataType(null))||null,A=Ye(w,i.error,l);w!=null&&w.asType?A==null||A.setValueAsTypeSingle(y.error):A==null||A.metaSync({value:y.error},null),b={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:A}}return{value:y.value,entity:i,error:b,results:v}}catch(y){console.warn("Operation execution error: ",y);let v=null;if(i.error){const b=(t=i.error)==null?void 0:t.getDataType(null),w=Ye(b,i.error,l);b!=null&&b.asType?w==null||w.setValueAsTypeSingle(y):w==null||w.metaSync({value:y},null),v={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:w}}return{value:Se.Error,entity:i,error:v,results:[]}}}async executeSearch(i,a,l){var p;console.log("executeSearch");try{let t={value:Se.Success,error:null,results:[]};const y=i.outputs[0];if(!y)return{value:Se.Success,entity:i,error:null,results:[]};let v={value:null,valueOwner:y,type:Ae.ExecutionResult,inheritanceLink:null};const b=await hs.searchImplementation(i,a),w=y==null?void 0:y.getDataType(null),A=Ye(w,y,l);return A==null||A.metaSync({value:b.data},null),v.value=A,{value:t.value,entity:i,error:null,results:[v]}}catch(t){if(console.warn(`Search node execution error: ${t}`),!i.error)return{value:Se.Error,entity:i,error:null,results:[]};const y=(p=i.error)==null?void 0:p.getDataType(null),v=Ye(y,i.error,l);return v==null||v.metaSync({value:t},null),{value:Se.Error,entity:i,error:{valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:v},results:[]}}}async executeLoop(i,a,l,p={}){var y,v;const t={...Wo,...p};try{let b={value:Se.Success,error:null,results:[]};const w=a.map(q=>{var H,ie;return((H=q==null?void 0:q.value)==null?void 0:H.valueAsType)||((ie=q==null?void 0:q.value)==null?void 0:ie.value)});let A={};i.getUniqueReturnDeclarations().forEach(q=>{const H=i.body.inputs.find(ne=>re(ne,l)===Ti.fromReturnDeclarationToBodyArgumentDeclarationName(q)),ie=q==null?void 0:q.getDataType(null),te=Ye(ie,H,l);ie!=null&&ie.asType?te==null||te.setValueAsTypeList([]):te==null||te.metaSync({value:[]},null),this.lastExecutionResults.writeValue(H,te);const pe={value:te,valueOwner:H,type:Ae.ExecutionResult,inheritanceLink:null};A[H.id]=pe});let L={value:Se.Success,entity:i.body,error:null,results:[]};switch(console.log("aggregateListResults: ",A),i.declaration.id){case ve.loop["counted-loop"].id:{const q=w[0];console.log("maxCount",q);let H=1;for(console.log("currentIteration",H);H<=q&&H<=50;){console.log("iterating",H);const ie=i.body.inputs.map(pe=>{if(pe===i.currentIterationNumberArgumentDeclaration){console.log("Argument is body iteration number");const ne=i.currentIterationNumberArgumentDeclaration.getDataType(null),me=Fo(ne),J=this.lastExecutionResults.readValue(pe.id);if(J){J.metaSync({value:H},null),console.log("existingValue",H),this.lastExecutionResults.writeValue(pe,J);const de={value:J,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null};return A[pe.id]=de,de}const ae={id:P.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:P.UUID.uuid(),createdAt:new Date().toISOString(),author:P.sessionAuthor,deleted:!1,previousVersion:null,value:H,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:me,standaloneParent:pe.toReference()},ce=kt(ae,l);this.lastExecutionResults.writeValue(pe,ce);const Y={value:ce,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null};return console.log("newDynamicValue",H),A[pe.id]=Y,Y}else return A[pe.id]}).filter(pe=>!!pe);console.log("Loop executes body with inputs: ",ie);const te=await this.executeFullFunctionDeclarationLogic(i.body,ie,t);if(L=te,L.results.forEach(pe=>{var ae,ce,Y,de;if(pe.valueOwner.type!==f.ReturnDeclaration)return;const ne=i.body.inputs.find(Ee=>re(Ee,l)===Ti.fromReturnDeclarationToBodyArgumentDeclarationName(pe.valueOwner)),J=[...((ce=(ae=A==null?void 0:A[ne.id])==null?void 0:ae.value)==null?void 0:ce.value)||[],((Y=pe==null?void 0:pe.value)==null?void 0:Y.value)||null];(de=A[ne.id].value)==null||de.metaSync({value:J},null),this.lastExecutionResults.writeValue(ne,A[ne.id].value)}),[Se.Error,Se.Break,Se.Return].includes(te.value))break;console.log("Loop iteration finished"),H++}break}case ve.loop["manual-flow-loop"].id:{let q=1;for(;q<=50;){const H=i.body.inputs.map(te=>{if(te===i.currentIterationNumberArgumentDeclaration){const pe=this.lastExecutionResults.readValue(te.id);if(pe){pe.metaSync({value:q},null),this.lastExecutionResults.writeValue(te,pe);const ae={value:pe,valueOwner:te,type:Ae.ExecutionResult,inheritanceLink:null};return A[te.id]=ae,ae}const ne=i.currentIterationNumberArgumentDeclaration.getDataType(null),me=Ye(ne,te,l);me==null||me.metaSync({value:q},null),this.lastExecutionResults.writeValue(te,me);const J={value:me,valueOwner:te,type:Ae.ExecutionResult,inheritanceLink:null};return console.log("newDynamicValue",q),J}else return A[te.id]}).filter(te=>!!te);console.log("Loop executes body");const ie=await this.executeFullFunctionDeclarationLogic(i.body,H,t);if(L=ie,L.results.forEach(te=>{var J,ae,ce;if(te.valueOwner.type!==f.ReturnDeclaration)return;const pe=i.body.inputs.find(Y=>re(Y,l)===Ti.fromReturnDeclarationToBodyArgumentDeclarationName(te.valueOwner)),me=[...(J=A[pe.id].value)==null?void 0:J.value,((ae=te.value)==null?void 0:ae.value)||null];(ce=A[pe.id].value)==null||ce.metaSync({value:me},null),this.lastExecutionResults.writeValue(pe,A[pe.id].value)}),[Se.Error,Se.Break,Se.Return].includes(ie.value))break;q++}break}case ve.loop["list-loop"].id:{const q=w[0];let H=1;const ie=q;for(let te=0;te<ie.length;te++){const pe=ie[te],ne=i.body.inputs.map(J=>{if(J===i.currentIterationNumberArgumentDeclaration){const ae=this.lastExecutionResults.readValue(J.id);if(ae)return ae.metaSync({value:H},null),this.lastExecutionResults.writeValue(J,ae),{value:ae,valueOwner:J,type:Ae.ExecutionResult,inheritanceLink:null};const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),Y=Ye(ce,J,l);return Y==null||Y.metaSync({value:H},null),this.lastExecutionResults.writeValue(J,Y),{value:Y,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(J===i.currentValueArgumentDeclaration){const ae=i.currentValueArgumentDeclaration.getDataType(null),ce=Fo(ae),Y=this.lastExecutionResults.readValue(J.id);if(Y)return Y.metaSync({value:pe},null),this.lastExecutionResults.writeValue(J,Y),{value:Y,valueOwner:J,type:Ae.ExecutionResult,inheritanceLink:null};const de={id:P.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:P.UUID.uuid(),createdAt:new Date().toISOString(),author:P.sessionAuthor,deleted:!1,previousVersion:null,value:pe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:J.toReference()},Ee=kt(de,l);return this.lastExecutionResults.writeValue(J,Ee),{value:Ee,valueOwner:i.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[J.id]}).filter(J=>!!J);console.log("Loop executes body");const me=await this.executeFullFunctionDeclarationLogic(i.body,ne,t);if(L=me,L.results.forEach(J=>{var de,Ee,Pe;if(J.valueOwner.type!==f.ReturnDeclaration)return;const ae=i.body.inputs.find(Ce=>re(Ce,l)===Ti.fromReturnDeclarationToBodyArgumentDeclarationName(J.valueOwner)),Y=[...(de=A[ae.id].value)==null?void 0:de.value,((Ee=J.value)==null?void 0:Ee.value)||null];(Pe=A[ae.id].value)==null||Pe.metaSync({value:Y},null),this.lastExecutionResults.writeValue(ae,A[ae.id].value)}),[Se.Error,Se.Break,Se.Return].includes(me.value))break;H++}break}case ve.loop["object-keys-loop"].id:{const q=w[0];let H=1;const ie=q?Object.keys(q):[];console.log("iterableListOfValues: ",ie);for(let te=0;te<ie.length;te++){const pe=ie[te],ne=i.body.inputs.map(J=>{if(J===i.currentIterationNumberArgumentDeclaration){const ae=this.lastExecutionResults.readValue(J.id);if(ae)return ae.metaSync({value:H},null),this.lastExecutionResults.writeValue(J,ae),{value:ae,valueOwner:J,type:Ae.ExecutionResult,inheritanceLink:null};const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),Y=Ye(ce,J,l);return Y==null||Y.metaSync({value:H},null),this.lastExecutionResults.writeValue(J,Y),{value:Y,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(J===i.currentValueArgumentDeclaration){const ae=i.currentValueArgumentDeclaration.getDataType(null),ce=Fo(ae),Y=this.lastExecutionResults.readValue(J.id);if(Y)return Y.metaSync({value:pe},null),this.lastExecutionResults.writeValue(J,Y),{value:Y,valueOwner:J,type:Ae.ExecutionResult,inheritanceLink:null};const de={id:P.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:P.UUID.uuid(),createdAt:new Date().toISOString(),author:P.sessionAuthor,deleted:!1,previousVersion:null,value:pe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:J.toReference()},Ee=kt(de,l);return this.lastExecutionResults.writeValue(J,Ee),{value:Ee,valueOwner:i.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[J.id]}).filter(J=>!!J);console.log("Loop executes body");const me=await this.executeFullFunctionDeclarationLogic(i.body,ne,t);if(L=me,L.results.forEach(J=>{var de,Ee,Pe;if(J.valueOwner.type!==f.ReturnDeclaration)return;const ae=i.body.inputs.find(Ce=>re(Ce,l)===Ti.fromReturnDeclarationToBodyArgumentDeclarationName(J.valueOwner)),Y=[...(de=A[ae.id].value)==null?void 0:de.value,((Ee=J.value)==null?void 0:Ee.value)||null];(Pe=A[ae.id].value)==null||Pe.metaSync({value:Y},null),this.lastExecutionResults.writeValue(ae,A[ae.id].value)}),[Se.Error,Se.Break,Se.Return].includes(me.value))break;H++}break}case ve.loop["object-values-loop"].id:{const q=w[0];let H=1;const ie=q?Object.values(q):[];for(let te=0;te<ie.length;te++){const pe=ie[te],ne=i.body.inputs.map(J=>{if(J===i.currentIterationNumberArgumentDeclaration){const ae=this.lastExecutionResults.readValue(J.id);if(ae)return ae.metaSync({value:H},null),this.lastExecutionResults.writeValue(J,ae),{value:ae,valueOwner:J,type:Ae.ExecutionResult,inheritanceLink:null};const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),Y=Ye(ce,J,l);return Y==null||Y.metaSync({value:H},null),this.lastExecutionResults.writeValue(J,Y),{value:Y,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(J===i.currentValueArgumentDeclaration){const ae=i.currentValueArgumentDeclaration.getDataType(null),ce=Fo(ae),Y=this.lastExecutionResults.readValue(J.id);if(Y)return Y.metaSync({value:pe},null),this.lastExecutionResults.writeValue(J,Y),{value:Y,valueOwner:J,type:Ae.ExecutionResult,inheritanceLink:null};const de={id:P.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:P.UUID.uuid(),createdAt:new Date().toISOString(),author:P.sessionAuthor,deleted:!1,previousVersion:null,value:pe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:J.toReference()},Ee=kt(de,l);return this.lastExecutionResults.writeValue(J,Ee),{value:Ee,valueOwner:i.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[J.id]}).filter(J=>!!J);console.log("Loop executes body"),console.log("HEREEE Object.values() resolvedBodyInputsForCurrentIteration",ne);const me=await this.executeFullFunctionDeclarationLogic(i.body,ne,t);if(L=me,L.results.forEach(J=>{var de,Ee,Pe;if(J.valueOwner.type!==f.ReturnDeclaration)return;const ae=i.body.inputs.find(Ce=>re(Ce,l)===Ti.fromReturnDeclarationToBodyArgumentDeclarationName(J.valueOwner)),Y=[...(de=A[ae.id].value)==null?void 0:de.value,((Ee=J.value)==null?void 0:Ee.value)||null];(Pe=A[ae.id].value)==null||Pe.metaSync({value:Y},null),this.lastExecutionResults.writeValue(ae,A[ae.id].value)}),[Se.Error,Se.Break,Se.Return].includes(me.value))break;H++}break}case ve.loop["string-loop"].id:{const q=w[0];let H=1;const ie=q.split("");for(let te=0;te<ie.length;te++){const pe=ie[te],ne=i.body.inputs.map(J=>{if(J===i.currentIterationNumberArgumentDeclaration){const ae=this.lastExecutionResults.readValue(J.id);if(ae)return ae.metaSync({value:H},null),this.lastExecutionResults.writeValue(J,ae),{value:ae,valueOwner:J,type:Ae.ExecutionResult,inheritanceLink:null};const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),Y=Ye(ce,J,l);return Y==null||Y.metaSync({value:H},null),this.lastExecutionResults.writeValue(J,Y),{value:Y,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(J===i.currentValueArgumentDeclaration){const ae=i.currentValueArgumentDeclaration.getDataType(null),ce=Fo(ae),Y=this.lastExecutionResults.readValue(J.id);if(Y)return Y.metaSync({value:pe},null),this.lastExecutionResults.writeValue(J,Y),{value:Y,valueOwner:J,type:Ae.ExecutionResult,inheritanceLink:null};const de={id:P.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:P.UUID.uuid(),createdAt:new Date().toISOString(),author:P.sessionAuthor,deleted:!1,previousVersion:null,value:pe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:J.toReference()},Ee=kt(de,l);return this.lastExecutionResults.writeValue(J,Ee),{value:Ee,valueOwner:i.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[J.id]}).filter(J=>!!J);console.log("Loop executes body");const me=await this.executeFullFunctionDeclarationLogic(i.body,ne,t);if(L=me,L.results.forEach(J=>{var de,Ee,Pe;if(J.valueOwner.type!==f.ReturnDeclaration)return;const ae=i.body.inputs.find(Ce=>re(Ce,l)===Ti.fromReturnDeclarationToBodyArgumentDeclarationName(J.valueOwner)),Y=[...(de=A[ae.id].value)==null?void 0:de.value,((Ee=J.value)==null?void 0:Ee.value)||null];(Pe=A[ae.id].value)==null||Pe.metaSync({value:Y},null),this.lastExecutionResults.writeValue(ae,A[ae.id].value)}),[Se.Error,Se.Break,Se.Return].includes(me.value))break;H++}break}}let U=[];i.body.inputs.forEach(q=>{var ie;const H=A[q.id];if(H){const te=(ie=H.value)==null?void 0:ie.clone(null),pe=i.outputs.find(ne=>ne.declaration&&Ti.fromLoopOutputDeclarationToBodyArgumentDeclarationName(ne.declaration)===re(q,l));if(!pe)return;U.push({valueOwner:pe,type:Ae.ExecutionResult,inheritanceLink:null,value:te})}}),b={value:[Se.Error,Se.Return].includes(L.value)?L.value:Se.Success,error:null,results:U};let k=null;if(b.error&&i.error){console.warn("Raw error executing entity: ",b.error);const q=(y=i.error)==null?void 0:y.getDataType(null),H=Ye(q||null,i.error,l);q!=null&&q.asType?H==null||H.setValueAsTypeSingle(b.error):H==null||H.metaSync({value:b.error},null),k={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:H}}return{value:b.value,entity:i,error:k,results:b.results}}catch(b){if(console.warn("Error executing loop: ",b),i.error){const w=(v=i.error)==null?void 0:v.getDataType(null),A=Ye(w,i.error,l);return w!=null&&w.asType?A==null||A.setValueAsTypeSingle(b):A==null||A.metaSync({value:b},null),{value:Se.Error,entity:i,error:{valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:A},results:[]}}else return{value:Se.Error,entity:i,error:null,results:[]}}}async executeFunctionCall(i,a,l,p={}){var y,v;const t={...Wo,...p};try{let b={value:Se.Success,error:null,results:[]};console.log("executeFunctionCall",a),b=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,a,l,t);const w=i.outputs.map(V=>{var H,ie,te,pe;const L=[...V.declaration.getCounterparts(),V.declaration];console.log("declarations",L);const U=b.results.find(ne=>L.some(J=>ne.valueOwner.id===J.id));console.log("resultValue",U);const k=V==null?void 0:V.getDataType(null),q=Ye(k,V,l);return k!=null&&k.asType?Array.isArray((H=U==null?void 0:U.value)==null?void 0:H.valueAsType)?q==null||q.setValueAsTypeList((ie=U==null?void 0:U.value)==null?void 0:ie.valueAsTypeList):q==null||q.setValueAsTypeSingle(((te=U==null?void 0:U.value)==null?void 0:te.valueAsType)||null):q==null||q.metaSync({value:(pe=U==null?void 0:U.value)==null?void 0:pe.value},null),{valueOwner:V,type:Ae.ExecutionResult,inheritanceLink:null,value:q}});let A=null;if(b.error&&i.error){console.warn("Raw error executing entity: ",b.error);const V=(y=i.error)==null?void 0:y.getDataType(null),L=Ye(V||null,i.error,l);V!=null&&V.asType?L==null||L.setValueAsTypeSingle(b.error):L==null||L.metaSync({value:b.error},null),A={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:L}}return{value:b.value,entity:i,error:A,results:w}}catch(b){if(console.log("error: ",b),!i.error)return{value:Se.Error,entity:i,error:null,results:[]};const w=(v=i.error)==null?void 0:v.getDataType(null),A=Ye(w,i.error,l);return w!=null&&w.asType?A==null||A.setValueAsTypeSingle(b):A==null||A.metaSync({value:b},null),{value:Se.Error,entity:i,error:{valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:A},results:[]}}}static async executeCondition(i,a){var p,t,y,v,b,w,A,V,L,U,k,q,H,ie,te,pe,ne,me,J,ae,ce,Y,de,Ee,Pe,Ce,Ie,_e,Me,$e,ze,at,Zt,nr,br,Mr;let l=!1;switch(i.declaration.id){case Lr.Empty:{l=!!((t=(p=a[0])==null?void 0:p.value)!=null&&t.value);break}case Lr.NotEmpty:{l=!((v=(y=a[0])==null?void 0:y.value)!=null&&v.value);break}case dr.Equal:{if([X.String,X.Number,X.Boolean,X.Null,X.Enum,X.Date,X.UUID].includes((w=(b=a[0])==null?void 0:b.value)==null?void 0:w.name)){l=((V=(A=a[0])==null?void 0:A.value)==null?void 0:V.value)===((U=(L=a[1])==null?void 0:L.value)==null?void 0:U.value);break}if(((q=(k=a[0])==null?void 0:k.value)==null?void 0:q.name)===X.KeyValue||((ie=(H=a[0])==null?void 0:H.value)==null?void 0:ie.name)===X.Untyped){const Fr=(pe=(te=a[0])==null?void 0:te.value)==null?void 0:pe.value,Ni=(me=(ne=a[1])==null?void 0:ne.value)==null?void 0:me.value;l=JSON.stringify(Fr)===JSON.stringify(Ni);break}break}case dr.NotEqual:{if([X.String,X.Number,X.Boolean,X.Null,X.Enum,X.Date,X.UUID].includes((ae=(J=a[0])==null?void 0:J.value)==null?void 0:ae.name)){l=((Y=(ce=a[0])==null?void 0:ce.value)==null?void 0:Y.value)!==((Ee=(de=a[1])==null?void 0:de.value)==null?void 0:Ee.value);break}if(((Ce=(Pe=a[0])==null?void 0:Pe.value)==null?void 0:Ce.name)===X.Untyped||((_e=(Ie=a[0])==null?void 0:Ie.value)==null?void 0:_e.name)===X.KeyValue){const Fr=($e=(Me=a[0])==null?void 0:Me.value)==null?void 0:$e.value,Ni=(at=(ze=a[1])==null?void 0:ze.value)==null?void 0:at.value;l=JSON.stringify(Fr)!==JSON.stringify(Ni);break}break}case dr.MoreThanOrEqual:{l=((nr=(Zt=a[0])==null?void 0:Zt.value)==null?void 0:nr.value)>=((Mr=(br=a[1])==null?void 0:br.value)==null?void 0:Mr.value);break}}return{value:l?Se.Success:Se.Error,entity:i,error:null,results:[]}}async executeDetachedFullFunctionDeclarationLogic(i,a,l,p={}){const t={...Wo,...p,onBeforeEntityExecution:(b,w,A)=>{var V;return((V=p==null?void 0:p.onBeforeEntityExecution)==null?void 0:V.call(p,b,w,{...A,detached:!0}))||Promise.resolve()},onEntityExecuted:(b,w,A)=>{var V;return((V=p==null?void 0:p.onEntityExecuted)==null?void 0:V.call(p,b,w,{...A,detached:!0}))||Promise.resolve()}},y=new hs(l,[i,...gy(i)],i,this);y.inheritValuesFromContext(this),console.log("functionBodyExecution",a);const v=await y.execute(t,a);return console.log("executeDetachedFullFunctionDeclarationLogic result: ",v),v}async executeFullFunctionDeclarationLogic(i,a,l={}){const p={...Wo,...l},t=gy(i);t.forEach(A=>{this.addEntity(A)}),t.reduce((A,V)=>ir.includes(V.type)?[...A,...V.outputs]:Qt.includes(V.type)&&V.type!==f.Condition?[...A,...V.outputs,...V.inputs]:V.type===f.Condition?[...A,...V.inputs]:A,[]).forEach(A=>{this.lastExecutionResults.removeValue(A.id)});const v=await this.executeBranch(i,p,a),w=i.getUniqueReturnDeclarations().reduce((A,V)=>{const L=v==null?void 0:v.results.find(U=>U.valueOwner.id===V.id);return L?[...A,L]:A},[]);return{...v,results:w}}static async executeEntryPointEntity(i,a){return{value:Se.Success,entity:i,error:null,results:a}}static async executeVariable(i,a){return{value:Se.Success,entity:i,error:null,results:[a]}}static async executeReturnStatement(i,a){return{value:i.throws?Se.Error:Se.Return,entity:i,error:null,results:a}}static async executeContinueStatement(i,a){return{value:Se.Continue,entity:i,error:null,results:a}}static async executeBreakStatement(i,a){return{value:Se.Break,entity:i,error:null,results:a}}mergeValues(i,a){const l=[];for(let p=0;p<a.length;p++)i!=null&&i[p]?l.push(i[p]):l.push(a[p]);return l}async executeEntity(i,a=[],l={}){var y,v,b,w,A,V,L,U,k,q,H,ie,te,pe,ne,me;const p={...Wo,...l},t={detached:!1};switch(console.log("Executing entity: ",i),console.log("Exec ent with inputs: ",a),i.type){case f.Condition:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((y=p.onBeforeEntityExecution)==null?void 0:y.call(p,i,J,t)),hs.executeCondition(i,J)}case f.Operation:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((v=p.onBeforeEntityExecution)==null?void 0:v.call(p,i,J,t)),hs.executeOperation(i,J,this.project)}case f.VariableInstance:case f.VariableDeclaration:{i.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("Execute variable declaration resolveNextValue");let J=Uy(i,this.valueResolutionContext);const ae=di(i),ce=ae.getDataType(null);if(ce!=null&&ce.isObject()){let Ee={};if(((b=ce==null?void 0:ce.entity)==null?void 0:b.type)===f.DefinitionEntity&&(Ee={...Ee,...ce.entity.getActiveRawDefaultValue()}),J!=null&&J.value)sr((w=J==null?void 0:J.value)==null?void 0:w.value)&&(Ee={...Ee,...(A=J==null?void 0:J.value)==null?void 0:A.value}),J==null||J.value.metaSync({value:Ee},null);else{const Pe=Ye(ce,i,this.project);Pe==null||Pe.metaSync({value:Ee},null),J={valueOwner:ae,type:Ae.ExecutionResult,inheritanceLink:null,value:Pe}}this.lastExecutionResults.writeValue(ae,J.value),console.log("Propagating value to inputs: ",ae.inputs.map(Pe=>re(Pe,this.project))),ae.inputs.forEach(Pe=>{var Ce;if(((Ce=Pe.declaration)==null?void 0:Ce.type)===f.Property&&Pe.declaration.static){const Ie=this.lastExecutionResults.readValue(Pe.declaration.id),_e=re(Pe,this.project),Me=Zr(_e);if(Ie)Ie.metaSync({value:Ee[Me]},null),this.lastExecutionResults.writeValue(Pe.declaration,Ie);else{const $e=Ye(Pe.getDataType(null),Pe,this.project);$e==null||$e.metaSync({value:Ee[Me]},null),console.log(`Created new value for static property ${_e}: `,Ee[Me]),this.lastExecutionResults.writeValue(Pe.declaration,$e)}}})}else this.lastExecutionResults.writeValue(ae,J==null?void 0:J.value);const Y=[],de=(V=J==null?void 0:J.value)!=null&&V.value&&sr((L=J.value)==null?void 0:L.value)?((U=J.value)==null?void 0:U.value)||{}:{};return i.outputs.map(Ee=>{const Pe=Zr(re(Ee,this.project)),Ce=de[Pe],Ie=Ye(Ee.getDataType(null),Ee,this.project);Ie==null||Ie.metaSync({value:Ce},null);const _e={value:Ie,valueOwner:Ee,type:Ae.ExecutionResult,inheritanceLink:J?{sources:[J],target:i}:null};Y.push(_e)}),J.type=Ae.ExecutionResult,{value:Se.Success,entity:i,error:null,results:[J,...Y]}}case f.FunctionCall:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((k=p.onBeforeEntityExecution)==null?void 0:k.call(p,i,J,t)),this.executeFunctionCall(i,J,this.project)}case f.FunctionDeclaration:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((q=p.onBeforeEntityExecution)==null?void 0:q.call(p,i,J,t)),hs.executeEntryPointEntity(i,J)}case f.Search:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((H=p.onBeforeEntityExecution)==null?void 0:H.call(p,i,J,t)),this.executeSearch(i,J,this.project)}case f.Loop:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((ie=p.onBeforeEntityExecution)==null?void 0:ie.call(p,i,J,t)),this.executeLoop(i,J,this.project,p)}case f.ReturnStatement:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((te=p.onBeforeEntityExecution)==null?void 0:te.call(p,i,J,t)),hs.executeReturnStatement(i,J)}case f.ContinueStatement:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((pe=p.onBeforeEntityExecution)==null?void 0:pe.call(p,i,J,t)),hs.executeContinueStatement(i,J)}case f.BreakStatement:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((ne=p.onBeforeEntityExecution)==null?void 0:ne.call(p,i,J,t)),hs.executeBreakStatement(i,J)}case f.GlobalEvent:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((me=p.onBeforeEntityExecution)==null?void 0:me.call(p,i,J,t)),hs.executeEntryPointEntity(i,J)}default:return{value:Se.Error,entity:i,error:null,results:[]}}}storeLastExecutionValues(i){i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value),console.log("result.results: ",i.results),i.results.forEach(a=>{const l=en(a.valueOwner,this.project);a.value?l.forEach(p=>{this.lastExecutionResults.writeValue(p,a.value)}):l.forEach(p=>{this.lastExecutionResults.removeValue(p.id)})})}async executeBranch(i,a={},l=[]){var b;const p={...Wo,...a},t={detached:!1};if(console.log("executeBranch: ",l),!this.hasEntity(i))return console.log("Skipping entity (not part of test): ",i),null;this.addToExecutingList(i),console.log("Executing branch: ",i);const v=await this.executeEntity(i,l,p);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(v),await((b=p.onEntityExecuted)==null?void 0:b.call(p,i,v,t)),v.value===Se.Success){const w=(i.successCalls||i.calls||[]).filter(L=>this.hasEntity(L));(i.errorCalls||[]).filter(L=>this.hasEntity(L)).forEach(L=>{this.addToSkippedList(L)});const V=Mb(ei(w));for(let L=0;L<V.length;L++){const U=V[L];let k=[];const q=await Promise.all(U.map(ie=>this.executeBranch(ie,p,v.results))),H=q.find(ie=>ie.value===Se.Error||ie.value===Se.Return||ie.value===Se.Break||ie.value===Se.Continue);if(H)return H;k=[...k,...q]}return v}else if(v.value===Se.Error){const w=(i.errorCalls||[]).filter(U=>this.hasEntity(U));(i.successCalls||i.calls||[]).filter(U=>this.hasEntity(U)).forEach(U=>{this.addToSkippedList(U)});const V=Mb(ei(w));let L=[];for(let U=0;U<V.length;U++){const k=V[U],q=await Promise.all(k.map(ie=>this.executeBranch(ie,p,v.results))),H=q.find(ie=>ie.value===Se.Error||ie.value===Se.Return||ie.value===Se.Break||ie.value===Se.Continue);if(H)return H;L=[...L,...q]}return v}else{if(v.value===Se.Return)return v;if(v.value===Se.Break)return v;if(v.value===Se.Continue)return v}return v}async execute(i={},a=[]){const l={...Wo,...i};this.state="running";const p=await this.executeBranch(this.entryPoint,l,a);return this.state="finished-success",p}addEntity(i){var a;this.entities.includes(i)||(this.entities.push(i),(a=this.onAddEntityCallback)==null||a.call(this,i))}addEntities(i){i.forEach(a=>this.addEntity(a))}removeEntity(i){var a;if(i!==this.entryPoint){const l=this.entities.indexOf(i);l>-1&&(this.entities.splice(l,1),(a=this.onRemoveEntityCallback)==null||a.call(this,i))}}hasEntity(i){if(this.entities.includes(i))return!0;const a=cr(i);if(!a)return!1;const l=a.type===f.Loop&&i.parent===a.body?a.body:null;return l?this.entities.includes(l)||this.entities.includes(a):this.entities.includes(a)}hasEntityWithId(i){const a=this.project.get(i);return a?this.hasEntity(a):!1}onAddToSkippedList(i){this.onAddToSkippedListCallback=i}onAddEntity(i){this.onAddEntityCallback=i}onRemoveFromSkippedList(i){this.onRemoveFromSkippedListCallback=i}onRemoveEntity(i){this.onRemoveEntityCallback=i}addToExecutingList(i){this.executing.includes(i)||this.executing.push(i)}removeFromExecutingList(i){const a=this.executing.indexOf(i);a>-1&&this.executing.splice(a,1)}removeFromAlreadyExecutedList(i){const a=this.executed.indexOf(i);a>-1&&this.executed.splice(a,1)}removeFromSkippedList(i){var l;const a=this.skipped.indexOf(i);a>-1&&(this.skipped.splice(a,1),(l=this.onRemoveFromSkippedListCallback)==null||l.call(this,i))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var a;this.skipped.includes(i)||(this.skipped.push(i),(a=this.onAddToSkippedListCallback)==null||a.call(this,i))}};D(hs,"searchImplementation",async()=>({data:null,error:"Search module not implemented"}));let iA=hs;function hme(d){var u,i;if(d.isList)return"list";if(((u=d.entity)==null?void 0:u.type)===f.DefinitionEntity)return"definition-entity";switch((i=d.entity)==null?void 0:i.name){case X.Number:return"number";case X.String:return"text";case X.Boolean:return"boolean";case X.UUID:return"uuid";case X.Date:return"date-time";default:return"definition-entity"}}const sA={[f.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[f.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[f.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[f.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[f.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[f.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[f.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[f.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[f.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[f.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[f.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[f.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[f.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[f.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[f.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[f.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[f.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[f.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[f.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[f.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[f.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[f.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[f.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[f.ReturnDeclaration]:{singular:"Output definition",plural:"Output definitions",shortSingular:"Output",shortPlural:"Outputs"},[f.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"}};function nA(d){const u=Dy(d);if(!u){const a=bd(d);if(a.includes(Oe.HTTP_ENDPOINT))return"HTTP endpoint";if(a.includes(Oe.PERSISTED_ENTITY))return"Persisted entity";if(a.includes(Oe.CRON_JOB))return"Scheduled execution";if(a.includes(Oe.RELATIONAL_DATABASE))return"Relational database"}if(u){let a="Extension of "+re(u,u.project)+" entity",l=od(a);const p=bd(d);return p.includes(Oe.HTTP_ENDPOINT)?"HTTP endpoint"+(l?", "+l:""):p.includes(Oe.PERSISTED_ENTITY)?"Persisted entity"+(l?", "+l:""):p.includes(Oe.CRON_JOB)?"Scheduled execution"+(l?", "+l:""):p.includes(Oe.RELATIONAL_DATABASE)?"Relational database"+(l?", "+l:""):a}let i="";return d.abstract&&(i="Template "),d.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function wx(d){return d.parent.type===f.DefinitionEntity||d.parent.type===f.InstalledProject?"Internal action of "+re(d.parent,d.project):d.parent.type===f.Loop?"Action repeated on every iteration":"Internal action of entity"}function aA(d){return qb(d)?wx(d):"Custom trigger"}function yme(d){var u;switch(d.type){case f.DefinitionEntity:return nA(d);case f.FunctionDeclaration:return aA(d)}return(u=sA[d.type])==null?void 0:u.singular}function mme(d){var u;switch(d.type){case f.DefinitionEntity:return nA(d);case f.FunctionDeclaration:return aA(d)}return(u=sA[d.type])==null?void 0:u.singular}const oA=4e4,Rx=280,vme=300,lA=65,wd=32,xy=39,_x=26,gx=49,Fy=44,Eme=35,Gy=52,dA=10,ha=dA*2,Ky=38,ky=90,uA=270,Dx=oA/2+120,Cx=oA/2+180;function Ox(d){let i=wd+Fy+Ky+dA;const a=[...d.inputs];return a.length&&(i+=ha,a.forEach(()=>{i+=_x})),{height:i,width:280}}function $x(d){let i=lA;const a=[];if([f.DefinitionEntity].includes(d.type)){const v=[...d.suggestedProperties||[],...d.properties||[]];v.length&&(i+=ha,v.forEach(b=>{i+=b.static?gx:xy}))}if([f.DefinitionEntity,f.InstalledProject,f.Loop].includes(d.type)){const v=[...(d==null?void 0:d.suggestedMethods)||[],...d.methods||[],...d.functions||[],...d.body?[d.body]:[]];v.length&&(i+=ha,v.forEach(b=>{const w=Ox(b);i+=w.height}))}Qt.includes(d.type)?(rt.includes(d.type)?a.push(...(d.usedInputs||[]).flatMap(v=>[v])||[]):a.push(...(d.inputs||[]).flatMap(v=>[v])||[]),d.error&&(i+=Gy)):[f.ReturnStatement,f.BreakStatement,f.ContinueStatement].includes(d.type)?(a.push(...d.outputs||[]),d.throws&&(i+=Gy)):d.type===f.Condition&&(a.push(d.inputs[0]),d.inputs[1]&&a.push(d.inputs[1]));const l=a.length;l&&(i+=l*xy,i+=ha);const p=[];if(d.type===f.FunctionDeclaration||d.type===f.GlobalEvent?p.push(...d.inputs||[]):Qt.includes(d.type)&&(rt.includes(d.type)?p.push(...d.usedOutputs||[]):p.push(...d.outputs||[])),rt.includes(d.type)){d.readsValue&&(i+=ha,i+=Fy),d.writesValues.length&&(i+=ha,i+=Fy),d.internalCalls.length&&d.usedInternalCalls.forEach(()=>i+=Gy+ha);const v=d.getDataType(null);(!v||v.inferred)&&(i+=Ky)}const t=p.length;return t&&(i+=t*xy,i+=ha),[f.DefinitionEntity,f.FunctionDeclaration,f.ReturnStatement,f.BreakStatement,f.ContinueStatement].includes(d.type)&&(i+=Ky),{height:i,width:280}}function $p(d){return`${d.split("-").map((a,l)=>l===0?a.charAt(0).toUpperCase()+a.slice(1):a.toLowerCase()).join(" ")}.`}function Tme(d){switch(d.code){case se.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case se.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case se.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case se.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case se.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case se.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case se.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case oe.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case oe.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case se.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case se.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case oe.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case se.NoProperties:return"This entity has no properties, so it doesn't do anything";case se.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case se.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case se.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case se.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case se.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case se.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case se.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case se.PropertyImplementsNonAbstact:return"This property implements a non-template property";case se.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case se.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case se.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case se.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case se.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case oe.InternalCallDeclarationIsNotFunctionDeclaration:return"This internal call is not an action";case oe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case oe.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case oe.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case oe.UnreachableEntity:return"This entity is unreachable";case se.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";default:return $p(d.code)}}function bme(d){switch(d.code){case se.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case se.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case se.IncorrectEntityImplementation:return"Incorrect implementation";case se.IncorrectMethodImplementation:return"Incorrect action implementation";case se.IncorrectPropertyImplementation:return"Incorrect property implementation";case se.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case se.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case oe.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case oe.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case se.MissingMethodImplementation:return"Missing action";case se.MissingPropertyImplementation:return"Missing property";case oe.NameNotUniqueInScope:return"Duplicate name";case se.NoProperties:return"No properties";case se.NonStaticPropertyInStaticEntity:return"Non-static property";case se.StaticEntityWithNonStaticProperties:return"Non-static properties";case se.ReadingFromIncompatibleType:return"Read from different type";case se.WritingToIncompatibleType:return"Write to different type";case se.ScopeWithoutLogic:return"No logic";case se.NonStaticPropertyImplementsStatic:return"Invalid static property";case se.PropertyImplementsIncompatibleType:return"Incompatible data type";case se.PropertyImplementsNonAbstact:return"Non-template property";case se.StaticPropertyImplementsNonStatic:return"Non-static property";case se.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case se.VariableHasInputsAndInternalCall:return"Bad internal call";case se.VariableHasOutputsAndInternalCall:return"Bad internal call";case se.VariableIsCalledAndHasInternalCall:return"Bad internal call";case oe.InternalCallDeclarationIsNotFunctionDeclaration:return"Declaration not an action";case oe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case oe.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case oe.InternalCallParentMissingDataType:return"Parent has no data type";case oe.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case oe.UnreachableEntity:return"Unreachable entity";case se.DisconnectedCallableEntity:return"Disconnected entity";default:return $p(d.code)}}function Ame(d){switch(d.code){case se.AbstractEntityWithNonAbstractMethods:return`${re(d.entity,d.entity.project)} has non-template actions`;case se.AbstractEntityWithNonAbstractProperties:return`${re(d.entity,d.entity.project)} has non-template properties`;case se.IncorrectEntityImplementation:return`${re(d.entity,d.entity.project)} incorrectly implements template`;case se.IncorrectMethodImplementation:return`${re(d.entity,d.entity.project)} incorrectly implements the template`;case se.IncorrectPropertyImplementation:return`${re(d.entity,d.entity.project)} incorrectly implements the template`;case se.AbstractMethodInNonAbstractEntity:return`${re(d.entity,d.entity.project)} can't be a template`;case se.AbstractPropertyInNonAbstractEntity:return`${re(d.entity,d.entity.project)} can't be a template`;case oe.MethodOverwritesOtherSiblingWithSameName:return`${re(d.entity,d.entity.project)} overwrites action`;case oe.PropertyOverwritesOtherSiblingWithSameName:return`${re(d.entity,d.entity.project)} overwrites property`;case se.MissingMethodImplementation:return`${re(d.entity,d.entity.project)} is missing action`;case se.MissingPropertyImplementation:return`${re(d.entity,d.entity.project)} is missing property`;case oe.NameNotUniqueInScope:return`${re(d.entity,d.entity.project)} name is not unique`;case se.NoProperties:return`${re(d.entity,d.entity.project)} has no properties`;case se.NonStaticPropertyInStaticEntity:return`${re(d.entity,d.entity.project)} has non-static property`;case se.StaticEntityWithNonStaticProperties:return`${re(d.entity,d.entity.project)} has non-static properties`;case se.ReadingFromIncompatibleType:return`${re(d.entity,d.entity.project)} reads from different type`;case se.WritingToIncompatibleType:return`${re(d.entity,d.entity.project)} writes to different type`;case se.ScopeWithoutLogic:return`${re(d.entity,d.entity.project)} has no logic`;case se.NonStaticPropertyImplementsStatic:return`${re(d.entity,d.entity.project)} has invalid static property`;case se.PropertyImplementsIncompatibleType:return`${re(d.entity,d.entity.project)} has incompatible data type`;case se.PropertyImplementsNonAbstact:return`${re(d.entity,d.entity.project)} has non-template property`;case se.StaticPropertyImplementsNonStatic:return`${re(d.entity,d.entity.project)} has non-static property`;case se.VariableCallsOthersAndHasInternalCall:return`${re(d.entity,d.entity.project)} has bad internal call`;case se.VariableHasInputsAndInternalCall:return`${re(d.entity,d.entity.project)} has bad internal call`;case se.VariableHasOutputsAndInternalCall:return`${re(d.entity,d.entity.project)} has bad internal call`;case se.VariableIsCalledAndHasInternalCall:return`${re(d.entity,d.entity.project)} has bad internal call`;case oe.InternalCallDeclarationIsNotFunctionDeclaration:return`${re(d.entity,d.entity.project)} has declaration that is not an action`;case oe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${re(d.entity,d.entity.project)} has declaration that is not found in parent`;case oe.InternalCallParentDeclarationEntityInvalidType:return`${re(d.entity,d.entity.project)} has invalid parent declaration type`;case oe.InternalCallParentMissingDataType:return`${re(d.entity,d.entity.project)}'s parent has no data type`;case oe.InternalCallDeclarationNotInParentDatatypeEntity:return`${re(d.entity,d.entity.project)} has declaration that is not in parent`;case oe.UnreachableEntity:return`${re(d.entity,d.entity.project)} is unreachable`;case se.DisconnectedCallableEntity:return`${re(d.entity,d.entity.project)} is not executed by any entity`;default:return`${re(d.entity,d.entity.project)} Error: ${$p(d.code)}`}}function Ime(d){var u,i,a,l;switch(d.code){case se.AbstractEntityWithNonAbstractMethods:return`${re(d.entity,d.entity.project)} has non-template actions`;case se.AbstractEntityWithNonAbstractProperties:return`${re(d.entity,d.entity.project)} has non-template properties`;case se.IncorrectEntityImplementation:return`${re(d.entity,d.entity.project)} incorrectly implements the template entity`;case se.IncorrectMethodImplementation:return`${re(d.entity,d.entity.project)} incorrectly implements the template action it's based on`;case se.IncorrectPropertyImplementation:return`${re(d.entity,d.entity.project)} incorrectly implements the template property it's based on`;case se.AbstractMethodInNonAbstractEntity:return`${re(d.entity,d.entity.project)} is a template action in a non-template entity`;case se.AbstractPropertyInNonAbstractEntity:return`${re(d.entity,d.entity.project)} is a template property in a non-template entity`;case oe.MethodOverwritesOtherSiblingWithSameName:return`${re(d.entity,d.entity.project)} overwrites an action in the template entity`;case oe.PropertyOverwritesOtherSiblingWithSameName:return`${re(d.entity,d.entity.project)} overwrites a property in the template entity`;case se.MissingMethodImplementation:return`${re(d.entity,d.entity.project)} is missing an action implementation from the template entity`;case se.MissingPropertyImplementation:return`${re(d.entity,d.entity.project)} is missing a property implementation from the template entity`;case oe.NameNotUniqueInScope:return`${re(d.entity,d.entity.project)} has a duplicate name in the same scope`;case se.NoProperties:return`${re(d.entity,d.entity.project)} has no properties, so it doesn't do anything`;case se.NonStaticPropertyInStaticEntity:return`${re(d.entity,d.entity.project)} has a non-static property in a static entity`;case se.StaticEntityWithNonStaticProperties:return`${re(d.entity,d.entity.project)} has non-static properties in a static entity`;case se.ReadingFromIncompatibleType:return`${re(d.entity,d.entity.project)} reads data from a value of a different data type`;case se.WritingToIncompatibleType:return`${re(d.entity,d.entity.project)} writes data to a value of a different data type`;case se.ScopeWithoutLogic:return`${re(d.entity,d.entity.project)} has no logic`;case se.NonStaticPropertyImplementsStatic:return`${re(d.entity,d.entity.project)} has a static property in a non-static entity`;case se.PropertyImplementsIncompatibleType:return`${re(d.entity,d.entity.project)} implements a property of a different data type`;case se.PropertyImplementsNonAbstact:return`${re(d.entity,d.entity.project)} implements a non-template property`;case se.StaticPropertyImplementsNonStatic:return`${re(d.entity,d.entity.project)} has a static property in a non-static entity`;case se.VariableCallsOthersAndHasInternalCall:return`${re(d.entity,d.entity.project)} calls other entities while being used to execute internal logic`;case se.VariableHasInputsAndInternalCall:return`${re(d.entity,d.entity.project)} has inputs while being used to execute internal logic`;case se.VariableHasOutputsAndInternalCall:return`${re(d.entity,d.entity.project)} has outputs while being used to execute internal logic`;case se.VariableIsCalledAndHasInternalCall:return`${re(d.entity,d.entity.project)} is called while being used to execute internal logic`;case oe.InternalCallDeclarationIsNotFunctionDeclaration:return`${re(d.entity,d.entity.project)} has a declaration that is not an action`;case oe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${re(d.entity,d.entity.project)} has a declaration that is not found in ${(u=d.entity.parent.getDataType(null))!=null&&u.entity?re((i=d.entity.parent.getDataType(null))==null?void 0:i.entity,d.entity.project):"the variable's data-type entity"}`;case oe.InternalCallParentDeclarationEntityInvalidType:return`${re(d.entity,d.entity.project)} is part of a variable whos data-type entity can't have actions`;case oe.InternalCallParentMissingDataType:return`${re(d.entity,d.entity.project)} is part of a variable with no data-type entity`;case oe.InternalCallDeclarationNotInParentDatatypeEntity:return`${re(d.entity,d.entity.project)} has a declaration doesn't belong to ${(a=d.entity.parent.getDataType(null))!=null&&a.entity?re((l=d.entity.parent.getDataType(null))==null?void 0:l.entity,d.entity.project):"the variable's data-type entity"}`;case oe.UnreachableEntity:return`${re(d.entity,d.entity.project)} is unreachable`;case se.DisconnectedCallableEntity:return`${re(d.entity,d.entity.project)} is disconnected and won't be executed by anything after publishing`;default:return`${re(d.entity,d.entity.project)} Error: ${$p(d.code)}`}}var cA=(d=>(d.ValuesAlreadyConnected="values-already-connected",d.CannotReadMoreThanOneValue="cannot-read-more-than-one-value",d.CannotReadValueFromChildren="cannot-read-value-from-children",d.CannotWriteValueToChildren="cannot-write-value-to-children",d.CannotBeCalledByChildren="cannot-be-called-by-children",d.ExecutionsAlreadyConnected="executions-already-connected",d.DataTypesNotCompatible="data-types-not-compatible",d.CannotCallAncestor="cannot-call-ancestor",d.CannotWriteValueToAncestor="cannot-write-value-to-ancestor",d.NotInScope="not-in-scope",d.IsNotValueWrittingEntity="is-not-value-writting-entity",d.IsNotValueReadingEntity="is-not-value-reading-entity",d.ContinueOrBreakStatementCalledFromOutsideLoop="continue-or-break-statement-called-from-outside-loop",d.ElementInLoopBodyCallingOutsideLoop="element-in-loop-body-calling-outside-loop",d.CallerIsInHigherScope="caller-is-in-higher-scope",d.CallerIsInLowerScope="caller-is-in-lower-scope",d.CallIsInHigherScope="call-is-in-higher-scope",d.CallIsInLowerScope="call-is-in-lower-scope",d.OtherIncompatibleScopeReason="other-incompatible-scope-reason",d))(cA||{});const wme=Object.values(cA);var pA=(d=>(d.NotPartOfOngoingTest="not-part-of-ongoing-test",d.CannotBeAddedToTest="cannot-be-added-to-test",d))(pA||{});const Rme=Object.values(pA);var fA=(d=>(d.Suggestion="suggestion",d.CanvasGloballyDisabled="canvas-globally-disabled",d))(fA||{});const _me=Object.values(fA);function gme(d,u){const i=[...d,...u];return Array.from(new Set(i))}function Dme(d,u){const i=[...d,...u],a=Array.from(new Set(i));return{hasChanged:a.length!==d.length,reasons:a}}function Cme(d,u){const i=d.filter(l=>!u.includes(l));return{hasChanged:i.length!==d.length,reasons:i}}function Ome(d,u){return d.find(i=>i.entity.id===u)||null}function Px(d){return d.filter((u,i)=>d.indexOf(u)===i)}class ti{constructor(u,i,a=null,l){D(this,"ids",[]);D(this,"entity");D(this,"entityCardHeight");D(this,"entityCardWidth");D(this,"index");D(this,"childEntities",[]);D(this,"children",[]);D(this,"parents",[]);D(this,"calculationEntryPoint");D(this,"_onlyEntities",null);D(this,"_changeSet",null);if(this.index=i,this.entity=u,this.calculationEntryPoint=a||this,this===this.calculationEntryPoint&&!l)throw new Error("Change set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(u,i,a){const l=Dx-uA-Rx,p=Cx-ky-lA;u.metaSync({x:u.x||l,y:u.y||p},i);const t=new ti(u,0,null,i);t._onlyEntities=a||[],t.ids=["0"];const y=[];t.next(b=>{y.push(...b)}),ti.recursivelyAssembleChildrenAreas(y),t.resolveChildrenOverlaps();const v=t.flattenChildEntities();return t._onlyEntities?v.filter(b=>(t._onlyEntities||[]).includes(b)):v}static recursivelyAssembleChildrenAreas(u){const i=[];u.forEach(a=>{a.next(l=>{i.push(...l)})}),i.length>0&&ti.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(u){this.calculationEntryPoint._changeSet=u}findAreaInChildrenFromEntity(u){if(this.entity===u)return this;const i=this.children.find(l=>l.entity===u);return i||this.children.reduce((l,p)=>l||p.findAreaInChildrenFromEntity(u),null)}findAreaFromEntity(u){if(this.entity===u)return this;const i=this.calculationEntryPoint.children,a=i.find(p=>p.entity===u);return a||i.reduce((p,t)=>p||t.findAreaInChildrenFromEntity(u),null)}addParent(u){if(!this.parents.includes(u)){const i=ti.resolveIds(u,this.index);this.ids.push(...i),this.parents.push(u)}}static resolveIds(u,i){return u?u.ids.map(a=>`${a}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const u=Xs(this.entity,!0);if(this.entity.type===f.Project){const i=[],a=[],l=[];u.forEach(t=>{if(f.DefinitionEntity===t.type){a.push(t);return}else if(Ht.includes(t.type)){l.push(t);return}i.push(t)});const p=i.sort((t,y)=>{const v=!!Ay(t,y).length,b=Xs(t),w=Xs(y);return v?0:b.length&&!w.length?-1:!b.length&&w.length?1:0}).filter(t=>!Ja(t).length);this.childEntities=[...a,...l,...p]}else{const i=[],a=[],l=[],p=[],t=[];Gs.includes(this.entity.type)&&wy(this.entity).forEach(b=>{if(rt.includes(b.type)){l.push(b);return}const w=cr(b);i.push(w)}),Ar.includes(this.entity.type)&&a.push(...this.entity.detachedChildren);const y=u.filter(v=>{const b=i.includes(v);return b||l.includes(v)||a.includes(v)?!1:rt.includes(v.type)?(l.push(v),!1):Fs.includes(v.type)&&!b?(p.push(v),!1):v.type===f.DefinitionEntity?(t.push(v),!1):!0});i.sort((v,b)=>Ko(v,b)?-1:0),p.sort((v,b)=>Ko(v,b)?-1:0),l.sort((v,b)=>Lb(v,b)?1:Lb(b,v)?-1:0),this.childEntities=[...t,...i,...p,...y,...l,...a]}}calculateCardSize(){const u=$x(this.entity);this.entityCardWidth=u.width,this.entityCardHeight=u.height}static getBoundriesOfTwoAreas(u,i){return{top:Math.min(u.top,i.top),left:Math.min(u.left,i.left),bottom:Math.max(u.bottom,i.bottom),right:Math.max(u.right,i.right)}}static getBoundriedOfCombinedAreas(u,i){const a=u.filter(p=>!i.includes(p));return a.reduce((p,t)=>i.includes(t)?p:ti.getBoundriesOfTwoAreas(p,t.fullBranchArea),a[0].fullBranchArea)}getFullAreaUntilAny(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(t=>!u.includes(t)).map(t=>t.getFullAreaUntilAny(u)).reduce((t,y)=>ti.getBoundriesOfTwoAreas(t,y),i)}getFullAreaUntilAreaOrAnyChildren(u){const i=[u,...u.flattenChildren()],a=this.ownEntityPlusBufferArea;return this.children.filter(t=>i.includes(t)).map(t=>t.getFullAreaUntil(u)).reduce((t,y)=>ti.getBoundriesOfTwoAreas(t,y),a)}getFullAreaUntil(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(p=>p!==u).map(p=>p.getFullAreaUntil(u)).reduce((p,t)=>ti.getBoundriesOfTwoAreas(p,t),i)}get fullBranchArea(){const u=this.ownEntityPlusBufferArea;return this.children.map(l=>l.fullBranchArea).reduce((l,p)=>ti.getBoundriesOfTwoAreas(l,p),u)}get ownEntityArea(){return{top:this.entity.y,left:this.entity.x,bottom:this.entity.y+this.entityCardHeight,right:this.entity.x+this.entityCardWidth}}get ownEntityPlusBufferArea(){const u=this.ownEntityArea;return{top:u.top,left:u.left,bottom:u.bottom+ky,right:u.right+uA}}static filterOutRepeatedAreas(u){return u.filter((i,a)=>u.indexOf(i)===a)}getEarliestId(u,i){const a=u.split("-"),l=i.split("-");return a.length<l.length?u:a.length>l.length?i:a.reduce((t,y,v)=>y<l[v]?u:i,u)}getEarliestLevel(){return this.ids.reduce((a,l)=>this.getEarliestId(a,l),this.ids[0]).split("-").length}countColumns(){let u=0;if(this!==this.calculationEntryPoint)u++;else return u;if(!this.parents.length)return u;const a=this.parents.reduce((l,p)=>p.getEarliestLevel()>l.getEarliestLevel()?p:l,this.parents[0]).countColumns();return u+=a,u}getLatestId(u,i){if(u===i)return u;const a=u.split("-"),l=i.split("-");return a.length<l.length?i:a.length>l.length?u:a.reduce((t,y,v)=>y>l[v]?u:i,u)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((a,l)=>this.getLatestId(a,l),this.ids[0]).split("-").length}smoothPosition(){const u=this.flattenSiblings();if(!u.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(a=>{a!==this.calculationEntryPoint&&a.shiftDownAlone(i)})}else if([...Ht].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=u.filter(a=>!this.parents.includes(a));i.length?i.every(l=>{const p=this.countColumns(),t=l.countColumns();return p>t})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(u,i){if(u.includes(this))return u;this.move(this.entity,{y:this.entity.y+i});let a=[...u,this];return this.children.forEach(l=>{if(ti.getEarliestParentInChain(l)!==this)return;const t=Ome(a,l.entity.id);a=ti.filterOutRepeatedAreas([...a]),t||(a=a.filter(v=>v!==l));const y=l.shiftDownUntilAny(a,i);a.push(...y)}),a}shiftRightUntilAny(u,i){u.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(a=>{const l=ti.filterOutRepeatedAreas([...this.flattenSiblings(),...u]);ti.getEarliestParentInChain(a)===this&&a.shiftRightUntilAny(l,i)}))}shiftRight(u){this.move(this.entity,{x:this.entity.x+u}),this.children.forEach(i=>{const l=i.flattenSiblings().filter(p=>p!==i);i.shiftRightUntilAny(l,u)})}shiftDownAlone(u){this.move(this.entity,{y:this.entity.y+u})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const u=this.parents.reduce((l,p)=>{const t=p.ownEntityArea,y=t.top+wd,v={top:y,left:t.left,bottom:y,right:t.right};return ti.getBoundriesOfTwoAreas(l,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-wd;this.shiftDownAlone(a)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const u=this.children.reduce((l,p)=>{const t=p.ownEntityArea,y=t.top+wd,v={top:y,left:t.left,bottom:y,right:t.right};return ti.getBoundriesOfTwoAreas(l,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-wd;return this.shiftDownAlone(a),a}resolveChildrenOverlaps(){const u=this.flattenChildren();let i=[];u.forEach(a=>{const l=a.adjustVerticallyToAvoidOverlaps();i.push(...l)}),u.forEach(a=>{a.smoothPosition()})}static getEarliestParentInChain(u){let i=u.parents[0];return u.parents.length&&(i=u.parents.sort((a,l)=>{if(!a.ids.length)return-1;if(!l.ids.length)return 1;const p=a.ids.sort((y,v)=>y.length<v.length?-1:0),t=l.ids.sort((y,v)=>y.length<v.length?-1:0);return p[0].length-t[0].length})[0]),i}flattenEarlierSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((a,l)=>{if(u.has(l.entity.id))return a;u.add(l.entity.id);const t=l.children.slice(0,l.children.indexOf(this)).reduce((y,v)=>[...y,v,...v.flattenChildren(u)],[]);return[...a,...t]},[])}flattenSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((a,l)=>{if(u.has(l.entity.id))return a;u.add(l.entity.id);const t=l.children.filter(y=>y!==this).reduce((y,v)=>[...y,v,...v.flattenChildren(u)],[]);return[...a,...t]},[])}flattenChildren(u=new Set){return this.children.reduce((i,a)=>u.has(a.entity.id)?i:(u.add(a.entity.id),[...i,a,...a.flattenChildren(u)]),[])}flattenParents(u=new Set){return this.parents.reduce((a,l)=>u.has(l.entity.id)?a:(u.add(l.entity.id),[...a,l,...l.flattenParents(u)]),[])}getAreaIfRendered(u){return this.calculationEntryPoint.flattenChildren().find(l=>l.entity.id===u.id)||null}getLowerSiblings(){const u=this.parents.reduce((i,a)=>{const l=a.children.indexOf(this),p=a.children.slice(l+1);return[...i,...p]},[]);return Px(u)}getLowerAreas(){const u=this.getLowerSiblings(),i=this.parents.reduce((a,l)=>[...a,...l.getLowerAreas()],[]);return Px([...u,...i])}adjustVerticallyToAvoidOverlaps(u=[]){const a=ti.getEarliestParentInChain(this).children[this.index-1];if(!a)return u;const l=this.flattenEarlierSiblings(),p=this.flattenParents(),t=[...l,...p,a],b=R(t.flatMap(L=>Ay(this.entity,L.entity))).filter(L=>L.id!==this.entity.id).map(L=>this.findAreaFromEntity(L)).filter(L=>!!L),w=this.getFullAreaUntilAny(b),A=a.getFullAreaUntilAny(b),V=t.reduce((L,U)=>U===this||U.fullBranchArea.left!==w.left?L:Math.max(L,U.fullBranchArea.bottom),A.bottom);if(w.top<V){const L=V-w.top+ky;return this.shiftDownUntilAny(u,L)}return u}move(u,i){(this.onlyEntities||[]).includes(u)&&u.metaSync(i,this.changeSet)}addChild(u){const i=this.childEntities[u];let a=null;i.x&&i.y?a=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),a||(a=new ti(i,u,this.calculationEntryPoint));const l=this.ownEntityPlusBufferArea;this.children.includes(a)||(this.children.push(a),a.addParent(this));const p=a.fullBranchArea;if(p.left<l.right){const t=l.right-p.left;a.shiftRight(t)}return a}flattenChildEntities(u=new Set){return this.children.reduce((i,a)=>u.has(a.entity.id)?i:(u.add(a.entity.id),[...i,a.entity,...a.flattenChildEntities(u)]),[])}next(u){const i=[];this.childEntities.forEach((a,l)=>{const p=this.addChild(l);p&&i.push(p)}),u(i)}}var Pp=(d=>(d.Amazon="amazon",d.Google="google",d.Microsoft="microsoft",d))(Pp||{}),Cr=(d=>(d.RelationalDatabase="relational-database",d.CompiledLocalCodebase="compiled-local-codebase",d.CloudHostedCodebase="cloud-hosted-codebase",d.HttpApi="http-api",d.HttpEndpoint="http-endpoint",d.ServerlessFunction="serverless-function",d))(Cr||{}),hA=(d=>(d.Post="post",d.Get="get",d.Acknowledgement="acknowledgment",d.Progress="progress",d.Error="error",d.Complete="complete",d))(hA||{}),Vx=(d=>(d.Queued="queued",d.Running="running",d.Success="success",d.Failed="failed",d.CleanedUp="cleaned-up",d.Skipped="skipped",d.AbortedByUser="aborted-by-user",d.UnrecoverableFailure="unrecoverable-failure",d.Reverted="reverted",d.UnpublishingStarted="unpublishing-started",d.Unpublished="unpublished",d))(Vx||{}),Rd=(d=>(d.Queued="queued",d.Running="running",d.Success="success",d.Failed="failed",d.CleanedUp="cleaned-up",d.UnrecoverableFailure="unrecoverable-failure",d.Reverted="reverted",d.UnpublishingStarted="unpublishing-started",d.Unpublished="unpublished",d))(Rd||{}),dt=(d=>(d.ProjectNotFound="project-not-found",d.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",d.DeploymentCompleted="deployment-completed",d.DeploymentStarted="deployment-started",d.DeploymentFailed="deployment-failed",d.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",d.RequestPayloadValidationFailed="request-payload-validation-failed",d.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",d.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",d.ProjectAlreadyBeingPublished="project-already-being-published",d.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",d.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",d.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",d.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",d.CreatingNewRelationalDatabase="creating-new-relational-database",d.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",d.RelationalDatabaseAlreadyExists="relational-database-already-exists",d.HttpApiDeploymentStarted="http-api-deployment-started",d.HttpApiDeploymentCompleted="http-api-deployment-completed",d.HttpApiDeploymentFailed="http-api-deployment-failed",d.CreatingNewHttpApi="creating-new-http-api",d.HttpApiAlreadyExists="http-api-already-exists",d.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",d.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",d.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",d.BundlingCodebaseForDownload="bundling-codebase-for-download",d.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",d.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",d.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",d.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",d.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",d.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",d.CodeCompilationStarted="code-compilation-started",d.CodeCompilationCompleted="code-compilation-completed",d.CodeCompilationFailed="code-compilation-failed",d.BundleCodebaseStarted="bundle-codebase-started",d.BundleCodebaseCompleted="bundle-codebase-completed",d.BundleCodebaseFailed="bundle-codebase-failed",d.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",d.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",d.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",d.MigrateRelationalDatabaseStarted="migrate-relational-database-started",d.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",d.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",d))(dt||{}),ya=(d=>(d.CodeCompilation="code-compilation",d.RelationalDatabaseDeployment="relational-database-deployment",d.HttpApiDeployment="http-api-deployment",d.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",d.BundleCodebase="bundle-codebase",d.MigrateRelationalDatabase="migrate-relational-database",d.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",d.CodebaseCleanup="codebase-cleanup",d))(ya||{});Cr.CloudHostedCodebase,Cr.HttpApi,Cr.RelationalDatabase,Cr.CloudHostedCodebase,Cr.CloudHostedCodebase,Cr.RelationalDatabase,Cr.CloudHostedCodebase,Cr.CloudHostedCodebase;function Nx(d){return`project-${d}-http-api`}function Lx(d){return`entity-${d}-database`}class Bx{constructor(u,i,a,l,p,t,y,v,b){D(this,"stepType");D(this,"id");D(this,"resourceType");D(this,"index");D(this,"dependency",[]);D(this,"lastEvent",null);D(this,"lasEventTimestamp",null);D(this,"status",Vx.Queued);D(this,"publicationRun");D(this,"resource");this.stepType=u,this.id=i,this.resourceType=a,this.status=l,this.dependency=p,this.index=t,this.lasEventTimestamp=y,this.publicationRun=v,this.resource=b}toJSON(){return{stepType:this.stepType,id:this.id,resourceType:this.resourceType,index:this.index,status:this.status,dependency:this.dependency,lastEvent:this.lastEvent,resource:{resourceId:this.resource.resourceId,resourceType:this.resource.resourceType,provider:this.resource.provider,details:this.resource.details,status:this.resource.status}}}async update(u){var i,a;this.status=u.status,this.dependency=u.dependency,this.index=u.index,this.stepType=u.stepType,this.resourceType=u.resourceType,this.lastEvent=u.lastEvent,this.id=u.id,(a=this.resource)==null||a.setDetails((i=u.resource)==null?void 0:i.details)}}var Mx=(d=>(d.Ready="ready",d.Provisioning="provisioning",d.Queued="queued",d.ProvisioningFailed="provisioning-failed",d.Deleting="deleting",d.DeletingFailed="deleting-failed",d.Deleted="deleted",d))(Mx||{});class yA{constructor(u,i,a){D(this,"provisionedBy");D(this,"publicationRun");D(this,"resourceType");D(this,"provider");D(this,"resourceId");D(this,"details",null);D(this,"status","queued");this.publicationRun=u,this.resourceType=i,this.provider=a}setDetails(u){this.details=u}setStatus(u){this.status=u}setProvisionedBy(u){this.provisionedBy=u}}class mA extends yA{constructor(i,a,l,p){super(i,l,p);D(this,"resourceType");D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");a.forEach(t=>{this.owners.set(t.id,t)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,a;return this.resourceType===Cr.HttpApi?this.resourceId=Nx(this.publicationRun.project.id):this.resourceType===Cr.RelationalDatabase&&(this.resourceId=Lx((a=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:a.id)),this.resourceId}}class vA extends yA{constructor(i,a,l){super(i,a,l);D(this,"resourceType");D(this,"details",null);D(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceType===Cr.CompiledLocalCodebase?this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`:this.resourceType===Cr.CloudHostedCodebase&&(this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`),this.resourceId}}class $me{constructor(u,i){D(this,"id");D(this,"projectAutoIncrementPublicationCount");D(this,"projectPublishedSemanticVersion");D(this,"projectVersion");D(this,"projectId");D(this,"cloudProvider");D(this,"triggeredBy");D(this,"createdAt");D(this,"updatedAt");D(this,"status");D(this,"steps",[]);D(this,"editor");D(this,"explicitResources",new Map);D(this,"implicitGlobalResources",new Map);D(this,"finalGlobalEvent",null);D(this,"finalStatus",null);this.id=u.id,this.projectAutoIncrementPublicationCount=u.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=u.projectPublishedSemanticVersion,this.projectVersion=u.projectVersion,this.projectId=u.projectId,this.cloudProvider=u.cloudProvider,this.triggeredBy=u.triggeredBy,this.createdAt=u.createdAt,this.updatedAt=u.updatedAt,this.status=u.status,this.editor=i}get project(){return this.editor.project}getInfraTypes(u){return this.steps.filter(i=>u.includes(i.resourceType))}getStepsTypes(u){return this.steps.filter(i=>u.includes(i.stepType))}toIds(u){return u.map(i=>i.id)}getResourceForEntity(u){const i=Array.from(this.explicitResources.values()).find(a=>a.owners.has(u.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(Cr.CompiledLocalCodebase,new vA(this,Cr.CompiledLocalCodebase,Pp.Amazon)),this.implicitGlobalResources.set(Cr.CloudHostedCodebase,new vA(this,Cr.CloudHostedCodebase,Pp.Amazon));const u=this.project.entities.filter(a=>Yi(a,Oe.HTTP_ENDPOINT)),i=this.project.entities.filter(a=>Yi(a,Oe.RELATIONAL_DATABASE));if(i.length&&i.forEach(a=>{const l=new mA(this,[a],Cr.RelationalDatabase,Pp.Amazon);this.explicitResources.set(l.resourceId,l)}),u.length){const a=new mA(this,u,Cr.HttpApi,Pp.Amazon);this.explicitResources.set(a.resourceId,a)}}setSteps(u,i){u.forEach(a=>{this.addStep(a,i)}),this.editor.events.emit(dt.ProjectPublishRequestAcknowledged,{})}addStep(u,i){const a=u.dependency||[];if(a.length){const p=a.filter(t=>!this.steps.find(y=>y.id===t));if(p.length)throw new Error(`Missing dependencies: ${p.join(", ")}`)}if(!u.resource)throw new Error(`Resource not found for step ${u.stepType} (${u.id})`);if(!this.steps.find(p=>p.id===u.id)){const p=this.implicitGlobalResources.get(u.resourceType)||this.explicitResources.get(u.resource.resourceId),t=new Bx(u.stepType,u.id,u.resourceType,u.status,a,u.index,i,this,p);this.steps.push(t)}}onUpdate(u){var i;if(console.log("onUpdate",u),(i=u.payload)!=null&&i.stepType){const a=this.steps.find(l=>{var p;return l.id===((p=u.payload)==null?void 0:p.id)});a&&N(u.emittedAt).isAfter(N(a.lasEventTimestamp))&&a.update(u.payload)}this.editor.events.emit("publication-updated",{}),u.type===hA.Error?(this.finalStatus=Rd.Failed,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-error",u)):u.type===hA.Complete&&(this.finalStatus=Rd.Success,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-completed",u))}}function Pme(d){switch(d){case ya.CodeCompilation:return"Code generation";case ya.RelationalDatabaseDeployment:return"Database creation";case ya.HttpApiDeployment:return"HTTP gateway creation";case ya.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case ya.BundleCodebase:return"Bundle code";case ya.MigrateRelationalDatabase:return"Database structure migration";case ya.BusinessLogicCodebaseDeployment:return"Update servers with new code";case ya.CodebaseCleanup:return"Code cleanup";default:return"Publication finished"}}function Vme(d){switch(d){case dt.DeploymentCompleted:return"Successfully published";case dt.DeploymentStarted:return"Publication started";case dt.DeploymentFailed:return"Publication failed";case dt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case dt.RequestPayloadValidationFailed:return"Request payload validation failed";case dt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case dt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case dt.RelationalDatabaseDeploymentStarted:return"Database creation started";case dt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case dt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case dt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case dt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case dt.RelationalDatabaseAlreadyExists:return"Database already exists";case dt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case dt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case dt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case dt.CreatingNewHttpApi:return"Creating new HTTP gateway";case dt.HttpApiAlreadyExists:return"HTTP gateway already exists";case dt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case dt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case dt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case dt.BundlingCodebaseForDownload:return"Bundling code for download";case dt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case dt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case dt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case dt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case dt.CodeCompilationStarted:return"Code generation started";case dt.CodeCompilationCompleted:return"Code generation completed";case dt.CodeCompilationFailed:return"Code generation failed";case dt.BundleCodebaseStarted:return"Code bundling started";case dt.BundleCodebaseCompleted:return"Code bundling completed";case dt.BundleCodebaseFailed:return"Code bundling failed";case dt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case dt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case dt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case dt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case dt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case dt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case dt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case dt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case dt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case dt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case dt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case dt.ProjectNotFound:return"Project not found"}return"Unknown event"}var jx=(d=>(d.NO_LOGIC="NO_LOGIC",d.NO_NAME="NO_NAME",d.NO_CHANGES="NO_CHANGES",d.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",d))(jx||{});function Nme(d){switch(d){case"NO_LOGIC":return"This project has no logic";case"NO_NAME":return"This project has no name";case"NO_CHANGES":return"This version has already been published";case"PROJECT_PUBLICATION_ALREADY_ONGOING":return"This project is already being published";default:return"Publishing is currently not available. Try again later"}}function Lme(d){switch(d){case Cr.RelationalDatabase:return"Relational database";case Cr.HttpEndpoint:case Cr.HttpApi:return"HTTP endpoints";case Cr.ServerlessFunction:case Cr.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function Bme(d){switch(d){case Rd.Running:return"In progress";case Rd.Failed:return"Failed";case Rd.Success:return"Succeeded";case"skipped":return"Skipped";default:return"Queued"}}C.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=gb,C.ALL_BUILT_IN_BASE_ENTITIES=TP,C.ALL_BUILT_IN_CONDITION_ENTITIES=BP,C.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=jP,C.ALL_BUILT_IN_LOOP_BODY_ENTITIES=JO,C.ALL_BUILT_IN_LOOP_ENTITIES=ZO,C.ALL_BUILT_IN_OPERATION_ENTITIES=sC,C.ALL_BUILT_IN_PRIMITIVE_ENTITIES=ZR,C.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=kP,C.ALL_BUILT_IN_VALUE_DESCRIPTORS=KP,C.ALL_CONNECTION_DISABLED_REASONS=wme,C.ALL_OTHER_DISABLED_REASONS=_me,C.ALL_TESTING_DISABLED_REASONS=Rme,C.ActionDescriptorState=Ut,C.ActionInputMapState=mhe,C.ActionOutputMapState=The,C.AppendToListOperationInputIds=eg,C.AppendToListOperationOutputIds=tg,C.Area=ti,C.ArgumentDeclarationDependencyField=Ej,C.ArgumentDeclarationState=da,C.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=Ib,C.BUILT_IN_BASE_ENTITY_IDS=ve,C.BUILT_IN_ENTITY_TYPES=Fi,C.BaseCanvasDraggableState=Pye,C.BaseEntityNames=Oe,C.BaseState=$ye,C.BaseValueDescriptorIds=Il,C.BreakStatementDependencyField=bj,C.BreakStatementState=Ka,C.BuiltInBaseEntityState=gn,C.CACHED_PROJECTS_BY_ID=qo,C.CALLABLE_ENTITIES_EXPLANATION=ghe,C.CALLABLE_TYPES=Fs,C.CALLER_ENTITIES_EXPLANATION=_j,C.CALLER_TYPES=Gs,C.CALLS_UPDATE_EXPLANATION=qa,C.CANVAS_BASE_X=Dx,C.CANVAS_BASE_Y=Cx,C.CANVAS_CARD_HEADER_CENTER_HEIGHT=wd,C.CANVAS_CARD_WIDTH=Rx,C.CANVAS_COMPLEX_CARD_HEIGHT=vme,C.CANVAS_HORIZONTAL_BUFFER_BETWEEN_CARDS=uA,C.CANVAS_SIMPLE_CARD_HEIGHT=lA,C.CANVAS_SIZE=oA,C.CANVAS_VERTICAL_BUFFER_BETWEEN_CARDS=ky,C.CARD_FOOTER_HEIGHT=Ky,C.CARD_PROPERTIES_SECTION_PADDING=ha,C.CARD_PROPERTIES_SECTION_SINGLE_PADDING=dA,C.CHILDREN_TYPES=d9,C.COMPARISON_CONDITIONS=NP,C.CONDITIONS=LP,C.CUSTOM_ENTITY_OPERATIONS=ID,C.CallableEntityClass=Nye,C.CallerEntityClass=Jb,C.CanvasEntityConnectionDisabledReason=cA,C.CanvasEntityOtherDisabledReason=fA,C.CanvasEntityTestingDisabledReason=pA,C.ChangeSet=G,C.ChangeSetChangeCaptureType=JT,C.ChangeSetEntityChangeType=K,C.ChildEntityBaseClass=Vye,C.CommonStringValidationErrorCodes=Fj,C.ComparisonOperatorTypes=dr,C.ConditionDependencyField=J4,C.ConditionState=Ma,C.ContinueStatementDependencyField=K4,C.ContinueStatementState=ui,C.CreateNewInputIds=Yg,C.CreateNewOutputIds=zg,C.DRAGGABLE_CALLABLE_TYPES=B0,C.DRAGGABLE_CALLER_TYPES=jR,C.DRAGGABLE_ELEMENT_TYPES=Rf,C.DRAGGABLE_EXECUTABLE_TYPES=o9,C.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=wf,C.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=L0,C.DataTypeCompatibilityTypes=_s,C.DataTypeDependencyField=zT,C.DataTypeParentChildRelation=Hr,C.DataTypeState=Ji,C.DefinitionEntityDependencyField=Vy,C.DefinitionEntityState=fa,C.DynamicValueTypes=Ae,C.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=Cye,C.ENTITIES_WITH_VALLUES_EXPLANATION=hy,C.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=ye,C.ENTITY_RECUSION_OPTIONS_DEFAULTS=Ne,C.ENTITY_TYPES=l9,C.ENTITY_WITH_CODE_NAMES_TYPES=xR,C.ENTITY_WITH_DECLARATION_TYPES=n9,C.ENTITY_WITH_LOGIC_SCOPE_TYPES=Ar,C.ENTITY_WITH_NAMES_TYPES=UR,C.ENTITY_WITH_PARENT_TYPES=i9,C.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=BR,C.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=s9,C.ENTITY_WITH_VALUE_TYPES=N0,C.ENTRY_POINT_ENTITIES_EXPLANATION=pp,C.ENTRY_POINT_TYPES=Ht,C.ERROR_PROPERTY_HEIGHT=Gy,C.EVENT_TYPES=Al,C.EXECUTABLE_TYPES=a9,C.EXECUTION_OPERATIONS=Hg,C.EfimeralValueStore=Rp,C.EndpointEntity=rx,C.EntityError=St,C.EntityErrorSeverity=Z,C.EntityGenerationError=Q,C.EntityGenerationErrorCode=S,C.EntityInstanceErrorCode=se,C.EntityOperations=rr,C.EntityType=f,C.EntityWithLogicScopeClass=jye,C.EntityWithValueClass=Mye,C.EntryPointEntityClass=Lye,C.Execution=iA,C.ExecutionOperations=tr,C.ExecutionState=rA,C.ExecutionTerminationType=Se,C.ExplicitInfrastructureResource=mA,C.FunctionCallDependencyField=Mj,C.FunctionCallState=Za,C.FunctionDeclarationDependencyField=L4,C.FunctionDeclarationState=Va,C.GET_PROJECT_OPTIONS_DEFAULTS=wp,C.GLOBAL_EVENT_DECLARATIONS=MP,C.GetLastInListOperationInputIds=K_,C.GetLastInListOperationOutputIds=k_,C.GlobalEventNames=kn,C.GlobalEventState=Ba,C.HTTPOperations=li,C.HTTPStatucCodeValidationErrorCodes=ex,C.HTTP_OPERATIONS=rC,C.ImplicitGlobalInfrastructureResource=vA,C.InfrastructureResource=yA,C.InfrastructureResourceStatus=Mx,C.InputMapDependencyField=hj,C.InputMapState=Ds,C.InstalledProjectState=Fa,C.InternalCallDependencyField=pj,C.InternalCallState=Ga,C.JoinListOperationInputIds=l_,C.JoinListOperationOutputIds=d_,C.LIST_OPERATIONS=hg,C.ListOperations=lt,C.LiteralValueDependencyField=$4,C.LiteralValueState=Ei,C.LoopDependencyField=S4,C.LoopState=Ti,C.LoopTypes=xe,C.MAIN_VALUE_PROPERTY_HEADER_HEIGHT=Fy,C.MAIN_VALUE_SUB_PROPERTY_HEIGHT=Eme,C.NESTED_PROPERTY_HEIGHT=_x,C.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=Sa,C.NUMBER_OPERATIONS=I1,C.NumberOperations=lr,C.OPERATION_DECLARATIONS=iC,C.OperationDependencyField=j4,C.OperationState=Na,C.OutputMapDependencyField=mj,C.OutputMapParentChildRelation=bl,C.OutputMapState=Ys,C.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=yy,C.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=ka,C.PASS_THROUGH_CALLABLE_TYPES=Qt,C.PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=MR,C.PLACEHOLDER_VALUE_STORE_CLIENT=nx,C.PROPERTY_HEIGHT=xy,C.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=_b,C.PUBLISHING_DISABLED_REASONS=jx,C.ParallelExecutionOperation=YU,C.PassThroughCallableEntityClass=Bye,C.PersistedEntity=QU,C.PersistedEntityMethods=ss,C.PrimitiveEntityState=Vi,C.PrimitiveTypes=X,C.ProjectState=P,C.ProjectStateEvents=mr,C.PropertyDependencyField=V4,C.PropertyState=oa,C.PublicationRun=$me,C.PublicationStep=Bx,C.READABLE_ENTITY_TYPES=sA,C.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=HU,C.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=Dhe,C.ReturnDeclarationDependencyField=x4,C.ReturnDeclarationState=Pi,C.ReturnStatementDependencyField=XT,C.ReturnStatementState=La,C.SQLAST=lhe,C.STANDALONE_CONDITIONS=RP,C.STATIC_PROPERTY_HEIGHT=gx,C.STRING_OPERATIONS=o_,C.ScopeCompatibilityType=Oy,C.SearchDependencyField=lj,C.SearchState=xa,C.SequentialExecutionOperation=XU,C.SequentialExecutionOperationInputIds=Mg,C.SequentialExecutionOperationOutputIds=jg,C.SharedEntityErrorCode=oe,C.SharedStateFunctionality=WU,C.SplitListOperationInputIds=R_,C.SplitListOperationOutputIds=__,C.StandaloneOperatorTypes=Lr,C.StringOperations=yt,C.TERMINATION_TYPES=ir,C.Traverser=ca,C.USER_MANAGED_ENTITY_TYPES=FR,C.UserManagedEntityStateTemplate=Oye,C.VALUE_READING_ENTITIES_EXPLANATION=Rb,C.VALUE_READING_TYPES=qn,C.VALUE_WRITING_ENTITIES_EXPLANATION=gj,C.VALUE_WRITING_TYPES=Dr,C.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=wb,C.VARIABLE_TYPES=rt,C.ValueAutogenerationType=gr,C.ValueDescriptorDependencyField=Ij,C.ValueDescriptorParentChildRelation=ue,C.ValueDescriptorState=zs,C.ValueReadingEntityClass=Ap,C.ValueWritingEntityClass=Ip,C.VariableDeclarationDependencyField=Y4,C.VariableDeclarationState=Ua,C.VariableInputMapState=yhe,C.VariableInstanceDependencyField=eb,C.VariableInstanceState=ja,C.VariableOutputMapState=Ehe,C.WaitOperation=zU,C.WaitOperationInputIds=Og,C.WaitOperationOutputIds=$g,C.actionDescriptorValidation=vpe,C.addDisabledReasons=Dme,C.afterLiteralValueAsTypeChangeSideEffects=bx,C.afterLiteralValueAsTypeDeleteSideEffects=Tx,C.afterLiteralValueChangeSideEffects=vx,C.afterLiteralValueDeleteSideEffects=mx,C.aggregateVariableInputsNextValues=_p,C.aggregateVariableInputsValues=My,C.appendToListOperation=Cf,C.appendToListOperationElementToAppendArgument=H0,C.appendToListOperationElementToAppendArgumentParentRef=dg,C.appendToListOperationElementToAppendArgumentRef=sg,C.appendToListOperationError=fg,C.appendToListOperationErrorParentRef=pg,C.appendToListOperationListArgument=W0,C.appendToListOperationListArgumentParentRef=lg,C.appendToListOperationListArgumentRef=rg,C.appendToListOperationListDataType=ig,C.appendToListOperationResultListDataType=og,C.appendToListOperationResultListReturn=cg,C.appendToListOperationResultListReturnParentRef=ug,C.appendToListOperationResultListReturnRef=ag,C.appendToListOperationSecondListDataType=ng,C.applyNewScope=Ue,C.argumentDeclarationValidation=bhe,C.asGenerationActionExample=_n,C.assembleAndAddLiteralValueFromDataType=Qs,C.assembleStandaloneLiteralValueFromDataType=Ye,C.booleanPrototype=Sn,C.breakStatementValidation=Ahe,C.calculateCardSize=$x,C.calculateMethodCardSize=Ox,C.calculateNewParentBasedOnCallers=Nb,C.capitalizeFirstLetter=Qr,C.changeSetJSONRecordToUniqueIds=tpe,C.checkAreDataTypesCompatible=gs,C.checkAreDefinitionEntitiesCompatibleAsDataType=p4,C.checkArePropertiesCompatibleAsDataType=c4,C.checkExtendsBaseEntity=$y,C.checkHasBaseEntity=Yi,C.checkHasMetadataChanged=Tr,C.checkImplementationsOverlap=pa,C.checkImplementsBaseEntity=sye,C.checkIsBranchDependentButNotDirectlyOnBranch=Ko,C.checkIsBranchDependentOnBranch=Lb,C.checkIsBuiltIn=Zb,C.checkIsCallableEntityReachable=bp,C.checkIsCanvasEntity=rye,C.checkIsDefEntityInlineDeclaredForSearchOutputType=vb,C.checkIsDetachedBranch=jU,C.checkIsDetachedBranchShallow=kb,C.checkIsEmptyValue=ax,C.checkIsGlobalVariable=eye,C.checkIsGloballyDeclared=Kb,C.checkIsLiteralValueEmpty=Hb,C.checkIsMethod=qb,C.checkIsNestedScope=Cy,C.checkIsRequiredValue=So,C.checkScopeCompatibility=Tp,C.cloneProject=ame,C.conditionValidation=Epe,C.continueStatementValidation=fpe,C.convertToAbstract=jhe,C.convertToNonAbstract=Uhe,C.convertToNonStatic=Fhe,C.convertToStatic=xhe,C.countedLoopActionDescriptor=Au,C.countedLoopActionDescriptorDynamicReturnDeclaration=UO,C.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=jO,C.countedLoopActionDescriptorStringArgumentDeclaration=MO,C.countedLoopActionDescriptorStringArgumentDeclarationDataType=LO,C.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=VO,C.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=PO,C.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=NO,C.countedLoopActionDescriptorStringArgumentDeclarationParentRef=BO,C.countedLoopBodyActionDescriptor=Ff,C.countedLoopBodyActionDescriptorAnyDynamicArgument=kO,C.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=KO,C.countedLoopBodyActionDescriptorAnyDynamicReturn=SO,C.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=qO,C.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=uv,C.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=FO,C.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=xO,C.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=GO,C.createDefinitionEntityFromJSONObject=by,C.createEntityError=nt,C.createNestedDataTypeForEntity=xj,C.createNewInstanceOperation=yo,C.createNewInstanceOperationEntityToInstanciateArgument=nD,C.createNewInstanceOperationEntityToInstanciateArgumentRef=rD,C.createNewInstanceOperationEntityToInstanciateDataType=iD,C.createNewInstanceOperationError=dD,C.createNewInstanceOperationErrorParentRef=lD,C.createNewInstanceOperationNewEntityDataArgument=tD,C.createNewInstanceOperationNewEntityDataArgumentDataType=eD,C.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=Qg,C.createNewInstanceOperationNewEntityDataArgumentParentRef=Xg,C.createNewInstanceOperationOutputEntityDeclaration=oD,C.createNewInstanceOperationOutputEntityDeclarationParentRef=aD,C.createNewInstanceOperationRef=sD,C.createSemanticId=R4,C.createStateFromGenerationTargetType=Dye,C.createStateFromType=kt,C.createStateFromTypeAndSubscribe=ee,C.cronJobBuiltInBaseEntity=Sf,C.cronJobBuiltInBaseEntityExpressionProperty=vP,C.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=v9,C.cronJobBuiltInBaseEntityExpressionPropertyRef=yP,C.cronJobBuiltInBaseEntityRef=mP,C.cronJobTriggeredFunctionDeclarationBlueprint=Rv,C.cronJobTriggeredFunctionDeclarationBlueprintParentRef=fP,C.dataTypeCompatibilityToErrorExplanation=Lj,C.dataTypeValidation=ope,C.datePrototype=pn,C.dateValueAutogenerationSchema=NE,C.definitionEntityToZodSchema=nV,C.definitionEntityValidation=wye,C.deletePersistedEntityMethod=wv,C.deletePersistedEntityMethodParentRef=X$,C.deleteRootProject=lme,C.emitSideEffects=C4,C.emptyCondition=gv,C.emptyConditionArgument=wP,C.emptyConditionRef=IP,C.endpointBuiltInBaseEntity=Gi,C.endpointBuiltInBaseEntityRef=zO,C.endpointBuiltInBaseEntityRefFour=N$,C.endpointBuiltInBaseEntityRefThree=a$,C.endpointBuiltInBaseEntityRefTwo=r$,C.endpointBuiltInCorsProperty=XO,C.endpointBuiltInCorsPropertyDataType=YO,C.endpointBuiltInCorsPropertyDataTypeRef=WO,C.endpointBuiltInCorsPropertyRef=HO,C.endpointBuiltInMethodProperty=pv,C.endpointBuiltInMethodPropertyDataType=n$,C.endpointBuiltInMethodPropertyDataTypeRef=i$,C.endpointBuiltInMethodPropertyRef=s$,C.endpointBuiltInPathProperty=cv,C.endpointBuiltInPathPropertyDataType=t$,C.endpointBuiltInPathPropertyDataTypeRef=QO,C.endpointBuiltInPathPropertyRef=e$,C.endpointPathParamsArgumentDeclaration=hv,C.endpointPathParamsArgumentDeclarationRef=m$,C.endpointPathParamsVariableDataType=v$,C.endpointPathParamsVariableDataTypeRef=y$,C.endpointReachedTriggerActionDescriptor=bv,C.endpointReachedTriggerActionDescriptorRef=E$,C.endpointReachedTriggerActionDescriptorRefFour=A$,C.endpointReachedTriggerActionDescriptorRefThree=b$,C.endpointReachedTriggerActionDescriptorRefTwo=T$,C.endpointRequestBodyArgumentDeclaration=mv,C.endpointRequestBodyArgumentDeclarationRef=u$,C.endpointRequestBodyVariableDataType=c$,C.endpointRequestHeadersArgumentDeclaration=fv,C.endpointRequestHeadersArgumentDeclarationRef=l$,C.endpointRequestHeadersVariableDataType=d$,C.endpointRequestHeadersVariableDataTypeRef=o$,C.endpointRequestQueryParamsArgumentDeclaration=yv,C.endpointRequestQueryParamsArgumentDeclarationRef=f$,C.endpointRequestQueryParamsVariableDataType=h$,C.endpointRequestQueryParamsVariableDataTypeRef=p$,C.endpointResponseBodyDataType=P$,C.endpointResponseBodyReturnDeclaration=Tv,C.endpointResponseBodyReturnDeclarationRef=$$,C.endpointResponseCodeDataType=w$,C.endpointResponseCodeReturnDeclaration=vv,C.endpointResponseCodeReturnDeclarationDefaultValueParentRef=_$,C.endpointResponseCodeReturnDeclarationRef=I$,C.endpointResponseHeadersDataType=C$,C.endpointResponseHeadersDataTypeRef=g$,C.endpointResponseHeadersReturnDeclaration=Ev,C.endpointResponseHeadersReturnDeclarationRef=D$,C.endpointReturnStatementRef=R$,C.endpointReturnStatementRefThree=V$,C.endpointReturnStatementRefTwo=O$,C.enrichFromKnownEntities=hp,C.enumOptionsProperty=SR,C.enumOptionsPropertyDataType=kR,C.enumOptionsPropertyDataTypeRef=GR,C.enumOptionsPropertyRef=KR,C.enumPrototype=Zn,C.enumPrototypeRef=qR,C.errorCodeToMessage=$p,C.executionBuiltInBaseEntity=Zf,C.executionBuiltInEntityAbortMethod=_v,C.executionBuiltInEntityAbortMethodParentRef=EP,C.filterOutDuplicateEntities=R,C.filterOutDuplicateErrors=voe,C.findEntityFromKeys=$b,C.findReferenceToSelfInList=iU,C.findReferencesToSelfInProject=Jhe,C.flattenActionDescriptor=nU,C.flattenArgumentDeclaration=aU,C.flattenBreakStatement=oU,C.flattenBuiltInBaseEntity=lU,C.flattenCalls=Cs,C.flattenCanvasAncestorsUntil=vd,C.flattenCondition=dU,C.flattenContinueStatement=uU,C.flattenDataType=pU,C.flattenDefinitionEntity=cU,C.flattenDefinitionEntityExtensionAndImplementationTypes=bd,C.flattenDefinitionEntityExtensionTypes=mp,C.flattenDefinitionEntityExtensions=xb,C.flattenDefinitionEntityImplementations=Fb,C.flattenDefinitionEntityImplementionTypes=yp,C.flattenDerivedCanvasEntities=Hi,C.flattenDetachedBranch=xU,C.flattenElementCalls=ct,C.flattenElementCallsOnTheSameScope=Zhe,C.flattenEntity=he,C.flattenFunctionCall=fU,C.flattenFunctionDeclaration=hU,C.flattenGlobalEvent=yU,C.flattenInputMap=mU,C.flattenInstalledProject=vU,C.flattenInternalCall=EU,C.flattenLiteralValue=TU,C.flattenLoop=bU,C.flattenOperation=AU,C.flattenOutputMap=IU,C.flattenPrimitiveEntity=wU,C.flattenProject=RU,C.flattenProjectElements=rU,C.flattenProperty=_U,C.flattenRelatedCanvasElementsOnTheLeft=MU,C.flattenRelatedCanvasElementsOnTheRight=gy,C.flattenReturnDeclaration=gU,C.flattenReturnStatement=DU,C.flattenSearch=CU,C.flattenValueDescriptor=OU,C.flattenVariableDeclaration=$U,C.flattenVariableInstance=PU,C.flattenVariableReads=tU,C.flattenVariableWrites=eU,C.flattenVariables=zt,C.fromChangeSetToRecordChangeSet=uye,C.fromLiteralValueTypeToPrimitiveType=yb,C.fromPublishingDisabledCodeToReadable=Nme,C.fromZodParseToEntityGenerationErrors=Tb,C.functionCallValidation=Bhe,C.functionDeclarationValidation=ape,C.generate=nh,C.generateActionExample=Che,C.generateExecutionDataType=Jce,C.generateIdFromStrategy=Ir,C.generateMutablePropertiesExplanation=cy,C.generatePlaceholderValueStore=dme,C.generateRandomBoolean=bV,C.generateRandomDate=dV,C.generateRandomDateAfter=aV,C.generateRandomDateBefore=oV,C.generateRandomDateBetweenRange=lV,C.generateRandomNumber=yV,C.generateRandomNumberAfter=pV,C.generateRandomNumberBefore=fV,C.generateRandomNumberBetweenRange=hV,C.generateRandomText=TV,C.generateRandomTextAfter=mV,C.generateRandomTextBefore=vV,C.generateRandomTextBetweenRange=EV,C.generateStandaloneIfDefault=ume,C.generateUniqueUUID=cV,C.getAllActionDescriptorsForConditions=Ey,C.getAllActionDescriptorsForGlobalEvents=my,C.getAllActionDescriptorsForLoops=vy,C.getAllActionDescriptorsForOperations=Vhe,C.getAllBuiltInEntityIds=Os,C.getAllGloballyDeclaredFunctionDeclarationsExplanation=Pj,C.getBaseBuiltInEntities=Ai,C.getBaseSchemaBasedOnType=wj,C.getBuiltInEntityOwner=Wa,C.getCallableEntityReferenceSchema=Xr,C.getCallableEntityTypeSchema=XL,C.getCalledBy=fs,C.getCallerEntityReferenceSchema=Ade,C.getCallerEntityTypeSchema=bde,C.getCalls=wy,C.getCanvasEntitiesDerivedFromInternalCalls=BU,C.getCanvasEntitiesDerivedFromWrites=Td,C.getCanvasEntityDerivedFromValueReadingEntity=_y,C.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=LU,C.getCanvasEntityReferenceSchema=Ude,C.getCanvasEntityTypeSchema=jde,C.getChildrenEntityWithValues=Zj,C.getColumnProperties=Ad,C.getCommonAncestor=Bb,C.getCommonChildren=Ay,C.getDatabaseEntities=aye,C.getDatabaseEntity=lye,C.getDeclaration=di,C.getDeclarationOutputedError=pye,C.getDeepestScope=GU,C.getDefaultRelationalDatabaseEntityOrFirst=kU,C.getDraggableCallableEntityReferenceSchema=eB,C.getDraggableCallableEntityTypeSchema=QL,C.getDraggableCallerEntityReferenceSchema=wde,C.getDraggableCallerEntityTypeSchema=Ide,C.getDraggableExecutableEntityReferenceSchema=Dde,C.getDraggableExecutableEntityTypeSchema=gde,C.getDraggablePassThroughCallableEntityReferenceSchema=Gh,C.getDraggablePassThroughCallableEntityTypeSchema=Fh,C.getDraggablePlayableEntityReferenceSchema=Vde,C.getDraggablePlayableEntityTypeSchema=Pde,C.getEntitiesCreatedSinceInitialization=By,C.getEntitiesToPropagateValuesTo=en,C.getEntityArgumentDeclarations=Ub,C.getEntityInputMaps=VU,C.getEntityOutputMaps=zhe,C.getEntityReferenceSchema=Mde,C.getEntityReturnDeclarations=NU,C.getEntityTypeSchema=Bde,C.getEntityWithLogicScopeReferenceSchema=sa,C.getEntityWithLogicScopeTypeSchema=Cde,C.getEntityWithValueReferenceSchema=zL,C.getEntityWithValueTypeSchema=Tde,C.getEntryPointEntityReferenceSchema=Sr,C.getEntryPointEntityTypeSchema=$a,C.getEventEntityReferenceSchema=Uh,C.getEventEntityTypeSchema=jh,C.getEventNameFromDefinition=Vme,C.getExecutableEntityReferenceSchema=_de,C.getExecutableEntityTypeSchema=Rde,C.getExtendedBuiltInEntity=Xhe,C.getExtendedDefinitionEntity=Dy,C.getFirstNonLoopScopeOwner=Vr,C.getGenerationTargetSchemaBasedOnType=Rj,C.getHTTPAPINameFromProjectId=Nx,C.getHeadIfPartOfDetachedBranch=UU,C.getHighestScope=FU,C.getImplementedBuiltInEntity=Qhe,C.getIsInteractive=vp,C.getLastInListOperation=J0,C.getLastInListOperationError=Q_,C.getLastInListOperationErrorParentRef=X_,C.getLastInListOperationInputListArgument=H_,C.getLastInListOperationInputListArgumentParentRef=W_,C.getLastInListOperationInputListArgumentRef=q_,C.getLastInListOperationInputListDataType=S_,C.getLastInListOperationOutputElementDataType=J_,C.getLastInListOperationOutputElementReturn=z_,C.getLastInListOperationOutputElementReturnParentRef=Y_,C.getLastInListOperationOutputElementReturnRef=Z_,C.getLinkedEntitiesFromArgumentDeclaration=She,C.getLiteralValueNameFromDataType=Fo,C.getLowestPersistedEntityImplementation=Gb,C.getParentCallableEntity=kj,C.getParentCallerEntity=Sj,C.getParentCanvasEntities=ei,C.getParentCanvasEntity=cr,C.getParentCanvasEntityFromTransfer=Iy,C.getParentEntryPoint=Ghe,C.getParentPassthroughCallableEntity=qj,C.getPassThroughCallableEntityReferenceSchema=ur,C.getPassThroughCallableEntityTypeSchema=xh,C.getPeristedEntities=nye,C.getPlayableEntityReferenceSchema=$de,C.getPlayableEntityTypeSchema=Ode,C.getProject=ome,C.getPrototypeByType=Ep,C.getRecusriveParentsIds=Py,C.getReferenceEntityId=W,C.getReferencedEntitiesStateOrErrors=fy,C.getReferencedEntityStateOrErrors=bb,C.getReferencedIds=Ed,C.getRelatedCanvasElementsOnTheLeft=Ja,C.getRelatedCanvasElementsOnTheLeftFromTransfer=Whe,C.getRelatedCanvasElementsOnTheRight=Xs,C.getRelationalDBInstanceNameFromEntityId=Lx,C.getRootEntryPointScopeOwner=Sb,C.getScopeOwner=Ii,C.getStateClassFromType=dye,C.getStepNameFromDefinition=Pme,C.getTerminationReferenceSchema=Lde,C.getTerminationTypeSchema=Nde,C.getTopLevelParentEntityId=qU,C.getTouchedCanvasEntitiesFromChangeSet=cye,C.getUsedArgFromDeclaration=Hhe,C.getUsedReturnFromDeclaration=Yhe,C.getValueReadingEntityReferenceSchema=YL,C.getValueReadingEntityTypeSchema=ia,C.getValueWritingEntityReferenceSchema=Ede,C.getValueWritingEntityTypeSchema=ic,C.getVariableFromInputMapping=Wj,C.getVariableFromReturnVariablePointer=zj,C.getVariableReferenceSchema=Oa,C.getVariableTypeSchema=Lo,C.getVariablesFromArgumentDeclarations=Ry,C.getVariablesFromInputMaps=Hj,C.getVariablesFromOutputMapping=Xj,C.getVariablesFromOutputMaps=Qj,C.getVariablesFromReturnDeclarations=Yj,C.getVariablesInSameOrHigherScope=UT,C.getWrites=jb,C.globalEventValidation=hpe,C.groupCallsBasedOnParallelizableExecution=Mb,C.handleAfterEntityImplementationSideEffects=Uj,C.handleBeforeEntityImplementationSideEffects=jj,C.handleLiteralValueChange=cme,C.handleLiteralValueDelete=Ex,C.handleValueAsTypeChange=pme,C.handleValueAsTypeDelete=Ax,C.httpRequestBodyArgument=Vf,C.httpRequestBodyArgumentRef=BD,C.httpRequestBodyDataType=MD,C.httpRequestHeadersArgument=Pf,C.httpRequestHeadersArgumentRef=ND,C.httpRequestHeadersDataType=LD,C.httpRequestMethodArgument=Of,C.httpRequestMethodArgumentRef=PD,C.httpRequestMethodDataType=VD,C.httpRequestMethodDataTypeRef=OD,C.httpRequestOperation=vu,C.httpRequestOperationErrorValueDescriptor=tv,C.httpRequestOperationErrorValueDescriptorDatatype=tC,C.httpRequestOperationErrorValueDescriptorRef=eC,C.httpRequestOperationRef=YD,C.httpRequestOperationRefEight=XD,C.httpRequestOperationRefFive=WD,C.httpRequestOperationRefFour=JD,C.httpRequestOperationRefNine=QD,C.httpRequestOperationRefSeven=zD,C.httpRequestOperationRefSix=HD,C.httpRequestOperationRefThree=ZD,C.httpRequestOperationRefTwo=SD,C.httpRequestQueryParamsArgument=ev,C.httpRequestQueryParamsArgumentRef=DD,C.httpRequestQueryParamsDataType=CD,C.httpRequestVariableURLArgument=$f,C.httpRequestVariableURLArgumentRef=_D,C.httpRequestVariableURLDataType=gD,C.httpRequestVariableURLDataTypeRef=wD,C.httpResponseBodyReturnDataType=qD,C.httpResponseBodyReturnDataTypeRef=KD,C.httpResponseBodyReturnReturn=Bf,C.httpResponseBodyReturnReturnRef=kD,C.httpResponseCodeDataType=UD,C.httpResponseCodeReturn=Nf,C.httpResponseCodeReturnRef=jD,C.httpResponseHeadersDataType=GD,C.httpResponseHeadersDataTypeRef=xD,C.httpResponseHeadersReturn=Lf,C.httpResponseHeadersReturnRef=FD,C.httpStatusCodeValueValidation=tx,C.hydrateOrDiscardLiteralValue=ox,C.implement=Ty,C.inferArgumentDeclarationDataType=f4,C.inferDataType=Ws,C.inferInputMapDataType=BT,C.inferOutputMapDataType=jT,C.inferPropertyDataType=m4,C.inferReturnDeclarationDataType=MT,C.inferValueDescriptorDataType=v4,C.inferVariableDeclarationDataType=y4,C.inferVariableInstanceDataType=h4,C.initBaseProjectEntity=Ly,C.initProject=sx,C.initProjectFromFetchResult=ix,C.inputMapValidation=hhe,C.installedProjectValidation=phe,C.internalCallValidation=fhe,C.isPromise=Ob,C.isUUID=_4,C.iterateOverListActionDescriptorListArgumentDeclaration=BC,C.iterateOverListActionDescriptorListArgumentDeclarationDataType=NC,C.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=VC,C.iterateOverListActionDescriptorListArgumentDeclarationParentRef=LC,C.iterateOverListLoopActionDescriptor=Ia,C.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=jC,C.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=MC,C.iterateOverListLoopBodyActionDescriptor=bu,C.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=ZC,C.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=SC,C.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=WC,C.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=JC,C.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=xf,C.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=xC,C.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=UC,C.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=FC,C.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=qC,C.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=KC,C.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=GC,C.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=kC,C.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=QC,C.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=zC,C.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=YC,C.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=XC,C.iterateOverObjectKeysLoopActionDescriptor=gl,C.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=tO,C.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=eO,C.iterateOverObjectKeysLoopBodyActionDescriptor=av,C.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=uO,C.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=dO,C.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=pO,C.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=cO,C.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=nv,C.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=iO,C.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=rO,C.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=sO,C.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=lO,C.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=aO,C.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=nO,C.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=oO,C.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=vO,C.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=yO,C.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=hO,C.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=mO,C.iterateOverObjectValuesLoopActionDescriptor=Dl,C.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=TO,C.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=EO,C.iterateOverObjectValuesLoopBodyActionDescriptor=lv,C.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=CO,C.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=DO,C.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=$O,C.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=OO,C.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=ov,C.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=AO,C.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=bO,C.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=IO,C.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=gO,C.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=RO,C.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=wO,C.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=_O,C.iterateOverStringActionDescriptorDynamicReturnDeclaration=bC,C.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=TC,C.iterateOverStringActionDescriptorStringArgumentDeclaration=EC,C.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=mC,C.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=yC,C.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=vC,C.iterateOverStringLoopActionDescriptor=Tu,C.iterateOverStringLoopBodyActionDescriptor=Uf,C.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=CC,C.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=DC,C.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=$C,C.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=OC,C.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=iv,C.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=IC,C.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=AC,C.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=wC,C.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=sv,C.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=_C,C.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=RC,C.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=gC,C.joinListOperation=q0,C.joinListOperationError=w_,C.joinListOperationErrorParentRef=I_,C.joinListOperationFirstListArgument=v_,C.joinListOperationFirstListArgumentParentRef=m_,C.joinListOperationFirstListArgumentRef=u_,C.joinListOperationFirstListDataType=c_,C.joinListOperationResultListDataType=y_,C.joinListOperationResultListReturn=A_,C.joinListOperationResultListReturnParentRef=b_,C.joinListOperationResultListReturnRef=h_,C.joinListOperationSecondListArgument=T_,C.joinListOperationSecondListArgumentParentRef=E_,C.joinListOperationSecondListArgumentRef=p_,C.joinListOperationSecondListDataType=f_,C.joinListWithLastSeparator=ke,C.joinStringsOperation=mu,C.joinStringsOperationDynamicStringArgument=k1,C.joinStringsOperationDynamicStringArgumentParentRef=K1,C.joinStringsOperationDynamicStringArgumentRef=F1,C.joinStringsOperationDynamicStringDataType=G1,C.joinStringsOperationError=x1,C.joinStringsOperationErrorParentRef=U1,C.joinStringsOperationFirstStringArgument=gf,C.joinStringsOperationFirstStringArgumentParentRef=O1,C.joinStringsOperationFirstStringArgumentRef=w1,C.joinStringsOperationFirstStringDataType=R1,C.joinStringsOperationResultStringDataType=C1,C.joinStringsOperationResultStringReturn=yu,C.joinStringsOperationResultStringReturnParentRef=j1,C.joinStringsOperationResultStringReturnRef=D1,C.joinStringsOperationSecondStringArgument=Df,C.joinStringsOperationSecondStringArgumentParentRef=M1,C.joinStringsOperationSecondStringArgumentRef=_1,C.joinStringsOperationSecondStringDataType=g1,C.joinStringsOperationSeparatorStringArgument=B1,C.joinStringsOperationSeparatorStringArgumentParentRef=L1,C.joinStringsOperationSeparatorStringArgumentRef=$1,C.joinStringsOperationSeparatorStringDataType=N1,C.joinStringsOperationSeparatorStringDataTypeDefaultValue=V1,C.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=P1,C.keyValuePrototype=wl,C.literalValueValidation=rpe,C.loopValidation=mpe,C.lowercaseFirstLetter=od,C.manualFlowActionDescriptorDeclarationArgumentDeclaration=rv,C.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=lC,C.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=oC,C.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=dC,C.manualFlowLoopActionDescriptor=Mf,C.manualFlowLoopActionDescriptorDynamicReturnDeclaration=aC,C.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=nC,C.manualFlowLoopBodyActionDescriptor=jf,C.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=cC,C.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=uC,C.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=fC,C.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=pC,C.mapActionDescriptorToTypeItRepresents=iye,C.mapRecord=sU,C.mergeArraysOfStringsWithoutDuplicates=gme,C.mergeEntityErrorsList=Eoe,C.mergeListOfEntities=tye,C.methodDefaultValue=$D,C.mockClientProject=CE,C.moreThanOrEqualCondition=Vl,C.moreThanOrEqualConditionLeftHandArgument=CP,C.moreThanOrEqualConditionLeftHandArgumentDataType=gP,C.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=_P,C.moreThanOrEqualConditionLeftHandArgumentParentRef=DP,C.moreThanOrEqualConditionRightHandArgument=VP,C.moreThanOrEqualConditionRightHandArgumentDataType=$P,C.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=OP,C.moreThanOrEqualConditionRightHandArgumentParentRef=PP,C.noSpacesOrDashesValueValidation=Kj,C.noSpacesValueValidation=Gj,C.notEmptyCondition=Ao,C.notEmptyConditionArgument=AP,C.notEmptyConditionRef=bP,C.nullPrototype=M0,C.numberAdditionOperation=_f,C.numberAdditionOperationDynamicSummandArgument=n1,C.numberAdditionOperationDynamicSummandArgumentType=s1,C.numberAdditionOperationDynamicSummandArgumentTypeParentRef=i1,C.numberAdditionOperationError=r1,C.numberAdditionOperationErrorParentRef=t1,C.numberAdditionOperationFirstNumberArgument=j0,C.numberAdditionOperationFirstNumberArgumentRef=JR,C.numberAdditionOperationFirstNumberDataType=WR,C.numberAdditionOperationRef=QR,C.numberAdditionOperationRefThree=x0,C.numberAdditionOperationRefTwo=e1,C.numberAdditionOperationResultNumberDataType=XR,C.numberAdditionOperationResultNumberReturn=F0,C.numberAdditionOperationResultNumberReturnRef=zR,C.numberAdditionOperationSecondNumberArgument=U0,C.numberAdditionOperationSecondNumberArgumentRef=HR,C.numberAdditionOperationSecondNumberDataType=YR,C.numberPrototype=ut,C.numberSubtractionOperation=K0,C.numberSubtractionOperationDynamicSubtrahendArgument=A1,C.numberSubtractionOperationDynamicSubtrahendArgumentType=b1,C.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=T1,C.numberSubtractionOperationError=E1,C.numberSubtractionOperationErrorParentRef=v1,C.numberSubtractionOperationFirstNumberArgument=p1,C.numberSubtractionOperationFirstNumberArgumentRef=a1,C.numberSubtractionOperationFirstNumberDataType=o1,C.numberSubtractionOperationRef=G0,C.numberSubtractionOperationRefThree=y1,C.numberSubtractionOperationRefTwo=f1,C.numberSubtractionOperationResultNumberDataType=c1,C.numberSubtractionOperationResultNumberReturn=m1,C.numberSubtractionOperationResultNumberReturnRef=u1,C.numberSubtractionOperationSecondNumberArgument=h1,C.numberSubtractionOperationSecondNumberArgumentRef=l1,C.numberSubtractionOperationSecondNumberDataType=d1,C.numberValueAutogenerationSchema=VE,C.operationValidation=upe,C.orderEntitiesForTraversal=Mhe,C.outputMapValidation=vhe,C.parallelExecutionOperation=Ks,C.parallelExecutionOperationError=Cg,C.parallelExecutionOperationErrorParentRef=Dg,C.parallelExecutionOperationListOfExecutionResultsDataType=Rg,C.parallelExecutionOperationListOfExecutionResultsReturn=z0,C.parallelExecutionOperationListOfExecutionResultsReturnRef=wg,C.parallelExecutionOperationListOfFunctionsArgument=Y0,C.parallelExecutionOperationListOfFunctionsArgumentDatatype=Ig,C.parallelExecutionOperationListOfFunctionsArgumentRef=Ag,C.parallelExecutionOperationListOfFunctionsBlueprint=bg,C.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=Eg,C.parallelExecutionOperationListOfFunctionsBlueprintDynamicInputParentRef=vg,C.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=mg,C.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutputParentRef=yg,C.parallelExecutionOperationListOfFunctionsBlueprintParentRef=Tg,C.parallelExecutionOperationRef=_g,C.parallelExecutionOperationRefThree=gg,C.persistedBuiltInBaseEntity=si,C.persistedBuiltInBaseEntityDatabaseProperty=Ol,C.persistedBuiltInBaseEntityDatabasePropertyDataType=tP,C.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=h9,C.persistedBuiltInBaseEntityDatabasePropertyParentRef=rP,C.persistedBuiltInBaseEntityDatabasePropertyRef=eP,C.persistedBuiltInBaseEntityPrimaryKeyProperty=$l,C.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=uP,C.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=sP,C.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=iP,C.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=cP,C.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=dP,C.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=aP,C.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=nP,C.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=lP,C.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=oP,C.printEntity=Vb,C.processOutputGlobalValueDescriptorDataType=xP,C.processOutputGlobalValueDescriptorReturn=Wf,C.processOutputGlobalValueDescriptorReturnRef=UP,C.projectPublicationCompletedGlobalEvent=Jf,C.propagateNewInputOrOutputMapValueAsTypeToParentVariable=Op,C.propagateNewInputOrOutputMapValueToParentVariable=Cp,C.propagateNewStaticPropertyValueAsTypeToVariables=Jo,C.propagateNewStaticPropertyValueToVariables=Zo,C.propertyToZodSchema=sV,C.propertyValidation=Qce,C.readValueFromWritter=Id,C.rebaseStack=YT,C.relationalDatabaseBuiltInBaseEntity=zr,C.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=Iv,C.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=Y$,C.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=H$,C.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=z$,C.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=W$,C.relationalDatabaseBuiltInBaseEntityDefaultProperty=Av,C.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=J$,C.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=S$,C.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=Z$,C.relationalDatabaseBuiltInBaseEntityIdentifierProperty=Gf,C.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=M$,C.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=L$,C.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=B$,C.relationalDatabaseBuiltInBaseEntityMinSizeProperty=qf,C.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=q$,C.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=K$,C.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=k$,C.relationalDatabaseBuiltInBaseEntityPasswordProperty=kf,C.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=F$,C.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=f9,C.relationalDatabaseBuiltInBaseEntityPasswordPropertyDefaultValueParentRef=G$,C.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=x$,C.relationalDatabaseBuiltInBaseEntityRef=Cl,C.relationalDatabaseBuiltInBaseEntityUsernameProperty=Kf,C.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=U$,C.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=p9,C.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=j$,C.removeDisabledReasons=Cme,C.resolveActionDescriptorName=w4,C.resolveArgumentDeclarationValue=zb,C.resolveBaseEntityName=T4,C.resolveBuiltInBaseEntityDataTypeLabel=b4,C.resolveCardSubheader=yme,C.resolveClonedEntityProject=wr,C.resolveConditionOperatorLabel=zh,C.resolveDataType=Hh,C.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=Pb,C.resolveDataTypeLabel=dd,C.resolveDatatypeIconName=hme,C.resolveDefinitionEntityDataTypeLabel=Yce,C.resolveDefinitionEntitySubheader=nA,C.resolveEntityCodeName=ST,C.resolveEntityDataTypeLabel=Hce,C.resolveEntityName=re,C.resolveEntitySubheader=mme,C.resolveFirstCallsSecond=khe,C.resolveFirstWritesSecond=qhe,C.resolveFunctionDeclarationCardSubheader=aA,C.resolveInputMapNextStandaloneValue=eA,C.resolveInputMapNextValue=Dp,C.resolveInputMapNextValueAsPropertyOfAnObject=cx,C.resolveInputMapStandaloneValue=tA,C.resolveInputMapValue=fx,C.resolveInputMapValueAsPropertyOfAnObject=px,C.resolveMethodCardSubheader=wx,C.resolveNextValue=Uy,C.resolveOutputMapValue=Qb,C.resolvePersistedDefinitionEntityDatabaseEntity=KU,C.resolvePrimaryKeyProperty=oye,C.resolvePrimitiveEntityForSearchLiteralValueType=mb,C.resolvePrimitiveEntityName=I4,C.resolvePropertyValue=hx,C.resolvePublicationStepStatusFromType=Bme,C.resolveResourceNameFromType=Lme,C.resolveReturnDeclarationValue=Xb,C.resolveSearchName=A4,C.resolveValue=Ha,C.resolveValueDescriptorValue=yx,C.resolveVarDeclarationAggregateObjectValue=dx,C.resolveVarDeclarationNextAggregateObjectValue=lx,C.resolveVarDeclarationNextValue=gp,C.resolveVarDeclarationValue=Yb,C.resolveVarInstanceNextValue=jy,C.resolveVarInstanceValue=ux,C.resolveVariableScope=Wce,C.returnDeclarationValidation=cpe,C.returnStatementValidation=ppe,C.searchStatementErrorGlobalValueDescriptor=Ov,C.searchStatementErrorGlobalValueDescriptorDataType=GP,C.searchStatementErrorGlobalValueDescriptorRef=FP,C.searchStatementState=dhe,C.searchStatementUtils=che,C.searchValidation=Ape,C.sequentialExecutionOperation=Hn,C.sequentialExecutionOperationError=Wg,C.sequentialExecutionOperationErrorParentRef=Jg,C.sequentialExecutionOperationListOfExecutionResultsDataType=qg,C.sequentialExecutionOperationListOfExecutionResultsReturn=Q0,C.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=Zg,C.sequentialExecutionOperationListOfExecutionResultsReturnRef=kg,C.sequentialExecutionOperationListOfFunctionsArgument=X0,C.sequentialExecutionOperationListOfFunctionsArgumentDatatype=Kg,C.sequentialExecutionOperationListOfFunctionsArgumentParentRef=Sg,C.sequentialExecutionOperationListOfFunctionsArgumentRef=Gg,C.sequentialExecutionOperationListOfFunctionsBlueprint=Fg,C.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=xg,C.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=Ug,C.softDeletePersistedEntityMethod=y9,C.softDeletePersistedEntityMethodParentRef=pP,C.sortCallsBasedOnExecutionDependencies=Jj,C.sortChildrenEntitiesBasedOnExecutionDependencies=Khe,C.splitListOperation=Z0,C.splitListOperationError=G_,C.splitListOperationErrorParentRef=F_,C.splitListOperationFirstOutputListDataType=$_,C.splitListOperationFirstOutputListReturn=M_,C.splitListOperationFirstOutputListReturnParentRef=B_,C.splitListOperationFirstOutputListReturnRef=S0,C.splitListOperationInputListArgument=V_,C.splitListOperationInputListArgumentParentRef=P_,C.splitListOperationInputListArgumentRef=g_,C.splitListOperationInputListDataType=D_,C.splitListOperationSecondOutputListDataType=j_,C.splitListOperationSecondOutputListReturn=x_,C.splitListOperationSecondOutputListReturnParentRef=U_,C.splitListOperationSplitIndexArgument=L_,C.splitListOperationSplitIndexArgumentParentRef=N_,C.splitListOperationSplitIndexArgumentRef=C_,C.splitListOperationSplitIndexDataType=O_,C.splitStringOperation=k0,C.splitStringOperationError=a_,C.splitStringOperationErrorParentRef=n_,C.splitStringOperationFirstPartResultStringDataType=H1,C.splitStringOperationFirstPartResultStringReturn=s_,C.splitStringOperationFirstPartResultStringReturnParentRef=i_,C.splitStringOperationFirstPartResultStringReturnRef=W1,C.splitStringOperationIndexArgument=t_,C.splitStringOperationIndexArgumentParentRef=e_,C.splitStringOperationIndexArgumentRef=Z1,C.splitStringOperationIndexDataType=J1,C.splitStringOperationSecondPartResultStringDataType=z1,C.splitStringOperationSecondPartResultStringReturn=u9,C.splitStringOperationSecondPartResultStringReturnParentRef=r_,C.splitStringOperationSecondPartResultStringReturnRef=Y1,C.splitStringOperationStringArgument=Q1,C.splitStringOperationStringArgumentParentRef=X1,C.splitStringOperationStringArgumentRef=q1,C.splitStringOperationStringDataType=S1,C.stringPrototype=qe,C.stringValueAutogenerationSchema=PE,C.suggestNewIdForEntity=ZT,C.syncSearchEntityOutput=Eb,C.test_primitive_entities_export=zye,C.toCamelCase=Zr,C.toEntityState=wi,C.toKebabCase=E4,C.toLowerCaseKebabCase=Yh,C.toPascalCase=ld,C.transitionProjectVersion=WT,C.translateLogicErrorCode=Tme,C.translateLogicErrorCodeShort=bme,C.translateLogicErrorCodeShortWithEntityName=Ame,C.translateLogicErrorCodeWithEntityName=Ime,C.traverseChangeSet=HT,C.untypedDataPrototype=Yr,C.updateErrorsList=Xt,C.urlDefaultValue=RD,C.uuidPrototype=Jn,C.validateArgumentDeclarationName=kT,C.validateCalledByErrorIdInAction=$he,C.validateCalledByIdInAction=Ohe,C.validateCallers=$j,C.validateConditionEntityDeclaration=Nhe,C.validateDataOperation=mo,C.validateDataOperationDataToValidateArgument=fD,C.validateDataOperationDataToValidateArgumentParentRef=pD,C.validateDataOperationDataToValidateArgumentRef=uD,C.validateDataOperationDataToValidateDataType=cD,C.validateDataOperationEntityToMatchTypeArgument=vD,C.validateDataOperationEntityToMatchTypeArgumentParentRef=mD,C.validateDataOperationEntityToMatchTypeArgumentRef=hD,C.validateDataOperationEntityToMatchTypeDataType=yD,C.validateDataOperationError=AD,C.validateDataOperationErrorParentRef=bD,C.validateDataOperationOutputEntityDeclaration=TD,C.validateDataOperationOutputEntityDeclarationParentRef=ED,C.validateDefinitionEntityName=xT,C.validateEntityValues=Ix,C.validateEntryCaller=Oj,C.validateErrorCaller=Cj,C.validateFunctionCallDeclaration=Vj,C.validateFunctionDeclarationName=FT,C.validateGeneratedEntityParentIsNotBuiltInEntity=_he,C.validateGeneration=whe,C.validateGenerationTarget=Er,C.validateGenerationUpdate=Rhe,C.validateLogic=fme,C.validateLoopEntityDeclaration=Lhe,C.validateName=zce,C.validateOperationEntityDeclaration=Nj,C.validatePropertyName=KT,C.validateReachability=ua,C.validateReadsValueInActionPayload=Phe,C.validateReferenceObject=py,C.validateReferenceToOne=Ab,C.validateReferences=xr,C.validateReturnDeclarationName=qT,C.validateSuccessCaller=Dj,C.validateValueReaderGenerationUpdate=fp,C.validateValueWritter=Db,C.validateVariableDeclarationName=GT,C.validateVariableInternalCallUse=Cb,C.valueAutogenerationCurrentDateAndTimeSchema=OL,C.valueAutogenerationGenericSchema=Ih,C.valueAutogenerationOptions=LE,C.valueAutogenerationOptionsSchema=CL,C.valueAutogenerationRandomBooleanSchema=$E,C.valueAutogenerationRandomDateBetweenSchema=UL,C.valueAutogenerationRandomDateFromSchema=ML,C.valueAutogenerationRandomDateSchema=_h,C.valueAutogenerationRandomDateUntilSchema=jL,C.valueAutogenerationRandomNumberBetweenSchema=VL,C.valueAutogenerationRandomNumberFromSchema=$L,C.valueAutogenerationRandomNumberSchema=wh,C.valueAutogenerationRandomNumberUntilSchema=PL,C.valueAutogenerationRandomSchema=Yu,C.valueAutogenerationRandomTextBetweenSchema=BL,C.valueAutogenerationRandomTextFromSchema=NL,C.valueAutogenerationRandomTextSchema=Rh,C.valueAutogenerationRandomTextUntilSchema=LL,C.valueAutogenerationRangeValueTypesSchema=Hu,C.valueAutogenerationUniqueSchema=OE,C.valueDescriptorValidation=Ihe,C.variableDeclarationValidation=Tpe,C.variableInstanceValidation=bpe,C.waitOperation=Ri,C.waitOperationMillisecondsNumberArgument=ho,C.waitOperationMillisecondsNumberArgumentRef=Pg,C.waitOperationMillisecondsNumberDataType=Vg,C.waitOperationOperationError=Bg,C.waitOperationOperationErrorParentRef=Lg,C.waitOperationRef=Ng,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|
|
403
|
+
Alternatively you can update the parent data-type entity with 'update' action to remove the existing value of the field.`,issue:null}))}return{errors:p,modifiedData:l}}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 l=[...a.ownDeclaredProperties,...a.extendedPropertiesFromOriginalParents].filter(p=>!p.abstract);return[...i,...l]},[]))}get implementedPropertiesFromOriginalParents(){return R([...this.extends.reduce((i,a)=>{const l=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(t=>!!t.abstract&&!l.find(y=>y.name===t.name));return[...l,...p,...i]},[]),...this.implements.reduce((i,a)=>{const l=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(t=>!!t.abstract&&!l.find(y=>y.name===t.name));return[...l,...p,...i]},[])].filter(i=>!!i.abstract))}get extendedMethodsFromOriginalParents(){return R(this.extends.reduce((i,a)=>{if(a.type!==f.DefinitionEntity)return[];const l=[...a.ownDeclaredMethods,...a.extendedMethodsFromOriginalParents].filter(p=>p.type!==f.ActionDescriptor);return[...i,...l]},[]))}get implementedMethodsFromOriginalParents(){return R([...this.extends.reduce((i,a)=>{const l=a.type===f.DefinitionEntity?a.methods:[],p=[...a.abstractMethods].filter(t=>!l.find(y=>y.name===t.name));return[...l,...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 Q({id:`${this.id}--${S.InvalidParentUpdate}`,code:S.InvalidParentUpdate,severity:Z.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on an '${this.type}', must be the root project as it is a globally declared entity.`,issue:null})),{errors: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,P.sessionAuthor,N().toISOString(),this,!0,"sync-dependents"))){const a=[],l=[],p=[],t=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),l.push(...v.added),p.push(...v.removed),t.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}onDetachedDependencyRemoved(i,a,l){const p=[],t=[],y=[],v=[];return a==="implements"&&this.removeImplementation(i),a==="extends"&&this.removeExtension(i),{updated:R(p),added:R(t),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,l){const p=[],t=[],y=[],v=[];return a==="implements"&&this.addImplementation(i),a==="extends"&&this.addExtension(i),{updated:R(p),added:R(t),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){return this.implements.forEach(i=>{Fi.includes(i.type)||i.unsubscribeDependents([{entity:this,field:"implements"}])}),this}subscribeToDependencies(){return this.implements.forEach(i=>{Fi.includes(i.type)||i.subscribeDependents([{entity:this,field:"implements"}])}),this.extends.forEach(i=>{Fi.includes(i.type)||i.subscribeDependents([{entity:this,field:"extends"}])}),this}increaseVersion(i){if(i&&!N(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&N(i).isSame(N(this.createdAt))?this:(this.previousVersion=this.version,this.version=P.UUID.uuid(),this.createdAt=N(i).toISOString()||N().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new $t(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=[],l=[],p=[],t=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),l.push(...y.added),p.push(...y.removed)}return{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}async restoreVersion(i){var v;const a=[],l=[],p=[],t=[];if(this.version===i)return{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this};if(!this.knownVersions){const b=new Map;for(const[w,A]of this.knownVersions||new Map){if(b.set(w,A),A.activeVersion=!1,A.knownVersions)for(const[V,L]of A.knownVersions)b.set(V,L);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const b=await this.APILoadVersion({},i);if(!b)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new $t(b,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(l),removed:R(p),affected:R(t),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().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 l=W(i.parent),p=this.project.get(l),t=this.parent;if(t&&t.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 '${l}' 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(l=>{const p=W(l),t=this.project.get(p);t&&this.addExtension(t)}),i.implements.forEach(l=>{const p=W(l),t=this.project.get(p);t&&this.addImplementation(t)}),this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const i=[],a=[],l=[],p=[];if(this.initialData.parent){const t=W(this.initialData.parent),y=this.project.get(t);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${t}' 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(t=>{const y=W(t),v=this.project.get(y);v&&(this.addExtension(v),v.type!==f.BuiltInBaseEntity&&i.push(v))}),this.initialData.implements.forEach(t=>{const y=W(t),v=this.project.get(y);v&&(this.addImplementation(v),v.type!==f.BuiltInBaseEntity&&i.push(v))}),{updated:R(i),added:R(a),removed:R(l),affected:R(p),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],l=[],p=[],t=[];this.initialized=!0;const{updated:y,added:v,removed:b,affected:w}=this.syncImplementationProperties(i);a.push(...y),l.push(...v),p.push(...b),t.push(...w);const{updated:A,added:V,removed:L,affected:U}=this.addExtendedProperties(i);a.push(...A),l.push(...V),p.push(...L),t.push(...U);const{updated:k,added:q,removed:H}=this.removeUnrecognizedProperties(i);a.push(...k),l.push(...q),p.push(...H);const{updated:ie,added:te,removed:pe,affected:ne}=this.syncImplementationMethods(i);a.push(...ie),l.push(...te),p.push(...pe),t.push(...ne);const{updated:me,added:J,removed:ae,affected:ce}=this.addExtendedMethods(i);a.push(...me),l.push(...J),p.push(...ae),t.push(...ce);const{updated:Y,added:de,removed:Ee}=this.removeUnrecognizedMethods(i);return a.push(...Y),l.push(...de),p.push(...Ee),this.addSuggestions(),this.captureVersion(),i==null||i.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}addSelfToProject(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-self-to-project"))){const a=[this],l=[],p=[],t=[];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(l),removed:R(p),affected:R(t),self:this}}setParent(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"set-parent"))){var l;return((l=this.parent)==null?void 0:l.id)!==(i==null?void 0:i.id)&&(this.parent=i,a&&(a==null||a.add(this,K.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,P.sessionAuthor,N().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.properties=this.initialData.properties.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(i),l}),this.methods=this.initialData.methods.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(i),l}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(i),l}),this.extends=this.initialData.extends.map(a=>ee(a,this.project)),this.implements=this.initialData.implements.map(a=>ee(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,P.sessionAuthor,N().toISOString(),this,!0,"remove-unrecognized-properties"))){const a=[],l=[],p=[],t=[];let y=[...this.properties];y=y.filter(b=>b.parent.id===this.id),y=y.filter(b=>!b.isExtendedProperty);const v=this.implementedPropertiesFromOriginalParents;return y=y.filter(b=>this.interactive&&!b.implements?!1:!v.find(w=>{var A;return w.id===((A=b.implements)==null?void 0:A.id)})),y.forEach(b=>{const w=b.remove({ignoreUpstream:!1},i);p.push(...w.removed),a.push(...w.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-properties",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}removeUnrecognizedMethods(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-unrecognized-methods"))){const a=[],l=[],p=[],t=[];let y=[...this.methods];y=y.filter(b=>b.parent.id===this.id),y=y.filter(b=>!b.isExtendedMethod);const v=this.implementedMethodsFromOriginalParents;return y=y.filter(b=>this.interactive&&!b.implements?!1:!v.find(w=>{var A;return w.id===((A=b.implements)==null?void 0:A.id)})),y.forEach(b=>{const w=b.remove({ignoreUpstream:!1},i);p.push(...w.removed),a.push(...w.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-methods",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}syncImplementationMethods(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-implementation-methods"))){const a=[],l=[],p=[],t=[],y=this.methods,v=this.implementedMethodsFromOriginalParents,b=[...this.allBaseMethodsFromExtendedAndImplementedEntities,...y];return v.filter(A=>!b.find(L=>{var U;return((U=L.implements)==null?void 0:U.id)===A.id})).forEach(A=>{if(this.methods.find(k=>{var q;return((q=k.implements)==null?void 0:q.id)===A.id}))return;const L=this.methods.find(k=>{var pe,ne;if(k.name===A.name&&!k.implements)return!0;const q=Yi(this,Oe.CRON_JOB),H=Yi(this,Oe.HTTP_ENDPOINT),ie=((pe=k.implements)==null?void 0:pe.id)===ve["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id,te=((ne=k.implements)==null?void 0:ne.id)===ve["built-in-base-entity"].BUILT_IN_CRON_JOB_ENTITY.methods.handler.id;return!!(q&&!te&&!H&&ie||H&&!ie&&!q&&te)});if(L&&L.type===f.FunctionDeclaration){L.setImplements(A),L.metaSync({name:A.name},i),i==null||i.add(L,K.Updated),i==null||i.add(this,K.Updated);return}const U=A.implementAsFunctionDeclaration(i,this);l.push(U),i==null||i.add(U,K.Added),this.addMethod(U)}),i==null||i.attemptAutoclose("sync-implementation-methods",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}syncImplementationProperties(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-implementation-properties"))){const a=[],l=[],p=[],t=[],y=this.properties,v=this.implementedPropertiesFromOriginalParents,b=[...this.allBasePropertiesFromExtendedAndImplementedEntities,...y];return v.filter(A=>!b.find(L=>{var U;return((U=L.implements)==null?void 0:U.id)===A.id})).forEach(A=>{if(this.properties.find(k=>{var q;return((q=k.implements)==null?void 0:q.id)===A.id}))return;const L=this.properties.find(k=>k.name===A.name&&!!k.abstract&&!k.implements);if(L){L.setImplements(A,i),L.metaSync({abstract:!1},i),L.afterAllChildrenInitialized(i);return}const U=A.implement(this,i,P.UUID.uuid());l.push(U),i==null||i.add(U,K.Added)}),i==null||i.attemptAutoclose("sync-implementation-properties",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}addExtendedMethods(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-extended-methods"))){const a=[],l=[],p=[],t=[],y=this.methods,b=this.extendedMethodsFromOriginalParents.filter(A=>A.type===f.FunctionDeclaration),w=new Set(y.filter(A=>{var V;return!!((V=A.extends)!=null&&V.id)}).map(A=>A.extends.id));return b.forEach(A=>{if(w.has(A.id))return;w.add(A.id);const V=A.clone(i,this,P.UUID.uuid());V.setExtends(A,i),V.initChildren(i),l.push(V),i==null||i.add(V,K.Added),this.addMethod(V)}),i==null||i.attemptAutoclose("add-extended-methods",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}addExtendedProperties(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-extended-properties"))){const a=[],l=[],p=[],t=[],y=this.properties,v=this.extendedPropertiesFromOriginalParents,b=v.filter(A=>v.find(L=>{var U;return((U=L.implements)==null?void 0:U.id)===A.id})?!1:!A.abstract),w=new Set(y.filter(A=>{var V;return!!((V=A.extends)!=null&&V.id)}).map(A=>A.extends.id));return b.forEach(A=>{if(w.has(A.id))return;w.add(A.id);const V=A.clone(i,this,P.UUID.uuid());V.setExtends(A,i),V.initChildren(i),l.push(V),i==null||i.add(V,K.Added),this.addProperty(V)}),i==null||i.attemptAutoclose("add-extended-properties",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}addSuggestions(){return this.implements.forEach(i=>{ZU(this,i).forEach(p=>{const t=p.toJSON();t.id=`_suggestion--parent--${this.id}--${p.id}`;const y=ee(t,this.project);y.suggestion=!0,y.setParent(this,null),y.initChildren(null),this.addSuggestedProperty(y)}),JU(this,i).forEach(p=>{const t=`_suggestion--parent--${this.id}--${p.id}`,y=p.implementAsFunctionDeclaration(null,this,t),v=ee(y,this.project);if(v.suggestion=!0,v.setParent(this,null),v.initChildren(null),this.methods=this.methods.filter(b=>b.id!==t),v.inputs.forEach(b=>{b.suggestion=!0}),v.returnStatements.length){const b=v.returnStatements[0];b.suggestion=!0,b.outputs.forEach(w=>{w.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,P.sessionAuthor,N().toISOString(),this,!0,"meta-sync"))){const l=Tr(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,K.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,K.Added):l&&(a==null||a.add(this,K.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ye,...a){return await $t.repository.APILoad(this.id,...a),this}async APICreate(i=ye,...a){return await $t.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ye,...a){return await $t.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ye,...a){return await $t.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ye,...a){return await $t.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ye,a,...l){return await $t.repository.APILoadVersion(this.id,a,...l)}removeFromParent(i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-from-parent"))){const a=[],l=[],p=[],t=[];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(l),affected:R(t),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-entity"))){const l=[],p=[],t=[],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:b,removed:w,added:A}=v.entity.onDetachedDependencyRemoved(this,v.field,a);l.push(...b),p.push(...w),t.push(...A)}),this.properties.forEach(v=>{const{updated:b,removed:w}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(...w)}),this.methods.forEach(v=>{const{updated:b,removed:w}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(...w)}),this.abstractMethods.forEach(v=>{const{updated:b,removed:w}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(...w)}),this.suggestedProperties.forEach(v=>{const{updated:b,removed:w}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(...w)}),this.suggestedMethods.forEach(v=>{const{updated:b,removed:w}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(...w)}),!i){const v=this.removeFromParent(a);t.push(...v.added),l.push(...v.updated),p.push(...v.removed),y.push(...v.affected)}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:R(t),updated:R(l),removed:R(p),affected:R(y),self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"restore-entity"))){const a=[],l=[],p=[],t=[];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:b,added:w}=y.entity.onDetachedDependencyRestored(this,y.field,i);l.push(...v),p.push(...b),a.push(...w)}),this.properties.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),this.methods.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),this.abstractMethods.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),this.suggestedProperties.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),this.suggestedMethods.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),i==null||i.attemptAutoclose("restore-entity",this.id),{added:R(a),updated:R(l),removed:R(p),affected:R(t),self:this})}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.extends.flatMap(l=>l.toFlat(i)),...this.implements.flatMap(l=>l.toFlat(i)),...this.properties.flatMap(l=>l.toFlat(i)),...this.methods.flatMap(l=>l.toFlat(i)),...this.abstractMethods.flatMap(l=>l.toFlat(i)),...this.parent.toFlat(i)])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.extends.flatMap(l=>l.toFlatIds(i)),...this.implements.flatMap(l=>l.toFlatIds(i)),...this.properties.flatMap(l=>l.toFlatIds(i)),...this.methods.flatMap(l=>l.toFlatIds(i)),...this.abstractMethods.flatMap(l=>l.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=Ne){var l,p,t,y,v;let a;return(l=i.seenEntityMaps)!=null&&l.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||Ir(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(p=i.seenEntities)!=null&&p.has(a)||(t=i.seenEntities)!=null&&t.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:P.UUID.uuid(),createdAt:i.timestamp||N().toISOString(),author:P.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(b=>b.toJSONClone({...i,newId:null})),methods:this.methods.map(b=>b.toJSONClone({...i,newId:null})),abstractMethods:this.abstractMethods.map(b=>b.toJSONClone({...i,newId:null})),implements:this.implements.map(b=>b.type===f.BuiltInBaseEntity?b.toJSON():b.toJSONClone({...i,newId:null})),extends:this.extends.map(b=>b.type===f.BuiltInBaseEntity?b.toJSON():b.toJSONClone({...i,newId:null})),parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=Ne){var l;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+P.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=Ne){var l;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.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(l=>l.toFlatJSON(i)),...this.methods.flatMap(l=>l.toFlatJSON(i)),...this.abstractMethods.flatMap(l=>l.toFlatJSON(i)),...this.implements.flatMap(l=>l.toFlatJSON(i)),...this.extends.flatMap(l=>l.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(l=>l.toFlatGenerationTarget(i)),...this.methods.flatMap(l=>l.toFlatGenerationTarget(i)),...this.abstractMethods.flatMap(l=>l.toFlatGenerationTarget(i)),...this.implements.filter(l=>l.type===f.DefinitionEntity).flatMap(l=>l.toFlatGenerationTarget(i)),...this.implements.filter(l=>l.type===f.DefinitionEntity).flatMap(l=>l.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=SU(this),{success:!0,error:null,data:null}}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,P.sessionAuthor,N().toISOString(),this,!0,"clone-entity")),a=null,l=null,p=!0){var k,q,H;let t=wr(a,this);const y=this.toJSON(),v=l||P.UUID.uuid();y.properties=[],y.methods=[],y.abstractMethods=[];const b=v.split("-id"),w=b[b.length-1||0]||v;y.id=v,y.version=P.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||N().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1;const A=kt(y,t);a&&A.setParent(a,null),p&&A.subscribe(),A.initChildren(i),i==null||i.add(A,K.Added);const V=(k=this.properties)==null?void 0:k.map(ie=>ie.clone(i,A,P.UUID.uuid(),p));A.properties=V;const L=(q=this.methods)==null?void 0:q.map((ie,te)=>ie.clone(i,A,w+"-method-"+te+"-id",p));A.methods=L;const U=(H=this.abstractMethods)==null?void 0:H.map((ie,te)=>ie.clone(i,A,w+"-abstract-method-"+te+"-id",p));return A.abstractMethods=U,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,P.sessionAuthor,N().toISOString(),this,!0,"implement-definition-entity")),l){const p=Ty(this,i,a,l);return a==null||a.attemptAutoclose("implement-definition-entity",this.id),p}getAllInteractiveMethods(){const i=this.implements.filter(l=>l.type===f.DefinitionEntity||l.type===f.BuiltInBaseEntity&&l.interactive);return R([...this.methods,...this.extends.flatMap(l=>l.getAllInteractiveMethods()),...i.flatMap(l=>l.getAllInteractiveMethods())])}inferFromInputs(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"infer-definition-entity-from-inputs"))){const l=[],p=[],t=[],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(L=>re(L,this.project)===re(A,this.project))||v.push(A)});const b=this.properties.filter(A=>!A.dataType);v.forEach(A=>{var H,ie;const V=b.find(te=>re(te,this.project)===re(A,this.project));if(!V)return;const U=di(A.parent).getMasterInputWithValueWritterFromAllInstances(A),k=Ws(U,a),q=k==null?void 0:k.clone(a,V,P.UUID.uuid(),!0);q&&((H=V.dataType)==null||H.merge(q,a),q.id!==((ie=V.dataType)==null?void 0:ie.id)&&q.remove({ignoreUpstream:!1},a),V.dataType&&(V.dataType.metaSync({inferred:!0,like:!0},a),V.setDataType(V.dataType,a),a==null||a.add(V,K.Affected))),A.setDeclaration(V),a==null||a.add(A,K.Updated)});const w=[];return v.forEach(A=>{if(!A.declaration){w.push(A);return}}),w.length===0?(a==null||a.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(w.forEach(A=>{var te,pe,ne,me;const V=this.properties.find(J=>re(J,this.project)===re(A,this.project));if(V){if(A.setDeclaration(V),!V.getDataType(a)){const ae=di(A.parent).getMasterInputWithValueWritterFromAllInstances(A),ce=Ws(ae),Y=ce==null?void 0:ce.clone(a,V,P.UUID.uuid(),!0);Y&&((te=V.dataType)==null||te.merge(Y,a),Y.id!==((pe=V.dataType)==null?void 0:pe.id)&&Y.remove({ignoreUpstream:!1},a),V.dataType&&(V.dataType.metaSync({inferred:!0,like:!0},a),V.setDataType(V.dataType,a),a==null||a.add(V,K.Affected)))}return}const L={id:P.UUID.uuid(),type:f.Property,version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||N().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,name:re(A,this.project),codeName:A.codeName,description:A.description,defaultValue:null,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,constant:!0,index:A.index,implements:null,extends:null,dataType:null,parent:this.toReference()},U=ee(L,this.project);U.setParent(this,a),U.initChildren(a),a==null||a.add(U,K.Added);const q=di(A.parent).getMasterInputWithValueWritterFromAllInstances(A),H=Ws(q),ie=H==null?void 0:H.clone(a,U,P.UUID.uuid(),!0);return ie&&((ne=U.dataType)==null||ne.merge(ie,a),ie.id!==((me=U.dataType)==null?void 0:me.id)&&ie.remove({ignoreUpstream:!1},a),U.dataType&&(U.dataType.metaSync({inferred:!0,like:!0},a),U.setDataType(U.dataType,a),a==null||a.add(U,K.Affected))),this.addProperty(U),A.setDeclaration(U),a==null||a.add(A,K.Updated),U}),a==null||a.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:R(l),updated:R(p),removed:R(t),affected:R(y),self:this})}getRawDefaultValue(){const i={};return this.properties.forEach(a=>{var p;const l=Zr(a.name);i[l]=((p=a.getDefaultValue())==null?void 0:p.value)||null}),i}getActiveRawDefaultValue(){const i={};return this.properties.forEach(a=>{const l=Zr(a.name),p=this.project.requestActiveValue(a);i[l]=(p==null?void 0:p.value)||null}),i}};D($t,"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,...l)=>null}),D($t,"type",f.DefinitionEntity),D($t,"USER_MANAGED_PARENT_TYPES",[f.Project,f.DataType]),D($t,"PARENT_TYPES",[...$t.USER_MANAGED_PARENT_TYPES]),D($t,"MUTABLE_BASE_PROPERTIES",["name","codeName","description","static","abstract"]),D($t,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),D($t,"BASE_PROPERTIES",[...$t.MUTABLE_BASE_PROPERTIES,...$t.INMUTABLE_BASE_PROPERTIES]),D($t,"MUTABLE_META_PROPERTIES",[...$t.MUTABLE_BASE_PROPERTIES,"x","y"]),D($t,"INMUTABLE_META_PROPERTIES",[...$t.INMUTABLE_BASE_PROPERTIES]),D($t,"META_PROPERTIES",[...$t.MUTABLE_META_PROPERTIES,...$t.INMUTABLE_META_PROPERTIES]),D($t,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),D($t,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),D($t,"UPSTREAM_PROPERTIES",[...$t.MUTABLE_UPSTREAM_PROPERTIES,...$t.INMUTABLE_UPSTREAM_PROPERTIES]),D($t,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),D($t,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),D($t,"DOWNSTREAM_PROPERTIES",[...$t.MUTABLE_DOWNSTREAM_PROPERTIES,...$t.INMUTABLE_DOWNSTREAM_PROPERTIES]),D($t,"PROPERTIES",[...$t.META_PROPERTIES,...$t.UPSTREAM_PROPERTIES,...$t.DOWNSTREAM_PROPERTIES]);let fa=$t;function _ye(d){const u=Boe(),i=d.toJSON();u.safeParse(i).success;const l=[];return Xt(d.errors,l)}const Vp=class Vp extends yr{constructor(i,a){super(i);D(this,"initialData");D(this,"id");D(this,"version");D(this,"name");D(this,"description",null);D(this,"type",f.BuiltInBaseEntity);D(this,"abstract",!1);D(this,"static");D(this,"properties",[]);D(this,"methods",[]);D(this,"abstractMethods",[]);D(this,"extends",[]);D(this,"interactive",!1);D(this,"errors",[]);D(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(l=>{const p=ee(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.methods=this.initialData.methods.map(l=>{const p=ee(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.abstractMethods=this.initialData.abstractMethods.map(l=>{const p=ee(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.extends=this.initialData.extends.map(l=>ee(l,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 l=[...a.ownDeclaredProperties,...a.allBasePropertiesFromExtendedAndImplementedEntities].filter(p=>!p.abstract);return[...i,...l]},[]))}get extendedPropertiesFromOriginalParents(){return R(this.extends.reduce((i,a)=>{const l=[...a.ownDeclaredProperties,...a.extendedPropertiesFromOriginalParents].filter(p=>!p.abstract);return[...i,...l]},[]))}get implementedPropertiesFromOriginalParents(){return R([...this.extends.reduce((i,a)=>{const l=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(t=>!!t.abstract&&!l.find(y=>y.name===t.name));return[...l,...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=ye,...a){return await Vp.repository.APILoad(this.id,...a),this}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.properties.flatMap(l=>l.toFlat(i)),...this.methods.flatMap(l=>l.toFlat(i)),...this.abstractMethods.flatMap(l=>l.toFlat(i)),...this.extends.flatMap(l=>l.toFlat(i))])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.properties.flatMap(l=>l.toFlatIds(i)),...this.methods.flatMap(l=>l.toFlatIds(i)),...this.abstractMethods.flatMap(l=>l.toFlatIds(i)),...this.extends.flatMap(l=>l.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=Ne){return{id:this.id+"--"+P.UUID.uuid()+"--ref",type:f.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(i=Ne){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(l=>l.toFlatJSON(i)),...this.methods.flatMap(l=>l.toFlatJSON(i)),...this.abstractMethods.flatMap(l=>l.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(l=>l.toFlatGenerationTarget(i)),...this.methods.flatMap(l=>l.toFlatGenerationTarget(i)),...this.abstractMethods.flatMap(l=>l.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=_ye(this);return this.errors=i,{success:!0,error:null,data:this.toJSON()}}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,P.sessionAuthor,N().toISOString(),null,!0,"implement-built-in-base-entity")),l){const p=Ty(this,i,a,l);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(l=>l.type===f.BuiltInBaseEntity&&l.interactive||l.type===f.PrimitiveEntity).forEach(l=>{l instanceof Vp&&i.push(...l.getAllInteractiveMethods())})),R(i)}};D(Vp,"repository",{APILoad:async(i,...a)=>null});let gn=Vp;function gye(d){const u=goe(),i=d.toJSON();u.safeParse(i).success;const l=[];return Xt(d.errors,l)}const qy=class qy extends yr{constructor(i,a){super(i);D(this,"initialData");D(this,"id");D(this,"name");D(this,"description",null);D(this,"type",f.PrimitiveEntity);D(this,"static");D(this,"abstract");D(this,"properties",[]);D(this,"methods",[]);D(this,"abstractMethods",[]);D(this,"extends",[]);D(this,"errors",[]);D(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(l=>{const p=ee(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.methods=this.initialData.methods.map(l=>{const p=ee(l,this.project);return p.parent=this,p}),this.abstractMethods=this.initialData.abstractMethods.map(l=>{const p=ee(l,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 l=[...a.ownDeclaredProperties,...a.allBasePropertiesFromExtendedAndImplementedEntities].filter(p=>!p.abstract);return[...i,...l]},[]))}get extendedPropertiesFromOriginalParents(){return R(this.extends.reduce((i,a)=>{const l=[...a.ownDeclaredProperties,...a.extendedPropertiesFromOriginalParents].filter(p=>!p.abstract);return[...i,...l]},[]))}get implementedPropertiesFromOriginalParents(){return R([...this.extends.reduce((i,a)=>{const l=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(t=>!!t.abstract&&!l.find(y=>y.name===t.name));return[...l,...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=ye,...a){return await qy.repository.APILoad(this.id,...a),this}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.properties.flatMap(l=>l.toFlat(i)),...this.methods.flatMap(l=>l.toFlat(i)),...this.abstractMethods.flatMap(l=>l.toFlat(i))])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.properties.flatMap(l=>l.toFlatIds(i)),...this.methods.flatMap(l=>l.toFlatIds(i)),...this.abstractMethods.flatMap(l=>l.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=Ne){return{id:this.id+"--"+P.UUID.uuid()+"--ref",type:f.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(i=Ne){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(l=>l.toFlatJSON(i)),...this.methods.flatMap(l=>l.toFlatJSON(i)),...this.abstractMethods.flatMap(l=>l.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(l=>l.toFlatGenerationTarget(i)),...this.methods.flatMap(l=>l.toFlatGenerationTarget(i)),...this.abstractMethods.flatMap(l=>l.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=gye(this);return this.errors=i,{success:!0,error:null,data:this.toJSON()}}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(l=>l.type===f.BuiltInBaseEntity&&l.interactive||l.type===f.PrimitiveEntity).forEach(l=>{l instanceof gn&&i.push(...l.getAllInteractiveMethods())}),R(i)}};D(qy,"repository",{APILoad:async(i,...a)=>null});let Vi=qy;function kt(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 Ei(d,u);case f.DefinitionEntity:return i||new fa(d,u);case f.PrimitiveEntity:return i||new Vi(d,u);case f.FunctionDeclaration:return i||new Va(d,u);case f.GlobalEvent:return i||new Ba(d,u);case f.DataType:return i||new Ji(d,u);case f.Property:return i||new oa(d,u);case f.FunctionCall:return i||new Za(d,u);case f.Condition:return i||new Ma(d,u);case f.Operation:return i||new Na(d,u);case f.VariableDeclaration:return i||new Ua(d,u);case f.VariableInstance:return i||new ja(d,u);case f.OutputMap:return i||new Ys(d,u);case f.ReturnDeclaration:return i||new Pi(d,u);case f.ArgumentDeclaration:return i||new da(d,u);case f.InputMap:return i||new Ds(d,u);case f.Project:return i||new P(d);case f.InstalledProject:return i||new Fa(d,u);case f.ActionDescriptor:return i||new Ut(d,u);case f.ReturnStatement:return i||new La(d,u);case f.Loop:return i||new Ti(d,u);case f.Search:return i||new xa(d,u);case f.ValueDescriptor:return i||new zs(d,u);case f.BuiltInBaseEntity:return i||new gn(d,u);case f.InternalCall:return i||new Ga(d,u);case f.ContinueStatement:return i||new ui(d,u);case f.BreakStatement:return i||new Ka(d,u);case f.GenericReference:return u.get(d.entityId);default:throw new Error("Invalid entity type: "+d.type)}}function ee(d,u){if(!d)throw new Error("Entity is null");const i=kt(d,u);return i.subscribe(),i}function Dye(d,u){if(!d)throw new Error("Entity is null");switch(d.type){case f.LiteralValue:return Ei.fromGenerationTarget(d,u);case f.DefinitionEntity:return fa.fromGenerationTarget(d,u);case f.FunctionDeclaration:return Va.fromGenerationTarget(d,u);case f.GlobalEvent:return Ba.fromGenerationTarget(d,u);case f.DataType:return Ji.fromGenerationTarget(d,u);case f.Property:return oa.fromGenerationTarget(d,u);case f.FunctionCall:return Za.fromGenerationTarget(d,u);case f.Condition:return Ma.fromGenerationTarget(d,u);case f.Operation:return Na.fromGenerationTarget(d,u);case f.VariableDeclaration:return Ua.fromGenerationTarget(d,u);case f.VariableInstance:return ja.fromGenerationTarget(d,u);case f.OutputMap:return Ys.fromGenerationTarget(d,u);case f.ReturnDeclaration:return Pi.fromGenerationTarget(d,u);case f.ArgumentDeclaration:return da.fromGenerationTarget(d,u);case f.InputMap:return Ds.fromGenerationTarget(d,u);case f.InstalledProject:return Fa.fromGenerationTarget(d,u);case f.ReturnStatement:return La.fromGenerationTarget(d,u);case f.Loop:return Ti.fromGenerationTarget(d,u);case f.Search:return xa.fromGenerationTarget(d,u);case f.ActionDescriptor:return Ut.fromGenerationTarget(d,u);case f.ValueDescriptor:return zs.fromGenerationTarget(d,u);case f.InternalCall:return Ga.fromGenerationTarget(d,u);case f.ContinueStatement:return ui.fromGenerationTarget(d,u);case f.BreakStatement:return Ka.fromGenerationTarget(d,u);default:throw new Error("Invalid entity type: "+d.type)}}const Ne={seenEntityMaps:new Map,seenEntities:new Set,timestamp:N().toISOString()};class WU{constructor(){D(this,"initialData")}}const ye={cascade:!1},HU={APILoad:async(d,...u)=>null},Cye={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,...HU};class Oye{}class $ye extends WU{}class Pye{}class Vye{}class Nye{}class Jb{}class Lye extends Jb{}class Bye extends Jb{}class Mye{}class Ap{static initReadsValue(u){if(u.initialData.readsValue&&u.initialData.readsValue.type!==f.GenericReference)u.readsValue=ee(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(rt.includes(u.readsValue.type)){let i=u.parent;Ar.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 Ip{static initWritesValues(u,i){const a=u.initialData.writesValues.reduce((p,t)=>{if(t.type===f.GenericReference||u.writesValues.some(v=>v.id===t.id))return p;const y=ee(t,u.project);return y.setValueWriter(u,null),rt.includes(y.type)&&(y.setParent(i,null),y.initChildren(null)),[...p,y]},[]),l=[...u.writesValues];return u.writesValues=R([...l,...a]),u.writesValues}}class jye{}var Uye=Object.defineProperty,xye=(d,u,i)=>u in d?Uye(d,u,{enumerable:!0,configurable:!0,writable:!0,value:i}):d[u]=i,ko=(d,u,i)=>(xye(d,typeof u!="symbol"?u+"":u,i),i);let Fye=class{constructor(u){ko(this,"eventName"),ko(this,"callbacks",[]),this.eventName=u,this.on=this.on.bind(this),this.off=this.off.bind(this),this.destroy=this.destroy.bind(this)}on(u){if(typeof u!="function")throw new Error("Event callback must be a function");this.callbacks.includes(u)||this.callbacks.push(u)}off(u){if(typeof u!="function")throw new Error("Event callback must be a function");this.callbacks=this.callbacks.filter(i=>i!==u)}destroy(){this.callbacks=[]}},Wb=class{constructor(){ko(this,"subscribedEvents",{}),ko(this,"on",this._on),ko(this,"emit",this._emit),ko(this,"off",this._off),ko(this,"destroy",this._destroy),this.getEvent=this.getEvent.bind(this),this._on=this._on.bind(this),this._emit=this._emit.bind(this),this._off=this._off.bind(this),this._destroy=this._destroy.bind(this),this.on=this.on.bind(this),this.emit=this.emit.bind(this),this.off=this.off.bind(this),this.destroy=this.destroy.bind(this)}getEvent(u){return this.subscribedEvents[u]||(this.subscribedEvents[u]=new Fye(u)),this.subscribedEvents[u]}_on(u,i){this.getEvent(u).on(i)}_emit(u,...i){const a=this.getEvent(u);a&&a.callbacks.forEach(l=>{l.apply(null,i)})}_off(u,i){const a=this.getEvent(u);a&&(i?a.off(i):(a.destroy(),delete this.subscribedEvents[u]))}_destroy(){Object.keys(this.subscribedEvents).forEach(u=>{this._off(u)}),this.subscribedEvents={}}};var mr=(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))(mr||{});const We=class We extends yr{constructor(i){super(i);D(this,"initialData");D(this,"id");D(this,"type",f.Project);D(this,"name",null);D(this,"description",null);D(this,"x");D(this,"y");D(this,"entities",[]);D(this,"projects",[]);D(this,"functions",[]);D(this,"events",[]);D(this,"variableDeclarations",[]);D(this,"variableInstances",[]);D(this,"conditions",[]);D(this,"operations",[]);D(this,"functionCalls",[]);D(this,"loops",[]);D(this,"searches",[]);D(this,"primitives",[]);D(this,"builtInBaseEntities",[]);D(this,"operationDeclarations",[]);D(this,"globalEventActionDescriptors",[]);D(this,"loopDeclarations",[]);D(this,"loopDeclarationsBodies",[]);D(this,"conditionDeclarations",[]);D(this,"valueDescriptors",[]);D(this,"dataTypes",[]);D(this,"project");D(this,"instances",{});D(this,"builtInInstances",{});D(this,"deletedInstances",{});D(this,"errors",[]);D(this,"references",[]);D(this,"history",[]);D(this,"undoableStackValueIndex",-1);D(this,"detachedDependents",{});D(this,"knownVersions",null);D(this,"activeVersion",!1);D(this,"initialized",!1);D(this,"startedInitialization",!1);D(this,"_eventsHub",new Wb);D(this,"onCloseChangeSetCallback",null);D(this,"onAddChangeSetCallback",null);D(this,"onDiscardChangeSetCallback",null);D(this,"onRequestActiveValueCallback",null);if(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,!We.UUID)throw new Error("UUID module is already initialized. Please inject a valid UUID module.")}static get UUID(){return this._UUIDModule}static injectUUIDModule(i){this._UUIDModule=i}static new(i=null){return{id:We.UUID.uuid(),version:We.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||N().toISOString(),author:(i==null?void 0:i.author)||We.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 l=JSON.parse(JSON.stringify(i));const p=[];return p.push(...Er(l)),{errors:p,modifiedData:l}}get off(){return this._eventsHub.off}get on(){return this._eventsHub.on}get emit(){return this._eventsHub.emit}async closePendingChangeSets(){const i=this.history.find(a=>a.dirty&&!a.open);i&&await this.closeChangeSet(i)}onRequestActiveValue(i){this.onRequestActiveValueCallback=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(t=>t.id===i.id),l=this.history.slice(0,a),p=l[l.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,l,p=!1,t="here-this"){if(!this.history.length)return new G(this,i,a,l,p,t);const y=this.history[this.history.length-1];return y.open?y:this.addChangeSet(new G(this,i,a,l,p,t))}addChangeSet(i){var p,t;if(!this.history.length)return this.undoableStackValueIndex=YT(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 l=this.history.find(y=>y.open);if(l)throw console.warn("Previous still open: ",l),console.warn("New change set: ",i),new Error(`There is already an open change-set with id '${l.id}'.`);return this.undoableStackValueIndex=YT(this.undoableStackValueIndex,this.history,i),(t=this.onAddChangeSetCallback)==null||t.call(this,i,this.undoableStackValueIndex),i}discardChangeSet(i){var l;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,(l=this.onDiscardChangeSetCallback)==null||l.call(this,i)),this}async inject(...i){return await Promise.all(i.map(a=>new Promise(async l=>{await a.init(this),l(null)}))),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,We.sessionAuthor,N().toISOString(),this,!0,"sync-dependents"))){const a=[],l=[],p=[],t=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),l.push(...v.added),p.push(...v.removed),t.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}onDetachedDependencyRemoved(i,a,l){const p=[],t=[],y=[],v=[];return{updated:R(p),added:R(t),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,l){const p=[],t=[],y=[],v=[];return{updated:R(p),added:R(t),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){return this}subscribeToDependencies(){return this}increaseVersion(i){if(i&&!N(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&N(i).isSame(N(this.createdAt))?this:(this.previousVersion=this.version,this.version=We.UUID.uuid(),this.createdAt=N(i).toISOString()||N().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new We(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=[],l=[],p=[],t=[];return{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}async restoreVersion(i){var v;const a=[],l=[],p=[],t=[];if(this.version===i)return{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this};if(!this.knownVersions){const b=new Map;for(const[w,A]of this.knownVersions||new Map){if(b.set(w,A),A.activeVersion=!1,A.knownVersions)for(const[V,L]of A.knownVersions)b.set(V,L);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const b=await this.APILoadVersion({},i);if(!b)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new We(b)}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(l),removed:R(p),affected:R(t),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new G(this.project,We.sessionAuthor,N().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=[],l=[],p=[];return{updated:R(i),added:R(a),removed:R(l),affected:R(p),self:this}}afterAllChildrenInitialized(i=null){const a=[],l=[],p=[],t=[];return this.initialized||(this.initialized=!0,this.emit("project-initialized",this,i)),this.validate(),this.captureVersion(),{updated:R(a),added:R(l),removed:R(p),affected:R(t),self:this}}addSelfToProject(i){const a=[],l=[],p=[],t=[];return this.subscribe(),this.subscribeToDependencies(),{updated:R(a),added:R(l),removed:R(p),affected:R(t),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,We.sessionAuthor,N().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.entities=this.initialData.entities.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.projects=this.initialData.projects.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.variableDeclarations=this.initialData.variableDeclarations.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.variableInstances=this.initialData.variableInstances.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.conditions=this.initialData.conditions.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.operations=this.initialData.operations.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.functions=this.initialData.functions.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.events=this.initialData.events.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.functionCalls=this.initialData.functionCalls.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.loops=this.initialData.loops.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),this.searches=this.initialData.searches.map(a=>{const l=ee(a,this);return l.setParent(this,null),l.initChildren(i),l}),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,We.sessionAuthor,N().toISOString(),this,!0,"meta-sync"))){const l=Tr(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,K.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,K.Added):l&&(a==null||a.add(this,K.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ye,...a){return await We.repository.APILoad(this.id,...a),this}async APICreate(i=ye,...a){return await We.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ye,...a){return await We.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ye,...a){return await We.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ye,...a){return await We.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ye,a,...l){return await We.repository.APILoadVersion(this.id,a,...l)}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new G(this.project,We.sessionAuthor,N().toISOString(),this,!0,"remove-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}restore({}={},i=this.project.addChangeSet(new G(this.project,We.sessionAuthor,N().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(l=>l.toFlat(i)),...this.functions.flatMap(l=>l.toFlat(i)),...this.events.flatMap(l=>l.toFlat(i)),...this.projects.flatMap(l=>l.toFlat(i)),...this.variableDeclarations.flatMap(l=>l.toFlat(i)),...this.variableInstances.flatMap(l=>l.toFlat(i)),...this.conditions.flatMap(l=>l.toFlat(i)),...this.operations.flatMap(l=>l.toFlat(i)),...this.functionCalls.flatMap(l=>l.toFlat(i)),...this.loops.flatMap(l=>l.toFlat(i)),...this.searches.flatMap(l=>l.toFlat(i))])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.entities.flatMap(l=>l.toFlatIds(i)),...this.functions.flatMap(l=>l.toFlatIds(i)),...this.events.flatMap(l=>l.toFlatIds(i)),...this.projects.flatMap(l=>l.toFlatIds(i)),...this.variableDeclarations.flatMap(l=>l.toFlatIds(i)),...this.variableInstances.flatMap(l=>l.toFlatIds(i)),...this.conditions.flatMap(l=>l.toFlatIds(i)),...this.operations.flatMap(l=>l.toFlatIds(i)),...this.functionCalls.flatMap(l=>l.toFlatIds(i)),...this.loops.flatMap(l=>l.toFlatIds(i)),...this.searches.flatMap(l=>l.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,l=new Set,p=this.getAllBuiltInIds();return Object.keys(this.instances).forEach(t=>{if(p.includes(t)){a.set(t,t);return}a.set(t,We.UUID.uuid())}),l.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(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),projects:this.projects.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),variableDeclarations:this.variableDeclarations.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),variableInstances:this.variableInstances.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),conditions:this.conditions.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),operations:this.operations.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),functions:this.functions.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),events:this.events.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),functionCalls:this.functionCalls.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),loops:this.loops.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null})),searches:this.searches.map(t=>t.toJSONClone({...i,seenEntityMaps:a,seenEntities:l,newId:null}))}}toReference(i=Ne){var l;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+We.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=Ne){var l;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.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(l=>l.toFlatJSON(i)),...this.functions.flatMap(l=>l.toFlatJSON(i)),...this.events.flatMap(l=>l.toFlatJSON(i)),...this.projects.flatMap(l=>l.toFlatJSON(i)),...this.variableDeclarations.flatMap(l=>l.toFlatJSON(i)),...this.variableInstances.flatMap(l=>l.toFlatJSON(i)),...this.conditions.flatMap(l=>l.toFlatJSON(i)),...this.operations.flatMap(l=>l.toFlatJSON(i)),...this.functionCalls.flatMap(l=>l.toFlatJSON(i)),...this.loops.flatMap(l=>l.toFlatJSON(i)),...this.searches.flatMap(l=>l.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(l=>l.toFlatGenerationTarget(i)),...this.functions.flatMap(l=>l.toFlatGenerationTarget(i)),...this.events.flatMap(l=>l.toFlatGenerationTarget(i)),...this.projects.flatMap(l=>l.toFlatGenerationTarget(i)),...this.variableDeclarations.flatMap(l=>l.toFlatGenerationTarget(i)),...this.variableInstances.flatMap(l=>l.toFlatGenerationTarget(i)),...this.conditions.flatMap(l=>l.toFlatGenerationTarget(i)),...this.operations.flatMap(l=>l.toFlatGenerationTarget(i)),...this.functionCalls.flatMap(l=>l.toFlatGenerationTarget(i)),...this.loops.flatMap(l=>l.toFlatGenerationTarget(i)),...this.searches.flatMap(l=>l.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(){const i=zde(),a=this.toJSON();return i.safeParse(a),this.validateChildren(),{success:!0,error:null,data:a}}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(l=>l.id===i.id);if(a>-1){const l=this.entities[a];return this.entities.splice(a,1),l}return null}removeCondition(i){const a=this.conditions.findIndex(l=>l.id===i.id);if(a>-1){const l=this.conditions[a];return this.conditions.splice(a,1),l}return null}removeOperation(i){const a=this.operations.findIndex(l=>l.id===i.id);if(a>-1){const l=this.operations[a];return this.operations.splice(a,1),l}return null}removeLoop(i){const a=this.loops.findIndex(l=>l.id===i.id);if(a>-1){const l=this.loops[a];return this.loops.splice(a,1),l}return null}removeSearch(i){const a=this.searches.findIndex(l=>l.id===i.id);if(a>-1){const l=this.searches[a];return this.searches.splice(a,1),l}return null}removeFunctionCall(i){const a=this.functionCalls.findIndex(l=>l.id===i.id);if(a>-1){const l=this.functionCalls[a];return this.functionCalls.splice(a,1),l}return null}removeVariableInstance(i){const a=this.variableInstances.findIndex(l=>l.id===i.id);if(a>-1){const l=this.variableInstances[a];return this.variableInstances.splice(a,1),l}return null}removeVariableDeclaration(i){const a=this.variableDeclarations.findIndex(l=>l.id===i.id);if(a>-1){const l=this.variableDeclarations[a];return this.variableDeclarations.splice(a,1),l}return null}removeFunctionDeclaration(i){const a=this.functions.findIndex(l=>l.id===i.id);if(a>-1){const l=this.functions[a];return this.functions.splice(a,1),l}return null}removeInstalledProject(i){const a=this.projects.findIndex(l=>l.id===i.id);if(a>-1){const l=this.projects[a];return this.projects.splice(a,1),l}return null}removeGlobalEvent(i){const a=this.events.findIndex(l=>l.id===i.id);if(a>-1){const l=this.events[a];return this.events.splice(a,1),l}return null}removeTopLevelVariableDeclaration(i){if(i.type!==f.VariableDeclaration)return null;const a=this.variableDeclarations.findIndex(l=>l.id===i.id);if(a>-1){const l=this.variableDeclarations[a];return this.variableDeclarations.splice(a,1),l}return null}getEntryPoints(){return[...this.functions,...this.events,...this.entities.flatMap(a=>a.methods)]}getTerminationStatements(){return[...this.getEntryPoints().reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.ReturnStatement||t.type===f.ContinueStatement||t.type===f.BreakStatement)]},[])]}getFunctionDeclaration(i){return this.functions.find(a=>a.id===i)||null}getConditions(){return[...this.conditions,...this.getEntryPoints().reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[]),...this.functionCalls.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[]),...this.operations.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[]),...this.loops.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[]),...this.searches.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[]),...this.functionCalls.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[]),...this.conditions.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[]),...this.loops.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[]),...this.searches.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[]),...this.conditions.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[]),...this.operations.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[]),...this.loops.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[]),...this.searches.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((a,l)=>{const p=zt(l);return[...a,...p]},[]),...this.functionCalls.reduce((a,l)=>{const p=zt(l);return[...a,...p]},[]),...this.conditions.reduce((a,l)=>{const p=zt(l);return[...a,...p]},[]),...this.operations.reduce((a,l)=>{const p=zt(l);return[...a,...p]},[]),...this.loops.reduce((a,l)=>{const p=zt(l);return[...a,...p]},[]),...this.searches.reduce((a,l)=>{const p=zt(l);return[...a,...p]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableInstance);return[...a,...t]},[]),...this.functionCalls.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableInstance);return[...a,...t]},[]),...this.conditions.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableInstance);return[...a,...t]},[]),...this.operations.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableInstance);return[...a,...t]},[]),...this.loops.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableInstance);return[...a,...t]},[]),...this.searches.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableInstance);return[...a,...t]},[])]}getVariableDeclarations(){return R([...this.variableDeclarations,...this.getEntryPoints().reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableDeclaration);return[...a,...t]},[]),...this.functionCalls.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableDeclaration);return[...a,...t]},[]),...this.conditions.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableDeclaration);return[...a,...t]},[]),...this.operations.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableDeclaration);return[...a,...t]},[]),...this.loops.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableDeclaration);return[...a,...t]},[]),...this.searches.reduce((a,l)=>{const t=zt(l).filter(y=>y.type===f.VariableDeclaration);return[...a,...t]},[])])}getLoops(){return[...this.loops,...this.getEntryPoints().reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[]),...this.functionCalls.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[]),...this.conditions.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[]),...this.operations.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[]),...this.searches.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[])]}getSearches(){return[...this.searches,...this.getEntryPoints().reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Search)]},[]),...this.functionCalls.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Search)]},[]),...this.conditions.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Search)]},[]),...this.operations.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Search)]},[]),...this.loops.reduce((a,l)=>{const p=ct(l);return[...a,...p.filter(t=>t.type===f.Search)]},[])]}attachOrphanReferences(){const i=this.getVariableInstances(),a=this.getVariableDeclarations();return i.forEach(l=>{if(!l.declaration){const p=l.initialData,t=p.declaration.entityId||p.declaration.id,y=a.find(v=>v.id===t);y&&l.setDeclaration(y)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(i=>i.name===Oe.PERSISTED_ENTITY)||null}requestActiveValue(i){var l;const a=(l=this.onRequestActiveValueCallback)==null?void 0:l.call(this,i);return a?a||null:i.getDefaultValue()}undo(){console.log("Undoing, from: ",this.undoableStackValueIndex),this.undoableStackValueIndex=this.undoableStackValueIndex-1,console.log("To: ",this.undoableStackValueIndex);const i=this.history[this.undoableStackValueIndex+1],a=this.history[this.undoableStackValueIndex];return console.log("Current change set: ",i),console.log("Change set to restore: ",a==null?void 0:a.toJSON()),WT(i||"initial",a||"initial",this)}redo(){console.log("Undoing, from: ",this.undoableStackValueIndex),this.undoableStackValueIndex=this.undoableStackValueIndex+1,console.log("To: ",this.undoableStackValueIndex);const i=this.history[this.undoableStackValueIndex-1],a=this.history[this.undoableStackValueIndex];return console.log("Current change set: ",i),console.log("Change set to restore: ",a.toJSON()),WT(i||"initial",a||"initial",this)}applyExternalChangeSet(i){const a=i.payload,l=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 t={...a.added,...a.updated,...a.removed},y=[...Object.keys(a.added),...Object.keys(a.updated),...Object.keys(a.removed)];y.forEach(b=>{var w;if(!t[b]){console.warn(`Entity '${b}' not found in change set transfer. Cannot apply changes.`);const A=(w=this.get(b))==null?void 0:w.toShallowJSON();throw A?console.warn("Entity in project: ",A):console.warn("Entity not in project"),new Error(`Entity '${b}' not found in change set transfer. Cannot apply changes.`)}});const v=new ca(p);return v.flatRecord=t,v.order=y,v.orderEntities(),console.log("All entities: ",v.order.map((b,w)=>`${w+1}: ${t[b].type} - ${b}`).join(`,
|
|
404
|
+
`)),console.log("Persisting new additions"),v.visit(async(b,w)=>{if(a.added[b.id]){console.log("Adding: ",b.id);try{const A=ee(b,this);if(A.hydrateAncestors(),A.addSelfToProject(l),l.add(A,K.Added),!this.get(b.id))throw new Error(`Entity ${b.id} was not added to the project`)}catch(A){console.error("Error: ",A),console.error("Errored entity: ",b)}}}),console.log("Persisting updates"),v.visit(async(b,w)=>{if(a.updated[b.id]){console.log("Updating: ",b.id);try{const A=this.get(b.id);A?(A.updateWithShallowTransfer(b,l),l.add(A,K.Updated)):console.warn(`Active version of ${b.id} not found when applying external changes`)}catch(A){console.error("Error: ",A),console.error("Errored entity: ",b)}}}),console.log("Persisting removals"),v.visit(async(b,w)=>{if(a.removed[b.id]){console.log("Removing: ",b.id);try{const A=this.get(b.id);A&&A.remove({ignoreUpstream:!1},l)}catch(A){console.error("Error: ",A),console.error("Errored entity: ",b)}}}),l}toFullProjectTransfer(){const i=new ca(this),a={};return i.visit(l=>{const p=l.toShallowJSON();a[l.id]=p}),{order:i.order,size:i.order.length,record:a}}};D(We,"_UUIDModule",uV),D(We,"sessionAuthor","1"),D(We,"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,...l)=>null}),D(We,"type",f.Project),D(We,"USER_MANAGED_PARENT_TYPES",[]),D(We,"PARENT_TYPES",[...We.USER_MANAGED_PARENT_TYPES]),D(We,"MUTABLE_BASE_PROPERTIES",["name","description"]),D(We,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),D(We,"BASE_PROPERTIES",[...We.MUTABLE_BASE_PROPERTIES,...We.INMUTABLE_BASE_PROPERTIES]),D(We,"MUTABLE_META_PROPERTIES",[...We.MUTABLE_BASE_PROPERTIES,"x","y"]),D(We,"INMUTABLE_META_PROPERTIES",[...We.INMUTABLE_BASE_PROPERTIES]),D(We,"META_PROPERTIES",[...We.MUTABLE_META_PROPERTIES,...We.INMUTABLE_META_PROPERTIES]),D(We,"MUTABLE_UPSTREAM_PROPERTIES",[]),D(We,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),D(We,"UPSTREAM_PROPERTIES",[...We.MUTABLE_UPSTREAM_PROPERTIES,...We.INMUTABLE_UPSTREAM_PROPERTIES]),D(We,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),D(We,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),D(We,"DOWNSTREAM_PROPERTIES",[...We.MUTABLE_DOWNSTREAM_PROPERTIES,...We.INMUTABLE_DOWNSTREAM_PROPERTIES]),D(We,"PROPERTIES",[...We.META_PROPERTIES,...We.UPSTREAM_PROPERTIES,...We.DOWNSTREAM_PROPERTIES]);let P=We;class YU extends Ut{constructor(i){super(Ks,i);D(this,"id",tr.Parallel);D(this,"name",tr.Parallel);D(this,"description","Programmatically execute a list of actions one after the other");D(this,"version","1");D(this,"autoexecutable",!0);D(this,"initialData",Ks);D(this,"type",f.ActionDescriptor);D(this,"inputs",[]);D(this,"outputs",[]);D(this,"error",null);D(this,"project");this.project=i,this.inputs=Ks.inputs.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.outputs=Ks.outputs.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.error=Ks.error?ee(Ks.error,this.project):null}}class zU extends Ut{constructor(i){super(Ri,i);D(this,"id",Ri.id);D(this,"name",Ri.name);D(this,"description",Ri.description);D(this,"version",Ri.version);D(this,"autoexecutable",!1);D(this,"initialData",Ri);D(this,"type",f.ActionDescriptor);D(this,"inputs",[]);D(this,"outputs",[]);D(this,"error",null);D(this,"project");this.project=i,this.inputs=Ri.inputs.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.outputs=Ri.outputs.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.error=Ri.error?ee(Ri.error,this.project):null}}class XU extends Ut{constructor(i){super(Hn,i);D(this,"id",tr.Sequential);D(this,"name",tr.Sequential);D(this,"description","Programmatically execute a list of actions one after the other");D(this,"version","1");D(this,"autoexecutable",!0);D(this,"initialData",Hn);D(this,"type",f.ActionDescriptor);D(this,"inputs",[]);D(this,"outputs",[]);D(this,"error",null);D(this,"project");this.project=i,this.inputs=Hn.inputs.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.outputs=Hn.outputs.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.error=Hn.error?ee(Hn.error,this.project):null}}class Gye extends Ut{constructor(u){super(vu,u)}}class Kye extends Ut{constructor(u){super(yo,u)}}class kye extends Ut{constructor(i){super(mo,i);D(this,"autoexecutable",!0)}getEntityToMatchInputMap(i){return i.inputs.find(a=>{var l;return((l=a.declaration)==null?void 0:l.id)===ve.operation[rr.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(i){return i.inputs.find(a=>{var l;return((l=a.declaration)==null?void 0:l.id)===ve.operation[rr.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(i){return i.outputs.find(a=>{var l;return((l=a.declaration)==null?void 0:l.id)===ve.operation[rr.Validate].outputs.outputEntity.id})||null}getEntityToMatch(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"get-entity-to-match-validate-data"))){const l=this.project.requestActiveValue(i),p=l==null?void 0:l.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,P.sessionAuthor,N().toISOString(),this,!0,"sync-operation-instance-validate-data"))){const l=[],p=[],t=[],y=[],v=this.getEntityToMatchInputMap(i);if(v){const{added:A,updated:V,removed:L,affected:U}=this.syncEntityToMatchInputMapDataType(v,a);l.push(...V),p.push(...A),t.push(...L),y.push(...U)}const b=this.getDataToValidateInputMap(i);if(b){const{added:A,updated:V,removed:L,affected:U}=this.syncDataToValidateInputMapDataType(b,a);l.push(...V),p.push(...A),t.push(...L),y.push(...U)}const w=this.getOutputDataOutputMap(i);if(w){const{added:A,updated:V,removed:L,affected:U}=this.syncOutputDataOutputMapDataType(w,a);l.push(...V),p.push(...A),t.push(...L),y.push(...U)}return a==null||a.attemptAutoclose("sync-operation-instance-validate-data",this.id),{updated:R(l),added:R(p),removed:R(t),affected:R(y),self:i}}syncEntityToMatchInputMapDataType(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-entity-to-match-input-map-data-type"))){var w,A,V,L,U,k,q,H,ie,te,pe,ne,me,J,ae;const l=[],p=[],t=[],y=[];if(((w=i.declaration)==null?void 0:w.id)!==ve.operation[rr.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=this.project.requestActiveValue(i),b=v==null?void 0:v.valueAsTypeSingle;if(!i.dataType){const ce={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,parentRelationType:null,options:((A=i.declaration.dataType)==null?void 0:A.options)||null,implementationChooseOne:((V=i.declaration.dataType)==null?void 0:V.implementationChooseOne)||!1,staticEntities:((L=i.declaration.dataType)==null?void 0:L.staticEntities)??null,interactiveEntities:((U=i.declaration.dataType)==null?void 0:U.interactiveEntities)??null,actionEntities:((k=i.declaration.dataType)==null?void 0:k.actionEntities)??null,isList:((q=i.declaration.dataType)==null?void 0:q.isList)||!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:(b==null?void 0:b.toJSON())||null,like:!0,inferred:!0,parent:i.toReference()},Y=ee(ce,i.project);Y.hydrateAncestors(),Y.setParent(i,a),Y.initChildren(a),Y.setEntity(b,a),a==null||a.add(Y,K.Added),l.push(Y),i.setDataType(Y,a)}return(J=i.dataType)==null||J.metaSync({inferred:!0,like:!1,asType:!0,options:((H=i.declaration.dataType)==null?void 0:H.options)||null,implementationChooseOne:((ie=i.declaration.dataType)==null?void 0:ie.implementationChooseOne)||!1,staticEntities:((te=i.declaration.dataType)==null?void 0:te.staticEntities)??null,interactiveEntities:((pe=i.declaration.dataType)==null?void 0:pe.interactiveEntities)??null,actionEntities:((ne=i.declaration.dataType)==null?void 0:ne.actionEntities)??null,isList:((me=i.declaration.dataType)==null?void 0:me.isList)||!1},a),(ae=i.dataType)==null||ae.setEntity(b,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(l),removed:R(t),affected:R(y),self:i.dataType}}syncDataToValidateInputMapDataType(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-data-to-validate-input-map-data-type"))){var A,V,L;const l=[],p=[],t=[],y=[];if(((A=i.declaration)==null?void 0:A.id)!==ve.operation[rr.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 U={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,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()},k=ee(U,i.project);k.setParent(i,a),k.initChildren(a),a==null||a.add(k,K.Added),l.push(k),i.setDataType(k,a)}(V=i.dataType)==null||V.metaSync({inferred:!0,like:!0,asType:!1},a);const w=this.getEntityToMatch(v,a);return(L=i.dataType)==null||L.setEntity(w,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(l),removed:R(t),affected:R(y),self:i.dataType}}syncOutputDataOutputMapDataType(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-output-data-output-map-data-type"))){var V,L,U;const l=[],p=[],t=[],y=[];if(((V=i.declaration)==null?void 0:V.id)!==ve.operation[rr.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 w=this.project.requestActiveValue(v),A=(w==null?void 0:w.valueAsTypeSingle)||null;if(!i.dataType){const k={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,staticEntities:null,interactiveEntities: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()},q=ee(k,i.project);q.hydrateAncestors(),q.setParent(i,a),q.initChildren(a),q.setEntity(A,a),a==null||a.add(q,K.Added),l.push(q),i.setDataType(q,a)}return(L=i.dataType)==null||L.metaSync({inferred:!0,like:!0,asType:!1},a),(U=i.dataType)==null||U.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(l),removed:R(t),affected:R(y),self:i.dataType}}inferInputMapDataType(i,a=this.project.addChangeSet(new G(this.project,P.sessionAuthor,N().toISOString(),this,!0,"infer-input-map-data-type-validate-data"))){var p,t,y;if(((p=i.declaration)==null?void 0:p.id)===ve.operation[rr.Validate].inputs.entityToMatch.id){const{added:v,updated:b,removed:w,affected:A}=this.syncEntityToMatchInputMapDataType(i,a);return a==null||a.attemptAutoclose("infer-input-map-data-type",this.id),{updated:R(b),added:R(v),removed:R(w),affected:R(A),self:i.dataType}}if(((t=i.declaration)==null?void 0:t.id)===ve.operation[rr.Validate].inputs.dataToValidate.id){const{added:v,updated:b,removed:w,affected:A}=this.syncDataToValidateInputMapDataType(i,a);return a==null||a.attemptAutoclose("infer-input-map-data-type",this.id),{updated:R(b),added:R(v),removed:R(w),affected:R(A),self:i.dataType}}const l=(y=i.declaration)==null?void 0:y.getDataType(a);if(l&&l.isResolved)return a==null||a.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:l};if(i.readsValue){const v=Ws(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,P.sessionAuthor,N().toISOString(),this,!0,"infer-output-map-data-type-validate-data"))){var l;if(((l=i.declaration)==null?void 0:l.id)===ve.operation[rr.Validate].outputs.outputEntity.id){const{added:p,updated:t,removed:y,affected:v}=this.syncOutputDataOutputMapDataType(i,a);return a==null||a.attemptAutoclose("infer-output-map-data-type-validate-data",this.id),{updated:R(t),added:R(p),removed:R(y),affected:R(v),self:i.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}}class qye extends Ut{constructor(u){super(q0,u)}}class Sye extends Ut{constructor(u){super(Z0,u)}}class Zye extends Ut{constructor(u){super(J0,u)}}class Jye extends Ut{constructor(u){super(Cf,u)}}class Wye extends Ut{constructor(u){super(_f,u)}}class Hye extends Ut{constructor(u){super(mu,u)}}function Yye(d){const u=[new XU(d),new YU(d),new zU(d),new Gye(d),new Kye(d),new kye(d),new Jye(d),new qye(d),new Zye(d),new Sye(d),new Wye(d),new Hye(d),new Ut(k0,d),new Ut(K0,d)];return u.forEach(i=>{i.initChildren(null),d.subscribeBuiltInInstance(i)}),d.operationDeclarations=u,u}class QU extends gn{constructor(i){super(si,i);D(this,"initialData");D(this,"id",Oe.PERSISTED_ENTITY);D(this,"version","1");D(this,"name",Oe.PERSISTED_ENTITY);D(this,"description",si.description);D(this,"type",f.BuiltInBaseEntity);D(this,"abstract",si.abstract);D(this,"static",si.static);D(this,"properties",[]);D(this,"methods",[]);D(this,"abstractMethods",[]);D(this,"extends",[]);D(this,"errors",[]);D(this,"project");this.initialData=si,this.project=i,this.id=si.id,this.version=si.version,this.name=si.name,this.static=si.static,this.abstract=si.abstract,this.properties=this.initialData.properties.map(a=>{const l=ee(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.methods=this.initialData.methods.map(a=>{const l=ee(a,this.project);return l.parent=this,l}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const l=ee(a,this.project);return l.parent=this,l}),this.extends=this.initialData.extends.map(a=>ee(a,this.project))}}var ex=(d=>(d.StatusCodeMustBeNumber="status-code-must-be-number",d.StatusCodeMustBeBetween100And599="status-code-must-be-between-100-and-599",d))(ex||{});function tx(d,u){const i=[];if(typeof u!="number"){const a=new St({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.`,issue:null,severity:Z.Error,code:"status-code-must-be-number",entity:d});return i.push(a),{errors:i,override:u}}if(u<100){const a=new St({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.`,issue:null,severity:Z.Error,code:"status-code-must-be-between-100-and-599",entity:d});i.push(a)}if(u>599){const a=new St({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.`,issue:null,severity:Z.Error,code:"status-code-must-be-between-100-and-599",entity:d});i.push(a)}return{errors:i,override:u}}class rx extends gn{constructor(i){super(Gi,i);D(this,"initialData");D(this,"id",Oe.PERSISTED_ENTITY);D(this,"version","1");D(this,"name",Oe.PERSISTED_ENTITY);D(this,"description",Gi.description);D(this,"type",f.BuiltInBaseEntity);D(this,"abstract",Gi.abstract);D(this,"static",Gi.static);D(this,"properties",[]);D(this,"methods",[]);D(this,"abstractMethods",[]);D(this,"extends",[]);D(this,"errors",[]);D(this,"project");this.initialData=Gi,this.project=i,this.id=Gi.id,this.version=Gi.version,this.name=Gi.name,this.static=Gi.static,this.abstract=Gi.abstract,this.properties=this.initialData.properties.map(t=>{const y=ee(t,this.project);return y.setParent(this,null),y.initChildren(null),y}),this.methods=this.initialData.methods.map(t=>{const y=ee(t,this.project);return y.parent=this,y}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const y=ee(t,this.project);return y.parent=this,y}),this.extends=this.initialData.extends.map(t=>ee(t,this.project));const a=this.properties.find(t=>t.id===ve["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=(t,y)=>Gj(t,y);const l=this.abstractMethods.find(t=>t.id===ve["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id);if(!l)throw new Error("Handler method not found in endpoint entity");const p=l.outputs.find(t=>t.id===ve["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=(t,y)=>tx(t,y)}}const zye="test_primitive_entities_export";class Xye extends gn{constructor(i){super(zr,i);D(this,"initialData");D(this,"id",Oe.PERSISTED_ENTITY);D(this,"version","1");D(this,"name",Oe.PERSISTED_ENTITY);D(this,"description",zr.description);D(this,"type",f.BuiltInBaseEntity);D(this,"abstract",zr.abstract);D(this,"static",zr.static);D(this,"properties",[]);D(this,"methods",[]);D(this,"abstractMethods",[]);D(this,"extends",[]);D(this,"errors",[]);D(this,"project");this.initialData=zr,this.project=i,this.id=zr.id,this.version=zr.version,this.name=zr.name,this.static=zr.static,this.abstract=zr.abstract,this.properties=this.initialData.properties.map(l=>{const p=ee(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.methods=this.initialData.methods.map(l=>{const p=ee(l,this.project);return p.parent=this,p}),this.abstractMethods=this.initialData.abstractMethods.map(l=>{const p=ee(l,this.project);return p.parent=this,p}),this.extends=this.initialData.extends.map(l=>ee(l,this.project));const a=this.properties.find(l=>l.id===ve["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=(l,p)=>Kj(l,p)}}function Qye(d){const u=[new QU(d),new rx(d),new Xye(d),new gn(Sf,d)];return u.forEach(i=>{d.subscribeBuiltInInstance(i)}),d.builtInBaseEntities=u,u}function eme(d){const u=[new Vi(qe,d),new Vi(Sn,d),new Vi(ut,d),new Vi(M0,d),new Vi(Yr,d),new Vi(Zn,d),new Vi(pn,d),new Vi(Jn,d),new Vi(wl,d)];return u.forEach(i=>{d.subscribeBuiltInInstance(i)}),d.primitives=u,u}function tme(d){const u=[new Ut(Jf,d)];return u.forEach(i=>{i.initChildren(null),d.subscribeBuiltInInstance(i)}),d.globalEventActionDescriptors=u,u}function rme(d){const u=[new Ut(Au,d),new Ut(Ia,d),new Ut(Tu,d),new Ut(gl,d),new Ut(Dl,d),new Ut(Mf,d)];u.forEach(a=>{a.initChildren(null),d.subscribeBuiltInInstance(a)}),d.loopDeclarations=u;const i=[new Ut(Ff,d),new Ut(bu,d),new Ut(Uf,d),new Ut(av,d),new Ut(lv,d),new Ut(jf,d)];return i.forEach(a=>{a.initChildren(null),d.subscribeBuiltInInstance(a)}),d.loopDeclarationsBodies=i,u}function ime(d){const u=[new zs(Wf,d),new zs(Ov,d)];return u.forEach(i=>{i.initChildren(null),d.subscribeBuiltInInstance(i)}),d.valueDescriptors=u,u}function sme(d){const u=[new Ut(Ao,d),new Ut(gv,d),new Ut(Vl,d)];return u.forEach(i=>{i.initChildren(null),d.subscribeBuiltInInstance(i)}),d.conditionDeclarations=u,u}const qo={},Ny={},wp={empty:!1,enrich:!0,mock:!1,ignoreCache:!1,onFetch:async()=>null,manuallyInit:!1};function ix(d,u={enrich:!0,shallowErrors:!1}){const i={enrich:!0,shallowErrors:!1,...u},{enrich:a,shallowErrors:l}=i,p=d.project,t=d.record,y=new ca(p),v=new Set;t[p.id]=p,v.add(p.id);const b=N().toISOString();Object.values(t).forEach(V=>{!V||y.allBuiltInEntityIds.includes(V.id)||v.add(V.id)}),y.order=Array.from(v),y.flatRecord=t,y.orderEntities();const w=Ly(d.project);w.instances[p.id]=w;const A=a?w.addChangeSet(new G(w,P.sessionAuthor,b,w,!0,"project-init-from-fetch-result")):null;return y.visit(V=>{if(V.id===w.id)return;const L=ee(V,w);try{L.hydrateAncestors(),L.addSelfToProject(null);const U=Ed(V);Object.keys(U.downstream).forEach(k=>{const q=w.get(k);q&&q.hydrateAncestors()})}catch(U){if(l)console.error("Error hydrating ancestors: ",U);else throw U}}),a?(y.visit(V=>{if(V.id===w.id)return;const L=w.get(V.id);L&&L.afterAllChildrenInitialized(A)}),w.afterAllChildrenInitialized(A)):By(w,b).forEach(L=>{L.remove({ignoreUpstream:!0},null)}),w.instancesList.forEach(V=>{V.previousVersion=null}),A==null||A.attemptAutoclose("project-init-from-fetch-result",w.id),w}async function nme(d,u=wp){const i={...wp,...u};if(i.empty)return{data:{project:{id:d.id,type:f.Project,version:P.UUID.uuid(),createdAt:N().toISOString(),author:P.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 l={...CE};return l.id=d.id,{data:{project:l,record:{}}}}return console.log("Fetching project from external API"),new Promise(async l=>{try{if(i.onFetch){const p=await i.onFetch(d.id);if(p){l({data:p});return}}else l({data:null})}catch(p){console.error("Error fetching project: ",p),l({data:null})}})}function Ly(d){const u=new P(d);return eme(u),Qye(u),Yye(u),tme(u),rme(u),ime(u),sme(u),Array.from(new Set([...u.getAllBuiltInIds(),...Os()])).forEach(a=>{if(!u.builtInInstances[a]&&u.instances[a])u.builtInInstances[a]=u.instances[a],delete u.instances[a];else if(!u.builtInInstances[a])throw new Error(`Built in entity was not properly initialized: ${a}`)}),u.instances[u.id]=u,u}function By(d,u){return d.instancesList.filter(a=>N(a.createdAt).isAfter(N(u)||!!a.previousVersion))}function ame(d,{enrich:u}={enrich:!0}){const i=new Map,a=new Map,l=Array.from(new Set([...d.getAllBuiltInIds(),...Os()]));Object.keys(d.instances).forEach(w=>{if(l.includes(w)){i.set(w,w),a.set(w,w);return}const A=d.get(w);if(!Py(A,{...d.instances,...d.builtInInstances}).every(k=>!l.includes(k))){i.set(w,w),a.set(w,w);return}const U=P.UUID.uuid();i.set(w,U),a.set(U,w)});const p=N().toISOString(),t=d.toShallowJSON({seenEntityMaps:i});t.previousVersion=null,t.createdAt=p,t.version=P.UUID.uuid();const y=Ly(t);y.instances[y.id]=y;const v=u?y.addChangeSet(new G(y,P.sessionAuthor,p,y,!0,"project-clone")):null,b=new ca(d);return b.visit(w=>{const A=w.toShallowJSON({seenEntityMaps:i});A.previousVersion=null,A.createdAt=p,A.version=P.UUID.uuid();const V=Ed(A,sU(b.flatRecord,i));if(Object.keys(V.upstream).length){let U=!1;if(Object.keys(V.upstream).forEach(k=>{if(!U&&(!y.get(k)||y.getDeleted(k))){U=!0;return}}),U)return}const L=ee(A,y);L.hydrateAncestors(),L.addSelfToProject(v),v==null||v.add(L,K.Added)}),u?(b.visit(w=>{if(w.id===y.id)return;const A=y.get(i.get(w.id));A&&A.afterAllChildrenInitialized(v)}),y.afterAllChildrenInitialized(v)):By(y,p).forEach(A=>{A.remove({ignoreUpstream:!0},null)}),y.instancesList.forEach(w=>{w.previousVersion=null}),v==null||v.attemptAutoclose("project-clone",y.id),y}function sx(d,{enrich:u}={enrich:!0}){const i=Ly(d),a=N().toISOString(),l=u?i.addChangeSet(new G(i,P.sessionAuthor,a,i,!0,"project-init")):null;l&&(l.type=JT.Automatic);const p=new ca(d);return p.visit(t=>{const y=ee(t,i);y.hydrateAncestors(),y.addSelfToProject(l)}),u?(p.visit(t=>{if(t.id===i.id)return;const y=i.get(t.id);y&&y.afterAllChildrenInitialized(l)}),i.afterAllChildrenInitialized(l)):(By(i,a).forEach(v=>{v.remove({ignoreUpstream:!0},null)}),new ca(i).visit(v=>{v.initialized=!0,v.captureVersion()})),i.initialized=!0,l==null||l.attemptAutoclose("project-init",i.id),i}async function ome(d,u=wp){const i={...wp,...u};if(d.id&&qo[d.id]&&!i.ignoreCache)return qo[d.id];if(d.id&&Ny[d.id]&&!i.ignoreCache)return await Ny[d.id],qo[d.id];const a=nme(d,i);d.id&&(Ny[d.id]=a);const l=await a;if(l.data){let p;return i.mock?p=sx(CE,{enrich:!!i.enrich}):l.data instanceof P?p=l.data:p=ix(l.data,{enrich:!!i.enrich}),qo[d.id]=p,d.id&&delete Ny[d.id],p}return null}function lme(d){return qo[d.id]&&delete qo[d.id],null}var Ae=(d=>(d.Inherited="inherited",d.DefaultValue="default-value",d.Missing="missing",d.Empty="empty",d.AutoCalculated="auto-calculated",d.QueuedAutocalculation="queued-autocalculation",d.External="external",d.Testing="testing",d.ExecutionResult="execution-result",d))(Ae||{});const nx={initialized:!1,id:"",project:null,values:{},onWriteCallback:()=>{},onRemoveCallback:()=>{},onWrite:()=>{},onRemove:()=>{},init:()=>{},toJSON:()=>({}),writeValue:()=>{},readValue:()=>null,removeValue:()=>{},clear:()=>{}};function dme(d,u){return{...nx,id:d,project:u}}class Rp{constructor(u,i){D(this,"initialized",!1);D(this,"id");D(this,"project");D(this,"values",{});D(this,"onWriteCallback",()=>{});D(this,"onRemoveCallback",()=>{});this.id=u,this.project=i,this.init()}onWrite(u){this.onWriteCallback=u}onRemove(u){this.onRemoveCallback=u}init(){if(!this.project.id||this.initialized)return;const u={},i={};Object.keys(u).forEach(a=>{const l=u[a],p=new Ei(l,this.project);try{if(l.parent){const v=this.project.findSubscribedInstanceFromReference(l.parent);if(!v)return;p.setParent(v,null),p.hydrateAncestors(),p.initChildren(null)}else if(l.standaloneParent){const v=this.project.findSubscribedInstanceFromReference(l.standaloneParent);if(!v)return;p.standalone=!0,p.setStandaloneParent(v),p.hydrateAncestors(),p.initChildren(null)}i[a]=p;const t=p.parent||p.standaloneParent,y=ox(p,t,this.project);y?i[a]=y:delete u[a]}catch(t){console.error("Error hydrating ancestors: ",t),delete u[a]}}),this.values={...this.values,...i},this.initialized=!0}toJSON(){const u={};return Object.keys(this.values).forEach(i=>{u[i]=this.values[i].toJSON()}),u}writeValue(u,i){if(!u)throw new Error("The value owner entity is required when writing a value to a value store");let l=this.values[u.id];if(!l)if(i instanceof Ei)l=i;else if(i)l=kt(i,this.project);else{const p={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:new Date().toISOString(),author:P.sessionAuthor,deleted:!1,previousVersion:null,value:null,type:f.LiteralValue,standaloneParent:u.toReference(),parent:null,valueAsTypeSingle:null,valueAsTypeList:null,autogeneration:null,name:Fo(u.getDataType(null))};l=kt(p,this.project)}l.standalone=!0,l.initialData.standaloneParent||console.warn("instance.initialData: ",l.initialData),l.setStandaloneParent(u),l.hydrateAncestors(),l.initChildren(null),i&&(l.metaSync({...i},null),l.setValueAsType(i.valueAsType,null)),this.values[u.id]=l,this.onWriteCallback(u,l)}readValue(u){return this.values[u]||null}removeValue(u){if(!this.values[u])return;delete this.values[u];const i=this.project.get(u);i&&this.onRemoveCallback(i)}clear(){this.values={}}}function So(d){var u;return!!(d.required||(u=d.declaration)!=null&&u.required)}function ax(d){return cB(d)||d===void 0||d===""}function Hb(d){return d?d.valueAsType?!1:ax(d.value):!0}function Qs(d,u,i,a){var y;let l;if(((y=d==null?void 0:d.entity)==null?void 0:y.type)===f.PrimitiveEntity)switch(d.entity.name){case X.EntityTemplate:l=X.EntityTemplate;break;case X.String:l=X.String;break;case X.Number:l=X.Number;break;case X.Boolean:l=X.Boolean;break;case X.Null:l=X.Null;break;case X.Enum:l=X.Enum;break;case X.KeyValue:l=X.KeyValue;break;case X.Untyped:l=X.Untyped;break;case X.KeyValue:l=X.KeyValue;break;case X.Date:l=X.Date;break;case X.UUID:l=X.UUID;break;case X.File:l=X.File;break;default:throw new Error(`Primitive type ${re(d.entity,i)} is not supported`)}else l=X.Untyped;const p=Ei.new();p.name=l,p.parent=u.toReference();const t=ee(p,i);return t.hydrateAncestors(),a==null||a.add(t,K.Added),t.addSelfToProject(a),t.initChildren(a),t}function en(d,u,i=new Set){var a;if(i.has(d.id))return[];if(i.add(d.id),d.type===f.ReturnDeclaration){const l=[d,...d.getCounterparts()];return console.log("Resolved counterparts for return declaration: ",`${d.name} ${d.id}`),console.log("equivalentReturnDeclarations: ",l.map(p=>`${p.name} ${p.id}`)),R([...l,...l.flatMap(p=>en(p,u,i))])}else if(rt.includes(d.type)){const l=di(d);return R([l,...[l].flatMap(p=>en(p,u,i))])}else if(d.type===f.OutputMap){if(rt.includes(d.parent.type)&&d.declaration.type===f.Property&&d.declaration.static)return R([d,d.declaration,...[d,d.declaration].flatMap(l=>en(l,u,i))])}else if(d.type===f.InputMap&&rt.includes(d.parent.type)&&((a=d.declaration)==null?void 0:a.type)===f.Property&&d.declaration.static)return R([d.declaration,...[d.declaration].flatMap(l=>en(l,u,i))]);return[d]}function ox(d,u,i){return d}function Id(d,u){const i=d.readsValue;let a=null;if((i==null?void 0:i.type)===f.VariableDeclaration){const p=gp(i,u);if(p&&p.value){const t={sources:[p],target:d};a={value:p.value,valueOwner:d,type:Ae.Inherited,inheritanceLink:t}}}else if((i==null?void 0:i.type)===f.VariableInstance){const p=jy(i,u);if(p&&p.value){const t={sources:[p],target:d};a={value:p.value,valueOwner:d,type:Ae.Inherited,inheritanceLink:t}}}else if((i==null?void 0:i.type)===f.OutputMap){const p=Qb(i,u);if(p&&p.value){const t={sources:[p],target:d};a={value:p.value,valueOwner:d,type:Ae.Inherited,inheritanceLink:t}}}else if((i==null?void 0:i.type)===f.ArgumentDeclaration){const p=zb(i,u);if(p){const t={sources:[p],target:d};a={value:p.value,valueOwner:d,type:Ae.Inherited,inheritanceLink:t}}}return a}function Ye(d,u,i){var t;if(!u)return null;let a;if(((t=d==null?void 0:d.entity)==null?void 0:t.type)===f.PrimitiveEntity)switch(d.entity.name){case X.EntityTemplate:a=X.EntityTemplate;break;case X.String:a=X.String;break;case X.Number:a=X.Number;break;case X.Boolean:a=X.Boolean;break;case X.Null:a=X.Null;break;case X.Enum:a=X.Enum;break;case X.KeyValue:a=X.KeyValue;break;case X.Untyped:a=X.Untyped;break;case X.KeyValue:a=X.KeyValue;break;case X.Date:a=X.Date;break;case X.UUID:a=X.UUID;break;case X.File:a=X.File;break;default:throw new Error(`Primitive type ${re(d.entity,i)} is not supported`)}else a=X.Untyped;const l=Ei.new();l.name=a,l.standaloneParent=u.toReference();let p=new Ei(l,i);return p.hydrateAncestors(),p.standalone=!0,p.setStandaloneParent(u),p.initChildren(null),p}function My(d,u,i){var p;const a={...d},l=u.inputs;if(!l)return a;for(const t of l){const y=tA(t,i);if(y&&y.value){const v=re(t,i.project),b=Zr(v);a[b]=(p=y==null?void 0:y.value)==null?void 0:p.value}}return a}function _p(d,u,i){var p;const a={...d},l=u.inputs;if(!l)return a;for(const t of l){const y=eA(t,i);if(y&&y.value){const v=re(t,i.project),b=Zr(v);a[b]=(p=y==null?void 0:y.value)==null?void 0:p.value}}return a}function lx(d,u){var y,v,b,w,A,V,L;let i={};if(((v=(y=d.dataType)==null?void 0:y.entity)==null?void 0:v.type)===f.DefinitionEntity&&(i={...i,...d.dataType.entity.getActiveRawDefaultValue()}),u.execution&&u.execution.hasEntity(d)){const U=(b=u.lastExecutionResults)==null?void 0:b.readValue(d.id);if(U){if(sr(U.value)){const q={...i,...U.value},H={..._p(q,d,u)};d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("1- newRawValue",H),U.metaSync({value:H},null)}return{value:U,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}}const a=!!((w=u.execution)!=null&&w.entities.length),l=(A=u.execution)==null?void 0:A.hasEntity(d),p=d.readsValue;let t=null;if(p){const U=(V=u.execution)==null?void 0:V.hasEntity(p);if((!a||a&&U&&l||a&&!U&&!l)&&(t=Id(d,u),t&&t.value&&sr(t.value.value))){const q={...i,...t.value.value},H={..._p(q,d,u)};d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("2- newRawValue",H),t.value.metaSync({value:H},null)}}if(!t&&d.defaultValue){const U=d.defaultValue;if(U.value===null&&U.autogeneration){const k=nh(U);if(U.metaSync({value:k},null),sr(k)){const q={..._p(k,d,u)};d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("3- newRawValue",q),U.metaSync({value:q},null)}}t={value:U,valueOwner:d,type:U.value===null?Ae.Empty:Ae.DefaultValue,inheritanceLink:null}}if(!t||t.type===Ae.DefaultValue){const U=(L=u.localTestValues)==null?void 0:L.readValue(d.id);if(U){if(sr(U.value)){const k={...i,...U.value},q={..._p(k,d,u)};d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("4- newRawValue",q),U.metaSync({value:q},null)}return{value:U,valueOwner:d,type:Ae.Testing,inheritanceLink:null}}}return t||{value:null,valueOwner:d,type:Ae.Empty,inheritanceLink:null}}function dx(d,u){var l,p,t,y,v;let i={};if(((p=(l=d.dataType)==null?void 0:l.entity)==null?void 0:p.type)===f.DefinitionEntity&&(i={...i,...d.dataType.entity.getActiveRawDefaultValue()},d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("initialDefaultValue",i)),u.execution&&u.execution.hasEntity(d)){const b=(t=u.lastExecutionResults)==null?void 0:t.readValue(d.id);if(b){if(sr(b.value)){const A={...i,...b.value};b.metaSync({value:{...My(A,d,u)}},null)}return{value:b,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}}const a=(y=u.localTestValues)==null?void 0:y.readValue(d.id);if(d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("testValue",a),a){if(sr(a.value)){const w={...i,...a.value};a.metaSync({value:{...My(w,d,u)}},null)}return{value:a,valueOwner:d,type:Ae.Testing,inheritanceLink:null}}if((v=d.dataType)!=null&&v.entity&&d.dataType.entity.type===f.DefinitionEntity&&d.dataType.isObject()){const b=Ye(d.dataType,d,u.project);return b==null||b.metaSync({value:My(i,d,u)},null),{value:b,valueOwner:d,type:Ae.DefaultValue,inheritanceLink:null}}return null}function gp(d,u){var y,v,b,w,A,V;if((y=d.dataType)!=null&&y.isObject())return lx(d,u);const i=cr(d),a=!!((v=u.execution)!=null&&v.entities.length),l=(b=u.execution)==null?void 0:b.hasEntity(i),p=d.readsValue;let t=null;if(p){const L=(w=u.execution)==null?void 0:w.hasEntity(p);(!a||a&&L&&l||a&&!L&&!l)&&(t=Id(d,u))}if(!t&&d.defaultValue){const L=d.defaultValue;if(L.value===null&&L.autogeneration){const U=nh(L);L.metaSync({value:U},null)}t={value:L,valueOwner:d,type:L.value===null?Ae.Empty:Ae.DefaultValue,inheritanceLink:null}}return(!t||t.type===Ae.DefaultValue)&&(A=u.localTestValues)!=null&&A.values[d.id]?{value:(V=u.localTestValues)==null?void 0:V.values[d.id],valueOwner:d,type:Ae.Testing,inheritanceLink:null}:t||{value:null,valueOwner:d,type:Ae.Empty,inheritanceLink:null}}function Yb(d,u){var a,l,p,t;if(d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("resolveVarDeclarationValue",d),(a=d.dataType)!=null&&a.isObject())return d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("current value is object"),dx(d,u);if(u.execution&&u.execution.hasEntity(d)){const y=(l=u.lastExecutionResults)==null?void 0:l.readValue(d.id);if(y)return{value:y,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}const i=(p=u.localTestValues)==null?void 0:p.readValue(d.id);if(i)return{value:i,valueOwner:d,type:Ae.Testing,inheritanceLink:null};if((t=d.dataType)!=null&&t.entity&&d.dataType.entity.type===f.DefinitionEntity&&d.dataType.isObject()){const y=Ye(d.dataType,d,u.project),v=d.dataType.entity.getActiveRawDefaultValue();return d.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("resolvedRawValue",v),y==null||y.metaSync({value:v},null),{value:y,valueOwner:d,type:Ae.DefaultValue,inheritanceLink:null}}return null}function jy(d,u){var b,w,A,V,L;d.id==="e749df9b-6b68-4baf-a3c5-59ca15c2492f"&&console.log("resolveVarInstanceNextValue");const i=!!((b=u.execution)!=null&&b.entities.length),a=(w=u.execution)==null?void 0:w.hasEntity(d);let l=null;const p=d.readsValue;if(p){const U=(A=u.execution)==null?void 0:A.hasEntity(p);(!i||i&&U&&a||i&&!U&&!a)&&(l=Id(d,u))}const t=d.declaration;if(!l&&t){d.id==="e749df9b-6b68-4baf-a3c5-59ca15c2492f"&&console.log("resolveVarInstanceNextValue resolveVarDeclarationNextValue");const U=gp(t,u);U&&U.value&&(l=U)}if((!l||l.type===Ae.DefaultValue)&&(V=u.localTestValues)!=null&&V.values[d.id])return{value:(L=u.localTestValues)==null?void 0:L.values[d.id],valueOwner:d,type:Ae.Testing,inheritanceLink:null};const y=So(d);return y&&a&&!l?{value:null,valueOwner:d,type:Ae.Missing,inheritanceLink:null}:a&&!y&&!l?{value:null,valueOwner:d,type:Ae.Empty,inheritanceLink:null}:l||{value:null,valueOwner:d,type:Ae.External,inheritanceLink:null}}function ux(d,u){return Yb(d.declaration,u)}function zb(d,u){var v,b,w,A,V;if(u.execution&&u.execution.hasEntity(d)){const L=(v=u.lastExecutionResults)==null?void 0:v.readValue(d.id);if(L)return{value:L,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}const i=cr(d),a=d.parent.type===f.FunctionDeclaration&&d.parent.parent.type===f.Loop?d.parent:null,l=!!((b=u.execution)!=null&&b.hasEntity(i))||!!a&&!!((w=u.execution)!=null&&w.hasEntity(a));let p=null;if(d.defaultValue){const L=d.defaultValue;if(L.value===null&&L.autogeneration){const U=nh(L);L.metaSync({value:U},null)}p={value:L,valueOwner:d,type:L.value===null?Ae.Empty:Ae.DefaultValue,inheritanceLink:null}}if((!p||p.type===Ae.DefaultValue)&&(A=u.localTestValues)!=null&&A.values[d.id])return{value:(V=u.localTestValues)==null?void 0:V.values[d.id],valueOwner:d,type:Ae.Testing,inheritanceLink:null};const t=So(d);let y=t&&l&&!p;return i.type===f.Loop&&l&&(y=!1),y?{value:null,valueOwner:d,type:Ae.Missing,inheritanceLink:null}:l&&!t&&!p?{value:null,valueOwner:d,type:Ae.Empty,inheritanceLink:null}:p||{value:null,valueOwner:d,type:Ae.External,inheritanceLink:null}}function Xb(d,u){var b,w,A,V,L,U;if(u.execution&&u.execution.hasEntity(d)){const k=(b=u.lastExecutionResults)==null?void 0:b.readValue(d.id);if(k)return{value:k,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}const i=cr(d),a=!!((w=u.execution)!=null&&w.entities.length),l=(A=u.execution)==null?void 0:A.hasEntity(i),p=d.readsValue;let t=null;if(p){const k=(V=u.execution)==null?void 0:V.hasEntity(p);(!a||a&&k&&l||a&&!k&&!l)&&(t=Id(d,u))}if(!t&&d.defaultValue&&(t={value:d.defaultValue,valueOwner:d,type:Ae.DefaultValue,inheritanceLink:null}),(!t||t.type===Ae.DefaultValue)&&(L=u.localTestValues)!=null&&L.values[d.id])return{value:(U=u.localTestValues)==null?void 0:U.values[d.id],valueOwner:d,type:Ae.Testing,inheritanceLink:null};const y=So(d);return y&&!t?{value:null,valueOwner:d,type:Ae.Missing,inheritanceLink:null}:!y&&!t?{value:null,valueOwner:d,type:Ae.Empty,inheritanceLink:null}:t}function Qb(d,u){var y,v,b,w,A;if(u.execution&&u.execution.hasEntity(d)){const V=(y=u.lastExecutionResults)==null?void 0:y.readValue(d.id);if(V)return{value:V,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}const i=cr(d);if(rt.includes(i.type)){const V=Ha(i,u),L=Zr(re(d,u.project));if(V!=null&&V.value&&sr(V.value.value)){const U=V.value.value[L],k=Ye(d.getDataType(null),d,u.project);return k==null||k.metaSync({value:U},null),{value:k,valueOwner:d,type:V.type,inheritanceLink:{sources:[V],target:d}}}return null}const a=(v=u.execution)==null?void 0:v.hasEntity(i),l=((b=u.execution)==null?void 0:b.state)===rA.Running;if((w=u.persistedExecutionResults)!=null&&w.values[d.id]&&!a&&!l){const V=(A=u.persistedExecutionResults)==null?void 0:A.readValue(d.id);if((V==null?void 0:V.value)!==null||V.valueAsType!==null)return{value:V,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}const p=d.getDefaultValue();if(p&&(p.value!==null||p.valueAsType!==null))return{value:p,valueOwner:d,type:Ae.DefaultValue,inheritanceLink:null};const t=d.parent;if(!t)throw new Error(`Couldn't find the parent that generates the output ${d.id}`);switch(t.type){case f.VariableInstance:{const L=jy(t,u);if(L&&L.value){const k=d.declaration;if(sr(L.value.value)){const q=L.value.value[k.name],H=Ye(d.declaration.dataType,d,u.project);return H==null||H.metaSync({value:q},null),{value:H,valueOwner:d,type:Ae.Inherited,inheritanceLink:{sources:[L],target:d}}}}const U=Ye(d.declaration.dataType,d,u.project);return U==null||U.metaSync({value:null},null),{value:U,valueOwner:d,type:Ae.Inherited,inheritanceLink:{sources:L?[L]:[],target:d}}}case f.VariableDeclaration:{const L=gp(t,u);if(L&&L.value){const k=d.declaration;if(sr(L.value.value)){const q=L.value.value[k.name],H=Ye(d.declaration.dataType,d,u.project);return H==null||H.metaSync({value:q},null),{value:H,valueOwner:d,type:Ae.Inherited,inheritanceLink:{sources:[L],target:d}}}}const U=Ye(d.declaration.dataType,d,u.project);return U==null||U.metaSync({value:null},null),{value:U,valueOwner:d,type:Ae.Inherited,inheritanceLink:{sources:L?[L]:[],target:d}}}case f.Operation:{const V=t.outputs.map(U=>{var q,H;if((q=u.persistedExecutionResults)!=null&&q.values[U.id]){const ie=(H=u.persistedExecutionResults)==null?void 0:H.values[U.id];if(ie.value!==null||ie.valueAsType!==null)return{value:ie,valueOwner:U,type:Ae.ExecutionResult,inheritanceLink:null}}const k=U.getDefaultValue();if(k&&(k.value!==null||k.valueAsType!==null))return{value:k,valueOwner:U,type:Ae.DefaultValue,inheritanceLink:null}}).filter(U=>!!U),L=Ye(d.declaration.dataType,d,u.project);return L==null||L.metaSync({value:null},null),{value:L,valueOwner:d,type:Ae.QueuedAutocalculation,inheritanceLink:V.length?{sources:V,target:d}:null}}case f.FunctionCall:{const V=t.inputs.map(U=>Dp(U,u)).filter(U=>!!U),L=Ye(d.declaration.dataType,d,u.project);return L==null||L.metaSync({value:null},null),{value:L,valueOwner:d,type:Ae.QueuedAutocalculation,inheritanceLink:V.length?{sources:V,target:d}:null}}case f.Loop:{const V=t.inputs.map(U=>Dp(U,u)).filter(U=>!!U),L=Ye(d.declaration.dataType,d,u.project);return L==null||L.metaSync({value:null},null),{value:L,valueOwner:d,type:Ae.QueuedAutocalculation,inheritanceLink:V.length?{sources:V,target:d}:null}}}return null}function cx(d,u){var y,v;if(!rt.includes(d.parent.type))return null;if(((y=d.declaration)==null?void 0:y.type)===f.Property&&d.declaration.static)return Ha(d.declaration,u);const i=di(d.parent),a=Uy(i,u),l=Zr(re(d,u.project)),p=Ye(d.getDataType(null),d,u.project),t=(v=a==null?void 0:a.value)==null?void 0:v.value;return t&&sr(t)?(p==null||p.metaSync({value:t[l]||null},null),{value:p,valueOwner:d,type:a.type,inheritanceLink:{sources:a?[a]:[],target:d}}):null}function px(d,u){var y,v;if(!rt.includes(d.parent.type))return null;if(((y=d.declaration)==null?void 0:y.type)===f.Property&&d.declaration.static)return Ha(d.declaration,u);const i=di(d.parent),a=Ha(i,u),l=Zr(re(d,u.project)),p=Ye(d.getDataType(null),d,u.project),t=(v=a==null?void 0:a.value)==null?void 0:v.value;return t&&sr(t)?(p==null||p.metaSync({value:t[l]||null},null),{value:p,valueOwner:d,type:a.type,inheritanceLink:{sources:[a],target:d}}):null}function eA(d,u){var b,w,A,V,L;const i=cr(d),a=!!((b=u.execution)!=null&&b.entities.length),l=(w=u.execution)==null?void 0:w.hasEntity(i),p=d.readsValue;let t=null;if(p){const U=(A=u.execution)==null?void 0:A.hasEntity(p);(!a||a&&U&&l||a&&!U&&!l)&&(d.id==="c1b53d2e-0916-48c6-a2fa-0d488af73a93"&&console.log("Here input-map is property of object -- resolving from writter"),t=Id(d,u),d.id==="c1b53d2e-0916-48c6-a2fa-0d488af73a93"&&console.log("Here input-map is property of object -- resolved from writter: ",t))}if(!t&&d.defaultValue){const U=d.defaultValue;U&&(t={value:U,valueOwner:d,type:Ae.DefaultValue,inheritanceLink:null})}if(!t&&d.declaration){const U=Ha(d.declaration,u);U&&U.value&&(t={...U,valueOwner:d,type:Ae.DefaultValue})}if((!t||t.type===Ae.DefaultValue||(t==null?void 0:t.type)===Ae.Empty)&&(V=u.localTestValues)!=null&&V.values[d.id])return{value:(L=u.localTestValues)==null?void 0:L.values[d.id],valueOwner:d,type:Ae.Testing,inheritanceLink:null};const y=So(d);return y&&!t||(t==null?void 0:t.type)===Ae.Empty?{value:null,valueOwner:d,type:Ae.Missing,inheritanceLink:(t==null?void 0:t.inheritanceLink)||null}:!y&&(!t||t.type===Ae.Inherited)&&!(t!=null&&t.inheritanceLink)?{value:null,valueOwner:d,type:Ae.Empty,inheritanceLink:null}:t}function tA(d,u){var a;if(u.execution&&u.execution.hasEntity(d)){const l=(a=u.lastExecutionResults)==null?void 0:a.readValue(d.id);if(l)return{value:l,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}return Dp(d,u)}function Dp(d,u){var i;return rt.includes(d.parent.type)&&(i=di(d.parent).dataType)!=null&&i.isObject()?cx(d,u):eA(d,u)}function fx(d,u){var i;return rt.includes(d.parent.type)&&(i=di(d.parent).dataType)!=null&&i.isObject()?px(d,u):tA(d,u)}function hx(d,u){var t,y,v;if(!d.static)return null;if(u.execution){const b=(t=u.lastExecutionResults)==null?void 0:t.readValue(d.id);if(b)return{value:b,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}if((y=u.localTestValues)!=null&&y.values[d.id])return{value:(v=u.localTestValues)==null?void 0:v.values[d.id],valueOwner:d,type:Ae.Testing,inheritanceLink:null};const i=d.getDefaultValue();let a=null;return i&&(a={value:i,valueOwner:d,type:Ae.DefaultValue,inheritanceLink:null}),So(d)&&Hb(a==null?void 0:a.value)?{value:null,valueOwner:d,type:Ae.Missing,inheritanceLink:null}:Hb(a==null?void 0:a.value)?{value:null,valueOwner:d,type:Ae.Empty,inheritanceLink:null}:a}function yx(d,u){var t,y,v,b,w,A,V;if(u.execution&&u.execution.hasEntity(d)){const L=(t=u.lastExecutionResults)==null?void 0:t.readValue(d.id);if(L)return{value:L,valueOwner:d,type:Ae.ExecutionResult,inheritanceLink:null}}if((y=u.localTestValues)!=null&&y.values[d.id])return{value:(v=u.localTestValues)==null?void 0:v.values[d.id],valueOwner:d,type:Ae.Testing,inheritanceLink:null};const i=d.getDefaultValue();let a=null;return i&&(a={value:i,valueOwner:d,type:Ae.DefaultValue,inheritanceLink:null}),So(d)&&!((b=a==null?void 0:a.value)!=null&&b.value)&&!((w=a==null?void 0:a.value)!=null&&w.valueAsType)?{value:null,valueOwner:d,type:Ae.Missing,inheritanceLink:null}:!((A=a==null?void 0:a.value)!=null&&A.value)&&!((V=a==null?void 0:a.value)!=null&&V.valueAsType)?{value:null,valueOwner:d,type:Ae.Empty,inheritanceLink:null}:a}function Ha(d,u){switch(d.type){case f.ArgumentDeclaration:return zb(d,u);case f.InputMap:return fx(d,u);case f.VariableDeclaration:return Yb(d,u);case f.VariableInstance:return ux(d,u);case f.OutputMap:return Qb(d,u);case f.ReturnDeclaration:return Xb(d,u);case f.Property:return hx(d,u);case f.ValueDescriptor:return yx(d,u);default:return null}}function Uy(d,u){switch(d.type){case f.InputMap:return Dp(d,u);case f.VariableDeclaration:return gp(d,u);case f.VariableInstance:return jy(d,u);case f.ReturnDeclaration:return Xb(d,u);default:return null}}function ume(d){var u;if(d&&d.type===Ae.DefaultValue&&d.value&&d.valueOwner&&((u=d.valueOwner.defaultValue)==null?void 0:u.id)===d.value.id){const i=Ye(d.valueOwner.getDataType(null),d.valueOwner,d.valueOwner.project);return{type:Ae.DefaultValue,value:i,valueOwner:d.valueOwner,inheritanceLink:null}}return d}function Zo(d,u,i,a){let l=!1,p=null,t=null;a instanceof G?(l=!0,p=a,t=null):(p=null,t=a);const y=d.parent;return u.getVariableDeclarations().forEach(b=>{var A,V,L,U;const w=b.getDataType(null);if(((A=w==null?void 0:w.entity)==null?void 0:A.id)===y.id){let k=l?b.defaultValue:t==null?void 0:t.readValue(b.id);k?!l&&k&&k.id===((V=b.defaultValue)==null?void 0:V.id)&&(k=Ye(b.getDataType(null),b,u)):l?k=Qs(b.getDataType(null),b,u,p):k=Ye(b.getDataType(null),b,u);const q=re(d,u),H=Zr(q);let ie={};((U=(L=b.dataType)==null?void 0:L.entity)==null?void 0:U.type)===f.DefinitionEntity&&(ie={...ie,...b.dataType.entity.getActiveRawDefaultValue()}),sr(k==null?void 0:k.value)&&(ie={...ie,...k.value}),ie[H]=i,k==null||k.metaSync({value:ie},p),l||t==null||t.writeValue(b,k);return}}),p}function Cp(d,u,i,a){var L,U,k;let l=!1,p=null,t=null;a instanceof G?(l=!0,p=a,t=null):(p=null,t=a);const y=di(d.parent),v=y.getDataType(null);if(!(v!=null&&v.isObject()))return p;let b=l?y.defaultValue:t==null?void 0:t.readValue(y.id);b?!l&&b&&b.id===((L=y.defaultValue)==null?void 0:L.id)&&(b=Ye(y.getDataType(null),y,u)):l?b=Qs(y.getDataType(null),y,u,p):b=Ye(y.getDataType(null),y,u);const w=re(d,u),A=Zr(w);let V={};if(((k=(U=y.dataType)==null?void 0:U.entity)==null?void 0:k.type)===f.DefinitionEntity&&(V={...V,...y.dataType.entity.getActiveRawDefaultValue()}),sr(b==null?void 0:b.value)&&(V={...V,...b==null?void 0:b.value}),V[A]=i,b==null||b.metaSync({value:V},p),l||t==null||t.writeValue(y,b),(i===""||i===null||i===void 0)&&d.type===f.OutputMap){const q=y.inputs.find(H=>{var ie;return((ie=H.declaration)==null?void 0:ie.id)===d.declaration.id||re(H,u)===w});if(q){let H=l?q.defaultValue:t==null?void 0:t.readValue(q.id);H&&H.metaSync({value:null},p),l||t==null||t.removeValue(q.id)}}return p}function mx(d,u,i){var t,y,v,b;let a=!1,l=null,p=null;if(i instanceof G?(a=!0,l=i,p=null):(l=null,p=i),rt.includes(d.type)){const w=di(d);(t=w.dataType)!=null&&t.isObject()&&w.inputs.forEach(A=>{var V,L,U,k;if(((V=A.declaration)==null?void 0:V.type)===f.Property&&A.declaration.static){let q=a?d.defaultValue:p==null?void 0:p.readValue(A.declaration.id);q?!a&&q&&q.id===((L=A.declaration.defaultValue)==null?void 0:L.id)&&(q=Ye(A.declaration.getDataType(null),A.declaration,u)):a?q=Qs(A.declaration.getDataType(null),A.declaration,u,l):q=Ye(A.declaration.getDataType(null),A.declaration,u),q==null||q.metaSync({value:null},l),a||p==null||p.removeValue((U=A.declaration)==null?void 0:U.id)}else if(((k=A.declaration)==null?void 0:k.type)===f.Property){let q=a?d.defaultValue:p==null?void 0:p.readValue(A.id);q&&q.metaSync({value:null},l),a||p==null||p.removeValue(A.id)}})}else d.type===f.InputMap?((y=d.declaration)==null?void 0:y.type)===f.Property&&d.declaration.static?Zo(d.declaration,u,null,i):rt.includes(d.parent.type)&&((v=d.declaration)==null?void 0:v.type)===f.Property&&Cp(d,u,null,i):d.type===f.OutputMap?((b=d.declaration)==null?void 0:b.type)===f.Property&&d.declaration.static?Zo(d.declaration,u,null,i):rt.includes(d.parent.type)&&d.declaration.type===f.Property&&Cp(d,u,null,i):d.type===f.Property&&d.static&&Zo(d,u,null,i);return l}function vx(d,u,i,a){var y,v,b,w,A,V;let l=!1,p=null,t=null;if(a instanceof G?(l=!0,p=a,t=null):(p=null,t=a),rt.includes(u.type)){const L=di(u);if((y=L.dataType)!=null&&y.isObject()){let U={};((b=(v=L.dataType)==null?void 0:v.entity)==null?void 0:b.type)===f.DefinitionEntity&&(U={...U,...L.dataType.entity.getActiveRawDefaultValue()});const k=sr(d)?d:U;L.inputs.forEach(q=>{var H,ie,te;if(((H=q.declaration)==null?void 0:H.type)===f.Property&&q.declaration.static){let pe=l?u.defaultValue:t==null?void 0:t.readValue(q.declaration.id);pe?!l&&pe&&pe.id===((ie=q.declaration.defaultValue)==null?void 0:ie.id)&&(pe=Ye(q.declaration.getDataType(null),q.declaration,i)):l?pe=Qs(q.declaration.getDataType(null),q.declaration,i,p):pe=Ye(q.declaration.getDataType(null),q.declaration,i);const ne=re(q,i),me=Zr(ne),J=k[me];pe==null||pe.metaSync({value:J},p),l||t==null||t.writeValue(q.declaration,pe)}else if(((te=q.declaration)==null?void 0:te.type)===f.Property){let pe=l?u.defaultValue:t==null?void 0:t.readValue(q.id);pe&&pe.metaSync({value:null},p),l||t==null||t.removeValue(q.id)}})}}else u.type===f.InputMap?((w=u.declaration)==null?void 0:w.type)===f.Property&&u.declaration.static?Zo(u.declaration,i,d,a):rt.includes(u.parent.type)&&((A=u.declaration)==null?void 0:A.type)===f.Property&&Cp(u,i,d,a):u.type===f.OutputMap?((V=u.declaration)==null?void 0:V.type)===f.Property&&u.declaration.static?Zo(u.declaration,i,null,a):rt.includes(u.parent.type)&&u.declaration.type===f.Property&&Cp(u,i,null,a):u.type===f.Property&&u.static&&Zo(u,i,d,a);return p}function Ex(d,u,i){const a=en(d,u);let l=!1,p=null,t=null;return i instanceof G?(l=!0,p=i,t=null):(p=null,t=i),a.forEach(y=>{var b;let v=l?y.defaultValue:t==null?void 0:t.readValue(y.id);v?!l&&v&&v.id===((b=y.defaultValue)==null?void 0:b.id)&&(v=Ye(d.getDataType(null),d,d.project)):l?v=Qs(y.getDataType(null),y,u,p):v=Ye(y.getDataType(null),y,u),v==null||v.metaSync({value:null},p),l||t==null||t.removeValue(y.id),mx(y,u,i)}),p}function cme(d,u,i,a){if(d===""||d===null||d===void 0)return Ex(u,i,a);const l=en(u,i);let p=!1,t=null,y=null;return a instanceof G?(p=!0,t=a,y=null):(t=null,y=a),l.forEach(v=>{var w;let b=p?u.defaultValue:y==null?void 0:y.readValue(u.id);b?!p&&b&&b.id===((w=v.defaultValue)==null?void 0:w.id)&&(b=Ye(v.getDataType(null),v,i)):p?b=Qs(v.getDataType(null),v,i,t):b=Ye(v.getDataType(null),v,i),b==null||b.metaSync({value:d},t),p||y==null||y.writeValue(v,b),vx(d,v,i,a)}),t}function Jo(d,u,i,a){let l=!1,p=null,t=null;a instanceof G?(l=!0,p=a,t=null):(p=null,t=a);const y=d.parent;return u.getVariableDeclarations().forEach(b=>{var A,V,L,U;const w=b.getDataType(null);if(((A=w==null?void 0:w.entity)==null?void 0:A.id)===y.id){let k=l?b.defaultValue:t==null?void 0:t.readValue(b.id);k?!l&&k&&k.id===((V=b.defaultValue)==null?void 0:V.id)&&(k=Ye(b.getDataType(null),b,u)):l?k=Qs(b.getDataType(null),b,u,p):k=Ye(b.getDataType(null),b,u);const q=re(d,u),H=Zr(q);let ie={};((U=(L=b.dataType)==null?void 0:L.entity)==null?void 0:U.type)===f.DefinitionEntity&&(ie={...ie,...b.dataType.entity.getActiveRawDefaultValue()}),sr(k==null?void 0:k.value)&&(ie={...ie,...k.value}),Array.isArray(i)?ie[H]=(i==null?void 0:i.map(te=>te.toShallowJSON()))||null:ie[H]=(i==null?void 0:i.toShallowJSON())||null,k==null||k.metaSync({value:ie},p),l||t==null||t.writeValue(b,k);return}}),p}function Op(d,u,i,a){var L,U,k;let l=!1,p=null,t=null;a instanceof G?(l=!0,p=a,t=null):(p=null,t=a);const y=di(d.parent),v=y.getDataType(null);if(!(v!=null&&v.isObject()))return p;let b=l?y.defaultValue:t==null?void 0:t.readValue(y.id);b?!l&&b&&b.id===((L=y.defaultValue)==null?void 0:L.id)&&(b=Ye(y.getDataType(null),y,u)):l?b=Qs(y.getDataType(null),y,u,p):b=Ye(y.getDataType(null),y,u);const w=re(d,u),A=Zr(w);let V={};if(((k=(U=y.dataType)==null?void 0:U.entity)==null?void 0:k.type)===f.DefinitionEntity&&(V={...V,...y.dataType.entity.getActiveRawDefaultValue()}),sr(b==null?void 0:b.value)&&(V={...V,...b.value}),Array.isArray(i)?V[A]=(i==null?void 0:i.map(q=>q.toShallowJSON()))||null:V[A]=(i==null?void 0:i.toShallowJSON())||null,b==null||b.metaSync({value:V},p),l||t==null||t.writeValue(y,b),i==null&&d.type===f.OutputMap){const q=y.inputs.find(H=>{var ie;return((ie=H.declaration)==null?void 0:ie.id)===d.declaration.id||re(H,u)===w});if(q){let H=l?q.defaultValue:t==null?void 0:t.readValue(q.id);H&&(Array.isArray(i)?H==null||H.setValueAsTypeList(i,p):H==null||H.setValueAsTypeSingle(i,p)),l||t==null||t.removeValue(q.id)}}return p}function Tx(d,u,i){var a,l,p;return d.type===f.InputMap?((a=d.declaration)==null?void 0:a.type)===f.Property&&d.declaration.static?Jo(d.declaration,u,null,i):rt.includes(d.parent.type)&&((l=d.declaration)==null?void 0:l.type)===f.Property&&Op(d,u,null,i):d.type===f.OutputMap?((p=d.declaration)==null?void 0:p.type)===f.Property&&d.declaration.static?Jo(d.declaration,u,null,i):rt.includes(d.parent.type)&&d.declaration.type===f.Property&&Op(d,u,null,i):d.type===f.Property&&d.static&&Jo(d,u,null,i),i}function bx(d,u,i,a){var l,p,t;return u.type===f.InputMap?((l=u.declaration)==null?void 0:l.type)===f.Property&&u.declaration.static?Jo(u.declaration,i,d,a):rt.includes(u.parent.type)&&((p=u.declaration)==null?void 0:p.type)===f.Property&&Op(u,i,d,a):u.type===f.OutputMap?((t=u.declaration)==null?void 0:t.type)===f.Property&&u.declaration.static?Jo(u.declaration,i,null,a):rt.includes(u.parent.type)&&u.declaration.type===f.Property&&Op(u,i,null,a):u.type===f.Property&&u.static&&Jo(u,i,d,a),a}function Ax(d,u,i){const a=en(d,u);let l=!1,p=null,t=null;return i instanceof G?(l=!0,p=i,t=null):(p=null,t=i),a.forEach(y=>{var b;let v=l?y.defaultValue:t==null?void 0:t.readValue(y.id);v?!l&&v&&v.id===((b=y.defaultValue)==null?void 0:b.id)&&(v=Ye(y.getDataType(null),y,y.project)):l?v=Qs(y.getDataType(null),y,u,p):v=Ye(y.getDataType(null),y,u),v==null||v.setValueAsTypeSingle(null,p),v==null||v.setValueAsTypeList(null,p),l||t==null||t.removeValue(y.id),Tx(y,u,i)}),p}function pme(d,u,i,a){if(d==null)return Ax(u,i,a);const l=en(u,i);let p=!1,t=null,y=null;return a instanceof G?(p=!0,t=a,y=null):(t=null,y=a),l.forEach(v=>{var w;let b=p?v.defaultValue:y==null?void 0:y.readValue(v.id);b?!p&&b&&b.id===((w=v.defaultValue)==null?void 0:w.id)&&(b=Ye(v.getDataType(null),v,v.project)):p?b=Qs(v.getDataType(null),v,i,t):b=Ye(v.getDataType(null),v,i),Array.isArray(d)?b==null||b.setValueAsTypeList(d,t):b==null||b.setValueAsTypeSingle(d,t),p||y==null||y.writeValue(v,b),bx(d,v,i,a)}),t}function Ix(d,u){return Zj(d).map(a=>Ha(a,u))}function fme(d,u){return d.reduce((a,l)=>{const p=Ix(l,u);return[...a,...p.filter(t=>(t==null?void 0:t.type)===Ae.Missing)]},[])}const Wo={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var rA=(d=>(d.FinishedSuccess="finished-success",d.FinishedError="finished-error",d.Running="running",d.Paused="paused",d.Stopped="stopped",d.NotStarted="not-started",d))(rA||{});const hs=class hs extends Wb{constructor(i,a,l,p=null){super();D(this,"project");D(this,"entryPoint");D(this,"state","not-started");D(this,"events",new Wb);D(this,"entities",[]);D(this,"parentExecution",null);D(this,"executing",[]);D(this,"executed",[]);D(this,"skipped",[]);D(this,"localTestValues");D(this,"resolvedValues");D(this,"persistedExecutionResults");D(this,"lastExecutionResults");D(this,"onAddToSkippedListCallback",null);D(this,"onRemoveFromSkippedListCallback",null);D(this,"onAddEntityCallback",null);D(this,"onRemoveEntityCallback",null);this.entities=a,this.entryPoint=l,this.project=i,this.parentExecution=p,this.localTestValues=new Rp(P.UUID.uuid(),this.project),this.resolvedValues=new Rp(P.UUID.uuid(),this.project),this.persistedExecutionResults=new Rp(P.UUID.uuid(),this.project),this.lastExecutionResults=new Rp(P.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults}}static injectSearchImplementation(i){hs.searchImplementation=i}mergeExernalValuesWithInternalInputs(i,a){const l=[];return[...Qt,...Ht].includes(a.type)?l.push(...a.inputs):ir.includes(a.type)&&l.push(...a.outputs),l.map(t=>{var v;let y=i.find(b=>b.valueOwner.id===t.id);if(y)return y;if(!y&&Ht.includes(a.type)&&(y=i.find(b=>{var w;return((w=b.valueOwner.declaration)==null?void 0:w.id)===t.id})),y){const b=(v=y.value)==null?void 0:v.clone(null);return b==null||b.setStandaloneParent(t),{...y,valueOwner:t,value:b||null,inheritanceLink:{sources:[y],target:t}}}return qn.includes(t.type)?Uy(t,this.valueResolutionContext):Ha(t,this.valueResolutionContext)}).reduce((t,y)=>{const v=en(y==null?void 0:y.valueOwner,this.project),b=y?[y]:[];return v.forEach(w=>{var L,U,k;if(w.id===(y==null?void 0:y.valueOwner.id))return;const A=Ye(w.getDataType(null),w,this.project);A==null||A.metaSync({value:(L=y==null?void 0:y.value)==null?void 0:L.value},null),A==null||A.setValueAsTypeList(((U=y==null?void 0:y.value)==null?void 0:U.valueAsTypeList)||null),A==null||A.setValueAsTypeSingle(((k=y==null?void 0:y.value)==null?void 0:k.valueAsTypeSingle)||null);const V={...y,valueOwner:w,value:A};b.push(V)}),[...t,...b]},[])}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}static async executeOperation(i,a,l){var p,t;try{let y={value:Se.Success,error:null,results:[]};a.sort((w,A)=>w.valueOwner.index-A.valueOwner.index),i.declaration.implementation&&(y=await i.declaration.implementation(...a.map(w=>{var A,V;return((A=w==null?void 0:w.value)==null?void 0:A.valueAsType)||((V=w==null?void 0:w.value)==null?void 0:V.value)})));const v=i.outputs.map((w,A)=>{const V=w==null?void 0:w.getDataType(null),L=Ye(V,w,l);return V!=null&&V.asType?L==null||L.setValueAsTypeSingle(y.results[A]):L==null||L.metaSync({value:y.results[A]},null),{valueOwner:w,type:Ae.ExecutionResult,inheritanceLink:null,value:L}});let b=null;if(y.error&&i.error){console.warn("Raw error executing entity: ",y.error);const w=((p=i.error)==null?void 0:p.getDataType(null))||null,A=Ye(w,i.error,l);w!=null&&w.asType?A==null||A.setValueAsTypeSingle(y.error):A==null||A.metaSync({value:y.error},null),b={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:A}}return{value:y.value,entity:i,error:b,results:v}}catch(y){console.warn("Operation execution error: ",y);let v=null;if(i.error){const b=(t=i.error)==null?void 0:t.getDataType(null),w=Ye(b,i.error,l);b!=null&&b.asType?w==null||w.setValueAsTypeSingle(y):w==null||w.metaSync({value:y},null),v={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:w}}return{value:Se.Error,entity:i,error:v,results:[]}}}async executeSearch(i,a,l){var p;console.log("executeSearch");try{let t={value:Se.Success,error:null,results:[]};const y=i.outputs[0];if(!y)return{value:Se.Success,entity:i,error:null,results:[]};let v={value:null,valueOwner:y,type:Ae.ExecutionResult,inheritanceLink:null};const b=await hs.searchImplementation(i,a),w=y==null?void 0:y.getDataType(null),A=Ye(w,y,l);return A==null||A.metaSync({value:b.data},null),v.value=A,{value:t.value,entity:i,error:null,results:[v]}}catch(t){if(console.warn(`Search node execution error: ${t}`),!i.error)return{value:Se.Error,entity:i,error:null,results:[]};const y=(p=i.error)==null?void 0:p.getDataType(null),v=Ye(y,i.error,l);return v==null||v.metaSync({value:t},null),{value:Se.Error,entity:i,error:{valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:v},results:[]}}}async executeLoop(i,a,l,p={}){var y,v;const t={...Wo,...p};try{let b={value:Se.Success,error:null,results:[]};const w=a.map(q=>{var H,ie;return((H=q==null?void 0:q.value)==null?void 0:H.valueAsType)||((ie=q==null?void 0:q.value)==null?void 0:ie.value)});let A={};i.getUniqueReturnDeclarations().forEach(q=>{const H=i.body.inputs.find(ne=>re(ne,l)===Ti.fromReturnDeclarationToBodyArgumentDeclarationName(q)),ie=q==null?void 0:q.getDataType(null),te=Ye(ie,H,l);ie!=null&&ie.asType?te==null||te.setValueAsTypeList([]):te==null||te.metaSync({value:[]},null),this.lastExecutionResults.writeValue(H,te);const pe={value:te,valueOwner:H,type:Ae.ExecutionResult,inheritanceLink:null};A[H.id]=pe});let L={value:Se.Success,entity:i.body,error:null,results:[]};switch(console.log("aggregateListResults: ",A),i.declaration.id){case ve.loop["counted-loop"].id:{const q=w[0];console.log("maxCount",q);let H=1;for(console.log("currentIteration",H);H<=q&&H<=50;){console.log("iterating",H);const ie=i.body.inputs.map(pe=>{if(pe===i.currentIterationNumberArgumentDeclaration){console.log("Argument is body iteration number");const ne=i.currentIterationNumberArgumentDeclaration.getDataType(null),me=Fo(ne),J=this.lastExecutionResults.readValue(pe.id);if(J){J.metaSync({value:H},null),console.log("existingValue",H),this.lastExecutionResults.writeValue(pe,J);const de={value:J,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null};return A[pe.id]=de,de}const ae={id:P.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:P.UUID.uuid(),createdAt:new Date().toISOString(),author:P.sessionAuthor,deleted:!1,previousVersion:null,value:H,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:me,standaloneParent:pe.toReference()},ce=kt(ae,l);this.lastExecutionResults.writeValue(pe,ce);const Y={value:ce,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null};return console.log("newDynamicValue",H),A[pe.id]=Y,Y}else return A[pe.id]}).filter(pe=>!!pe);console.log("Loop executes body with inputs: ",ie);const te=await this.executeFullFunctionDeclarationLogic(i.body,ie,t);if(L=te,L.results.forEach(pe=>{var ae,ce,Y,de;if(pe.valueOwner.type!==f.ReturnDeclaration)return;const ne=i.body.inputs.find(Ee=>re(Ee,l)===Ti.fromReturnDeclarationToBodyArgumentDeclarationName(pe.valueOwner)),J=[...((ce=(ae=A==null?void 0:A[ne.id])==null?void 0:ae.value)==null?void 0:ce.value)||[],((Y=pe==null?void 0:pe.value)==null?void 0:Y.value)||null];(de=A[ne.id].value)==null||de.metaSync({value:J},null),this.lastExecutionResults.writeValue(ne,A[ne.id].value)}),[Se.Error,Se.Break,Se.Return].includes(te.value))break;console.log("Loop iteration finished"),H++}break}case ve.loop["manual-flow-loop"].id:{let q=1;for(;q<=50;){const H=i.body.inputs.map(te=>{if(te===i.currentIterationNumberArgumentDeclaration){const pe=this.lastExecutionResults.readValue(te.id);if(pe){pe.metaSync({value:q},null),this.lastExecutionResults.writeValue(te,pe);const ae={value:pe,valueOwner:te,type:Ae.ExecutionResult,inheritanceLink:null};return A[te.id]=ae,ae}const ne=i.currentIterationNumberArgumentDeclaration.getDataType(null),me=Ye(ne,te,l);me==null||me.metaSync({value:q},null),this.lastExecutionResults.writeValue(te,me);const J={value:me,valueOwner:te,type:Ae.ExecutionResult,inheritanceLink:null};return console.log("newDynamicValue",q),J}else return A[te.id]}).filter(te=>!!te);console.log("Loop executes body");const ie=await this.executeFullFunctionDeclarationLogic(i.body,H,t);if(L=ie,L.results.forEach(te=>{var J,ae,ce;if(te.valueOwner.type!==f.ReturnDeclaration)return;const pe=i.body.inputs.find(Y=>re(Y,l)===Ti.fromReturnDeclarationToBodyArgumentDeclarationName(te.valueOwner)),me=[...(J=A[pe.id].value)==null?void 0:J.value,((ae=te.value)==null?void 0:ae.value)||null];(ce=A[pe.id].value)==null||ce.metaSync({value:me},null),this.lastExecutionResults.writeValue(pe,A[pe.id].value)}),[Se.Error,Se.Break,Se.Return].includes(ie.value))break;q++}break}case ve.loop["list-loop"].id:{const q=w[0];let H=1;const ie=q;for(let te=0;te<ie.length;te++){const pe=ie[te],ne=i.body.inputs.map(J=>{if(J===i.currentIterationNumberArgumentDeclaration){const ae=this.lastExecutionResults.readValue(J.id);if(ae)return ae.metaSync({value:H},null),this.lastExecutionResults.writeValue(J,ae),{value:ae,valueOwner:J,type:Ae.ExecutionResult,inheritanceLink:null};const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),Y=Ye(ce,J,l);return Y==null||Y.metaSync({value:H},null),this.lastExecutionResults.writeValue(J,Y),{value:Y,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(J===i.currentValueArgumentDeclaration){const ae=i.currentValueArgumentDeclaration.getDataType(null),ce=Fo(ae),Y=this.lastExecutionResults.readValue(J.id);if(Y)return Y.metaSync({value:pe},null),this.lastExecutionResults.writeValue(J,Y),{value:Y,valueOwner:J,type:Ae.ExecutionResult,inheritanceLink:null};const de={id:P.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:P.UUID.uuid(),createdAt:new Date().toISOString(),author:P.sessionAuthor,deleted:!1,previousVersion:null,value:pe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:J.toReference()},Ee=kt(de,l);return this.lastExecutionResults.writeValue(J,Ee),{value:Ee,valueOwner:i.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[J.id]}).filter(J=>!!J);console.log("Loop executes body");const me=await this.executeFullFunctionDeclarationLogic(i.body,ne,t);if(L=me,L.results.forEach(J=>{var de,Ee,Pe;if(J.valueOwner.type!==f.ReturnDeclaration)return;const ae=i.body.inputs.find(Ce=>re(Ce,l)===Ti.fromReturnDeclarationToBodyArgumentDeclarationName(J.valueOwner)),Y=[...(de=A[ae.id].value)==null?void 0:de.value,((Ee=J.value)==null?void 0:Ee.value)||null];(Pe=A[ae.id].value)==null||Pe.metaSync({value:Y},null),this.lastExecutionResults.writeValue(ae,A[ae.id].value)}),[Se.Error,Se.Break,Se.Return].includes(me.value))break;H++}break}case ve.loop["object-keys-loop"].id:{const q=w[0];let H=1;const ie=q?Object.keys(q):[];console.log("iterableListOfValues: ",ie);for(let te=0;te<ie.length;te++){const pe=ie[te],ne=i.body.inputs.map(J=>{if(J===i.currentIterationNumberArgumentDeclaration){const ae=this.lastExecutionResults.readValue(J.id);if(ae)return ae.metaSync({value:H},null),this.lastExecutionResults.writeValue(J,ae),{value:ae,valueOwner:J,type:Ae.ExecutionResult,inheritanceLink:null};const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),Y=Ye(ce,J,l);return Y==null||Y.metaSync({value:H},null),this.lastExecutionResults.writeValue(J,Y),{value:Y,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(J===i.currentValueArgumentDeclaration){const ae=i.currentValueArgumentDeclaration.getDataType(null),ce=Fo(ae),Y=this.lastExecutionResults.readValue(J.id);if(Y)return Y.metaSync({value:pe},null),this.lastExecutionResults.writeValue(J,Y),{value:Y,valueOwner:J,type:Ae.ExecutionResult,inheritanceLink:null};const de={id:P.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:P.UUID.uuid(),createdAt:new Date().toISOString(),author:P.sessionAuthor,deleted:!1,previousVersion:null,value:pe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:J.toReference()},Ee=kt(de,l);return this.lastExecutionResults.writeValue(J,Ee),{value:Ee,valueOwner:i.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[J.id]}).filter(J=>!!J);console.log("Loop executes body");const me=await this.executeFullFunctionDeclarationLogic(i.body,ne,t);if(L=me,L.results.forEach(J=>{var de,Ee,Pe;if(J.valueOwner.type!==f.ReturnDeclaration)return;const ae=i.body.inputs.find(Ce=>re(Ce,l)===Ti.fromReturnDeclarationToBodyArgumentDeclarationName(J.valueOwner)),Y=[...(de=A[ae.id].value)==null?void 0:de.value,((Ee=J.value)==null?void 0:Ee.value)||null];(Pe=A[ae.id].value)==null||Pe.metaSync({value:Y},null),this.lastExecutionResults.writeValue(ae,A[ae.id].value)}),[Se.Error,Se.Break,Se.Return].includes(me.value))break;H++}break}case ve.loop["object-values-loop"].id:{const q=w[0];let H=1;const ie=q?Object.values(q):[];for(let te=0;te<ie.length;te++){const pe=ie[te],ne=i.body.inputs.map(J=>{if(J===i.currentIterationNumberArgumentDeclaration){const ae=this.lastExecutionResults.readValue(J.id);if(ae)return ae.metaSync({value:H},null),this.lastExecutionResults.writeValue(J,ae),{value:ae,valueOwner:J,type:Ae.ExecutionResult,inheritanceLink:null};const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),Y=Ye(ce,J,l);return Y==null||Y.metaSync({value:H},null),this.lastExecutionResults.writeValue(J,Y),{value:Y,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(J===i.currentValueArgumentDeclaration){const ae=i.currentValueArgumentDeclaration.getDataType(null),ce=Fo(ae),Y=this.lastExecutionResults.readValue(J.id);if(Y)return Y.metaSync({value:pe},null),this.lastExecutionResults.writeValue(J,Y),{value:Y,valueOwner:J,type:Ae.ExecutionResult,inheritanceLink:null};const de={id:P.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:P.UUID.uuid(),createdAt:new Date().toISOString(),author:P.sessionAuthor,deleted:!1,previousVersion:null,value:pe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:J.toReference()},Ee=kt(de,l);return this.lastExecutionResults.writeValue(J,Ee),{value:Ee,valueOwner:i.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[J.id]}).filter(J=>!!J);console.log("Loop executes body"),console.log("HEREEE Object.values() resolvedBodyInputsForCurrentIteration",ne);const me=await this.executeFullFunctionDeclarationLogic(i.body,ne,t);if(L=me,L.results.forEach(J=>{var de,Ee,Pe;if(J.valueOwner.type!==f.ReturnDeclaration)return;const ae=i.body.inputs.find(Ce=>re(Ce,l)===Ti.fromReturnDeclarationToBodyArgumentDeclarationName(J.valueOwner)),Y=[...(de=A[ae.id].value)==null?void 0:de.value,((Ee=J.value)==null?void 0:Ee.value)||null];(Pe=A[ae.id].value)==null||Pe.metaSync({value:Y},null),this.lastExecutionResults.writeValue(ae,A[ae.id].value)}),[Se.Error,Se.Break,Se.Return].includes(me.value))break;H++}break}case ve.loop["string-loop"].id:{const q=w[0];let H=1;const ie=q.split("");for(let te=0;te<ie.length;te++){const pe=ie[te],ne=i.body.inputs.map(J=>{if(J===i.currentIterationNumberArgumentDeclaration){const ae=this.lastExecutionResults.readValue(J.id);if(ae)return ae.metaSync({value:H},null),this.lastExecutionResults.writeValue(J,ae),{value:ae,valueOwner:J,type:Ae.ExecutionResult,inheritanceLink:null};const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),Y=Ye(ce,J,l);return Y==null||Y.metaSync({value:H},null),this.lastExecutionResults.writeValue(J,Y),{value:Y,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else if(J===i.currentValueArgumentDeclaration){const ae=i.currentValueArgumentDeclaration.getDataType(null),ce=Fo(ae),Y=this.lastExecutionResults.readValue(J.id);if(Y)return Y.metaSync({value:pe},null),this.lastExecutionResults.writeValue(J,Y),{value:Y,valueOwner:J,type:Ae.ExecutionResult,inheritanceLink:null};const de={id:P.UUID.uuid(),type:f.LiteralValue,autogeneration:null,version:P.UUID.uuid(),createdAt:new Date().toISOString(),author:P.sessionAuthor,deleted:!1,previousVersion:null,value:pe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ce,standaloneParent:J.toReference()},Ee=kt(de,l);return this.lastExecutionResults.writeValue(J,Ee),{value:Ee,valueOwner:i.currentValueArgumentDeclaration,type:Ae.ExecutionResult,inheritanceLink:null}}else return A[J.id]}).filter(J=>!!J);console.log("Loop executes body");const me=await this.executeFullFunctionDeclarationLogic(i.body,ne,t);if(L=me,L.results.forEach(J=>{var de,Ee,Pe;if(J.valueOwner.type!==f.ReturnDeclaration)return;const ae=i.body.inputs.find(Ce=>re(Ce,l)===Ti.fromReturnDeclarationToBodyArgumentDeclarationName(J.valueOwner)),Y=[...(de=A[ae.id].value)==null?void 0:de.value,((Ee=J.value)==null?void 0:Ee.value)||null];(Pe=A[ae.id].value)==null||Pe.metaSync({value:Y},null),this.lastExecutionResults.writeValue(ae,A[ae.id].value)}),[Se.Error,Se.Break,Se.Return].includes(me.value))break;H++}break}}let U=[];i.body.inputs.forEach(q=>{var ie;const H=A[q.id];if(H){const te=(ie=H.value)==null?void 0:ie.clone(null),pe=i.outputs.find(ne=>ne.declaration&&Ti.fromLoopOutputDeclarationToBodyArgumentDeclarationName(ne.declaration)===re(q,l));if(!pe)return;U.push({valueOwner:pe,type:Ae.ExecutionResult,inheritanceLink:null,value:te})}}),b={value:[Se.Error,Se.Return].includes(L.value)?L.value:Se.Success,error:null,results:U};let k=null;if(b.error&&i.error){console.warn("Raw error executing entity: ",b.error);const q=(y=i.error)==null?void 0:y.getDataType(null),H=Ye(q||null,i.error,l);q!=null&&q.asType?H==null||H.setValueAsTypeSingle(b.error):H==null||H.metaSync({value:b.error},null),k={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:H}}return{value:b.value,entity:i,error:k,results:b.results}}catch(b){if(console.warn("Error executing loop: ",b),i.error){const w=(v=i.error)==null?void 0:v.getDataType(null),A=Ye(w,i.error,l);return w!=null&&w.asType?A==null||A.setValueAsTypeSingle(b):A==null||A.metaSync({value:b},null),{value:Se.Error,entity:i,error:{valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:A},results:[]}}else return{value:Se.Error,entity:i,error:null,results:[]}}}async executeFunctionCall(i,a,l,p={}){var y,v;const t={...Wo,...p};try{let b={value:Se.Success,error:null,results:[]};console.log("executeFunctionCall",a),b=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,a,l,t);const w=i.outputs.map(V=>{var H,ie,te,pe;const L=[...V.declaration.getCounterparts(),V.declaration];console.log("declarations",L);const U=b.results.find(ne=>L.some(J=>ne.valueOwner.id===J.id));console.log("resultValue",U);const k=V==null?void 0:V.getDataType(null),q=Ye(k,V,l);return k!=null&&k.asType?Array.isArray((H=U==null?void 0:U.value)==null?void 0:H.valueAsType)?q==null||q.setValueAsTypeList((ie=U==null?void 0:U.value)==null?void 0:ie.valueAsTypeList):q==null||q.setValueAsTypeSingle(((te=U==null?void 0:U.value)==null?void 0:te.valueAsType)||null):q==null||q.metaSync({value:(pe=U==null?void 0:U.value)==null?void 0:pe.value},null),{valueOwner:V,type:Ae.ExecutionResult,inheritanceLink:null,value:q}});let A=null;if(b.error&&i.error){console.warn("Raw error executing entity: ",b.error);const V=(y=i.error)==null?void 0:y.getDataType(null),L=Ye(V||null,i.error,l);V!=null&&V.asType?L==null||L.setValueAsTypeSingle(b.error):L==null||L.metaSync({value:b.error},null),A={valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:L}}return{value:b.value,entity:i,error:A,results:w}}catch(b){if(console.log("error: ",b),!i.error)return{value:Se.Error,entity:i,error:null,results:[]};const w=(v=i.error)==null?void 0:v.getDataType(null),A=Ye(w,i.error,l);return w!=null&&w.asType?A==null||A.setValueAsTypeSingle(b):A==null||A.metaSync({value:b},null),{value:Se.Error,entity:i,error:{valueOwner:i.error,type:Ae.ExecutionResult,inheritanceLink:null,value:A},results:[]}}}static async executeCondition(i,a){var p,t,y,v,b,w,A,V,L,U,k,q,H,ie,te,pe,ne,me,J,ae,ce,Y,de,Ee,Pe,Ce,Ie,_e,Me,$e,ze,at,Zt,nr,br,Mr;let l=!1;switch(i.declaration.id){case Lr.Empty:{l=!!((t=(p=a[0])==null?void 0:p.value)!=null&&t.value);break}case Lr.NotEmpty:{l=!((v=(y=a[0])==null?void 0:y.value)!=null&&v.value);break}case dr.Equal:{if([X.String,X.Number,X.Boolean,X.Null,X.Enum,X.Date,X.UUID].includes((w=(b=a[0])==null?void 0:b.value)==null?void 0:w.name)){l=((V=(A=a[0])==null?void 0:A.value)==null?void 0:V.value)===((U=(L=a[1])==null?void 0:L.value)==null?void 0:U.value);break}if(((q=(k=a[0])==null?void 0:k.value)==null?void 0:q.name)===X.KeyValue||((ie=(H=a[0])==null?void 0:H.value)==null?void 0:ie.name)===X.Untyped){const Fr=(pe=(te=a[0])==null?void 0:te.value)==null?void 0:pe.value,Ni=(me=(ne=a[1])==null?void 0:ne.value)==null?void 0:me.value;l=JSON.stringify(Fr)===JSON.stringify(Ni);break}break}case dr.NotEqual:{if([X.String,X.Number,X.Boolean,X.Null,X.Enum,X.Date,X.UUID].includes((ae=(J=a[0])==null?void 0:J.value)==null?void 0:ae.name)){l=((Y=(ce=a[0])==null?void 0:ce.value)==null?void 0:Y.value)!==((Ee=(de=a[1])==null?void 0:de.value)==null?void 0:Ee.value);break}if(((Ce=(Pe=a[0])==null?void 0:Pe.value)==null?void 0:Ce.name)===X.Untyped||((_e=(Ie=a[0])==null?void 0:Ie.value)==null?void 0:_e.name)===X.KeyValue){const Fr=($e=(Me=a[0])==null?void 0:Me.value)==null?void 0:$e.value,Ni=(at=(ze=a[1])==null?void 0:ze.value)==null?void 0:at.value;l=JSON.stringify(Fr)!==JSON.stringify(Ni);break}break}case dr.MoreThanOrEqual:{l=((nr=(Zt=a[0])==null?void 0:Zt.value)==null?void 0:nr.value)>=((Mr=(br=a[1])==null?void 0:br.value)==null?void 0:Mr.value);break}}return{value:l?Se.Success:Se.Error,entity:i,error:null,results:[]}}async executeDetachedFullFunctionDeclarationLogic(i,a,l,p={}){const t={...Wo,...p,onBeforeEntityExecution:(b,w,A)=>{var V;return((V=p==null?void 0:p.onBeforeEntityExecution)==null?void 0:V.call(p,b,w,{...A,detached:!0}))||Promise.resolve()},onEntityExecuted:(b,w,A)=>{var V;return((V=p==null?void 0:p.onEntityExecuted)==null?void 0:V.call(p,b,w,{...A,detached:!0}))||Promise.resolve()}},y=new hs(l,[i,...gy(i)],i,this);y.inheritValuesFromContext(this),console.log("functionBodyExecution",a);const v=await y.execute(t,a);return console.log("executeDetachedFullFunctionDeclarationLogic result: ",v),v}async executeFullFunctionDeclarationLogic(i,a,l={}){const p={...Wo,...l},t=gy(i);t.forEach(A=>{this.addEntity(A)}),t.reduce((A,V)=>ir.includes(V.type)?[...A,...V.outputs]:Qt.includes(V.type)&&V.type!==f.Condition?[...A,...V.outputs,...V.inputs]:V.type===f.Condition?[...A,...V.inputs]:A,[]).forEach(A=>{this.lastExecutionResults.removeValue(A.id)});const v=await this.executeBranch(i,p,a),w=i.getUniqueReturnDeclarations().reduce((A,V)=>{const L=v==null?void 0:v.results.find(U=>U.valueOwner.id===V.id);return L?[...A,L]:A},[]);return{...v,results:w}}static async executeEntryPointEntity(i,a){return{value:Se.Success,entity:i,error:null,results:a}}static async executeVariable(i,a){return{value:Se.Success,entity:i,error:null,results:[a]}}static async executeReturnStatement(i,a){return{value:i.throws?Se.Error:Se.Return,entity:i,error:null,results:a}}static async executeContinueStatement(i,a){return{value:Se.Continue,entity:i,error:null,results:a}}static async executeBreakStatement(i,a){return{value:Se.Break,entity:i,error:null,results:a}}mergeValues(i,a){const l=[];for(let p=0;p<a.length;p++)i!=null&&i[p]?l.push(i[p]):l.push(a[p]);return l}async executeEntity(i,a=[],l={}){var y,v,b,w,A,V,L,U,k,q,H,ie,te,pe,ne,me;const p={...Wo,...l},t={detached:!1};switch(console.log("Executing entity: ",i),console.log("Exec ent with inputs: ",a),i.type){case f.Condition:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((y=p.onBeforeEntityExecution)==null?void 0:y.call(p,i,J,t)),hs.executeCondition(i,J)}case f.Operation:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((v=p.onBeforeEntityExecution)==null?void 0:v.call(p,i,J,t)),hs.executeOperation(i,J,this.project)}case f.VariableInstance:case f.VariableDeclaration:{i.id==="ad7eae6d-c691-40a5-943b-f72008cdc3b0"&&console.log("Execute variable declaration resolveNextValue");let J=Uy(i,this.valueResolutionContext);const ae=di(i),ce=ae.getDataType(null);if(ce!=null&&ce.isObject()){let Ee={};if(((b=ce==null?void 0:ce.entity)==null?void 0:b.type)===f.DefinitionEntity&&(Ee={...Ee,...ce.entity.getActiveRawDefaultValue()}),J!=null&&J.value)sr((w=J==null?void 0:J.value)==null?void 0:w.value)&&(Ee={...Ee,...(A=J==null?void 0:J.value)==null?void 0:A.value}),J==null||J.value.metaSync({value:Ee},null);else{const Pe=Ye(ce,i,this.project);Pe==null||Pe.metaSync({value:Ee},null),J={valueOwner:ae,type:Ae.ExecutionResult,inheritanceLink:null,value:Pe}}this.lastExecutionResults.writeValue(ae,J.value),console.log("Propagating value to inputs: ",ae.inputs.map(Pe=>re(Pe,this.project))),ae.inputs.forEach(Pe=>{var Ce;if(((Ce=Pe.declaration)==null?void 0:Ce.type)===f.Property&&Pe.declaration.static){const Ie=this.lastExecutionResults.readValue(Pe.declaration.id),_e=re(Pe,this.project),Me=Zr(_e);if(Ie)Ie.metaSync({value:Ee[Me]},null),this.lastExecutionResults.writeValue(Pe.declaration,Ie);else{const $e=Ye(Pe.getDataType(null),Pe,this.project);$e==null||$e.metaSync({value:Ee[Me]},null),console.log(`Created new value for static property ${_e}: `,Ee[Me]),this.lastExecutionResults.writeValue(Pe.declaration,$e)}}})}else this.lastExecutionResults.writeValue(ae,J==null?void 0:J.value);const Y=[],de=(V=J==null?void 0:J.value)!=null&&V.value&&sr((L=J.value)==null?void 0:L.value)?((U=J.value)==null?void 0:U.value)||{}:{};return i.outputs.map(Ee=>{const Pe=Zr(re(Ee,this.project)),Ce=de[Pe],Ie=Ye(Ee.getDataType(null),Ee,this.project);Ie==null||Ie.metaSync({value:Ce},null);const _e={value:Ie,valueOwner:Ee,type:Ae.ExecutionResult,inheritanceLink:J?{sources:[J],target:i}:null};Y.push(_e)}),J.type=Ae.ExecutionResult,{value:Se.Success,entity:i,error:null,results:[J,...Y]}}case f.FunctionCall:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((k=p.onBeforeEntityExecution)==null?void 0:k.call(p,i,J,t)),this.executeFunctionCall(i,J,this.project)}case f.FunctionDeclaration:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((q=p.onBeforeEntityExecution)==null?void 0:q.call(p,i,J,t)),hs.executeEntryPointEntity(i,J)}case f.Search:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((H=p.onBeforeEntityExecution)==null?void 0:H.call(p,i,J,t)),this.executeSearch(i,J,this.project)}case f.Loop:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((ie=p.onBeforeEntityExecution)==null?void 0:ie.call(p,i,J,t)),this.executeLoop(i,J,this.project,p)}case f.ReturnStatement:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((te=p.onBeforeEntityExecution)==null?void 0:te.call(p,i,J,t)),hs.executeReturnStatement(i,J)}case f.ContinueStatement:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((pe=p.onBeforeEntityExecution)==null?void 0:pe.call(p,i,J,t)),hs.executeContinueStatement(i,J)}case f.BreakStatement:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((ne=p.onBeforeEntityExecution)==null?void 0:ne.call(p,i,J,t)),hs.executeBreakStatement(i,J)}case f.GlobalEvent:{const J=this.mergeExernalValuesWithInternalInputs(a,i);return await((me=p.onBeforeEntityExecution)==null?void 0:me.call(p,i,J,t)),hs.executeEntryPointEntity(i,J)}default:return{value:Se.Error,entity:i,error:null,results:[]}}}storeLastExecutionValues(i){i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value),console.log("result.results: ",i.results),i.results.forEach(a=>{const l=en(a.valueOwner,this.project);a.value?l.forEach(p=>{this.lastExecutionResults.writeValue(p,a.value)}):l.forEach(p=>{this.lastExecutionResults.removeValue(p.id)})})}async executeBranch(i,a={},l=[]){var b;const p={...Wo,...a},t={detached:!1};if(console.log("executeBranch: ",l),!this.hasEntity(i))return console.log("Skipping entity (not part of test): ",i),null;this.addToExecutingList(i),console.log("Executing branch: ",i);const v=await this.executeEntity(i,l,p);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(v),await((b=p.onEntityExecuted)==null?void 0:b.call(p,i,v,t)),v.value===Se.Success){const w=(i.successCalls||i.calls||[]).filter(L=>this.hasEntity(L));(i.errorCalls||[]).filter(L=>this.hasEntity(L)).forEach(L=>{this.addToSkippedList(L)});const V=Mb(ei(w));for(let L=0;L<V.length;L++){const U=V[L];let k=[];const q=await Promise.all(U.map(ie=>this.executeBranch(ie,p,v.results))),H=q.find(ie=>ie.value===Se.Error||ie.value===Se.Return||ie.value===Se.Break||ie.value===Se.Continue);if(H)return H;k=[...k,...q]}return v}else if(v.value===Se.Error){const w=(i.errorCalls||[]).filter(U=>this.hasEntity(U));(i.successCalls||i.calls||[]).filter(U=>this.hasEntity(U)).forEach(U=>{this.addToSkippedList(U)});const V=Mb(ei(w));let L=[];for(let U=0;U<V.length;U++){const k=V[U],q=await Promise.all(k.map(ie=>this.executeBranch(ie,p,v.results))),H=q.find(ie=>ie.value===Se.Error||ie.value===Se.Return||ie.value===Se.Break||ie.value===Se.Continue);if(H)return H;L=[...L,...q]}return v}else{if(v.value===Se.Return)return v;if(v.value===Se.Break)return v;if(v.value===Se.Continue)return v}return v}async execute(i={},a=[]){const l={...Wo,...i};this.state="running";const p=await this.executeBranch(this.entryPoint,l,a);return this.state="finished-success",p}addEntity(i){var a;this.entities.includes(i)||(this.entities.push(i),(a=this.onAddEntityCallback)==null||a.call(this,i))}addEntities(i){i.forEach(a=>this.addEntity(a))}removeEntity(i){var a;if(i!==this.entryPoint){const l=this.entities.indexOf(i);l>-1&&(this.entities.splice(l,1),(a=this.onRemoveEntityCallback)==null||a.call(this,i))}}hasEntity(i){if(this.entities.includes(i))return!0;const a=cr(i);if(!a)return!1;const l=a.type===f.Loop&&i.parent===a.body?a.body:null;return l?this.entities.includes(l)||this.entities.includes(a):this.entities.includes(a)}hasEntityWithId(i){const a=this.project.get(i);return a?this.hasEntity(a):!1}onAddToSkippedList(i){this.onAddToSkippedListCallback=i}onAddEntity(i){this.onAddEntityCallback=i}onRemoveFromSkippedList(i){this.onRemoveFromSkippedListCallback=i}onRemoveEntity(i){this.onRemoveEntityCallback=i}addToExecutingList(i){this.executing.includes(i)||this.executing.push(i)}removeFromExecutingList(i){const a=this.executing.indexOf(i);a>-1&&this.executing.splice(a,1)}removeFromAlreadyExecutedList(i){const a=this.executed.indexOf(i);a>-1&&this.executed.splice(a,1)}removeFromSkippedList(i){var l;const a=this.skipped.indexOf(i);a>-1&&(this.skipped.splice(a,1),(l=this.onRemoveFromSkippedListCallback)==null||l.call(this,i))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var a;this.skipped.includes(i)||(this.skipped.push(i),(a=this.onAddToSkippedListCallback)==null||a.call(this,i))}};D(hs,"searchImplementation",async()=>({data:null,error:"Search module not implemented"}));let iA=hs;function hme(d){var u,i;if(d.isList)return"list";if(((u=d.entity)==null?void 0:u.type)===f.DefinitionEntity)return"definition-entity";switch((i=d.entity)==null?void 0:i.name){case X.Number:return"number";case X.String:return"text";case X.Boolean:return"boolean";case X.UUID:return"uuid";case X.Date:return"date-time";default:return"definition-entity"}}const sA={[f.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[f.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[f.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[f.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[f.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[f.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[f.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[f.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[f.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[f.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[f.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[f.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[f.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[f.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[f.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[f.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[f.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[f.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[f.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[f.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[f.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[f.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[f.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[f.ReturnDeclaration]:{singular:"Output definition",plural:"Output definitions",shortSingular:"Output",shortPlural:"Outputs"},[f.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"}};function nA(d){const u=Dy(d);if(!u){const a=bd(d);if(a.includes(Oe.HTTP_ENDPOINT))return"HTTP endpoint";if(a.includes(Oe.PERSISTED_ENTITY))return"Persisted entity";if(a.includes(Oe.CRON_JOB))return"Scheduled execution";if(a.includes(Oe.RELATIONAL_DATABASE))return"Relational database"}if(u){let a="Extension of "+re(u,u.project)+" entity",l=od(a);const p=bd(d);return p.includes(Oe.HTTP_ENDPOINT)?"HTTP endpoint"+(l?", "+l:""):p.includes(Oe.PERSISTED_ENTITY)?"Persisted entity"+(l?", "+l:""):p.includes(Oe.CRON_JOB)?"Scheduled execution"+(l?", "+l:""):p.includes(Oe.RELATIONAL_DATABASE)?"Relational database"+(l?", "+l:""):a}let i="";return d.abstract&&(i="Template "),d.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function wx(d){return d.parent.type===f.DefinitionEntity||d.parent.type===f.InstalledProject?"Internal action of "+re(d.parent,d.project):d.parent.type===f.Loop?"Action repeated on every iteration":"Internal action of entity"}function aA(d){return qb(d)?wx(d):"Custom trigger"}function yme(d){var u;switch(d.type){case f.DefinitionEntity:return nA(d);case f.FunctionDeclaration:return aA(d)}return(u=sA[d.type])==null?void 0:u.singular}function mme(d){var u;switch(d.type){case f.DefinitionEntity:return nA(d);case f.FunctionDeclaration:return aA(d)}return(u=sA[d.type])==null?void 0:u.singular}const oA=4e4,Rx=280,vme=300,lA=65,wd=32,xy=39,_x=26,gx=49,Fy=44,Eme=35,Gy=52,dA=10,ha=dA*2,Ky=38,ky=90,uA=270,Dx=oA/2+120,Cx=oA/2+180;function Ox(d){let i=wd+Fy+Ky+dA;const a=[...d.inputs];return a.length&&(i+=ha,a.forEach(()=>{i+=_x})),{height:i,width:280}}function $x(d){let i=lA;const a=[];if([f.DefinitionEntity].includes(d.type)){const v=[...d.suggestedProperties||[],...d.properties||[]];v.length&&(i+=ha,v.forEach(b=>{i+=b.static?gx:xy}))}if([f.DefinitionEntity,f.InstalledProject,f.Loop].includes(d.type)){const v=[...(d==null?void 0:d.suggestedMethods)||[],...d.methods||[],...d.functions||[],...d.body?[d.body]:[]];v.length&&(i+=ha,v.forEach(b=>{const w=Ox(b);i+=w.height}))}Qt.includes(d.type)?(rt.includes(d.type)?a.push(...(d.usedInputs||[]).flatMap(v=>[v])||[]):a.push(...(d.inputs||[]).flatMap(v=>[v])||[]),d.error&&(i+=Gy)):[f.ReturnStatement,f.BreakStatement,f.ContinueStatement].includes(d.type)?(a.push(...d.outputs||[]),d.throws&&(i+=Gy)):d.type===f.Condition&&(a.push(d.inputs[0]),d.inputs[1]&&a.push(d.inputs[1]));const l=a.length;l&&(i+=l*xy,i+=ha);const p=[];if(d.type===f.FunctionDeclaration||d.type===f.GlobalEvent?p.push(...d.inputs||[]):Qt.includes(d.type)&&(rt.includes(d.type)?p.push(...d.usedOutputs||[]):p.push(...d.outputs||[])),rt.includes(d.type)){d.readsValue&&(i+=ha,i+=Fy),d.writesValues.length&&(i+=ha,i+=Fy),d.internalCalls.length&&d.usedInternalCalls.forEach(()=>i+=Gy+ha);const v=d.getDataType(null);(!v||v.inferred)&&(i+=Ky)}const t=p.length;return t&&(i+=t*xy,i+=ha),[f.DefinitionEntity,f.FunctionDeclaration,f.ReturnStatement,f.BreakStatement,f.ContinueStatement].includes(d.type)&&(i+=Ky),{height:i,width:280}}function $p(d){return`${d.split("-").map((a,l)=>l===0?a.charAt(0).toUpperCase()+a.slice(1):a.toLowerCase()).join(" ")}.`}function Tme(d){switch(d.code){case se.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case se.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case se.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case se.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case se.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case se.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case se.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case oe.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case oe.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case se.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case se.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case oe.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case se.NoProperties:return"This entity has no properties, so it doesn't do anything";case se.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case se.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case se.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case se.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case se.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case se.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case se.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case se.PropertyImplementsNonAbstact:return"This property implements a non-template property";case se.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case se.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case se.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case se.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case se.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case oe.InternalCallDeclarationIsNotFunctionDeclaration:return"This internal call is not an action";case oe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case oe.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case oe.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case oe.UnreachableEntity:return"This entity is unreachable";case se.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";default:return $p(d.code)}}function bme(d){switch(d.code){case se.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case se.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case se.IncorrectEntityImplementation:return"Incorrect implementation";case se.IncorrectMethodImplementation:return"Incorrect action implementation";case se.IncorrectPropertyImplementation:return"Incorrect property implementation";case se.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case se.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case oe.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case oe.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case se.MissingMethodImplementation:return"Missing action";case se.MissingPropertyImplementation:return"Missing property";case oe.NameNotUniqueInScope:return"Duplicate name";case se.NoProperties:return"No properties";case se.NonStaticPropertyInStaticEntity:return"Non-static property";case se.StaticEntityWithNonStaticProperties:return"Non-static properties";case se.ReadingFromIncompatibleType:return"Read from different type";case se.WritingToIncompatibleType:return"Write to different type";case se.ScopeWithoutLogic:return"No logic";case se.NonStaticPropertyImplementsStatic:return"Invalid static property";case se.PropertyImplementsIncompatibleType:return"Incompatible data type";case se.PropertyImplementsNonAbstact:return"Non-template property";case se.StaticPropertyImplementsNonStatic:return"Non-static property";case se.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case se.VariableHasInputsAndInternalCall:return"Bad internal call";case se.VariableHasOutputsAndInternalCall:return"Bad internal call";case se.VariableIsCalledAndHasInternalCall:return"Bad internal call";case oe.InternalCallDeclarationIsNotFunctionDeclaration:return"Declaration not an action";case oe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case oe.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case oe.InternalCallParentMissingDataType:return"Parent has no data type";case oe.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case oe.UnreachableEntity:return"Unreachable entity";case se.DisconnectedCallableEntity:return"Disconnected entity";default:return $p(d.code)}}function Ame(d){switch(d.code){case se.AbstractEntityWithNonAbstractMethods:return`${re(d.entity,d.entity.project)} has non-template actions`;case se.AbstractEntityWithNonAbstractProperties:return`${re(d.entity,d.entity.project)} has non-template properties`;case se.IncorrectEntityImplementation:return`${re(d.entity,d.entity.project)} incorrectly implements template`;case se.IncorrectMethodImplementation:return`${re(d.entity,d.entity.project)} incorrectly implements the template`;case se.IncorrectPropertyImplementation:return`${re(d.entity,d.entity.project)} incorrectly implements the template`;case se.AbstractMethodInNonAbstractEntity:return`${re(d.entity,d.entity.project)} can't be a template`;case se.AbstractPropertyInNonAbstractEntity:return`${re(d.entity,d.entity.project)} can't be a template`;case oe.MethodOverwritesOtherSiblingWithSameName:return`${re(d.entity,d.entity.project)} overwrites action`;case oe.PropertyOverwritesOtherSiblingWithSameName:return`${re(d.entity,d.entity.project)} overwrites property`;case se.MissingMethodImplementation:return`${re(d.entity,d.entity.project)} is missing action`;case se.MissingPropertyImplementation:return`${re(d.entity,d.entity.project)} is missing property`;case oe.NameNotUniqueInScope:return`${re(d.entity,d.entity.project)} name is not unique`;case se.NoProperties:return`${re(d.entity,d.entity.project)} has no properties`;case se.NonStaticPropertyInStaticEntity:return`${re(d.entity,d.entity.project)} has non-static property`;case se.StaticEntityWithNonStaticProperties:return`${re(d.entity,d.entity.project)} has non-static properties`;case se.ReadingFromIncompatibleType:return`${re(d.entity,d.entity.project)} reads from different type`;case se.WritingToIncompatibleType:return`${re(d.entity,d.entity.project)} writes to different type`;case se.ScopeWithoutLogic:return`${re(d.entity,d.entity.project)} has no logic`;case se.NonStaticPropertyImplementsStatic:return`${re(d.entity,d.entity.project)} has invalid static property`;case se.PropertyImplementsIncompatibleType:return`${re(d.entity,d.entity.project)} has incompatible data type`;case se.PropertyImplementsNonAbstact:return`${re(d.entity,d.entity.project)} has non-template property`;case se.StaticPropertyImplementsNonStatic:return`${re(d.entity,d.entity.project)} has non-static property`;case se.VariableCallsOthersAndHasInternalCall:return`${re(d.entity,d.entity.project)} has bad internal call`;case se.VariableHasInputsAndInternalCall:return`${re(d.entity,d.entity.project)} has bad internal call`;case se.VariableHasOutputsAndInternalCall:return`${re(d.entity,d.entity.project)} has bad internal call`;case se.VariableIsCalledAndHasInternalCall:return`${re(d.entity,d.entity.project)} has bad internal call`;case oe.InternalCallDeclarationIsNotFunctionDeclaration:return`${re(d.entity,d.entity.project)} has declaration that is not an action`;case oe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${re(d.entity,d.entity.project)} has declaration that is not found in parent`;case oe.InternalCallParentDeclarationEntityInvalidType:return`${re(d.entity,d.entity.project)} has invalid parent declaration type`;case oe.InternalCallParentMissingDataType:return`${re(d.entity,d.entity.project)}'s parent has no data type`;case oe.InternalCallDeclarationNotInParentDatatypeEntity:return`${re(d.entity,d.entity.project)} has declaration that is not in parent`;case oe.UnreachableEntity:return`${re(d.entity,d.entity.project)} is unreachable`;case se.DisconnectedCallableEntity:return`${re(d.entity,d.entity.project)} is not executed by any entity`;default:return`${re(d.entity,d.entity.project)} Error: ${$p(d.code)}`}}function Ime(d){var u,i,a,l;switch(d.code){case se.AbstractEntityWithNonAbstractMethods:return`${re(d.entity,d.entity.project)} has non-template actions`;case se.AbstractEntityWithNonAbstractProperties:return`${re(d.entity,d.entity.project)} has non-template properties`;case se.IncorrectEntityImplementation:return`${re(d.entity,d.entity.project)} incorrectly implements the template entity`;case se.IncorrectMethodImplementation:return`${re(d.entity,d.entity.project)} incorrectly implements the template action it's based on`;case se.IncorrectPropertyImplementation:return`${re(d.entity,d.entity.project)} incorrectly implements the template property it's based on`;case se.AbstractMethodInNonAbstractEntity:return`${re(d.entity,d.entity.project)} is a template action in a non-template entity`;case se.AbstractPropertyInNonAbstractEntity:return`${re(d.entity,d.entity.project)} is a template property in a non-template entity`;case oe.MethodOverwritesOtherSiblingWithSameName:return`${re(d.entity,d.entity.project)} overwrites an action in the template entity`;case oe.PropertyOverwritesOtherSiblingWithSameName:return`${re(d.entity,d.entity.project)} overwrites a property in the template entity`;case se.MissingMethodImplementation:return`${re(d.entity,d.entity.project)} is missing an action implementation from the template entity`;case se.MissingPropertyImplementation:return`${re(d.entity,d.entity.project)} is missing a property implementation from the template entity`;case oe.NameNotUniqueInScope:return`${re(d.entity,d.entity.project)} has a duplicate name in the same scope`;case se.NoProperties:return`${re(d.entity,d.entity.project)} has no properties, so it doesn't do anything`;case se.NonStaticPropertyInStaticEntity:return`${re(d.entity,d.entity.project)} has a non-static property in a static entity`;case se.StaticEntityWithNonStaticProperties:return`${re(d.entity,d.entity.project)} has non-static properties in a static entity`;case se.ReadingFromIncompatibleType:return`${re(d.entity,d.entity.project)} reads data from a value of a different data type`;case se.WritingToIncompatibleType:return`${re(d.entity,d.entity.project)} writes data to a value of a different data type`;case se.ScopeWithoutLogic:return`${re(d.entity,d.entity.project)} has no logic`;case se.NonStaticPropertyImplementsStatic:return`${re(d.entity,d.entity.project)} has a static property in a non-static entity`;case se.PropertyImplementsIncompatibleType:return`${re(d.entity,d.entity.project)} implements a property of a different data type`;case se.PropertyImplementsNonAbstact:return`${re(d.entity,d.entity.project)} implements a non-template property`;case se.StaticPropertyImplementsNonStatic:return`${re(d.entity,d.entity.project)} has a static property in a non-static entity`;case se.VariableCallsOthersAndHasInternalCall:return`${re(d.entity,d.entity.project)} calls other entities while being used to execute internal logic`;case se.VariableHasInputsAndInternalCall:return`${re(d.entity,d.entity.project)} has inputs while being used to execute internal logic`;case se.VariableHasOutputsAndInternalCall:return`${re(d.entity,d.entity.project)} has outputs while being used to execute internal logic`;case se.VariableIsCalledAndHasInternalCall:return`${re(d.entity,d.entity.project)} is called while being used to execute internal logic`;case oe.InternalCallDeclarationIsNotFunctionDeclaration:return`${re(d.entity,d.entity.project)} has a declaration that is not an action`;case oe.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${re(d.entity,d.entity.project)} has a declaration that is not found in ${(u=d.entity.parent.getDataType(null))!=null&&u.entity?re((i=d.entity.parent.getDataType(null))==null?void 0:i.entity,d.entity.project):"the variable's data-type entity"}`;case oe.InternalCallParentDeclarationEntityInvalidType:return`${re(d.entity,d.entity.project)} is part of a variable whos data-type entity can't have actions`;case oe.InternalCallParentMissingDataType:return`${re(d.entity,d.entity.project)} is part of a variable with no data-type entity`;case oe.InternalCallDeclarationNotInParentDatatypeEntity:return`${re(d.entity,d.entity.project)} has a declaration doesn't belong to ${(a=d.entity.parent.getDataType(null))!=null&&a.entity?re((l=d.entity.parent.getDataType(null))==null?void 0:l.entity,d.entity.project):"the variable's data-type entity"}`;case oe.UnreachableEntity:return`${re(d.entity,d.entity.project)} is unreachable`;case se.DisconnectedCallableEntity:return`${re(d.entity,d.entity.project)} is disconnected and won't be executed by anything after publishing`;default:return`${re(d.entity,d.entity.project)} Error: ${$p(d.code)}`}}var cA=(d=>(d.ValuesAlreadyConnected="values-already-connected",d.CannotReadMoreThanOneValue="cannot-read-more-than-one-value",d.CannotReadValueFromChildren="cannot-read-value-from-children",d.CannotWriteValueToChildren="cannot-write-value-to-children",d.CannotBeCalledByChildren="cannot-be-called-by-children",d.ExecutionsAlreadyConnected="executions-already-connected",d.DataTypesNotCompatible="data-types-not-compatible",d.CannotCallAncestor="cannot-call-ancestor",d.CannotWriteValueToAncestor="cannot-write-value-to-ancestor",d.NotInScope="not-in-scope",d.IsNotValueWrittingEntity="is-not-value-writting-entity",d.IsNotValueReadingEntity="is-not-value-reading-entity",d.ContinueOrBreakStatementCalledFromOutsideLoop="continue-or-break-statement-called-from-outside-loop",d.ElementInLoopBodyCallingOutsideLoop="element-in-loop-body-calling-outside-loop",d.CallerIsInHigherScope="caller-is-in-higher-scope",d.CallerIsInLowerScope="caller-is-in-lower-scope",d.CallIsInHigherScope="call-is-in-higher-scope",d.CallIsInLowerScope="call-is-in-lower-scope",d.OtherIncompatibleScopeReason="other-incompatible-scope-reason",d))(cA||{});const wme=Object.values(cA);var pA=(d=>(d.NotPartOfOngoingTest="not-part-of-ongoing-test",d.CannotBeAddedToTest="cannot-be-added-to-test",d))(pA||{});const Rme=Object.values(pA);var fA=(d=>(d.Suggestion="suggestion",d.CanvasGloballyDisabled="canvas-globally-disabled",d))(fA||{});const _me=Object.values(fA);function gme(d,u){const i=[...d,...u];return Array.from(new Set(i))}function Dme(d,u){const i=[...d,...u],a=Array.from(new Set(i));return{hasChanged:a.length!==d.length,reasons:a}}function Cme(d,u){const i=d.filter(l=>!u.includes(l));return{hasChanged:i.length!==d.length,reasons:i}}function Ome(d,u){return d.find(i=>i.entity.id===u)||null}function Px(d){return d.filter((u,i)=>d.indexOf(u)===i)}class ti{constructor(u,i,a=null,l){D(this,"ids",[]);D(this,"entity");D(this,"entityCardHeight");D(this,"entityCardWidth");D(this,"index");D(this,"childEntities",[]);D(this,"children",[]);D(this,"parents",[]);D(this,"calculationEntryPoint");D(this,"_onlyEntities",null);D(this,"_changeSet",null);if(this.index=i,this.entity=u,this.calculationEntryPoint=a||this,this===this.calculationEntryPoint&&!l)throw new Error("Change set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(u,i,a){const l=Dx-uA-Rx,p=Cx-ky-lA;u.metaSync({x:u.x||l,y:u.y||p},i);const t=new ti(u,0,null,i);t._onlyEntities=a||[],t.ids=["0"];const y=[];t.next(b=>{y.push(...b)}),ti.recursivelyAssembleChildrenAreas(y),t.resolveChildrenOverlaps();const v=t.flattenChildEntities();return t._onlyEntities?v.filter(b=>(t._onlyEntities||[]).includes(b)):v}static recursivelyAssembleChildrenAreas(u){const i=[];u.forEach(a=>{a.next(l=>{i.push(...l)})}),i.length>0&&ti.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(u){this.calculationEntryPoint._changeSet=u}findAreaInChildrenFromEntity(u){if(this.entity===u)return this;const i=this.children.find(l=>l.entity===u);return i||this.children.reduce((l,p)=>l||p.findAreaInChildrenFromEntity(u),null)}findAreaFromEntity(u){if(this.entity===u)return this;const i=this.calculationEntryPoint.children,a=i.find(p=>p.entity===u);return a||i.reduce((p,t)=>p||t.findAreaInChildrenFromEntity(u),null)}addParent(u){if(!this.parents.includes(u)){const i=ti.resolveIds(u,this.index);this.ids.push(...i),this.parents.push(u)}}static resolveIds(u,i){return u?u.ids.map(a=>`${a}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const u=Xs(this.entity,!0);if(this.entity.type===f.Project){const i=[],a=[],l=[];u.forEach(t=>{if(f.DefinitionEntity===t.type){a.push(t);return}else if(Ht.includes(t.type)){l.push(t);return}i.push(t)});const p=i.sort((t,y)=>{const v=!!Ay(t,y).length,b=Xs(t),w=Xs(y);return v?0:b.length&&!w.length?-1:!b.length&&w.length?1:0}).filter(t=>!Ja(t).length);this.childEntities=[...a,...l,...p]}else{const i=[],a=[],l=[],p=[],t=[];Gs.includes(this.entity.type)&&wy(this.entity).forEach(b=>{if(rt.includes(b.type)){l.push(b);return}const w=cr(b);i.push(w)}),Ar.includes(this.entity.type)&&a.push(...this.entity.detachedChildren);const y=u.filter(v=>{const b=i.includes(v);return b||l.includes(v)||a.includes(v)?!1:rt.includes(v.type)?(l.push(v),!1):Fs.includes(v.type)&&!b?(p.push(v),!1):v.type===f.DefinitionEntity?(t.push(v),!1):!0});i.sort((v,b)=>Ko(v,b)?-1:0),p.sort((v,b)=>Ko(v,b)?-1:0),l.sort((v,b)=>Lb(v,b)?1:Lb(b,v)?-1:0),this.childEntities=[...t,...i,...p,...y,...l,...a]}}calculateCardSize(){const u=$x(this.entity);this.entityCardWidth=u.width,this.entityCardHeight=u.height}static getBoundriesOfTwoAreas(u,i){return{top:Math.min(u.top,i.top),left:Math.min(u.left,i.left),bottom:Math.max(u.bottom,i.bottom),right:Math.max(u.right,i.right)}}static getBoundriedOfCombinedAreas(u,i){const a=u.filter(p=>!i.includes(p));return a.reduce((p,t)=>i.includes(t)?p:ti.getBoundriesOfTwoAreas(p,t.fullBranchArea),a[0].fullBranchArea)}getFullAreaUntilAny(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(t=>!u.includes(t)).map(t=>t.getFullAreaUntilAny(u)).reduce((t,y)=>ti.getBoundriesOfTwoAreas(t,y),i)}getFullAreaUntilAreaOrAnyChildren(u){const i=[u,...u.flattenChildren()],a=this.ownEntityPlusBufferArea;return this.children.filter(t=>i.includes(t)).map(t=>t.getFullAreaUntil(u)).reduce((t,y)=>ti.getBoundriesOfTwoAreas(t,y),a)}getFullAreaUntil(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(p=>p!==u).map(p=>p.getFullAreaUntil(u)).reduce((p,t)=>ti.getBoundriesOfTwoAreas(p,t),i)}get fullBranchArea(){const u=this.ownEntityPlusBufferArea;return this.children.map(l=>l.fullBranchArea).reduce((l,p)=>ti.getBoundriesOfTwoAreas(l,p),u)}get ownEntityArea(){return{top:this.entity.y,left:this.entity.x,bottom:this.entity.y+this.entityCardHeight,right:this.entity.x+this.entityCardWidth}}get ownEntityPlusBufferArea(){const u=this.ownEntityArea;return{top:u.top,left:u.left,bottom:u.bottom+ky,right:u.right+uA}}static filterOutRepeatedAreas(u){return u.filter((i,a)=>u.indexOf(i)===a)}getEarliestId(u,i){const a=u.split("-"),l=i.split("-");return a.length<l.length?u:a.length>l.length?i:a.reduce((t,y,v)=>y<l[v]?u:i,u)}getEarliestLevel(){return this.ids.reduce((a,l)=>this.getEarliestId(a,l),this.ids[0]).split("-").length}countColumns(){let u=0;if(this!==this.calculationEntryPoint)u++;else return u;if(!this.parents.length)return u;const a=this.parents.reduce((l,p)=>p.getEarliestLevel()>l.getEarliestLevel()?p:l,this.parents[0]).countColumns();return u+=a,u}getLatestId(u,i){if(u===i)return u;const a=u.split("-"),l=i.split("-");return a.length<l.length?i:a.length>l.length?u:a.reduce((t,y,v)=>y>l[v]?u:i,u)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((a,l)=>this.getLatestId(a,l),this.ids[0]).split("-").length}smoothPosition(){const u=this.flattenSiblings();if(!u.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(a=>{a!==this.calculationEntryPoint&&a.shiftDownAlone(i)})}else if([...Ht].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=u.filter(a=>!this.parents.includes(a));i.length?i.every(l=>{const p=this.countColumns(),t=l.countColumns();return p>t})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(u,i){if(u.includes(this))return u;this.move(this.entity,{y:this.entity.y+i});let a=[...u,this];return this.children.forEach(l=>{if(ti.getEarliestParentInChain(l)!==this)return;const t=Ome(a,l.entity.id);a=ti.filterOutRepeatedAreas([...a]),t||(a=a.filter(v=>v!==l));const y=l.shiftDownUntilAny(a,i);a.push(...y)}),a}shiftRightUntilAny(u,i){u.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(a=>{const l=ti.filterOutRepeatedAreas([...this.flattenSiblings(),...u]);ti.getEarliestParentInChain(a)===this&&a.shiftRightUntilAny(l,i)}))}shiftRight(u){this.move(this.entity,{x:this.entity.x+u}),this.children.forEach(i=>{const l=i.flattenSiblings().filter(p=>p!==i);i.shiftRightUntilAny(l,u)})}shiftDownAlone(u){this.move(this.entity,{y:this.entity.y+u})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const u=this.parents.reduce((l,p)=>{const t=p.ownEntityArea,y=t.top+wd,v={top:y,left:t.left,bottom:y,right:t.right};return ti.getBoundriesOfTwoAreas(l,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-wd;this.shiftDownAlone(a)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const u=this.children.reduce((l,p)=>{const t=p.ownEntityArea,y=t.top+wd,v={top:y,left:t.left,bottom:y,right:t.right};return ti.getBoundriesOfTwoAreas(l,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-wd;return this.shiftDownAlone(a),a}resolveChildrenOverlaps(){const u=this.flattenChildren();let i=[];u.forEach(a=>{const l=a.adjustVerticallyToAvoidOverlaps();i.push(...l)}),u.forEach(a=>{a.smoothPosition()})}static getEarliestParentInChain(u){let i=u.parents[0];return u.parents.length&&(i=u.parents.sort((a,l)=>{if(!a.ids.length)return-1;if(!l.ids.length)return 1;const p=a.ids.sort((y,v)=>y.length<v.length?-1:0),t=l.ids.sort((y,v)=>y.length<v.length?-1:0);return p[0].length-t[0].length})[0]),i}flattenEarlierSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((a,l)=>{if(u.has(l.entity.id))return a;u.add(l.entity.id);const t=l.children.slice(0,l.children.indexOf(this)).reduce((y,v)=>[...y,v,...v.flattenChildren(u)],[]);return[...a,...t]},[])}flattenSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((a,l)=>{if(u.has(l.entity.id))return a;u.add(l.entity.id);const t=l.children.filter(y=>y!==this).reduce((y,v)=>[...y,v,...v.flattenChildren(u)],[]);return[...a,...t]},[])}flattenChildren(u=new Set){return this.children.reduce((i,a)=>u.has(a.entity.id)?i:(u.add(a.entity.id),[...i,a,...a.flattenChildren(u)]),[])}flattenParents(u=new Set){return this.parents.reduce((a,l)=>u.has(l.entity.id)?a:(u.add(l.entity.id),[...a,l,...l.flattenParents(u)]),[])}getAreaIfRendered(u){return this.calculationEntryPoint.flattenChildren().find(l=>l.entity.id===u.id)||null}getLowerSiblings(){const u=this.parents.reduce((i,a)=>{const l=a.children.indexOf(this),p=a.children.slice(l+1);return[...i,...p]},[]);return Px(u)}getLowerAreas(){const u=this.getLowerSiblings(),i=this.parents.reduce((a,l)=>[...a,...l.getLowerAreas()],[]);return Px([...u,...i])}adjustVerticallyToAvoidOverlaps(u=[]){const a=ti.getEarliestParentInChain(this).children[this.index-1];if(!a)return u;const l=this.flattenEarlierSiblings(),p=this.flattenParents(),t=[...l,...p,a],b=R(t.flatMap(L=>Ay(this.entity,L.entity))).filter(L=>L.id!==this.entity.id).map(L=>this.findAreaFromEntity(L)).filter(L=>!!L),w=this.getFullAreaUntilAny(b),A=a.getFullAreaUntilAny(b),V=t.reduce((L,U)=>U===this||U.fullBranchArea.left!==w.left?L:Math.max(L,U.fullBranchArea.bottom),A.bottom);if(w.top<V){const L=V-w.top+ky;return this.shiftDownUntilAny(u,L)}return u}move(u,i){(this.onlyEntities||[]).includes(u)&&u.metaSync(i,this.changeSet)}addChild(u){const i=this.childEntities[u];let a=null;i.x&&i.y?a=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),a||(a=new ti(i,u,this.calculationEntryPoint));const l=this.ownEntityPlusBufferArea;this.children.includes(a)||(this.children.push(a),a.addParent(this));const p=a.fullBranchArea;if(p.left<l.right){const t=l.right-p.left;a.shiftRight(t)}return a}flattenChildEntities(u=new Set){return this.children.reduce((i,a)=>u.has(a.entity.id)?i:(u.add(a.entity.id),[...i,a.entity,...a.flattenChildEntities(u)]),[])}next(u){const i=[];this.childEntities.forEach((a,l)=>{const p=this.addChild(l);p&&i.push(p)}),u(i)}}var Pp=(d=>(d.Amazon="amazon",d.Google="google",d.Microsoft="microsoft",d))(Pp||{}),Cr=(d=>(d.RelationalDatabase="relational-database",d.CompiledLocalCodebase="compiled-local-codebase",d.CloudHostedCodebase="cloud-hosted-codebase",d.HttpApi="http-api",d.HttpEndpoint="http-endpoint",d.ServerlessFunction="serverless-function",d))(Cr||{}),hA=(d=>(d.Post="post",d.Get="get",d.Acknowledgement="acknowledgment",d.Progress="progress",d.Error="error",d.Complete="complete",d))(hA||{}),Vx=(d=>(d.Queued="queued",d.Running="running",d.Success="success",d.Failed="failed",d.CleanedUp="cleaned-up",d.Skipped="skipped",d.AbortedByUser="aborted-by-user",d.UnrecoverableFailure="unrecoverable-failure",d.Reverted="reverted",d.UnpublishingStarted="unpublishing-started",d.Unpublished="unpublished",d))(Vx||{}),Rd=(d=>(d.Queued="queued",d.Running="running",d.Success="success",d.Failed="failed",d.CleanedUp="cleaned-up",d.UnrecoverableFailure="unrecoverable-failure",d.Reverted="reverted",d.UnpublishingStarted="unpublishing-started",d.Unpublished="unpublished",d))(Rd||{}),dt=(d=>(d.ProjectNotFound="project-not-found",d.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",d.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",d.DeploymentCompleted="deployment-completed",d.DeploymentStarted="deployment-started",d.DeploymentFailed="deployment-failed",d.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",d.RequestPayloadValidationFailed="request-payload-validation-failed",d.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",d.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",d.ProjectAlreadyBeingPublished="project-already-being-published",d.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",d.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",d.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",d.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",d.CreatingNewRelationalDatabase="creating-new-relational-database",d.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",d.RelationalDatabaseAlreadyExists="relational-database-already-exists",d.HttpApiDeploymentStarted="http-api-deployment-started",d.HttpApiDeploymentCompleted="http-api-deployment-completed",d.HttpApiDeploymentFailed="http-api-deployment-failed",d.CreatingNewHttpApi="creating-new-http-api",d.HttpApiAlreadyExists="http-api-already-exists",d.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",d.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",d.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",d.BundlingCodebaseForDownload="bundling-codebase-for-download",d.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",d.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",d.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",d.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",d.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",d.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",d.CodeCompilationStarted="code-compilation-started",d.CodeCompilationCompleted="code-compilation-completed",d.CodeCompilationFailed="code-compilation-failed",d.BundleCodebaseStarted="bundle-codebase-started",d.BundleCodebaseCompleted="bundle-codebase-completed",d.BundleCodebaseFailed="bundle-codebase-failed",d.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",d.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",d.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",d.MigrateRelationalDatabaseStarted="migrate-relational-database-started",d.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",d.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",d))(dt||{}),ya=(d=>(d.CodeCompilation="code-compilation",d.RelationalDatabaseDeployment="relational-database-deployment",d.HttpApiDeployment="http-api-deployment",d.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",d.BundleCodebase="bundle-codebase",d.MigrateRelationalDatabase="migrate-relational-database",d.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",d.CodebaseCleanup="codebase-cleanup",d))(ya||{});Cr.CloudHostedCodebase,Cr.HttpApi,Cr.RelationalDatabase,Cr.CloudHostedCodebase,Cr.CloudHostedCodebase,Cr.RelationalDatabase,Cr.CloudHostedCodebase,Cr.CloudHostedCodebase;function Nx(d){return`project-${d}-http-api`}function Lx(d){return`entity-${d}-database`}class Bx{constructor(u,i,a,l,p,t,y,v,b){D(this,"stepType");D(this,"id");D(this,"resourceType");D(this,"index");D(this,"dependency",[]);D(this,"lastEvent",null);D(this,"lasEventTimestamp",null);D(this,"status",Vx.Queued);D(this,"publicationRun");D(this,"resource");this.stepType=u,this.id=i,this.resourceType=a,this.status=l,this.dependency=p,this.index=t,this.lasEventTimestamp=y,this.publicationRun=v,this.resource=b}toJSON(){return{stepType:this.stepType,id:this.id,resourceType:this.resourceType,index:this.index,status:this.status,dependency:this.dependency,lastEvent:this.lastEvent,resource:{resourceId:this.resource.resourceId,resourceType:this.resource.resourceType,provider:this.resource.provider,details:this.resource.details,status:this.resource.status,name:this.resource.name}}}async update(u){var i,a;this.status=u.status,this.dependency=u.dependency,this.index=u.index,this.stepType=u.stepType,this.resourceType=u.resourceType,this.lastEvent=u.lastEvent,this.id=u.id,(a=this.resource)==null||a.setDetails((i=u.resource)==null?void 0:i.details)}}var Mx=(d=>(d.Ready="ready",d.Provisioning="provisioning",d.Queued="queued",d.ProvisioningFailed="provisioning-failed",d.Deleting="deleting",d.DeletingFailed="deleting-failed",d.Deleted="deleted",d))(Mx||{});class yA{constructor(u,i,a){D(this,"provisionedBy");D(this,"publicationRun");D(this,"resourceType");D(this,"provider");D(this,"resourceId");D(this,"details",null);D(this,"name",null);D(this,"status","queued");this.publicationRun=u,this.resourceType=i,this.provider=a}setDetails(u){this.details=u}setStatus(u){this.status=u}setProvisionedBy(u){this.provisionedBy=u}}class mA extends yA{constructor(i,a,l,p){super(i,l,p);D(this,"resourceType");D(this,"owners",new Map);D(this,"details",null);D(this,"status","queued");a.forEach(t=>{this.owners.set(t.id,t)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,a;return this.resourceType===Cr.HttpApi?this.resourceId=Nx(this.publicationRun.project.id):this.resourceType===Cr.RelationalDatabase&&(this.resourceId=Lx((a=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:a.id)),this.resourceId}}class vA extends yA{constructor(i,a,l){super(i,a,l);D(this,"resourceType");D(this,"details",null);D(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceType===Cr.CompiledLocalCodebase?this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`:this.resourceType===Cr.CloudHostedCodebase&&(this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`),this.resourceId}}class $me{constructor(u,i){D(this,"id");D(this,"projectAutoIncrementPublicationCount");D(this,"projectPublishedSemanticVersion");D(this,"projectVersion");D(this,"projectId");D(this,"cloudProvider");D(this,"triggeredBy");D(this,"createdAt");D(this,"updatedAt");D(this,"status");D(this,"steps",[]);D(this,"editor");D(this,"explicitResources",new Map);D(this,"implicitGlobalResources",new Map);D(this,"finalGlobalEvent",null);D(this,"finalStatus",null);this.id=u.id,this.projectAutoIncrementPublicationCount=u.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=u.projectPublishedSemanticVersion,this.projectVersion=u.projectVersion,this.projectId=u.projectId,this.cloudProvider=u.cloudProvider,this.triggeredBy=u.triggeredBy,this.createdAt=u.createdAt,this.updatedAt=u.updatedAt,this.status=u.status,this.editor=i}get project(){return this.editor.project}getInfraTypes(u){return this.steps.filter(i=>u.includes(i.resourceType))}getStepsTypes(u){return this.steps.filter(i=>u.includes(i.stepType))}toIds(u){return u.map(i=>i.id)}getResourceForEntity(u){const i=Array.from(this.explicitResources.values()).find(a=>a.owners.has(u.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(Cr.CompiledLocalCodebase,new vA(this,Cr.CompiledLocalCodebase,Pp.Amazon)),this.implicitGlobalResources.set(Cr.CloudHostedCodebase,new vA(this,Cr.CloudHostedCodebase,Pp.Amazon));const u=this.project.entities.filter(a=>Yi(a,Oe.HTTP_ENDPOINT)),i=this.project.entities.filter(a=>Yi(a,Oe.RELATIONAL_DATABASE));if(i.length&&i.forEach(a=>{const l=new mA(this,[a],Cr.RelationalDatabase,Pp.Amazon);this.explicitResources.set(l.resourceId,l)}),u.length){const a=new mA(this,u,Cr.HttpApi,Pp.Amazon);this.explicitResources.set(a.resourceId,a)}}setSteps(u,i){u.forEach(a=>{this.addStep(a,i)}),this.editor.events.emit(dt.ProjectPublishRequestAcknowledged,{})}addStep(u,i){const a=u.dependency||[];if(a.length){const p=a.filter(t=>!this.steps.find(y=>y.id===t));if(p.length)throw new Error(`Missing dependencies: ${p.join(", ")}`)}if(!u.resource)throw new Error(`Resource not found for step ${u.stepType} (${u.id})`);if(!this.steps.find(p=>p.id===u.id)){const p=this.implicitGlobalResources.get(u.resourceType)||this.explicitResources.get(u.resource.resourceId),t=new Bx(u.stepType,u.id,u.resourceType,u.status,a,u.index,i,this,p);this.steps.push(t)}}onUpdate(u){var i;if(console.log("onUpdate",u),(i=u.payload)!=null&&i.stepType){const a=this.steps.find(l=>{var p;return l.id===((p=u.payload)==null?void 0:p.id)});a&&N(u.emittedAt).isAfter(N(a.lasEventTimestamp))&&a.update(u.payload)}this.editor.events.emit("publication-updated",{}),u.type===hA.Error?(this.finalStatus=Rd.Failed,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-error",u)):u.type===hA.Complete&&(this.finalStatus=Rd.Success,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-completed",u))}}function Pme(d){switch(d){case ya.CodeCompilation:return"Code generation";case ya.RelationalDatabaseDeployment:return"Database creation";case ya.HttpApiDeployment:return"HTTP gateway creation";case ya.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case ya.BundleCodebase:return"Bundle code";case ya.MigrateRelationalDatabase:return"Database structure migration";case ya.BusinessLogicCodebaseDeployment:return"Update servers with new code";case ya.CodebaseCleanup:return"Code cleanup";default:return"Publication finished"}}function Vme(d){switch(d){case dt.DeploymentCompleted:return"Successfully published";case dt.DeploymentStarted:return"Publication started";case dt.DeploymentFailed:return"Publication failed";case dt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case dt.RequestPayloadValidationFailed:return"Request payload validation failed";case dt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case dt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case dt.RelationalDatabaseDeploymentStarted:return"Database creation started";case dt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case dt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case dt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case dt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case dt.RelationalDatabaseAlreadyExists:return"Database already exists";case dt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case dt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case dt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case dt.CreatingNewHttpApi:return"Creating new HTTP gateway";case dt.HttpApiAlreadyExists:return"HTTP gateway already exists";case dt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case dt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case dt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case dt.BundlingCodebaseForDownload:return"Bundling code for download";case dt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case dt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case dt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case dt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case dt.CodeCompilationStarted:return"Code generation started";case dt.CodeCompilationCompleted:return"Code generation completed";case dt.CodeCompilationFailed:return"Code generation failed";case dt.BundleCodebaseStarted:return"Code bundling started";case dt.BundleCodebaseCompleted:return"Code bundling completed";case dt.BundleCodebaseFailed:return"Code bundling failed";case dt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case dt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case dt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case dt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case dt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case dt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case dt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case dt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case dt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case dt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case dt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case dt.ProjectNotFound:return"Project not found"}return"Unknown event"}var jx=(d=>(d.NO_LOGIC="NO_LOGIC",d.NO_NAME="NO_NAME",d.NO_CHANGES="NO_CHANGES",d.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",d))(jx||{});function Nme(d){switch(d){case"NO_LOGIC":return"This project has no logic";case"NO_NAME":return"This project has no name";case"NO_CHANGES":return"This version has already been published";case"PROJECT_PUBLICATION_ALREADY_ONGOING":return"This project is already being published";default:return"Publishing is currently not available. Try again later"}}function Lme(d){switch(d){case Cr.RelationalDatabase:return"Relational database";case Cr.HttpEndpoint:case Cr.HttpApi:return"HTTP endpoints";case Cr.ServerlessFunction:case Cr.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function Bme(d){switch(d){case Rd.Running:return"In progress";case Rd.Failed:return"Failed";case Rd.Success:return"Succeeded";case"skipped":return"Skipped";default:return"Queued"}}C.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=gb,C.ALL_BUILT_IN_BASE_ENTITIES=TP,C.ALL_BUILT_IN_CONDITION_ENTITIES=BP,C.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=jP,C.ALL_BUILT_IN_LOOP_BODY_ENTITIES=JO,C.ALL_BUILT_IN_LOOP_ENTITIES=ZO,C.ALL_BUILT_IN_OPERATION_ENTITIES=sC,C.ALL_BUILT_IN_PRIMITIVE_ENTITIES=ZR,C.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=kP,C.ALL_BUILT_IN_VALUE_DESCRIPTORS=KP,C.ALL_CONNECTION_DISABLED_REASONS=wme,C.ALL_OTHER_DISABLED_REASONS=_me,C.ALL_TESTING_DISABLED_REASONS=Rme,C.ActionDescriptorState=Ut,C.ActionInputMapState=mhe,C.ActionOutputMapState=The,C.AppendToListOperationInputIds=eg,C.AppendToListOperationOutputIds=tg,C.Area=ti,C.ArgumentDeclarationDependencyField=Ej,C.ArgumentDeclarationState=da,C.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=Ib,C.BUILT_IN_BASE_ENTITY_IDS=ve,C.BUILT_IN_ENTITY_TYPES=Fi,C.BaseCanvasDraggableState=Pye,C.BaseEntityNames=Oe,C.BaseState=$ye,C.BaseValueDescriptorIds=Il,C.BreakStatementDependencyField=bj,C.BreakStatementState=Ka,C.BuiltInBaseEntityState=gn,C.CACHED_PROJECTS_BY_ID=qo,C.CALLABLE_ENTITIES_EXPLANATION=ghe,C.CALLABLE_TYPES=Fs,C.CALLER_ENTITIES_EXPLANATION=_j,C.CALLER_TYPES=Gs,C.CALLS_UPDATE_EXPLANATION=qa,C.CANVAS_BASE_X=Dx,C.CANVAS_BASE_Y=Cx,C.CANVAS_CARD_HEADER_CENTER_HEIGHT=wd,C.CANVAS_CARD_WIDTH=Rx,C.CANVAS_COMPLEX_CARD_HEIGHT=vme,C.CANVAS_HORIZONTAL_BUFFER_BETWEEN_CARDS=uA,C.CANVAS_SIMPLE_CARD_HEIGHT=lA,C.CANVAS_SIZE=oA,C.CANVAS_VERTICAL_BUFFER_BETWEEN_CARDS=ky,C.CARD_FOOTER_HEIGHT=Ky,C.CARD_PROPERTIES_SECTION_PADDING=ha,C.CARD_PROPERTIES_SECTION_SINGLE_PADDING=dA,C.CHILDREN_TYPES=d9,C.COMPARISON_CONDITIONS=NP,C.CONDITIONS=LP,C.CUSTOM_ENTITY_OPERATIONS=ID,C.CallableEntityClass=Nye,C.CallerEntityClass=Jb,C.CanvasEntityConnectionDisabledReason=cA,C.CanvasEntityOtherDisabledReason=fA,C.CanvasEntityTestingDisabledReason=pA,C.ChangeSet=G,C.ChangeSetChangeCaptureType=JT,C.ChangeSetEntityChangeType=K,C.ChildEntityBaseClass=Vye,C.CommonStringValidationErrorCodes=Fj,C.ComparisonOperatorTypes=dr,C.ConditionDependencyField=J4,C.ConditionState=Ma,C.ContinueStatementDependencyField=K4,C.ContinueStatementState=ui,C.CreateNewInputIds=Yg,C.CreateNewOutputIds=zg,C.DRAGGABLE_CALLABLE_TYPES=B0,C.DRAGGABLE_CALLER_TYPES=jR,C.DRAGGABLE_ELEMENT_TYPES=Rf,C.DRAGGABLE_EXECUTABLE_TYPES=o9,C.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=wf,C.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=L0,C.DataTypeCompatibilityTypes=_s,C.DataTypeDependencyField=zT,C.DataTypeParentChildRelation=Hr,C.DataTypeState=Ji,C.DefinitionEntityDependencyField=Vy,C.DefinitionEntityState=fa,C.DynamicValueTypes=Ae,C.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=Cye,C.ENTITIES_WITH_VALLUES_EXPLANATION=hy,C.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=ye,C.ENTITY_RECUSION_OPTIONS_DEFAULTS=Ne,C.ENTITY_TYPES=l9,C.ENTITY_WITH_CODE_NAMES_TYPES=xR,C.ENTITY_WITH_DECLARATION_TYPES=n9,C.ENTITY_WITH_LOGIC_SCOPE_TYPES=Ar,C.ENTITY_WITH_NAMES_TYPES=UR,C.ENTITY_WITH_PARENT_TYPES=i9,C.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=BR,C.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=s9,C.ENTITY_WITH_VALUE_TYPES=N0,C.ENTRY_POINT_ENTITIES_EXPLANATION=pp,C.ENTRY_POINT_TYPES=Ht,C.ERROR_PROPERTY_HEIGHT=Gy,C.EVENT_TYPES=Al,C.EXECUTABLE_TYPES=a9,C.EXECUTION_OPERATIONS=Hg,C.EfimeralValueStore=Rp,C.EndpointEntity=rx,C.EntityError=St,C.EntityErrorSeverity=Z,C.EntityGenerationError=Q,C.EntityGenerationErrorCode=S,C.EntityInstanceErrorCode=se,C.EntityOperations=rr,C.EntityType=f,C.EntityWithLogicScopeClass=jye,C.EntityWithValueClass=Mye,C.EntryPointEntityClass=Lye,C.Execution=iA,C.ExecutionOperations=tr,C.ExecutionState=rA,C.ExecutionTerminationType=Se,C.ExplicitInfrastructureResource=mA,C.FunctionCallDependencyField=Mj,C.FunctionCallState=Za,C.FunctionDeclarationDependencyField=L4,C.FunctionDeclarationState=Va,C.GET_PROJECT_OPTIONS_DEFAULTS=wp,C.GLOBAL_EVENT_DECLARATIONS=MP,C.GetLastInListOperationInputIds=K_,C.GetLastInListOperationOutputIds=k_,C.GlobalEventNames=kn,C.GlobalEventState=Ba,C.HTTPOperations=li,C.HTTPStatucCodeValidationErrorCodes=ex,C.HTTP_OPERATIONS=rC,C.ImplicitGlobalInfrastructureResource=vA,C.InfrastructureResource=yA,C.InfrastructureResourceStatus=Mx,C.InputMapDependencyField=hj,C.InputMapState=Ds,C.InstalledProjectState=Fa,C.InternalCallDependencyField=pj,C.InternalCallState=Ga,C.JoinListOperationInputIds=l_,C.JoinListOperationOutputIds=d_,C.LIST_OPERATIONS=hg,C.ListOperations=lt,C.LiteralValueDependencyField=$4,C.LiteralValueState=Ei,C.LoopDependencyField=S4,C.LoopState=Ti,C.LoopTypes=xe,C.MAIN_VALUE_PROPERTY_HEADER_HEIGHT=Fy,C.MAIN_VALUE_SUB_PROPERTY_HEIGHT=Eme,C.NESTED_PROPERTY_HEIGHT=_x,C.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=Sa,C.NUMBER_OPERATIONS=I1,C.NumberOperations=lr,C.OPERATION_DECLARATIONS=iC,C.OperationDependencyField=j4,C.OperationState=Na,C.OutputMapDependencyField=mj,C.OutputMapParentChildRelation=bl,C.OutputMapState=Ys,C.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=yy,C.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=ka,C.PASS_THROUGH_CALLABLE_TYPES=Qt,C.PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=MR,C.PLACEHOLDER_VALUE_STORE_CLIENT=nx,C.PROPERTY_HEIGHT=xy,C.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=_b,C.PUBLISHING_DISABLED_REASONS=jx,C.ParallelExecutionOperation=YU,C.PassThroughCallableEntityClass=Bye,C.PersistedEntity=QU,C.PersistedEntityMethods=ss,C.PrimitiveEntityState=Vi,C.PrimitiveTypes=X,C.ProjectState=P,C.ProjectStateEvents=mr,C.PropertyDependencyField=V4,C.PropertyState=oa,C.PublicationRun=$me,C.PublicationStep=Bx,C.READABLE_ENTITY_TYPES=sA,C.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=HU,C.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=Dhe,C.ReturnDeclarationDependencyField=x4,C.ReturnDeclarationState=Pi,C.ReturnStatementDependencyField=XT,C.ReturnStatementState=La,C.SQLAST=lhe,C.STANDALONE_CONDITIONS=RP,C.STATIC_PROPERTY_HEIGHT=gx,C.STRING_OPERATIONS=o_,C.ScopeCompatibilityType=Oy,C.SearchDependencyField=lj,C.SearchState=xa,C.SequentialExecutionOperation=XU,C.SequentialExecutionOperationInputIds=Mg,C.SequentialExecutionOperationOutputIds=jg,C.SharedEntityErrorCode=oe,C.SharedStateFunctionality=WU,C.SplitListOperationInputIds=R_,C.SplitListOperationOutputIds=__,C.StandaloneOperatorTypes=Lr,C.StringOperations=yt,C.TERMINATION_TYPES=ir,C.Traverser=ca,C.USER_MANAGED_ENTITY_TYPES=FR,C.UserManagedEntityStateTemplate=Oye,C.VALUE_READING_ENTITIES_EXPLANATION=Rb,C.VALUE_READING_TYPES=qn,C.VALUE_WRITING_ENTITIES_EXPLANATION=gj,C.VALUE_WRITING_TYPES=Dr,C.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=wb,C.VARIABLE_TYPES=rt,C.ValueAutogenerationType=gr,C.ValueDescriptorDependencyField=Ij,C.ValueDescriptorParentChildRelation=ue,C.ValueDescriptorState=zs,C.ValueReadingEntityClass=Ap,C.ValueWritingEntityClass=Ip,C.VariableDeclarationDependencyField=Y4,C.VariableDeclarationState=Ua,C.VariableInputMapState=yhe,C.VariableInstanceDependencyField=eb,C.VariableInstanceState=ja,C.VariableOutputMapState=Ehe,C.WaitOperation=zU,C.WaitOperationInputIds=Og,C.WaitOperationOutputIds=$g,C.actionDescriptorValidation=vpe,C.addDisabledReasons=Dme,C.afterLiteralValueAsTypeChangeSideEffects=bx,C.afterLiteralValueAsTypeDeleteSideEffects=Tx,C.afterLiteralValueChangeSideEffects=vx,C.afterLiteralValueDeleteSideEffects=mx,C.aggregateVariableInputsNextValues=_p,C.aggregateVariableInputsValues=My,C.appendToListOperation=Cf,C.appendToListOperationElementToAppendArgument=H0,C.appendToListOperationElementToAppendArgumentParentRef=dg,C.appendToListOperationElementToAppendArgumentRef=sg,C.appendToListOperationError=fg,C.appendToListOperationErrorParentRef=pg,C.appendToListOperationListArgument=W0,C.appendToListOperationListArgumentParentRef=lg,C.appendToListOperationListArgumentRef=rg,C.appendToListOperationListDataType=ig,C.appendToListOperationResultListDataType=og,C.appendToListOperationResultListReturn=cg,C.appendToListOperationResultListReturnParentRef=ug,C.appendToListOperationResultListReturnRef=ag,C.appendToListOperationSecondListDataType=ng,C.applyNewScope=Ue,C.argumentDeclarationValidation=bhe,C.asGenerationActionExample=_n,C.assembleAndAddLiteralValueFromDataType=Qs,C.assembleStandaloneLiteralValueFromDataType=Ye,C.booleanPrototype=Sn,C.breakStatementValidation=Ahe,C.calculateCardSize=$x,C.calculateMethodCardSize=Ox,C.calculateNewParentBasedOnCallers=Nb,C.capitalizeFirstLetter=Qr,C.changeSetJSONRecordToUniqueIds=tpe,C.checkAreDataTypesCompatible=gs,C.checkAreDefinitionEntitiesCompatibleAsDataType=p4,C.checkArePropertiesCompatibleAsDataType=c4,C.checkExtendsBaseEntity=$y,C.checkHasBaseEntity=Yi,C.checkHasMetadataChanged=Tr,C.checkImplementationsOverlap=pa,C.checkImplementsBaseEntity=sye,C.checkIsBranchDependentButNotDirectlyOnBranch=Ko,C.checkIsBranchDependentOnBranch=Lb,C.checkIsBuiltIn=Zb,C.checkIsCallableEntityReachable=bp,C.checkIsCanvasEntity=rye,C.checkIsDefEntityInlineDeclaredForSearchOutputType=vb,C.checkIsDetachedBranch=jU,C.checkIsDetachedBranchShallow=kb,C.checkIsEmptyValue=ax,C.checkIsGlobalVariable=eye,C.checkIsGloballyDeclared=Kb,C.checkIsLiteralValueEmpty=Hb,C.checkIsMethod=qb,C.checkIsNestedScope=Cy,C.checkIsRequiredValue=So,C.checkScopeCompatibility=Tp,C.cloneProject=ame,C.conditionValidation=Epe,C.continueStatementValidation=fpe,C.convertToAbstract=jhe,C.convertToNonAbstract=Uhe,C.convertToNonStatic=Fhe,C.convertToStatic=xhe,C.countedLoopActionDescriptor=Au,C.countedLoopActionDescriptorDynamicReturnDeclaration=UO,C.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=jO,C.countedLoopActionDescriptorStringArgumentDeclaration=MO,C.countedLoopActionDescriptorStringArgumentDeclarationDataType=LO,C.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=VO,C.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=PO,C.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=NO,C.countedLoopActionDescriptorStringArgumentDeclarationParentRef=BO,C.countedLoopBodyActionDescriptor=Ff,C.countedLoopBodyActionDescriptorAnyDynamicArgument=kO,C.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=KO,C.countedLoopBodyActionDescriptorAnyDynamicReturn=SO,C.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=qO,C.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=uv,C.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=FO,C.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=xO,C.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=GO,C.createDefinitionEntityFromJSONObject=by,C.createEntityError=nt,C.createNestedDataTypeForEntity=xj,C.createNewInstanceOperation=yo,C.createNewInstanceOperationEntityToInstanciateArgument=nD,C.createNewInstanceOperationEntityToInstanciateArgumentRef=rD,C.createNewInstanceOperationEntityToInstanciateDataType=iD,C.createNewInstanceOperationError=dD,C.createNewInstanceOperationErrorParentRef=lD,C.createNewInstanceOperationNewEntityDataArgument=tD,C.createNewInstanceOperationNewEntityDataArgumentDataType=eD,C.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=Qg,C.createNewInstanceOperationNewEntityDataArgumentParentRef=Xg,C.createNewInstanceOperationOutputEntityDeclaration=oD,C.createNewInstanceOperationOutputEntityDeclarationParentRef=aD,C.createNewInstanceOperationRef=sD,C.createSemanticId=R4,C.createStateFromGenerationTargetType=Dye,C.createStateFromType=kt,C.createStateFromTypeAndSubscribe=ee,C.cronJobBuiltInBaseEntity=Sf,C.cronJobBuiltInBaseEntityExpressionProperty=vP,C.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=v9,C.cronJobBuiltInBaseEntityExpressionPropertyRef=yP,C.cronJobBuiltInBaseEntityRef=mP,C.cronJobTriggeredFunctionDeclarationBlueprint=Rv,C.cronJobTriggeredFunctionDeclarationBlueprintParentRef=fP,C.dataTypeCompatibilityToErrorExplanation=Lj,C.dataTypeValidation=ope,C.datePrototype=pn,C.dateValueAutogenerationSchema=NE,C.definitionEntityToZodSchema=nV,C.definitionEntityValidation=wye,C.deletePersistedEntityMethod=wv,C.deletePersistedEntityMethodParentRef=X$,C.deleteRootProject=lme,C.emitSideEffects=C4,C.emptyCondition=gv,C.emptyConditionArgument=wP,C.emptyConditionRef=IP,C.endpointBuiltInBaseEntity=Gi,C.endpointBuiltInBaseEntityRef=zO,C.endpointBuiltInBaseEntityRefFour=N$,C.endpointBuiltInBaseEntityRefThree=a$,C.endpointBuiltInBaseEntityRefTwo=r$,C.endpointBuiltInCorsProperty=XO,C.endpointBuiltInCorsPropertyDataType=YO,C.endpointBuiltInCorsPropertyDataTypeRef=WO,C.endpointBuiltInCorsPropertyRef=HO,C.endpointBuiltInMethodProperty=pv,C.endpointBuiltInMethodPropertyDataType=n$,C.endpointBuiltInMethodPropertyDataTypeRef=i$,C.endpointBuiltInMethodPropertyRef=s$,C.endpointBuiltInPathProperty=cv,C.endpointBuiltInPathPropertyDataType=t$,C.endpointBuiltInPathPropertyDataTypeRef=QO,C.endpointBuiltInPathPropertyRef=e$,C.endpointPathParamsArgumentDeclaration=hv,C.endpointPathParamsArgumentDeclarationRef=m$,C.endpointPathParamsVariableDataType=v$,C.endpointPathParamsVariableDataTypeRef=y$,C.endpointReachedTriggerActionDescriptor=bv,C.endpointReachedTriggerActionDescriptorRef=E$,C.endpointReachedTriggerActionDescriptorRefFour=A$,C.endpointReachedTriggerActionDescriptorRefThree=b$,C.endpointReachedTriggerActionDescriptorRefTwo=T$,C.endpointRequestBodyArgumentDeclaration=mv,C.endpointRequestBodyArgumentDeclarationRef=u$,C.endpointRequestBodyVariableDataType=c$,C.endpointRequestHeadersArgumentDeclaration=fv,C.endpointRequestHeadersArgumentDeclarationRef=l$,C.endpointRequestHeadersVariableDataType=d$,C.endpointRequestHeadersVariableDataTypeRef=o$,C.endpointRequestQueryParamsArgumentDeclaration=yv,C.endpointRequestQueryParamsArgumentDeclarationRef=f$,C.endpointRequestQueryParamsVariableDataType=h$,C.endpointRequestQueryParamsVariableDataTypeRef=p$,C.endpointResponseBodyDataType=P$,C.endpointResponseBodyReturnDeclaration=Tv,C.endpointResponseBodyReturnDeclarationRef=$$,C.endpointResponseCodeDataType=w$,C.endpointResponseCodeReturnDeclaration=vv,C.endpointResponseCodeReturnDeclarationDefaultValueParentRef=_$,C.endpointResponseCodeReturnDeclarationRef=I$,C.endpointResponseHeadersDataType=C$,C.endpointResponseHeadersDataTypeRef=g$,C.endpointResponseHeadersReturnDeclaration=Ev,C.endpointResponseHeadersReturnDeclarationRef=D$,C.endpointReturnStatementRef=R$,C.endpointReturnStatementRefThree=V$,C.endpointReturnStatementRefTwo=O$,C.enrichFromKnownEntities=hp,C.enumOptionsProperty=SR,C.enumOptionsPropertyDataType=kR,C.enumOptionsPropertyDataTypeRef=GR,C.enumOptionsPropertyRef=KR,C.enumPrototype=Zn,C.enumPrototypeRef=qR,C.errorCodeToMessage=$p,C.executionBuiltInBaseEntity=Zf,C.executionBuiltInEntityAbortMethod=_v,C.executionBuiltInEntityAbortMethodParentRef=EP,C.filterOutDuplicateEntities=R,C.filterOutDuplicateErrors=voe,C.findEntityFromKeys=$b,C.findReferenceToSelfInList=iU,C.findReferencesToSelfInProject=Jhe,C.flattenActionDescriptor=nU,C.flattenArgumentDeclaration=aU,C.flattenBreakStatement=oU,C.flattenBuiltInBaseEntity=lU,C.flattenCalls=Cs,C.flattenCanvasAncestorsUntil=vd,C.flattenCondition=dU,C.flattenContinueStatement=uU,C.flattenDataType=pU,C.flattenDefinitionEntity=cU,C.flattenDefinitionEntityExtensionAndImplementationTypes=bd,C.flattenDefinitionEntityExtensionTypes=mp,C.flattenDefinitionEntityExtensions=xb,C.flattenDefinitionEntityImplementations=Fb,C.flattenDefinitionEntityImplementionTypes=yp,C.flattenDerivedCanvasEntities=Hi,C.flattenDetachedBranch=xU,C.flattenElementCalls=ct,C.flattenElementCallsOnTheSameScope=Zhe,C.flattenEntity=he,C.flattenFunctionCall=fU,C.flattenFunctionDeclaration=hU,C.flattenGlobalEvent=yU,C.flattenInputMap=mU,C.flattenInstalledProject=vU,C.flattenInternalCall=EU,C.flattenLiteralValue=TU,C.flattenLoop=bU,C.flattenOperation=AU,C.flattenOutputMap=IU,C.flattenPrimitiveEntity=wU,C.flattenProject=RU,C.flattenProjectElements=rU,C.flattenProperty=_U,C.flattenRelatedCanvasElementsOnTheLeft=MU,C.flattenRelatedCanvasElementsOnTheRight=gy,C.flattenReturnDeclaration=gU,C.flattenReturnStatement=DU,C.flattenSearch=CU,C.flattenValueDescriptor=OU,C.flattenVariableDeclaration=$U,C.flattenVariableInstance=PU,C.flattenVariableReads=tU,C.flattenVariableWrites=eU,C.flattenVariables=zt,C.fromChangeSetToRecordChangeSet=uye,C.fromLiteralValueTypeToPrimitiveType=yb,C.fromPublishingDisabledCodeToReadable=Nme,C.fromZodParseToEntityGenerationErrors=Tb,C.functionCallValidation=Bhe,C.functionDeclarationValidation=ape,C.generate=nh,C.generateActionExample=Che,C.generateExecutionDataType=Jce,C.generateIdFromStrategy=Ir,C.generateMutablePropertiesExplanation=cy,C.generatePlaceholderValueStore=dme,C.generateRandomBoolean=bV,C.generateRandomDate=dV,C.generateRandomDateAfter=aV,C.generateRandomDateBefore=oV,C.generateRandomDateBetweenRange=lV,C.generateRandomNumber=yV,C.generateRandomNumberAfter=pV,C.generateRandomNumberBefore=fV,C.generateRandomNumberBetweenRange=hV,C.generateRandomText=TV,C.generateRandomTextAfter=mV,C.generateRandomTextBefore=vV,C.generateRandomTextBetweenRange=EV,C.generateStandaloneIfDefault=ume,C.generateUniqueUUID=cV,C.getAllActionDescriptorsForConditions=Ey,C.getAllActionDescriptorsForGlobalEvents=my,C.getAllActionDescriptorsForLoops=vy,C.getAllActionDescriptorsForOperations=Vhe,C.getAllBuiltInEntityIds=Os,C.getAllGloballyDeclaredFunctionDeclarationsExplanation=Pj,C.getBaseBuiltInEntities=Ai,C.getBaseSchemaBasedOnType=wj,C.getBuiltInEntityOwner=Wa,C.getCallableEntityReferenceSchema=Xr,C.getCallableEntityTypeSchema=XL,C.getCalledBy=fs,C.getCallerEntityReferenceSchema=Ade,C.getCallerEntityTypeSchema=bde,C.getCalls=wy,C.getCanvasEntitiesDerivedFromInternalCalls=BU,C.getCanvasEntitiesDerivedFromWrites=Td,C.getCanvasEntityDerivedFromValueReadingEntity=_y,C.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=LU,C.getCanvasEntityReferenceSchema=Ude,C.getCanvasEntityTypeSchema=jde,C.getChildrenEntityWithValues=Zj,C.getColumnProperties=Ad,C.getCommonAncestor=Bb,C.getCommonChildren=Ay,C.getDatabaseEntities=aye,C.getDatabaseEntity=lye,C.getDeclaration=di,C.getDeclarationOutputedError=pye,C.getDeepestScope=GU,C.getDefaultRelationalDatabaseEntityOrFirst=kU,C.getDraggableCallableEntityReferenceSchema=eB,C.getDraggableCallableEntityTypeSchema=QL,C.getDraggableCallerEntityReferenceSchema=wde,C.getDraggableCallerEntityTypeSchema=Ide,C.getDraggableExecutableEntityReferenceSchema=Dde,C.getDraggableExecutableEntityTypeSchema=gde,C.getDraggablePassThroughCallableEntityReferenceSchema=Gh,C.getDraggablePassThroughCallableEntityTypeSchema=Fh,C.getDraggablePlayableEntityReferenceSchema=Vde,C.getDraggablePlayableEntityTypeSchema=Pde,C.getEntitiesCreatedSinceInitialization=By,C.getEntitiesToPropagateValuesTo=en,C.getEntityArgumentDeclarations=Ub,C.getEntityInputMaps=VU,C.getEntityOutputMaps=zhe,C.getEntityReferenceSchema=Mde,C.getEntityReturnDeclarations=NU,C.getEntityTypeSchema=Bde,C.getEntityWithLogicScopeReferenceSchema=sa,C.getEntityWithLogicScopeTypeSchema=Cde,C.getEntityWithValueReferenceSchema=zL,C.getEntityWithValueTypeSchema=Tde,C.getEntryPointEntityReferenceSchema=Sr,C.getEntryPointEntityTypeSchema=$a,C.getEventEntityReferenceSchema=Uh,C.getEventEntityTypeSchema=jh,C.getEventNameFromDefinition=Vme,C.getExecutableEntityReferenceSchema=_de,C.getExecutableEntityTypeSchema=Rde,C.getExtendedBuiltInEntity=Xhe,C.getExtendedDefinitionEntity=Dy,C.getFirstNonLoopScopeOwner=Vr,C.getGenerationTargetSchemaBasedOnType=Rj,C.getHTTPAPINameFromProjectId=Nx,C.getHeadIfPartOfDetachedBranch=UU,C.getHighestScope=FU,C.getImplementedBuiltInEntity=Qhe,C.getIsInteractive=vp,C.getLastInListOperation=J0,C.getLastInListOperationError=Q_,C.getLastInListOperationErrorParentRef=X_,C.getLastInListOperationInputListArgument=H_,C.getLastInListOperationInputListArgumentParentRef=W_,C.getLastInListOperationInputListArgumentRef=q_,C.getLastInListOperationInputListDataType=S_,C.getLastInListOperationOutputElementDataType=J_,C.getLastInListOperationOutputElementReturn=z_,C.getLastInListOperationOutputElementReturnParentRef=Y_,C.getLastInListOperationOutputElementReturnRef=Z_,C.getLinkedEntitiesFromArgumentDeclaration=She,C.getLiteralValueNameFromDataType=Fo,C.getLowestPersistedEntityImplementation=Gb,C.getParentCallableEntity=kj,C.getParentCallerEntity=Sj,C.getParentCanvasEntities=ei,C.getParentCanvasEntity=cr,C.getParentCanvasEntityFromTransfer=Iy,C.getParentEntryPoint=Ghe,C.getParentPassthroughCallableEntity=qj,C.getPassThroughCallableEntityReferenceSchema=ur,C.getPassThroughCallableEntityTypeSchema=xh,C.getPeristedEntities=nye,C.getPlayableEntityReferenceSchema=$de,C.getPlayableEntityTypeSchema=Ode,C.getProject=ome,C.getPrototypeByType=Ep,C.getRecusriveParentsIds=Py,C.getReferenceEntityId=W,C.getReferencedEntitiesStateOrErrors=fy,C.getReferencedEntityStateOrErrors=bb,C.getReferencedIds=Ed,C.getRelatedCanvasElementsOnTheLeft=Ja,C.getRelatedCanvasElementsOnTheLeftFromTransfer=Whe,C.getRelatedCanvasElementsOnTheRight=Xs,C.getRelationalDBInstanceNameFromEntityId=Lx,C.getRootEntryPointScopeOwner=Sb,C.getScopeOwner=Ii,C.getStateClassFromType=dye,C.getStepNameFromDefinition=Pme,C.getTerminationReferenceSchema=Lde,C.getTerminationTypeSchema=Nde,C.getTopLevelParentEntityId=qU,C.getTouchedCanvasEntitiesFromChangeSet=cye,C.getUsedArgFromDeclaration=Hhe,C.getUsedReturnFromDeclaration=Yhe,C.getValueReadingEntityReferenceSchema=YL,C.getValueReadingEntityTypeSchema=ia,C.getValueWritingEntityReferenceSchema=Ede,C.getValueWritingEntityTypeSchema=ic,C.getVariableFromInputMapping=Wj,C.getVariableFromReturnVariablePointer=zj,C.getVariableReferenceSchema=Oa,C.getVariableTypeSchema=Lo,C.getVariablesFromArgumentDeclarations=Ry,C.getVariablesFromInputMaps=Hj,C.getVariablesFromOutputMapping=Xj,C.getVariablesFromOutputMaps=Qj,C.getVariablesFromReturnDeclarations=Yj,C.getVariablesInSameOrHigherScope=UT,C.getWrites=jb,C.globalEventValidation=hpe,C.groupCallsBasedOnParallelizableExecution=Mb,C.handleAfterEntityImplementationSideEffects=Uj,C.handleBeforeEntityImplementationSideEffects=jj,C.handleLiteralValueChange=cme,C.handleLiteralValueDelete=Ex,C.handleValueAsTypeChange=pme,C.handleValueAsTypeDelete=Ax,C.httpRequestBodyArgument=Vf,C.httpRequestBodyArgumentRef=BD,C.httpRequestBodyDataType=MD,C.httpRequestHeadersArgument=Pf,C.httpRequestHeadersArgumentRef=ND,C.httpRequestHeadersDataType=LD,C.httpRequestMethodArgument=Of,C.httpRequestMethodArgumentRef=PD,C.httpRequestMethodDataType=VD,C.httpRequestMethodDataTypeRef=OD,C.httpRequestOperation=vu,C.httpRequestOperationErrorValueDescriptor=tv,C.httpRequestOperationErrorValueDescriptorDatatype=tC,C.httpRequestOperationErrorValueDescriptorRef=eC,C.httpRequestOperationRef=YD,C.httpRequestOperationRefEight=XD,C.httpRequestOperationRefFive=WD,C.httpRequestOperationRefFour=JD,C.httpRequestOperationRefNine=QD,C.httpRequestOperationRefSeven=zD,C.httpRequestOperationRefSix=HD,C.httpRequestOperationRefThree=ZD,C.httpRequestOperationRefTwo=SD,C.httpRequestQueryParamsArgument=ev,C.httpRequestQueryParamsArgumentRef=DD,C.httpRequestQueryParamsDataType=CD,C.httpRequestVariableURLArgument=$f,C.httpRequestVariableURLArgumentRef=_D,C.httpRequestVariableURLDataType=gD,C.httpRequestVariableURLDataTypeRef=wD,C.httpResponseBodyReturnDataType=qD,C.httpResponseBodyReturnDataTypeRef=KD,C.httpResponseBodyReturnReturn=Bf,C.httpResponseBodyReturnReturnRef=kD,C.httpResponseCodeDataType=UD,C.httpResponseCodeReturn=Nf,C.httpResponseCodeReturnRef=jD,C.httpResponseHeadersDataType=GD,C.httpResponseHeadersDataTypeRef=xD,C.httpResponseHeadersReturn=Lf,C.httpResponseHeadersReturnRef=FD,C.httpStatusCodeValueValidation=tx,C.hydrateOrDiscardLiteralValue=ox,C.implement=Ty,C.inferArgumentDeclarationDataType=f4,C.inferDataType=Ws,C.inferInputMapDataType=BT,C.inferOutputMapDataType=jT,C.inferPropertyDataType=m4,C.inferReturnDeclarationDataType=MT,C.inferValueDescriptorDataType=v4,C.inferVariableDeclarationDataType=y4,C.inferVariableInstanceDataType=h4,C.initBaseProjectEntity=Ly,C.initProject=sx,C.initProjectFromFetchResult=ix,C.inputMapValidation=hhe,C.installedProjectValidation=phe,C.internalCallValidation=fhe,C.isPromise=Ob,C.isUUID=_4,C.iterateOverListActionDescriptorListArgumentDeclaration=BC,C.iterateOverListActionDescriptorListArgumentDeclarationDataType=NC,C.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=VC,C.iterateOverListActionDescriptorListArgumentDeclarationParentRef=LC,C.iterateOverListLoopActionDescriptor=Ia,C.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=jC,C.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=MC,C.iterateOverListLoopBodyActionDescriptor=bu,C.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=ZC,C.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=SC,C.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=WC,C.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=JC,C.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=xf,C.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=xC,C.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=UC,C.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=FC,C.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=qC,C.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=KC,C.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=GC,C.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=kC,C.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=QC,C.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=zC,C.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=YC,C.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=XC,C.iterateOverObjectKeysLoopActionDescriptor=gl,C.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=tO,C.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=eO,C.iterateOverObjectKeysLoopBodyActionDescriptor=av,C.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=uO,C.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=dO,C.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=pO,C.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=cO,C.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=nv,C.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=iO,C.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=rO,C.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=sO,C.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=lO,C.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=aO,C.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=nO,C.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=oO,C.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=vO,C.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=yO,C.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=hO,C.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=mO,C.iterateOverObjectValuesLoopActionDescriptor=Dl,C.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=TO,C.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=EO,C.iterateOverObjectValuesLoopBodyActionDescriptor=lv,C.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=CO,C.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=DO,C.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=$O,C.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=OO,C.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=ov,C.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=AO,C.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=bO,C.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=IO,C.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=gO,C.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=RO,C.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=wO,C.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=_O,C.iterateOverStringActionDescriptorDynamicReturnDeclaration=bC,C.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=TC,C.iterateOverStringActionDescriptorStringArgumentDeclaration=EC,C.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=mC,C.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=yC,C.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=vC,C.iterateOverStringLoopActionDescriptor=Tu,C.iterateOverStringLoopBodyActionDescriptor=Uf,C.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=CC,C.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=DC,C.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=$C,C.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=OC,C.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=iv,C.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=IC,C.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=AC,C.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=wC,C.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=sv,C.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=_C,C.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=RC,C.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=gC,C.joinListOperation=q0,C.joinListOperationError=w_,C.joinListOperationErrorParentRef=I_,C.joinListOperationFirstListArgument=v_,C.joinListOperationFirstListArgumentParentRef=m_,C.joinListOperationFirstListArgumentRef=u_,C.joinListOperationFirstListDataType=c_,C.joinListOperationResultListDataType=y_,C.joinListOperationResultListReturn=A_,C.joinListOperationResultListReturnParentRef=b_,C.joinListOperationResultListReturnRef=h_,C.joinListOperationSecondListArgument=T_,C.joinListOperationSecondListArgumentParentRef=E_,C.joinListOperationSecondListArgumentRef=p_,C.joinListOperationSecondListDataType=f_,C.joinListWithLastSeparator=ke,C.joinStringsOperation=mu,C.joinStringsOperationDynamicStringArgument=k1,C.joinStringsOperationDynamicStringArgumentParentRef=K1,C.joinStringsOperationDynamicStringArgumentRef=F1,C.joinStringsOperationDynamicStringDataType=G1,C.joinStringsOperationError=x1,C.joinStringsOperationErrorParentRef=U1,C.joinStringsOperationFirstStringArgument=gf,C.joinStringsOperationFirstStringArgumentParentRef=O1,C.joinStringsOperationFirstStringArgumentRef=w1,C.joinStringsOperationFirstStringDataType=R1,C.joinStringsOperationResultStringDataType=C1,C.joinStringsOperationResultStringReturn=yu,C.joinStringsOperationResultStringReturnParentRef=j1,C.joinStringsOperationResultStringReturnRef=D1,C.joinStringsOperationSecondStringArgument=Df,C.joinStringsOperationSecondStringArgumentParentRef=M1,C.joinStringsOperationSecondStringArgumentRef=_1,C.joinStringsOperationSecondStringDataType=g1,C.joinStringsOperationSeparatorStringArgument=B1,C.joinStringsOperationSeparatorStringArgumentParentRef=L1,C.joinStringsOperationSeparatorStringArgumentRef=$1,C.joinStringsOperationSeparatorStringDataType=N1,C.joinStringsOperationSeparatorStringDataTypeDefaultValue=V1,C.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=P1,C.keyValuePrototype=wl,C.literalValueValidation=rpe,C.loopValidation=mpe,C.lowercaseFirstLetter=od,C.manualFlowActionDescriptorDeclarationArgumentDeclaration=rv,C.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=lC,C.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=oC,C.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=dC,C.manualFlowLoopActionDescriptor=Mf,C.manualFlowLoopActionDescriptorDynamicReturnDeclaration=aC,C.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=nC,C.manualFlowLoopBodyActionDescriptor=jf,C.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=cC,C.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=uC,C.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=fC,C.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=pC,C.mapActionDescriptorToTypeItRepresents=iye,C.mapRecord=sU,C.mergeArraysOfStringsWithoutDuplicates=gme,C.mergeEntityErrorsList=Eoe,C.mergeListOfEntities=tye,C.methodDefaultValue=$D,C.mockClientProject=CE,C.moreThanOrEqualCondition=Vl,C.moreThanOrEqualConditionLeftHandArgument=CP,C.moreThanOrEqualConditionLeftHandArgumentDataType=gP,C.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=_P,C.moreThanOrEqualConditionLeftHandArgumentParentRef=DP,C.moreThanOrEqualConditionRightHandArgument=VP,C.moreThanOrEqualConditionRightHandArgumentDataType=$P,C.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=OP,C.moreThanOrEqualConditionRightHandArgumentParentRef=PP,C.noSpacesOrDashesValueValidation=Kj,C.noSpacesValueValidation=Gj,C.notEmptyCondition=Ao,C.notEmptyConditionArgument=AP,C.notEmptyConditionRef=bP,C.nullPrototype=M0,C.numberAdditionOperation=_f,C.numberAdditionOperationDynamicSummandArgument=n1,C.numberAdditionOperationDynamicSummandArgumentType=s1,C.numberAdditionOperationDynamicSummandArgumentTypeParentRef=i1,C.numberAdditionOperationError=r1,C.numberAdditionOperationErrorParentRef=t1,C.numberAdditionOperationFirstNumberArgument=j0,C.numberAdditionOperationFirstNumberArgumentRef=JR,C.numberAdditionOperationFirstNumberDataType=WR,C.numberAdditionOperationRef=QR,C.numberAdditionOperationRefThree=x0,C.numberAdditionOperationRefTwo=e1,C.numberAdditionOperationResultNumberDataType=XR,C.numberAdditionOperationResultNumberReturn=F0,C.numberAdditionOperationResultNumberReturnRef=zR,C.numberAdditionOperationSecondNumberArgument=U0,C.numberAdditionOperationSecondNumberArgumentRef=HR,C.numberAdditionOperationSecondNumberDataType=YR,C.numberPrototype=ut,C.numberSubtractionOperation=K0,C.numberSubtractionOperationDynamicSubtrahendArgument=A1,C.numberSubtractionOperationDynamicSubtrahendArgumentType=b1,C.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=T1,C.numberSubtractionOperationError=E1,C.numberSubtractionOperationErrorParentRef=v1,C.numberSubtractionOperationFirstNumberArgument=p1,C.numberSubtractionOperationFirstNumberArgumentRef=a1,C.numberSubtractionOperationFirstNumberDataType=o1,C.numberSubtractionOperationRef=G0,C.numberSubtractionOperationRefThree=y1,C.numberSubtractionOperationRefTwo=f1,C.numberSubtractionOperationResultNumberDataType=c1,C.numberSubtractionOperationResultNumberReturn=m1,C.numberSubtractionOperationResultNumberReturnRef=u1,C.numberSubtractionOperationSecondNumberArgument=h1,C.numberSubtractionOperationSecondNumberArgumentRef=l1,C.numberSubtractionOperationSecondNumberDataType=d1,C.numberValueAutogenerationSchema=VE,C.operationValidation=upe,C.orderEntitiesForTraversal=Mhe,C.outputMapValidation=vhe,C.parallelExecutionOperation=Ks,C.parallelExecutionOperationError=Cg,C.parallelExecutionOperationErrorParentRef=Dg,C.parallelExecutionOperationListOfExecutionResultsDataType=Rg,C.parallelExecutionOperationListOfExecutionResultsReturn=z0,C.parallelExecutionOperationListOfExecutionResultsReturnRef=wg,C.parallelExecutionOperationListOfFunctionsArgument=Y0,C.parallelExecutionOperationListOfFunctionsArgumentDatatype=Ig,C.parallelExecutionOperationListOfFunctionsArgumentRef=Ag,C.parallelExecutionOperationListOfFunctionsBlueprint=bg,C.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=Eg,C.parallelExecutionOperationListOfFunctionsBlueprintDynamicInputParentRef=vg,C.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=mg,C.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutputParentRef=yg,C.parallelExecutionOperationListOfFunctionsBlueprintParentRef=Tg,C.parallelExecutionOperationRef=_g,C.parallelExecutionOperationRefThree=gg,C.persistedBuiltInBaseEntity=si,C.persistedBuiltInBaseEntityDatabaseProperty=Ol,C.persistedBuiltInBaseEntityDatabasePropertyDataType=tP,C.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=h9,C.persistedBuiltInBaseEntityDatabasePropertyParentRef=rP,C.persistedBuiltInBaseEntityDatabasePropertyRef=eP,C.persistedBuiltInBaseEntityPrimaryKeyProperty=$l,C.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=uP,C.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=sP,C.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=iP,C.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=cP,C.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=dP,C.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=aP,C.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=nP,C.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=lP,C.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=oP,C.printEntity=Vb,C.processOutputGlobalValueDescriptorDataType=xP,C.processOutputGlobalValueDescriptorReturn=Wf,C.processOutputGlobalValueDescriptorReturnRef=UP,C.projectPublicationCompletedGlobalEvent=Jf,C.propagateNewInputOrOutputMapValueAsTypeToParentVariable=Op,C.propagateNewInputOrOutputMapValueToParentVariable=Cp,C.propagateNewStaticPropertyValueAsTypeToVariables=Jo,C.propagateNewStaticPropertyValueToVariables=Zo,C.propertyToZodSchema=sV,C.propertyValidation=Qce,C.readValueFromWritter=Id,C.rebaseStack=YT,C.relationalDatabaseBuiltInBaseEntity=zr,C.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=Iv,C.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=Y$,C.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=H$,C.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=z$,C.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=W$,C.relationalDatabaseBuiltInBaseEntityDefaultProperty=Av,C.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=J$,C.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=S$,C.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=Z$,C.relationalDatabaseBuiltInBaseEntityIdentifierProperty=Gf,C.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=M$,C.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=L$,C.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=B$,C.relationalDatabaseBuiltInBaseEntityMinSizeProperty=qf,C.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=q$,C.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=K$,C.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=k$,C.relationalDatabaseBuiltInBaseEntityPasswordProperty=kf,C.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=F$,C.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=f9,C.relationalDatabaseBuiltInBaseEntityPasswordPropertyDefaultValueParentRef=G$,C.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=x$,C.relationalDatabaseBuiltInBaseEntityRef=Cl,C.relationalDatabaseBuiltInBaseEntityUsernameProperty=Kf,C.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=U$,C.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=p9,C.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=j$,C.removeDisabledReasons=Cme,C.resolveActionDescriptorName=w4,C.resolveArgumentDeclarationValue=zb,C.resolveBaseEntityName=T4,C.resolveBuiltInBaseEntityDataTypeLabel=b4,C.resolveCardSubheader=yme,C.resolveClonedEntityProject=wr,C.resolveConditionOperatorLabel=zh,C.resolveDataType=Hh,C.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=Pb,C.resolveDataTypeLabel=dd,C.resolveDatatypeIconName=hme,C.resolveDefinitionEntityDataTypeLabel=Yce,C.resolveDefinitionEntitySubheader=nA,C.resolveEntityCodeName=ST,C.resolveEntityDataTypeLabel=Hce,C.resolveEntityName=re,C.resolveEntitySubheader=mme,C.resolveFirstCallsSecond=khe,C.resolveFirstWritesSecond=qhe,C.resolveFunctionDeclarationCardSubheader=aA,C.resolveInputMapNextStandaloneValue=eA,C.resolveInputMapNextValue=Dp,C.resolveInputMapNextValueAsPropertyOfAnObject=cx,C.resolveInputMapStandaloneValue=tA,C.resolveInputMapValue=fx,C.resolveInputMapValueAsPropertyOfAnObject=px,C.resolveMethodCardSubheader=wx,C.resolveNextValue=Uy,C.resolveOutputMapValue=Qb,C.resolvePersistedDefinitionEntityDatabaseEntity=KU,C.resolvePrimaryKeyProperty=oye,C.resolvePrimitiveEntityForSearchLiteralValueType=mb,C.resolvePrimitiveEntityName=I4,C.resolvePropertyValue=hx,C.resolvePublicationStepStatusFromType=Bme,C.resolveResourceNameFromType=Lme,C.resolveReturnDeclarationValue=Xb,C.resolveSearchName=A4,C.resolveValue=Ha,C.resolveValueDescriptorValue=yx,C.resolveVarDeclarationAggregateObjectValue=dx,C.resolveVarDeclarationNextAggregateObjectValue=lx,C.resolveVarDeclarationNextValue=gp,C.resolveVarDeclarationValue=Yb,C.resolveVarInstanceNextValue=jy,C.resolveVarInstanceValue=ux,C.resolveVariableScope=Wce,C.returnDeclarationValidation=cpe,C.returnStatementValidation=ppe,C.searchStatementErrorGlobalValueDescriptor=Ov,C.searchStatementErrorGlobalValueDescriptorDataType=GP,C.searchStatementErrorGlobalValueDescriptorRef=FP,C.searchStatementState=dhe,C.searchStatementUtils=che,C.searchValidation=Ape,C.sequentialExecutionOperation=Hn,C.sequentialExecutionOperationError=Wg,C.sequentialExecutionOperationErrorParentRef=Jg,C.sequentialExecutionOperationListOfExecutionResultsDataType=qg,C.sequentialExecutionOperationListOfExecutionResultsReturn=Q0,C.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=Zg,C.sequentialExecutionOperationListOfExecutionResultsReturnRef=kg,C.sequentialExecutionOperationListOfFunctionsArgument=X0,C.sequentialExecutionOperationListOfFunctionsArgumentDatatype=Kg,C.sequentialExecutionOperationListOfFunctionsArgumentParentRef=Sg,C.sequentialExecutionOperationListOfFunctionsArgumentRef=Gg,C.sequentialExecutionOperationListOfFunctionsBlueprint=Fg,C.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=xg,C.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=Ug,C.softDeletePersistedEntityMethod=y9,C.softDeletePersistedEntityMethodParentRef=pP,C.sortCallsBasedOnExecutionDependencies=Jj,C.sortChildrenEntitiesBasedOnExecutionDependencies=Khe,C.splitListOperation=Z0,C.splitListOperationError=G_,C.splitListOperationErrorParentRef=F_,C.splitListOperationFirstOutputListDataType=$_,C.splitListOperationFirstOutputListReturn=M_,C.splitListOperationFirstOutputListReturnParentRef=B_,C.splitListOperationFirstOutputListReturnRef=S0,C.splitListOperationInputListArgument=V_,C.splitListOperationInputListArgumentParentRef=P_,C.splitListOperationInputListArgumentRef=g_,C.splitListOperationInputListDataType=D_,C.splitListOperationSecondOutputListDataType=j_,C.splitListOperationSecondOutputListReturn=x_,C.splitListOperationSecondOutputListReturnParentRef=U_,C.splitListOperationSplitIndexArgument=L_,C.splitListOperationSplitIndexArgumentParentRef=N_,C.splitListOperationSplitIndexArgumentRef=C_,C.splitListOperationSplitIndexDataType=O_,C.splitStringOperation=k0,C.splitStringOperationError=a_,C.splitStringOperationErrorParentRef=n_,C.splitStringOperationFirstPartResultStringDataType=H1,C.splitStringOperationFirstPartResultStringReturn=s_,C.splitStringOperationFirstPartResultStringReturnParentRef=i_,C.splitStringOperationFirstPartResultStringReturnRef=W1,C.splitStringOperationIndexArgument=t_,C.splitStringOperationIndexArgumentParentRef=e_,C.splitStringOperationIndexArgumentRef=Z1,C.splitStringOperationIndexDataType=J1,C.splitStringOperationSecondPartResultStringDataType=z1,C.splitStringOperationSecondPartResultStringReturn=u9,C.splitStringOperationSecondPartResultStringReturnParentRef=r_,C.splitStringOperationSecondPartResultStringReturnRef=Y1,C.splitStringOperationStringArgument=Q1,C.splitStringOperationStringArgumentParentRef=X1,C.splitStringOperationStringArgumentRef=q1,C.splitStringOperationStringDataType=S1,C.stringPrototype=qe,C.stringValueAutogenerationSchema=PE,C.suggestNewIdForEntity=ZT,C.syncSearchEntityOutput=Eb,C.test_primitive_entities_export=zye,C.toCamelCase=Zr,C.toEntityState=wi,C.toKebabCase=E4,C.toLowerCaseKebabCase=Yh,C.toPascalCase=ld,C.transitionProjectVersion=WT,C.translateLogicErrorCode=Tme,C.translateLogicErrorCodeShort=bme,C.translateLogicErrorCodeShortWithEntityName=Ame,C.translateLogicErrorCodeWithEntityName=Ime,C.traverseChangeSet=HT,C.untypedDataPrototype=Yr,C.updateErrorsList=Xt,C.urlDefaultValue=RD,C.uuidPrototype=Jn,C.validateArgumentDeclarationName=kT,C.validateCalledByErrorIdInAction=$he,C.validateCalledByIdInAction=Ohe,C.validateCallers=$j,C.validateConditionEntityDeclaration=Nhe,C.validateDataOperation=mo,C.validateDataOperationDataToValidateArgument=fD,C.validateDataOperationDataToValidateArgumentParentRef=pD,C.validateDataOperationDataToValidateArgumentRef=uD,C.validateDataOperationDataToValidateDataType=cD,C.validateDataOperationEntityToMatchTypeArgument=vD,C.validateDataOperationEntityToMatchTypeArgumentParentRef=mD,C.validateDataOperationEntityToMatchTypeArgumentRef=hD,C.validateDataOperationEntityToMatchTypeDataType=yD,C.validateDataOperationError=AD,C.validateDataOperationErrorParentRef=bD,C.validateDataOperationOutputEntityDeclaration=TD,C.validateDataOperationOutputEntityDeclarationParentRef=ED,C.validateDefinitionEntityName=xT,C.validateEntityValues=Ix,C.validateEntryCaller=Oj,C.validateErrorCaller=Cj,C.validateFunctionCallDeclaration=Vj,C.validateFunctionDeclarationName=FT,C.validateGeneratedEntityParentIsNotBuiltInEntity=_he,C.validateGeneration=whe,C.validateGenerationTarget=Er,C.validateGenerationUpdate=Rhe,C.validateLogic=fme,C.validateLoopEntityDeclaration=Lhe,C.validateName=zce,C.validateOperationEntityDeclaration=Nj,C.validatePropertyName=KT,C.validateReachability=ua,C.validateReadsValueInActionPayload=Phe,C.validateReferenceObject=py,C.validateReferenceToOne=Ab,C.validateReferences=xr,C.validateReturnDeclarationName=qT,C.validateSuccessCaller=Dj,C.validateValueReaderGenerationUpdate=fp,C.validateValueWritter=Db,C.validateVariableDeclarationName=GT,C.validateVariableInternalCallUse=Cb,C.valueAutogenerationCurrentDateAndTimeSchema=OL,C.valueAutogenerationGenericSchema=Ih,C.valueAutogenerationOptions=LE,C.valueAutogenerationOptionsSchema=CL,C.valueAutogenerationRandomBooleanSchema=$E,C.valueAutogenerationRandomDateBetweenSchema=UL,C.valueAutogenerationRandomDateFromSchema=ML,C.valueAutogenerationRandomDateSchema=_h,C.valueAutogenerationRandomDateUntilSchema=jL,C.valueAutogenerationRandomNumberBetweenSchema=VL,C.valueAutogenerationRandomNumberFromSchema=$L,C.valueAutogenerationRandomNumberSchema=wh,C.valueAutogenerationRandomNumberUntilSchema=PL,C.valueAutogenerationRandomSchema=Yu,C.valueAutogenerationRandomTextBetweenSchema=BL,C.valueAutogenerationRandomTextFromSchema=NL,C.valueAutogenerationRandomTextSchema=Rh,C.valueAutogenerationRandomTextUntilSchema=LL,C.valueAutogenerationRangeValueTypesSchema=Hu,C.valueAutogenerationUniqueSchema=OE,C.valueDescriptorValidation=Ihe,C.variableDeclarationValidation=Tpe,C.variableInstanceValidation=bpe,C.waitOperation=Ri,C.waitOperationMillisecondsNumberArgument=ho,C.waitOperationMillisecondsNumberArgumentRef=Pg,C.waitOperationMillisecondsNumberDataType=Vg,C.waitOperationOperationError=Bg,C.waitOperationOperationErrorParentRef=Lg,C.waitOperationRef=Ng,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|